| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 "use strict"; 2 var wp; 3 (wp ||= {}).url = (() => { 4 var __create = Object.create; 5 var __defProp = Object.defineProperty; 6 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 7 var __getOwnPropNames = Object.getOwnPropertyNames; 8 var __getProtoOf = Object.getPrototypeOf; 9 var __hasOwnProp = Object.prototype.hasOwnProperty; 10 var __commonJS = (cb, mod) => function __require() { 11 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 12 }; 13 var __export = (target, all) => { 14 for (var name in all) 15 __defProp(target, name, { get: all[name], enumerable: true }); 16 }; 17 var __copyProps = (to, from, except, desc) => { 18 if (from && typeof from === "object" || typeof from === "function") { 19 for (let key of __getOwnPropNames(from)) 20 if (!__hasOwnProp.call(to, key) && key !== except) 21 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 22 } 23 return to; 24 }; 25 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 26 // If the importer is in node compatibility mode or this is not an ESM 27 // file that has been converted to a CommonJS file using a Babel- 28 // compatible transform (i.e. "__esModule" has not been set), then set 29 // "default" to the CommonJS "module.exports" for node compatibility. 30 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 31 mod 32 )); 33 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 34 35 // node_modules/remove-accents/index.js 36 var require_remove_accents = __commonJS({ 37 "node_modules/remove-accents/index.js"(exports, module) { 38 var characterMap = { 39 "\xC0": "A", 40 "\xC1": "A", 41 "\xC2": "A", 42 "\xC3": "A", 43 "\xC4": "A", 44 "\xC5": "A", 45 "\u1EA4": "A", 46 "\u1EAE": "A", 47 "\u1EB2": "A", 48 "\u1EB4": "A", 49 "\u1EB6": "A", 50 "\xC6": "AE", 51 "\u1EA6": "A", 52 "\u1EB0": "A", 53 "\u0202": "A", 54 "\u1EA2": "A", 55 "\u1EA0": "A", 56 "\u1EA8": "A", 57 "\u1EAA": "A", 58 "\u1EAC": "A", 59 "\xC7": "C", 60 "\u1E08": "C", 61 "\xC8": "E", 62 "\xC9": "E", 63 "\xCA": "E", 64 "\xCB": "E", 65 "\u1EBE": "E", 66 "\u1E16": "E", 67 "\u1EC0": "E", 68 "\u1E14": "E", 69 "\u1E1C": "E", 70 "\u0206": "E", 71 "\u1EBA": "E", 72 "\u1EBC": "E", 73 "\u1EB8": "E", 74 "\u1EC2": "E", 75 "\u1EC4": "E", 76 "\u1EC6": "E", 77 "\xCC": "I", 78 "\xCD": "I", 79 "\xCE": "I", 80 "\xCF": "I", 81 "\u1E2E": "I", 82 "\u020A": "I", 83 "\u1EC8": "I", 84 "\u1ECA": "I", 85 "\xD0": "D", 86 "\xD1": "N", 87 "\xD2": "O", 88 "\xD3": "O", 89 "\xD4": "O", 90 "\xD5": "O", 91 "\xD6": "O", 92 "\xD8": "O", 93 "\u1ED0": "O", 94 "\u1E4C": "O", 95 "\u1E52": "O", 96 "\u020E": "O", 97 "\u1ECE": "O", 98 "\u1ECC": "O", 99 "\u1ED4": "O", 100 "\u1ED6": "O", 101 "\u1ED8": "O", 102 "\u1EDC": "O", 103 "\u1EDE": "O", 104 "\u1EE0": "O", 105 "\u1EDA": "O", 106 "\u1EE2": "O", 107 "\xD9": "U", 108 "\xDA": "U", 109 "\xDB": "U", 110 "\xDC": "U", 111 "\u1EE6": "U", 112 "\u1EE4": "U", 113 "\u1EEC": "U", 114 "\u1EEE": "U", 115 "\u1EF0": "U", 116 "\xDD": "Y", 117 "\xE0": "a", 118 "\xE1": "a", 119 "\xE2": "a", 120 "\xE3": "a", 121 "\xE4": "a", 122 "\xE5": "a", 123 "\u1EA5": "a", 124 "\u1EAF": "a", 125 "\u1EB3": "a", 126 "\u1EB5": "a", 127 "\u1EB7": "a", 128 "\xE6": "ae", 129 "\u1EA7": "a", 130 "\u1EB1": "a", 131 "\u0203": "a", 132 "\u1EA3": "a", 133 "\u1EA1": "a", 134 "\u1EA9": "a", 135 "\u1EAB": "a", 136 "\u1EAD": "a", 137 "\xE7": "c", 138 "\u1E09": "c", 139 "\xE8": "e", 140 "\xE9": "e", 141 "\xEA": "e", 142 "\xEB": "e", 143 "\u1EBF": "e", 144 "\u1E17": "e", 145 "\u1EC1": "e", 146 "\u1E15": "e", 147 "\u1E1D": "e", 148 "\u0207": "e", 149 "\u1EBB": "e", 150 "\u1EBD": "e", 151 "\u1EB9": "e", 152 "\u1EC3": "e", 153 "\u1EC5": "e", 154 "\u1EC7": "e", 155 "\xEC": "i", 156 "\xED": "i", 157 "\xEE": "i", 158 "\xEF": "i", 159 "\u1E2F": "i", 160 "\u020B": "i", 161 "\u1EC9": "i", 162 "\u1ECB": "i", 163 "\xF0": "d", 164 "\xF1": "n", 165 "\xF2": "o", 166 "\xF3": "o", 167 "\xF4": "o", 168 "\xF5": "o", 169 "\xF6": "o", 170 "\xF8": "o", 171 "\u1ED1": "o", 172 "\u1E4D": "o", 173 "\u1E53": "o", 174 "\u020F": "o", 175 "\u1ECF": "o", 176 "\u1ECD": "o", 177 "\u1ED5": "o", 178 "\u1ED7": "o", 179 "\u1ED9": "o", 180 "\u1EDD": "o", 181 "\u1EDF": "o", 182 "\u1EE1": "o", 183 "\u1EDB": "o", 184 "\u1EE3": "o", 185 "\xF9": "u", 186 "\xFA": "u", 187 "\xFB": "u", 188 "\xFC": "u", 189 "\u1EE7": "u", 190 "\u1EE5": "u", 191 "\u1EED": "u", 192 "\u1EEF": "u", 193 "\u1EF1": "u", 194 "\xFD": "y", 195 "\xFF": "y", 196 "\u0100": "A", 197 "\u0101": "a", 198 "\u0102": "A", 199 "\u0103": "a", 200 "\u0104": "A", 201 "\u0105": "a", 202 "\u0106": "C", 203 "\u0107": "c", 204 "\u0108": "C", 205 "\u0109": "c", 206 "\u010A": "C", 207 "\u010B": "c", 208 "\u010C": "C", 209 "\u010D": "c", 210 "C\u0306": "C", 211 "c\u0306": "c", 212 "\u010E": "D", 213 "\u010F": "d", 214 "\u0110": "D", 215 "\u0111": "d", 216 "\u0112": "E", 217 "\u0113": "e", 218 "\u0114": "E", 219 "\u0115": "e", 220 "\u0116": "E", 221 "\u0117": "e", 222 "\u0118": "E", 223 "\u0119": "e", 224 "\u011A": "E", 225 "\u011B": "e", 226 "\u011C": "G", 227 "\u01F4": "G", 228 "\u011D": "g", 229 "\u01F5": "g", 230 "\u011E": "G", 231 "\u011F": "g", 232 "\u0120": "G", 233 "\u0121": "g", 234 "\u0122": "G", 235 "\u0123": "g", 236 "\u0124": "H", 237 "\u0125": "h", 238 "\u0126": "H", 239 "\u0127": "h", 240 "\u1E2A": "H", 241 "\u1E2B": "h", 242 "\u0128": "I", 243 "\u0129": "i", 244 "\u012A": "I", 245 "\u012B": "i", 246 "\u012C": "I", 247 "\u012D": "i", 248 "\u012E": "I", 249 "\u012F": "i", 250 "\u0130": "I", 251 "\u0131": "i", 252 "\u0132": "IJ", 253 "\u0133": "ij", 254 "\u0134": "J", 255 "\u0135": "j", 256 "\u0136": "K", 257 "\u0137": "k", 258 "\u1E30": "K", 259 "\u1E31": "k", 260 "K\u0306": "K", 261 "k\u0306": "k", 262 "\u0139": "L", 263 "\u013A": "l", 264 "\u013B": "L", 265 "\u013C": "l", 266 "\u013D": "L", 267 "\u013E": "l", 268 "\u013F": "L", 269 "\u0140": "l", 270 "\u0141": "l", 271 "\u0142": "l", 272 "\u1E3E": "M", 273 "\u1E3F": "m", 274 "M\u0306": "M", 275 "m\u0306": "m", 276 "\u0143": "N", 277 "\u0144": "n", 278 "\u0145": "N", 279 "\u0146": "n", 280 "\u0147": "N", 281 "\u0148": "n", 282 "\u0149": "n", 283 "N\u0306": "N", 284 "n\u0306": "n", 285 "\u014C": "O", 286 "\u014D": "o", 287 "\u014E": "O", 288 "\u014F": "o", 289 "\u0150": "O", 290 "\u0151": "o", 291 "\u0152": "OE", 292 "\u0153": "oe", 293 "P\u0306": "P", 294 "p\u0306": "p", 295 "\u0154": "R", 296 "\u0155": "r", 297 "\u0156": "R", 298 "\u0157": "r", 299 "\u0158": "R", 300 "\u0159": "r", 301 "R\u0306": "R", 302 "r\u0306": "r", 303 "\u0212": "R", 304 "\u0213": "r", 305 "\u015A": "S", 306 "\u015B": "s", 307 "\u015C": "S", 308 "\u015D": "s", 309 "\u015E": "S", 310 "\u0218": "S", 311 "\u0219": "s", 312 "\u015F": "s", 313 "\u0160": "S", 314 "\u0161": "s", 315 "\u0162": "T", 316 "\u0163": "t", 317 "\u021B": "t", 318 "\u021A": "T", 319 "\u0164": "T", 320 "\u0165": "t", 321 "\u0166": "T", 322 "\u0167": "t", 323 "T\u0306": "T", 324 "t\u0306": "t", 325 "\u0168": "U", 326 "\u0169": "u", 327 "\u016A": "U", 328 "\u016B": "u", 329 "\u016C": "U", 330 "\u016D": "u", 331 "\u016E": "U", 332 "\u016F": "u", 333 "\u0170": "U", 334 "\u0171": "u", 335 "\u0172": "U", 336 "\u0173": "u", 337 "\u0216": "U", 338 "\u0217": "u", 339 "V\u0306": "V", 340 "v\u0306": "v", 341 "\u0174": "W", 342 "\u0175": "w", 343 "\u1E82": "W", 344 "\u1E83": "w", 345 "X\u0306": "X", 346 "x\u0306": "x", 347 "\u0176": "Y", 348 "\u0177": "y", 349 "\u0178": "Y", 350 "Y\u0306": "Y", 351 "y\u0306": "y", 352 "\u0179": "Z", 353 "\u017A": "z", 354 "\u017B": "Z", 355 "\u017C": "z", 356 "\u017D": "Z", 357 "\u017E": "z", 358 "\u017F": "s", 359 "\u0192": "f", 360 "\u01A0": "O", 361 "\u01A1": "o", 362 "\u01AF": "U", 363 "\u01B0": "u", 364 "\u01CD": "A", 365 "\u01CE": "a", 366 "\u01CF": "I", 367 "\u01D0": "i", 368 "\u01D1": "O", 369 "\u01D2": "o", 370 "\u01D3": "U", 371 "\u01D4": "u", 372 "\u01D5": "U", 373 "\u01D6": "u", 374 "\u01D7": "U", 375 "\u01D8": "u", 376 "\u01D9": "U", 377 "\u01DA": "u", 378 "\u01DB": "U", 379 "\u01DC": "u", 380 "\u1EE8": "U", 381 "\u1EE9": "u", 382 "\u1E78": "U", 383 "\u1E79": "u", 384 "\u01FA": "A", 385 "\u01FB": "a", 386 "\u01FC": "AE", 387 "\u01FD": "ae", 388 "\u01FE": "O", 389 "\u01FF": "o", 390 "\xDE": "TH", 391 "\xFE": "th", 392 "\u1E54": "P", 393 "\u1E55": "p", 394 "\u1E64": "S", 395 "\u1E65": "s", 396 "X\u0301": "X", 397 "x\u0301": "x", 398 "\u0403": "\u0413", 399 "\u0453": "\u0433", 400 "\u040C": "\u041A", 401 "\u045C": "\u043A", 402 "A\u030B": "A", 403 "a\u030B": "a", 404 "E\u030B": "E", 405 "e\u030B": "e", 406 "I\u030B": "I", 407 "i\u030B": "i", 408 "\u01F8": "N", 409 "\u01F9": "n", 410 "\u1ED2": "O", 411 "\u1ED3": "o", 412 "\u1E50": "O", 413 "\u1E51": "o", 414 "\u1EEA": "U", 415 "\u1EEB": "u", 416 "\u1E80": "W", 417 "\u1E81": "w", 418 "\u1EF2": "Y", 419 "\u1EF3": "y", 420 "\u0200": "A", 421 "\u0201": "a", 422 "\u0204": "E", 423 "\u0205": "e", 424 "\u0208": "I", 425 "\u0209": "i", 426 "\u020C": "O", 427 "\u020D": "o", 428 "\u0210": "R", 429 "\u0211": "r", 430 "\u0214": "U", 431 "\u0215": "u", 432 "B\u030C": "B", 433 "b\u030C": "b", 434 "\u010C\u0323": "C", 435 "\u010D\u0323": "c", 436 "\xCA\u030C": "E", 437 "\xEA\u030C": "e", 438 "F\u030C": "F", 439 "f\u030C": "f", 440 "\u01E6": "G", 441 "\u01E7": "g", 442 "\u021E": "H", 443 "\u021F": "h", 444 "J\u030C": "J", 445 "\u01F0": "j", 446 "\u01E8": "K", 447 "\u01E9": "k", 448 "M\u030C": "M", 449 "m\u030C": "m", 450 "P\u030C": "P", 451 "p\u030C": "p", 452 "Q\u030C": "Q", 453 "q\u030C": "q", 454 "\u0158\u0329": "R", 455 "\u0159\u0329": "r", 456 "\u1E66": "S", 457 "\u1E67": "s", 458 "V\u030C": "V", 459 "v\u030C": "v", 460 "W\u030C": "W", 461 "w\u030C": "w", 462 "X\u030C": "X", 463 "x\u030C": "x", 464 "Y\u030C": "Y", 465 "y\u030C": "y", 466 "A\u0327": "A", 467 "a\u0327": "a", 468 "B\u0327": "B", 469 "b\u0327": "b", 470 "\u1E10": "D", 471 "\u1E11": "d", 472 "\u0228": "E", 473 "\u0229": "e", 474 "\u0190\u0327": "E", 475 "\u025B\u0327": "e", 476 "\u1E28": "H", 477 "\u1E29": "h", 478 "I\u0327": "I", 479 "i\u0327": "i", 480 "\u0197\u0327": "I", 481 "\u0268\u0327": "i", 482 "M\u0327": "M", 483 "m\u0327": "m", 484 "O\u0327": "O", 485 "o\u0327": "o", 486 "Q\u0327": "Q", 487 "q\u0327": "q", 488 "U\u0327": "U", 489 "u\u0327": "u", 490 "X\u0327": "X", 491 "x\u0327": "x", 492 "Z\u0327": "Z", 493 "z\u0327": "z", 494 "\u0439": "\u0438", 495 "\u0419": "\u0418", 496 "\u0451": "\u0435", 497 "\u0401": "\u0415" 498 }; 499 var chars = Object.keys(characterMap).join("|"); 500 var allAccents = new RegExp(chars, "g"); 501 var firstAccent = new RegExp(chars, ""); 502 function matcher(match) { 503 return characterMap[match]; 504 } 505 var removeAccents2 = function(string) { 506 return string.replace(allAccents, matcher); 507 }; 508 var hasAccents = function(string) { 509 return !!string.match(firstAccent); 510 }; 511 module.exports = removeAccents2; 512 module.exports.has = hasAccents; 513 module.exports.remove = removeAccents2; 514 } 515 }); 516 517 // packages/url/build-module/index.js 518 var index_exports = {}; 519 __export(index_exports, { 520 addQueryArgs: () => addQueryArgs, 521 buildQueryString: () => buildQueryString, 522 cleanForSlug: () => cleanForSlug, 523 filterURLForDisplay: () => filterURLForDisplay, 524 getAuthority: () => getAuthority, 525 getFilename: () => getFilename, 526 getFragment: () => getFragment, 527 getPath: () => getPath, 528 getPathAndQueryString: () => getPathAndQueryString, 529 getProtocol: () => getProtocol, 530 getQueryArg: () => getQueryArg, 531 getQueryArgs: () => getQueryArgs, 532 getQueryString: () => getQueryString, 533 hasQueryArg: () => hasQueryArg, 534 isEmail: () => isEmail, 535 isPhoneNumber: () => isPhoneNumber, 536 isURL: () => isURL, 537 isValidAuthority: () => isValidAuthority, 538 isValidFragment: () => isValidFragment, 539 isValidPath: () => isValidPath, 540 isValidProtocol: () => isValidProtocol, 541 isValidQueryString: () => isValidQueryString, 542 normalizePath: () => normalizePath, 543 prependHTTP: () => prependHTTP, 544 prependHTTPS: () => prependHTTPS, 545 removeQueryArgs: () => removeQueryArgs, 546 safeDecodeURI: () => safeDecodeURI, 547 safeDecodeURIComponent: () => safeDecodeURIComponent 548 }); 549 550 // packages/url/build-module/is-url.js 551 function isURL(url) { 552 try { 553 new URL(url); 554 return true; 555 } catch { 556 return false; 557 } 558 } 559 560 // packages/url/build-module/is-email.js 561 var EMAIL_REGEXP = /^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i; 562 function isEmail(email) { 563 return EMAIL_REGEXP.test(email); 564 } 565 566 // packages/url/build-module/is-phone-number.js 567 var PHONE_REGEXP = /^(tel:)?(\+)?\d{6,15}$/; 568 function isPhoneNumber(phoneNumber) { 569 phoneNumber = phoneNumber.replace(/[-.() ]/g, ""); 570 return PHONE_REGEXP.test(phoneNumber); 571 } 572 573 // packages/url/build-module/get-protocol.js 574 function getProtocol(url) { 575 const matches = /^([^\s:]+:)/.exec(url); 576 if (matches) { 577 return matches[1]; 578 } 579 } 580 581 // packages/url/build-module/is-valid-protocol.js 582 function isValidProtocol(protocol) { 583 if (!protocol) { 584 return false; 585 } 586 return /^[a-z\-.\+]+[0-9]*:$/i.test(protocol); 587 } 588 589 // packages/url/build-module/get-authority.js 590 function getAuthority(url) { 591 const matches = /^[^\/\s:]+:(?:\/\/)?\/?([^\/\s#?]+)[\/#?]{0,1}\S*$/.exec( 592 url 593 ); 594 if (matches) { 595 return matches[1]; 596 } 597 } 598 599 // packages/url/build-module/is-valid-authority.js 600 function isValidAuthority(authority) { 601 if (!authority) { 602 return false; 603 } 604 return /^[^\s#?]+$/.test(authority); 605 } 606 607 // packages/url/build-module/get-path.js 608 function getPath(url) { 609 const matches = /^[^\/\s:]+:(?:\/\/)?[^\/\s#?]+[\/]([^\s#?]+)[#?]{0,1}\S*$/.exec(url); 610 if (matches) { 611 return matches[1]; 612 } 613 } 614 615 // packages/url/build-module/is-valid-path.js 616 function isValidPath(path) { 617 if (!path) { 618 return false; 619 } 620 return /^[^\s#?]+$/.test(path); 621 } 622 623 // packages/url/build-module/get-query-string.js 624 function getQueryString(url) { 625 let query; 626 try { 627 query = new URL(url, "http://example.com").search.substring(1); 628 } catch (error) { 629 } 630 if (query) { 631 return query; 632 } 633 } 634 635 // packages/url/build-module/build-query-string.js 636 function buildQueryString(data) { 637 let string = ""; 638 const stack = Object.entries(data); 639 let pair; 640 while (pair = stack.shift()) { 641 let [key, value] = pair; 642 const hasNestedData = Array.isArray(value) || value && value.constructor === Object; 643 if (hasNestedData) { 644 const valuePairs = Object.entries(value).reverse(); 645 for (const [member, memberValue] of valuePairs) { 646 stack.unshift([`$key}[$member}]`, memberValue]); 647 } 648 } else if (value !== void 0) { 649 if (value === null) { 650 value = ""; 651 } 652 string += "&" + [key, String(value)].map(encodeURIComponent).join("="); 653 } 654 } 655 return string.substr(1); 656 } 657 658 // packages/url/build-module/is-valid-query-string.js 659 function isValidQueryString(queryString) { 660 if (!queryString) { 661 return false; 662 } 663 return /^[^\s#?\/]+$/.test(queryString); 664 } 665 666 // packages/url/build-module/get-path-and-query-string.js 667 function getPathAndQueryString(url) { 668 const path = getPath(url); 669 const queryString = getQueryString(url); 670 let value = "/"; 671 if (path) { 672 value += path; 673 } 674 if (queryString) { 675 value += `?$queryString}`; 676 } 677 return value; 678 } 679 680 // packages/url/build-module/get-fragment.js 681 function getFragment(url) { 682 const matches = /^\S+?(#[^\s\?]*)/.exec(url); 683 if (matches) { 684 return matches[1]; 685 } 686 } 687 688 // packages/url/build-module/is-valid-fragment.js 689 function isValidFragment(fragment) { 690 if (!fragment) { 691 return false; 692 } 693 return /^#[^\s#?\/]*$/.test(fragment); 694 } 695 696 // packages/url/build-module/safe-decode-uri-component.js 697 function safeDecodeURIComponent(uriComponent) { 698 try { 699 return decodeURIComponent(uriComponent); 700 } catch (uriComponentError) { 701 return uriComponent; 702 } 703 } 704 705 // packages/url/build-module/get-query-args.js 706 function setPath(object, path, value) { 707 const length = path.length; 708 const lastIndex = length - 1; 709 for (let i = 0; i < length; i++) { 710 let key = path[i]; 711 if (!key && Array.isArray(object)) { 712 key = object.length.toString(); 713 } 714 key = ["__proto__", "constructor", "prototype"].includes(key) ? key.toUpperCase() : key; 715 const isNextKeyArrayIndex = !isNaN(Number(path[i + 1])); 716 object[key] = i === lastIndex ? ( 717 // If at end of path, assign the intended value. 718 value 719 ) : ( 720 // Otherwise, advance to the next object in the path, creating 721 // it if it does not yet exist. 722 object[key] || (isNextKeyArrayIndex ? [] : {}) 723 ); 724 if (Array.isArray(object[key]) && !isNextKeyArrayIndex) { 725 object[key] = { ...object[key] }; 726 } 727 object = object[key]; 728 } 729 } 730 function getQueryArgs(url) { 731 return (getQueryString(url) || "").replace(/\+/g, "%20").split("&").reduce((accumulator, keyValue) => { 732 const [key, value = ""] = keyValue.split("=").filter(Boolean).map(safeDecodeURIComponent); 733 if (key) { 734 const segments = key.replace(/\]/g, "").split("["); 735 setPath(accumulator, segments, value); 736 } 737 return accumulator; 738 }, /* @__PURE__ */ Object.create(null)); 739 } 740 741 // packages/url/build-module/add-query-args.js 742 function addQueryArgs(url = "", args) { 743 if (!args || !Object.keys(args).length) { 744 return url; 745 } 746 const fragment = getFragment(url) || ""; 747 let baseUrl = url.replace(fragment, ""); 748 const queryStringIndex = url.indexOf("?"); 749 if (queryStringIndex !== -1) { 750 args = Object.assign(getQueryArgs(url), args); 751 baseUrl = baseUrl.substr(0, queryStringIndex); 752 } 753 return baseUrl + "?" + buildQueryString(args) + fragment; 754 } 755 756 // packages/url/build-module/get-query-arg.js 757 function getQueryArg(url, arg) { 758 return getQueryArgs(url)[arg]; 759 } 760 761 // packages/url/build-module/has-query-arg.js 762 function hasQueryArg(url, arg) { 763 return getQueryArg(url, arg) !== void 0; 764 } 765 766 // packages/url/build-module/remove-query-args.js 767 function removeQueryArgs(url, ...args) { 768 const fragment = url.replace(/^[^#]*/, ""); 769 url = url.replace(/#.*/, ""); 770 const queryStringIndex = url.indexOf("?"); 771 if (queryStringIndex === -1) { 772 return url + fragment; 773 } 774 const query = getQueryArgs(url); 775 const baseURL = url.substr(0, queryStringIndex); 776 args.forEach((arg) => delete query[arg]); 777 const queryString = buildQueryString(query); 778 const updatedUrl = queryString ? baseURL + "?" + queryString : baseURL; 779 return updatedUrl + fragment; 780 } 781 782 // packages/url/build-module/prepend-http.js 783 var USABLE_HREF_REGEXP = /^(?:[a-z]+:|#|\?|\.|\/)/i; 784 function prependHTTP(url) { 785 if (!url) { 786 return url; 787 } 788 url = url.trim(); 789 if (!USABLE_HREF_REGEXP.test(url) && !isEmail(url)) { 790 return "http://" + url; 791 } 792 return url; 793 } 794 795 // packages/url/build-module/safe-decode-uri.js 796 function safeDecodeURI(uri) { 797 try { 798 return decodeURI(uri); 799 } catch (uriError) { 800 return uri; 801 } 802 } 803 804 // packages/url/build-module/filter-url-for-display.js 805 function filterURLForDisplay(url, maxLength = null) { 806 if (!url) { 807 return ""; 808 } 809 let filteredURL = url.replace(/^[a-z\-.\+]+[0-9]*:(\/\/)?/i, "").replace(/^www\./i, ""); 810 if (filteredURL.match(/^[^\/]+\/$/)) { 811 filteredURL = filteredURL.replace("/", ""); 812 } 813 const fileRegexp = /\/([^\/?]+)\.(?:[\w]+)(?=\?|$)/; 814 if (!maxLength || filteredURL.length <= maxLength || !filteredURL.match(fileRegexp)) { 815 return filteredURL; 816 } 817 filteredURL = filteredURL.split("?")[0]; 818 const urlPieces = filteredURL.split("/"); 819 const file = urlPieces[urlPieces.length - 1]; 820 if (file.length <= maxLength) { 821 return "\u2026" + filteredURL.slice(-maxLength); 822 } 823 const index = file.lastIndexOf("."); 824 const [fileName, extension] = [ 825 file.slice(0, index), 826 file.slice(index + 1) 827 ]; 828 const truncatedFile = fileName.slice(-3) + "." + extension; 829 return file.slice(0, maxLength - truncatedFile.length - 1) + "\u2026" + truncatedFile; 830 } 831 832 // packages/url/build-module/clean-for-slug.js 833 var import_remove_accents = __toESM(require_remove_accents()); 834 function cleanForSlug(string) { 835 if (!string) { 836 return ""; 837 } 838 return (0, import_remove_accents.default)(string).replace(/( |–|—)/g, "-").replace(/[\s\./]+/g, "-").replace(/&\S+?;/g, "").replace(/[^\p{L}\p{N}_-]+/gu, "").toLowerCase().replace(/-+/g, "-").replace(/(^-+)|(-+$)/g, ""); 839 } 840 841 // packages/url/build-module/get-filename.js 842 function getFilename(url) { 843 let filename; 844 if (!url) { 845 return; 846 } 847 try { 848 filename = new URL(url, "http://example.com").pathname.split("/").pop(); 849 } catch (error) { 850 } 851 if (filename) { 852 return filename; 853 } 854 } 855 856 // packages/url/build-module/normalize-path.js 857 function normalizePath(path) { 858 const split = path.split("?"); 859 const query = split[1]; 860 const base = split[0]; 861 if (!query) { 862 return base; 863 } 864 return base + "?" + query.split("&").map((entry) => entry.split("=")).map((pair) => pair.map(decodeURIComponent)).sort((a, b) => a[0].localeCompare(b[0])).map((pair) => pair.map(encodeURIComponent)).map((pair) => pair.join("=")).join("&"); 865 } 866 867 // packages/url/build-module/prepend-https.js 868 function prependHTTPS(url) { 869 if (!url) { 870 return url; 871 } 872 if (url.startsWith("http://")) { 873 return url; 874 } 875 url = prependHTTP(url); 876 return url.replace(/^http:/, "https:"); 877 } 878 return __toCommonJS(index_exports); 879 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Wed Apr 15 08:20:10 2026 | Cross-referenced by PHPXref |