[ 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 = 442);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 188:
  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  /***/ 442:
 330  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 331  
 332  "use strict";
 333  __webpack_require__.r(__webpack_exports__);
 334  
 335  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
 336  var defineProperty = __webpack_require__(5);
 337  
 338  // CONCATENATED MODULE: ./node_modules/@tannin/postfix/index.js
 339  var PRECEDENCE, OPENERS, TERMINATORS, PATTERN;
 340  
 341  /**
 342   * Operator precedence mapping.
 343   *
 344   * @type {Object}
 345   */
 346  PRECEDENCE = {
 347      '(': 9,
 348      '!': 8,
 349      '*': 7,
 350      '/': 7,
 351      '%': 7,
 352      '+': 6,
 353      '-': 6,
 354      '<': 5,
 355      '<=': 5,
 356      '>': 5,
 357      '>=': 5,
 358      '==': 4,
 359      '!=': 4,
 360      '&&': 3,
 361      '||': 2,
 362      '?': 1,
 363      '?:': 1,
 364  };
 365  
 366  /**
 367   * Characters which signal pair opening, to be terminated by terminators.
 368   *
 369   * @type {string[]}
 370   */
 371  OPENERS = [ '(', '?' ];
 372  
 373  /**
 374   * Characters which signal pair termination, the value an array with the
 375   * opener as its first member. The second member is an optional operator
 376   * replacement to push to the stack.
 377   *
 378   * @type {string[]}
 379   */
 380  TERMINATORS = {
 381      ')': [ '(' ],
 382      ':': [ '?', '?:' ],
 383  };
 384  
 385  /**
 386   * Pattern matching operators and openers.
 387   *
 388   * @type {RegExp}
 389   */
 390  PATTERN = /<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;
 391  
 392  /**
 393   * Given a C expression, returns the equivalent postfix (Reverse Polish)
 394   * notation terms as an array.
 395   *
 396   * If a postfix string is desired, simply `.join( ' ' )` the result.
 397   *
 398   * @example
 399   *
 400   * ```js
 401   * import postfix from '@tannin/postfix';
 402   *
 403   * postfix( 'n > 1' );
 404   * // ⇒ [ 'n', '1', '>' ]
 405   * ```
 406   *
 407   * @param {string} expression C expression.
 408   *
 409   * @return {string[]} Postfix terms.
 410   */
 411  function postfix( expression ) {
 412      var terms = [],
 413          stack = [],
 414          match, operator, term, element;
 415  
 416      while ( ( match = expression.match( PATTERN ) ) ) {
 417          operator = match[ 0 ];
 418  
 419          // Term is the string preceding the operator match. It may contain
 420          // whitespace, and may be empty (if operator is at beginning).
 421          term = expression.substr( 0, match.index ).trim();
 422          if ( term ) {
 423              terms.push( term );
 424          }
 425  
 426          while ( ( element = stack.pop() ) ) {
 427              if ( TERMINATORS[ operator ] ) {
 428                  if ( TERMINATORS[ operator ][ 0 ] === element ) {
 429                      // Substitution works here under assumption that because
 430                      // the assigned operator will no longer be a terminator, it
 431                      // will be pushed to the stack during the condition below.
 432                      operator = TERMINATORS[ operator ][ 1 ] || operator;
 433                      break;
 434                  }
 435              } else if ( OPENERS.indexOf( element ) >= 0 || PRECEDENCE[ element ] < PRECEDENCE[ operator ] ) {
 436                  // Push to stack if either an opener or when pop reveals an
 437                  // element of lower precedence.
 438                  stack.push( element );
 439                  break;
 440              }
 441  
 442              // For each popped from stack, push to terms.
 443              terms.push( element );
 444          }
 445  
 446          if ( ! TERMINATORS[ operator ] ) {
 447              stack.push( operator );
 448          }
 449  
 450          // Slice matched fragment from expression to continue match.
 451          expression = expression.substr( match.index + operator.length );
 452      }
 453  
 454      // Push remainder of operand, if exists, to terms.
 455      expression = expression.trim();
 456      if ( expression ) {
 457          terms.push( expression );
 458      }
 459  
 460      // Pop remaining items from stack into terms.
 461      return terms.concat( stack.reverse() );
 462  }
 463  
 464  // CONCATENATED MODULE: ./node_modules/@tannin/evaluate/index.js
 465  /**
 466   * Operator callback functions.
 467   *
 468   * @type {Object}
 469   */
 470  var OPERATORS = {
 471      '!': function( a ) {
 472          return ! a;
 473      },
 474      '*': function( a, b ) {
 475          return a * b;
 476      },
 477      '/': function( a, b ) {
 478          return a / b;
 479      },
 480      '%': function( a, b ) {
 481          return a % b;
 482      },
 483      '+': function( a, b ) {
 484          return a + b;
 485      },
 486      '-': function( a, b ) {
 487          return a - b;
 488      },
 489      '<': function( a, b ) {
 490          return a < b;
 491      },
 492      '<=': function( a, b ) {
 493          return a <= b;
 494      },
 495      '>': function( a, b ) {
 496          return a > b;
 497      },
 498      '>=': function( a, b ) {
 499          return a >= b;
 500      },
 501      '==': function( a, b ) {
 502          return a === b;
 503      },
 504      '!=': function( a, b ) {
 505          return a !== b;
 506      },
 507      '&&': function( a, b ) {
 508          return a && b;
 509      },
 510      '||': function( a, b ) {
 511          return a || b;
 512      },
 513      '?:': function( a, b, c ) {
 514          if ( a ) {
 515              throw b;
 516          }
 517  
 518          return c;
 519      },
 520  };
 521  
 522  /**
 523   * Given an array of postfix terms and operand variables, returns the result of
 524   * the postfix evaluation.
 525   *
 526   * @example
 527   *
 528   * ```js
 529   * import evaluate from '@tannin/evaluate';
 530   *
 531   * // 3 + 4 * 5 / 6 ⇒ '3 4 5 * 6 / +'
 532   * const terms = [ '3', '4', '5', '*', '6', '/', '+' ];
 533   *
 534   * evaluate( terms, {} );
 535   * // ⇒ 6.333333333333334
 536   * ```
 537   *
 538   * @param {string[]} postfix   Postfix terms.
 539   * @param {Object}   variables Operand variables.
 540   *
 541   * @return {*} Result of evaluation.
 542   */
 543  function evaluate_evaluate( postfix, variables ) {
 544      var stack = [],
 545          i, j, args, getOperatorResult, term, value;
 546  
 547      for ( i = 0; i < postfix.length; i++ ) {
 548          term = postfix[ i ];
 549  
 550          getOperatorResult = OPERATORS[ term ];
 551          if ( getOperatorResult ) {
 552              // Pop from stack by number of function arguments.
 553              j = getOperatorResult.length;
 554              args = Array( j );
 555              while ( j-- ) {
 556                  args[ j ] = stack.pop();
 557              }
 558  
 559              try {
 560                  value = getOperatorResult.apply( null, args );
 561              } catch ( earlyReturn ) {
 562                  return earlyReturn;
 563              }
 564          } else if ( variables.hasOwnProperty( term ) ) {
 565              value = variables[ term ];
 566          } else {
 567              value = +term;
 568          }
 569  
 570          stack.push( value );
 571      }
 572  
 573      return stack[ 0 ];
 574  }
 575  
 576  // CONCATENATED MODULE: ./node_modules/@tannin/compile/index.js
 577  
 578  
 579  
 580  /**
 581   * Given a C expression, returns a function which can be called to evaluate its
 582   * result.
 583   *
 584   * @example
 585   *
 586   * ```js
 587   * import compile from '@tannin/compile';
 588   *
 589   * const evaluate = compile( 'n > 1' );
 590   *
 591   * evaluate( { n: 2 } );
 592   * // ⇒ true
 593   * ```
 594   *
 595   * @param {string} expression C expression.
 596   *
 597   * @return {(variables?:{[variable:string]:*})=>*} Compiled evaluator.
 598   */
 599  function compile( expression ) {
 600      var terms = postfix( expression );
 601  
 602      return function( variables ) {
 603          return evaluate_evaluate( terms, variables );
 604      };
 605  }
 606  
 607  // CONCATENATED MODULE: ./node_modules/@tannin/plural-forms/index.js
 608  
 609  
 610  /**
 611   * Given a C expression, returns a function which, when called with a value,
 612   * evaluates the result with the value assumed to be the "n" variable of the
 613   * expression. The result will be coerced to its numeric equivalent.
 614   *
 615   * @param {string} expression C expression.
 616   *
 617   * @return {Function} Evaluator function.
 618   */
 619  function pluralForms( expression ) {
 620      var evaluate = compile( expression );
 621  
 622      return function( n ) {
 623          return +evaluate( { n: n } );
 624      };
 625  }
 626  
 627  // CONCATENATED MODULE: ./node_modules/tannin/index.js
 628  
 629  
 630  /**
 631   * Tannin constructor options.
 632   *
 633   * @typedef {Object} TanninOptions
 634   *
 635   * @property {string}   [contextDelimiter] Joiner in string lookup with context.
 636   * @property {Function} [onMissingKey]     Callback to invoke when key missing.
 637   */
 638  
 639  /**
 640   * Domain metadata.
 641   *
 642   * @typedef {Object} TanninDomainMetadata
 643   *
 644   * @property {string}            [domain]       Domain name.
 645   * @property {string}            [lang]         Language code.
 646   * @property {(string|Function)} [plural_forms] Plural forms expression or
 647   *                                              function evaluator.
 648   */
 649  
 650  /**
 651   * Domain translation pair respectively representing the singular and plural
 652   * translation.
 653   *
 654   * @typedef {[string,string]} TanninTranslation
 655   */
 656  
 657  /**
 658   * Locale data domain. The key is used as reference for lookup, the value an
 659   * array of two string entries respectively representing the singular and plural
 660   * translation.
 661   *
 662   * @typedef {{[key:string]:TanninDomainMetadata|TanninTranslation,'':TanninDomainMetadata|TanninTranslation}} TanninLocaleDomain
 663   */
 664  
 665  /**
 666   * Jed-formatted locale data.
 667   *
 668   * @see http://messageformat.github.io/Jed/
 669   *
 670   * @typedef {{[domain:string]:TanninLocaleDomain}} TanninLocaleData
 671   */
 672  
 673  /**
 674   * Default Tannin constructor options.
 675   *
 676   * @type {TanninOptions}
 677   */
 678  var DEFAULT_OPTIONS = {
 679      contextDelimiter: '\u0004',
 680      onMissingKey: null,
 681  };
 682  
 683  /**
 684   * Given a specific locale data's config `plural_forms` value, returns the
 685   * expression.
 686   *
 687   * @example
 688   *
 689   * ```
 690   * getPluralExpression( 'nplurals=2; plural=(n != 1);' ) === '(n != 1)'
 691   * ```
 692   *
 693   * @param {string} pf Locale data plural forms.
 694   *
 695   * @return {string} Plural forms expression.
 696   */
 697  function getPluralExpression( pf ) {
 698      var parts, i, part;
 699  
 700      parts = pf.split( ';' );
 701  
 702      for ( i = 0; i < parts.length; i++ ) {
 703          part = parts[ i ].trim();
 704          if ( part.indexOf( 'plural=' ) === 0 ) {
 705              return part.substr( 7 );
 706          }
 707      }
 708  }
 709  
 710  /**
 711   * Tannin constructor.
 712   *
 713   * @class
 714   *
 715   * @param {TanninLocaleData} data      Jed-formatted locale data.
 716   * @param {TanninOptions}    [options] Tannin options.
 717   */
 718  function Tannin( data, options ) {
 719      var key;
 720  
 721      /**
 722       * Jed-formatted locale data.
 723       *
 724       * @name Tannin#data
 725       * @type {TanninLocaleData}
 726       */
 727      this.data = data;
 728  
 729      /**
 730       * Plural forms function cache, keyed by plural forms string.
 731       *
 732       * @name Tannin#pluralForms
 733       * @type {Object<string,Function>}
 734       */
 735      this.pluralForms = {};
 736  
 737      /**
 738       * Effective options for instance, including defaults.
 739       *
 740       * @name Tannin#options
 741       * @type {TanninOptions}
 742       */
 743      this.options = {};
 744  
 745      for ( key in DEFAULT_OPTIONS ) {
 746          this.options[ key ] = options !== undefined && key in options
 747              ? options[ key ]
 748              : DEFAULT_OPTIONS[ key ];
 749      }
 750  }
 751  
 752  /**
 753   * Returns the plural form index for the given domain and value.
 754   *
 755   * @param {string} domain Domain on which to calculate plural form.
 756   * @param {number} n      Value for which plural form is to be calculated.
 757   *
 758   * @return {number} Plural form index.
 759   */
 760  Tannin.prototype.getPluralForm = function( domain, n ) {
 761      var getPluralForm = this.pluralForms[ domain ],
 762          config, plural, pf;
 763  
 764      if ( ! getPluralForm ) {
 765          config = this.data[ domain ][ '' ];
 766  
 767          pf = (
 768              config[ 'Plural-Forms' ] ||
 769              config[ 'plural-forms' ] ||
 770              // Ignore reason: As known, there's no way to document the empty
 771              // string property on a key to guarantee this as metadata.
 772              // @ts-ignore
 773              config.plural_forms
 774          );
 775  
 776          if ( typeof pf !== 'function' ) {
 777              plural = getPluralExpression(
 778                  config[ 'Plural-Forms' ] ||
 779                  config[ 'plural-forms' ] ||
 780                  // Ignore reason: As known, there's no way to document the empty
 781                  // string property on a key to guarantee this as metadata.
 782                  // @ts-ignore
 783                  config.plural_forms
 784              );
 785  
 786              pf = pluralForms( plural );
 787          }
 788  
 789          getPluralForm = this.pluralForms[ domain ] = pf;
 790      }
 791  
 792      return getPluralForm( n );
 793  };
 794  
 795  /**
 796   * Translate a string.
 797   *
 798   * @param {string}      domain   Translation domain.
 799   * @param {string|void} context  Context distinguishing terms of the same name.
 800   * @param {string}      singular Primary key for translation lookup.
 801   * @param {string=}     plural   Fallback value used for non-zero plural
 802   *                               form index.
 803   * @param {number=}     n        Value to use in calculating plural form.
 804   *
 805   * @return {string} Translated string.
 806   */
 807  Tannin.prototype.dcnpgettext = function( domain, context, singular, plural, n ) {
 808      var index, key, entry;
 809  
 810      if ( n === undefined ) {
 811          // Default to singular.
 812          index = 0;
 813      } else {
 814          // Find index by evaluating plural form for value.
 815          index = this.getPluralForm( domain, n );
 816      }
 817  
 818      key = singular;
 819  
 820      // If provided, context is prepended to key with delimiter.
 821      if ( context ) {
 822          key = context + this.options.contextDelimiter + singular;
 823      }
 824  
 825      entry = this.data[ domain ][ key ];
 826  
 827      // Verify not only that entry exists, but that the intended index is within
 828      // range and non-empty.
 829      if ( entry && entry[ index ] ) {
 830          return entry[ index ];
 831      }
 832  
 833      if ( this.options.onMissingKey ) {
 834          this.options.onMissingKey( singular, domain );
 835      }
 836  
 837      // If entry not found, fall back to singular vs. plural with zero index
 838      // representing the singular value.
 839      return index === 0 ? singular : plural;
 840  };
 841  
 842  // EXTERNAL MODULE: ./node_modules/memize/index.js
 843  var memize = __webpack_require__(46);
 844  var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
 845  
 846  // EXTERNAL MODULE: ./node_modules/sprintf-js/src/sprintf.js
 847  var sprintf = __webpack_require__(188);
 848  var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf);
 849  
 850  // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/index.js
 851  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setLocaleData", function() { return setLocaleData; });
 852  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__", function() { return __; });
 853  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_x", function() { return _x; });
 854  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_n", function() { return _n; });
 855  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_nx", function() { return _nx; });
 856  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sprintf", function() { return build_module_sprintf; });
 857  
 858  
 859  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
 860  
 861  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 862  
 863  /**
 864   * External dependencies
 865   */
 866  
 867  
 868  
 869  /**
 870   * @typedef {{[key: string]: any}} LocaleData
 871   */
 872  
 873  /**
 874   * Default locale data to use for Tannin domain when not otherwise provided.
 875   * Assumes an English plural forms expression.
 876   *
 877   * @type {LocaleData}
 878   */
 879  
 880  var DEFAULT_LOCALE_DATA = {
 881    '': {
 882      plural_forms: function plural_forms(n) {
 883        return n === 1 ? 0 : 1;
 884      }
 885    }
 886  };
 887  /**
 888   * Log to console, once per message; or more precisely, per referentially equal
 889   * argument set. Because Jed throws errors, we log these to the console instead
 890   * to avoid crashing the application.
 891   *
 892   * @param {...*} args Arguments to pass to `console.error`
 893   */
 894  
 895  var logErrorOnce = memize_default()(console.error); // eslint-disable-line no-console
 896  
 897  /**
 898   * The underlying instance of Tannin to which exported functions interface.
 899   *
 900   * @type {Tannin}
 901   */
 902  
 903  var i18n = new Tannin({});
 904  /**
 905   * Merges locale data into the Tannin instance by domain. Accepts data in a
 906   * Jed-formatted JSON object shape.
 907   *
 908   * @see http://messageformat.github.io/Jed/
 909   *
 910   * @param {LocaleData} [data]   Locale data configuration.
 911   * @param {string}     [domain] Domain for which configuration applies.
 912   */
 913  
 914  function setLocaleData(data) {
 915    var domain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
 916    i18n.data[domain] = _objectSpread({}, DEFAULT_LOCALE_DATA, {}, i18n.data[domain], {}, data); // Populate default domain configuration (supported locale date which omits
 917    // a plural forms expression).
 918  
 919    i18n.data[domain][''] = _objectSpread({}, DEFAULT_LOCALE_DATA[''], {}, i18n.data[domain]['']);
 920  }
 921  /**
 922   * Wrapper for Tannin's `dcnpgettext`. Populates default locale data if not
 923   * otherwise previously assigned.
 924   *
 925   * @param {string|undefined} domain   Domain to retrieve the translated text.
 926   * @param {string|undefined} context  Context information for the translators.
 927   * @param {string}           single   Text to translate if non-plural. Used as
 928   *                                    fallback return value on a caught error.
 929   * @param {string}           [plural] The text to be used if the number is
 930   *                                    plural.
 931   * @param {number}           [number] The number to compare against to use
 932   *                                    either the singular or plural form.
 933   *
 934   * @return {string} The translated string.
 935   */
 936  
 937  function dcnpgettext() {
 938    var domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
 939    var context = arguments.length > 1 ? arguments[1] : undefined;
 940    var single = arguments.length > 2 ? arguments[2] : undefined;
 941    var plural = arguments.length > 3 ? arguments[3] : undefined;
 942    var number = arguments.length > 4 ? arguments[4] : undefined;
 943  
 944    if (!i18n.data[domain]) {
 945      setLocaleData(undefined, domain);
 946    }
 947  
 948    return i18n.dcnpgettext(domain, context, single, plural, number);
 949  }
 950  /**
 951   * Retrieve the translation of text.
 952   *
 953   * @see https://developer.wordpress.org/reference/functions/__/
 954   *
 955   * @param {string} text     Text to translate.
 956   * @param {string} [domain] Domain to retrieve the translated text.
 957   *
 958   * @return {string} Translated text.
 959   */
 960  
 961  
 962  function __(text, domain) {
 963    return dcnpgettext(domain, undefined, text);
 964  }
 965  /**
 966   * Retrieve translated string with gettext context.
 967   *
 968   * @see https://developer.wordpress.org/reference/functions/_x/
 969   *
 970   * @param {string} text     Text to translate.
 971   * @param {string} context  Context information for the translators.
 972   * @param {string} [domain] Domain to retrieve the translated text.
 973   *
 974   * @return {string} Translated context string without pipe.
 975   */
 976  
 977  function _x(text, context, domain) {
 978    return dcnpgettext(domain, context, text);
 979  }
 980  /**
 981   * Translates and retrieves the singular or plural form based on the supplied
 982   * number.
 983   *
 984   * @see https://developer.wordpress.org/reference/functions/_n/
 985   *
 986   * @param {string} single   The text to be used if the number is singular.
 987   * @param {string} plural   The text to be used if the number is plural.
 988   * @param {number} number   The number to compare against to use either the
 989   *                          singular or plural form.
 990   * @param {string} [domain] Domain to retrieve the translated text.
 991   *
 992   * @return {string} The translated singular or plural form.
 993   */
 994  
 995  function _n(single, plural, number, domain) {
 996    return dcnpgettext(domain, undefined, single, plural, number);
 997  }
 998  /**
 999   * Translates and retrieves the singular or plural form based on the supplied
1000   * number, with gettext context.
1001   *
1002   * @see https://developer.wordpress.org/reference/functions/_nx/
1003   *
1004   * @param {string} single   The text to be used if the number is singular.
1005   * @param {string} plural   The text to be used if the number is plural.
1006   * @param {number} number   The number to compare against to use either the
1007   *                          singular or plural form.
1008   * @param {string} context  Context information for the translators.
1009   * @param {string} [domain] Domain to retrieve the translated text.
1010   *
1011   * @return {string} The translated singular or plural form.
1012   */
1013  
1014  function _nx(single, plural, number, context, domain) {
1015    return dcnpgettext(domain, context, single, plural, number);
1016  }
1017  /**
1018   * Returns a formatted string. If an error occurs in applying the format, the
1019   * original format string is returned.
1020   *
1021   * @param {string}    format The format of the string to generate.
1022   * @param {...string} args   Arguments to apply to the format.
1023   *
1024   * @see http://www.diveintojavascript.com/projects/javascript-sprintf
1025   *
1026   * @return {string} The formatted string.
1027   */
1028  
1029  function build_module_sprintf(format) {
1030    try {
1031      for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1032        args[_key - 1] = arguments[_key];
1033      }
1034  
1035      return sprintf_default.a.sprintf.apply(sprintf_default.a, [format].concat(args));
1036    } catch (error) {
1037      logErrorOnce('sprintf error: \n\n' + error.toString());
1038      return format;
1039    }
1040  }
1041  
1042  
1043  /***/ }),
1044  
1045  /***/ 46:
1046  /***/ (function(module, exports, __webpack_require__) {
1047  
1048  /**
1049   * Memize options object.
1050   *
1051   * @typedef MemizeOptions
1052   *
1053   * @property {number} [maxSize] Maximum size of the cache.
1054   */
1055  
1056  /**
1057   * Internal cache entry.
1058   *
1059   * @typedef MemizeCacheNode
1060   *
1061   * @property {?MemizeCacheNode|undefined} [prev] Previous node.
1062   * @property {?MemizeCacheNode|undefined} [next] Next node.
1063   * @property {Array<*>}                   args   Function arguments for cache
1064   *                                               entry.
1065   * @property {*}                          val    Function result.
1066   */
1067  
1068  /**
1069   * Properties of the enhanced function for controlling cache.
1070   *
1071   * @typedef MemizeMemoizedFunction
1072   *
1073   * @property {()=>void} clear Clear the cache.
1074   */
1075  
1076  /**
1077   * Accepts a function to be memoized, and returns a new memoized function, with
1078   * optional options.
1079   *
1080   * @template {Function} F
1081   *
1082   * @param {F}             fn        Function to memoize.
1083   * @param {MemizeOptions} [options] Options object.
1084   *
1085   * @return {F & MemizeMemoizedFunction} Memoized function.
1086   */
1087  function memize( fn, options ) {
1088      var size = 0;
1089  
1090      /** @type {?MemizeCacheNode|undefined} */
1091      var head;
1092  
1093      /** @type {?MemizeCacheNode|undefined} */
1094      var tail;
1095  
1096      options = options || {};
1097  
1098  	function memoized( /* ...args */ ) {
1099          var node = head,
1100              len = arguments.length,
1101              args, i;
1102  
1103          searchCache: while ( node ) {
1104              // Perform a shallow equality test to confirm that whether the node
1105              // under test is a candidate for the arguments passed. Two arrays
1106              // are shallowly equal if their length matches and each entry is
1107              // strictly equal between the two sets. Avoid abstracting to a
1108              // function which could incur an arguments leaking deoptimization.
1109  
1110              // Check whether node arguments match arguments length
1111              if ( node.args.length !== arguments.length ) {
1112                  node = node.next;
1113                  continue;
1114              }
1115  
1116              // Check whether node arguments match arguments values
1117              for ( i = 0; i < len; i++ ) {
1118                  if ( node.args[ i ] !== arguments[ i ] ) {
1119                      node = node.next;
1120                      continue searchCache;
1121                  }
1122              }
1123  
1124              // At this point we can assume we've found a match
1125  
1126              // Surface matched node to head if not already
1127              if ( node !== head ) {
1128                  // As tail, shift to previous. Must only shift if not also
1129                  // head, since if both head and tail, there is no previous.
1130                  if ( node === tail ) {
1131                      tail = node.prev;
1132                  }
1133  
1134                  // Adjust siblings to point to each other. If node was tail,
1135                  // this also handles new tail's empty `next` assignment.
1136                  /** @type {MemizeCacheNode} */ ( node.prev ).next = node.next;
1137                  if ( node.next ) {
1138                      node.next.prev = node.prev;
1139                  }
1140  
1141                  node.next = head;
1142                  node.prev = null;
1143                  /** @type {MemizeCacheNode} */ ( head ).prev = node;
1144                  head = node;
1145              }
1146  
1147              // Return immediately
1148              return node.val;
1149          }
1150  
1151          // No cached value found. Continue to insertion phase:
1152  
1153          // Create a copy of arguments (avoid leaking deoptimization)
1154          args = new Array( len );
1155          for ( i = 0; i < len; i++ ) {
1156              args[ i ] = arguments[ i ];
1157          }
1158  
1159          node = {
1160              args: args,
1161  
1162              // Generate the result from original function
1163              val: fn.apply( null, args ),
1164          };
1165  
1166          // Don't need to check whether node is already head, since it would
1167          // have been returned above already if it was
1168  
1169          // Shift existing head down list
1170          if ( head ) {
1171              head.prev = node;
1172              node.next = head;
1173          } else {
1174              // If no head, follows that there's no tail (at initial or reset)
1175              tail = node;
1176          }
1177  
1178          // Trim tail if we're reached max size and are pending cache insertion
1179          if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) {
1180              tail = /** @type {MemizeCacheNode} */ ( tail ).prev;
1181              /** @type {MemizeCacheNode} */ ( tail ).next = null;
1182          } else {
1183              size++;
1184          }
1185  
1186          head = node;
1187  
1188          return node.val;
1189      }
1190  
1191      memoized.clear = function() {
1192          head = null;
1193          tail = null;
1194          size = 0;
1195      };
1196  
1197      if ( false ) {}
1198  
1199      // Ignore reason: There's not a clear solution to create an intersection of
1200      // the function with additional properties, where the goal is to retain the
1201      // function signature of the incoming argument and add control properties
1202      // on the return value.
1203  
1204      // @ts-ignore
1205      return memoized;
1206  }
1207  
1208  module.exports = memize;
1209  
1210  
1211  /***/ }),
1212  
1213  /***/ 5:
1214  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1215  
1216  "use strict";
1217  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
1218  function _defineProperty(obj, key, value) {
1219    if (key in obj) {
1220      Object.defineProperty(obj, key, {
1221        value: value,
1222        enumerable: true,
1223        configurable: true,
1224        writable: true
1225      });
1226    } else {
1227      obj[key] = value;
1228    }
1229  
1230    return obj;
1231  }
1232  
1233  /***/ })
1234  
1235  /******/ });


Generated: Sat Apr 4 01:00:03 2020 Cross-referenced by PHPXref 0.7.1