[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> i18n.js (source)

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


Generated: Wed Aug 4 01:00:05 2021 Cross-referenced by PHPXref 0.7.1