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