[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ var __webpack_modules__ = ({ 3 4 /***/ 2058: 5 /***/ ((module, exports, __webpack_require__) => { 6 7 var __WEBPACK_AMD_DEFINE_RESULT__;/* global window, exports, define */ 8 9 !function() { 10 'use strict' 11 12 var re = { 13 not_string: /[^s]/, 14 not_bool: /[^t]/, 15 not_type: /[^T]/, 16 not_primitive: /[^v]/, 17 number: /[diefg]/, 18 numeric_arg: /[bcdiefguxX]/, 19 json: /[j]/, 20 not_json: /[^j]/, 21 text: /^[^\x25]+/, 22 modulo: /^\x25{2}/, 23 placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/, 24 key: /^([a-z_][a-z_\d]*)/i, 25 key_access: /^\.([a-z_][a-z_\d]*)/i, 26 index_access: /^\[(\d+)\]/, 27 sign: /^[+-]/ 28 } 29 30 function sprintf(key) { 31 // `arguments` is not an array, but should be fine for this call 32 return sprintf_format(sprintf_parse(key), arguments) 33 } 34 35 function vsprintf(fmt, argv) { 36 return sprintf.apply(null, [fmt].concat(argv || [])) 37 } 38 39 function sprintf_format(parse_tree, argv) { 40 var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, ph, pad, pad_character, pad_length, is_positive, sign 41 for (i = 0; i < tree_length; i++) { 42 if (typeof parse_tree[i] === 'string') { 43 output += parse_tree[i] 44 } 45 else if (typeof parse_tree[i] === 'object') { 46 ph = parse_tree[i] // convenience purposes only 47 if (ph.keys) { // keyword argument 48 arg = argv[cursor] 49 for (k = 0; k < ph.keys.length; k++) { 50 if (arg == undefined) { 51 throw new Error(sprintf('[sprintf] Cannot access property "%s" of undefined value "%s"', ph.keys[k], ph.keys[k-1])) 52 } 53 arg = arg[ph.keys[k]] 54 } 55 } 56 else if (ph.param_no) { // positional argument (explicit) 57 arg = argv[ph.param_no] 58 } 59 else { // positional argument (implicit) 60 arg = argv[cursor++] 61 } 62 63 if (re.not_type.test(ph.type) && re.not_primitive.test(ph.type) && arg instanceof Function) { 64 arg = arg() 65 } 66 67 if (re.numeric_arg.test(ph.type) && (typeof arg !== 'number' && isNaN(arg))) { 68 throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg)) 69 } 70 71 if (re.number.test(ph.type)) { 72 is_positive = arg >= 0 73 } 74 75 switch (ph.type) { 76 case 'b': 77 arg = parseInt(arg, 10).toString(2) 78 break 79 case 'c': 80 arg = String.fromCharCode(parseInt(arg, 10)) 81 break 82 case 'd': 83 case 'i': 84 arg = parseInt(arg, 10) 85 break 86 case 'j': 87 arg = JSON.stringify(arg, null, ph.width ? parseInt(ph.width) : 0) 88 break 89 case 'e': 90 arg = ph.precision ? parseFloat(arg).toExponential(ph.precision) : parseFloat(arg).toExponential() 91 break 92 case 'f': 93 arg = ph.precision ? parseFloat(arg).toFixed(ph.precision) : parseFloat(arg) 94 break 95 case 'g': 96 arg = ph.precision ? String(Number(arg.toPrecision(ph.precision))) : parseFloat(arg) 97 break 98 case 'o': 99 arg = (parseInt(arg, 10) >>> 0).toString(8) 100 break 101 case 's': 102 arg = String(arg) 103 arg = (ph.precision ? arg.substring(0, ph.precision) : arg) 104 break 105 case 't': 106 arg = String(!!arg) 107 arg = (ph.precision ? arg.substring(0, ph.precision) : arg) 108 break 109 case 'T': 110 arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase() 111 arg = (ph.precision ? arg.substring(0, ph.precision) : arg) 112 break 113 case 'u': 114 arg = parseInt(arg, 10) >>> 0 115 break 116 case 'v': 117 arg = arg.valueOf() 118 arg = (ph.precision ? arg.substring(0, ph.precision) : arg) 119 break 120 case 'x': 121 arg = (parseInt(arg, 10) >>> 0).toString(16) 122 break 123 case 'X': 124 arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase() 125 break 126 } 127 if (re.json.test(ph.type)) { 128 output += arg 129 } 130 else { 131 if (re.number.test(ph.type) && (!is_positive || ph.sign)) { 132 sign = is_positive ? '+' : '-' 133 arg = arg.toString().replace(re.sign, '') 134 } 135 else { 136 sign = '' 137 } 138 pad_character = ph.pad_char ? ph.pad_char === '0' ? '0' : ph.pad_char.charAt(1) : ' ' 139 pad_length = ph.width - (sign + arg).length 140 pad = ph.width ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : '' 141 output += ph.align ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg) 142 } 143 } 144 } 145 return output 146 } 147 148 var sprintf_cache = Object.create(null) 149 150 function sprintf_parse(fmt) { 151 if (sprintf_cache[fmt]) { 152 return sprintf_cache[fmt] 153 } 154 155 var _fmt = fmt, match, parse_tree = [], arg_names = 0 156 while (_fmt) { 157 if ((match = re.text.exec(_fmt)) !== null) { 158 parse_tree.push(match[0]) 159 } 160 else if ((match = re.modulo.exec(_fmt)) !== null) { 161 parse_tree.push('%') 162 } 163 else if ((match = re.placeholder.exec(_fmt)) !== null) { 164 if (match[2]) { 165 arg_names |= 1 166 var field_list = [], replacement_field = match[2], field_match = [] 167 if ((field_match = re.key.exec(replacement_field)) !== null) { 168 field_list.push(field_match[1]) 169 while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') { 170 if ((field_match = re.key_access.exec(replacement_field)) !== null) { 171 field_list.push(field_match[1]) 172 } 173 else if ((field_match = re.index_access.exec(replacement_field)) !== null) { 174 field_list.push(field_match[1]) 175 } 176 else { 177 throw new SyntaxError('[sprintf] failed to parse named argument key') 178 } 179 } 180 } 181 else { 182 throw new SyntaxError('[sprintf] failed to parse named argument key') 183 } 184 match[2] = field_list 185 } 186 else { 187 arg_names |= 2 188 } 189 if (arg_names === 3) { 190 throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported') 191 } 192 193 parse_tree.push( 194 { 195 placeholder: match[0], 196 param_no: match[1], 197 keys: match[2], 198 sign: match[3], 199 pad_char: match[4], 200 align: match[5], 201 width: match[6], 202 precision: match[7], 203 type: match[8] 204 } 205 ) 206 } 207 else { 208 throw new SyntaxError('[sprintf] unexpected placeholder') 209 } 210 _fmt = _fmt.substring(match[0].length) 211 } 212 return sprintf_cache[fmt] = parse_tree 213 } 214 215 /** 216 * export to either browser or node.js 217 */ 218 /* eslint-disable quote-props */ 219 if (true) { 220 exports.sprintf = sprintf 221 exports.vsprintf = vsprintf 222 } 223 if (typeof window !== 'undefined') { 224 window['sprintf'] = sprintf 225 window['vsprintf'] = vsprintf 226 227 if (true) { 228 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { 229 return { 230 'sprintf': sprintf, 231 'vsprintf': vsprintf 232 } 233 }).call(exports, __webpack_require__, exports, module), 234 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) 235 } 236 } 237 /* eslint-enable quote-props */ 238 }(); // eslint-disable-line 239 240 241 /***/ }) 242 243 /******/ }); 244 /************************************************************************/ 245 /******/ // The module cache 246 /******/ var __webpack_module_cache__ = {}; 247 /******/ 248 /******/ // The require function 249 /******/ function __webpack_require__(moduleId) { 250 /******/ // Check if module is in cache 251 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 252 /******/ if (cachedModule !== undefined) { 253 /******/ return cachedModule.exports; 254 /******/ } 255 /******/ // Create a new module (and put it into the cache) 256 /******/ var module = __webpack_module_cache__[moduleId] = { 257 /******/ // no module.id needed 258 /******/ // no module.loaded needed 259 /******/ exports: {} 260 /******/ }; 261 /******/ 262 /******/ // Execute the module function 263 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 264 /******/ 265 /******/ // Return the exports of the module 266 /******/ return module.exports; 267 /******/ } 268 /******/ 269 /************************************************************************/ 270 /******/ /* webpack/runtime/compat get default export */ 271 /******/ (() => { 272 /******/ // getDefaultExport function for compatibility with non-harmony modules 273 /******/ __webpack_require__.n = (module) => { 274 /******/ var getter = module && module.__esModule ? 275 /******/ () => (module['default']) : 276 /******/ () => (module); 277 /******/ __webpack_require__.d(getter, { a: getter }); 278 /******/ return getter; 279 /******/ }; 280 /******/ })(); 281 /******/ 282 /******/ /* webpack/runtime/define property getters */ 283 /******/ (() => { 284 /******/ // define getter functions for harmony exports 285 /******/ __webpack_require__.d = (exports, definition) => { 286 /******/ for(var key in definition) { 287 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 288 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 289 /******/ } 290 /******/ } 291 /******/ }; 292 /******/ })(); 293 /******/ 294 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 295 /******/ (() => { 296 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 297 /******/ })(); 298 /******/ 299 /******/ /* webpack/runtime/make namespace object */ 300 /******/ (() => { 301 /******/ // define __esModule on exports 302 /******/ __webpack_require__.r = (exports) => { 303 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 304 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 305 /******/ } 306 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 307 /******/ }; 308 /******/ })(); 309 /******/ 310 /************************************************************************/ 311 var __webpack_exports__ = {}; 312 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. 313 (() => { 314 "use strict"; 315 // ESM COMPAT FLAG 316 __webpack_require__.r(__webpack_exports__); 317 318 // EXPORTS 319 __webpack_require__.d(__webpack_exports__, { 320 __: () => (/* reexport */ __), 321 _n: () => (/* reexport */ _n), 322 _nx: () => (/* reexport */ _nx), 323 _x: () => (/* reexport */ _x), 324 createI18n: () => (/* reexport */ createI18n), 325 defaultI18n: () => (/* reexport */ default_i18n), 326 getLocaleData: () => (/* reexport */ getLocaleData), 327 hasTranslation: () => (/* reexport */ hasTranslation), 328 isRTL: () => (/* reexport */ isRTL), 329 resetLocaleData: () => (/* reexport */ resetLocaleData), 330 setLocaleData: () => (/* reexport */ setLocaleData), 331 sprintf: () => (/* reexport */ sprintf_sprintf), 332 subscribe: () => (/* reexport */ subscribe) 333 }); 334 335 ;// ./node_modules/memize/dist/index.js 336 /** 337 * Memize options object. 338 * 339 * @typedef MemizeOptions 340 * 341 * @property {number} [maxSize] Maximum size of the cache. 342 */ 343 344 /** 345 * Internal cache entry. 346 * 347 * @typedef MemizeCacheNode 348 * 349 * @property {?MemizeCacheNode|undefined} [prev] Previous node. 350 * @property {?MemizeCacheNode|undefined} [next] Next node. 351 * @property {Array<*>} args Function arguments for cache 352 * entry. 353 * @property {*} val Function result. 354 */ 355 356 /** 357 * Properties of the enhanced function for controlling cache. 358 * 359 * @typedef MemizeMemoizedFunction 360 * 361 * @property {()=>void} clear Clear the cache. 362 */ 363 364 /** 365 * Accepts a function to be memoized, and returns a new memoized function, with 366 * optional options. 367 * 368 * @template {(...args: any[]) => any} F 369 * 370 * @param {F} fn Function to memoize. 371 * @param {MemizeOptions} [options] Options object. 372 * 373 * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function. 374 */ 375 function memize(fn, options) { 376 var size = 0; 377 378 /** @type {?MemizeCacheNode|undefined} */ 379 var head; 380 381 /** @type {?MemizeCacheNode|undefined} */ 382 var tail; 383 384 options = options || {}; 385 386 function memoized(/* ...args */) { 387 var node = head, 388 len = arguments.length, 389 args, 390 i; 391 392 searchCache: while (node) { 393 // Perform a shallow equality test to confirm that whether the node 394 // under test is a candidate for the arguments passed. Two arrays 395 // are shallowly equal if their length matches and each entry is 396 // strictly equal between the two sets. Avoid abstracting to a 397 // function which could incur an arguments leaking deoptimization. 398 399 // Check whether node arguments match arguments length 400 if (node.args.length !== arguments.length) { 401 node = node.next; 402 continue; 403 } 404 405 // Check whether node arguments match arguments values 406 for (i = 0; i < len; i++) { 407 if (node.args[i] !== arguments[i]) { 408 node = node.next; 409 continue searchCache; 410 } 411 } 412 413 // At this point we can assume we've found a match 414 415 // Surface matched node to head if not already 416 if (node !== head) { 417 // As tail, shift to previous. Must only shift if not also 418 // head, since if both head and tail, there is no previous. 419 if (node === tail) { 420 tail = node.prev; 421 } 422 423 // Adjust siblings to point to each other. If node was tail, 424 // this also handles new tail's empty `next` assignment. 425 /** @type {MemizeCacheNode} */ (node.prev).next = node.next; 426 if (node.next) { 427 node.next.prev = node.prev; 428 } 429 430 node.next = head; 431 node.prev = null; 432 /** @type {MemizeCacheNode} */ (head).prev = node; 433 head = node; 434 } 435 436 // Return immediately 437 return node.val; 438 } 439 440 // No cached value found. Continue to insertion phase: 441 442 // Create a copy of arguments (avoid leaking deoptimization) 443 args = new Array(len); 444 for (i = 0; i < len; i++) { 445 args[i] = arguments[i]; 446 } 447 448 node = { 449 args: args, 450 451 // Generate the result from original function 452 val: fn.apply(null, args), 453 }; 454 455 // Don't need to check whether node is already head, since it would 456 // have been returned above already if it was 457 458 // Shift existing head down list 459 if (head) { 460 head.prev = node; 461 node.next = head; 462 } else { 463 // If no head, follows that there's no tail (at initial or reset) 464 tail = node; 465 } 466 467 // Trim tail if we're reached max size and are pending cache insertion 468 if (size === /** @type {MemizeOptions} */ (options).maxSize) { 469 tail = /** @type {MemizeCacheNode} */ (tail).prev; 470 /** @type {MemizeCacheNode} */ (tail).next = null; 471 } else { 472 size++; 473 } 474 475 head = node; 476 477 return node.val; 478 } 479 480 memoized.clear = function () { 481 head = null; 482 tail = null; 483 size = 0; 484 }; 485 486 // Ignore reason: There's not a clear solution to create an intersection of 487 // the function with additional properties, where the goal is to retain the 488 // function signature of the incoming argument and add control properties 489 // on the return value. 490 491 // @ts-ignore 492 return memoized; 493 } 494 495 496 497 // EXTERNAL MODULE: ./node_modules/sprintf-js/src/sprintf.js 498 var sprintf = __webpack_require__(2058); 499 var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf); 500 ;// ./node_modules/@wordpress/i18n/build-module/sprintf.js 501 /** 502 * External dependencies 503 */ 504 505 506 507 /** 508 * Log to console, once per message; or more precisely, per referentially equal 509 * argument set. Because Jed throws errors, we log these to the console instead 510 * to avoid crashing the application. 511 * 512 * @param {...*} args Arguments to pass to `console.error` 513 */ 514 const logErrorOnce = memize(console.error); // eslint-disable-line no-console 515 516 /** 517 * Returns a formatted string. If an error occurs in applying the format, the 518 * original format string is returned. 519 * 520 * @param {string} format The format of the string to generate. 521 * @param {...*} args Arguments to apply to the format. 522 * 523 * @see https://www.npmjs.com/package/sprintf-js 524 * 525 * @return {string} The formatted string. 526 */ 527 function sprintf_sprintf(format, ...args) { 528 try { 529 return sprintf_default().sprintf(format, ...args); 530 } catch (error) { 531 if (error instanceof Error) { 532 logErrorOnce('sprintf error: \n\n' + error.toString()); 533 } 534 return format; 535 } 536 } 537 538 ;// ./node_modules/@tannin/postfix/index.js 539 var PRECEDENCE, OPENERS, TERMINATORS, PATTERN; 540 541 /** 542 * Operator precedence mapping. 543 * 544 * @type {Object} 545 */ 546 PRECEDENCE = { 547 '(': 9, 548 '!': 8, 549 '*': 7, 550 '/': 7, 551 '%': 7, 552 '+': 6, 553 '-': 6, 554 '<': 5, 555 '<=': 5, 556 '>': 5, 557 '>=': 5, 558 '==': 4, 559 '!=': 4, 560 '&&': 3, 561 '||': 2, 562 '?': 1, 563 '?:': 1, 564 }; 565 566 /** 567 * Characters which signal pair opening, to be terminated by terminators. 568 * 569 * @type {string[]} 570 */ 571 OPENERS = [ '(', '?' ]; 572 573 /** 574 * Characters which signal pair termination, the value an array with the 575 * opener as its first member. The second member is an optional operator 576 * replacement to push to the stack. 577 * 578 * @type {string[]} 579 */ 580 TERMINATORS = { 581 ')': [ '(' ], 582 ':': [ '?', '?:' ], 583 }; 584 585 /** 586 * Pattern matching operators and openers. 587 * 588 * @type {RegExp} 589 */ 590 PATTERN = /<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/; 591 592 /** 593 * Given a C expression, returns the equivalent postfix (Reverse Polish) 594 * notation terms as an array. 595 * 596 * If a postfix string is desired, simply `.join( ' ' )` the result. 597 * 598 * @example 599 * 600 * ```js 601 * import postfix from '@tannin/postfix'; 602 * 603 * postfix( 'n > 1' ); 604 * // ⇒ [ 'n', '1', '>' ] 605 * ``` 606 * 607 * @param {string} expression C expression. 608 * 609 * @return {string[]} Postfix terms. 610 */ 611 function postfix( expression ) { 612 var terms = [], 613 stack = [], 614 match, operator, term, element; 615 616 while ( ( match = expression.match( PATTERN ) ) ) { 617 operator = match[ 0 ]; 618 619 // Term is the string preceding the operator match. It may contain 620 // whitespace, and may be empty (if operator is at beginning). 621 term = expression.substr( 0, match.index ).trim(); 622 if ( term ) { 623 terms.push( term ); 624 } 625 626 while ( ( element = stack.pop() ) ) { 627 if ( TERMINATORS[ operator ] ) { 628 if ( TERMINATORS[ operator ][ 0 ] === element ) { 629 // Substitution works here under assumption that because 630 // the assigned operator will no longer be a terminator, it 631 // will be pushed to the stack during the condition below. 632 operator = TERMINATORS[ operator ][ 1 ] || operator; 633 break; 634 } 635 } else if ( OPENERS.indexOf( element ) >= 0 || PRECEDENCE[ element ] < PRECEDENCE[ operator ] ) { 636 // Push to stack if either an opener or when pop reveals an 637 // element of lower precedence. 638 stack.push( element ); 639 break; 640 } 641 642 // For each popped from stack, push to terms. 643 terms.push( element ); 644 } 645 646 if ( ! TERMINATORS[ operator ] ) { 647 stack.push( operator ); 648 } 649 650 // Slice matched fragment from expression to continue match. 651 expression = expression.substr( match.index + operator.length ); 652 } 653 654 // Push remainder of operand, if exists, to terms. 655 expression = expression.trim(); 656 if ( expression ) { 657 terms.push( expression ); 658 } 659 660 // Pop remaining items from stack into terms. 661 return terms.concat( stack.reverse() ); 662 } 663 664 ;// ./node_modules/@tannin/evaluate/index.js 665 /** 666 * Operator callback functions. 667 * 668 * @type {Object} 669 */ 670 var OPERATORS = { 671 '!': function( a ) { 672 return ! a; 673 }, 674 '*': function( a, b ) { 675 return a * b; 676 }, 677 '/': function( a, b ) { 678 return a / b; 679 }, 680 '%': function( a, b ) { 681 return a % b; 682 }, 683 '+': function( a, b ) { 684 return a + b; 685 }, 686 '-': function( a, b ) { 687 return a - b; 688 }, 689 '<': function( a, b ) { 690 return a < b; 691 }, 692 '<=': function( a, b ) { 693 return a <= b; 694 }, 695 '>': function( a, b ) { 696 return a > b; 697 }, 698 '>=': function( a, b ) { 699 return a >= b; 700 }, 701 '==': function( a, b ) { 702 return a === b; 703 }, 704 '!=': function( a, b ) { 705 return a !== b; 706 }, 707 '&&': function( a, b ) { 708 return a && b; 709 }, 710 '||': function( a, b ) { 711 return a || b; 712 }, 713 '?:': function( a, b, c ) { 714 if ( a ) { 715 throw b; 716 } 717 718 return c; 719 }, 720 }; 721 722 /** 723 * Given an array of postfix terms and operand variables, returns the result of 724 * the postfix evaluation. 725 * 726 * @example 727 * 728 * ```js 729 * import evaluate from '@tannin/evaluate'; 730 * 731 * // 3 + 4 * 5 / 6 ⇒ '3 4 5 * 6 / +' 732 * const terms = [ '3', '4', '5', '*', '6', '/', '+' ]; 733 * 734 * evaluate( terms, {} ); 735 * // ⇒ 6.333333333333334 736 * ``` 737 * 738 * @param {string[]} postfix Postfix terms. 739 * @param {Object} variables Operand variables. 740 * 741 * @return {*} Result of evaluation. 742 */ 743 function evaluate( postfix, variables ) { 744 var stack = [], 745 i, j, args, getOperatorResult, term, value; 746 747 for ( i = 0; i < postfix.length; i++ ) { 748 term = postfix[ i ]; 749 750 getOperatorResult = OPERATORS[ term ]; 751 if ( getOperatorResult ) { 752 // Pop from stack by number of function arguments. 753 j = getOperatorResult.length; 754 args = Array( j ); 755 while ( j-- ) { 756 args[ j ] = stack.pop(); 757 } 758 759 try { 760 value = getOperatorResult.apply( null, args ); 761 } catch ( earlyReturn ) { 762 return earlyReturn; 763 } 764 } else if ( variables.hasOwnProperty( term ) ) { 765 value = variables[ term ]; 766 } else { 767 value = +term; 768 } 769 770 stack.push( value ); 771 } 772 773 return stack[ 0 ]; 774 } 775 776 ;// ./node_modules/@tannin/compile/index.js 777 778 779 780 /** 781 * Given a C expression, returns a function which can be called to evaluate its 782 * result. 783 * 784 * @example 785 * 786 * ```js 787 * import compile from '@tannin/compile'; 788 * 789 * const evaluate = compile( 'n > 1' ); 790 * 791 * evaluate( { n: 2 } ); 792 * // ⇒ true 793 * ``` 794 * 795 * @param {string} expression C expression. 796 * 797 * @return {(variables?:{[variable:string]:*})=>*} Compiled evaluator. 798 */ 799 function compile( expression ) { 800 var terms = postfix( expression ); 801 802 return function( variables ) { 803 return evaluate( terms, variables ); 804 }; 805 } 806 807 ;// ./node_modules/@tannin/plural-forms/index.js 808 809 810 /** 811 * Given a C expression, returns a function which, when called with a value, 812 * evaluates the result with the value assumed to be the "n" variable of the 813 * expression. The result will be coerced to its numeric equivalent. 814 * 815 * @param {string} expression C expression. 816 * 817 * @return {Function} Evaluator function. 818 */ 819 function pluralForms( expression ) { 820 var evaluate = compile( expression ); 821 822 return function( n ) { 823 return +evaluate( { n: n } ); 824 }; 825 } 826 827 ;// ./node_modules/tannin/index.js 828 829 830 /** 831 * Tannin constructor options. 832 * 833 * @typedef {Object} TanninOptions 834 * 835 * @property {string} [contextDelimiter] Joiner in string lookup with context. 836 * @property {Function} [onMissingKey] Callback to invoke when key missing. 837 */ 838 839 /** 840 * Domain metadata. 841 * 842 * @typedef {Object} TanninDomainMetadata 843 * 844 * @property {string} [domain] Domain name. 845 * @property {string} [lang] Language code. 846 * @property {(string|Function)} [plural_forms] Plural forms expression or 847 * function evaluator. 848 */ 849 850 /** 851 * Domain translation pair respectively representing the singular and plural 852 * translation. 853 * 854 * @typedef {[string,string]} TanninTranslation 855 */ 856 857 /** 858 * Locale data domain. The key is used as reference for lookup, the value an 859 * array of two string entries respectively representing the singular and plural 860 * translation. 861 * 862 * @typedef {{[key:string]:TanninDomainMetadata|TanninTranslation,'':TanninDomainMetadata|TanninTranslation}} TanninLocaleDomain 863 */ 864 865 /** 866 * Jed-formatted locale data. 867 * 868 * @see http://messageformat.github.io/Jed/ 869 * 870 * @typedef {{[domain:string]:TanninLocaleDomain}} TanninLocaleData 871 */ 872 873 /** 874 * Default Tannin constructor options. 875 * 876 * @type {TanninOptions} 877 */ 878 var DEFAULT_OPTIONS = { 879 contextDelimiter: '\u0004', 880 onMissingKey: null, 881 }; 882 883 /** 884 * Given a specific locale data's config `plural_forms` value, returns the 885 * expression. 886 * 887 * @example 888 * 889 * ``` 890 * getPluralExpression( 'nplurals=2; plural=(n != 1);' ) === '(n != 1)' 891 * ``` 892 * 893 * @param {string} pf Locale data plural forms. 894 * 895 * @return {string} Plural forms expression. 896 */ 897 function getPluralExpression( pf ) { 898 var parts, i, part; 899 900 parts = pf.split( ';' ); 901 902 for ( i = 0; i < parts.length; i++ ) { 903 part = parts[ i ].trim(); 904 if ( part.indexOf( 'plural=' ) === 0 ) { 905 return part.substr( 7 ); 906 } 907 } 908 } 909 910 /** 911 * Tannin constructor. 912 * 913 * @class 914 * 915 * @param {TanninLocaleData} data Jed-formatted locale data. 916 * @param {TanninOptions} [options] Tannin options. 917 */ 918 function Tannin( data, options ) { 919 var key; 920 921 /** 922 * Jed-formatted locale data. 923 * 924 * @name Tannin#data 925 * @type {TanninLocaleData} 926 */ 927 this.data = data; 928 929 /** 930 * Plural forms function cache, keyed by plural forms string. 931 * 932 * @name Tannin#pluralForms 933 * @type {Object<string,Function>} 934 */ 935 this.pluralForms = {}; 936 937 /** 938 * Effective options for instance, including defaults. 939 * 940 * @name Tannin#options 941 * @type {TanninOptions} 942 */ 943 this.options = {}; 944 945 for ( key in DEFAULT_OPTIONS ) { 946 this.options[ key ] = options !== undefined && key in options 947 ? options[ key ] 948 : DEFAULT_OPTIONS[ key ]; 949 } 950 } 951 952 /** 953 * Returns the plural form index for the given domain and value. 954 * 955 * @param {string} domain Domain on which to calculate plural form. 956 * @param {number} n Value for which plural form is to be calculated. 957 * 958 * @return {number} Plural form index. 959 */ 960 Tannin.prototype.getPluralForm = function( domain, n ) { 961 var getPluralForm = this.pluralForms[ domain ], 962 config, plural, pf; 963 964 if ( ! getPluralForm ) { 965 config = this.data[ domain ][ '' ]; 966 967 pf = ( 968 config[ 'Plural-Forms' ] || 969 config[ 'plural-forms' ] || 970 // Ignore reason: As known, there's no way to document the empty 971 // string property on a key to guarantee this as metadata. 972 // @ts-ignore 973 config.plural_forms 974 ); 975 976 if ( typeof pf !== 'function' ) { 977 plural = getPluralExpression( 978 config[ 'Plural-Forms' ] || 979 config[ 'plural-forms' ] || 980 // Ignore reason: As known, there's no way to document the empty 981 // string property on a key to guarantee this as metadata. 982 // @ts-ignore 983 config.plural_forms 984 ); 985 986 pf = pluralForms( plural ); 987 } 988 989 getPluralForm = this.pluralForms[ domain ] = pf; 990 } 991 992 return getPluralForm( n ); 993 }; 994 995 /** 996 * Translate a string. 997 * 998 * @param {string} domain Translation domain. 999 * @param {string|void} context Context distinguishing terms of the same name. 1000 * @param {string} singular Primary key for translation lookup. 1001 * @param {string=} plural Fallback value used for non-zero plural 1002 * form index. 1003 * @param {number=} n Value to use in calculating plural form. 1004 * 1005 * @return {string} Translated string. 1006 */ 1007 Tannin.prototype.dcnpgettext = function( domain, context, singular, plural, n ) { 1008 var index, key, entry; 1009 1010 if ( n === undefined ) { 1011 // Default to singular. 1012 index = 0; 1013 } else { 1014 // Find index by evaluating plural form for value. 1015 index = this.getPluralForm( domain, n ); 1016 } 1017 1018 key = singular; 1019 1020 // If provided, context is prepended to key with delimiter. 1021 if ( context ) { 1022 key = context + this.options.contextDelimiter + singular; 1023 } 1024 1025 entry = this.data[ domain ][ key ]; 1026 1027 // Verify not only that entry exists, but that the intended index is within 1028 // range and non-empty. 1029 if ( entry && entry[ index ] ) { 1030 return entry[ index ]; 1031 } 1032 1033 if ( this.options.onMissingKey ) { 1034 this.options.onMissingKey( singular, domain ); 1035 } 1036 1037 // If entry not found, fall back to singular vs. plural with zero index 1038 // representing the singular value. 1039 return index === 0 ? singular : plural; 1040 }; 1041 1042 ;// ./node_modules/@wordpress/i18n/build-module/create-i18n.js 1043 /* wp:polyfill */ 1044 /** 1045 * External dependencies 1046 */ 1047 1048 1049 /** 1050 * @typedef {Record<string,any>} LocaleData 1051 */ 1052 1053 /** 1054 * Default locale data to use for Tannin domain when not otherwise provided. 1055 * Assumes an English plural forms expression. 1056 * 1057 * @type {LocaleData} 1058 */ 1059 const DEFAULT_LOCALE_DATA = { 1060 '': { 1061 /** @param {number} n */ 1062 plural_forms(n) { 1063 return n === 1 ? 0 : 1; 1064 } 1065 } 1066 }; 1067 1068 /* 1069 * Regular expression that matches i18n hooks like `i18n.gettext`, `i18n.ngettext`, 1070 * `i18n.gettext_domain` or `i18n.ngettext_with_context` or `i18n.has_translation`. 1071 */ 1072 const I18N_HOOK_REGEXP = /^i18n\.(n?gettext|has_translation)(_|$)/; 1073 1074 /** 1075 * @typedef {(domain?: string) => LocaleData} GetLocaleData 1076 * 1077 * Returns locale data by domain in a 1078 * Jed-formatted JSON object shape. 1079 * 1080 * @see http://messageformat.github.io/Jed/ 1081 */ 1082 /** 1083 * @typedef {(data?: LocaleData, domain?: string) => void} SetLocaleData 1084 * 1085 * Merges locale data into the Tannin instance by domain. Note that this 1086 * function will overwrite the domain configuration. Accepts data in a 1087 * Jed-formatted JSON object shape. 1088 * 1089 * @see http://messageformat.github.io/Jed/ 1090 */ 1091 /** 1092 * @typedef {(data?: LocaleData, domain?: string) => void} AddLocaleData 1093 * 1094 * Merges locale data into the Tannin instance by domain. Note that this 1095 * function will also merge the domain configuration. Accepts data in a 1096 * Jed-formatted JSON object shape. 1097 * 1098 * @see http://messageformat.github.io/Jed/ 1099 */ 1100 /** 1101 * @typedef {(data?: LocaleData, domain?: string) => void} ResetLocaleData 1102 * 1103 * Resets all current Tannin instance locale data and sets the specified 1104 * locale data for the domain. Accepts data in a Jed-formatted JSON object shape. 1105 * 1106 * @see http://messageformat.github.io/Jed/ 1107 */ 1108 /** @typedef {() => void} SubscribeCallback */ 1109 /** @typedef {() => void} UnsubscribeCallback */ 1110 /** 1111 * @typedef {(callback: SubscribeCallback) => UnsubscribeCallback} Subscribe 1112 * 1113 * Subscribes to changes of locale data 1114 */ 1115 /** 1116 * @typedef {(domain?: string) => string} GetFilterDomain 1117 * Retrieve the domain to use when calling domain-specific filters. 1118 */ 1119 /** 1120 * @typedef {(text: string, domain?: string) => string} __ 1121 * 1122 * Retrieve the translation of text. 1123 * 1124 * @see https://developer.wordpress.org/reference/functions/__/ 1125 */ 1126 /** 1127 * @typedef {(text: string, context: string, domain?: string) => string} _x 1128 * 1129 * Retrieve translated string with gettext context. 1130 * 1131 * @see https://developer.wordpress.org/reference/functions/_x/ 1132 */ 1133 /** 1134 * @typedef {(single: string, plural: string, number: number, domain?: string) => string} _n 1135 * 1136 * Translates and retrieves the singular or plural form based on the supplied 1137 * number. 1138 * 1139 * @see https://developer.wordpress.org/reference/functions/_n/ 1140 */ 1141 /** 1142 * @typedef {(single: string, plural: string, number: number, context: string, domain?: string) => string} _nx 1143 * 1144 * Translates and retrieves the singular or plural form based on the supplied 1145 * number, with gettext context. 1146 * 1147 * @see https://developer.wordpress.org/reference/functions/_nx/ 1148 */ 1149 /** 1150 * @typedef {() => boolean} IsRtl 1151 * 1152 * Check if current locale is RTL. 1153 * 1154 * **RTL (Right To Left)** is a locale property indicating that text is written from right to left. 1155 * For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common 1156 * language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages, 1157 * including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`). 1158 */ 1159 /** 1160 * @typedef {(single: string, context?: string, domain?: string) => boolean} HasTranslation 1161 * 1162 * Check if there is a translation for a given string in singular form. 1163 */ 1164 /** @typedef {import('@wordpress/hooks').Hooks} Hooks */ 1165 1166 /** 1167 * An i18n instance 1168 * 1169 * @typedef I18n 1170 * @property {GetLocaleData} getLocaleData Returns locale data by domain in a Jed-formatted JSON object shape. 1171 * @property {SetLocaleData} setLocaleData Merges locale data into the Tannin instance by domain. Note that this 1172 * function will overwrite the domain configuration. Accepts data in a 1173 * Jed-formatted JSON object shape. 1174 * @property {AddLocaleData} addLocaleData Merges locale data into the Tannin instance by domain. Note that this 1175 * function will also merge the domain configuration. Accepts data in a 1176 * Jed-formatted JSON object shape. 1177 * @property {ResetLocaleData} resetLocaleData Resets all current Tannin instance locale data and sets the specified 1178 * locale data for the domain. Accepts data in a Jed-formatted JSON object shape. 1179 * @property {Subscribe} subscribe Subscribes to changes of Tannin locale data. 1180 * @property {__} __ Retrieve the translation of text. 1181 * @property {_x} _x Retrieve translated string with gettext context. 1182 * @property {_n} _n Translates and retrieves the singular or plural form based on the supplied 1183 * number. 1184 * @property {_nx} _nx Translates and retrieves the singular or plural form based on the supplied 1185 * number, with gettext context. 1186 * @property {IsRtl} isRTL Check if current locale is RTL. 1187 * @property {HasTranslation} hasTranslation Check if there is a translation for a given string. 1188 */ 1189 1190 /** 1191 * Create an i18n instance 1192 * 1193 * @param {LocaleData} [initialData] Locale data configuration. 1194 * @param {string} [initialDomain] Domain for which configuration applies. 1195 * @param {Hooks} [hooks] Hooks implementation. 1196 * 1197 * @return {I18n} I18n instance. 1198 */ 1199 const createI18n = (initialData, initialDomain, hooks) => { 1200 /** 1201 * The underlying instance of Tannin to which exported functions interface. 1202 * 1203 * @type {Tannin} 1204 */ 1205 const tannin = new Tannin({}); 1206 const listeners = new Set(); 1207 const notifyListeners = () => { 1208 listeners.forEach(listener => listener()); 1209 }; 1210 1211 /** 1212 * Subscribe to changes of locale data. 1213 * 1214 * @param {SubscribeCallback} callback Subscription callback. 1215 * @return {UnsubscribeCallback} Unsubscribe callback. 1216 */ 1217 const subscribe = callback => { 1218 listeners.add(callback); 1219 return () => listeners.delete(callback); 1220 }; 1221 1222 /** @type {GetLocaleData} */ 1223 const getLocaleData = (domain = 'default') => tannin.data[domain]; 1224 1225 /** 1226 * @param {LocaleData} [data] 1227 * @param {string} [domain] 1228 */ 1229 const doSetLocaleData = (data, domain = 'default') => { 1230 tannin.data[domain] = { 1231 ...tannin.data[domain], 1232 ...data 1233 }; 1234 1235 // Populate default domain configuration (supported locale date which omits 1236 // a plural forms expression). 1237 tannin.data[domain][''] = { 1238 ...DEFAULT_LOCALE_DATA[''], 1239 ...tannin.data[domain]?.[''] 1240 }; 1241 1242 // Clean up cached plural forms functions cache as it might be updated. 1243 delete tannin.pluralForms[domain]; 1244 }; 1245 1246 /** @type {SetLocaleData} */ 1247 const setLocaleData = (data, domain) => { 1248 doSetLocaleData(data, domain); 1249 notifyListeners(); 1250 }; 1251 1252 /** @type {AddLocaleData} */ 1253 const addLocaleData = (data, domain = 'default') => { 1254 tannin.data[domain] = { 1255 ...tannin.data[domain], 1256 ...data, 1257 // Populate default domain configuration (supported locale date which omits 1258 // a plural forms expression). 1259 '': { 1260 ...DEFAULT_LOCALE_DATA[''], 1261 ...tannin.data[domain]?.[''], 1262 ...data?.[''] 1263 } 1264 }; 1265 1266 // Clean up cached plural forms functions cache as it might be updated. 1267 delete tannin.pluralForms[domain]; 1268 notifyListeners(); 1269 }; 1270 1271 /** @type {ResetLocaleData} */ 1272 const resetLocaleData = (data, domain) => { 1273 // Reset all current Tannin locale data. 1274 tannin.data = {}; 1275 1276 // Reset cached plural forms functions cache. 1277 tannin.pluralForms = {}; 1278 setLocaleData(data, domain); 1279 }; 1280 1281 /** 1282 * Wrapper for Tannin's `dcnpgettext`. Populates default locale data if not 1283 * otherwise previously assigned. 1284 * 1285 * @param {string|undefined} domain Domain to retrieve the translated text. 1286 * @param {string|undefined} context Context information for the translators. 1287 * @param {string} single Text to translate if non-plural. Used as 1288 * fallback return value on a caught error. 1289 * @param {string} [plural] The text to be used if the number is 1290 * plural. 1291 * @param {number} [number] The number to compare against to use 1292 * either the singular or plural form. 1293 * 1294 * @return {string} The translated string. 1295 */ 1296 const dcnpgettext = (domain = 'default', context, single, plural, number) => { 1297 if (!tannin.data[domain]) { 1298 // Use `doSetLocaleData` to set silently, without notifying listeners. 1299 doSetLocaleData(undefined, domain); 1300 } 1301 return tannin.dcnpgettext(domain, context, single, plural, number); 1302 }; 1303 1304 /** @type {GetFilterDomain} */ 1305 const getFilterDomain = (domain = 'default') => domain; 1306 1307 /** @type {__} */ 1308 const __ = (text, domain) => { 1309 let translation = dcnpgettext(domain, undefined, text); 1310 if (!hooks) { 1311 return translation; 1312 } 1313 1314 /** 1315 * Filters text with its translation. 1316 * 1317 * @param {string} translation Translated text. 1318 * @param {string} text Text to translate. 1319 * @param {string} domain Text domain. Unique identifier for retrieving translated strings. 1320 */ 1321 translation = /** @type {string} */ 1322 /** @type {*} */hooks.applyFilters('i18n.gettext', translation, text, domain); 1323 return /** @type {string} */ /** @type {*} */hooks.applyFilters('i18n.gettext_' + getFilterDomain(domain), translation, text, domain); 1324 }; 1325 1326 /** @type {_x} */ 1327 const _x = (text, context, domain) => { 1328 let translation = dcnpgettext(domain, context, text); 1329 if (!hooks) { 1330 return translation; 1331 } 1332 1333 /** 1334 * Filters text with its translation based on context information. 1335 * 1336 * @param {string} translation Translated text. 1337 * @param {string} text Text to translate. 1338 * @param {string} context Context information for the translators. 1339 * @param {string} domain Text domain. Unique identifier for retrieving translated strings. 1340 */ 1341 translation = /** @type {string} */ 1342 /** @type {*} */hooks.applyFilters('i18n.gettext_with_context', translation, text, context, domain); 1343 return /** @type {string} */ /** @type {*} */hooks.applyFilters('i18n.gettext_with_context_' + getFilterDomain(domain), translation, text, context, domain); 1344 }; 1345 1346 /** @type {_n} */ 1347 const _n = (single, plural, number, domain) => { 1348 let translation = dcnpgettext(domain, undefined, single, plural, number); 1349 if (!hooks) { 1350 return translation; 1351 } 1352 1353 /** 1354 * Filters the singular or plural form of a string. 1355 * 1356 * @param {string} translation Translated text. 1357 * @param {string} single The text to be used if the number is singular. 1358 * @param {string} plural The text to be used if the number is plural. 1359 * @param {string} number The number to compare against to use either the singular or plural form. 1360 * @param {string} domain Text domain. Unique identifier for retrieving translated strings. 1361 */ 1362 translation = /** @type {string} */ 1363 /** @type {*} */hooks.applyFilters('i18n.ngettext', translation, single, plural, number, domain); 1364 return /** @type {string} */ /** @type {*} */hooks.applyFilters('i18n.ngettext_' + getFilterDomain(domain), translation, single, plural, number, domain); 1365 }; 1366 1367 /** @type {_nx} */ 1368 const _nx = (single, plural, number, context, domain) => { 1369 let translation = dcnpgettext(domain, context, single, plural, number); 1370 if (!hooks) { 1371 return translation; 1372 } 1373 1374 /** 1375 * Filters the singular or plural form of a string with gettext context. 1376 * 1377 * @param {string} translation Translated text. 1378 * @param {string} single The text to be used if the number is singular. 1379 * @param {string} plural The text to be used if the number is plural. 1380 * @param {string} number The number to compare against to use either the singular or plural form. 1381 * @param {string} context Context information for the translators. 1382 * @param {string} domain Text domain. Unique identifier for retrieving translated strings. 1383 */ 1384 translation = /** @type {string} */ 1385 /** @type {*} */hooks.applyFilters('i18n.ngettext_with_context', translation, single, plural, number, context, domain); 1386 return /** @type {string} */ /** @type {*} */hooks.applyFilters('i18n.ngettext_with_context_' + getFilterDomain(domain), translation, single, plural, number, context, domain); 1387 }; 1388 1389 /** @type {IsRtl} */ 1390 const isRTL = () => { 1391 return 'rtl' === _x('ltr', 'text direction'); 1392 }; 1393 1394 /** @type {HasTranslation} */ 1395 const hasTranslation = (single, context, domain) => { 1396 const key = context ? context + '\u0004' + single : single; 1397 let result = !!tannin.data?.[domain !== null && domain !== void 0 ? domain : 'default']?.[key]; 1398 if (hooks) { 1399 /** 1400 * Filters the presence of a translation in the locale data. 1401 * 1402 * @param {boolean} hasTranslation Whether the translation is present or not.. 1403 * @param {string} single The singular form of the translated text (used as key in locale data) 1404 * @param {string} context Context information for the translators. 1405 * @param {string} domain Text domain. Unique identifier for retrieving translated strings. 1406 */ 1407 result = /** @type { boolean } */ 1408 /** @type {*} */hooks.applyFilters('i18n.has_translation', result, single, context, domain); 1409 result = /** @type { boolean } */ 1410 /** @type {*} */hooks.applyFilters('i18n.has_translation_' + getFilterDomain(domain), result, single, context, domain); 1411 } 1412 return result; 1413 }; 1414 if (initialData) { 1415 setLocaleData(initialData, initialDomain); 1416 } 1417 if (hooks) { 1418 /** 1419 * @param {string} hookName 1420 */ 1421 const onHookAddedOrRemoved = hookName => { 1422 if (I18N_HOOK_REGEXP.test(hookName)) { 1423 notifyListeners(); 1424 } 1425 }; 1426 hooks.addAction('hookAdded', 'core/i18n', onHookAddedOrRemoved); 1427 hooks.addAction('hookRemoved', 'core/i18n', onHookAddedOrRemoved); 1428 } 1429 return { 1430 getLocaleData, 1431 setLocaleData, 1432 addLocaleData, 1433 resetLocaleData, 1434 subscribe, 1435 __, 1436 _x, 1437 _n, 1438 _nx, 1439 isRTL, 1440 hasTranslation 1441 }; 1442 }; 1443 1444 ;// external ["wp","hooks"] 1445 const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; 1446 ;// ./node_modules/@wordpress/i18n/build-module/default-i18n.js 1447 /** 1448 * Internal dependencies 1449 */ 1450 1451 1452 /** 1453 * WordPress dependencies 1454 */ 1455 1456 const i18n = createI18n(undefined, undefined, external_wp_hooks_namespaceObject.defaultHooks); 1457 1458 /** 1459 * Default, singleton instance of `I18n`. 1460 */ 1461 /* harmony default export */ const default_i18n = (i18n); 1462 1463 /* 1464 * Comments in this file are duplicated from ./i18n due to 1465 * https://github.com/WordPress/gutenberg/pull/20318#issuecomment-590837722 1466 */ 1467 1468 /** 1469 * @typedef {import('./create-i18n').LocaleData} LocaleData 1470 * @typedef {import('./create-i18n').SubscribeCallback} SubscribeCallback 1471 * @typedef {import('./create-i18n').UnsubscribeCallback} UnsubscribeCallback 1472 */ 1473 1474 /** 1475 * Returns locale data by domain in a Jed-formatted JSON object shape. 1476 * 1477 * @see http://messageformat.github.io/Jed/ 1478 * 1479 * @param {string} [domain] Domain for which to get the data. 1480 * @return {LocaleData} Locale data. 1481 */ 1482 const getLocaleData = i18n.getLocaleData.bind(i18n); 1483 1484 /** 1485 * Merges locale data into the Tannin instance by domain. Accepts data in a 1486 * Jed-formatted JSON object shape. 1487 * 1488 * @see http://messageformat.github.io/Jed/ 1489 * 1490 * @param {LocaleData} [data] Locale data configuration. 1491 * @param {string} [domain] Domain for which configuration applies. 1492 */ 1493 const setLocaleData = i18n.setLocaleData.bind(i18n); 1494 1495 /** 1496 * Resets all current Tannin instance locale data and sets the specified 1497 * locale data for the domain. Accepts data in a Jed-formatted JSON object shape. 1498 * 1499 * @see http://messageformat.github.io/Jed/ 1500 * 1501 * @param {LocaleData} [data] Locale data configuration. 1502 * @param {string} [domain] Domain for which configuration applies. 1503 */ 1504 const resetLocaleData = i18n.resetLocaleData.bind(i18n); 1505 1506 /** 1507 * Subscribes to changes of locale data 1508 * 1509 * @param {SubscribeCallback} callback Subscription callback 1510 * @return {UnsubscribeCallback} Unsubscribe callback 1511 */ 1512 const subscribe = i18n.subscribe.bind(i18n); 1513 1514 /** 1515 * Retrieve the translation of text. 1516 * 1517 * @see https://developer.wordpress.org/reference/functions/__/ 1518 * 1519 * @param {string} text Text to translate. 1520 * @param {string} [domain] Domain to retrieve the translated text. 1521 * 1522 * @return {string} Translated text. 1523 */ 1524 const __ = i18n.__.bind(i18n); 1525 1526 /** 1527 * Retrieve translated string with gettext context. 1528 * 1529 * @see https://developer.wordpress.org/reference/functions/_x/ 1530 * 1531 * @param {string} text Text to translate. 1532 * @param {string} context Context information for the translators. 1533 * @param {string} [domain] Domain to retrieve the translated text. 1534 * 1535 * @return {string} Translated context string without pipe. 1536 */ 1537 const _x = i18n._x.bind(i18n); 1538 1539 /** 1540 * Translates and retrieves the singular or plural form based on the supplied 1541 * number. 1542 * 1543 * @see https://developer.wordpress.org/reference/functions/_n/ 1544 * 1545 * @param {string} single The text to be used if the number is singular. 1546 * @param {string} plural The text to be used if the number is plural. 1547 * @param {number} number The number to compare against to use either the 1548 * singular or plural form. 1549 * @param {string} [domain] Domain to retrieve the translated text. 1550 * 1551 * @return {string} The translated singular or plural form. 1552 */ 1553 const _n = i18n._n.bind(i18n); 1554 1555 /** 1556 * Translates and retrieves the singular or plural form based on the supplied 1557 * number, with gettext context. 1558 * 1559 * @see https://developer.wordpress.org/reference/functions/_nx/ 1560 * 1561 * @param {string} single The text to be used if the number is singular. 1562 * @param {string} plural The text to be used if the number is plural. 1563 * @param {number} number The number to compare against to use either the 1564 * singular or plural form. 1565 * @param {string} context Context information for the translators. 1566 * @param {string} [domain] Domain to retrieve the translated text. 1567 * 1568 * @return {string} The translated singular or plural form. 1569 */ 1570 const _nx = i18n._nx.bind(i18n); 1571 1572 /** 1573 * Check if current locale is RTL. 1574 * 1575 * **RTL (Right To Left)** is a locale property indicating that text is written from right to left. 1576 * For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common 1577 * language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages, 1578 * including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`). 1579 * 1580 * @return {boolean} Whether locale is RTL. 1581 */ 1582 const isRTL = i18n.isRTL.bind(i18n); 1583 1584 /** 1585 * Check if there is a translation for a given string (in singular form). 1586 * 1587 * @param {string} single Singular form of the string to look up. 1588 * @param {string} [context] Context information for the translators. 1589 * @param {string} [domain] Domain to retrieve the translated text. 1590 * @return {boolean} Whether the translation exists or not. 1591 */ 1592 const hasTranslation = i18n.hasTranslation.bind(i18n); 1593 1594 ;// ./node_modules/@wordpress/i18n/build-module/index.js 1595 1596 1597 1598 1599 })(); 1600 1601 (window.wp = window.wp || {}).i18n = __webpack_exports__; 1602 /******/ })() 1603 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Sat Feb 22 08:20:01 2025 | Cross-referenced by PHPXref |