@pie-element/ebsr 10.2.6-next.31 → 10.2.6-next.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/module/element.js +3574 -308
- package/module/print.js +7287 -7253
- package/package.json +3 -3
package/module/element.js
CHANGED
|
@@ -136,7 +136,7 @@ function createGenerateClassName$1() {
|
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
var createMuiTheme$1 = {};
|
|
139
|
-
var defineProperty$
|
|
139
|
+
var defineProperty$2 = {
|
|
140
140
|
exports: {}
|
|
141
141
|
};
|
|
142
142
|
(function (module) {
|
|
@@ -154,8 +154,8 @@ var defineProperty$1 = {
|
|
|
154
154
|
return obj;
|
|
155
155
|
}
|
|
156
156
|
(module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
157
|
-
})(defineProperty$
|
|
158
|
-
getDefaultExportFromCjs(defineProperty$
|
|
157
|
+
})(defineProperty$2);
|
|
158
|
+
getDefaultExportFromCjs(defineProperty$2.exports);
|
|
159
159
|
var _extends$1 = {
|
|
160
160
|
exports: {}
|
|
161
161
|
};
|
|
@@ -390,7 +390,7 @@ Object.defineProperty(createMixins$1, "__esModule", {
|
|
|
390
390
|
value: true
|
|
391
391
|
});
|
|
392
392
|
createMixins$1.default = createMixins;
|
|
393
|
-
var _defineProperty2$d = _interopRequireDefault$I(defineProperty$
|
|
393
|
+
var _defineProperty2$d = _interopRequireDefault$I(defineProperty$2.exports);
|
|
394
394
|
var _extends3$2 = _interopRequireDefault$I(_extends$1.exports);
|
|
395
395
|
function createMixins(breakpoints, spacing, mixins) {
|
|
396
396
|
var _toolbar;
|
|
@@ -803,7 +803,7 @@ function createPalette(palette) {
|
|
|
803
803
|
}
|
|
804
804
|
var createTypography$1 = {};
|
|
805
805
|
var componentPropType$1 = {};
|
|
806
|
-
var _typeof$
|
|
806
|
+
var _typeof$3 = {
|
|
807
807
|
exports: {}
|
|
808
808
|
};
|
|
809
809
|
(function (module) {
|
|
@@ -816,8 +816,8 @@ var _typeof$1 = {
|
|
|
816
816
|
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj));
|
|
817
817
|
}
|
|
818
818
|
(module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
819
|
-
})(_typeof$
|
|
820
|
-
getDefaultExportFromCjs(_typeof$
|
|
819
|
+
})(_typeof$3);
|
|
820
|
+
getDefaultExportFromCjs(_typeof$3.exports);
|
|
821
821
|
var reactIs$1 = {
|
|
822
822
|
exports: {}
|
|
823
823
|
};
|
|
@@ -976,7 +976,7 @@ Object.defineProperty(componentPropType$1, "__esModule", {
|
|
|
976
976
|
value: true
|
|
977
977
|
});
|
|
978
978
|
var default_1$4 = componentPropType$1.default = void 0;
|
|
979
|
-
var _typeof2$2 = _interopRequireDefault$F(_typeof$
|
|
979
|
+
var _typeof2$2 = _interopRequireDefault$F(_typeof$3.exports);
|
|
980
980
|
var _reactIs = reactIs$1.exports;
|
|
981
981
|
function createComponentProp(isRequired) {
|
|
982
982
|
return function componentPropType(props, key, componentName, location, propFullName) {
|
|
@@ -1019,7 +1019,7 @@ Object.defineProperty(exactProp$1, "__esModule", {
|
|
|
1019
1019
|
value: true
|
|
1020
1020
|
});
|
|
1021
1021
|
var default_1$2 = exactProp$1.default = exactProp$1.specialProperty = void 0;
|
|
1022
|
-
var _defineProperty2$c = _interopRequireDefault$E(defineProperty$
|
|
1022
|
+
var _defineProperty2$c = _interopRequireDefault$E(defineProperty$2.exports);
|
|
1023
1023
|
var _extends3$1 = _interopRequireDefault$E(_extends$1.exports);
|
|
1024
1024
|
var specialProperty = "exact-prop: \u200B";
|
|
1025
1025
|
exactProp$1.specialProperty = specialProperty;
|
|
@@ -1356,7 +1356,7 @@ Object.defineProperty(createMuiTheme$1, "__esModule", {
|
|
|
1356
1356
|
value: true
|
|
1357
1357
|
});
|
|
1358
1358
|
createMuiTheme$1.default = void 0;
|
|
1359
|
-
var _defineProperty2$b = _interopRequireDefault$B(defineProperty$
|
|
1359
|
+
var _defineProperty2$b = _interopRequireDefault$B(defineProperty$2.exports);
|
|
1360
1360
|
var _extends2$f = _interopRequireDefault$B(_extends$1.exports);
|
|
1361
1361
|
var _objectWithoutProperties2$c = _interopRequireDefault$B(objectWithoutProperties.exports);
|
|
1362
1362
|
var _deepmerge$1 = _interopRequireDefault$B(umd.exports);
|
|
@@ -1911,11 +1911,11 @@ if (typeof self !== 'undefined') {
|
|
|
1911
1911
|
root = Function('return this')();
|
|
1912
1912
|
}
|
|
1913
1913
|
var result = symbolObservablePonyfill(root);
|
|
1914
|
-
var es = Object.freeze({
|
|
1914
|
+
var es$1 = Object.freeze({
|
|
1915
1915
|
__proto__: null,
|
|
1916
1916
|
'default': result
|
|
1917
1917
|
});
|
|
1918
|
-
var require$$0$8 = getAugmentedNamespace(es);
|
|
1918
|
+
var require$$0$8 = getAugmentedNamespace(es$1);
|
|
1919
1919
|
(function (exports) {
|
|
1920
1920
|
Object.defineProperty(exports, "__esModule", {
|
|
1921
1921
|
value: true
|
|
@@ -2435,12 +2435,12 @@ getDefaultExportFromCjs(moduleId);
|
|
|
2435
2435
|
})(createGenerateClassName);
|
|
2436
2436
|
getDefaultExportFromCjs(createGenerateClassName);
|
|
2437
2437
|
var Jss = {};
|
|
2438
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
|
2438
|
+
var _typeof$2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
|
2439
2439
|
return typeof obj;
|
|
2440
2440
|
} : function (obj) {
|
|
2441
2441
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2442
2442
|
};
|
|
2443
|
-
var isBrowser = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object' && document.nodeType === 9;
|
|
2443
|
+
var isBrowser = (typeof window === "undefined" ? "undefined" : _typeof$2(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof$2(document)) === 'object' && document.nodeType === 9;
|
|
2444
2444
|
var module$1 = Object.freeze({
|
|
2445
2445
|
__proto__: null,
|
|
2446
2446
|
isBrowser: isBrowser,
|
|
@@ -4476,7 +4476,7 @@ var interopRequireWildcard = {
|
|
|
4476
4476
|
exports: {}
|
|
4477
4477
|
};
|
|
4478
4478
|
(function (module) {
|
|
4479
|
-
var _typeof = _typeof$
|
|
4479
|
+
var _typeof = _typeof$3.exports["default"];
|
|
4480
4480
|
function _getRequireWildcardCache(nodeInterop) {
|
|
4481
4481
|
if (typeof WeakMap !== "function") return null;
|
|
4482
4482
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -4519,7 +4519,7 @@ var interopRequireWildcard = {
|
|
|
4519
4519
|
(module.exports = _interopRequireWildcard, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4520
4520
|
})(interopRequireWildcard);
|
|
4521
4521
|
getDefaultExportFromCjs(interopRequireWildcard.exports);
|
|
4522
|
-
var classCallCheck = {
|
|
4522
|
+
var classCallCheck$1 = {
|
|
4523
4523
|
exports: {}
|
|
4524
4524
|
};
|
|
4525
4525
|
(function (module) {
|
|
@@ -4529,9 +4529,9 @@ var classCallCheck = {
|
|
|
4529
4529
|
}
|
|
4530
4530
|
}
|
|
4531
4531
|
(module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4532
|
-
})(classCallCheck);
|
|
4533
|
-
getDefaultExportFromCjs(classCallCheck.exports);
|
|
4534
|
-
var createClass = {
|
|
4532
|
+
})(classCallCheck$1);
|
|
4533
|
+
getDefaultExportFromCjs(classCallCheck$1.exports);
|
|
4534
|
+
var createClass$1 = {
|
|
4535
4535
|
exports: {}
|
|
4536
4536
|
};
|
|
4537
4537
|
(function (module) {
|
|
@@ -4553,12 +4553,12 @@ var createClass = {
|
|
|
4553
4553
|
return Constructor;
|
|
4554
4554
|
}
|
|
4555
4555
|
(module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4556
|
-
})(createClass);
|
|
4557
|
-
getDefaultExportFromCjs(createClass.exports);
|
|
4558
|
-
var possibleConstructorReturn = {
|
|
4556
|
+
})(createClass$1);
|
|
4557
|
+
getDefaultExportFromCjs(createClass$1.exports);
|
|
4558
|
+
var possibleConstructorReturn$1 = {
|
|
4559
4559
|
exports: {}
|
|
4560
4560
|
};
|
|
4561
|
-
var assertThisInitialized = {
|
|
4561
|
+
var assertThisInitialized$1 = {
|
|
4562
4562
|
exports: {}
|
|
4563
4563
|
};
|
|
4564
4564
|
(function (module) {
|
|
@@ -4569,23 +4569,23 @@ var assertThisInitialized = {
|
|
|
4569
4569
|
return self;
|
|
4570
4570
|
}
|
|
4571
4571
|
(module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4572
|
-
})(assertThisInitialized);
|
|
4573
|
-
getDefaultExportFromCjs(assertThisInitialized.exports);
|
|
4572
|
+
})(assertThisInitialized$1);
|
|
4573
|
+
getDefaultExportFromCjs(assertThisInitialized$1.exports);
|
|
4574
4574
|
(function (module) {
|
|
4575
|
-
var _typeof = _typeof$
|
|
4576
|
-
var assertThisInitialized
|
|
4575
|
+
var _typeof = _typeof$3.exports["default"];
|
|
4576
|
+
var assertThisInitialized = assertThisInitialized$1.exports;
|
|
4577
4577
|
function _possibleConstructorReturn(self, call) {
|
|
4578
4578
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
4579
4579
|
return call;
|
|
4580
4580
|
} else if (call !== void 0) {
|
|
4581
4581
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
4582
4582
|
}
|
|
4583
|
-
return assertThisInitialized
|
|
4583
|
+
return assertThisInitialized(self);
|
|
4584
4584
|
}
|
|
4585
4585
|
(module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4586
|
-
})(possibleConstructorReturn);
|
|
4587
|
-
getDefaultExportFromCjs(possibleConstructorReturn.exports);
|
|
4588
|
-
var getPrototypeOf$
|
|
4586
|
+
})(possibleConstructorReturn$1);
|
|
4587
|
+
getDefaultExportFromCjs(possibleConstructorReturn$1.exports);
|
|
4588
|
+
var getPrototypeOf$2 = {
|
|
4589
4589
|
exports: {}
|
|
4590
4590
|
};
|
|
4591
4591
|
(function (module) {
|
|
@@ -4596,12 +4596,12 @@ var getPrototypeOf$1 = {
|
|
|
4596
4596
|
return _getPrototypeOf(o);
|
|
4597
4597
|
}
|
|
4598
4598
|
(module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4599
|
-
})(getPrototypeOf$
|
|
4600
|
-
getDefaultExportFromCjs(getPrototypeOf$
|
|
4601
|
-
var inherits = {
|
|
4599
|
+
})(getPrototypeOf$2);
|
|
4600
|
+
getDefaultExportFromCjs(getPrototypeOf$2.exports);
|
|
4601
|
+
var inherits$1 = {
|
|
4602
4602
|
exports: {}
|
|
4603
4603
|
};
|
|
4604
|
-
var setPrototypeOf = {
|
|
4604
|
+
var setPrototypeOf$1 = {
|
|
4605
4605
|
exports: {}
|
|
4606
4606
|
};
|
|
4607
4607
|
(function (module) {
|
|
@@ -4613,10 +4613,10 @@ var setPrototypeOf = {
|
|
|
4613
4613
|
return _setPrototypeOf(o, p);
|
|
4614
4614
|
}
|
|
4615
4615
|
(module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4616
|
-
})(setPrototypeOf);
|
|
4617
|
-
getDefaultExportFromCjs(setPrototypeOf.exports);
|
|
4616
|
+
})(setPrototypeOf$1);
|
|
4617
|
+
getDefaultExportFromCjs(setPrototypeOf$1.exports);
|
|
4618
4618
|
(function (module) {
|
|
4619
|
-
var setPrototypeOf
|
|
4619
|
+
var setPrototypeOf = setPrototypeOf$1.exports;
|
|
4620
4620
|
function _inherits(subClass, superClass) {
|
|
4621
4621
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
4622
4622
|
throw new TypeError("Super expression must either be null or a function");
|
|
@@ -4631,11 +4631,11 @@ getDefaultExportFromCjs(setPrototypeOf.exports);
|
|
|
4631
4631
|
Object.defineProperty(subClass, "prototype", {
|
|
4632
4632
|
writable: false
|
|
4633
4633
|
});
|
|
4634
|
-
if (superClass) setPrototypeOf
|
|
4634
|
+
if (superClass) setPrototypeOf(subClass, superClass);
|
|
4635
4635
|
}
|
|
4636
4636
|
(module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4637
|
-
})(inherits);
|
|
4638
|
-
getDefaultExportFromCjs(inherits.exports);
|
|
4637
|
+
})(inherits$1);
|
|
4638
|
+
getDefaultExportFromCjs(inherits$1.exports);
|
|
4639
4639
|
function createBroadcast(initialState) {
|
|
4640
4640
|
var listeners = {};
|
|
4641
4641
|
var id = 1;
|
|
@@ -4684,7 +4684,7 @@ Object.defineProperty(themeListener$1, "__esModule", {
|
|
|
4684
4684
|
value: true
|
|
4685
4685
|
});
|
|
4686
4686
|
themeListener$1.default = themeListener$1.CHANNEL = void 0;
|
|
4687
|
-
var _defineProperty2$a = _interopRequireDefault$y(defineProperty$
|
|
4687
|
+
var _defineProperty2$a = _interopRequireDefault$y(defineProperty$2.exports);
|
|
4688
4688
|
var CHANNEL = '__THEMING__';
|
|
4689
4689
|
themeListener$1.CHANNEL = CHANNEL;
|
|
4690
4690
|
var themeListener = {
|
|
@@ -4718,12 +4718,12 @@ Object.defineProperty(MuiThemeProvider, "__esModule", {
|
|
|
4718
4718
|
});
|
|
4719
4719
|
MuiThemeProvider.default = MuiThemeProvider.MuiThemeProviderOld = void 0;
|
|
4720
4720
|
var _extends2$e = _interopRequireDefault$x(_extends$1.exports);
|
|
4721
|
-
var _defineProperty2$9 = _interopRequireDefault$x(defineProperty$
|
|
4722
|
-
var _classCallCheck2$7 = _interopRequireDefault$x(classCallCheck.exports);
|
|
4723
|
-
var _createClass2$7 = _interopRequireDefault$x(createClass.exports);
|
|
4724
|
-
var _possibleConstructorReturn2$7 = _interopRequireDefault$x(possibleConstructorReturn.exports);
|
|
4725
|
-
var _getPrototypeOf2$3 = _interopRequireDefault$x(getPrototypeOf$
|
|
4726
|
-
var _inherits2$7 = _interopRequireDefault$x(inherits.exports);
|
|
4721
|
+
var _defineProperty2$9 = _interopRequireDefault$x(defineProperty$2.exports);
|
|
4722
|
+
var _classCallCheck2$7 = _interopRequireDefault$x(classCallCheck$1.exports);
|
|
4723
|
+
var _createClass2$7 = _interopRequireDefault$x(createClass$1.exports);
|
|
4724
|
+
var _possibleConstructorReturn2$7 = _interopRequireDefault$x(possibleConstructorReturn$1.exports);
|
|
4725
|
+
var _getPrototypeOf2$3 = _interopRequireDefault$x(getPrototypeOf$2.exports);
|
|
4726
|
+
var _inherits2$7 = _interopRequireDefault$x(inherits$1.exports);
|
|
4727
4727
|
var _react$n = _interopRequireDefault$x(require$$9$4);
|
|
4728
4728
|
var _propTypes$e = _interopRequireDefault$x(require$$10$5);
|
|
4729
4729
|
var _warning$5 = _interopRequireDefault$x(warning_1);
|
|
@@ -4882,16 +4882,16 @@ function getStatics(component) {
|
|
|
4882
4882
|
}
|
|
4883
4883
|
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
|
|
4884
4884
|
}
|
|
4885
|
-
var defineProperty = Object.defineProperty;
|
|
4885
|
+
var defineProperty$1 = Object.defineProperty;
|
|
4886
4886
|
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
4887
4887
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
4888
4888
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
4889
|
-
var getPrototypeOf = Object.getPrototypeOf;
|
|
4889
|
+
var getPrototypeOf$1 = Object.getPrototypeOf;
|
|
4890
4890
|
var objectPrototype = Object.prototype;
|
|
4891
4891
|
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
|
4892
4892
|
if (typeof sourceComponent !== 'string') {
|
|
4893
4893
|
if (objectPrototype) {
|
|
4894
|
-
var inheritedComponent = getPrototypeOf(sourceComponent);
|
|
4894
|
+
var inheritedComponent = getPrototypeOf$1(sourceComponent);
|
|
4895
4895
|
if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
|
4896
4896
|
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
|
4897
4897
|
}
|
|
@@ -4907,7 +4907,7 @@ function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
|
|
4907
4907
|
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
|
4908
4908
|
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
|
4909
4909
|
try {
|
|
4910
|
-
defineProperty(targetComponent, key, descriptor);
|
|
4910
|
+
defineProperty$1(targetComponent, key, descriptor);
|
|
4911
4911
|
} catch (e) {}
|
|
4912
4912
|
}
|
|
4913
4913
|
}
|
|
@@ -4990,7 +4990,7 @@ Object.defineProperty(getStylesCreator$1, "__esModule", {
|
|
|
4990
4990
|
});
|
|
4991
4991
|
getStylesCreator$1.default = void 0;
|
|
4992
4992
|
var _extends2$c = _interopRequireDefault$v(_extends$1.exports);
|
|
4993
|
-
var _typeof2$1 = _interopRequireDefault$v(_typeof$
|
|
4993
|
+
var _typeof2$1 = _interopRequireDefault$v(_typeof$3.exports);
|
|
4994
4994
|
var _warning$3 = _interopRequireDefault$v(warning_1);
|
|
4995
4995
|
var _deepmerge = _interopRequireDefault$v(umd.exports);
|
|
4996
4996
|
function arrayMerge(destination, source) {
|
|
@@ -5050,13 +5050,13 @@ Object.defineProperty(withStyles, "__esModule", {
|
|
|
5050
5050
|
value: true
|
|
5051
5051
|
});
|
|
5052
5052
|
withStyles.default = withStyles.sheetsManager = void 0;
|
|
5053
|
-
var _defineProperty2$8 = _interopRequireDefault$u(defineProperty$
|
|
5053
|
+
var _defineProperty2$8 = _interopRequireDefault$u(defineProperty$2.exports);
|
|
5054
5054
|
var _extends3 = _interopRequireDefault$u(_extends$1.exports);
|
|
5055
|
-
var _classCallCheck2$6 = _interopRequireDefault$u(classCallCheck.exports);
|
|
5056
|
-
var _createClass2$6 = _interopRequireDefault$u(createClass.exports);
|
|
5057
|
-
var _possibleConstructorReturn2$6 = _interopRequireDefault$u(possibleConstructorReturn.exports);
|
|
5058
|
-
var _getPrototypeOf2$2 = _interopRequireDefault$u(getPrototypeOf$
|
|
5059
|
-
var _inherits2$6 = _interopRequireDefault$u(inherits.exports);
|
|
5055
|
+
var _classCallCheck2$6 = _interopRequireDefault$u(classCallCheck$1.exports);
|
|
5056
|
+
var _createClass2$6 = _interopRequireDefault$u(createClass$1.exports);
|
|
5057
|
+
var _possibleConstructorReturn2$6 = _interopRequireDefault$u(possibleConstructorReturn$1.exports);
|
|
5058
|
+
var _getPrototypeOf2$2 = _interopRequireDefault$u(getPrototypeOf$2.exports);
|
|
5059
|
+
var _inherits2$6 = _interopRequireDefault$u(inherits$1.exports);
|
|
5060
5060
|
var _objectWithoutProperties2$b = _interopRequireDefault$u(objectWithoutProperties.exports);
|
|
5061
5061
|
var _react$m = _interopRequireDefault$u(require$$9$3);
|
|
5062
5062
|
var _propTypes$d = _interopRequireDefault$u(require$$10$4);
|
|
@@ -5317,11 +5317,11 @@ Object.defineProperty(withTheme, "__esModule", {
|
|
|
5317
5317
|
withTheme.default = void 0;
|
|
5318
5318
|
var _extends2$b = _interopRequireDefault$t(_extends$1.exports);
|
|
5319
5319
|
var _objectWithoutProperties2$a = _interopRequireDefault$t(objectWithoutProperties.exports);
|
|
5320
|
-
var _classCallCheck2$5 = _interopRequireDefault$t(classCallCheck.exports);
|
|
5321
|
-
var _createClass2$5 = _interopRequireDefault$t(createClass.exports);
|
|
5322
|
-
var _possibleConstructorReturn2$5 = _interopRequireDefault$t(possibleConstructorReturn.exports);
|
|
5323
|
-
var _getPrototypeOf2$1 = _interopRequireDefault$t(getPrototypeOf$
|
|
5324
|
-
var _inherits2$5 = _interopRequireDefault$t(inherits.exports);
|
|
5320
|
+
var _classCallCheck2$5 = _interopRequireDefault$t(classCallCheck$1.exports);
|
|
5321
|
+
var _createClass2$5 = _interopRequireDefault$t(createClass$1.exports);
|
|
5322
|
+
var _possibleConstructorReturn2$5 = _interopRequireDefault$t(possibleConstructorReturn$1.exports);
|
|
5323
|
+
var _getPrototypeOf2$1 = _interopRequireDefault$t(getPrototypeOf$2.exports);
|
|
5324
|
+
var _inherits2$5 = _interopRequireDefault$t(inherits$1.exports);
|
|
5325
5325
|
var _react$l = _interopRequireDefault$t(require$$8);
|
|
5326
5326
|
var _propTypes$c = _interopRequireDefault$t(require$$9$2);
|
|
5327
5327
|
var _hoistNonReactStatics$1 = _interopRequireDefault$t(hoistNonReactStatics_cjs);
|
|
@@ -5460,154 +5460,3386 @@ withTheme.default = _default$s;
|
|
|
5460
5460
|
var _withTheme = _interopRequireDefault(withTheme);
|
|
5461
5461
|
})(styles$b);
|
|
5462
5462
|
getDefaultExportFromCjs(styles$b);
|
|
5463
|
-
var
|
|
5464
|
-
var
|
|
5465
|
-
var
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
FormControlContext$1.default = _default$r;
|
|
5477
|
-
const require$$2$3 = _dll_react;
|
|
5478
|
-
var _interopRequireDefault$r = interopRequireDefault.exports;
|
|
5479
|
-
Object.defineProperty(withFormControlContext$1, "__esModule", {
|
|
5480
|
-
value: true
|
|
5481
|
-
});
|
|
5482
|
-
withFormControlContext$1.default = withFormControlContext;
|
|
5483
|
-
var _extends2$a = _interopRequireDefault$r(_extends$1.exports);
|
|
5484
|
-
var _react$j = _interopRequireDefault$r(require$$2$3);
|
|
5485
|
-
var _hoistNonReactStatics = _interopRequireDefault$r(hoistNonReactStatics_cjs);
|
|
5486
|
-
var _FormControlContext = _interopRequireDefault$r(FormControlContext$1);
|
|
5487
|
-
var _utils$5 = require$$7$1;
|
|
5488
|
-
function withFormControlContext(Component) {
|
|
5489
|
-
var EnhancedComponent = function EnhancedComponent(props) {
|
|
5490
|
-
return _react$j.default.createElement(_FormControlContext.default.Consumer, null, function (context) {
|
|
5491
|
-
return _react$j.default.createElement(Component, (0, _extends2$a.default)({
|
|
5492
|
-
muiFormControl: context
|
|
5493
|
-
}, props));
|
|
5494
|
-
});
|
|
5495
|
-
};
|
|
5496
|
-
{
|
|
5497
|
-
EnhancedComponent.displayName = ("WithFormControlContext(").concat((0, _utils$5.getDisplayName)(Component), ")");
|
|
5498
|
-
}
|
|
5499
|
-
(0, _hoistNonReactStatics.default)(EnhancedComponent, Component);
|
|
5500
|
-
return EnhancedComponent;
|
|
5501
|
-
}
|
|
5502
|
-
var Typography$2 = {};
|
|
5503
|
-
var Typography$1 = {};
|
|
5504
|
-
var helpers = {};
|
|
5505
|
-
var _interopRequireDefault$q = interopRequireDefault.exports;
|
|
5506
|
-
Object.defineProperty(helpers, "__esModule", {
|
|
5507
|
-
value: true
|
|
5508
|
-
});
|
|
5509
|
-
helpers.capitalize = capitalize;
|
|
5510
|
-
helpers.contains = contains;
|
|
5511
|
-
helpers.findIndex = findIndex;
|
|
5512
|
-
helpers.find = find;
|
|
5513
|
-
helpers.createChainedFunction = createChainedFunction;
|
|
5514
|
-
var _typeof2 = _interopRequireDefault$q(_typeof$1.exports);
|
|
5515
|
-
var _warning$1 = _interopRequireDefault$q(warning_1);
|
|
5516
|
-
function capitalize(string) {
|
|
5517
|
-
if (typeof string !== 'string') {
|
|
5518
|
-
throw new Error('Material-UI: capitalize(string) expects a string argument.');
|
|
5463
|
+
var translator$2 = {};
|
|
5464
|
+
var translator$1 = {};
|
|
5465
|
+
var _typeof$1 = {
|
|
5466
|
+
exports: {}
|
|
5467
|
+
};
|
|
5468
|
+
(function (module) {
|
|
5469
|
+
function _typeof(obj) {
|
|
5470
|
+
"@babel/helpers - typeof";
|
|
5471
|
+
return ((module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
5472
|
+
return typeof obj;
|
|
5473
|
+
} : function (obj) {
|
|
5474
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
5475
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj));
|
|
5519
5476
|
}
|
|
5520
|
-
|
|
5521
|
-
}
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
function
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
if (predType === 'function' && !!pred(arr[i], i, arr) === true) {
|
|
5531
|
-
return i;
|
|
5477
|
+
(module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5478
|
+
})(_typeof$1);
|
|
5479
|
+
getDefaultExportFromCjs(_typeof$1.exports);
|
|
5480
|
+
var classCallCheck = {
|
|
5481
|
+
exports: {}
|
|
5482
|
+
};
|
|
5483
|
+
(function (module) {
|
|
5484
|
+
function _classCallCheck(instance, Constructor) {
|
|
5485
|
+
if (!(instance instanceof Constructor)) {
|
|
5486
|
+
throw new TypeError("Cannot call a class as a function");
|
|
5532
5487
|
}
|
|
5533
|
-
|
|
5534
|
-
|
|
5488
|
+
}
|
|
5489
|
+
(module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5490
|
+
})(classCallCheck);
|
|
5491
|
+
getDefaultExportFromCjs(classCallCheck.exports);
|
|
5492
|
+
var createClass = {
|
|
5493
|
+
exports: {}
|
|
5494
|
+
};
|
|
5495
|
+
var toPropertyKey = {
|
|
5496
|
+
exports: {}
|
|
5497
|
+
};
|
|
5498
|
+
var toPrimitive = {
|
|
5499
|
+
exports: {}
|
|
5500
|
+
};
|
|
5501
|
+
(function (module) {
|
|
5502
|
+
var _typeof = _typeof$1.exports["default"];
|
|
5503
|
+
function _toPrimitive(input, hint) {
|
|
5504
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
5505
|
+
var prim = input[Symbol.toPrimitive];
|
|
5506
|
+
if (prim !== undefined) {
|
|
5507
|
+
var res = prim.call(input, hint || "default");
|
|
5508
|
+
if (_typeof(res) !== "object") return res;
|
|
5509
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
5510
|
+
}
|
|
5511
|
+
return (hint === "string" ? String : Number)(input);
|
|
5512
|
+
}
|
|
5513
|
+
(module.exports = _toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5514
|
+
})(toPrimitive);
|
|
5515
|
+
getDefaultExportFromCjs(toPrimitive.exports);
|
|
5516
|
+
(function (module) {
|
|
5517
|
+
var _typeof = _typeof$1.exports["default"];
|
|
5518
|
+
var toPrimitive$1 = toPrimitive.exports;
|
|
5519
|
+
function _toPropertyKey(arg) {
|
|
5520
|
+
var key = toPrimitive$1(arg, "string");
|
|
5521
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
5522
|
+
}
|
|
5523
|
+
(module.exports = _toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5524
|
+
})(toPropertyKey);
|
|
5525
|
+
getDefaultExportFromCjs(toPropertyKey.exports);
|
|
5526
|
+
(function (module) {
|
|
5527
|
+
var toPropertyKey$1 = toPropertyKey.exports;
|
|
5528
|
+
function _defineProperties(target, props) {
|
|
5529
|
+
for (var i = 0; i < props.length; i++) {
|
|
5530
|
+
var descriptor = props[i];
|
|
5531
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
5532
|
+
descriptor.configurable = true;
|
|
5533
|
+
if (("value" in descriptor)) descriptor.writable = true;
|
|
5534
|
+
Object.defineProperty(target, toPropertyKey$1(descriptor.key), descriptor);
|
|
5535
5535
|
}
|
|
5536
|
-
|
|
5537
|
-
|
|
5536
|
+
}
|
|
5537
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
5538
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
5539
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
5540
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
5541
|
+
writable: false
|
|
5542
|
+
});
|
|
5543
|
+
return Constructor;
|
|
5544
|
+
}
|
|
5545
|
+
(module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5546
|
+
})(createClass);
|
|
5547
|
+
getDefaultExportFromCjs(createClass.exports);
|
|
5548
|
+
var assertThisInitialized = {
|
|
5549
|
+
exports: {}
|
|
5550
|
+
};
|
|
5551
|
+
(function (module) {
|
|
5552
|
+
function _assertThisInitialized(self) {
|
|
5553
|
+
if (self === void 0) {
|
|
5554
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
5538
5555
|
}
|
|
5556
|
+
return self;
|
|
5539
5557
|
}
|
|
5540
|
-
|
|
5541
|
-
}
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
}
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5558
|
+
(module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5559
|
+
})(assertThisInitialized);
|
|
5560
|
+
getDefaultExportFromCjs(assertThisInitialized.exports);
|
|
5561
|
+
var inherits = {
|
|
5562
|
+
exports: {}
|
|
5563
|
+
};
|
|
5564
|
+
var setPrototypeOf = {
|
|
5565
|
+
exports: {}
|
|
5566
|
+
};
|
|
5567
|
+
(function (module) {
|
|
5568
|
+
function _setPrototypeOf(o, p) {
|
|
5569
|
+
(module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
5570
|
+
o.__proto__ = p;
|
|
5571
|
+
return o;
|
|
5572
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5573
|
+
return _setPrototypeOf(o, p);
|
|
5549
5574
|
}
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5575
|
+
(module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5576
|
+
})(setPrototypeOf);
|
|
5577
|
+
getDefaultExportFromCjs(setPrototypeOf.exports);
|
|
5578
|
+
(function (module) {
|
|
5579
|
+
var setPrototypeOf$1 = setPrototypeOf.exports;
|
|
5580
|
+
function _inherits(subClass, superClass) {
|
|
5581
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
5582
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
5553
5583
|
}
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5584
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
5585
|
+
constructor: {
|
|
5586
|
+
value: subClass,
|
|
5587
|
+
writable: true,
|
|
5588
|
+
configurable: true
|
|
5558
5589
|
}
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
}
|
|
5571
|
-
|
|
5572
|
-
var
|
|
5573
|
-
var
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5590
|
+
});
|
|
5591
|
+
Object.defineProperty(subClass, "prototype", {
|
|
5592
|
+
writable: false
|
|
5593
|
+
});
|
|
5594
|
+
if (superClass) setPrototypeOf$1(subClass, superClass);
|
|
5595
|
+
}
|
|
5596
|
+
(module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5597
|
+
})(inherits);
|
|
5598
|
+
getDefaultExportFromCjs(inherits.exports);
|
|
5599
|
+
var possibleConstructorReturn = {
|
|
5600
|
+
exports: {}
|
|
5601
|
+
};
|
|
5602
|
+
(function (module) {
|
|
5603
|
+
var _typeof = _typeof$1.exports["default"];
|
|
5604
|
+
var assertThisInitialized$1 = assertThisInitialized.exports;
|
|
5605
|
+
function _possibleConstructorReturn(self, call) {
|
|
5606
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
5607
|
+
return call;
|
|
5608
|
+
} else if (call !== void 0) {
|
|
5609
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
5610
|
+
}
|
|
5611
|
+
return assertThisInitialized$1(self);
|
|
5612
|
+
}
|
|
5613
|
+
(module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5614
|
+
})(possibleConstructorReturn);
|
|
5615
|
+
getDefaultExportFromCjs(possibleConstructorReturn.exports);
|
|
5616
|
+
var getPrototypeOf = {
|
|
5617
|
+
exports: {}
|
|
5618
|
+
};
|
|
5619
|
+
(function (module) {
|
|
5620
|
+
function _getPrototypeOf(o) {
|
|
5621
|
+
(module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
5622
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
5623
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5624
|
+
return _getPrototypeOf(o);
|
|
5625
|
+
}
|
|
5626
|
+
(module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5627
|
+
})(getPrototypeOf);
|
|
5628
|
+
getDefaultExportFromCjs(getPrototypeOf.exports);
|
|
5629
|
+
var defineProperty = {
|
|
5630
|
+
exports: {}
|
|
5631
|
+
};
|
|
5632
|
+
(function (module) {
|
|
5633
|
+
var toPropertyKey$1 = toPropertyKey.exports;
|
|
5634
|
+
function _defineProperty(obj, key, value) {
|
|
5635
|
+
key = toPropertyKey$1(key);
|
|
5636
|
+
if ((key in obj)) {
|
|
5637
|
+
Object.defineProperty(obj, key, {
|
|
5638
|
+
value: value,
|
|
5639
|
+
enumerable: true,
|
|
5640
|
+
configurable: true,
|
|
5641
|
+
writable: true
|
|
5642
|
+
});
|
|
5643
|
+
} else {
|
|
5644
|
+
obj[key] = value;
|
|
5645
|
+
}
|
|
5646
|
+
return obj;
|
|
5647
|
+
}
|
|
5648
|
+
(module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5649
|
+
})(defineProperty);
|
|
5650
|
+
getDefaultExportFromCjs(defineProperty.exports);
|
|
5651
|
+
var toArray = {
|
|
5652
|
+
exports: {}
|
|
5653
|
+
};
|
|
5654
|
+
var arrayWithHoles = {
|
|
5655
|
+
exports: {}
|
|
5656
|
+
};
|
|
5657
|
+
(function (module) {
|
|
5658
|
+
function _arrayWithHoles(arr) {
|
|
5659
|
+
if (Array.isArray(arr)) return arr;
|
|
5660
|
+
}
|
|
5661
|
+
(module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5662
|
+
})(arrayWithHoles);
|
|
5663
|
+
getDefaultExportFromCjs(arrayWithHoles.exports);
|
|
5664
|
+
var iterableToArray$1 = {
|
|
5665
|
+
exports: {}
|
|
5666
|
+
};
|
|
5667
|
+
(function (module) {
|
|
5668
|
+
function _iterableToArray(iter) {
|
|
5669
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
5670
|
+
}
|
|
5671
|
+
(module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5672
|
+
})(iterableToArray$1);
|
|
5673
|
+
getDefaultExportFromCjs(iterableToArray$1.exports);
|
|
5674
|
+
var unsupportedIterableToArray$1 = {
|
|
5675
|
+
exports: {}
|
|
5676
|
+
};
|
|
5677
|
+
var arrayLikeToArray$1 = {
|
|
5678
|
+
exports: {}
|
|
5679
|
+
};
|
|
5680
|
+
(function (module) {
|
|
5681
|
+
function _arrayLikeToArray(arr, len) {
|
|
5682
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
5683
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
5684
|
+
return arr2;
|
|
5685
|
+
}
|
|
5686
|
+
(module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5687
|
+
})(arrayLikeToArray$1);
|
|
5688
|
+
getDefaultExportFromCjs(arrayLikeToArray$1.exports);
|
|
5689
|
+
(function (module) {
|
|
5690
|
+
var arrayLikeToArray = arrayLikeToArray$1.exports;
|
|
5691
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
5692
|
+
if (!o) return;
|
|
5693
|
+
if (typeof o === "string") return arrayLikeToArray(o, minLen);
|
|
5694
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
5695
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
5696
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
5697
|
+
if (n === "Arguments" || (/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/).test(n)) return arrayLikeToArray(o, minLen);
|
|
5698
|
+
}
|
|
5699
|
+
(module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5700
|
+
})(unsupportedIterableToArray$1);
|
|
5701
|
+
getDefaultExportFromCjs(unsupportedIterableToArray$1.exports);
|
|
5702
|
+
var nonIterableRest = {
|
|
5703
|
+
exports: {}
|
|
5704
|
+
};
|
|
5705
|
+
(function (module) {
|
|
5706
|
+
function _nonIterableRest() {
|
|
5707
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5708
|
+
}
|
|
5709
|
+
(module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5710
|
+
})(nonIterableRest);
|
|
5711
|
+
getDefaultExportFromCjs(nonIterableRest.exports);
|
|
5712
|
+
(function (module) {
|
|
5713
|
+
var arrayWithHoles$1 = arrayWithHoles.exports;
|
|
5714
|
+
var iterableToArray = iterableToArray$1.exports;
|
|
5715
|
+
var unsupportedIterableToArray = unsupportedIterableToArray$1.exports;
|
|
5716
|
+
var nonIterableRest$1 = nonIterableRest.exports;
|
|
5717
|
+
function _toArray(arr) {
|
|
5718
|
+
return arrayWithHoles$1(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest$1();
|
|
5719
|
+
}
|
|
5720
|
+
(module.exports = _toArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5721
|
+
})(toArray);
|
|
5722
|
+
getDefaultExportFromCjs(toArray.exports);
|
|
5723
|
+
var _typeof = _typeof$1.exports;
|
|
5724
|
+
var _classCallCheck = classCallCheck.exports;
|
|
5725
|
+
var _createClass = createClass.exports;
|
|
5726
|
+
var _assertThisInitialized = assertThisInitialized.exports;
|
|
5727
|
+
var _inherits = inherits.exports;
|
|
5728
|
+
var _possibleConstructorReturn = possibleConstructorReturn.exports;
|
|
5729
|
+
var _getPrototypeOf = getPrototypeOf.exports;
|
|
5730
|
+
var _defineProperty = defineProperty.exports;
|
|
5731
|
+
var _toArray = toArray.exports;
|
|
5732
|
+
function _interopDefaultLegacy(e) {
|
|
5733
|
+
return e && typeof e === 'object' && ('default' in e) ? e : {
|
|
5734
|
+
'default': e
|
|
5735
|
+
};
|
|
5736
|
+
}
|
|
5737
|
+
var _typeof__default = _interopDefaultLegacy(_typeof);
|
|
5738
|
+
var _classCallCheck__default = _interopDefaultLegacy(_classCallCheck);
|
|
5739
|
+
var _createClass__default = _interopDefaultLegacy(_createClass);
|
|
5740
|
+
var _assertThisInitialized__default = _interopDefaultLegacy(_assertThisInitialized);
|
|
5741
|
+
var _inherits__default = _interopDefaultLegacy(_inherits);
|
|
5742
|
+
var _possibleConstructorReturn__default = _interopDefaultLegacy(_possibleConstructorReturn);
|
|
5743
|
+
var _getPrototypeOf__default = _interopDefaultLegacy(_getPrototypeOf);
|
|
5744
|
+
var _defineProperty__default = _interopDefaultLegacy(_defineProperty);
|
|
5745
|
+
var _toArray__default = _interopDefaultLegacy(_toArray);
|
|
5746
|
+
function ownKeys$6(object, enumerableOnly) {
|
|
5747
|
+
var keys = Object.keys(object);
|
|
5748
|
+
if (Object.getOwnPropertySymbols) {
|
|
5749
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
5750
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
5751
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
5752
|
+
})), keys.push.apply(keys, symbols));
|
|
5753
|
+
}
|
|
5754
|
+
return keys;
|
|
5755
|
+
}
|
|
5756
|
+
function _objectSpread$6(target) {
|
|
5757
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
5758
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
5759
|
+
i % 2 ? ownKeys$6(Object(source), !0).forEach(function (key) {
|
|
5760
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
5761
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function (key) {
|
|
5762
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
5763
|
+
});
|
|
5764
|
+
}
|
|
5765
|
+
return target;
|
|
5766
|
+
}
|
|
5767
|
+
var consoleLogger = {
|
|
5768
|
+
type: 'logger',
|
|
5769
|
+
log: function log(args) {
|
|
5770
|
+
this.output('log', args);
|
|
5771
|
+
},
|
|
5772
|
+
warn: function warn(args) {
|
|
5773
|
+
this.output('warn', args);
|
|
5774
|
+
},
|
|
5775
|
+
error: function error(args) {
|
|
5776
|
+
this.output('error', args);
|
|
5777
|
+
},
|
|
5778
|
+
output: function output(type, args) {
|
|
5779
|
+
if (console && console[type]) console[type].apply(console, args);
|
|
5780
|
+
}
|
|
5781
|
+
};
|
|
5782
|
+
var Logger = (function () {
|
|
5783
|
+
function Logger(concreteLogger) {
|
|
5784
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5785
|
+
_classCallCheck__default["default"](this, Logger);
|
|
5786
|
+
this.init(concreteLogger, options);
|
|
5787
|
+
}
|
|
5788
|
+
_createClass__default["default"](Logger, [{
|
|
5789
|
+
key: "init",
|
|
5790
|
+
value: function init(concreteLogger) {
|
|
5791
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5792
|
+
this.prefix = options.prefix || 'i18next:';
|
|
5793
|
+
this.logger = concreteLogger || consoleLogger;
|
|
5794
|
+
this.options = options;
|
|
5795
|
+
this.debug = options.debug;
|
|
5796
|
+
}
|
|
5797
|
+
}, {
|
|
5798
|
+
key: "setDebug",
|
|
5799
|
+
value: function setDebug(bool) {
|
|
5800
|
+
this.debug = bool;
|
|
5801
|
+
}
|
|
5802
|
+
}, {
|
|
5803
|
+
key: "log",
|
|
5804
|
+
value: function log() {
|
|
5805
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5806
|
+
args[_key] = arguments[_key];
|
|
5807
|
+
}
|
|
5808
|
+
return this.forward(args, 'log', '', true);
|
|
5809
|
+
}
|
|
5810
|
+
}, {
|
|
5811
|
+
key: "warn",
|
|
5812
|
+
value: function warn() {
|
|
5813
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
5814
|
+
args[_key2] = arguments[_key2];
|
|
5815
|
+
}
|
|
5816
|
+
return this.forward(args, 'warn', '', true);
|
|
5817
|
+
}
|
|
5818
|
+
}, {
|
|
5819
|
+
key: "error",
|
|
5820
|
+
value: function error() {
|
|
5821
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
5822
|
+
args[_key3] = arguments[_key3];
|
|
5823
|
+
}
|
|
5824
|
+
return this.forward(args, 'error', '');
|
|
5825
|
+
}
|
|
5826
|
+
}, {
|
|
5827
|
+
key: "deprecate",
|
|
5828
|
+
value: function deprecate() {
|
|
5829
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
5830
|
+
args[_key4] = arguments[_key4];
|
|
5831
|
+
}
|
|
5832
|
+
return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
|
|
5833
|
+
}
|
|
5834
|
+
}, {
|
|
5835
|
+
key: "forward",
|
|
5836
|
+
value: function forward(args, lvl, prefix, debugOnly) {
|
|
5837
|
+
if (debugOnly && !this.debug) return null;
|
|
5838
|
+
if (typeof args[0] === 'string') args[0] = ("").concat(prefix).concat(this.prefix, " ").concat(args[0]);
|
|
5839
|
+
return this.logger[lvl](args);
|
|
5840
|
+
}
|
|
5841
|
+
}, {
|
|
5842
|
+
key: "create",
|
|
5843
|
+
value: function create(moduleName) {
|
|
5844
|
+
return new Logger(this.logger, _objectSpread$6(_objectSpread$6({}, {
|
|
5845
|
+
prefix: ("").concat(this.prefix, ":").concat(moduleName, ":")
|
|
5846
|
+
}), this.options));
|
|
5847
|
+
}
|
|
5848
|
+
}, {
|
|
5849
|
+
key: "clone",
|
|
5850
|
+
value: function clone(options) {
|
|
5851
|
+
options = options || this.options;
|
|
5852
|
+
options.prefix = options.prefix || this.prefix;
|
|
5853
|
+
return new Logger(this.logger, options);
|
|
5854
|
+
}
|
|
5855
|
+
}]);
|
|
5856
|
+
return Logger;
|
|
5857
|
+
})();
|
|
5858
|
+
var baseLogger = new Logger();
|
|
5859
|
+
var EventEmitter = (function () {
|
|
5860
|
+
function EventEmitter() {
|
|
5861
|
+
_classCallCheck__default["default"](this, EventEmitter);
|
|
5862
|
+
this.observers = {};
|
|
5863
|
+
}
|
|
5864
|
+
_createClass__default["default"](EventEmitter, [{
|
|
5865
|
+
key: "on",
|
|
5866
|
+
value: function on(events, listener) {
|
|
5867
|
+
var _this = this;
|
|
5868
|
+
events.split(' ').forEach(function (event) {
|
|
5869
|
+
_this.observers[event] = _this.observers[event] || [];
|
|
5870
|
+
_this.observers[event].push(listener);
|
|
5871
|
+
});
|
|
5872
|
+
return this;
|
|
5873
|
+
}
|
|
5874
|
+
}, {
|
|
5875
|
+
key: "off",
|
|
5876
|
+
value: function off(event, listener) {
|
|
5877
|
+
if (!this.observers[event]) return;
|
|
5878
|
+
if (!listener) {
|
|
5879
|
+
delete this.observers[event];
|
|
5880
|
+
return;
|
|
5881
|
+
}
|
|
5882
|
+
this.observers[event] = this.observers[event].filter(function (l) {
|
|
5883
|
+
return l !== listener;
|
|
5884
|
+
});
|
|
5885
|
+
}
|
|
5886
|
+
}, {
|
|
5887
|
+
key: "emit",
|
|
5888
|
+
value: function emit(event) {
|
|
5889
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
5890
|
+
args[_key - 1] = arguments[_key];
|
|
5891
|
+
}
|
|
5892
|
+
if (this.observers[event]) {
|
|
5893
|
+
var cloned = [].concat(this.observers[event]);
|
|
5894
|
+
cloned.forEach(function (observer) {
|
|
5895
|
+
observer.apply(void 0, args);
|
|
5896
|
+
});
|
|
5897
|
+
}
|
|
5898
|
+
if (this.observers['*']) {
|
|
5899
|
+
var _cloned = [].concat(this.observers['*']);
|
|
5900
|
+
_cloned.forEach(function (observer) {
|
|
5901
|
+
observer.apply(observer, [event].concat(args));
|
|
5902
|
+
});
|
|
5903
|
+
}
|
|
5904
|
+
}
|
|
5905
|
+
}]);
|
|
5906
|
+
return EventEmitter;
|
|
5907
|
+
})();
|
|
5908
|
+
function defer() {
|
|
5909
|
+
var res;
|
|
5910
|
+
var rej;
|
|
5911
|
+
var promise = new Promise(function (resolve, reject) {
|
|
5912
|
+
res = resolve;
|
|
5913
|
+
rej = reject;
|
|
5914
|
+
});
|
|
5915
|
+
promise.resolve = res;
|
|
5916
|
+
promise.reject = rej;
|
|
5917
|
+
return promise;
|
|
5918
|
+
}
|
|
5919
|
+
function makeString(object) {
|
|
5920
|
+
if (object == null) return '';
|
|
5921
|
+
return '' + object;
|
|
5922
|
+
}
|
|
5923
|
+
function copy(a, s, t) {
|
|
5924
|
+
a.forEach(function (m) {
|
|
5925
|
+
if (s[m]) t[m] = s[m];
|
|
5926
|
+
});
|
|
5927
|
+
}
|
|
5928
|
+
function getLastOfPath(object, path, Empty) {
|
|
5929
|
+
function cleanKey(key) {
|
|
5930
|
+
return key && key.indexOf('###') > -1 ? key.replace(/###/g, '.') : key;
|
|
5931
|
+
}
|
|
5932
|
+
function canNotTraverseDeeper() {
|
|
5933
|
+
return !object || typeof object === 'string';
|
|
5934
|
+
}
|
|
5935
|
+
var stack = typeof path !== 'string' ? [].concat(path) : path.split('.');
|
|
5936
|
+
while (stack.length > 1) {
|
|
5937
|
+
if (canNotTraverseDeeper()) return {};
|
|
5938
|
+
var key = cleanKey(stack.shift());
|
|
5939
|
+
if (!object[key] && Empty) object[key] = new Empty();
|
|
5940
|
+
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
|
5941
|
+
object = object[key];
|
|
5942
|
+
} else {
|
|
5943
|
+
object = {};
|
|
5944
|
+
}
|
|
5945
|
+
}
|
|
5946
|
+
if (canNotTraverseDeeper()) return {};
|
|
5947
|
+
return {
|
|
5948
|
+
obj: object,
|
|
5949
|
+
k: cleanKey(stack.shift())
|
|
5950
|
+
};
|
|
5951
|
+
}
|
|
5952
|
+
function setPath(object, path, newValue) {
|
|
5953
|
+
var _getLastOfPath = getLastOfPath(object, path, Object), obj = _getLastOfPath.obj, k = _getLastOfPath.k;
|
|
5954
|
+
obj[k] = newValue;
|
|
5955
|
+
}
|
|
5956
|
+
function pushPath(object, path, newValue, concat) {
|
|
5957
|
+
var _getLastOfPath2 = getLastOfPath(object, path, Object), obj = _getLastOfPath2.obj, k = _getLastOfPath2.k;
|
|
5958
|
+
obj[k] = obj[k] || [];
|
|
5959
|
+
if (concat) obj[k] = obj[k].concat(newValue);
|
|
5960
|
+
if (!concat) obj[k].push(newValue);
|
|
5961
|
+
}
|
|
5962
|
+
function getPath(object, path) {
|
|
5963
|
+
var _getLastOfPath3 = getLastOfPath(object, path), obj = _getLastOfPath3.obj, k = _getLastOfPath3.k;
|
|
5964
|
+
if (!obj) return undefined;
|
|
5965
|
+
return obj[k];
|
|
5966
|
+
}
|
|
5967
|
+
function getPathWithDefaults(data, defaultData, key) {
|
|
5968
|
+
var value = getPath(data, key);
|
|
5969
|
+
if (value !== undefined) {
|
|
5970
|
+
return value;
|
|
5971
|
+
}
|
|
5972
|
+
return getPath(defaultData, key);
|
|
5973
|
+
}
|
|
5974
|
+
function deepExtend(target, source, overwrite) {
|
|
5975
|
+
for (var prop in source) {
|
|
5976
|
+
if (prop !== '__proto__' && prop !== 'constructor') {
|
|
5977
|
+
if ((prop in target)) {
|
|
5978
|
+
if (typeof target[prop] === 'string' || target[prop] instanceof String || typeof source[prop] === 'string' || source[prop] instanceof String) {
|
|
5979
|
+
if (overwrite) target[prop] = source[prop];
|
|
5980
|
+
} else {
|
|
5981
|
+
deepExtend(target[prop], source[prop], overwrite);
|
|
5982
|
+
}
|
|
5983
|
+
} else {
|
|
5984
|
+
target[prop] = source[prop];
|
|
5985
|
+
}
|
|
5986
|
+
}
|
|
5987
|
+
}
|
|
5988
|
+
return target;
|
|
5989
|
+
}
|
|
5990
|
+
function regexEscape(str) {
|
|
5991
|
+
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
|
5992
|
+
}
|
|
5993
|
+
var _entityMap = {
|
|
5994
|
+
'&': '&',
|
|
5995
|
+
'<': '<',
|
|
5996
|
+
'>': '>',
|
|
5997
|
+
'"': '"',
|
|
5998
|
+
"'": ''',
|
|
5999
|
+
'/': '/'
|
|
6000
|
+
};
|
|
6001
|
+
function escape(data) {
|
|
6002
|
+
if (typeof data === 'string') {
|
|
6003
|
+
return data.replace(/[&<>"'\/]/g, function (s) {
|
|
6004
|
+
return _entityMap[s];
|
|
6005
|
+
});
|
|
6006
|
+
}
|
|
6007
|
+
return data;
|
|
6008
|
+
}
|
|
6009
|
+
var isIE10 = typeof window !== 'undefined' && window.navigator && typeof window.navigator.userAgentData === 'undefined' && window.navigator.userAgent && window.navigator.userAgent.indexOf('MSIE') > -1;
|
|
6010
|
+
var chars = [' ', ',', '?', '!', ';'];
|
|
6011
|
+
function looksLikeObjectPath(key, nsSeparator, keySeparator) {
|
|
6012
|
+
nsSeparator = nsSeparator || '';
|
|
6013
|
+
keySeparator = keySeparator || '';
|
|
6014
|
+
var possibleChars = chars.filter(function (c) {
|
|
6015
|
+
return nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0;
|
|
6016
|
+
});
|
|
6017
|
+
if (possibleChars.length === 0) return true;
|
|
6018
|
+
var r = new RegExp(("(").concat(possibleChars.map(function (c) {
|
|
6019
|
+
return c === '?' ? '\\?' : c;
|
|
6020
|
+
}).join('|'), ")"));
|
|
6021
|
+
var matched = !r.test(key);
|
|
6022
|
+
if (!matched) {
|
|
6023
|
+
var ki = key.indexOf(keySeparator);
|
|
6024
|
+
if (ki > 0 && !r.test(key.substring(0, ki))) {
|
|
6025
|
+
matched = true;
|
|
6026
|
+
}
|
|
6027
|
+
}
|
|
6028
|
+
return matched;
|
|
6029
|
+
}
|
|
6030
|
+
function deepFind(obj, path) {
|
|
6031
|
+
var keySeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
|
|
6032
|
+
if (!obj) return undefined;
|
|
6033
|
+
if (obj[path]) return obj[path];
|
|
6034
|
+
var paths = path.split(keySeparator);
|
|
6035
|
+
var current = obj;
|
|
6036
|
+
for (var i = 0; i < paths.length; ++i) {
|
|
6037
|
+
if (!current) return undefined;
|
|
6038
|
+
if (typeof current[paths[i]] === 'string' && i + 1 < paths.length) {
|
|
6039
|
+
return undefined;
|
|
6040
|
+
}
|
|
6041
|
+
if (current[paths[i]] === undefined) {
|
|
6042
|
+
var j = 2;
|
|
6043
|
+
var p = paths.slice(i, i + j).join(keySeparator);
|
|
6044
|
+
var mix = current[p];
|
|
6045
|
+
while (mix === undefined && paths.length > i + j) {
|
|
6046
|
+
j++;
|
|
6047
|
+
p = paths.slice(i, i + j).join(keySeparator);
|
|
6048
|
+
mix = current[p];
|
|
6049
|
+
}
|
|
6050
|
+
if (mix === undefined) return undefined;
|
|
6051
|
+
if (mix === null) return null;
|
|
6052
|
+
if (path.endsWith(p)) {
|
|
6053
|
+
if (typeof mix === 'string') return mix;
|
|
6054
|
+
if (p && typeof mix[p] === 'string') return mix[p];
|
|
6055
|
+
}
|
|
6056
|
+
var joinedPath = paths.slice(i + j).join(keySeparator);
|
|
6057
|
+
if (joinedPath) return deepFind(mix, joinedPath, keySeparator);
|
|
6058
|
+
return undefined;
|
|
6059
|
+
}
|
|
6060
|
+
current = current[paths[i]];
|
|
6061
|
+
}
|
|
6062
|
+
return current;
|
|
6063
|
+
}
|
|
6064
|
+
function ownKeys$5(object, enumerableOnly) {
|
|
6065
|
+
var keys = Object.keys(object);
|
|
6066
|
+
if (Object.getOwnPropertySymbols) {
|
|
6067
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
6068
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
6069
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
6070
|
+
})), keys.push.apply(keys, symbols));
|
|
6071
|
+
}
|
|
6072
|
+
return keys;
|
|
6073
|
+
}
|
|
6074
|
+
function _objectSpread$5(target) {
|
|
6075
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
6076
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
6077
|
+
i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) {
|
|
6078
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
6079
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) {
|
|
6080
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
6081
|
+
});
|
|
6082
|
+
}
|
|
6083
|
+
return target;
|
|
6084
|
+
}
|
|
6085
|
+
function _createSuper$3(Derived) {
|
|
6086
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct$3();
|
|
6087
|
+
return function _createSuperInternal() {
|
|
6088
|
+
var Super = _getPrototypeOf__default["default"](Derived), result;
|
|
6089
|
+
if (hasNativeReflectConstruct) {
|
|
6090
|
+
var NewTarget = _getPrototypeOf__default["default"](this).constructor;
|
|
6091
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
6092
|
+
} else {
|
|
6093
|
+
result = Super.apply(this, arguments);
|
|
6094
|
+
}
|
|
6095
|
+
return _possibleConstructorReturn__default["default"](this, result);
|
|
6096
|
+
};
|
|
6097
|
+
}
|
|
6098
|
+
function _isNativeReflectConstruct$3() {
|
|
6099
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
6100
|
+
if (Reflect.construct.sham) return false;
|
|
6101
|
+
if (typeof Proxy === "function") return true;
|
|
6102
|
+
try {
|
|
6103
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
6104
|
+
return true;
|
|
6105
|
+
} catch (e) {
|
|
6106
|
+
return false;
|
|
6107
|
+
}
|
|
6108
|
+
}
|
|
6109
|
+
var ResourceStore = (function (_EventEmitter) {
|
|
6110
|
+
_inherits__default["default"](ResourceStore, _EventEmitter);
|
|
6111
|
+
var _super = _createSuper$3(ResourceStore);
|
|
6112
|
+
function ResourceStore(data) {
|
|
6113
|
+
var _this;
|
|
6114
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
6115
|
+
ns: ['translation'],
|
|
6116
|
+
defaultNS: 'translation'
|
|
6117
|
+
};
|
|
6118
|
+
_classCallCheck__default["default"](this, ResourceStore);
|
|
6119
|
+
_this = _super.call(this);
|
|
6120
|
+
if (isIE10) {
|
|
6121
|
+
EventEmitter.call(_assertThisInitialized__default["default"](_this));
|
|
6122
|
+
}
|
|
6123
|
+
_this.data = data || ({});
|
|
6124
|
+
_this.options = options;
|
|
6125
|
+
if (_this.options.keySeparator === undefined) {
|
|
6126
|
+
_this.options.keySeparator = '.';
|
|
6127
|
+
}
|
|
6128
|
+
if (_this.options.ignoreJSONStructure === undefined) {
|
|
6129
|
+
_this.options.ignoreJSONStructure = true;
|
|
6130
|
+
}
|
|
6131
|
+
return _this;
|
|
6132
|
+
}
|
|
6133
|
+
_createClass__default["default"](ResourceStore, [{
|
|
6134
|
+
key: "addNamespaces",
|
|
6135
|
+
value: function addNamespaces(ns) {
|
|
6136
|
+
if (this.options.ns.indexOf(ns) < 0) {
|
|
6137
|
+
this.options.ns.push(ns);
|
|
6138
|
+
}
|
|
6139
|
+
}
|
|
6140
|
+
}, {
|
|
6141
|
+
key: "removeNamespaces",
|
|
6142
|
+
value: function removeNamespaces(ns) {
|
|
6143
|
+
var index = this.options.ns.indexOf(ns);
|
|
6144
|
+
if (index > -1) {
|
|
6145
|
+
this.options.ns.splice(index, 1);
|
|
6146
|
+
}
|
|
6147
|
+
}
|
|
6148
|
+
}, {
|
|
6149
|
+
key: "getResource",
|
|
6150
|
+
value: function getResource(lng, ns, key) {
|
|
6151
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
6152
|
+
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
6153
|
+
var ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
6154
|
+
var path = [lng, ns];
|
|
6155
|
+
if (key && typeof key !== 'string') path = path.concat(key);
|
|
6156
|
+
if (key && typeof key === 'string') path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
6157
|
+
if (lng.indexOf('.') > -1) {
|
|
6158
|
+
path = lng.split('.');
|
|
6159
|
+
}
|
|
6160
|
+
var result = getPath(this.data, path);
|
|
6161
|
+
if (result || !ignoreJSONStructure || typeof key !== 'string') return result;
|
|
6162
|
+
return deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);
|
|
6163
|
+
}
|
|
6164
|
+
}, {
|
|
6165
|
+
key: "addResource",
|
|
6166
|
+
value: function addResource(lng, ns, key, value) {
|
|
6167
|
+
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
|
|
6168
|
+
silent: false
|
|
6169
|
+
};
|
|
6170
|
+
var keySeparator = this.options.keySeparator;
|
|
6171
|
+
if (keySeparator === undefined) keySeparator = '.';
|
|
6172
|
+
var path = [lng, ns];
|
|
6173
|
+
if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
6174
|
+
if (lng.indexOf('.') > -1) {
|
|
6175
|
+
path = lng.split('.');
|
|
6176
|
+
value = ns;
|
|
6177
|
+
ns = path[1];
|
|
6178
|
+
}
|
|
6179
|
+
this.addNamespaces(ns);
|
|
6180
|
+
setPath(this.data, path, value);
|
|
6181
|
+
if (!options.silent) this.emit('added', lng, ns, key, value);
|
|
6182
|
+
}
|
|
6183
|
+
}, {
|
|
6184
|
+
key: "addResources",
|
|
6185
|
+
value: function addResources(lng, ns, resources) {
|
|
6186
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
|
|
6187
|
+
silent: false
|
|
6188
|
+
};
|
|
6189
|
+
for (var m in resources) {
|
|
6190
|
+
if (typeof resources[m] === 'string' || Object.prototype.toString.apply(resources[m]) === '[object Array]') this.addResource(lng, ns, m, resources[m], {
|
|
6191
|
+
silent: true
|
|
6192
|
+
});
|
|
6193
|
+
}
|
|
6194
|
+
if (!options.silent) this.emit('added', lng, ns, resources);
|
|
6195
|
+
}
|
|
6196
|
+
}, {
|
|
6197
|
+
key: "addResourceBundle",
|
|
6198
|
+
value: function addResourceBundle(lng, ns, resources, deep, overwrite) {
|
|
6199
|
+
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {
|
|
6200
|
+
silent: false
|
|
6201
|
+
};
|
|
6202
|
+
var path = [lng, ns];
|
|
6203
|
+
if (lng.indexOf('.') > -1) {
|
|
6204
|
+
path = lng.split('.');
|
|
6205
|
+
deep = resources;
|
|
6206
|
+
resources = ns;
|
|
6207
|
+
ns = path[1];
|
|
6208
|
+
}
|
|
6209
|
+
this.addNamespaces(ns);
|
|
6210
|
+
var pack = getPath(this.data, path) || ({});
|
|
6211
|
+
if (deep) {
|
|
6212
|
+
deepExtend(pack, resources, overwrite);
|
|
6213
|
+
} else {
|
|
6214
|
+
pack = _objectSpread$5(_objectSpread$5({}, pack), resources);
|
|
6215
|
+
}
|
|
6216
|
+
setPath(this.data, path, pack);
|
|
6217
|
+
if (!options.silent) this.emit('added', lng, ns, resources);
|
|
6218
|
+
}
|
|
6219
|
+
}, {
|
|
6220
|
+
key: "removeResourceBundle",
|
|
6221
|
+
value: function removeResourceBundle(lng, ns) {
|
|
6222
|
+
if (this.hasResourceBundle(lng, ns)) {
|
|
6223
|
+
delete this.data[lng][ns];
|
|
6224
|
+
}
|
|
6225
|
+
this.removeNamespaces(ns);
|
|
6226
|
+
this.emit('removed', lng, ns);
|
|
6227
|
+
}
|
|
6228
|
+
}, {
|
|
6229
|
+
key: "hasResourceBundle",
|
|
6230
|
+
value: function hasResourceBundle(lng, ns) {
|
|
6231
|
+
return this.getResource(lng, ns) !== undefined;
|
|
6232
|
+
}
|
|
6233
|
+
}, {
|
|
6234
|
+
key: "getResourceBundle",
|
|
6235
|
+
value: function getResourceBundle(lng, ns) {
|
|
6236
|
+
if (!ns) ns = this.options.defaultNS;
|
|
6237
|
+
if (this.options.compatibilityAPI === 'v1') return _objectSpread$5(_objectSpread$5({}, {}), this.getResource(lng, ns));
|
|
6238
|
+
return this.getResource(lng, ns);
|
|
6239
|
+
}
|
|
6240
|
+
}, {
|
|
6241
|
+
key: "getDataByLanguage",
|
|
6242
|
+
value: function getDataByLanguage(lng) {
|
|
6243
|
+
return this.data[lng];
|
|
6244
|
+
}
|
|
6245
|
+
}, {
|
|
6246
|
+
key: "hasLanguageSomeTranslations",
|
|
6247
|
+
value: function hasLanguageSomeTranslations(lng) {
|
|
6248
|
+
var data = this.getDataByLanguage(lng);
|
|
6249
|
+
var n = data && Object.keys(data) || [];
|
|
6250
|
+
return !!n.find(function (v) {
|
|
6251
|
+
return data[v] && Object.keys(data[v]).length > 0;
|
|
6252
|
+
});
|
|
6253
|
+
}
|
|
6254
|
+
}, {
|
|
6255
|
+
key: "toJSON",
|
|
6256
|
+
value: function toJSON() {
|
|
6257
|
+
return this.data;
|
|
6258
|
+
}
|
|
6259
|
+
}]);
|
|
6260
|
+
return ResourceStore;
|
|
6261
|
+
})(EventEmitter);
|
|
6262
|
+
var postProcessor = {
|
|
6263
|
+
processors: {},
|
|
6264
|
+
addPostProcessor: function addPostProcessor(module) {
|
|
6265
|
+
this.processors[module.name] = module;
|
|
6266
|
+
},
|
|
6267
|
+
handle: function handle(processors, value, key, options, translator) {
|
|
6268
|
+
var _this = this;
|
|
6269
|
+
processors.forEach(function (processor) {
|
|
6270
|
+
if (_this.processors[processor]) value = _this.processors[processor].process(value, key, options, translator);
|
|
6271
|
+
});
|
|
6272
|
+
return value;
|
|
6273
|
+
}
|
|
6274
|
+
};
|
|
6275
|
+
function ownKeys$4(object, enumerableOnly) {
|
|
6276
|
+
var keys = Object.keys(object);
|
|
6277
|
+
if (Object.getOwnPropertySymbols) {
|
|
6278
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
6279
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
6280
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
6281
|
+
})), keys.push.apply(keys, symbols));
|
|
6282
|
+
}
|
|
6283
|
+
return keys;
|
|
6284
|
+
}
|
|
6285
|
+
function _objectSpread$4(target) {
|
|
6286
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
6287
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
6288
|
+
i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) {
|
|
6289
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
6290
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) {
|
|
6291
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
6292
|
+
});
|
|
6293
|
+
}
|
|
6294
|
+
return target;
|
|
6295
|
+
}
|
|
6296
|
+
function _createSuper$2(Derived) {
|
|
6297
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct$2();
|
|
6298
|
+
return function _createSuperInternal() {
|
|
6299
|
+
var Super = _getPrototypeOf__default["default"](Derived), result;
|
|
6300
|
+
if (hasNativeReflectConstruct) {
|
|
6301
|
+
var NewTarget = _getPrototypeOf__default["default"](this).constructor;
|
|
6302
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
6303
|
+
} else {
|
|
6304
|
+
result = Super.apply(this, arguments);
|
|
6305
|
+
}
|
|
6306
|
+
return _possibleConstructorReturn__default["default"](this, result);
|
|
6307
|
+
};
|
|
6308
|
+
}
|
|
6309
|
+
function _isNativeReflectConstruct$2() {
|
|
6310
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
6311
|
+
if (Reflect.construct.sham) return false;
|
|
6312
|
+
if (typeof Proxy === "function") return true;
|
|
6313
|
+
try {
|
|
6314
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
6315
|
+
return true;
|
|
6316
|
+
} catch (e) {
|
|
6317
|
+
return false;
|
|
6318
|
+
}
|
|
6319
|
+
}
|
|
6320
|
+
var checkedLoadedFor = {};
|
|
6321
|
+
var Translator$1 = (function (_EventEmitter) {
|
|
6322
|
+
_inherits__default["default"](Translator, _EventEmitter);
|
|
6323
|
+
var _super = _createSuper$2(Translator);
|
|
6324
|
+
function Translator(services) {
|
|
6325
|
+
var _this;
|
|
6326
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6327
|
+
_classCallCheck__default["default"](this, Translator);
|
|
6328
|
+
_this = _super.call(this);
|
|
6329
|
+
if (isIE10) {
|
|
6330
|
+
EventEmitter.call(_assertThisInitialized__default["default"](_this));
|
|
6331
|
+
}
|
|
6332
|
+
copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, _assertThisInitialized__default["default"](_this));
|
|
6333
|
+
_this.options = options;
|
|
6334
|
+
if (_this.options.keySeparator === undefined) {
|
|
6335
|
+
_this.options.keySeparator = '.';
|
|
6336
|
+
}
|
|
6337
|
+
_this.logger = baseLogger.create('translator');
|
|
6338
|
+
return _this;
|
|
6339
|
+
}
|
|
6340
|
+
_createClass__default["default"](Translator, [{
|
|
6341
|
+
key: "changeLanguage",
|
|
6342
|
+
value: function changeLanguage(lng) {
|
|
6343
|
+
if (lng) this.language = lng;
|
|
6344
|
+
}
|
|
6345
|
+
}, {
|
|
6346
|
+
key: "exists",
|
|
6347
|
+
value: function exists(key) {
|
|
6348
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
6349
|
+
interpolation: {}
|
|
6350
|
+
};
|
|
6351
|
+
if (key === undefined || key === null) {
|
|
6352
|
+
return false;
|
|
6353
|
+
}
|
|
6354
|
+
var resolved = this.resolve(key, options);
|
|
6355
|
+
return resolved && resolved.res !== undefined;
|
|
6356
|
+
}
|
|
6357
|
+
}, {
|
|
6358
|
+
key: "extractFromKey",
|
|
6359
|
+
value: function extractFromKey(key, options) {
|
|
6360
|
+
var nsSeparator = options.nsSeparator !== undefined ? options.nsSeparator : this.options.nsSeparator;
|
|
6361
|
+
if (nsSeparator === undefined) nsSeparator = ':';
|
|
6362
|
+
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
6363
|
+
var namespaces = options.ns || this.options.defaultNS || [];
|
|
6364
|
+
var wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
|
|
6365
|
+
var seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !options.keySeparator && !this.options.userDefinedNsSeparator && !options.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
|
|
6366
|
+
if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
|
|
6367
|
+
var m = key.match(this.interpolator.nestingRegexp);
|
|
6368
|
+
if (m && m.length > 0) {
|
|
6369
|
+
return {
|
|
6370
|
+
key: key,
|
|
6371
|
+
namespaces: namespaces
|
|
6372
|
+
};
|
|
6373
|
+
}
|
|
6374
|
+
var parts = key.split(nsSeparator);
|
|
6375
|
+
if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
|
|
6376
|
+
key = parts.join(keySeparator);
|
|
6377
|
+
}
|
|
6378
|
+
if (typeof namespaces === 'string') namespaces = [namespaces];
|
|
6379
|
+
return {
|
|
6380
|
+
key: key,
|
|
6381
|
+
namespaces: namespaces
|
|
6382
|
+
};
|
|
6383
|
+
}
|
|
6384
|
+
}, {
|
|
6385
|
+
key: "translate",
|
|
6386
|
+
value: function translate(keys, options, lastKey) {
|
|
6387
|
+
var _this2 = this;
|
|
6388
|
+
if (_typeof__default["default"](options) !== 'object' && this.options.overloadTranslationOptionHandler) {
|
|
6389
|
+
options = this.options.overloadTranslationOptionHandler(arguments);
|
|
6390
|
+
}
|
|
6391
|
+
if (_typeof__default["default"](options) === 'object') options = _objectSpread$4({}, options);
|
|
6392
|
+
if (!options) options = {};
|
|
6393
|
+
if (keys === undefined || keys === null) return '';
|
|
6394
|
+
if (!Array.isArray(keys)) keys = [String(keys)];
|
|
6395
|
+
var returnDetails = options.returnDetails !== undefined ? options.returnDetails : this.options.returnDetails;
|
|
6396
|
+
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
6397
|
+
var _this$extractFromKey = this.extractFromKey(keys[keys.length - 1], options), key = _this$extractFromKey.key, namespaces = _this$extractFromKey.namespaces;
|
|
6398
|
+
var namespace = namespaces[namespaces.length - 1];
|
|
6399
|
+
var lng = options.lng || this.language;
|
|
6400
|
+
var appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
6401
|
+
if (lng && lng.toLowerCase() === 'cimode') {
|
|
6402
|
+
if (appendNamespaceToCIMode) {
|
|
6403
|
+
var nsSeparator = options.nsSeparator || this.options.nsSeparator;
|
|
6404
|
+
if (returnDetails) {
|
|
6405
|
+
return {
|
|
6406
|
+
res: ("").concat(namespace).concat(nsSeparator).concat(key),
|
|
6407
|
+
usedKey: key,
|
|
6408
|
+
exactUsedKey: key,
|
|
6409
|
+
usedLng: lng,
|
|
6410
|
+
usedNS: namespace
|
|
6411
|
+
};
|
|
6412
|
+
}
|
|
6413
|
+
return ("").concat(namespace).concat(nsSeparator).concat(key);
|
|
6414
|
+
}
|
|
6415
|
+
if (returnDetails) {
|
|
6416
|
+
return {
|
|
6417
|
+
res: key,
|
|
6418
|
+
usedKey: key,
|
|
6419
|
+
exactUsedKey: key,
|
|
6420
|
+
usedLng: lng,
|
|
6421
|
+
usedNS: namespace
|
|
6422
|
+
};
|
|
6423
|
+
}
|
|
6424
|
+
return key;
|
|
6425
|
+
}
|
|
6426
|
+
var resolved = this.resolve(keys, options);
|
|
6427
|
+
var res = resolved && resolved.res;
|
|
6428
|
+
var resUsedKey = resolved && resolved.usedKey || key;
|
|
6429
|
+
var resExactUsedKey = resolved && resolved.exactUsedKey || key;
|
|
6430
|
+
var resType = Object.prototype.toString.apply(res);
|
|
6431
|
+
var noObject = ['[object Number]', '[object Function]', '[object RegExp]'];
|
|
6432
|
+
var joinArrays = options.joinArrays !== undefined ? options.joinArrays : this.options.joinArrays;
|
|
6433
|
+
var handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
|
|
6434
|
+
var handleAsObject = typeof res !== 'string' && typeof res !== 'boolean' && typeof res !== 'number';
|
|
6435
|
+
if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === 'string' && resType === '[object Array]')) {
|
|
6436
|
+
if (!options.returnObjects && !this.options.returnObjects) {
|
|
6437
|
+
if (!this.options.returnedObjectHandler) {
|
|
6438
|
+
this.logger.warn('accessing an object - but returnObjects options is not enabled!');
|
|
6439
|
+
}
|
|
6440
|
+
var r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, _objectSpread$4(_objectSpread$4({}, options), {}, {
|
|
6441
|
+
ns: namespaces
|
|
6442
|
+
})) : ("key '").concat(key, " (").concat(this.language, ")' returned an object instead of string.");
|
|
6443
|
+
if (returnDetails) {
|
|
6444
|
+
resolved.res = r;
|
|
6445
|
+
return resolved;
|
|
6446
|
+
}
|
|
6447
|
+
return r;
|
|
6448
|
+
}
|
|
6449
|
+
if (keySeparator) {
|
|
6450
|
+
var resTypeIsArray = resType === '[object Array]';
|
|
6451
|
+
var copy = resTypeIsArray ? [] : {};
|
|
6452
|
+
var newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
|
|
6453
|
+
for (var m in res) {
|
|
6454
|
+
if (Object.prototype.hasOwnProperty.call(res, m)) {
|
|
6455
|
+
var deepKey = ("").concat(newKeyToUse).concat(keySeparator).concat(m);
|
|
6456
|
+
copy[m] = this.translate(deepKey, _objectSpread$4(_objectSpread$4({}, options), {
|
|
6457
|
+
joinArrays: false,
|
|
6458
|
+
ns: namespaces
|
|
6459
|
+
}));
|
|
6460
|
+
if (copy[m] === deepKey) copy[m] = res[m];
|
|
6461
|
+
}
|
|
6462
|
+
}
|
|
6463
|
+
res = copy;
|
|
6464
|
+
}
|
|
6465
|
+
} else if (handleAsObjectInI18nFormat && typeof joinArrays === 'string' && resType === '[object Array]') {
|
|
6466
|
+
res = res.join(joinArrays);
|
|
6467
|
+
if (res) res = this.extendTranslation(res, keys, options, lastKey);
|
|
6468
|
+
} else {
|
|
6469
|
+
var usedDefault = false;
|
|
6470
|
+
var usedKey = false;
|
|
6471
|
+
var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
|
|
6472
|
+
var hasDefaultValue = Translator.hasDefaultValue(options);
|
|
6473
|
+
var defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : '';
|
|
6474
|
+
var defaultValue = options[("defaultValue").concat(defaultValueSuffix)] || options.defaultValue;
|
|
6475
|
+
if (!this.isValidLookup(res) && hasDefaultValue) {
|
|
6476
|
+
usedDefault = true;
|
|
6477
|
+
res = defaultValue;
|
|
6478
|
+
}
|
|
6479
|
+
if (!this.isValidLookup(res)) {
|
|
6480
|
+
usedKey = true;
|
|
6481
|
+
res = key;
|
|
6482
|
+
}
|
|
6483
|
+
var missingKeyNoValueFallbackToKey = options.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
|
|
6484
|
+
var resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;
|
|
6485
|
+
var updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
|
|
6486
|
+
if (usedKey || usedDefault || updateMissing) {
|
|
6487
|
+
this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);
|
|
6488
|
+
if (keySeparator) {
|
|
6489
|
+
var fk = this.resolve(key, _objectSpread$4(_objectSpread$4({}, options), {}, {
|
|
6490
|
+
keySeparator: false
|
|
6491
|
+
}));
|
|
6492
|
+
if (fk && fk.res) this.logger.warn('Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.');
|
|
6493
|
+
}
|
|
6494
|
+
var lngs = [];
|
|
6495
|
+
var fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);
|
|
6496
|
+
if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {
|
|
6497
|
+
for (var i = 0; i < fallbackLngs.length; i++) {
|
|
6498
|
+
lngs.push(fallbackLngs[i]);
|
|
6499
|
+
}
|
|
6500
|
+
} else if (this.options.saveMissingTo === 'all') {
|
|
6501
|
+
lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);
|
|
6502
|
+
} else {
|
|
6503
|
+
lngs.push(options.lng || this.language);
|
|
6504
|
+
}
|
|
6505
|
+
var send = function send(l, k, specificDefaultValue) {
|
|
6506
|
+
var defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
|
|
6507
|
+
if (_this2.options.missingKeyHandler) {
|
|
6508
|
+
_this2.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, options);
|
|
6509
|
+
} else if (_this2.backendConnector && _this2.backendConnector.saveMissing) {
|
|
6510
|
+
_this2.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, options);
|
|
6511
|
+
}
|
|
6512
|
+
_this2.emit('missingKey', l, namespace, k, res);
|
|
6513
|
+
};
|
|
6514
|
+
if (this.options.saveMissing) {
|
|
6515
|
+
if (this.options.saveMissingPlurals && needsPluralHandling) {
|
|
6516
|
+
lngs.forEach(function (language) {
|
|
6517
|
+
_this2.pluralResolver.getSuffixes(language, options).forEach(function (suffix) {
|
|
6518
|
+
send([language], key + suffix, options[("defaultValue").concat(suffix)] || defaultValue);
|
|
6519
|
+
});
|
|
6520
|
+
});
|
|
6521
|
+
} else {
|
|
6522
|
+
send(lngs, key, defaultValue);
|
|
6523
|
+
}
|
|
6524
|
+
}
|
|
6525
|
+
}
|
|
6526
|
+
res = this.extendTranslation(res, keys, options, resolved, lastKey);
|
|
6527
|
+
if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = ("").concat(namespace, ":").concat(key);
|
|
6528
|
+
if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
|
|
6529
|
+
if (this.options.compatibilityAPI !== 'v1') {
|
|
6530
|
+
res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? ("").concat(namespace, ":").concat(key) : key, usedDefault ? res : undefined);
|
|
6531
|
+
} else {
|
|
6532
|
+
res = this.options.parseMissingKeyHandler(res);
|
|
6533
|
+
}
|
|
6534
|
+
}
|
|
6535
|
+
}
|
|
6536
|
+
if (returnDetails) {
|
|
6537
|
+
resolved.res = res;
|
|
6538
|
+
return resolved;
|
|
6539
|
+
}
|
|
6540
|
+
return res;
|
|
6541
|
+
}
|
|
6542
|
+
}, {
|
|
6543
|
+
key: "extendTranslation",
|
|
6544
|
+
value: function extendTranslation(res, key, options, resolved, lastKey) {
|
|
6545
|
+
var _this3 = this;
|
|
6546
|
+
if (this.i18nFormat && this.i18nFormat.parse) {
|
|
6547
|
+
res = this.i18nFormat.parse(res, _objectSpread$4(_objectSpread$4({}, this.options.interpolation.defaultVariables), options), resolved.usedLng, resolved.usedNS, resolved.usedKey, {
|
|
6548
|
+
resolved: resolved
|
|
6549
|
+
});
|
|
6550
|
+
} else if (!options.skipInterpolation) {
|
|
6551
|
+
if (options.interpolation) this.interpolator.init(_objectSpread$4(_objectSpread$4({}, options), {
|
|
6552
|
+
interpolation: _objectSpread$4(_objectSpread$4({}, this.options.interpolation), options.interpolation)
|
|
6553
|
+
}));
|
|
6554
|
+
var skipOnVariables = typeof res === 'string' && (options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
6555
|
+
var nestBef;
|
|
6556
|
+
if (skipOnVariables) {
|
|
6557
|
+
var nb = res.match(this.interpolator.nestingRegexp);
|
|
6558
|
+
nestBef = nb && nb.length;
|
|
6559
|
+
}
|
|
6560
|
+
var data = options.replace && typeof options.replace !== 'string' ? options.replace : options;
|
|
6561
|
+
if (this.options.interpolation.defaultVariables) data = _objectSpread$4(_objectSpread$4({}, this.options.interpolation.defaultVariables), data);
|
|
6562
|
+
res = this.interpolator.interpolate(res, data, options.lng || this.language, options);
|
|
6563
|
+
if (skipOnVariables) {
|
|
6564
|
+
var na = res.match(this.interpolator.nestingRegexp);
|
|
6565
|
+
var nestAft = na && na.length;
|
|
6566
|
+
if (nestBef < nestAft) options.nest = false;
|
|
6567
|
+
}
|
|
6568
|
+
if (!options.lng && this.options.compatibilityAPI !== 'v1' && resolved && resolved.res) options.lng = resolved.usedLng;
|
|
6569
|
+
if (options.nest !== false) res = this.interpolator.nest(res, function () {
|
|
6570
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
6571
|
+
args[_key] = arguments[_key];
|
|
6572
|
+
}
|
|
6573
|
+
if (lastKey && lastKey[0] === args[0] && !options.context) {
|
|
6574
|
+
_this3.logger.warn(("It seems you are nesting recursively key: ").concat(args[0], " in key: ").concat(key[0]));
|
|
6575
|
+
return null;
|
|
6576
|
+
}
|
|
6577
|
+
return _this3.translate.apply(_this3, args.concat([key]));
|
|
6578
|
+
}, options);
|
|
6579
|
+
if (options.interpolation) this.interpolator.reset();
|
|
6580
|
+
}
|
|
6581
|
+
var postProcess = options.postProcess || this.options.postProcess;
|
|
6582
|
+
var postProcessorNames = typeof postProcess === 'string' ? [postProcess] : postProcess;
|
|
6583
|
+
if (res !== undefined && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {
|
|
6584
|
+
res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread$4({
|
|
6585
|
+
i18nResolved: resolved
|
|
6586
|
+
}, options) : options, this);
|
|
6587
|
+
}
|
|
6588
|
+
return res;
|
|
6589
|
+
}
|
|
6590
|
+
}, {
|
|
6591
|
+
key: "resolve",
|
|
6592
|
+
value: function resolve(keys) {
|
|
6593
|
+
var _this4 = this;
|
|
6594
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6595
|
+
var found;
|
|
6596
|
+
var usedKey;
|
|
6597
|
+
var exactUsedKey;
|
|
6598
|
+
var usedLng;
|
|
6599
|
+
var usedNS;
|
|
6600
|
+
if (typeof keys === 'string') keys = [keys];
|
|
6601
|
+
keys.forEach(function (k) {
|
|
6602
|
+
if (_this4.isValidLookup(found)) return;
|
|
6603
|
+
var extracted = _this4.extractFromKey(k, options);
|
|
6604
|
+
var key = extracted.key;
|
|
6605
|
+
usedKey = key;
|
|
6606
|
+
var namespaces = extracted.namespaces;
|
|
6607
|
+
if (_this4.options.fallbackNS) namespaces = namespaces.concat(_this4.options.fallbackNS);
|
|
6608
|
+
var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
|
|
6609
|
+
var needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0 && _this4.pluralResolver.shouldUseIntlApi();
|
|
6610
|
+
var needsContextHandling = options.context !== undefined && (typeof options.context === 'string' || typeof options.context === 'number') && options.context !== '';
|
|
6611
|
+
var codes = options.lngs ? options.lngs : _this4.languageUtils.toResolveHierarchy(options.lng || _this4.language, options.fallbackLng);
|
|
6612
|
+
namespaces.forEach(function (ns) {
|
|
6613
|
+
if (_this4.isValidLookup(found)) return;
|
|
6614
|
+
usedNS = ns;
|
|
6615
|
+
if (!checkedLoadedFor[("").concat(codes[0], "-").concat(ns)] && _this4.utils && _this4.utils.hasLoadedNamespace && !_this4.utils.hasLoadedNamespace(usedNS)) {
|
|
6616
|
+
checkedLoadedFor[("").concat(codes[0], "-").concat(ns)] = true;
|
|
6617
|
+
_this4.logger.warn(("key \"").concat(usedKey, "\" for languages \"").concat(codes.join(', '), "\" won't get resolved as namespace \"").concat(usedNS, "\" was not yet loaded"), 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');
|
|
6618
|
+
}
|
|
6619
|
+
codes.forEach(function (code) {
|
|
6620
|
+
if (_this4.isValidLookup(found)) return;
|
|
6621
|
+
usedLng = code;
|
|
6622
|
+
var finalKeys = [key];
|
|
6623
|
+
if (_this4.i18nFormat && _this4.i18nFormat.addLookupKeys) {
|
|
6624
|
+
_this4.i18nFormat.addLookupKeys(finalKeys, key, code, ns, options);
|
|
6625
|
+
} else {
|
|
6626
|
+
var pluralSuffix;
|
|
6627
|
+
if (needsPluralHandling) pluralSuffix = _this4.pluralResolver.getSuffix(code, options.count, options);
|
|
6628
|
+
var zeroSuffix = ("").concat(_this4.options.pluralSeparator, "zero");
|
|
6629
|
+
if (needsPluralHandling) {
|
|
6630
|
+
finalKeys.push(key + pluralSuffix);
|
|
6631
|
+
if (needsZeroSuffixLookup) {
|
|
6632
|
+
finalKeys.push(key + zeroSuffix);
|
|
6633
|
+
}
|
|
6634
|
+
}
|
|
6635
|
+
if (needsContextHandling) {
|
|
6636
|
+
var contextKey = ("").concat(key).concat(_this4.options.contextSeparator).concat(options.context);
|
|
6637
|
+
finalKeys.push(contextKey);
|
|
6638
|
+
if (needsPluralHandling) {
|
|
6639
|
+
finalKeys.push(contextKey + pluralSuffix);
|
|
6640
|
+
if (needsZeroSuffixLookup) {
|
|
6641
|
+
finalKeys.push(contextKey + zeroSuffix);
|
|
6642
|
+
}
|
|
6643
|
+
}
|
|
6644
|
+
}
|
|
6645
|
+
}
|
|
6646
|
+
var possibleKey;
|
|
6647
|
+
while (possibleKey = finalKeys.pop()) {
|
|
6648
|
+
if (!_this4.isValidLookup(found)) {
|
|
6649
|
+
exactUsedKey = possibleKey;
|
|
6650
|
+
found = _this4.getResource(code, ns, possibleKey, options);
|
|
6651
|
+
}
|
|
6652
|
+
}
|
|
6653
|
+
});
|
|
6654
|
+
});
|
|
6655
|
+
});
|
|
6656
|
+
return {
|
|
6657
|
+
res: found,
|
|
6658
|
+
usedKey: usedKey,
|
|
6659
|
+
exactUsedKey: exactUsedKey,
|
|
6660
|
+
usedLng: usedLng,
|
|
6661
|
+
usedNS: usedNS
|
|
6662
|
+
};
|
|
6663
|
+
}
|
|
6664
|
+
}, {
|
|
6665
|
+
key: "isValidLookup",
|
|
6666
|
+
value: function isValidLookup(res) {
|
|
6667
|
+
return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');
|
|
6668
|
+
}
|
|
6669
|
+
}, {
|
|
6670
|
+
key: "getResource",
|
|
6671
|
+
value: function getResource(code, ns, key) {
|
|
6672
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
6673
|
+
if (this.i18nFormat && this.i18nFormat.getResource) return this.i18nFormat.getResource(code, ns, key, options);
|
|
6674
|
+
return this.resourceStore.getResource(code, ns, key, options);
|
|
6675
|
+
}
|
|
6676
|
+
}], [{
|
|
6677
|
+
key: "hasDefaultValue",
|
|
6678
|
+
value: function hasDefaultValue(options) {
|
|
6679
|
+
var prefix = 'defaultValue';
|
|
6680
|
+
for (var option in options) {
|
|
6681
|
+
if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {
|
|
6682
|
+
return true;
|
|
6683
|
+
}
|
|
6684
|
+
}
|
|
6685
|
+
return false;
|
|
6686
|
+
}
|
|
6687
|
+
}]);
|
|
6688
|
+
return Translator;
|
|
6689
|
+
})(EventEmitter);
|
|
6690
|
+
function capitalize$1(string) {
|
|
6691
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
6692
|
+
}
|
|
6693
|
+
var LanguageUtil = (function () {
|
|
6694
|
+
function LanguageUtil(options) {
|
|
6695
|
+
_classCallCheck__default["default"](this, LanguageUtil);
|
|
6696
|
+
this.options = options;
|
|
6697
|
+
this.supportedLngs = this.options.supportedLngs || false;
|
|
6698
|
+
this.logger = baseLogger.create('languageUtils');
|
|
6699
|
+
}
|
|
6700
|
+
_createClass__default["default"](LanguageUtil, [{
|
|
6701
|
+
key: "getScriptPartFromCode",
|
|
6702
|
+
value: function getScriptPartFromCode(code) {
|
|
6703
|
+
if (!code || code.indexOf('-') < 0) return null;
|
|
6704
|
+
var p = code.split('-');
|
|
6705
|
+
if (p.length === 2) return null;
|
|
6706
|
+
p.pop();
|
|
6707
|
+
if (p[p.length - 1].toLowerCase() === 'x') return null;
|
|
6708
|
+
return this.formatLanguageCode(p.join('-'));
|
|
6709
|
+
}
|
|
6710
|
+
}, {
|
|
6711
|
+
key: "getLanguagePartFromCode",
|
|
6712
|
+
value: function getLanguagePartFromCode(code) {
|
|
6713
|
+
if (!code || code.indexOf('-') < 0) return code;
|
|
6714
|
+
var p = code.split('-');
|
|
6715
|
+
return this.formatLanguageCode(p[0]);
|
|
6716
|
+
}
|
|
6717
|
+
}, {
|
|
6718
|
+
key: "formatLanguageCode",
|
|
6719
|
+
value: function formatLanguageCode(code) {
|
|
6720
|
+
if (typeof code === 'string' && code.indexOf('-') > -1) {
|
|
6721
|
+
var specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];
|
|
6722
|
+
var p = code.split('-');
|
|
6723
|
+
if (this.options.lowerCaseLng) {
|
|
6724
|
+
p = p.map(function (part) {
|
|
6725
|
+
return part.toLowerCase();
|
|
6726
|
+
});
|
|
6727
|
+
} else if (p.length === 2) {
|
|
6728
|
+
p[0] = p[0].toLowerCase();
|
|
6729
|
+
p[1] = p[1].toUpperCase();
|
|
6730
|
+
if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize$1(p[1].toLowerCase());
|
|
6731
|
+
} else if (p.length === 3) {
|
|
6732
|
+
p[0] = p[0].toLowerCase();
|
|
6733
|
+
if (p[1].length === 2) p[1] = p[1].toUpperCase();
|
|
6734
|
+
if (p[0] !== 'sgn' && p[2].length === 2) p[2] = p[2].toUpperCase();
|
|
6735
|
+
if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize$1(p[1].toLowerCase());
|
|
6736
|
+
if (specialCases.indexOf(p[2].toLowerCase()) > -1) p[2] = capitalize$1(p[2].toLowerCase());
|
|
6737
|
+
}
|
|
6738
|
+
return p.join('-');
|
|
6739
|
+
}
|
|
6740
|
+
return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
|
|
6741
|
+
}
|
|
6742
|
+
}, {
|
|
6743
|
+
key: "isSupportedCode",
|
|
6744
|
+
value: function isSupportedCode(code) {
|
|
6745
|
+
if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
|
|
6746
|
+
code = this.getLanguagePartFromCode(code);
|
|
6747
|
+
}
|
|
6748
|
+
return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
|
|
6749
|
+
}
|
|
6750
|
+
}, {
|
|
6751
|
+
key: "getBestMatchFromCodes",
|
|
6752
|
+
value: function getBestMatchFromCodes(codes) {
|
|
6753
|
+
var _this = this;
|
|
6754
|
+
if (!codes) return null;
|
|
6755
|
+
var found;
|
|
6756
|
+
codes.forEach(function (code) {
|
|
6757
|
+
if (found) return;
|
|
6758
|
+
var cleanedLng = _this.formatLanguageCode(code);
|
|
6759
|
+
if (!_this.options.supportedLngs || _this.isSupportedCode(cleanedLng)) found = cleanedLng;
|
|
6760
|
+
});
|
|
6761
|
+
if (!found && this.options.supportedLngs) {
|
|
6762
|
+
codes.forEach(function (code) {
|
|
6763
|
+
if (found) return;
|
|
6764
|
+
var lngOnly = _this.getLanguagePartFromCode(code);
|
|
6765
|
+
if (_this.isSupportedCode(lngOnly)) return found = lngOnly;
|
|
6766
|
+
found = _this.options.supportedLngs.find(function (supportedLng) {
|
|
6767
|
+
if (supportedLng === lngOnly) return supportedLng;
|
|
6768
|
+
if (supportedLng.indexOf('-') < 0 && lngOnly.indexOf('-') < 0) return;
|
|
6769
|
+
if (supportedLng.indexOf(lngOnly) === 0) return supportedLng;
|
|
6770
|
+
});
|
|
6771
|
+
});
|
|
6772
|
+
}
|
|
6773
|
+
if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
|
|
6774
|
+
return found;
|
|
6775
|
+
}
|
|
6776
|
+
}, {
|
|
6777
|
+
key: "getFallbackCodes",
|
|
6778
|
+
value: function getFallbackCodes(fallbacks, code) {
|
|
6779
|
+
if (!fallbacks) return [];
|
|
6780
|
+
if (typeof fallbacks === 'function') fallbacks = fallbacks(code);
|
|
6781
|
+
if (typeof fallbacks === 'string') fallbacks = [fallbacks];
|
|
6782
|
+
if (Object.prototype.toString.apply(fallbacks) === '[object Array]') return fallbacks;
|
|
6783
|
+
if (!code) return fallbacks["default"] || [];
|
|
6784
|
+
var found = fallbacks[code];
|
|
6785
|
+
if (!found) found = fallbacks[this.getScriptPartFromCode(code)];
|
|
6786
|
+
if (!found) found = fallbacks[this.formatLanguageCode(code)];
|
|
6787
|
+
if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];
|
|
6788
|
+
if (!found) found = fallbacks["default"];
|
|
6789
|
+
return found || [];
|
|
6790
|
+
}
|
|
6791
|
+
}, {
|
|
6792
|
+
key: "toResolveHierarchy",
|
|
6793
|
+
value: function toResolveHierarchy(code, fallbackCode) {
|
|
6794
|
+
var _this2 = this;
|
|
6795
|
+
var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
|
|
6796
|
+
var codes = [];
|
|
6797
|
+
var addCode = function addCode(c) {
|
|
6798
|
+
if (!c) return;
|
|
6799
|
+
if (_this2.isSupportedCode(c)) {
|
|
6800
|
+
codes.push(c);
|
|
6801
|
+
} else {
|
|
6802
|
+
_this2.logger.warn(("rejecting language code not found in supportedLngs: ").concat(c));
|
|
6803
|
+
}
|
|
6804
|
+
};
|
|
6805
|
+
if (typeof code === 'string' && code.indexOf('-') > -1) {
|
|
6806
|
+
if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
|
|
6807
|
+
if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
|
|
6808
|
+
if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
|
|
6809
|
+
} else if (typeof code === 'string') {
|
|
6810
|
+
addCode(this.formatLanguageCode(code));
|
|
6811
|
+
}
|
|
6812
|
+
fallbackCodes.forEach(function (fc) {
|
|
6813
|
+
if (codes.indexOf(fc) < 0) addCode(_this2.formatLanguageCode(fc));
|
|
6814
|
+
});
|
|
6815
|
+
return codes;
|
|
6816
|
+
}
|
|
6817
|
+
}]);
|
|
6818
|
+
return LanguageUtil;
|
|
6819
|
+
})();
|
|
6820
|
+
var sets = [{
|
|
6821
|
+
lngs: ['ach', 'ak', 'am', 'arn', 'br', 'fil', 'gun', 'ln', 'mfe', 'mg', 'mi', 'oc', 'pt', 'pt-BR', 'tg', 'tl', 'ti', 'tr', 'uz', 'wa'],
|
|
6822
|
+
nr: [1, 2],
|
|
6823
|
+
fc: 1
|
|
6824
|
+
}, {
|
|
6825
|
+
lngs: ['af', 'an', 'ast', 'az', 'bg', 'bn', 'ca', 'da', 'de', 'dev', 'el', 'en', 'eo', 'es', 'et', 'eu', 'fi', 'fo', 'fur', 'fy', 'gl', 'gu', 'ha', 'hi', 'hu', 'hy', 'ia', 'it', 'kk', 'kn', 'ku', 'lb', 'mai', 'ml', 'mn', 'mr', 'nah', 'nap', 'nb', 'ne', 'nl', 'nn', 'no', 'nso', 'pa', 'pap', 'pms', 'ps', 'pt-PT', 'rm', 'sco', 'se', 'si', 'so', 'son', 'sq', 'sv', 'sw', 'ta', 'te', 'tk', 'ur', 'yo'],
|
|
6826
|
+
nr: [1, 2],
|
|
6827
|
+
fc: 2
|
|
6828
|
+
}, {
|
|
6829
|
+
lngs: ['ay', 'bo', 'cgg', 'fa', 'ht', 'id', 'ja', 'jbo', 'ka', 'km', 'ko', 'ky', 'lo', 'ms', 'sah', 'su', 'th', 'tt', 'ug', 'vi', 'wo', 'zh'],
|
|
6830
|
+
nr: [1],
|
|
6831
|
+
fc: 3
|
|
6832
|
+
}, {
|
|
6833
|
+
lngs: ['be', 'bs', 'cnr', 'dz', 'hr', 'ru', 'sr', 'uk'],
|
|
6834
|
+
nr: [1, 2, 5],
|
|
6835
|
+
fc: 4
|
|
6836
|
+
}, {
|
|
6837
|
+
lngs: ['ar'],
|
|
6838
|
+
nr: [0, 1, 2, 3, 11, 100],
|
|
6839
|
+
fc: 5
|
|
6840
|
+
}, {
|
|
6841
|
+
lngs: ['cs', 'sk'],
|
|
6842
|
+
nr: [1, 2, 5],
|
|
6843
|
+
fc: 6
|
|
6844
|
+
}, {
|
|
6845
|
+
lngs: ['csb', 'pl'],
|
|
6846
|
+
nr: [1, 2, 5],
|
|
6847
|
+
fc: 7
|
|
6848
|
+
}, {
|
|
6849
|
+
lngs: ['cy'],
|
|
6850
|
+
nr: [1, 2, 3, 8],
|
|
6851
|
+
fc: 8
|
|
6852
|
+
}, {
|
|
6853
|
+
lngs: ['fr'],
|
|
6854
|
+
nr: [1, 2],
|
|
6855
|
+
fc: 9
|
|
6856
|
+
}, {
|
|
6857
|
+
lngs: ['ga'],
|
|
6858
|
+
nr: [1, 2, 3, 7, 11],
|
|
6859
|
+
fc: 10
|
|
6860
|
+
}, {
|
|
6861
|
+
lngs: ['gd'],
|
|
6862
|
+
nr: [1, 2, 3, 20],
|
|
6863
|
+
fc: 11
|
|
6864
|
+
}, {
|
|
6865
|
+
lngs: ['is'],
|
|
6866
|
+
nr: [1, 2],
|
|
6867
|
+
fc: 12
|
|
6868
|
+
}, {
|
|
6869
|
+
lngs: ['jv'],
|
|
6870
|
+
nr: [0, 1],
|
|
6871
|
+
fc: 13
|
|
6872
|
+
}, {
|
|
6873
|
+
lngs: ['kw'],
|
|
6874
|
+
nr: [1, 2, 3, 4],
|
|
6875
|
+
fc: 14
|
|
6876
|
+
}, {
|
|
6877
|
+
lngs: ['lt'],
|
|
6878
|
+
nr: [1, 2, 10],
|
|
6879
|
+
fc: 15
|
|
6880
|
+
}, {
|
|
6881
|
+
lngs: ['lv'],
|
|
6882
|
+
nr: [1, 2, 0],
|
|
6883
|
+
fc: 16
|
|
6884
|
+
}, {
|
|
6885
|
+
lngs: ['mk'],
|
|
6886
|
+
nr: [1, 2],
|
|
6887
|
+
fc: 17
|
|
6888
|
+
}, {
|
|
6889
|
+
lngs: ['mnk'],
|
|
6890
|
+
nr: [0, 1, 2],
|
|
6891
|
+
fc: 18
|
|
6892
|
+
}, {
|
|
6893
|
+
lngs: ['mt'],
|
|
6894
|
+
nr: [1, 2, 11, 20],
|
|
6895
|
+
fc: 19
|
|
6896
|
+
}, {
|
|
6897
|
+
lngs: ['or'],
|
|
6898
|
+
nr: [2, 1],
|
|
6899
|
+
fc: 2
|
|
6900
|
+
}, {
|
|
6901
|
+
lngs: ['ro'],
|
|
6902
|
+
nr: [1, 2, 20],
|
|
6903
|
+
fc: 20
|
|
6904
|
+
}, {
|
|
6905
|
+
lngs: ['sl'],
|
|
6906
|
+
nr: [5, 1, 2, 3],
|
|
6907
|
+
fc: 21
|
|
6908
|
+
}, {
|
|
6909
|
+
lngs: ['he', 'iw'],
|
|
6910
|
+
nr: [1, 2, 20, 21],
|
|
6911
|
+
fc: 22
|
|
6912
|
+
}];
|
|
6913
|
+
var _rulesPluralsTypes = {
|
|
6914
|
+
1: function _(n) {
|
|
6915
|
+
return Number(n > 1);
|
|
6916
|
+
},
|
|
6917
|
+
2: function _(n) {
|
|
6918
|
+
return Number(n != 1);
|
|
6919
|
+
},
|
|
6920
|
+
3: function _(n) {
|
|
6921
|
+
return 0;
|
|
6922
|
+
},
|
|
6923
|
+
4: function _(n) {
|
|
6924
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
6925
|
+
},
|
|
6926
|
+
5: function _(n) {
|
|
6927
|
+
return Number(n == 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5);
|
|
6928
|
+
},
|
|
6929
|
+
6: function _(n) {
|
|
6930
|
+
return Number(n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2);
|
|
6931
|
+
},
|
|
6932
|
+
7: function _(n) {
|
|
6933
|
+
return Number(n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
6934
|
+
},
|
|
6935
|
+
8: function _(n) {
|
|
6936
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3);
|
|
6937
|
+
},
|
|
6938
|
+
9: function _(n) {
|
|
6939
|
+
return Number(n >= 2);
|
|
6940
|
+
},
|
|
6941
|
+
10: function _(n) {
|
|
6942
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4);
|
|
6943
|
+
},
|
|
6944
|
+
11: function _(n) {
|
|
6945
|
+
return Number(n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3);
|
|
6946
|
+
},
|
|
6947
|
+
12: function _(n) {
|
|
6948
|
+
return Number(n % 10 != 1 || n % 100 == 11);
|
|
6949
|
+
},
|
|
6950
|
+
13: function _(n) {
|
|
6951
|
+
return Number(n !== 0);
|
|
6952
|
+
},
|
|
6953
|
+
14: function _(n) {
|
|
6954
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3);
|
|
6955
|
+
},
|
|
6956
|
+
15: function _(n) {
|
|
6957
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
6958
|
+
},
|
|
6959
|
+
16: function _(n) {
|
|
6960
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2);
|
|
6961
|
+
},
|
|
6962
|
+
17: function _(n) {
|
|
6963
|
+
return Number(n == 1 || n % 10 == 1 && n % 100 != 11 ? 0 : 1);
|
|
6964
|
+
},
|
|
6965
|
+
18: function _(n) {
|
|
6966
|
+
return Number(n == 0 ? 0 : n == 1 ? 1 : 2);
|
|
6967
|
+
},
|
|
6968
|
+
19: function _(n) {
|
|
6969
|
+
return Number(n == 1 ? 0 : n == 0 || n % 100 > 1 && n % 100 < 11 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3);
|
|
6970
|
+
},
|
|
6971
|
+
20: function _(n) {
|
|
6972
|
+
return Number(n == 1 ? 0 : n == 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2);
|
|
6973
|
+
},
|
|
6974
|
+
21: function _(n) {
|
|
6975
|
+
return Number(n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0);
|
|
6976
|
+
},
|
|
6977
|
+
22: function _(n) {
|
|
6978
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : (n < 0 || n > 10) && n % 10 == 0 ? 2 : 3);
|
|
6979
|
+
}
|
|
6980
|
+
};
|
|
6981
|
+
var deprecatedJsonVersions = ['v1', 'v2', 'v3'];
|
|
6982
|
+
var suffixesOrder = {
|
|
6983
|
+
zero: 0,
|
|
6984
|
+
one: 1,
|
|
6985
|
+
two: 2,
|
|
6986
|
+
few: 3,
|
|
6987
|
+
many: 4,
|
|
6988
|
+
other: 5
|
|
6989
|
+
};
|
|
6990
|
+
function createRules() {
|
|
6991
|
+
var rules = {};
|
|
6992
|
+
sets.forEach(function (set) {
|
|
6993
|
+
set.lngs.forEach(function (l) {
|
|
6994
|
+
rules[l] = {
|
|
6995
|
+
numbers: set.nr,
|
|
6996
|
+
plurals: _rulesPluralsTypes[set.fc]
|
|
6997
|
+
};
|
|
6998
|
+
});
|
|
6999
|
+
});
|
|
7000
|
+
return rules;
|
|
7001
|
+
}
|
|
7002
|
+
var PluralResolver = (function () {
|
|
7003
|
+
function PluralResolver(languageUtils) {
|
|
7004
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7005
|
+
_classCallCheck__default["default"](this, PluralResolver);
|
|
7006
|
+
this.languageUtils = languageUtils;
|
|
7007
|
+
this.options = options;
|
|
7008
|
+
this.logger = baseLogger.create('pluralResolver');
|
|
7009
|
+
if ((!this.options.compatibilityJSON || this.options.compatibilityJSON === 'v4') && (typeof Intl === 'undefined' || !Intl.PluralRules)) {
|
|
7010
|
+
this.options.compatibilityJSON = 'v3';
|
|
7011
|
+
this.logger.error('Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.');
|
|
7012
|
+
}
|
|
7013
|
+
this.rules = createRules();
|
|
7014
|
+
}
|
|
7015
|
+
_createClass__default["default"](PluralResolver, [{
|
|
7016
|
+
key: "addRule",
|
|
7017
|
+
value: function addRule(lng, obj) {
|
|
7018
|
+
this.rules[lng] = obj;
|
|
7019
|
+
}
|
|
7020
|
+
}, {
|
|
7021
|
+
key: "getRule",
|
|
7022
|
+
value: function getRule(code) {
|
|
7023
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7024
|
+
if (this.shouldUseIntlApi()) {
|
|
7025
|
+
try {
|
|
7026
|
+
return new Intl.PluralRules(code, {
|
|
7027
|
+
type: options.ordinal ? 'ordinal' : 'cardinal'
|
|
7028
|
+
});
|
|
7029
|
+
} catch (_unused) {
|
|
7030
|
+
return;
|
|
7031
|
+
}
|
|
7032
|
+
}
|
|
7033
|
+
return this.rules[code] || this.rules[this.languageUtils.getLanguagePartFromCode(code)];
|
|
7034
|
+
}
|
|
7035
|
+
}, {
|
|
7036
|
+
key: "needsPlural",
|
|
7037
|
+
value: function needsPlural(code) {
|
|
7038
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7039
|
+
var rule = this.getRule(code, options);
|
|
7040
|
+
if (this.shouldUseIntlApi()) {
|
|
7041
|
+
return rule && rule.resolvedOptions().pluralCategories.length > 1;
|
|
7042
|
+
}
|
|
7043
|
+
return rule && rule.numbers.length > 1;
|
|
7044
|
+
}
|
|
7045
|
+
}, {
|
|
7046
|
+
key: "getPluralFormsOfKey",
|
|
7047
|
+
value: function getPluralFormsOfKey(code, key) {
|
|
7048
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
7049
|
+
return this.getSuffixes(code, options).map(function (suffix) {
|
|
7050
|
+
return ("").concat(key).concat(suffix);
|
|
7051
|
+
});
|
|
7052
|
+
}
|
|
7053
|
+
}, {
|
|
7054
|
+
key: "getSuffixes",
|
|
7055
|
+
value: function getSuffixes(code) {
|
|
7056
|
+
var _this = this;
|
|
7057
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7058
|
+
var rule = this.getRule(code, options);
|
|
7059
|
+
if (!rule) {
|
|
7060
|
+
return [];
|
|
7061
|
+
}
|
|
7062
|
+
if (this.shouldUseIntlApi()) {
|
|
7063
|
+
return rule.resolvedOptions().pluralCategories.sort(function (pluralCategory1, pluralCategory2) {
|
|
7064
|
+
return suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2];
|
|
7065
|
+
}).map(function (pluralCategory) {
|
|
7066
|
+
return ("").concat(_this.options.prepend).concat(pluralCategory);
|
|
7067
|
+
});
|
|
7068
|
+
}
|
|
7069
|
+
return rule.numbers.map(function (number) {
|
|
7070
|
+
return _this.getSuffix(code, number, options);
|
|
7071
|
+
});
|
|
7072
|
+
}
|
|
7073
|
+
}, {
|
|
7074
|
+
key: "getSuffix",
|
|
7075
|
+
value: function getSuffix(code, count) {
|
|
7076
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
7077
|
+
var rule = this.getRule(code, options);
|
|
7078
|
+
if (rule) {
|
|
7079
|
+
if (this.shouldUseIntlApi()) {
|
|
7080
|
+
return ("").concat(this.options.prepend).concat(rule.select(count));
|
|
7081
|
+
}
|
|
7082
|
+
return this.getSuffixRetroCompatible(rule, count);
|
|
7083
|
+
}
|
|
7084
|
+
this.logger.warn(("no plural rule found for: ").concat(code));
|
|
7085
|
+
return '';
|
|
7086
|
+
}
|
|
7087
|
+
}, {
|
|
7088
|
+
key: "getSuffixRetroCompatible",
|
|
7089
|
+
value: function getSuffixRetroCompatible(rule, count) {
|
|
7090
|
+
var _this2 = this;
|
|
7091
|
+
var idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));
|
|
7092
|
+
var suffix = rule.numbers[idx];
|
|
7093
|
+
if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
|
|
7094
|
+
if (suffix === 2) {
|
|
7095
|
+
suffix = 'plural';
|
|
7096
|
+
} else if (suffix === 1) {
|
|
7097
|
+
suffix = '';
|
|
7098
|
+
}
|
|
7099
|
+
}
|
|
7100
|
+
var returnSuffix = function returnSuffix() {
|
|
7101
|
+
return _this2.options.prepend && suffix.toString() ? _this2.options.prepend + suffix.toString() : suffix.toString();
|
|
7102
|
+
};
|
|
7103
|
+
if (this.options.compatibilityJSON === 'v1') {
|
|
7104
|
+
if (suffix === 1) return '';
|
|
7105
|
+
if (typeof suffix === 'number') return ("_plural_").concat(suffix.toString());
|
|
7106
|
+
return returnSuffix();
|
|
7107
|
+
} else if (this.options.compatibilityJSON === 'v2') {
|
|
7108
|
+
return returnSuffix();
|
|
7109
|
+
} else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
|
|
7110
|
+
return returnSuffix();
|
|
7111
|
+
}
|
|
7112
|
+
return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();
|
|
7113
|
+
}
|
|
7114
|
+
}, {
|
|
7115
|
+
key: "shouldUseIntlApi",
|
|
7116
|
+
value: function shouldUseIntlApi() {
|
|
7117
|
+
return !deprecatedJsonVersions.includes(this.options.compatibilityJSON);
|
|
7118
|
+
}
|
|
7119
|
+
}]);
|
|
7120
|
+
return PluralResolver;
|
|
7121
|
+
})();
|
|
7122
|
+
function ownKeys$3(object, enumerableOnly) {
|
|
7123
|
+
var keys = Object.keys(object);
|
|
7124
|
+
if (Object.getOwnPropertySymbols) {
|
|
7125
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7126
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
7127
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
7128
|
+
})), keys.push.apply(keys, symbols));
|
|
7129
|
+
}
|
|
7130
|
+
return keys;
|
|
7131
|
+
}
|
|
7132
|
+
function _objectSpread$3(target) {
|
|
7133
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7134
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
7135
|
+
i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) {
|
|
7136
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
7137
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) {
|
|
7138
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7139
|
+
});
|
|
7140
|
+
}
|
|
7141
|
+
return target;
|
|
7142
|
+
}
|
|
7143
|
+
function deepFindWithDefaults(data, defaultData, key) {
|
|
7144
|
+
var keySeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '.';
|
|
7145
|
+
var ignoreJSONStructure = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
7146
|
+
var path = getPathWithDefaults(data, defaultData, key);
|
|
7147
|
+
if (!path && ignoreJSONStructure && typeof key === 'string') {
|
|
7148
|
+
path = deepFind(data, key, keySeparator);
|
|
7149
|
+
if (path === undefined) path = deepFind(defaultData, key, keySeparator);
|
|
7150
|
+
}
|
|
7151
|
+
return path;
|
|
7152
|
+
}
|
|
7153
|
+
var Interpolator = (function () {
|
|
7154
|
+
function Interpolator() {
|
|
7155
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7156
|
+
_classCallCheck__default["default"](this, Interpolator);
|
|
7157
|
+
this.logger = baseLogger.create('interpolator');
|
|
7158
|
+
this.options = options;
|
|
7159
|
+
this.format = options.interpolation && options.interpolation.format || (function (value) {
|
|
7160
|
+
return value;
|
|
7161
|
+
});
|
|
7162
|
+
this.init(options);
|
|
7163
|
+
}
|
|
7164
|
+
_createClass__default["default"](Interpolator, [{
|
|
7165
|
+
key: "init",
|
|
7166
|
+
value: function init() {
|
|
7167
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7168
|
+
if (!options.interpolation) options.interpolation = {
|
|
7169
|
+
escapeValue: true
|
|
7170
|
+
};
|
|
7171
|
+
var iOpts = options.interpolation;
|
|
7172
|
+
this.escape = iOpts.escape !== undefined ? iOpts.escape : escape;
|
|
7173
|
+
this.escapeValue = iOpts.escapeValue !== undefined ? iOpts.escapeValue : true;
|
|
7174
|
+
this.useRawValueToEscape = iOpts.useRawValueToEscape !== undefined ? iOpts.useRawValueToEscape : false;
|
|
7175
|
+
this.prefix = iOpts.prefix ? regexEscape(iOpts.prefix) : iOpts.prefixEscaped || '{{';
|
|
7176
|
+
this.suffix = iOpts.suffix ? regexEscape(iOpts.suffix) : iOpts.suffixEscaped || '}}';
|
|
7177
|
+
this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
|
|
7178
|
+
this.unescapePrefix = iOpts.unescapeSuffix ? '' : iOpts.unescapePrefix || '-';
|
|
7179
|
+
this.unescapeSuffix = this.unescapePrefix ? '' : iOpts.unescapeSuffix || '';
|
|
7180
|
+
this.nestingPrefix = iOpts.nestingPrefix ? regexEscape(iOpts.nestingPrefix) : iOpts.nestingPrefixEscaped || regexEscape('$t(');
|
|
7181
|
+
this.nestingSuffix = iOpts.nestingSuffix ? regexEscape(iOpts.nestingSuffix) : iOpts.nestingSuffixEscaped || regexEscape(')');
|
|
7182
|
+
this.nestingOptionsSeparator = iOpts.nestingOptionsSeparator ? iOpts.nestingOptionsSeparator : iOpts.nestingOptionsSeparator || ',';
|
|
7183
|
+
this.maxReplaces = iOpts.maxReplaces ? iOpts.maxReplaces : 1000;
|
|
7184
|
+
this.alwaysFormat = iOpts.alwaysFormat !== undefined ? iOpts.alwaysFormat : false;
|
|
7185
|
+
this.resetRegExp();
|
|
7186
|
+
}
|
|
7187
|
+
}, {
|
|
7188
|
+
key: "reset",
|
|
7189
|
+
value: function reset() {
|
|
7190
|
+
if (this.options) this.init(this.options);
|
|
7191
|
+
}
|
|
7192
|
+
}, {
|
|
7193
|
+
key: "resetRegExp",
|
|
7194
|
+
value: function resetRegExp() {
|
|
7195
|
+
var regexpStr = ("").concat(this.prefix, "(.+?)").concat(this.suffix);
|
|
7196
|
+
this.regexp = new RegExp(regexpStr, 'g');
|
|
7197
|
+
var regexpUnescapeStr = ("").concat(this.prefix).concat(this.unescapePrefix, "(.+?)").concat(this.unescapeSuffix).concat(this.suffix);
|
|
7198
|
+
this.regexpUnescape = new RegExp(regexpUnescapeStr, 'g');
|
|
7199
|
+
var nestingRegexpStr = ("").concat(this.nestingPrefix, "(.+?)").concat(this.nestingSuffix);
|
|
7200
|
+
this.nestingRegexp = new RegExp(nestingRegexpStr, 'g');
|
|
7201
|
+
}
|
|
7202
|
+
}, {
|
|
7203
|
+
key: "interpolate",
|
|
7204
|
+
value: function interpolate(str, data, lng, options) {
|
|
7205
|
+
var _this = this;
|
|
7206
|
+
var match;
|
|
7207
|
+
var value;
|
|
7208
|
+
var replaces;
|
|
7209
|
+
var defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || ({});
|
|
7210
|
+
function regexSafe(val) {
|
|
7211
|
+
return val.replace(/\$/g, '$$$$');
|
|
7212
|
+
}
|
|
7213
|
+
var handleFormat = function handleFormat(key) {
|
|
7214
|
+
if (key.indexOf(_this.formatSeparator) < 0) {
|
|
7215
|
+
var path = deepFindWithDefaults(data, defaultData, key, _this.options.keySeparator, _this.options.ignoreJSONStructure);
|
|
7216
|
+
return _this.alwaysFormat ? _this.format(path, undefined, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
|
|
7217
|
+
interpolationkey: key
|
|
7218
|
+
})) : path;
|
|
7219
|
+
}
|
|
7220
|
+
var p = key.split(_this.formatSeparator);
|
|
7221
|
+
var k = p.shift().trim();
|
|
7222
|
+
var f = p.join(_this.formatSeparator).trim();
|
|
7223
|
+
return _this.format(deepFindWithDefaults(data, defaultData, k, _this.options.keySeparator, _this.options.ignoreJSONStructure), f, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
|
|
7224
|
+
interpolationkey: k
|
|
7225
|
+
}));
|
|
7226
|
+
};
|
|
7227
|
+
this.resetRegExp();
|
|
7228
|
+
var missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler;
|
|
7229
|
+
var skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
7230
|
+
var todos = [{
|
|
7231
|
+
regex: this.regexpUnescape,
|
|
7232
|
+
safeValue: function safeValue(val) {
|
|
7233
|
+
return regexSafe(val);
|
|
7234
|
+
}
|
|
7235
|
+
}, {
|
|
7236
|
+
regex: this.regexp,
|
|
7237
|
+
safeValue: function safeValue(val) {
|
|
7238
|
+
return _this.escapeValue ? regexSafe(_this.escape(val)) : regexSafe(val);
|
|
7239
|
+
}
|
|
7240
|
+
}];
|
|
7241
|
+
todos.forEach(function (todo) {
|
|
7242
|
+
replaces = 0;
|
|
7243
|
+
while (match = todo.regex.exec(str)) {
|
|
7244
|
+
var matchedVar = match[1].trim();
|
|
7245
|
+
value = handleFormat(matchedVar);
|
|
7246
|
+
if (value === undefined) {
|
|
7247
|
+
if (typeof missingInterpolationHandler === 'function') {
|
|
7248
|
+
var temp = missingInterpolationHandler(str, match, options);
|
|
7249
|
+
value = typeof temp === 'string' ? temp : '';
|
|
7250
|
+
} else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
|
|
7251
|
+
value = '';
|
|
7252
|
+
} else if (skipOnVariables) {
|
|
7253
|
+
value = match[0];
|
|
7254
|
+
continue;
|
|
7255
|
+
} else {
|
|
7256
|
+
_this.logger.warn(("missed to pass in variable ").concat(matchedVar, " for interpolating ").concat(str));
|
|
7257
|
+
value = '';
|
|
7258
|
+
}
|
|
7259
|
+
} else if (typeof value !== 'string' && !_this.useRawValueToEscape) {
|
|
7260
|
+
value = makeString(value);
|
|
7261
|
+
}
|
|
7262
|
+
var safeValue = todo.safeValue(value);
|
|
7263
|
+
str = str.replace(match[0], safeValue);
|
|
7264
|
+
if (skipOnVariables) {
|
|
7265
|
+
todo.regex.lastIndex += value.length;
|
|
7266
|
+
todo.regex.lastIndex -= match[0].length;
|
|
7267
|
+
} else {
|
|
7268
|
+
todo.regex.lastIndex = 0;
|
|
7269
|
+
}
|
|
7270
|
+
replaces++;
|
|
7271
|
+
if (replaces >= _this.maxReplaces) {
|
|
7272
|
+
break;
|
|
7273
|
+
}
|
|
7274
|
+
}
|
|
7275
|
+
});
|
|
7276
|
+
return str;
|
|
7277
|
+
}
|
|
7278
|
+
}, {
|
|
7279
|
+
key: "nest",
|
|
7280
|
+
value: function nest(str, fc) {
|
|
7281
|
+
var _this2 = this;
|
|
7282
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
7283
|
+
var match;
|
|
7284
|
+
var value;
|
|
7285
|
+
var clonedOptions;
|
|
7286
|
+
function handleHasOptions(key, inheritedOptions) {
|
|
7287
|
+
var sep = this.nestingOptionsSeparator;
|
|
7288
|
+
if (key.indexOf(sep) < 0) return key;
|
|
7289
|
+
var c = key.split(new RegExp(("").concat(sep, "[ ]*{")));
|
|
7290
|
+
var optionsString = ("{").concat(c[1]);
|
|
7291
|
+
key = c[0];
|
|
7292
|
+
optionsString = this.interpolate(optionsString, clonedOptions);
|
|
7293
|
+
var matchedSingleQuotes = optionsString.match(/'/g);
|
|
7294
|
+
var matchedDoubleQuotes = optionsString.match(/"/g);
|
|
7295
|
+
if (matchedSingleQuotes && matchedSingleQuotes.length % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
|
|
7296
|
+
optionsString = optionsString.replace(/'/g, '"');
|
|
7297
|
+
}
|
|
7298
|
+
try {
|
|
7299
|
+
clonedOptions = JSON.parse(optionsString);
|
|
7300
|
+
if (inheritedOptions) clonedOptions = _objectSpread$3(_objectSpread$3({}, inheritedOptions), clonedOptions);
|
|
7301
|
+
} catch (e) {
|
|
7302
|
+
this.logger.warn(("failed parsing options string in nesting for key ").concat(key), e);
|
|
7303
|
+
return ("").concat(key).concat(sep).concat(optionsString);
|
|
7304
|
+
}
|
|
7305
|
+
delete clonedOptions.defaultValue;
|
|
7306
|
+
return key;
|
|
7307
|
+
}
|
|
7308
|
+
while (match = this.nestingRegexp.exec(str)) {
|
|
7309
|
+
var formatters = [];
|
|
7310
|
+
clonedOptions = _objectSpread$3({}, options);
|
|
7311
|
+
clonedOptions = clonedOptions.replace && typeof clonedOptions.replace !== 'string' ? clonedOptions.replace : clonedOptions;
|
|
7312
|
+
clonedOptions.applyPostProcessor = false;
|
|
7313
|
+
delete clonedOptions.defaultValue;
|
|
7314
|
+
var doReduce = false;
|
|
7315
|
+
if (match[0].indexOf(this.formatSeparator) !== -1 && !(/{.*}/).test(match[1])) {
|
|
7316
|
+
var r = match[1].split(this.formatSeparator).map(function (elem) {
|
|
7317
|
+
return elem.trim();
|
|
7318
|
+
});
|
|
7319
|
+
match[1] = r.shift();
|
|
7320
|
+
formatters = r;
|
|
7321
|
+
doReduce = true;
|
|
7322
|
+
}
|
|
7323
|
+
value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
|
|
7324
|
+
if (value && match[0] === str && typeof value !== 'string') return value;
|
|
7325
|
+
if (typeof value !== 'string') value = makeString(value);
|
|
7326
|
+
if (!value) {
|
|
7327
|
+
this.logger.warn(("missed to resolve ").concat(match[1], " for nesting ").concat(str));
|
|
7328
|
+
value = '';
|
|
7329
|
+
}
|
|
7330
|
+
if (doReduce) {
|
|
7331
|
+
value = formatters.reduce(function (v, f) {
|
|
7332
|
+
return _this2.format(v, f, options.lng, _objectSpread$3(_objectSpread$3({}, options), {}, {
|
|
7333
|
+
interpolationkey: match[1].trim()
|
|
7334
|
+
}));
|
|
7335
|
+
}, value.trim());
|
|
7336
|
+
}
|
|
7337
|
+
str = str.replace(match[0], value);
|
|
7338
|
+
this.regexp.lastIndex = 0;
|
|
7339
|
+
}
|
|
7340
|
+
return str;
|
|
7341
|
+
}
|
|
7342
|
+
}]);
|
|
7343
|
+
return Interpolator;
|
|
7344
|
+
})();
|
|
7345
|
+
function ownKeys$2(object, enumerableOnly) {
|
|
7346
|
+
var keys = Object.keys(object);
|
|
7347
|
+
if (Object.getOwnPropertySymbols) {
|
|
7348
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7349
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
7350
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
7351
|
+
})), keys.push.apply(keys, symbols));
|
|
7352
|
+
}
|
|
7353
|
+
return keys;
|
|
7354
|
+
}
|
|
7355
|
+
function _objectSpread$2(target) {
|
|
7356
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7357
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
7358
|
+
i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
|
|
7359
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
7360
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
|
|
7361
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7362
|
+
});
|
|
7363
|
+
}
|
|
7364
|
+
return target;
|
|
7365
|
+
}
|
|
7366
|
+
function parseFormatStr(formatStr) {
|
|
7367
|
+
var formatName = formatStr.toLowerCase().trim();
|
|
7368
|
+
var formatOptions = {};
|
|
7369
|
+
if (formatStr.indexOf('(') > -1) {
|
|
7370
|
+
var p = formatStr.split('(');
|
|
7371
|
+
formatName = p[0].toLowerCase().trim();
|
|
7372
|
+
var optStr = p[1].substring(0, p[1].length - 1);
|
|
7373
|
+
if (formatName === 'currency' && optStr.indexOf(':') < 0) {
|
|
7374
|
+
if (!formatOptions.currency) formatOptions.currency = optStr.trim();
|
|
7375
|
+
} else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {
|
|
7376
|
+
if (!formatOptions.range) formatOptions.range = optStr.trim();
|
|
7377
|
+
} else {
|
|
7378
|
+
var opts = optStr.split(';');
|
|
7379
|
+
opts.forEach(function (opt) {
|
|
7380
|
+
if (!opt) return;
|
|
7381
|
+
var _opt$split = opt.split(':'), _opt$split2 = _toArray__default["default"](_opt$split), key = _opt$split2[0], rest = _opt$split2.slice(1);
|
|
7382
|
+
var val = rest.join(':').trim().replace(/^'+|'+$/g, '');
|
|
7383
|
+
if (!formatOptions[key.trim()]) formatOptions[key.trim()] = val;
|
|
7384
|
+
if (val === 'false') formatOptions[key.trim()] = false;
|
|
7385
|
+
if (val === 'true') formatOptions[key.trim()] = true;
|
|
7386
|
+
if (!isNaN(val)) formatOptions[key.trim()] = parseInt(val, 10);
|
|
7387
|
+
});
|
|
7388
|
+
}
|
|
7389
|
+
}
|
|
7390
|
+
return {
|
|
7391
|
+
formatName: formatName,
|
|
7392
|
+
formatOptions: formatOptions
|
|
7393
|
+
};
|
|
7394
|
+
}
|
|
7395
|
+
function createCachedFormatter(fn) {
|
|
7396
|
+
var cache = {};
|
|
7397
|
+
return function invokeFormatter(val, lng, options) {
|
|
7398
|
+
var key = lng + JSON.stringify(options);
|
|
7399
|
+
var formatter = cache[key];
|
|
7400
|
+
if (!formatter) {
|
|
7401
|
+
formatter = fn(lng, options);
|
|
7402
|
+
cache[key] = formatter;
|
|
7403
|
+
}
|
|
7404
|
+
return formatter(val);
|
|
7405
|
+
};
|
|
7406
|
+
}
|
|
7407
|
+
var Formatter = (function () {
|
|
7408
|
+
function Formatter() {
|
|
7409
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7410
|
+
_classCallCheck__default["default"](this, Formatter);
|
|
7411
|
+
this.logger = baseLogger.create('formatter');
|
|
7412
|
+
this.options = options;
|
|
7413
|
+
this.formats = {
|
|
7414
|
+
number: createCachedFormatter(function (lng, opt) {
|
|
7415
|
+
var formatter = new Intl.NumberFormat(lng, _objectSpread$2({}, opt));
|
|
7416
|
+
return function (val) {
|
|
7417
|
+
return formatter.format(val);
|
|
7418
|
+
};
|
|
7419
|
+
}),
|
|
7420
|
+
currency: createCachedFormatter(function (lng, opt) {
|
|
7421
|
+
var formatter = new Intl.NumberFormat(lng, _objectSpread$2(_objectSpread$2({}, opt), {}, {
|
|
7422
|
+
style: 'currency'
|
|
7423
|
+
}));
|
|
7424
|
+
return function (val) {
|
|
7425
|
+
return formatter.format(val);
|
|
7426
|
+
};
|
|
7427
|
+
}),
|
|
7428
|
+
datetime: createCachedFormatter(function (lng, opt) {
|
|
7429
|
+
var formatter = new Intl.DateTimeFormat(lng, _objectSpread$2({}, opt));
|
|
7430
|
+
return function (val) {
|
|
7431
|
+
return formatter.format(val);
|
|
7432
|
+
};
|
|
7433
|
+
}),
|
|
7434
|
+
relativetime: createCachedFormatter(function (lng, opt) {
|
|
7435
|
+
var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$2({}, opt));
|
|
7436
|
+
return function (val) {
|
|
7437
|
+
return formatter.format(val, opt.range || 'day');
|
|
7438
|
+
};
|
|
7439
|
+
}),
|
|
7440
|
+
list: createCachedFormatter(function (lng, opt) {
|
|
7441
|
+
var formatter = new Intl.ListFormat(lng, _objectSpread$2({}, opt));
|
|
7442
|
+
return function (val) {
|
|
7443
|
+
return formatter.format(val);
|
|
7444
|
+
};
|
|
7445
|
+
})
|
|
7446
|
+
};
|
|
7447
|
+
this.init(options);
|
|
7448
|
+
}
|
|
7449
|
+
_createClass__default["default"](Formatter, [{
|
|
7450
|
+
key: "init",
|
|
7451
|
+
value: function init(services) {
|
|
7452
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
7453
|
+
interpolation: {}
|
|
7454
|
+
};
|
|
7455
|
+
var iOpts = options.interpolation;
|
|
7456
|
+
this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
|
|
7457
|
+
}
|
|
7458
|
+
}, {
|
|
7459
|
+
key: "add",
|
|
7460
|
+
value: function add(name, fc) {
|
|
7461
|
+
this.formats[name.toLowerCase().trim()] = fc;
|
|
7462
|
+
}
|
|
7463
|
+
}, {
|
|
7464
|
+
key: "addCached",
|
|
7465
|
+
value: function addCached(name, fc) {
|
|
7466
|
+
this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
|
|
7467
|
+
}
|
|
7468
|
+
}, {
|
|
7469
|
+
key: "format",
|
|
7470
|
+
value: function format(value, _format, lng) {
|
|
7471
|
+
var _this = this;
|
|
7472
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
7473
|
+
var formats = _format.split(this.formatSeparator);
|
|
7474
|
+
var result = formats.reduce(function (mem, f) {
|
|
7475
|
+
var _parseFormatStr = parseFormatStr(f), formatName = _parseFormatStr.formatName, formatOptions = _parseFormatStr.formatOptions;
|
|
7476
|
+
if (_this.formats[formatName]) {
|
|
7477
|
+
var formatted = mem;
|
|
7478
|
+
try {
|
|
7479
|
+
var valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || ({});
|
|
7480
|
+
var l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
|
|
7481
|
+
formatted = _this.formats[formatName](mem, l, _objectSpread$2(_objectSpread$2(_objectSpread$2({}, formatOptions), options), valOptions));
|
|
7482
|
+
} catch (error) {
|
|
7483
|
+
_this.logger.warn(error);
|
|
7484
|
+
}
|
|
7485
|
+
return formatted;
|
|
7486
|
+
} else {
|
|
7487
|
+
_this.logger.warn(("there was no format function for ").concat(formatName));
|
|
7488
|
+
}
|
|
7489
|
+
return mem;
|
|
7490
|
+
}, value);
|
|
7491
|
+
return result;
|
|
7492
|
+
}
|
|
7493
|
+
}]);
|
|
7494
|
+
return Formatter;
|
|
7495
|
+
})();
|
|
7496
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
7497
|
+
var keys = Object.keys(object);
|
|
7498
|
+
if (Object.getOwnPropertySymbols) {
|
|
7499
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7500
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
7501
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
7502
|
+
})), keys.push.apply(keys, symbols));
|
|
7503
|
+
}
|
|
7504
|
+
return keys;
|
|
7505
|
+
}
|
|
7506
|
+
function _objectSpread$1(target) {
|
|
7507
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7508
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
7509
|
+
i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
|
|
7510
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
7511
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
|
|
7512
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7513
|
+
});
|
|
7514
|
+
}
|
|
7515
|
+
return target;
|
|
7516
|
+
}
|
|
7517
|
+
function _createSuper$1(Derived) {
|
|
7518
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
|
|
7519
|
+
return function _createSuperInternal() {
|
|
7520
|
+
var Super = _getPrototypeOf__default["default"](Derived), result;
|
|
7521
|
+
if (hasNativeReflectConstruct) {
|
|
7522
|
+
var NewTarget = _getPrototypeOf__default["default"](this).constructor;
|
|
7523
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
7524
|
+
} else {
|
|
7525
|
+
result = Super.apply(this, arguments);
|
|
7526
|
+
}
|
|
7527
|
+
return _possibleConstructorReturn__default["default"](this, result);
|
|
7528
|
+
};
|
|
7529
|
+
}
|
|
7530
|
+
function _isNativeReflectConstruct$1() {
|
|
7531
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
7532
|
+
if (Reflect.construct.sham) return false;
|
|
7533
|
+
if (typeof Proxy === "function") return true;
|
|
7534
|
+
try {
|
|
7535
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
7536
|
+
return true;
|
|
7537
|
+
} catch (e) {
|
|
7538
|
+
return false;
|
|
7539
|
+
}
|
|
7540
|
+
}
|
|
7541
|
+
function removePending(q, name) {
|
|
7542
|
+
if (q.pending[name] !== undefined) {
|
|
7543
|
+
delete q.pending[name];
|
|
7544
|
+
q.pendingCount--;
|
|
7545
|
+
}
|
|
7546
|
+
}
|
|
7547
|
+
var Connector = (function (_EventEmitter) {
|
|
7548
|
+
_inherits__default["default"](Connector, _EventEmitter);
|
|
7549
|
+
var _super = _createSuper$1(Connector);
|
|
7550
|
+
function Connector(backend, store, services) {
|
|
7551
|
+
var _this;
|
|
7552
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
7553
|
+
_classCallCheck__default["default"](this, Connector);
|
|
7554
|
+
_this = _super.call(this);
|
|
7555
|
+
if (isIE10) {
|
|
7556
|
+
EventEmitter.call(_assertThisInitialized__default["default"](_this));
|
|
7557
|
+
}
|
|
7558
|
+
_this.backend = backend;
|
|
7559
|
+
_this.store = store;
|
|
7560
|
+
_this.services = services;
|
|
7561
|
+
_this.languageUtils = services.languageUtils;
|
|
7562
|
+
_this.options = options;
|
|
7563
|
+
_this.logger = baseLogger.create('backendConnector');
|
|
7564
|
+
_this.waitingReads = [];
|
|
7565
|
+
_this.maxParallelReads = options.maxParallelReads || 10;
|
|
7566
|
+
_this.readingCalls = 0;
|
|
7567
|
+
_this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
|
|
7568
|
+
_this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
|
|
7569
|
+
_this.state = {};
|
|
7570
|
+
_this.queue = [];
|
|
7571
|
+
if (_this.backend && _this.backend.init) {
|
|
7572
|
+
_this.backend.init(services, options.backend, options);
|
|
7573
|
+
}
|
|
7574
|
+
return _this;
|
|
7575
|
+
}
|
|
7576
|
+
_createClass__default["default"](Connector, [{
|
|
7577
|
+
key: "queueLoad",
|
|
7578
|
+
value: function queueLoad(languages, namespaces, options, callback) {
|
|
7579
|
+
var _this2 = this;
|
|
7580
|
+
var toLoad = {};
|
|
7581
|
+
var pending = {};
|
|
7582
|
+
var toLoadLanguages = {};
|
|
7583
|
+
var toLoadNamespaces = {};
|
|
7584
|
+
languages.forEach(function (lng) {
|
|
7585
|
+
var hasAllNamespaces = true;
|
|
7586
|
+
namespaces.forEach(function (ns) {
|
|
7587
|
+
var name = ("").concat(lng, "|").concat(ns);
|
|
7588
|
+
if (!options.reload && _this2.store.hasResourceBundle(lng, ns)) {
|
|
7589
|
+
_this2.state[name] = 2;
|
|
7590
|
+
} else if (_this2.state[name] < 0) ; else if (_this2.state[name] === 1) {
|
|
7591
|
+
if (pending[name] === undefined) pending[name] = true;
|
|
7592
|
+
} else {
|
|
7593
|
+
_this2.state[name] = 1;
|
|
7594
|
+
hasAllNamespaces = false;
|
|
7595
|
+
if (pending[name] === undefined) pending[name] = true;
|
|
7596
|
+
if (toLoad[name] === undefined) toLoad[name] = true;
|
|
7597
|
+
if (toLoadNamespaces[ns] === undefined) toLoadNamespaces[ns] = true;
|
|
7598
|
+
}
|
|
7599
|
+
});
|
|
7600
|
+
if (!hasAllNamespaces) toLoadLanguages[lng] = true;
|
|
7601
|
+
});
|
|
7602
|
+
if (Object.keys(toLoad).length || Object.keys(pending).length) {
|
|
7603
|
+
this.queue.push({
|
|
7604
|
+
pending: pending,
|
|
7605
|
+
pendingCount: Object.keys(pending).length,
|
|
7606
|
+
loaded: {},
|
|
7607
|
+
errors: [],
|
|
7608
|
+
callback: callback
|
|
7609
|
+
});
|
|
7610
|
+
}
|
|
7611
|
+
return {
|
|
7612
|
+
toLoad: Object.keys(toLoad),
|
|
7613
|
+
pending: Object.keys(pending),
|
|
7614
|
+
toLoadLanguages: Object.keys(toLoadLanguages),
|
|
7615
|
+
toLoadNamespaces: Object.keys(toLoadNamespaces)
|
|
7616
|
+
};
|
|
7617
|
+
}
|
|
7618
|
+
}, {
|
|
7619
|
+
key: "loaded",
|
|
7620
|
+
value: function loaded(name, err, data) {
|
|
7621
|
+
var s = name.split('|');
|
|
7622
|
+
var lng = s[0];
|
|
7623
|
+
var ns = s[1];
|
|
7624
|
+
if (err) this.emit('failedLoading', lng, ns, err);
|
|
7625
|
+
if (data) {
|
|
7626
|
+
this.store.addResourceBundle(lng, ns, data);
|
|
7627
|
+
}
|
|
7628
|
+
this.state[name] = err ? -1 : 2;
|
|
7629
|
+
var loaded = {};
|
|
7630
|
+
this.queue.forEach(function (q) {
|
|
7631
|
+
pushPath(q.loaded, [lng], ns);
|
|
7632
|
+
removePending(q, name);
|
|
7633
|
+
if (err) q.errors.push(err);
|
|
7634
|
+
if (q.pendingCount === 0 && !q.done) {
|
|
7635
|
+
Object.keys(q.loaded).forEach(function (l) {
|
|
7636
|
+
if (!loaded[l]) loaded[l] = {};
|
|
7637
|
+
var loadedKeys = q.loaded[l];
|
|
7638
|
+
if (loadedKeys.length) {
|
|
7639
|
+
loadedKeys.forEach(function (n) {
|
|
7640
|
+
if (loaded[l][n] === undefined) loaded[l][n] = true;
|
|
7641
|
+
});
|
|
7642
|
+
}
|
|
7643
|
+
});
|
|
7644
|
+
q.done = true;
|
|
7645
|
+
if (q.errors.length) {
|
|
7646
|
+
q.callback(q.errors);
|
|
7647
|
+
} else {
|
|
7648
|
+
q.callback();
|
|
7649
|
+
}
|
|
7650
|
+
}
|
|
7651
|
+
});
|
|
7652
|
+
this.emit('loaded', loaded);
|
|
7653
|
+
this.queue = this.queue.filter(function (q) {
|
|
7654
|
+
return !q.done;
|
|
7655
|
+
});
|
|
7656
|
+
}
|
|
7657
|
+
}, {
|
|
7658
|
+
key: "read",
|
|
7659
|
+
value: function read(lng, ns, fcName) {
|
|
7660
|
+
var _this3 = this;
|
|
7661
|
+
var tried = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
7662
|
+
var wait = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : this.retryTimeout;
|
|
7663
|
+
var callback = arguments.length > 5 ? arguments[5] : undefined;
|
|
7664
|
+
if (!lng.length) return callback(null, {});
|
|
7665
|
+
if (this.readingCalls >= this.maxParallelReads) {
|
|
7666
|
+
this.waitingReads.push({
|
|
7667
|
+
lng: lng,
|
|
7668
|
+
ns: ns,
|
|
7669
|
+
fcName: fcName,
|
|
7670
|
+
tried: tried,
|
|
7671
|
+
wait: wait,
|
|
7672
|
+
callback: callback
|
|
7673
|
+
});
|
|
7674
|
+
return;
|
|
7675
|
+
}
|
|
7676
|
+
this.readingCalls++;
|
|
7677
|
+
var resolver = function resolver(err, data) {
|
|
7678
|
+
_this3.readingCalls--;
|
|
7679
|
+
if (_this3.waitingReads.length > 0) {
|
|
7680
|
+
var next = _this3.waitingReads.shift();
|
|
7681
|
+
_this3.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
|
|
7682
|
+
}
|
|
7683
|
+
if (err && data && tried < _this3.maxRetries) {
|
|
7684
|
+
setTimeout(function () {
|
|
7685
|
+
_this3.read.call(_this3, lng, ns, fcName, tried + 1, wait * 2, callback);
|
|
7686
|
+
}, wait);
|
|
7687
|
+
return;
|
|
7688
|
+
}
|
|
7689
|
+
callback(err, data);
|
|
7690
|
+
};
|
|
7691
|
+
var fc = this.backend[fcName].bind(this.backend);
|
|
7692
|
+
if (fc.length === 2) {
|
|
7693
|
+
try {
|
|
7694
|
+
var r = fc(lng, ns);
|
|
7695
|
+
if (r && typeof r.then === 'function') {
|
|
7696
|
+
r.then(function (data) {
|
|
7697
|
+
return resolver(null, data);
|
|
7698
|
+
})["catch"](resolver);
|
|
7699
|
+
} else {
|
|
7700
|
+
resolver(null, r);
|
|
7701
|
+
}
|
|
7702
|
+
} catch (err) {
|
|
7703
|
+
resolver(err);
|
|
7704
|
+
}
|
|
7705
|
+
return;
|
|
7706
|
+
}
|
|
7707
|
+
return fc(lng, ns, resolver);
|
|
7708
|
+
}
|
|
7709
|
+
}, {
|
|
7710
|
+
key: "prepareLoading",
|
|
7711
|
+
value: function prepareLoading(languages, namespaces) {
|
|
7712
|
+
var _this4 = this;
|
|
7713
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
7714
|
+
var callback = arguments.length > 3 ? arguments[3] : undefined;
|
|
7715
|
+
if (!this.backend) {
|
|
7716
|
+
this.logger.warn('No backend was added via i18next.use. Will not load resources.');
|
|
7717
|
+
return callback && callback();
|
|
7718
|
+
}
|
|
7719
|
+
if (typeof languages === 'string') languages = this.languageUtils.toResolveHierarchy(languages);
|
|
7720
|
+
if (typeof namespaces === 'string') namespaces = [namespaces];
|
|
7721
|
+
var toLoad = this.queueLoad(languages, namespaces, options, callback);
|
|
7722
|
+
if (!toLoad.toLoad.length) {
|
|
7723
|
+
if (!toLoad.pending.length) callback();
|
|
7724
|
+
return null;
|
|
7725
|
+
}
|
|
7726
|
+
toLoad.toLoad.forEach(function (name) {
|
|
7727
|
+
_this4.loadOne(name);
|
|
7728
|
+
});
|
|
7729
|
+
}
|
|
7730
|
+
}, {
|
|
7731
|
+
key: "load",
|
|
7732
|
+
value: function load(languages, namespaces, callback) {
|
|
7733
|
+
this.prepareLoading(languages, namespaces, {}, callback);
|
|
7734
|
+
}
|
|
7735
|
+
}, {
|
|
7736
|
+
key: "reload",
|
|
7737
|
+
value: function reload(languages, namespaces, callback) {
|
|
7738
|
+
this.prepareLoading(languages, namespaces, {
|
|
7739
|
+
reload: true
|
|
7740
|
+
}, callback);
|
|
7741
|
+
}
|
|
7742
|
+
}, {
|
|
7743
|
+
key: "loadOne",
|
|
7744
|
+
value: function loadOne(name) {
|
|
7745
|
+
var _this5 = this;
|
|
7746
|
+
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
7747
|
+
var s = name.split('|');
|
|
7748
|
+
var lng = s[0];
|
|
7749
|
+
var ns = s[1];
|
|
7750
|
+
this.read(lng, ns, 'read', undefined, undefined, function (err, data) {
|
|
7751
|
+
if (err) _this5.logger.warn(("").concat(prefix, "loading namespace ").concat(ns, " for language ").concat(lng, " failed"), err);
|
|
7752
|
+
if (!err && data) _this5.logger.log(("").concat(prefix, "loaded namespace ").concat(ns, " for language ").concat(lng), data);
|
|
7753
|
+
_this5.loaded(name, err, data);
|
|
7754
|
+
});
|
|
7755
|
+
}
|
|
7756
|
+
}, {
|
|
7757
|
+
key: "saveMissing",
|
|
7758
|
+
value: function saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
|
|
7759
|
+
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
|
|
7760
|
+
var clb = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : function () {};
|
|
7761
|
+
if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) {
|
|
7762
|
+
this.logger.warn(("did not save key \"").concat(key, "\" as the namespace \"").concat(namespace, "\" was not yet loaded"), 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');
|
|
7763
|
+
return;
|
|
7764
|
+
}
|
|
7765
|
+
if (key === undefined || key === null || key === '') return;
|
|
7766
|
+
if (this.backend && this.backend.create) {
|
|
7767
|
+
var opts = _objectSpread$1(_objectSpread$1({}, options), {}, {
|
|
7768
|
+
isUpdate: isUpdate
|
|
7769
|
+
});
|
|
7770
|
+
var fc = this.backend.create.bind(this.backend);
|
|
7771
|
+
if (fc.length < 6) {
|
|
7772
|
+
try {
|
|
7773
|
+
var r;
|
|
7774
|
+
if (fc.length === 5) {
|
|
7775
|
+
r = fc(languages, namespace, key, fallbackValue, opts);
|
|
7776
|
+
} else {
|
|
7777
|
+
r = fc(languages, namespace, key, fallbackValue);
|
|
7778
|
+
}
|
|
7779
|
+
if (r && typeof r.then === 'function') {
|
|
7780
|
+
r.then(function (data) {
|
|
7781
|
+
return clb(null, data);
|
|
7782
|
+
})["catch"](clb);
|
|
7783
|
+
} else {
|
|
7784
|
+
clb(null, r);
|
|
7785
|
+
}
|
|
7786
|
+
} catch (err) {
|
|
7787
|
+
clb(err);
|
|
7788
|
+
}
|
|
7789
|
+
} else {
|
|
7790
|
+
fc(languages, namespace, key, fallbackValue, clb, opts);
|
|
7791
|
+
}
|
|
7792
|
+
}
|
|
7793
|
+
if (!languages || !languages[0]) return;
|
|
7794
|
+
this.store.addResource(languages[0], namespace, key, fallbackValue);
|
|
7795
|
+
}
|
|
7796
|
+
}]);
|
|
7797
|
+
return Connector;
|
|
7798
|
+
})(EventEmitter);
|
|
7799
|
+
function get$1() {
|
|
7800
|
+
return {
|
|
7801
|
+
debug: false,
|
|
7802
|
+
initImmediate: true,
|
|
7803
|
+
ns: ['translation'],
|
|
7804
|
+
defaultNS: ['translation'],
|
|
7805
|
+
fallbackLng: ['dev'],
|
|
7806
|
+
fallbackNS: false,
|
|
7807
|
+
supportedLngs: false,
|
|
7808
|
+
nonExplicitSupportedLngs: false,
|
|
7809
|
+
load: 'all',
|
|
7810
|
+
preload: false,
|
|
7811
|
+
simplifyPluralSuffix: true,
|
|
7812
|
+
keySeparator: '.',
|
|
7813
|
+
nsSeparator: ':',
|
|
7814
|
+
pluralSeparator: '_',
|
|
7815
|
+
contextSeparator: '_',
|
|
7816
|
+
partialBundledLanguages: false,
|
|
7817
|
+
saveMissing: false,
|
|
7818
|
+
updateMissing: false,
|
|
7819
|
+
saveMissingTo: 'fallback',
|
|
7820
|
+
saveMissingPlurals: true,
|
|
7821
|
+
missingKeyHandler: false,
|
|
7822
|
+
missingInterpolationHandler: false,
|
|
7823
|
+
postProcess: false,
|
|
7824
|
+
postProcessPassResolved: false,
|
|
7825
|
+
returnNull: true,
|
|
7826
|
+
returnEmptyString: true,
|
|
7827
|
+
returnObjects: false,
|
|
7828
|
+
joinArrays: false,
|
|
7829
|
+
returnedObjectHandler: false,
|
|
7830
|
+
parseMissingKeyHandler: false,
|
|
7831
|
+
appendNamespaceToMissingKey: false,
|
|
7832
|
+
appendNamespaceToCIMode: false,
|
|
7833
|
+
overloadTranslationOptionHandler: function handle(args) {
|
|
7834
|
+
var ret = {};
|
|
7835
|
+
if (_typeof__default["default"](args[1]) === 'object') ret = args[1];
|
|
7836
|
+
if (typeof args[1] === 'string') ret.defaultValue = args[1];
|
|
7837
|
+
if (typeof args[2] === 'string') ret.tDescription = args[2];
|
|
7838
|
+
if (_typeof__default["default"](args[2]) === 'object' || _typeof__default["default"](args[3]) === 'object') {
|
|
7839
|
+
var options = args[3] || args[2];
|
|
7840
|
+
Object.keys(options).forEach(function (key) {
|
|
7841
|
+
ret[key] = options[key];
|
|
7842
|
+
});
|
|
7843
|
+
}
|
|
7844
|
+
return ret;
|
|
7845
|
+
},
|
|
7846
|
+
interpolation: {
|
|
7847
|
+
escapeValue: true,
|
|
7848
|
+
format: function format(value, _format, lng, options) {
|
|
7849
|
+
return value;
|
|
7850
|
+
},
|
|
7851
|
+
prefix: '{{',
|
|
7852
|
+
suffix: '}}',
|
|
7853
|
+
formatSeparator: ',',
|
|
7854
|
+
unescapePrefix: '-',
|
|
7855
|
+
nestingPrefix: '$t(',
|
|
7856
|
+
nestingSuffix: ')',
|
|
7857
|
+
nestingOptionsSeparator: ',',
|
|
7858
|
+
maxReplaces: 1000,
|
|
7859
|
+
skipOnVariables: true
|
|
7860
|
+
}
|
|
7861
|
+
};
|
|
7862
|
+
}
|
|
7863
|
+
function transformOptions(options) {
|
|
7864
|
+
if (typeof options.ns === 'string') options.ns = [options.ns];
|
|
7865
|
+
if (typeof options.fallbackLng === 'string') options.fallbackLng = [options.fallbackLng];
|
|
7866
|
+
if (typeof options.fallbackNS === 'string') options.fallbackNS = [options.fallbackNS];
|
|
7867
|
+
if (options.supportedLngs && options.supportedLngs.indexOf('cimode') < 0) {
|
|
7868
|
+
options.supportedLngs = options.supportedLngs.concat(['cimode']);
|
|
7869
|
+
}
|
|
7870
|
+
return options;
|
|
7871
|
+
}
|
|
7872
|
+
function ownKeys(object, enumerableOnly) {
|
|
7873
|
+
var keys = Object.keys(object);
|
|
7874
|
+
if (Object.getOwnPropertySymbols) {
|
|
7875
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7876
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
7877
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
7878
|
+
})), keys.push.apply(keys, symbols));
|
|
7879
|
+
}
|
|
7880
|
+
return keys;
|
|
7881
|
+
}
|
|
7882
|
+
function _objectSpread(target) {
|
|
7883
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7884
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
7885
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
7886
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
7887
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
7888
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7889
|
+
});
|
|
7890
|
+
}
|
|
7891
|
+
return target;
|
|
7892
|
+
}
|
|
7893
|
+
function _createSuper(Derived) {
|
|
7894
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
7895
|
+
return function _createSuperInternal() {
|
|
7896
|
+
var Super = _getPrototypeOf__default["default"](Derived), result;
|
|
7897
|
+
if (hasNativeReflectConstruct) {
|
|
7898
|
+
var NewTarget = _getPrototypeOf__default["default"](this).constructor;
|
|
7899
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
7900
|
+
} else {
|
|
7901
|
+
result = Super.apply(this, arguments);
|
|
7902
|
+
}
|
|
7903
|
+
return _possibleConstructorReturn__default["default"](this, result);
|
|
7904
|
+
};
|
|
7905
|
+
}
|
|
7906
|
+
function _isNativeReflectConstruct() {
|
|
7907
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
7908
|
+
if (Reflect.construct.sham) return false;
|
|
7909
|
+
if (typeof Proxy === "function") return true;
|
|
7910
|
+
try {
|
|
7911
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
7912
|
+
return true;
|
|
7913
|
+
} catch (e) {
|
|
7914
|
+
return false;
|
|
7915
|
+
}
|
|
7916
|
+
}
|
|
7917
|
+
function noop$1() {}
|
|
7918
|
+
function bindMemberFunctions(inst) {
|
|
7919
|
+
var mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
|
|
7920
|
+
mems.forEach(function (mem) {
|
|
7921
|
+
if (typeof inst[mem] === 'function') {
|
|
7922
|
+
inst[mem] = inst[mem].bind(inst);
|
|
7923
|
+
}
|
|
7924
|
+
});
|
|
7925
|
+
}
|
|
7926
|
+
var I18n = (function (_EventEmitter) {
|
|
7927
|
+
_inherits__default["default"](I18n, _EventEmitter);
|
|
7928
|
+
var _super = _createSuper(I18n);
|
|
7929
|
+
function I18n() {
|
|
7930
|
+
var _this;
|
|
7931
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7932
|
+
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
7933
|
+
_classCallCheck__default["default"](this, I18n);
|
|
7934
|
+
_this = _super.call(this);
|
|
7935
|
+
if (isIE10) {
|
|
7936
|
+
EventEmitter.call(_assertThisInitialized__default["default"](_this));
|
|
7937
|
+
}
|
|
7938
|
+
_this.options = transformOptions(options);
|
|
7939
|
+
_this.services = {};
|
|
7940
|
+
_this.logger = baseLogger;
|
|
7941
|
+
_this.modules = {
|
|
7942
|
+
external: []
|
|
7943
|
+
};
|
|
7944
|
+
bindMemberFunctions(_assertThisInitialized__default["default"](_this));
|
|
7945
|
+
if (callback && !_this.isInitialized && !options.isClone) {
|
|
7946
|
+
if (!_this.options.initImmediate) {
|
|
7947
|
+
_this.init(options, callback);
|
|
7948
|
+
return _possibleConstructorReturn__default["default"](_this, _assertThisInitialized__default["default"](_this));
|
|
7949
|
+
}
|
|
7950
|
+
setTimeout(function () {
|
|
7951
|
+
_this.init(options, callback);
|
|
7952
|
+
}, 0);
|
|
7953
|
+
}
|
|
7954
|
+
return _this;
|
|
7955
|
+
}
|
|
7956
|
+
_createClass__default["default"](I18n, [{
|
|
7957
|
+
key: "init",
|
|
7958
|
+
value: function init() {
|
|
7959
|
+
var _this2 = this;
|
|
7960
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7961
|
+
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
7962
|
+
if (typeof options === 'function') {
|
|
7963
|
+
callback = options;
|
|
7964
|
+
options = {};
|
|
7965
|
+
}
|
|
7966
|
+
if (!options.defaultNS && options.defaultNS !== false && options.ns) {
|
|
7967
|
+
if (typeof options.ns === 'string') {
|
|
7968
|
+
options.defaultNS = options.ns;
|
|
7969
|
+
} else if (options.ns.indexOf('translation') < 0) {
|
|
7970
|
+
options.defaultNS = options.ns[0];
|
|
7971
|
+
}
|
|
7972
|
+
}
|
|
7973
|
+
var defOpts = get$1();
|
|
7974
|
+
this.options = _objectSpread(_objectSpread(_objectSpread({}, defOpts), this.options), transformOptions(options));
|
|
7975
|
+
if (this.options.compatibilityAPI !== 'v1') {
|
|
7976
|
+
this.options.interpolation = _objectSpread(_objectSpread({}, defOpts.interpolation), this.options.interpolation);
|
|
7977
|
+
}
|
|
7978
|
+
if (options.keySeparator !== undefined) {
|
|
7979
|
+
this.options.userDefinedKeySeparator = options.keySeparator;
|
|
7980
|
+
}
|
|
7981
|
+
if (options.nsSeparator !== undefined) {
|
|
7982
|
+
this.options.userDefinedNsSeparator = options.nsSeparator;
|
|
7983
|
+
}
|
|
7984
|
+
function createClassOnDemand(ClassOrObject) {
|
|
7985
|
+
if (!ClassOrObject) return null;
|
|
7986
|
+
if (typeof ClassOrObject === 'function') return new ClassOrObject();
|
|
7987
|
+
return ClassOrObject;
|
|
7988
|
+
}
|
|
7989
|
+
if (!this.options.isClone) {
|
|
7990
|
+
if (this.modules.logger) {
|
|
7991
|
+
baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
|
|
7992
|
+
} else {
|
|
7993
|
+
baseLogger.init(null, this.options);
|
|
7994
|
+
}
|
|
7995
|
+
var formatter;
|
|
7996
|
+
if (this.modules.formatter) {
|
|
7997
|
+
formatter = this.modules.formatter;
|
|
7998
|
+
} else if (typeof Intl !== 'undefined') {
|
|
7999
|
+
formatter = Formatter;
|
|
8000
|
+
}
|
|
8001
|
+
var lu = new LanguageUtil(this.options);
|
|
8002
|
+
this.store = new ResourceStore(this.options.resources, this.options);
|
|
8003
|
+
var s = this.services;
|
|
8004
|
+
s.logger = baseLogger;
|
|
8005
|
+
s.resourceStore = this.store;
|
|
8006
|
+
s.languageUtils = lu;
|
|
8007
|
+
s.pluralResolver = new PluralResolver(lu, {
|
|
8008
|
+
prepend: this.options.pluralSeparator,
|
|
8009
|
+
compatibilityJSON: this.options.compatibilityJSON,
|
|
8010
|
+
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
8011
|
+
});
|
|
8012
|
+
if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
|
|
8013
|
+
s.formatter = createClassOnDemand(formatter);
|
|
8014
|
+
s.formatter.init(s, this.options);
|
|
8015
|
+
this.options.interpolation.format = s.formatter.format.bind(s.formatter);
|
|
8016
|
+
}
|
|
8017
|
+
s.interpolator = new Interpolator(this.options);
|
|
8018
|
+
s.utils = {
|
|
8019
|
+
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
8020
|
+
};
|
|
8021
|
+
s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
|
|
8022
|
+
s.backendConnector.on('*', function (event) {
|
|
8023
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
8024
|
+
args[_key - 1] = arguments[_key];
|
|
8025
|
+
}
|
|
8026
|
+
_this2.emit.apply(_this2, [event].concat(args));
|
|
8027
|
+
});
|
|
8028
|
+
if (this.modules.languageDetector) {
|
|
8029
|
+
s.languageDetector = createClassOnDemand(this.modules.languageDetector);
|
|
8030
|
+
if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);
|
|
8031
|
+
}
|
|
8032
|
+
if (this.modules.i18nFormat) {
|
|
8033
|
+
s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
|
|
8034
|
+
if (s.i18nFormat.init) s.i18nFormat.init(this);
|
|
8035
|
+
}
|
|
8036
|
+
this.translator = new Translator$1(this.services, this.options);
|
|
8037
|
+
this.translator.on('*', function (event) {
|
|
8038
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
8039
|
+
args[_key2 - 1] = arguments[_key2];
|
|
8040
|
+
}
|
|
8041
|
+
_this2.emit.apply(_this2, [event].concat(args));
|
|
8042
|
+
});
|
|
8043
|
+
this.modules.external.forEach(function (m) {
|
|
8044
|
+
if (m.init) m.init(_this2);
|
|
8045
|
+
});
|
|
8046
|
+
}
|
|
8047
|
+
this.format = this.options.interpolation.format;
|
|
8048
|
+
if (!callback) callback = noop$1;
|
|
8049
|
+
if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
8050
|
+
var codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
8051
|
+
if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];
|
|
8052
|
+
}
|
|
8053
|
+
if (!this.services.languageDetector && !this.options.lng) {
|
|
8054
|
+
this.logger.warn('init: no languageDetector is used and no lng is defined');
|
|
8055
|
+
}
|
|
8056
|
+
var storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];
|
|
8057
|
+
storeApi.forEach(function (fcName) {
|
|
8058
|
+
_this2[fcName] = function () {
|
|
8059
|
+
var _this2$store;
|
|
8060
|
+
return (_this2$store = _this2.store)[fcName].apply(_this2$store, arguments);
|
|
8061
|
+
};
|
|
8062
|
+
});
|
|
8063
|
+
var storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];
|
|
8064
|
+
storeApiChained.forEach(function (fcName) {
|
|
8065
|
+
_this2[fcName] = function () {
|
|
8066
|
+
var _this2$store2;
|
|
8067
|
+
(_this2$store2 = _this2.store)[fcName].apply(_this2$store2, arguments);
|
|
8068
|
+
return _this2;
|
|
8069
|
+
};
|
|
8070
|
+
});
|
|
8071
|
+
var deferred = defer();
|
|
8072
|
+
var load = function load() {
|
|
8073
|
+
var finish = function finish(err, t) {
|
|
8074
|
+
if (_this2.isInitialized && !_this2.initializedStoreOnce) _this2.logger.warn('init: i18next is already initialized. You should call init just once!');
|
|
8075
|
+
_this2.isInitialized = true;
|
|
8076
|
+
if (!_this2.options.isClone) _this2.logger.log('initialized', _this2.options);
|
|
8077
|
+
_this2.emit('initialized', _this2.options);
|
|
8078
|
+
deferred.resolve(t);
|
|
8079
|
+
callback(err, t);
|
|
8080
|
+
};
|
|
8081
|
+
if (_this2.languages && _this2.options.compatibilityAPI !== 'v1' && !_this2.isInitialized) return finish(null, _this2.t.bind(_this2));
|
|
8082
|
+
_this2.changeLanguage(_this2.options.lng, finish);
|
|
8083
|
+
};
|
|
8084
|
+
if (this.options.resources || !this.options.initImmediate) {
|
|
8085
|
+
load();
|
|
8086
|
+
} else {
|
|
8087
|
+
setTimeout(load, 0);
|
|
8088
|
+
}
|
|
8089
|
+
return deferred;
|
|
8090
|
+
}
|
|
8091
|
+
}, {
|
|
8092
|
+
key: "loadResources",
|
|
8093
|
+
value: function loadResources(language) {
|
|
8094
|
+
var _this3 = this;
|
|
8095
|
+
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$1;
|
|
8096
|
+
var usedCallback = callback;
|
|
8097
|
+
var usedLng = typeof language === 'string' ? language : this.language;
|
|
8098
|
+
if (typeof language === 'function') usedCallback = language;
|
|
8099
|
+
if (!this.options.resources || this.options.partialBundledLanguages) {
|
|
8100
|
+
if (usedLng && usedLng.toLowerCase() === 'cimode') return usedCallback();
|
|
8101
|
+
var toLoad = [];
|
|
8102
|
+
var append = function append(lng) {
|
|
8103
|
+
if (!lng) return;
|
|
8104
|
+
var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);
|
|
8105
|
+
lngs.forEach(function (l) {
|
|
8106
|
+
if (toLoad.indexOf(l) < 0) toLoad.push(l);
|
|
8107
|
+
});
|
|
8108
|
+
};
|
|
8109
|
+
if (!usedLng) {
|
|
8110
|
+
var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
8111
|
+
fallbacks.forEach(function (l) {
|
|
8112
|
+
return append(l);
|
|
8113
|
+
});
|
|
8114
|
+
} else {
|
|
8115
|
+
append(usedLng);
|
|
8116
|
+
}
|
|
8117
|
+
if (this.options.preload) {
|
|
8118
|
+
this.options.preload.forEach(function (l) {
|
|
8119
|
+
return append(l);
|
|
8120
|
+
});
|
|
8121
|
+
}
|
|
8122
|
+
this.services.backendConnector.load(toLoad, this.options.ns, function (e) {
|
|
8123
|
+
if (!e && !_this3.resolvedLanguage && _this3.language) _this3.setResolvedLanguage(_this3.language);
|
|
8124
|
+
usedCallback(e);
|
|
8125
|
+
});
|
|
8126
|
+
} else {
|
|
8127
|
+
usedCallback(null);
|
|
8128
|
+
}
|
|
8129
|
+
}
|
|
8130
|
+
}, {
|
|
8131
|
+
key: "reloadResources",
|
|
8132
|
+
value: function reloadResources(lngs, ns, callback) {
|
|
8133
|
+
var deferred = defer();
|
|
8134
|
+
if (!lngs) lngs = this.languages;
|
|
8135
|
+
if (!ns) ns = this.options.ns;
|
|
8136
|
+
if (!callback) callback = noop$1;
|
|
8137
|
+
this.services.backendConnector.reload(lngs, ns, function (err) {
|
|
8138
|
+
deferred.resolve();
|
|
8139
|
+
callback(err);
|
|
8140
|
+
});
|
|
8141
|
+
return deferred;
|
|
8142
|
+
}
|
|
8143
|
+
}, {
|
|
8144
|
+
key: "use",
|
|
8145
|
+
value: function use(module) {
|
|
8146
|
+
if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');
|
|
8147
|
+
if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');
|
|
8148
|
+
if (module.type === 'backend') {
|
|
8149
|
+
this.modules.backend = module;
|
|
8150
|
+
}
|
|
8151
|
+
if (module.type === 'logger' || module.log && module.warn && module.error) {
|
|
8152
|
+
this.modules.logger = module;
|
|
8153
|
+
}
|
|
8154
|
+
if (module.type === 'languageDetector') {
|
|
8155
|
+
this.modules.languageDetector = module;
|
|
8156
|
+
}
|
|
8157
|
+
if (module.type === 'i18nFormat') {
|
|
8158
|
+
this.modules.i18nFormat = module;
|
|
8159
|
+
}
|
|
8160
|
+
if (module.type === 'postProcessor') {
|
|
8161
|
+
postProcessor.addPostProcessor(module);
|
|
8162
|
+
}
|
|
8163
|
+
if (module.type === 'formatter') {
|
|
8164
|
+
this.modules.formatter = module;
|
|
8165
|
+
}
|
|
8166
|
+
if (module.type === '3rdParty') {
|
|
8167
|
+
this.modules.external.push(module);
|
|
8168
|
+
}
|
|
8169
|
+
return this;
|
|
8170
|
+
}
|
|
8171
|
+
}, {
|
|
8172
|
+
key: "setResolvedLanguage",
|
|
8173
|
+
value: function setResolvedLanguage(l) {
|
|
8174
|
+
if (!l || !this.languages) return;
|
|
8175
|
+
if (['cimode', 'dev'].indexOf(l) > -1) return;
|
|
8176
|
+
for (var li = 0; li < this.languages.length; li++) {
|
|
8177
|
+
var lngInLngs = this.languages[li];
|
|
8178
|
+
if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;
|
|
8179
|
+
if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
|
|
8180
|
+
this.resolvedLanguage = lngInLngs;
|
|
8181
|
+
break;
|
|
8182
|
+
}
|
|
8183
|
+
}
|
|
8184
|
+
}
|
|
8185
|
+
}, {
|
|
8186
|
+
key: "changeLanguage",
|
|
8187
|
+
value: function changeLanguage(lng, callback) {
|
|
8188
|
+
var _this4 = this;
|
|
8189
|
+
this.isLanguageChangingTo = lng;
|
|
8190
|
+
var deferred = defer();
|
|
8191
|
+
this.emit('languageChanging', lng);
|
|
8192
|
+
var setLngProps = function setLngProps(l) {
|
|
8193
|
+
_this4.language = l;
|
|
8194
|
+
_this4.languages = _this4.services.languageUtils.toResolveHierarchy(l);
|
|
8195
|
+
_this4.resolvedLanguage = undefined;
|
|
8196
|
+
_this4.setResolvedLanguage(l);
|
|
8197
|
+
};
|
|
8198
|
+
var done = function done(err, l) {
|
|
8199
|
+
if (l) {
|
|
8200
|
+
setLngProps(l);
|
|
8201
|
+
_this4.translator.changeLanguage(l);
|
|
8202
|
+
_this4.isLanguageChangingTo = undefined;
|
|
8203
|
+
_this4.emit('languageChanged', l);
|
|
8204
|
+
_this4.logger.log('languageChanged', l);
|
|
8205
|
+
} else {
|
|
8206
|
+
_this4.isLanguageChangingTo = undefined;
|
|
8207
|
+
}
|
|
8208
|
+
deferred.resolve(function () {
|
|
8209
|
+
return _this4.t.apply(_this4, arguments);
|
|
8210
|
+
});
|
|
8211
|
+
if (callback) callback(err, function () {
|
|
8212
|
+
return _this4.t.apply(_this4, arguments);
|
|
8213
|
+
});
|
|
8214
|
+
};
|
|
8215
|
+
var setLng = function setLng(lngs) {
|
|
8216
|
+
if (!lng && !lngs && _this4.services.languageDetector) lngs = [];
|
|
8217
|
+
var l = typeof lngs === 'string' ? lngs : _this4.services.languageUtils.getBestMatchFromCodes(lngs);
|
|
8218
|
+
if (l) {
|
|
8219
|
+
if (!_this4.language) {
|
|
8220
|
+
setLngProps(l);
|
|
8221
|
+
}
|
|
8222
|
+
if (!_this4.translator.language) _this4.translator.changeLanguage(l);
|
|
8223
|
+
if (_this4.services.languageDetector && _this4.services.languageDetector.cacheUserLanguage) _this4.services.languageDetector.cacheUserLanguage(l);
|
|
8224
|
+
}
|
|
8225
|
+
_this4.loadResources(l, function (err) {
|
|
8226
|
+
done(err, l);
|
|
8227
|
+
});
|
|
8228
|
+
};
|
|
8229
|
+
if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
|
|
8230
|
+
setLng(this.services.languageDetector.detect());
|
|
8231
|
+
} else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
|
|
8232
|
+
if (this.services.languageDetector.detect.length === 0) {
|
|
8233
|
+
this.services.languageDetector.detect().then(setLng);
|
|
8234
|
+
} else {
|
|
8235
|
+
this.services.languageDetector.detect(setLng);
|
|
8236
|
+
}
|
|
8237
|
+
} else {
|
|
8238
|
+
setLng(lng);
|
|
8239
|
+
}
|
|
8240
|
+
return deferred;
|
|
8241
|
+
}
|
|
8242
|
+
}, {
|
|
8243
|
+
key: "getFixedT",
|
|
8244
|
+
value: function getFixedT(lng, ns, keyPrefix) {
|
|
8245
|
+
var _this5 = this;
|
|
8246
|
+
var fixedT = function fixedT(key, opts) {
|
|
8247
|
+
var options;
|
|
8248
|
+
if (_typeof__default["default"](opts) !== 'object') {
|
|
8249
|
+
for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
|
8250
|
+
rest[_key3 - 2] = arguments[_key3];
|
|
8251
|
+
}
|
|
8252
|
+
options = _this5.options.overloadTranslationOptionHandler([key, opts].concat(rest));
|
|
8253
|
+
} else {
|
|
8254
|
+
options = _objectSpread({}, opts);
|
|
8255
|
+
}
|
|
8256
|
+
options.lng = options.lng || fixedT.lng;
|
|
8257
|
+
options.lngs = options.lngs || fixedT.lngs;
|
|
8258
|
+
options.ns = options.ns || fixedT.ns;
|
|
8259
|
+
options.keyPrefix = options.keyPrefix || keyPrefix || fixedT.keyPrefix;
|
|
8260
|
+
var keySeparator = _this5.options.keySeparator || '.';
|
|
8261
|
+
var resultKey;
|
|
8262
|
+
if (options.keyPrefix && Array.isArray(key)) {
|
|
8263
|
+
resultKey = key.map(function (k) {
|
|
8264
|
+
return ("").concat(options.keyPrefix).concat(keySeparator).concat(k);
|
|
8265
|
+
});
|
|
8266
|
+
} else {
|
|
8267
|
+
resultKey = options.keyPrefix ? ("").concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
|
|
8268
|
+
}
|
|
8269
|
+
return _this5.t(resultKey, options);
|
|
8270
|
+
};
|
|
8271
|
+
if (typeof lng === 'string') {
|
|
8272
|
+
fixedT.lng = lng;
|
|
8273
|
+
} else {
|
|
8274
|
+
fixedT.lngs = lng;
|
|
8275
|
+
}
|
|
8276
|
+
fixedT.ns = ns;
|
|
8277
|
+
fixedT.keyPrefix = keyPrefix;
|
|
8278
|
+
return fixedT;
|
|
8279
|
+
}
|
|
8280
|
+
}, {
|
|
8281
|
+
key: "t",
|
|
8282
|
+
value: function t() {
|
|
8283
|
+
var _this$translator;
|
|
8284
|
+
return this.translator && (_this$translator = this.translator).translate.apply(_this$translator, arguments);
|
|
8285
|
+
}
|
|
8286
|
+
}, {
|
|
8287
|
+
key: "exists",
|
|
8288
|
+
value: function exists() {
|
|
8289
|
+
var _this$translator2;
|
|
8290
|
+
return this.translator && (_this$translator2 = this.translator).exists.apply(_this$translator2, arguments);
|
|
8291
|
+
}
|
|
8292
|
+
}, {
|
|
8293
|
+
key: "setDefaultNamespace",
|
|
8294
|
+
value: function setDefaultNamespace(ns) {
|
|
8295
|
+
this.options.defaultNS = ns;
|
|
8296
|
+
}
|
|
8297
|
+
}, {
|
|
8298
|
+
key: "hasLoadedNamespace",
|
|
8299
|
+
value: function hasLoadedNamespace(ns) {
|
|
8300
|
+
var _this6 = this;
|
|
8301
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8302
|
+
if (!this.isInitialized) {
|
|
8303
|
+
this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);
|
|
8304
|
+
return false;
|
|
8305
|
+
}
|
|
8306
|
+
if (!this.languages || !this.languages.length) {
|
|
8307
|
+
this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);
|
|
8308
|
+
return false;
|
|
8309
|
+
}
|
|
8310
|
+
var lng = options.lng || this.resolvedLanguage || this.languages[0];
|
|
8311
|
+
var fallbackLng = this.options ? this.options.fallbackLng : false;
|
|
8312
|
+
var lastLng = this.languages[this.languages.length - 1];
|
|
8313
|
+
if (lng.toLowerCase() === 'cimode') return true;
|
|
8314
|
+
var loadNotPending = function loadNotPending(l, n) {
|
|
8315
|
+
var loadState = _this6.services.backendConnector.state[("").concat(l, "|").concat(n)];
|
|
8316
|
+
return loadState === -1 || loadState === 2;
|
|
8317
|
+
};
|
|
8318
|
+
if (options.precheck) {
|
|
8319
|
+
var preResult = options.precheck(this, loadNotPending);
|
|
8320
|
+
if (preResult !== undefined) return preResult;
|
|
8321
|
+
}
|
|
8322
|
+
if (this.hasResourceBundle(lng, ns)) return true;
|
|
8323
|
+
if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;
|
|
8324
|
+
if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
|
|
8325
|
+
return false;
|
|
8326
|
+
}
|
|
8327
|
+
}, {
|
|
8328
|
+
key: "loadNamespaces",
|
|
8329
|
+
value: function loadNamespaces(ns, callback) {
|
|
8330
|
+
var _this7 = this;
|
|
8331
|
+
var deferred = defer();
|
|
8332
|
+
if (!this.options.ns) {
|
|
8333
|
+
if (callback) callback();
|
|
8334
|
+
return Promise.resolve();
|
|
8335
|
+
}
|
|
8336
|
+
if (typeof ns === 'string') ns = [ns];
|
|
8337
|
+
ns.forEach(function (n) {
|
|
8338
|
+
if (_this7.options.ns.indexOf(n) < 0) _this7.options.ns.push(n);
|
|
8339
|
+
});
|
|
8340
|
+
this.loadResources(function (err) {
|
|
8341
|
+
deferred.resolve();
|
|
8342
|
+
if (callback) callback(err);
|
|
8343
|
+
});
|
|
8344
|
+
return deferred;
|
|
8345
|
+
}
|
|
8346
|
+
}, {
|
|
8347
|
+
key: "loadLanguages",
|
|
8348
|
+
value: function loadLanguages(lngs, callback) {
|
|
8349
|
+
var deferred = defer();
|
|
8350
|
+
if (typeof lngs === 'string') lngs = [lngs];
|
|
8351
|
+
var preloaded = this.options.preload || [];
|
|
8352
|
+
var newLngs = lngs.filter(function (lng) {
|
|
8353
|
+
return preloaded.indexOf(lng) < 0;
|
|
8354
|
+
});
|
|
8355
|
+
if (!newLngs.length) {
|
|
8356
|
+
if (callback) callback();
|
|
8357
|
+
return Promise.resolve();
|
|
8358
|
+
}
|
|
8359
|
+
this.options.preload = preloaded.concat(newLngs);
|
|
8360
|
+
this.loadResources(function (err) {
|
|
8361
|
+
deferred.resolve();
|
|
8362
|
+
if (callback) callback(err);
|
|
8363
|
+
});
|
|
8364
|
+
return deferred;
|
|
8365
|
+
}
|
|
8366
|
+
}, {
|
|
8367
|
+
key: "dir",
|
|
8368
|
+
value: function dir(lng) {
|
|
8369
|
+
if (!lng) lng = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language);
|
|
8370
|
+
if (!lng) return 'rtl';
|
|
8371
|
+
var rtlLngs = ['ar', 'shu', 'sqr', 'ssh', 'xaa', 'yhd', 'yud', 'aao', 'abh', 'abv', 'acm', 'acq', 'acw', 'acx', 'acy', 'adf', 'ads', 'aeb', 'aec', 'afb', 'ajp', 'apc', 'apd', 'arb', 'arq', 'ars', 'ary', 'arz', 'auz', 'avl', 'ayh', 'ayl', 'ayn', 'ayp', 'bbz', 'pga', 'he', 'iw', 'ps', 'pbt', 'pbu', 'pst', 'prp', 'prd', 'ug', 'ur', 'ydd', 'yds', 'yih', 'ji', 'yi', 'hbo', 'men', 'xmn', 'fa', 'jpr', 'peo', 'pes', 'prs', 'dv', 'sam', 'ckb'];
|
|
8372
|
+
var languageUtils = this.services && this.services.languageUtils || new LanguageUtil(get$1());
|
|
8373
|
+
return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
|
|
8374
|
+
}
|
|
8375
|
+
}, {
|
|
8376
|
+
key: "cloneInstance",
|
|
8377
|
+
value: function cloneInstance() {
|
|
8378
|
+
var _this8 = this;
|
|
8379
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8380
|
+
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$1;
|
|
8381
|
+
var mergedOptions = _objectSpread(_objectSpread(_objectSpread({}, this.options), options), {
|
|
8382
|
+
isClone: true
|
|
8383
|
+
});
|
|
8384
|
+
var clone = new I18n(mergedOptions);
|
|
8385
|
+
if (options.debug !== undefined || options.prefix !== undefined) {
|
|
8386
|
+
clone.logger = clone.logger.clone(options);
|
|
8387
|
+
}
|
|
8388
|
+
var membersToCopy = ['store', 'services', 'language'];
|
|
8389
|
+
membersToCopy.forEach(function (m) {
|
|
8390
|
+
clone[m] = _this8[m];
|
|
8391
|
+
});
|
|
8392
|
+
clone.services = _objectSpread({}, this.services);
|
|
8393
|
+
clone.services.utils = {
|
|
8394
|
+
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
8395
|
+
};
|
|
8396
|
+
clone.translator = new Translator$1(clone.services, clone.options);
|
|
8397
|
+
clone.translator.on('*', function (event) {
|
|
8398
|
+
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
8399
|
+
args[_key4 - 1] = arguments[_key4];
|
|
8400
|
+
}
|
|
8401
|
+
clone.emit.apply(clone, [event].concat(args));
|
|
8402
|
+
});
|
|
8403
|
+
clone.init(mergedOptions, callback);
|
|
8404
|
+
clone.translator.options = clone.options;
|
|
8405
|
+
clone.translator.backendConnector.services.utils = {
|
|
8406
|
+
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
8407
|
+
};
|
|
8408
|
+
return clone;
|
|
8409
|
+
}
|
|
8410
|
+
}, {
|
|
8411
|
+
key: "toJSON",
|
|
8412
|
+
value: function toJSON() {
|
|
8413
|
+
return {
|
|
8414
|
+
options: this.options,
|
|
8415
|
+
store: this.store,
|
|
8416
|
+
language: this.language,
|
|
8417
|
+
languages: this.languages,
|
|
8418
|
+
resolvedLanguage: this.resolvedLanguage
|
|
8419
|
+
};
|
|
8420
|
+
}
|
|
8421
|
+
}]);
|
|
8422
|
+
return I18n;
|
|
8423
|
+
})(EventEmitter);
|
|
8424
|
+
_defineProperty__default["default"](I18n, "createInstance", function () {
|
|
8425
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8426
|
+
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
8427
|
+
return new I18n(options, callback);
|
|
8428
|
+
});
|
|
8429
|
+
var instance = I18n.createInstance();
|
|
8430
|
+
instance.createInstance = I18n.createInstance;
|
|
8431
|
+
var i18next = instance;
|
|
8432
|
+
var en = {};
|
|
8433
|
+
(function (exports) {
|
|
8434
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8435
|
+
value: true
|
|
8436
|
+
});
|
|
8437
|
+
exports["default"] = void 0;
|
|
8438
|
+
var _default = {
|
|
8439
|
+
translation: {
|
|
8440
|
+
categorize: {
|
|
8441
|
+
limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
|
|
8442
|
+
maxChoicesPerCategoryRestriction: 'To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s].'
|
|
8443
|
+
},
|
|
8444
|
+
ebsr: {
|
|
8445
|
+
part: 'Part {{index}}'
|
|
8446
|
+
},
|
|
8447
|
+
numberLine: {
|
|
8448
|
+
addElementLimit_one: 'You can only add {{count}} element',
|
|
8449
|
+
addElementLimit_other: 'You can only add {{count}} elements',
|
|
8450
|
+
clearAll: 'Clear all'
|
|
8451
|
+
},
|
|
8452
|
+
imageClozeAssociation: {
|
|
8453
|
+
reachedLimit_one: 'You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.',
|
|
8454
|
+
reachedLimit_other: 'You’ve reached the limit of {{count}} responses per area. To add another response, one must first be removed.'
|
|
8455
|
+
},
|
|
8456
|
+
drawingResponse: {
|
|
8457
|
+
fillColor: 'Fill color',
|
|
8458
|
+
outlineColor: 'Outline color',
|
|
8459
|
+
noFill: 'No fill',
|
|
8460
|
+
lightblue: 'Light blue',
|
|
8461
|
+
lightyellow: 'Light yellow',
|
|
8462
|
+
red: 'Red',
|
|
8463
|
+
orange: 'Orange',
|
|
8464
|
+
yellow: 'Yellow',
|
|
8465
|
+
violet: 'Violet',
|
|
8466
|
+
blue: 'Blue',
|
|
8467
|
+
green: 'Green',
|
|
8468
|
+
white: 'White',
|
|
8469
|
+
black: 'Black',
|
|
8470
|
+
onDoubleClick: 'Double click to edit this text. Press Enter to submit.'
|
|
8471
|
+
},
|
|
8472
|
+
charting: {
|
|
8473
|
+
addCategory: 'Add category',
|
|
8474
|
+
newLabel: 'New label',
|
|
8475
|
+
reachedLimit_other: "There can't be more than {{count}} categories."
|
|
8476
|
+
},
|
|
8477
|
+
graphing: {
|
|
8478
|
+
point: 'Point',
|
|
8479
|
+
circle: 'Circle',
|
|
8480
|
+
line: 'Line',
|
|
8481
|
+
parabola: 'Parabola',
|
|
8482
|
+
absolute: 'Absolute Value',
|
|
8483
|
+
exponential: 'Exponential',
|
|
8484
|
+
polygon: 'Polygon',
|
|
8485
|
+
ray: 'Ray',
|
|
8486
|
+
segment: 'Segment',
|
|
8487
|
+
sine: 'Sine',
|
|
8488
|
+
vector: 'Vector',
|
|
8489
|
+
label: 'Label',
|
|
8490
|
+
redo: 'Redo',
|
|
8491
|
+
reset: 'Reset'
|
|
8492
|
+
},
|
|
8493
|
+
mathInline: {
|
|
8494
|
+
primaryCorrectWithAlternates: 'Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.'
|
|
8495
|
+
},
|
|
8496
|
+
selectText: {
|
|
8497
|
+
correctAnswerSelected: 'Correct answer selected',
|
|
8498
|
+
correctAnswerNotSelected: 'Correct answer not selected',
|
|
8499
|
+
incorrectSelection: 'Incorrect selection'
|
|
8500
|
+
}
|
|
8501
|
+
},
|
|
8502
|
+
common: {
|
|
8503
|
+
undo: 'Undo',
|
|
8504
|
+
clearAll: 'Clear all',
|
|
8505
|
+
correct: 'Correct',
|
|
8506
|
+
incorrect: 'Incorrect',
|
|
8507
|
+
showCorrectAnswer: 'Show correct answer',
|
|
8508
|
+
hideCorrectAnswer: 'Hide correct answer',
|
|
8509
|
+
commonCorrectAnswerWithAlternates: 'Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.',
|
|
8510
|
+
warning: 'Warning',
|
|
8511
|
+
showNote: 'Show Note',
|
|
8512
|
+
hideNote: 'Hide Note',
|
|
8513
|
+
cancel: 'Cancel'
|
|
8514
|
+
}
|
|
8515
|
+
};
|
|
8516
|
+
exports["default"] = _default;
|
|
8517
|
+
})(en);
|
|
8518
|
+
getDefaultExportFromCjs(en);
|
|
8519
|
+
var es = {};
|
|
8520
|
+
(function (exports) {
|
|
8521
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8522
|
+
value: true
|
|
8523
|
+
});
|
|
8524
|
+
exports["default"] = void 0;
|
|
8525
|
+
var _default = {
|
|
8526
|
+
translation: {
|
|
8527
|
+
categorize: {
|
|
8528
|
+
limitMaxChoicesPerCategory: 'Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
|
|
8529
|
+
maxChoicesPerCategoryRestriction: 'Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta'
|
|
8530
|
+
},
|
|
8531
|
+
ebsr: {
|
|
8532
|
+
part: 'Parte {{index}}'
|
|
8533
|
+
},
|
|
8534
|
+
numberLine: {
|
|
8535
|
+
addElementLimit_one: 'Solo puedes agregar {{count}} elemento',
|
|
8536
|
+
addElementLimit_other: 'Solo puedes agregar {{count}} elementos',
|
|
8537
|
+
clearAll: 'Borrar todo'
|
|
8538
|
+
},
|
|
8539
|
+
imageClozeAssociation: {
|
|
8540
|
+
reachedLimit_one: 'Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
|
|
8541
|
+
reachedLimit_other: 'Has alcanzado el límite de {{count}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.'
|
|
8542
|
+
},
|
|
8543
|
+
drawingResponse: {
|
|
8544
|
+
fillColor: 'Color de relleno',
|
|
8545
|
+
outlineColor: 'Color del contorno',
|
|
8546
|
+
noFill: 'Sin relleno',
|
|
8547
|
+
lightblue: 'Azul claro',
|
|
8548
|
+
lightyellow: 'Amarillo claro',
|
|
8549
|
+
red: 'Rojo',
|
|
8550
|
+
orange: 'Naranja',
|
|
8551
|
+
yellow: 'Amarillo',
|
|
8552
|
+
violet: 'Violeta',
|
|
8553
|
+
blue: 'Azul',
|
|
8554
|
+
green: 'Verde',
|
|
8555
|
+
white: 'Blanco',
|
|
8556
|
+
black: 'Negro',
|
|
8557
|
+
onDoubleClick: 'Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar'
|
|
8558
|
+
},
|
|
8559
|
+
charting: {
|
|
8560
|
+
addCategory: 'Añadir categoría',
|
|
8561
|
+
newLabel: 'Nueva etiqueta',
|
|
8562
|
+
reachedLimit_other: 'No puede haber más de {{count}} categorías.'
|
|
8563
|
+
},
|
|
8564
|
+
graphing: {
|
|
8565
|
+
point: 'Punto',
|
|
8566
|
+
circle: 'Circulo',
|
|
8567
|
+
line: 'Línea',
|
|
8568
|
+
parabola: 'Parábola',
|
|
8569
|
+
absolute: 'Valor absoluto',
|
|
8570
|
+
exponential: 'Exponencial',
|
|
8571
|
+
polygon: 'Polígono',
|
|
8572
|
+
ray: 'Semirrecta',
|
|
8573
|
+
segment: 'Segmento ',
|
|
8574
|
+
sine: 'Seno',
|
|
8575
|
+
vector: 'Vector',
|
|
8576
|
+
label: 'Etiqueta',
|
|
8577
|
+
redo: 'Rehacer',
|
|
8578
|
+
reset: 'Reiniciar'
|
|
8579
|
+
},
|
|
8580
|
+
mathInline: {
|
|
8581
|
+
primaryCorrectWithAlternates: 'Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas.'
|
|
8582
|
+
},
|
|
8583
|
+
selectText: {
|
|
8584
|
+
correctAnswerSelected: 'Respuesta correcta seleccionada',
|
|
8585
|
+
correctAnswerNotSelected: 'Respuesta correcta no seleccionada',
|
|
8586
|
+
incorrectSelection: 'Selección incorrecta'
|
|
8587
|
+
}
|
|
8588
|
+
},
|
|
8589
|
+
common: {
|
|
8590
|
+
undo: 'Deshacer',
|
|
8591
|
+
clearAll: 'Borrar todo',
|
|
8592
|
+
correct: 'Correct',
|
|
8593
|
+
incorrect: 'Incorrect',
|
|
8594
|
+
showCorrectAnswer: 'Mostrar respuesta correcta',
|
|
8595
|
+
hideCorrectAnswer: 'Ocultar respuesta correcta',
|
|
8596
|
+
commonCorrectAnswerWithAlternates: 'Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.',
|
|
8597
|
+
warning: 'Advertencia',
|
|
8598
|
+
showNote: 'Mostrar Nota',
|
|
8599
|
+
hideNote: 'Ocultar Nota',
|
|
8600
|
+
cancel: 'Cancelar'
|
|
8601
|
+
}
|
|
8602
|
+
};
|
|
8603
|
+
exports["default"] = _default;
|
|
8604
|
+
})(es);
|
|
8605
|
+
getDefaultExportFromCjs(es);
|
|
8606
|
+
(function (exports) {
|
|
8607
|
+
var _interopRequireDefault = interopRequireDefault.exports;
|
|
8608
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8609
|
+
value: true
|
|
8610
|
+
});
|
|
8611
|
+
exports["default"] = void 0;
|
|
8612
|
+
var _defineProperty2 = _interopRequireDefault(defineProperty$2.exports);
|
|
8613
|
+
var _i18next = _interopRequireDefault(i18next);
|
|
8614
|
+
var _en = _interopRequireDefault(en);
|
|
8615
|
+
var _es = _interopRequireDefault(es);
|
|
8616
|
+
function ownKeys(object, enumerableOnly) {
|
|
8617
|
+
var keys = Object.keys(object);
|
|
8618
|
+
if (Object.getOwnPropertySymbols) {
|
|
8619
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8620
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
8621
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
8622
|
+
})), keys.push.apply(keys, symbols));
|
|
8623
|
+
}
|
|
8624
|
+
return keys;
|
|
8625
|
+
}
|
|
8626
|
+
function _objectSpread(target) {
|
|
8627
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
8628
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
8629
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
8630
|
+
(0, _defineProperty2["default"])(target, key, source[key]);
|
|
8631
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
8632
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
8633
|
+
});
|
|
8634
|
+
}
|
|
8635
|
+
return target;
|
|
8636
|
+
}
|
|
8637
|
+
_i18next["default"].init({
|
|
8638
|
+
fallbackLng: "en",
|
|
8639
|
+
lng: "en",
|
|
8640
|
+
debug: true,
|
|
8641
|
+
resources: {
|
|
8642
|
+
en: _en["default"],
|
|
8643
|
+
es: _es["default"]
|
|
8644
|
+
}
|
|
8645
|
+
});
|
|
8646
|
+
var _default = {
|
|
8647
|
+
translator: _objectSpread(_objectSpread({}, _i18next["default"]), {}, {
|
|
8648
|
+
t: function t(key, options) {
|
|
8649
|
+
var lng = options.lng;
|
|
8650
|
+
switch (lng) {
|
|
8651
|
+
case "en_US":
|
|
8652
|
+
case "en-US":
|
|
8653
|
+
options.lng = "en";
|
|
8654
|
+
break;
|
|
8655
|
+
case "es_ES":
|
|
8656
|
+
case "es-ES":
|
|
8657
|
+
case "es_MX":
|
|
8658
|
+
case "es-MX":
|
|
8659
|
+
options.lng = "es";
|
|
8660
|
+
break;
|
|
8661
|
+
}
|
|
8662
|
+
return _i18next["default"].t(key, _objectSpread({
|
|
8663
|
+
lng: lng
|
|
8664
|
+
}, options));
|
|
8665
|
+
}
|
|
8666
|
+
}),
|
|
8667
|
+
languageOptions: [{
|
|
8668
|
+
value: "en_US",
|
|
8669
|
+
label: "English (US)"
|
|
8670
|
+
}, {
|
|
8671
|
+
value: "es_ES",
|
|
8672
|
+
label: "Spanish"
|
|
8673
|
+
}]
|
|
8674
|
+
};
|
|
8675
|
+
exports["default"] = _default;
|
|
8676
|
+
})(translator$1);
|
|
8677
|
+
getDefaultExportFromCjs(translator$1);
|
|
8678
|
+
(function (exports) {
|
|
8679
|
+
var _interopRequireDefault = interopRequireDefault.exports;
|
|
8680
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8681
|
+
value: true
|
|
8682
|
+
});
|
|
8683
|
+
Object.defineProperty(exports, "Translator", {
|
|
8684
|
+
enumerable: true,
|
|
8685
|
+
get: function get() {
|
|
8686
|
+
return _translator["default"];
|
|
8687
|
+
}
|
|
8688
|
+
});
|
|
8689
|
+
exports["default"] = void 0;
|
|
8690
|
+
var _translator = _interopRequireDefault(translator$1);
|
|
8691
|
+
var _default = _translator["default"];
|
|
8692
|
+
exports["default"] = _default;
|
|
8693
|
+
})(translator$2);
|
|
8694
|
+
var Translator = getDefaultExportFromCjs(translator$2);
|
|
8695
|
+
var FormControlLabel$3 = {};
|
|
8696
|
+
var FormControlLabel$2 = {};
|
|
8697
|
+
var withFormControlContext$1 = {};
|
|
8698
|
+
var FormControlContext$1 = {};
|
|
8699
|
+
const require$$1$8 = _dll_react;
|
|
8700
|
+
var _interopRequireDefault$s = interopRequireDefault.exports;
|
|
8701
|
+
Object.defineProperty(FormControlContext$1, "__esModule", {
|
|
8702
|
+
value: true
|
|
8703
|
+
});
|
|
8704
|
+
FormControlContext$1.default = void 0;
|
|
8705
|
+
var _react$k = _interopRequireDefault$s(require$$1$8);
|
|
8706
|
+
var FormControlContext = _react$k.default.createContext();
|
|
8707
|
+
var _default$r = FormControlContext;
|
|
8708
|
+
FormControlContext$1.default = _default$r;
|
|
8709
|
+
const require$$2$3 = _dll_react;
|
|
8710
|
+
var _interopRequireDefault$r = interopRequireDefault.exports;
|
|
8711
|
+
Object.defineProperty(withFormControlContext$1, "__esModule", {
|
|
8712
|
+
value: true
|
|
8713
|
+
});
|
|
8714
|
+
withFormControlContext$1.default = withFormControlContext;
|
|
8715
|
+
var _extends2$a = _interopRequireDefault$r(_extends$1.exports);
|
|
8716
|
+
var _react$j = _interopRequireDefault$r(require$$2$3);
|
|
8717
|
+
var _hoistNonReactStatics = _interopRequireDefault$r(hoistNonReactStatics_cjs);
|
|
8718
|
+
var _FormControlContext = _interopRequireDefault$r(FormControlContext$1);
|
|
8719
|
+
var _utils$5 = require$$7$1;
|
|
8720
|
+
function withFormControlContext(Component) {
|
|
8721
|
+
var EnhancedComponent = function EnhancedComponent(props) {
|
|
8722
|
+
return _react$j.default.createElement(_FormControlContext.default.Consumer, null, function (context) {
|
|
8723
|
+
return _react$j.default.createElement(Component, (0, _extends2$a.default)({
|
|
8724
|
+
muiFormControl: context
|
|
8725
|
+
}, props));
|
|
8726
|
+
});
|
|
8727
|
+
};
|
|
8728
|
+
{
|
|
8729
|
+
EnhancedComponent.displayName = ("WithFormControlContext(").concat((0, _utils$5.getDisplayName)(Component), ")");
|
|
8730
|
+
}
|
|
8731
|
+
(0, _hoistNonReactStatics.default)(EnhancedComponent, Component);
|
|
8732
|
+
return EnhancedComponent;
|
|
8733
|
+
}
|
|
8734
|
+
var Typography$2 = {};
|
|
8735
|
+
var Typography$1 = {};
|
|
8736
|
+
var helpers = {};
|
|
8737
|
+
var _interopRequireDefault$q = interopRequireDefault.exports;
|
|
8738
|
+
Object.defineProperty(helpers, "__esModule", {
|
|
8739
|
+
value: true
|
|
8740
|
+
});
|
|
8741
|
+
helpers.capitalize = capitalize;
|
|
8742
|
+
helpers.contains = contains;
|
|
8743
|
+
helpers.findIndex = findIndex;
|
|
8744
|
+
helpers.find = find;
|
|
8745
|
+
helpers.createChainedFunction = createChainedFunction;
|
|
8746
|
+
var _typeof2 = _interopRequireDefault$q(_typeof$3.exports);
|
|
8747
|
+
var _warning$1 = _interopRequireDefault$q(warning_1);
|
|
8748
|
+
function capitalize(string) {
|
|
8749
|
+
if (typeof string !== 'string') {
|
|
8750
|
+
throw new Error('Material-UI: capitalize(string) expects a string argument.');
|
|
8751
|
+
}
|
|
8752
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
8753
|
+
}
|
|
8754
|
+
function contains(obj, pred) {
|
|
8755
|
+
return Object.keys(pred).every(function (key) {
|
|
8756
|
+
return obj.hasOwnProperty(key) && obj[key] === pred[key];
|
|
8757
|
+
});
|
|
8758
|
+
}
|
|
8759
|
+
function findIndex(arr, pred) {
|
|
8760
|
+
var predType = (0, _typeof2.default)(pred);
|
|
8761
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
8762
|
+
if (predType === 'function' && !!pred(arr[i], i, arr) === true) {
|
|
8763
|
+
return i;
|
|
8764
|
+
}
|
|
8765
|
+
if (predType === 'object' && contains(arr[i], pred)) {
|
|
8766
|
+
return i;
|
|
8767
|
+
}
|
|
8768
|
+
if (['string', 'number', 'boolean'].indexOf(predType) !== -1) {
|
|
8769
|
+
return arr.indexOf(pred);
|
|
8770
|
+
}
|
|
8771
|
+
}
|
|
8772
|
+
return -1;
|
|
8773
|
+
}
|
|
8774
|
+
function find(arr, pred) {
|
|
8775
|
+
var index = findIndex(arr, pred);
|
|
8776
|
+
return index > -1 ? arr[index] : undefined;
|
|
8777
|
+
}
|
|
8778
|
+
function createChainedFunction() {
|
|
8779
|
+
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8780
|
+
funcs[_key] = arguments[_key];
|
|
8781
|
+
}
|
|
8782
|
+
return funcs.reduce(function (acc, func) {
|
|
8783
|
+
if (func == null) {
|
|
8784
|
+
return acc;
|
|
8785
|
+
}
|
|
8786
|
+
(0, _warning$1.default)(typeof func === 'function', 'Material-UI: invalid Argument Type, must only provide functions, undefined, or null.');
|
|
8787
|
+
return function chainedFunction() {
|
|
8788
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
8789
|
+
args[_key2] = arguments[_key2];
|
|
8790
|
+
}
|
|
8791
|
+
acc.apply(this, args);
|
|
8792
|
+
func.apply(this, args);
|
|
8793
|
+
};
|
|
8794
|
+
}, function () {});
|
|
8795
|
+
}
|
|
8796
|
+
const require$$4$5 = _dll_react;
|
|
8797
|
+
const require$$5$5 = _dll_prop_types;
|
|
8798
|
+
const require$$6$5 = _dll_classnames;
|
|
8799
|
+
var _interopRequireDefault$p = interopRequireDefault.exports;
|
|
8800
|
+
Object.defineProperty(Typography$1, "__esModule", {
|
|
8801
|
+
value: true
|
|
8802
|
+
});
|
|
8803
|
+
Typography$1.default = Typography$1.styles = void 0;
|
|
8804
|
+
var _extends2$9 = _interopRequireDefault$p(_extends$1.exports);
|
|
8805
|
+
var _defineProperty2$7 = _interopRequireDefault$p(defineProperty$2.exports);
|
|
8806
|
+
var _objectWithoutProperties2$9 = _interopRequireDefault$p(objectWithoutProperties.exports);
|
|
8807
|
+
var _react$i = _interopRequireDefault$p(require$$4$5);
|
|
8808
|
+
var _propTypes$b = _interopRequireDefault$p(require$$5$5);
|
|
8809
|
+
var _classnames$9 = _interopRequireDefault$p(require$$6$5);
|
|
8810
|
+
var _utils$4 = require$$7$1;
|
|
8811
|
+
var _withStyles$8 = _interopRequireDefault$p(withStyles);
|
|
8812
|
+
var _helpers$5 = helpers;
|
|
8813
|
+
var styles$a = function styles(theme) {
|
|
8814
|
+
return {
|
|
8815
|
+
root: {
|
|
8816
|
+
display: 'block',
|
|
8817
|
+
margin: 0
|
|
8818
|
+
},
|
|
8819
|
+
display4: theme.typography.display4,
|
|
8820
|
+
display3: theme.typography.display3,
|
|
8821
|
+
display2: theme.typography.display2,
|
|
8822
|
+
display1: theme.typography.display1,
|
|
8823
|
+
headline: theme.typography.headline,
|
|
8824
|
+
title: theme.typography.title,
|
|
8825
|
+
subheading: theme.typography.subheading,
|
|
8826
|
+
body2: theme.typography.body2,
|
|
8827
|
+
body1: theme.typography.body1,
|
|
8828
|
+
caption: theme.typography.caption,
|
|
8829
|
+
button: theme.typography.button,
|
|
8830
|
+
h1: theme.typography.h1,
|
|
8831
|
+
h2: theme.typography.h2,
|
|
8832
|
+
h3: theme.typography.h3,
|
|
8833
|
+
h4: theme.typography.h4,
|
|
8834
|
+
h5: theme.typography.h5,
|
|
8835
|
+
h6: theme.typography.h6,
|
|
8836
|
+
subtitle1: theme.typography.subtitle1,
|
|
8837
|
+
subtitle2: theme.typography.subtitle2,
|
|
8838
|
+
overline: theme.typography.overline,
|
|
8839
|
+
srOnly: {
|
|
8840
|
+
position: 'absolute',
|
|
8841
|
+
height: 1,
|
|
8842
|
+
width: 1,
|
|
5611
8843
|
overflow: 'hidden'
|
|
5612
8844
|
},
|
|
5613
8845
|
alignLeft: {
|
|
@@ -5767,7 +8999,7 @@ Object.defineProperty(FormControlLabel$2, "__esModule", {
|
|
|
5767
8999
|
});
|
|
5768
9000
|
FormControlLabel$2.default = FormControlLabel$2.styles = void 0;
|
|
5769
9001
|
var _extends2$8 = _interopRequireDefault$o(_extends$1.exports);
|
|
5770
|
-
var _defineProperty2$6 = _interopRequireDefault$o(defineProperty$
|
|
9002
|
+
var _defineProperty2$6 = _interopRequireDefault$o(defineProperty$2.exports);
|
|
5771
9003
|
var _objectWithoutProperties2$8 = _interopRequireDefault$o(objectWithoutProperties.exports);
|
|
5772
9004
|
var _react$h = _interopRequireDefault$o(require$$4$4);
|
|
5773
9005
|
var _propTypes$a = _interopRequireDefault$o(require$$5$4);
|
|
@@ -5919,11 +9151,11 @@ Object.defineProperty(NoSsr$1, "__esModule", {
|
|
|
5919
9151
|
value: true
|
|
5920
9152
|
});
|
|
5921
9153
|
NoSsr$1.default = void 0;
|
|
5922
|
-
var _classCallCheck2$4 = _interopRequireDefault$m(classCallCheck.exports);
|
|
5923
|
-
var _createClass2$4 = _interopRequireDefault$m(createClass.exports);
|
|
5924
|
-
var _possibleConstructorReturn2$4 = _interopRequireDefault$m(possibleConstructorReturn.exports);
|
|
5925
|
-
var _getPrototypeOf3$3 = _interopRequireDefault$m(getPrototypeOf$
|
|
5926
|
-
var _inherits2$4 = _interopRequireDefault$m(inherits.exports);
|
|
9154
|
+
var _classCallCheck2$4 = _interopRequireDefault$m(classCallCheck$1.exports);
|
|
9155
|
+
var _createClass2$4 = _interopRequireDefault$m(createClass$1.exports);
|
|
9156
|
+
var _possibleConstructorReturn2$4 = _interopRequireDefault$m(possibleConstructorReturn$1.exports);
|
|
9157
|
+
var _getPrototypeOf3$3 = _interopRequireDefault$m(getPrototypeOf$2.exports);
|
|
9158
|
+
var _inherits2$4 = _interopRequireDefault$m(inherits$1.exports);
|
|
5927
9159
|
var _react$g = _interopRequireDefault$m(require$$6$3);
|
|
5928
9160
|
var _propTypes$9 = _interopRequireDefault$m(require$$7);
|
|
5929
9161
|
var _utils$3 = require$$7$1;
|
|
@@ -6834,13 +10066,13 @@ Object.defineProperty(Ripple$1, "__esModule", {
|
|
|
6834
10066
|
});
|
|
6835
10067
|
Ripple$1.default = void 0;
|
|
6836
10068
|
var _extends2$7 = _interopRequireDefault$i(_extends$1.exports);
|
|
6837
|
-
var _defineProperty2$5 = _interopRequireDefault$i(defineProperty$
|
|
10069
|
+
var _defineProperty2$5 = _interopRequireDefault$i(defineProperty$2.exports);
|
|
6838
10070
|
var _objectWithoutProperties2$7 = _interopRequireDefault$i(objectWithoutProperties.exports);
|
|
6839
|
-
var _classCallCheck2$3 = _interopRequireDefault$i(classCallCheck.exports);
|
|
6840
|
-
var _createClass2$3 = _interopRequireDefault$i(createClass.exports);
|
|
6841
|
-
var _possibleConstructorReturn2$3 = _interopRequireDefault$i(possibleConstructorReturn.exports);
|
|
6842
|
-
var _getPrototypeOf3$2 = _interopRequireDefault$i(getPrototypeOf$
|
|
6843
|
-
var _inherits2$3 = _interopRequireDefault$i(inherits.exports);
|
|
10071
|
+
var _classCallCheck2$3 = _interopRequireDefault$i(classCallCheck$1.exports);
|
|
10072
|
+
var _createClass2$3 = _interopRequireDefault$i(createClass$1.exports);
|
|
10073
|
+
var _possibleConstructorReturn2$3 = _interopRequireDefault$i(possibleConstructorReturn$1.exports);
|
|
10074
|
+
var _getPrototypeOf3$2 = _interopRequireDefault$i(getPrototypeOf$2.exports);
|
|
10075
|
+
var _inherits2$3 = _interopRequireDefault$i(inherits$1.exports);
|
|
6844
10076
|
var _react$d = _interopRequireDefault$i(require$$9$1);
|
|
6845
10077
|
var _propTypes$7 = _interopRequireDefault$i(require$$10$3);
|
|
6846
10078
|
var _classnames$7 = _interopRequireDefault$i(require$$11$3);
|
|
@@ -6923,12 +10155,12 @@ TouchRipple$1.default = TouchRipple$1.styles = TouchRipple$1.DELAY_RIPPLE = void
|
|
|
6923
10155
|
var _extends2$6 = _interopRequireDefault$h(_extends$1.exports);
|
|
6924
10156
|
var _objectWithoutProperties2$6 = _interopRequireDefault$h(objectWithoutProperties.exports);
|
|
6925
10157
|
var _toConsumableArray2 = _interopRequireDefault$h(toConsumableArray.exports);
|
|
6926
|
-
var _classCallCheck2$2 = _interopRequireDefault$h(classCallCheck.exports);
|
|
6927
|
-
var _createClass2$2 = _interopRequireDefault$h(createClass.exports);
|
|
6928
|
-
var _possibleConstructorReturn2$2 = _interopRequireDefault$h(possibleConstructorReturn.exports);
|
|
6929
|
-
var _getPrototypeOf3$1 = _interopRequireDefault$h(getPrototypeOf$
|
|
6930
|
-
var _inherits2$2 = _interopRequireDefault$h(inherits.exports);
|
|
6931
|
-
var _assertThisInitialized2$1 = _interopRequireDefault$h(assertThisInitialized.exports);
|
|
10158
|
+
var _classCallCheck2$2 = _interopRequireDefault$h(classCallCheck$1.exports);
|
|
10159
|
+
var _createClass2$2 = _interopRequireDefault$h(createClass$1.exports);
|
|
10160
|
+
var _possibleConstructorReturn2$2 = _interopRequireDefault$h(possibleConstructorReturn$1.exports);
|
|
10161
|
+
var _getPrototypeOf3$1 = _interopRequireDefault$h(getPrototypeOf$2.exports);
|
|
10162
|
+
var _inherits2$2 = _interopRequireDefault$h(inherits$1.exports);
|
|
10163
|
+
var _assertThisInitialized2$1 = _interopRequireDefault$h(assertThisInitialized$1.exports);
|
|
6932
10164
|
var _react$c = _interopRequireDefault$h(require$$10$2);
|
|
6933
10165
|
var _propTypes$6 = _interopRequireDefault$h(require$$11$2);
|
|
6934
10166
|
var _reactDom$1 = _interopRequireDefault$h(require$$12$1);
|
|
@@ -7226,14 +10458,14 @@ Object.defineProperty(ButtonBase$1, "__esModule", {
|
|
|
7226
10458
|
});
|
|
7227
10459
|
ButtonBase$1.default = ButtonBase$1.styles = void 0;
|
|
7228
10460
|
var _extends2$5 = _interopRequireDefault$g(_extends$1.exports);
|
|
7229
|
-
var _defineProperty2$4 = _interopRequireDefault$g(defineProperty$
|
|
10461
|
+
var _defineProperty2$4 = _interopRequireDefault$g(defineProperty$2.exports);
|
|
7230
10462
|
var _objectWithoutProperties2$5 = _interopRequireDefault$g(objectWithoutProperties.exports);
|
|
7231
|
-
var _classCallCheck2$1 = _interopRequireDefault$g(classCallCheck.exports);
|
|
7232
|
-
var _createClass2$1 = _interopRequireDefault$g(createClass.exports);
|
|
7233
|
-
var _possibleConstructorReturn2$1 = _interopRequireDefault$g(possibleConstructorReturn.exports);
|
|
7234
|
-
var _getPrototypeOf3 = _interopRequireDefault$g(getPrototypeOf$
|
|
7235
|
-
var _inherits2$1 = _interopRequireDefault$g(inherits.exports);
|
|
7236
|
-
var _assertThisInitialized2 = _interopRequireDefault$g(assertThisInitialized.exports);
|
|
10463
|
+
var _classCallCheck2$1 = _interopRequireDefault$g(classCallCheck$1.exports);
|
|
10464
|
+
var _createClass2$1 = _interopRequireDefault$g(createClass$1.exports);
|
|
10465
|
+
var _possibleConstructorReturn2$1 = _interopRequireDefault$g(possibleConstructorReturn$1.exports);
|
|
10466
|
+
var _getPrototypeOf3 = _interopRequireDefault$g(getPrototypeOf$2.exports);
|
|
10467
|
+
var _inherits2$1 = _interopRequireDefault$g(inherits$1.exports);
|
|
10468
|
+
var _assertThisInitialized2 = _interopRequireDefault$g(assertThisInitialized$1.exports);
|
|
7237
10469
|
var _react$b = _interopRequireDefault$g(require$$10$1);
|
|
7238
10470
|
var _propTypes$5 = _interopRequireDefault$g(require$$11$1);
|
|
7239
10471
|
var _reactDom = _interopRequireDefault$g(require$$12);
|
|
@@ -7551,7 +10783,7 @@ Object.defineProperty(IconButton$1, "__esModule", {
|
|
|
7551
10783
|
});
|
|
7552
10784
|
IconButton$1.default = IconButton$1.styles = void 0;
|
|
7553
10785
|
var _extends2$4 = _interopRequireDefault$f(_extends$1.exports);
|
|
7554
|
-
var _defineProperty2$3 = _interopRequireDefault$f(defineProperty$
|
|
10786
|
+
var _defineProperty2$3 = _interopRequireDefault$f(defineProperty$2.exports);
|
|
7555
10787
|
var _objectWithoutProperties2$4 = _interopRequireDefault$f(objectWithoutProperties.exports);
|
|
7556
10788
|
var _react$a = _interopRequireDefault$f(require$$4$3);
|
|
7557
10789
|
var _propTypes$4 = _interopRequireDefault$f(require$$5$3);
|
|
@@ -7677,13 +10909,13 @@ Object.defineProperty(SwitchBase$1, "__esModule", {
|
|
|
7677
10909
|
});
|
|
7678
10910
|
SwitchBase$1.default = SwitchBase$1.styles = void 0;
|
|
7679
10911
|
var _extends2$3 = _interopRequireDefault$e(_extends$1.exports);
|
|
7680
|
-
var _defineProperty2$2 = _interopRequireDefault$e(defineProperty$
|
|
10912
|
+
var _defineProperty2$2 = _interopRequireDefault$e(defineProperty$2.exports);
|
|
7681
10913
|
var _objectWithoutProperties2$3 = _interopRequireDefault$e(objectWithoutProperties.exports);
|
|
7682
|
-
var _classCallCheck2 = _interopRequireDefault$e(classCallCheck.exports);
|
|
7683
|
-
var _createClass2 = _interopRequireDefault$e(createClass.exports);
|
|
7684
|
-
var _possibleConstructorReturn2 = _interopRequireDefault$e(possibleConstructorReturn.exports);
|
|
7685
|
-
var _getPrototypeOf2 = _interopRequireDefault$e(getPrototypeOf$
|
|
7686
|
-
var _inherits2 = _interopRequireDefault$e(inherits.exports);
|
|
10914
|
+
var _classCallCheck2 = _interopRequireDefault$e(classCallCheck$1.exports);
|
|
10915
|
+
var _createClass2 = _interopRequireDefault$e(createClass$1.exports);
|
|
10916
|
+
var _possibleConstructorReturn2 = _interopRequireDefault$e(possibleConstructorReturn$1.exports);
|
|
10917
|
+
var _getPrototypeOf2 = _interopRequireDefault$e(getPrototypeOf$2.exports);
|
|
10918
|
+
var _inherits2 = _interopRequireDefault$e(inherits$1.exports);
|
|
7687
10919
|
var _react$9 = _interopRequireDefault$e(require$$9);
|
|
7688
10920
|
var _propTypes$3 = _interopRequireDefault$e(require$$10);
|
|
7689
10921
|
var _classnames$3 = _interopRequireDefault$e(require$$11);
|
|
@@ -7836,11 +11068,11 @@ var inheritsLoose = {
|
|
|
7836
11068
|
exports: {}
|
|
7837
11069
|
};
|
|
7838
11070
|
(function (module) {
|
|
7839
|
-
var setPrototypeOf
|
|
11071
|
+
var setPrototypeOf = setPrototypeOf$1.exports;
|
|
7840
11072
|
function _inheritsLoose(subClass, superClass) {
|
|
7841
11073
|
subClass.prototype = Object.create(superClass.prototype);
|
|
7842
11074
|
subClass.prototype.constructor = subClass;
|
|
7843
|
-
setPrototypeOf
|
|
11075
|
+
setPrototypeOf(subClass, superClass);
|
|
7844
11076
|
}
|
|
7845
11077
|
(module.exports = _inheritsLoose, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
7846
11078
|
})(inheritsLoose);
|
|
@@ -7985,7 +11217,7 @@ Object.defineProperty(SvgIcon$1, "__esModule", {
|
|
|
7985
11217
|
});
|
|
7986
11218
|
SvgIcon$1.default = SvgIcon$1.styles = void 0;
|
|
7987
11219
|
var _extends2$2 = _interopRequireDefault$8(_extends$1.exports);
|
|
7988
|
-
var _defineProperty2$1 = _interopRequireDefault$8(defineProperty$
|
|
11220
|
+
var _defineProperty2$1 = _interopRequireDefault$8(defineProperty$2.exports);
|
|
7989
11221
|
var _objectWithoutProperties2$2 = _interopRequireDefault$8(objectWithoutProperties.exports);
|
|
7990
11222
|
var _react$7 = _interopRequireDefault$8(require$$4$2);
|
|
7991
11223
|
var _propTypes$2 = _interopRequireDefault$8(require$$5$2);
|
|
@@ -8151,7 +11383,7 @@ Object.defineProperty(Checkbox$2, "__esModule", {
|
|
|
8151
11383
|
});
|
|
8152
11384
|
Checkbox$2.default = Checkbox$2.styles = void 0;
|
|
8153
11385
|
var _extends2$1 = _interopRequireDefault$4(_extends$1.exports);
|
|
8154
|
-
var _defineProperty2 = _interopRequireDefault$4(defineProperty$
|
|
11386
|
+
var _defineProperty2 = _interopRequireDefault$4(defineProperty$2.exports);
|
|
8155
11387
|
var _objectWithoutProperties2$1 = _interopRequireDefault$4(objectWithoutProperties.exports);
|
|
8156
11388
|
var _react$3 = _interopRequireDefault$4(require$$4$1);
|
|
8157
11389
|
var _propTypes$1 = _interopRequireDefault$4(require$$5$1);
|
|
@@ -9040,7 +12272,7 @@ const StyledCheckbox = styles$b.withStyles(inputStyles)(props => {
|
|
|
9040
12272
|
__self: undefined,
|
|
9041
12273
|
__source: {
|
|
9042
12274
|
fileName: _jsxFileName$3,
|
|
9043
|
-
lineNumber:
|
|
12275
|
+
lineNumber: 116
|
|
9044
12276
|
}
|
|
9045
12277
|
});
|
|
9046
12278
|
});
|
|
@@ -9072,7 +12304,7 @@ const StyledRadio = styles$b.withStyles(inputStyles)(props => {
|
|
|
9072
12304
|
__self: undefined,
|
|
9073
12305
|
__source: {
|
|
9074
12306
|
fileName: _jsxFileName$3,
|
|
9075
|
-
lineNumber:
|
|
12307
|
+
lineNumber: 144
|
|
9076
12308
|
}
|
|
9077
12309
|
});
|
|
9078
12310
|
});
|
|
@@ -9095,7 +12327,6 @@ class ChoiceInput extends React$4.Component {
|
|
|
9095
12327
|
hideTick: PropTypes$3.bool,
|
|
9096
12328
|
isEvaluateMode: PropTypes$3.bool,
|
|
9097
12329
|
choicesLayout: PropTypes$3.oneOf(['vertical', 'grid', 'horizontal']),
|
|
9098
|
-
updateSession: PropTypes$3.func,
|
|
9099
12330
|
isSelectionButtonBelow: PropTypes$3.bool
|
|
9100
12331
|
};
|
|
9101
12332
|
}
|
|
@@ -9114,10 +12345,6 @@ class ChoiceInput extends React$4.Component {
|
|
|
9114
12345
|
}
|
|
9115
12346
|
onToggleChoice(event) {
|
|
9116
12347
|
this.props.onChange(event);
|
|
9117
|
-
this.props.updateSession({
|
|
9118
|
-
value: this.props.value,
|
|
9119
|
-
selected: !this.props.checked
|
|
9120
|
-
});
|
|
9121
12348
|
}
|
|
9122
12349
|
generateChoiceId() {
|
|
9123
12350
|
return 'choice-' + (Math.random() * 10000).toFixed();
|
|
@@ -9136,7 +12363,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9136
12363
|
__self: this,
|
|
9137
12364
|
__source: {
|
|
9138
12365
|
fileName: _jsxFileName$3,
|
|
9139
|
-
lineNumber:
|
|
12366
|
+
lineNumber: 233
|
|
9140
12367
|
}
|
|
9141
12368
|
}, displayKey, ".", '\u00A0', React$4.createElement(PreviewPrompt$1, {
|
|
9142
12369
|
className: "label",
|
|
@@ -9145,7 +12372,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9145
12372
|
__self: this,
|
|
9146
12373
|
__source: {
|
|
9147
12374
|
fileName: _jsxFileName$3,
|
|
9148
|
-
lineNumber:
|
|
12375
|
+
lineNumber: 235
|
|
9149
12376
|
}
|
|
9150
12377
|
})) : React$4.createElement(PreviewPrompt$1, {
|
|
9151
12378
|
className: "label",
|
|
@@ -9154,7 +12381,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9154
12381
|
__self: this,
|
|
9155
12382
|
__source: {
|
|
9156
12383
|
fileName: _jsxFileName$3,
|
|
9157
|
-
lineNumber:
|
|
12384
|
+
lineNumber: 238
|
|
9158
12385
|
}
|
|
9159
12386
|
}));
|
|
9160
12387
|
return React$4.createElement('div', {
|
|
@@ -9162,28 +12389,28 @@ class ChoiceInput extends React$4.Component {
|
|
|
9162
12389
|
__self: this,
|
|
9163
12390
|
__source: {
|
|
9164
12391
|
fileName: _jsxFileName$3,
|
|
9165
|
-
lineNumber:
|
|
12392
|
+
lineNumber: 244
|
|
9166
12393
|
}
|
|
9167
12394
|
}, React$4.createElement('div', {
|
|
9168
12395
|
className: classes.row,
|
|
9169
12396
|
__self: this,
|
|
9170
12397
|
__source: {
|
|
9171
12398
|
fileName: _jsxFileName$3,
|
|
9172
|
-
lineNumber:
|
|
12399
|
+
lineNumber: 245
|
|
9173
12400
|
}
|
|
9174
12401
|
}, !hideTick && isEvaluateMode && React$4.createElement(FeedbackTick$1, {
|
|
9175
12402
|
correctness: correctness,
|
|
9176
12403
|
__self: this,
|
|
9177
12404
|
__source: {
|
|
9178
12405
|
fileName: _jsxFileName$3,
|
|
9179
|
-
lineNumber:
|
|
12406
|
+
lineNumber: 246
|
|
9180
12407
|
}
|
|
9181
12408
|
}), React$4.createElement('div', {
|
|
9182
12409
|
className: classNames$2(holderClassNames, 'checkbox-holder'),
|
|
9183
12410
|
__self: this,
|
|
9184
12411
|
__source: {
|
|
9185
12412
|
fileName: _jsxFileName$3,
|
|
9186
|
-
lineNumber:
|
|
12413
|
+
lineNumber: 247
|
|
9187
12414
|
}
|
|
9188
12415
|
}, isSelectionButtonBelow ? React$4.createElement(StyledFormControlLabel, {
|
|
9189
12416
|
label: choicelabel,
|
|
@@ -9195,7 +12422,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9195
12422
|
__self: this,
|
|
9196
12423
|
__source: {
|
|
9197
12424
|
fileName: _jsxFileName$3,
|
|
9198
|
-
lineNumber:
|
|
12425
|
+
lineNumber: 255
|
|
9199
12426
|
}
|
|
9200
12427
|
}, React$4.createElement(Tag, {
|
|
9201
12428
|
accessibility: accessibility,
|
|
@@ -9211,13 +12438,13 @@ class ChoiceInput extends React$4.Component {
|
|
|
9211
12438
|
__self: this,
|
|
9212
12439
|
__source: {
|
|
9213
12440
|
fileName: _jsxFileName$3,
|
|
9214
|
-
lineNumber:
|
|
12441
|
+
lineNumber: 256
|
|
9215
12442
|
}
|
|
9216
12443
|
}), displayKey, "."),
|
|
9217
12444
|
__self: this,
|
|
9218
12445
|
__source: {
|
|
9219
12446
|
fileName: _jsxFileName$3,
|
|
9220
|
-
lineNumber:
|
|
12447
|
+
lineNumber: 249
|
|
9221
12448
|
}
|
|
9222
12449
|
}) : React$4.createElement(StyledFormControlLabel, {
|
|
9223
12450
|
label: choicelabel,
|
|
@@ -9234,13 +12461,13 @@ class ChoiceInput extends React$4.Component {
|
|
|
9234
12461
|
__self: this,
|
|
9235
12462
|
__source: {
|
|
9236
12463
|
fileName: _jsxFileName$3,
|
|
9237
|
-
lineNumber:
|
|
12464
|
+
lineNumber: 276
|
|
9238
12465
|
}
|
|
9239
12466
|
}),
|
|
9240
12467
|
__self: this,
|
|
9241
12468
|
__source: {
|
|
9242
12469
|
fileName: _jsxFileName$3,
|
|
9243
|
-
lineNumber:
|
|
12470
|
+
lineNumber: 271
|
|
9244
12471
|
}
|
|
9245
12472
|
}))), rationale && React$4.createElement(PreviewPrompt$1, {
|
|
9246
12473
|
className: "rationale",
|
|
@@ -9249,7 +12476,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9249
12476
|
__self: this,
|
|
9250
12477
|
__source: {
|
|
9251
12478
|
fileName: _jsxFileName$3,
|
|
9252
|
-
lineNumber:
|
|
12479
|
+
lineNumber: 290
|
|
9253
12480
|
}
|
|
9254
12481
|
}), React$4.createElement(Feedback, {
|
|
9255
12482
|
feedback: feedback,
|
|
@@ -9257,7 +12484,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9257
12484
|
__self: this,
|
|
9258
12485
|
__source: {
|
|
9259
12486
|
fileName: _jsxFileName$3,
|
|
9260
|
-
lineNumber:
|
|
12487
|
+
lineNumber: 291
|
|
9261
12488
|
}
|
|
9262
12489
|
}));
|
|
9263
12490
|
}
|
|
@@ -9275,9 +12502,7 @@ class Choice extends React$3.Component {
|
|
|
9275
12502
|
Choice.prototype.__init.call(this);
|
|
9276
12503
|
}
|
|
9277
12504
|
static __initStatic() {
|
|
9278
|
-
this.propTypes = {
|
|
9279
|
-
updateSession: PropTypes$2.func
|
|
9280
|
-
};
|
|
12505
|
+
this.propTypes = {};
|
|
9281
12506
|
}
|
|
9282
12507
|
__init() {
|
|
9283
12508
|
this.onChange = choice => {
|
|
@@ -9288,7 +12513,7 @@ class Choice extends React$3.Component {
|
|
|
9288
12513
|
};
|
|
9289
12514
|
}
|
|
9290
12515
|
render() {
|
|
9291
|
-
const {choice, index, choicesLength, showCorrect, isEvaluateMode, choiceMode, disabled, checked, correctness, displayKey, classes, choicesLayout, gridColumns,
|
|
12516
|
+
const {choice, index, choicesLength, showCorrect, isEvaluateMode, choiceMode, disabled, checked, correctness, displayKey, classes, choicesLayout, gridColumns, isSelectionButtonBelow} = this.props;
|
|
9292
12517
|
const choiceClass = 'choice' + (index === choicesLength - 1 ? ' last' : '');
|
|
9293
12518
|
const feedback = !isEvaluateMode || showCorrect ? '' : choice.feedback;
|
|
9294
12519
|
const choiceProps = {
|
|
@@ -9302,7 +12527,6 @@ class Choice extends React$3.Component {
|
|
|
9302
12527
|
index,
|
|
9303
12528
|
choicesLayout,
|
|
9304
12529
|
gridColumns,
|
|
9305
|
-
updateSession,
|
|
9306
12530
|
onChange: this.onChange,
|
|
9307
12531
|
isEvaluateMode,
|
|
9308
12532
|
isSelectionButtonBelow
|
|
@@ -9317,7 +12541,7 @@ class Choice extends React$3.Component {
|
|
|
9317
12541
|
__self: this,
|
|
9318
12542
|
__source: {
|
|
9319
12543
|
fileName: _jsxFileName$2,
|
|
9320
|
-
lineNumber:
|
|
12544
|
+
lineNumber: 62
|
|
9321
12545
|
}
|
|
9322
12546
|
}, React$3.createElement(ChoiceInput$1, {
|
|
9323
12547
|
...choiceProps,
|
|
@@ -9325,7 +12549,7 @@ class Choice extends React$3.Component {
|
|
|
9325
12549
|
__self: this,
|
|
9326
12550
|
__source: {
|
|
9327
12551
|
fileName: _jsxFileName$2,
|
|
9328
|
-
lineNumber:
|
|
12552
|
+
lineNumber: 63
|
|
9329
12553
|
}
|
|
9330
12554
|
}));
|
|
9331
12555
|
}
|
|
@@ -9372,6 +12596,7 @@ const {color: color} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
|
9372
12596
|
const {Collapsible: Collapsible} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
9373
12597
|
const {PreviewPrompt: PreviewPrompt} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
9374
12598
|
const _jsxFileName$1 = "/home/circleci/repo/packages/multiple-choice/src/multiple-choice.jsx";
|
|
12599
|
+
const {translator} = Translator;
|
|
9375
12600
|
const styles$1 = theme => ({
|
|
9376
12601
|
main: {
|
|
9377
12602
|
color: color.text(),
|
|
@@ -9411,6 +12636,11 @@ const styles$1 = theme => ({
|
|
|
9411
12636
|
width: '1px',
|
|
9412
12637
|
height: '1px',
|
|
9413
12638
|
overflow: 'hidden'
|
|
12639
|
+
},
|
|
12640
|
+
errorText: {
|
|
12641
|
+
fontSize: theme.typography.fontSize - 2,
|
|
12642
|
+
color: theme.palette.error.main,
|
|
12643
|
+
paddingTop: theme.spacing.unit
|
|
9414
12644
|
}
|
|
9415
12645
|
});
|
|
9416
12646
|
class MultipleChoice$1 extends React$2.Component {
|
|
@@ -9436,7 +12666,9 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9436
12666
|
animationsDisabled: PropTypes$1.bool,
|
|
9437
12667
|
language: PropTypes$1.string,
|
|
9438
12668
|
onShowCorrectToggle: PropTypes$1.func,
|
|
9439
|
-
isSelectionButtonBelow: PropTypes$1.bool
|
|
12669
|
+
isSelectionButtonBelow: PropTypes$1.bool,
|
|
12670
|
+
minSelections: PropTypes$1.number,
|
|
12671
|
+
maxSelections: PropTypes$1.number
|
|
9440
12672
|
};
|
|
9441
12673
|
}
|
|
9442
12674
|
constructor(props) {
|
|
@@ -9444,7 +12676,6 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9444
12676
|
MultipleChoice$1.prototype.__init.call(this);
|
|
9445
12677
|
MultipleChoice$1.prototype.__init2.call(this);
|
|
9446
12678
|
MultipleChoice$1.prototype.__init3.call(this);
|
|
9447
|
-
MultipleChoice$1.prototype.__init4.call(this);
|
|
9448
12679
|
this.state = {
|
|
9449
12680
|
selectedValue: null,
|
|
9450
12681
|
selectedValues: [],
|
|
@@ -9458,29 +12689,31 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9458
12689
|
}
|
|
9459
12690
|
__init() {
|
|
9460
12691
|
this.handleChange = event => {
|
|
9461
|
-
const target = event.target;
|
|
9462
|
-
this.setState({
|
|
9463
|
-
selectedValue: target.value
|
|
9464
|
-
});
|
|
9465
|
-
};
|
|
9466
|
-
}
|
|
9467
|
-
__init2() {
|
|
9468
|
-
this.handleChangeCheckboxes = event => {
|
|
9469
12692
|
const {value, checked} = event.target;
|
|
9470
|
-
this.
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
}
|
|
9475
|
-
|
|
12693
|
+
const {choiceMode, maxSelections, onChoiceChanged} = this.props;
|
|
12694
|
+
if (choiceMode === 'radio') {
|
|
12695
|
+
this.setState({
|
|
12696
|
+
selectedValue: value
|
|
12697
|
+
});
|
|
12698
|
+
} else {
|
|
12699
|
+
const {selectedValues} = this.state;
|
|
12700
|
+
if (checked && selectedValues.length >= maxSelections) {
|
|
12701
|
+
return;
|
|
9476
12702
|
}
|
|
9477
|
-
|
|
9478
|
-
selectedValues
|
|
9479
|
-
|
|
12703
|
+
this.setState(prevState => {
|
|
12704
|
+
const selectedValues = checked ? [...prevState.selectedValues, value] : prevState.selectedValues.filter(currentValue => currentValue !== value);
|
|
12705
|
+
return {
|
|
12706
|
+
selectedValues
|
|
12707
|
+
};
|
|
12708
|
+
});
|
|
12709
|
+
}
|
|
12710
|
+
onChoiceChanged({
|
|
12711
|
+
value,
|
|
12712
|
+
selected: checked
|
|
9480
12713
|
});
|
|
9481
12714
|
};
|
|
9482
12715
|
}
|
|
9483
|
-
|
|
12716
|
+
__init2() {
|
|
9484
12717
|
this.onToggle = () => {
|
|
9485
12718
|
if (this.props.mode === 'evaluate') {
|
|
9486
12719
|
this.setState({
|
|
@@ -9522,7 +12755,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9522
12755
|
}
|
|
9523
12756
|
return '';
|
|
9524
12757
|
}
|
|
9525
|
-
|
|
12758
|
+
__init3() {
|
|
9526
12759
|
this.getCorrectness = (choice = {}) => {
|
|
9527
12760
|
const isCorrect = choice.correct;
|
|
9528
12761
|
const isChecked = this.isSelected(choice.value);
|
|
@@ -9563,25 +12796,26 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9563
12796
|
__self: this,
|
|
9564
12797
|
__source: {
|
|
9565
12798
|
fileName: _jsxFileName$1,
|
|
9566
|
-
lineNumber:
|
|
12799
|
+
lineNumber: 224
|
|
9567
12800
|
}
|
|
9568
12801
|
}, "Multiple Choice Question") : React$2.createElement('h2', {
|
|
9569
12802
|
className: classes.srOnly,
|
|
9570
12803
|
__self: this,
|
|
9571
12804
|
__source: {
|
|
9572
12805
|
fileName: _jsxFileName$1,
|
|
9573
|
-
lineNumber:
|
|
12806
|
+
lineNumber: 226
|
|
9574
12807
|
}
|
|
9575
12808
|
}, "Multiple Select Question");
|
|
9576
12809
|
}
|
|
9577
12810
|
render() {
|
|
9578
|
-
const {mode, disabled, className, choices = [], choiceMode, gridColumns, partLabel, prompt,
|
|
12811
|
+
const {mode, disabled, className, choices = [], choiceMode, gridColumns, partLabel, prompt, responseCorrect, teacherInstructions, classes, alwaysShowCorrect, animationsDisabled, language, isSelectionButtonBelow, minSelections, maxSelections, session} = this.props;
|
|
9579
12812
|
const {showCorrect} = this.state;
|
|
9580
12813
|
const isEvaluateMode = mode === 'evaluate';
|
|
9581
12814
|
const showCorrectAnswerToggle = isEvaluateMode && !responseCorrect;
|
|
9582
12815
|
const columnsStyle = gridColumns > 1 ? {
|
|
9583
12816
|
gridTemplateColumns: `repeat(${gridColumns}, 1fr)`
|
|
9584
12817
|
} : undefined;
|
|
12818
|
+
const selections = session.value && session.value.length || 0;
|
|
9585
12819
|
const teacherInstructionsDiv = React$2.createElement(PreviewPrompt, {
|
|
9586
12820
|
tagName: "div",
|
|
9587
12821
|
className: "prompt",
|
|
@@ -9590,7 +12824,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9590
12824
|
__self: this,
|
|
9591
12825
|
__source: {
|
|
9592
12826
|
fileName: _jsxFileName$1,
|
|
9593
|
-
lineNumber:
|
|
12827
|
+
lineNumber: 258
|
|
9594
12828
|
}
|
|
9595
12829
|
});
|
|
9596
12830
|
return React$2.createElement('div', {
|
|
@@ -9598,21 +12832,21 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9598
12832
|
__self: this,
|
|
9599
12833
|
__source: {
|
|
9600
12834
|
fileName: _jsxFileName$1,
|
|
9601
|
-
lineNumber:
|
|
12835
|
+
lineNumber: 267
|
|
9602
12836
|
}
|
|
9603
12837
|
}, partLabel && React$2.createElement('h3', {
|
|
9604
12838
|
className: classes.partLabel,
|
|
9605
12839
|
__self: this,
|
|
9606
12840
|
__source: {
|
|
9607
12841
|
fileName: _jsxFileName$1,
|
|
9608
|
-
lineNumber:
|
|
12842
|
+
lineNumber: 268
|
|
9609
12843
|
}
|
|
9610
12844
|
}, partLabel), this.renderHeading(), teacherInstructions && React$2.createElement('div', {
|
|
9611
12845
|
className: classes.teacherInstructions,
|
|
9612
12846
|
__self: this,
|
|
9613
12847
|
__source: {
|
|
9614
12848
|
fileName: _jsxFileName$1,
|
|
9615
|
-
lineNumber:
|
|
12849
|
+
lineNumber: 273
|
|
9616
12850
|
}
|
|
9617
12851
|
}, !animationsDisabled ? React$2.createElement(Collapsible, {
|
|
9618
12852
|
labels: {
|
|
@@ -9622,14 +12856,14 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9622
12856
|
__self: this,
|
|
9623
12857
|
__source: {
|
|
9624
12858
|
fileName: _jsxFileName$1,
|
|
9625
|
-
lineNumber:
|
|
12859
|
+
lineNumber: 275
|
|
9626
12860
|
}
|
|
9627
12861
|
}, teacherInstructionsDiv) : teacherInstructionsDiv), React$2.createElement('fieldset', {
|
|
9628
12862
|
className: classes.fieldset,
|
|
9629
12863
|
__self: this,
|
|
9630
12864
|
__source: {
|
|
9631
12865
|
fileName: _jsxFileName$1,
|
|
9632
|
-
lineNumber:
|
|
12866
|
+
lineNumber: 289
|
|
9633
12867
|
}
|
|
9634
12868
|
}, React$2.createElement(PreviewPrompt, {
|
|
9635
12869
|
className: "prompt",
|
|
@@ -9639,7 +12873,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9639
12873
|
__self: this,
|
|
9640
12874
|
__source: {
|
|
9641
12875
|
fileName: _jsxFileName$1,
|
|
9642
|
-
lineNumber:
|
|
12876
|
+
lineNumber: 290
|
|
9643
12877
|
}
|
|
9644
12878
|
}), !alwaysShowCorrect && React$2.createElement(CorrectAnswerToggle, {
|
|
9645
12879
|
show: showCorrectAnswerToggle,
|
|
@@ -9649,7 +12883,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9649
12883
|
__self: this,
|
|
9650
12884
|
__source: {
|
|
9651
12885
|
fileName: _jsxFileName$1,
|
|
9652
|
-
lineNumber:
|
|
12886
|
+
lineNumber: 293
|
|
9653
12887
|
}
|
|
9654
12888
|
}), React$2.createElement('div', {
|
|
9655
12889
|
className: classNames({
|
|
@@ -9660,7 +12894,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9660
12894
|
__self: this,
|
|
9661
12895
|
__source: {
|
|
9662
12896
|
fileName: _jsxFileName$1,
|
|
9663
|
-
lineNumber:
|
|
12897
|
+
lineNumber: 301
|
|
9664
12898
|
}
|
|
9665
12899
|
}, choices.map((choice, index) => React$2.createElement(StyledChoice, {
|
|
9666
12900
|
choicesLayout: this.props.choicesLayout,
|
|
@@ -9673,8 +12907,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9673
12907
|
isEvaluateMode: isEvaluateMode,
|
|
9674
12908
|
choiceMode: choiceMode,
|
|
9675
12909
|
disabled: disabled,
|
|
9676
|
-
|
|
9677
|
-
onChoiceChanged: this.props.choiceMode === 'radio' ? this.handleChange : this.handleChangeCheckboxes,
|
|
12910
|
+
onChoiceChanged: this.handleChange,
|
|
9678
12911
|
hideTick: choice.hideTick,
|
|
9679
12912
|
checked: this.getChecked(choice),
|
|
9680
12913
|
correctness: isEvaluateMode ? this.getCorrectness(choice) : undefined,
|
|
@@ -9683,9 +12916,29 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9683
12916
|
__self: this,
|
|
9684
12917
|
__source: {
|
|
9685
12918
|
fileName: _jsxFileName$1,
|
|
9686
|
-
lineNumber:
|
|
12919
|
+
lineNumber: 309
|
|
12920
|
+
}
|
|
12921
|
+
})))), choiceMode === 'checkbox' && selections < minSelections && React$2.createElement('div', {
|
|
12922
|
+
className: classes.errorText,
|
|
12923
|
+
__self: this,
|
|
12924
|
+
__source: {
|
|
12925
|
+
fileName: _jsxFileName$1,
|
|
12926
|
+
lineNumber: 332
|
|
12927
|
+
}
|
|
12928
|
+
}, translator.t(`translation:multipleChoice:minSelections_${minSelections === 1 ? 'one' : 'other'}`, {
|
|
12929
|
+
lng: language,
|
|
12930
|
+
minSelections
|
|
12931
|
+
})), choiceMode === 'checkbox' && selections >= maxSelections && React$2.createElement('div', {
|
|
12932
|
+
className: classes.errorText,
|
|
12933
|
+
__self: this,
|
|
12934
|
+
__source: {
|
|
12935
|
+
fileName: _jsxFileName$1,
|
|
12936
|
+
lineNumber: 340
|
|
9687
12937
|
}
|
|
9688
|
-
}
|
|
12938
|
+
}, translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {
|
|
12939
|
+
lng: language,
|
|
12940
|
+
maxSelections
|
|
12941
|
+
})));
|
|
9689
12942
|
}
|
|
9690
12943
|
}
|
|
9691
12944
|
MultipleChoice$1.__initStatic();
|
|
@@ -9798,7 +13051,20 @@ const {debounce: debounce} = _dll_lodash;
|
|
|
9798
13051
|
const debug$1 = _dll_debug;
|
|
9799
13052
|
const {renderMath: renderMath} = _dll_pie_lib__pie_toolbox_math_rendering_accessible;
|
|
9800
13053
|
const log$1 = debug$1('pie-ui:multiple-choice');
|
|
9801
|
-
const isComplete =
|
|
13054
|
+
const isComplete = (session, model) => {
|
|
13055
|
+
if (!session || !session.value) {
|
|
13056
|
+
return false;
|
|
13057
|
+
}
|
|
13058
|
+
const {choiceMode, minSelections, maxSelections} = model || ({});
|
|
13059
|
+
const selections = session.value.length || 0;
|
|
13060
|
+
if (choiceMode === 'radio') {
|
|
13061
|
+
return !!selections;
|
|
13062
|
+
}
|
|
13063
|
+
if (selections < minSelections || selections > maxSelections) {
|
|
13064
|
+
return false;
|
|
13065
|
+
}
|
|
13066
|
+
return true;
|
|
13067
|
+
};
|
|
9802
13068
|
class MultipleChoice extends HTMLElement {
|
|
9803
13069
|
constructor() {
|
|
9804
13070
|
super();
|
|
@@ -9831,7 +13097,7 @@ class MultipleChoice extends HTMLElement {
|
|
|
9831
13097
|
bubbles: true,
|
|
9832
13098
|
composed: true,
|
|
9833
13099
|
detail: {
|
|
9834
|
-
complete: isComplete(this._session),
|
|
13100
|
+
complete: isComplete(this._session, this._model),
|
|
9835
13101
|
component: this.tagName.toLowerCase()
|
|
9836
13102
|
}
|
|
9837
13103
|
});
|
|
@@ -9842,7 +13108,7 @@ class MultipleChoice extends HTMLElement {
|
|
|
9842
13108
|
bubbles: true,
|
|
9843
13109
|
composed: true,
|
|
9844
13110
|
detail: {
|
|
9845
|
-
complete: isComplete(this._session),
|
|
13111
|
+
complete: isComplete(this._session, this._model),
|
|
9846
13112
|
component: this.tagName.toLowerCase(),
|
|
9847
13113
|
hasModel: this._model !== undefined
|
|
9848
13114
|
}
|