@twab/visualization 0.2.1 → 0.2.3
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/dist/visualization.common.js +292 -3122
- package/dist/visualization.common.js.map +1 -1
- package/dist/visualization.css +1 -1
- package/dist/visualization.umd.js +292 -3122
- package/dist/visualization.umd.js.map +1 -1
- package/dist/visualization.umd.min.js +3 -3
- package/dist/visualization.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,172 +11,6 @@
|
|
|
11
11
|
return /******/ (function() { // webpackBootstrap
|
|
12
12
|
/******/ var __webpack_modules__ = ({
|
|
13
13
|
|
|
14
|
-
/***/ 3875:
|
|
15
|
-
/***/ (function(__unused_webpack_module, exports) {
|
|
16
|
-
|
|
17
|
-
"use strict";
|
|
18
|
-
var __webpack_unused_export__;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
__webpack_unused_export__ = ({
|
|
22
|
-
value: true
|
|
23
|
-
});
|
|
24
|
-
function install(Vue, {
|
|
25
|
-
i18next,
|
|
26
|
-
rerenderOn = ['languageChanged', 'loaded', 'added', 'removed']
|
|
27
|
-
}) {
|
|
28
|
-
const genericT = i18next.t.bind(i18next);
|
|
29
|
-
const changeTracker = Vue.observable({
|
|
30
|
-
lastI18nChange: new Date()
|
|
31
|
-
});
|
|
32
|
-
const invalidate = () => changeTracker.lastI18nChange = new Date();
|
|
33
|
-
const usingTranslation = () => changeTracker.lastI18nChange;
|
|
34
|
-
rerenderOn.forEach(event => {
|
|
35
|
-
var _a;
|
|
36
|
-
switch (event) {
|
|
37
|
-
case 'added':
|
|
38
|
-
case 'removed':
|
|
39
|
-
(_a = i18next.store) === null || _a === void 0 ? void 0 : _a.on(event, invalidate);
|
|
40
|
-
break;
|
|
41
|
-
default:
|
|
42
|
-
i18next.on(event, invalidate);
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
Vue.mixin({
|
|
47
|
-
beforeCreate() {
|
|
48
|
-
var _a, _b;
|
|
49
|
-
const options = this.$options;
|
|
50
|
-
if (!options.__i18n && !options.i18nOptions) {
|
|
51
|
-
this.__translate = undefined;
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const name = this.$options.name;
|
|
55
|
-
const rand = (Math.random() * 10 ** 8 | 0).toString();
|
|
56
|
-
const localNs = [name, rand].filter(x => !!x).join("-");
|
|
57
|
-
this.__bundles = [];
|
|
58
|
-
const loadBundle = bundle => {
|
|
59
|
-
Object.entries(bundle).forEach(([lng, resources]) => {
|
|
60
|
-
i18next.addResourceBundle(lng, localNs, resources, true, false);
|
|
61
|
-
this.__bundles.push([lng, localNs]);
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
(_a = options.__i18n) === null || _a === void 0 ? void 0 : _a.forEach(bundle => {
|
|
65
|
-
loadBundle(JSON.parse(bundle));
|
|
66
|
-
});
|
|
67
|
-
let {
|
|
68
|
-
lng,
|
|
69
|
-
ns,
|
|
70
|
-
keyPrefix
|
|
71
|
-
} = handleI18nOptions(options, loadBundle);
|
|
72
|
-
if ((_b = this.__bundles) === null || _b === void 0 ? void 0 : _b.length) {
|
|
73
|
-
ns = [localNs].concat(ns !== null && ns !== void 0 ? ns : []);
|
|
74
|
-
}
|
|
75
|
-
const t = getTranslationFunction(lng, ns);
|
|
76
|
-
this.__translate = (key, options) => {
|
|
77
|
-
if (!keyPrefix || includesNs(key)) {
|
|
78
|
-
return t(key, options);
|
|
79
|
-
} else {
|
|
80
|
-
return t(keyPrefix + '.' + key, options);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
},
|
|
84
|
-
destroyed() {
|
|
85
|
-
var _a;
|
|
86
|
-
(_a = this.__bundles) === null || _a === void 0 ? void 0 : _a.forEach(([lng, ns]) => i18next.removeResourceBundle(lng, ns));
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
Vue.prototype.$t = function (key, options) {
|
|
90
|
-
var _a;
|
|
91
|
-
usingTranslation();
|
|
92
|
-
if (i18next.isInitialized) {
|
|
93
|
-
return ((_a = this === null || this === void 0 ? void 0 : this.__translate) !== null && _a !== void 0 ? _a : genericT)(key, options);
|
|
94
|
-
} else {
|
|
95
|
-
return key;
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
Vue.prototype.$i18next = typeof Proxy === 'function' ? new Proxy(i18next, {
|
|
99
|
-
get(target, prop) {
|
|
100
|
-
usingTranslation();
|
|
101
|
-
return Reflect.get(target, prop);
|
|
102
|
-
}
|
|
103
|
-
}) : i18next;
|
|
104
|
-
function getTranslationFunction(lng, ns) {
|
|
105
|
-
if (lng) {
|
|
106
|
-
return i18next.getFixedT(lng, ns);
|
|
107
|
-
} else if (ns) {
|
|
108
|
-
return i18next.getFixedT(null, ns);
|
|
109
|
-
} else {
|
|
110
|
-
return genericT;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function includesNs(key) {
|
|
114
|
-
const nsSeparator = i18next.options.nsSeparator;
|
|
115
|
-
return typeof nsSeparator === "string" && key.includes(nsSeparator);
|
|
116
|
-
}
|
|
117
|
-
function handleI18nOptions(options, loadBundle) {
|
|
118
|
-
let lng;
|
|
119
|
-
let ns;
|
|
120
|
-
let keyPrefix;
|
|
121
|
-
if (options.i18nOptions) {
|
|
122
|
-
let messages;
|
|
123
|
-
let namespaces;
|
|
124
|
-
({
|
|
125
|
-
lng,
|
|
126
|
-
namespaces = i18next.options.defaultNS,
|
|
127
|
-
keyPrefix,
|
|
128
|
-
messages
|
|
129
|
-
} = options.i18nOptions);
|
|
130
|
-
if (messages) {
|
|
131
|
-
loadBundle(messages);
|
|
132
|
-
}
|
|
133
|
-
ns = typeof namespaces === 'string' ? [namespaces] : namespaces;
|
|
134
|
-
if (ns) {
|
|
135
|
-
i18next.loadNamespaces(ns);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return {
|
|
139
|
-
lng,
|
|
140
|
-
ns,
|
|
141
|
-
keyPrefix
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
const slotNamePattern = new RegExp('{\\s*([a-z0-9\\-]+)\\s*}', 'gi');
|
|
145
|
-
const TranslationComponent = {
|
|
146
|
-
functional: true,
|
|
147
|
-
props: {
|
|
148
|
-
translation: {
|
|
149
|
-
type: String,
|
|
150
|
-
required: true
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
render(_createElement, context) {
|
|
154
|
-
const textNode = context._v;
|
|
155
|
-
const translation = context.props.translation;
|
|
156
|
-
const result = [];
|
|
157
|
-
let match;
|
|
158
|
-
let lastIndex = 0;
|
|
159
|
-
while ((match = slotNamePattern.exec(translation)) !== null) {
|
|
160
|
-
result.push(textNode(translation.substring(lastIndex, match.index)));
|
|
161
|
-
const slot = context.scopedSlots[match[1]];
|
|
162
|
-
if (slot) {
|
|
163
|
-
const nodes = slot({});
|
|
164
|
-
nodes === null || nodes === void 0 ? void 0 : nodes.forEach(n => result.push(n));
|
|
165
|
-
} else {
|
|
166
|
-
result.push(textNode(match[0]));
|
|
167
|
-
}
|
|
168
|
-
lastIndex = slotNamePattern.lastIndex;
|
|
169
|
-
}
|
|
170
|
-
result.push(textNode(translation.substring(lastIndex)));
|
|
171
|
-
return result;
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
Vue.component('i18next', TranslationComponent);
|
|
175
|
-
}
|
|
176
|
-
exports.Z = install;
|
|
177
|
-
|
|
178
|
-
/***/ }),
|
|
179
|
-
|
|
180
14
|
/***/ 477:
|
|
181
15
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
182
16
|
|
|
@@ -10455,130 +10289,12 @@ module.exports = toPlainObject;
|
|
|
10455
10289
|
|
|
10456
10290
|
/***/ }),
|
|
10457
10291
|
|
|
10458
|
-
/***/ 7202:
|
|
10459
|
-
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
10460
|
-
|
|
10461
|
-
var map = {
|
|
10462
|
-
"./1x1.svg": 9685,
|
|
10463
|
-
"./2x1.svg": 5496,
|
|
10464
|
-
"./3x1.svg": 7823,
|
|
10465
|
-
"./3x2.svg": 7022,
|
|
10466
|
-
"./4x1.svg": 6809,
|
|
10467
|
-
"./4x2.svg": 4389,
|
|
10468
|
-
"./5x1.svg": 9668,
|
|
10469
|
-
"./5x2.svg": 8243,
|
|
10470
|
-
"./6x1.svg": 3108,
|
|
10471
|
-
"./6x2.svg": 9145
|
|
10472
|
-
};
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
function webpackContext(req) {
|
|
10476
|
-
var id = webpackContextResolve(req);
|
|
10477
|
-
return __webpack_require__(id);
|
|
10478
|
-
}
|
|
10479
|
-
function webpackContextResolve(req) {
|
|
10480
|
-
if(!__webpack_require__.o(map, req)) {
|
|
10481
|
-
var e = new Error("Cannot find module '" + req + "'");
|
|
10482
|
-
e.code = 'MODULE_NOT_FOUND';
|
|
10483
|
-
throw e;
|
|
10484
|
-
}
|
|
10485
|
-
return map[req];
|
|
10486
|
-
}
|
|
10487
|
-
webpackContext.keys = function webpackContextKeys() {
|
|
10488
|
-
return Object.keys(map);
|
|
10489
|
-
};
|
|
10490
|
-
webpackContext.resolve = webpackContextResolve;
|
|
10491
|
-
module.exports = webpackContext;
|
|
10492
|
-
webpackContext.id = 7202;
|
|
10493
|
-
|
|
10494
|
-
/***/ }),
|
|
10495
|
-
|
|
10496
10292
|
/***/ 9583:
|
|
10497
10293
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
10498
10294
|
|
|
10499
10295
|
"use strict";
|
|
10500
10296
|
module.exports = __webpack_require__.p + "img/dummy.ec1ab0d6.svg";
|
|
10501
10297
|
|
|
10502
|
-
/***/ }),
|
|
10503
|
-
|
|
10504
|
-
/***/ 9685:
|
|
10505
|
-
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
10506
|
-
|
|
10507
|
-
"use strict";
|
|
10508
|
-
module.exports = __webpack_require__.p + "img/1x1.f865594b.svg";
|
|
10509
|
-
|
|
10510
|
-
/***/ }),
|
|
10511
|
-
|
|
10512
|
-
/***/ 5496:
|
|
10513
|
-
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
10514
|
-
|
|
10515
|
-
"use strict";
|
|
10516
|
-
module.exports = __webpack_require__.p + "img/2x1.6bc80fec.svg";
|
|
10517
|
-
|
|
10518
|
-
/***/ }),
|
|
10519
|
-
|
|
10520
|
-
/***/ 7823:
|
|
10521
|
-
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
10522
|
-
|
|
10523
|
-
"use strict";
|
|
10524
|
-
module.exports = __webpack_require__.p + "img/3x1.8fe1c055.svg";
|
|
10525
|
-
|
|
10526
|
-
/***/ }),
|
|
10527
|
-
|
|
10528
|
-
/***/ 7022:
|
|
10529
|
-
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
10530
|
-
|
|
10531
|
-
"use strict";
|
|
10532
|
-
module.exports = __webpack_require__.p + "img/3x2.f5153612.svg";
|
|
10533
|
-
|
|
10534
|
-
/***/ }),
|
|
10535
|
-
|
|
10536
|
-
/***/ 6809:
|
|
10537
|
-
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
10538
|
-
|
|
10539
|
-
"use strict";
|
|
10540
|
-
module.exports = __webpack_require__.p + "img/4x1.22f434b0.svg";
|
|
10541
|
-
|
|
10542
|
-
/***/ }),
|
|
10543
|
-
|
|
10544
|
-
/***/ 4389:
|
|
10545
|
-
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
10546
|
-
|
|
10547
|
-
"use strict";
|
|
10548
|
-
module.exports = __webpack_require__.p + "img/4x2.3810a721.svg";
|
|
10549
|
-
|
|
10550
|
-
/***/ }),
|
|
10551
|
-
|
|
10552
|
-
/***/ 9668:
|
|
10553
|
-
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
10554
|
-
|
|
10555
|
-
"use strict";
|
|
10556
|
-
module.exports = __webpack_require__.p + "img/5x1.c0878e49.svg";
|
|
10557
|
-
|
|
10558
|
-
/***/ }),
|
|
10559
|
-
|
|
10560
|
-
/***/ 8243:
|
|
10561
|
-
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
10562
|
-
|
|
10563
|
-
"use strict";
|
|
10564
|
-
module.exports = __webpack_require__.p + "img/5x2.b70b5289.svg";
|
|
10565
|
-
|
|
10566
|
-
/***/ }),
|
|
10567
|
-
|
|
10568
|
-
/***/ 3108:
|
|
10569
|
-
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
10570
|
-
|
|
10571
|
-
"use strict";
|
|
10572
|
-
module.exports = __webpack_require__.p + "img/6x1.28b9840c.svg";
|
|
10573
|
-
|
|
10574
|
-
/***/ }),
|
|
10575
|
-
|
|
10576
|
-
/***/ 9145:
|
|
10577
|
-
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
10578
|
-
|
|
10579
|
-
"use strict";
|
|
10580
|
-
module.exports = __webpack_require__.p + "img/6x2.6b117ba7.svg";
|
|
10581
|
-
|
|
10582
10298
|
/***/ })
|
|
10583
10299
|
|
|
10584
10300
|
/******/ });
|
|
@@ -10707,19 +10423,19 @@ if (typeof window !== 'undefined') {
|
|
|
10707
10423
|
// Indicate to webpack that this file can be concatenated
|
|
10708
10424
|
/* harmony default export */ var setPublicPath = (null);
|
|
10709
10425
|
|
|
10710
|
-
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/Visualization.vue?vue&type=template&id=
|
|
10426
|
+
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/Visualization.vue?vue&type=template&id=f4735614&scoped=true&
|
|
10711
10427
|
var render = function render() {
|
|
10712
10428
|
var _vm = this,
|
|
10713
10429
|
_c = _vm._self._c;
|
|
10714
10430
|
return _c('div', {
|
|
10715
|
-
staticClass: "row",
|
|
10431
|
+
staticClass: "visualization-row",
|
|
10716
10432
|
attrs: {
|
|
10717
10433
|
"id": "visualization-container"
|
|
10718
10434
|
},
|
|
10719
10435
|
on: {
|
|
10720
10436
|
"click": _vm.framesClicked
|
|
10721
10437
|
}
|
|
10722
|
-
}, [_vm.active && _vm.canInsertTime ? _c('GlobalEvents', {
|
|
10438
|
+
}, [_vm.active && _vm.canInsertTime && _vm.settingsClosed ? _c('GlobalEvents', {
|
|
10723
10439
|
on: {
|
|
10724
10440
|
"keydown": [function ($event) {
|
|
10725
10441
|
if (!$event.type.indexOf('key') && $event.keyCode !== 45) return null;
|
|
@@ -10729,7 +10445,7 @@ var render = function render() {
|
|
|
10729
10445
|
return _vm.insertTime.apply(null, arguments);
|
|
10730
10446
|
}]
|
|
10731
10447
|
}
|
|
10732
|
-
}) : _vm._e(), _vm.active ? _c('GlobalEvents', {
|
|
10448
|
+
}) : _vm._e(), _vm.active && _vm.settingsClosed ? _c('GlobalEvents', {
|
|
10733
10449
|
on: {
|
|
10734
10450
|
"keydown": [function ($event) {
|
|
10735
10451
|
if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "left", 37, $event.key, ["Left", "ArrowLeft"])) return null;
|
|
@@ -10741,6 +10457,11 @@ var render = function render() {
|
|
|
10741
10457
|
if ('button' in $event && $event.button !== 2) return null;
|
|
10742
10458
|
$event.preventDefault();
|
|
10743
10459
|
return _vm.arrowRight.apply(null, arguments);
|
|
10460
|
+
}, function ($event) {
|
|
10461
|
+
if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "page-down", undefined, $event.key, undefined)) return null;
|
|
10462
|
+
if (!$event.shiftKey) return null;
|
|
10463
|
+
$event.preventDefault();
|
|
10464
|
+
return _vm.nextLoopActivate.apply(null, arguments);
|
|
10744
10465
|
}, function ($event) {
|
|
10745
10466
|
if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "page-down", undefined, $event.key, undefined)) return null;
|
|
10746
10467
|
$event.preventDefault();
|
|
@@ -10749,6 +10470,11 @@ var render = function render() {
|
|
|
10749
10470
|
if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "page-up", undefined, $event.key, undefined)) return null;
|
|
10750
10471
|
$event.preventDefault();
|
|
10751
10472
|
return _vm.prev.apply(null, arguments);
|
|
10473
|
+
}, function ($event) {
|
|
10474
|
+
if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "page-up", undefined, $event.key, undefined)) return null;
|
|
10475
|
+
if (!$event.shiftKey) return null;
|
|
10476
|
+
$event.preventDefault();
|
|
10477
|
+
return _vm.prevLoopActivate.apply(null, arguments);
|
|
10752
10478
|
}, function ($event) {
|
|
10753
10479
|
if (!$event.type.indexOf('key') && $event.keyCode !== 83) return null;
|
|
10754
10480
|
$event.preventDefault();
|
|
@@ -10777,6 +10503,21 @@ var render = function render() {
|
|
|
10777
10503
|
if (!$event.type.indexOf('key') && $event.keyCode !== 76) return null;
|
|
10778
10504
|
$event.preventDefault();
|
|
10779
10505
|
_vm.dialogs.frames = true;
|
|
10506
|
+
}, function ($event) {
|
|
10507
|
+
if (!$event.type.indexOf('key') && $event.keyCode !== 49 && $event.keyCode !== 97) return null;
|
|
10508
|
+
return (() => _vm.secondsPerFrame = 1).apply(null, arguments);
|
|
10509
|
+
}, function ($event) {
|
|
10510
|
+
if (!$event.type.indexOf('key') && $event.keyCode !== 50 && $event.keyCode !== 98) return null;
|
|
10511
|
+
return (() => _vm.secondsPerFrame = 2).apply(null, arguments);
|
|
10512
|
+
}, function ($event) {
|
|
10513
|
+
if (!$event.type.indexOf('key') && $event.keyCode !== 51 && $event.keyCode !== 99) return null;
|
|
10514
|
+
return (() => _vm.secondsPerFrame = 3).apply(null, arguments);
|
|
10515
|
+
}, function ($event) {
|
|
10516
|
+
if (!$event.type.indexOf('key') && $event.keyCode !== 52 && $event.keyCode !== 100) return null;
|
|
10517
|
+
return (() => _vm.secondsPerFrame = 4).apply(null, arguments);
|
|
10518
|
+
}, function ($event) {
|
|
10519
|
+
if (!$event.type.indexOf('key') && $event.keyCode !== 53 && $event.keyCode !== 101) return null;
|
|
10520
|
+
return (() => _vm.secondsPerFrame = 5).apply(null, arguments);
|
|
10780
10521
|
}]
|
|
10781
10522
|
}
|
|
10782
10523
|
}) : _vm._e(), _vm.prevLoop || _vm.nextLoop ? _c('GlobalEvents', {
|
|
@@ -10801,7 +10542,7 @@ var render = function render() {
|
|
|
10801
10542
|
}
|
|
10802
10543
|
}) : _vm._e(), _c('div', {
|
|
10803
10544
|
class: {
|
|
10804
|
-
card: true,
|
|
10545
|
+
'visualization-card': true,
|
|
10805
10546
|
'active-tab': _vm.active
|
|
10806
10547
|
},
|
|
10807
10548
|
staticStyle: {
|
|
@@ -10882,7 +10623,10 @@ var render = function render() {
|
|
|
10882
10623
|
}), _vm._l(_vm.numberOfRows, function (rowNumber) {
|
|
10883
10624
|
return _c('div', {
|
|
10884
10625
|
key: 'row-' + rowNumber,
|
|
10885
|
-
staticClass: "row",
|
|
10626
|
+
staticClass: "visualization-row",
|
|
10627
|
+
staticStyle: {
|
|
10628
|
+
"padding": "12px"
|
|
10629
|
+
},
|
|
10886
10630
|
attrs: {
|
|
10887
10631
|
"id": 'row-' + rowNumber
|
|
10888
10632
|
}
|
|
@@ -10911,7 +10655,7 @@ var render = function render() {
|
|
|
10911
10655
|
}), _vm._l(_vm.frames.slice(_vm.framesPerRow * (rowNumber - 1), _vm.framesPerRow * rowNumber), function (frame, frameNumber) {
|
|
10912
10656
|
return _c('div', {
|
|
10913
10657
|
key: 'row-' + rowNumber + '-frame-' + frameNumber,
|
|
10914
|
-
staticClass: "col",
|
|
10658
|
+
staticClass: "visualization-col",
|
|
10915
10659
|
class: {
|
|
10916
10660
|
loaderImg: !!frame.img
|
|
10917
10661
|
},
|
|
@@ -10963,8 +10707,8 @@ var render = function render() {
|
|
|
10963
10707
|
};
|
|
10964
10708
|
var staticRenderFns = [];
|
|
10965
10709
|
|
|
10966
|
-
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Frame.vue?vue&type=template&id=
|
|
10967
|
-
var
|
|
10710
|
+
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Frame.vue?vue&type=template&id=efc1ebfe&scoped=true&
|
|
10711
|
+
var Framevue_type_template_id_efc1ebfe_scoped_true_render = function render() {
|
|
10968
10712
|
var _vm = this,
|
|
10969
10713
|
_c = _vm._self._c;
|
|
10970
10714
|
return _c('div', {
|
|
@@ -10977,9 +10721,10 @@ var Framevue_type_template_id_59f2115a_scoped_true_render = function render() {
|
|
|
10977
10721
|
},
|
|
10978
10722
|
style: {
|
|
10979
10723
|
height: `${_vm.maxHeight}px`,
|
|
10980
|
-
width:
|
|
10724
|
+
width: '100%',
|
|
10725
|
+
position: 'relative'
|
|
10981
10726
|
}
|
|
10982
|
-
}, [_vm.active && _vm.activeTab ? _c('GlobalEvents', {
|
|
10727
|
+
}, [_vm.active && _vm.activeTab && _vm.parentComponent.settingsClosed ? _c('GlobalEvents', {
|
|
10983
10728
|
on: {
|
|
10984
10729
|
"keydown": [function ($event) {
|
|
10985
10730
|
if (!$event.type.indexOf('key') && $event.keyCode !== 32) return null;
|
|
@@ -10992,6 +10737,10 @@ var Framevue_type_template_id_59f2115a_scoped_true_render = function render() {
|
|
|
10992
10737
|
}, function ($event) {
|
|
10993
10738
|
if (!$event.type.indexOf('key') && $event.keyCode !== 79) return null;
|
|
10994
10739
|
return _vm.toogleDetailFrame.apply(null, arguments);
|
|
10740
|
+
}, function ($event) {
|
|
10741
|
+
if (!$event.type.indexOf('key') && $event.keyCode !== 13) return null;
|
|
10742
|
+
$event.preventDefault();
|
|
10743
|
+
return _vm.jumpFrameToStart.apply(null, arguments);
|
|
10995
10744
|
}]
|
|
10996
10745
|
}
|
|
10997
10746
|
}) : _vm._e(), _vm.showFrame ? _c('GlobalEvents', {
|
|
@@ -11017,15 +10766,18 @@ var Framevue_type_template_id_59f2115a_scoped_true_render = function render() {
|
|
|
11017
10766
|
"background-color": "#ededed",
|
|
11018
10767
|
"text": _vm.videoIsLoading ? 'A criar vídeo temporário...' : ''
|
|
11019
10768
|
}
|
|
11020
|
-
}),
|
|
10769
|
+
}), _c('div', {
|
|
10770
|
+
staticStyle: {
|
|
10771
|
+
"background-color": "black"
|
|
10772
|
+
}
|
|
10773
|
+
}, [!_vm.loading ? _c('div', {
|
|
11021
10774
|
class: {
|
|
11022
10775
|
'frame-content': _vm.frame.title === -1 || _vm.videoStatus !== _vm.Status.stopped
|
|
11023
10776
|
},
|
|
11024
10777
|
style: {
|
|
11025
10778
|
height: `${_vm.height}px`,
|
|
11026
10779
|
width: `${_vm.width}px`,
|
|
11027
|
-
color: 'white'
|
|
11028
|
-
position: 'relative'
|
|
10780
|
+
color: 'white'
|
|
11029
10781
|
},
|
|
11030
10782
|
on: {
|
|
11031
10783
|
"dblclick": _vm.playOrPause
|
|
@@ -11053,7 +10805,7 @@ var Framevue_type_template_id_59f2115a_scoped_true_render = function render() {
|
|
|
11053
10805
|
}
|
|
11054
10806
|
}) : _vm._e(), _c('div', {
|
|
11055
10807
|
staticClass: "overlay"
|
|
11056
|
-
})]) : _vm._e(), _c('dialog', {
|
|
10808
|
+
})]) : _vm._e()]), _c('dialog', {
|
|
11057
10809
|
ref: "imageDetailsDialog",
|
|
11058
10810
|
class: {
|
|
11059
10811
|
'dummy-frame': _vm.frame.title === -1
|
|
@@ -11068,7 +10820,7 @@ var Framevue_type_template_id_59f2115a_scoped_true_render = function render() {
|
|
|
11068
10820
|
}
|
|
11069
10821
|
})], 1);
|
|
11070
10822
|
};
|
|
11071
|
-
var
|
|
10823
|
+
var Framevue_type_template_id_efc1ebfe_scoped_true_staticRenderFns = [];
|
|
11072
10824
|
|
|
11073
10825
|
// EXTERNAL MODULE: ./node_modules/vue-loading-twa/lib/vue-loading-twa.min.js
|
|
11074
10826
|
var vue_loading_twa_min = __webpack_require__(3396);
|
|
@@ -11147,7 +10899,8 @@ const Status = Object.freeze({
|
|
|
11147
10899
|
videoUrlString: '',
|
|
11148
10900
|
parentComponent: null,
|
|
11149
10901
|
videoIsLoading: false,
|
|
11150
|
-
currentBlock: null
|
|
10902
|
+
currentBlock: null,
|
|
10903
|
+
lastTimeEnterPressed: null
|
|
11151
10904
|
};
|
|
11152
10905
|
},
|
|
11153
10906
|
created() {
|
|
@@ -11161,6 +10914,15 @@ const Status = Object.freeze({
|
|
|
11161
10914
|
}
|
|
11162
10915
|
},
|
|
11163
10916
|
methods: {
|
|
10917
|
+
jumpFrameToStart() {
|
|
10918
|
+
if (this.active) {
|
|
10919
|
+
const currentTime = new Date().getTime();
|
|
10920
|
+
if (currentTime - this.lastTimeEnterPressed <= 500) {
|
|
10921
|
+
this.parentComponent.changeHour(this.parentComponent.convertToAudienceTime(this.frame.time));
|
|
10922
|
+
}
|
|
10923
|
+
this.lastTimeEnterPressed = currentTime;
|
|
10924
|
+
}
|
|
10925
|
+
},
|
|
11164
10926
|
changeSettings(value) {
|
|
11165
10927
|
this.videoCurrentTime = value;
|
|
11166
10928
|
},
|
|
@@ -11277,10 +11039,10 @@ const Status = Object.freeze({
|
|
|
11277
11039
|
});
|
|
11278
11040
|
;// CONCATENATED MODULE: ./src/components/Frame.vue?vue&type=script&lang=js&
|
|
11279
11041
|
/* harmony default export */ var components_Framevue_type_script_lang_js_ = (Framevue_type_script_lang_js_);
|
|
11280
|
-
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Frame.vue?vue&type=style&index=0&id=
|
|
11042
|
+
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Frame.vue?vue&type=style&index=0&id=efc1ebfe&prod&scoped=true&lang=css&
|
|
11281
11043
|
// extracted by mini-css-extract-plugin
|
|
11282
11044
|
|
|
11283
|
-
;// CONCATENATED MODULE: ./src/components/Frame.vue?vue&type=style&index=0&id=
|
|
11045
|
+
;// CONCATENATED MODULE: ./src/components/Frame.vue?vue&type=style&index=0&id=efc1ebfe&prod&scoped=true&lang=css&
|
|
11284
11046
|
|
|
11285
11047
|
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
|
|
11286
11048
|
/* globals __VUE_SSR_CONTEXT__ */
|
|
@@ -11391,11 +11153,11 @@ function normalizeComponent(
|
|
|
11391
11153
|
|
|
11392
11154
|
var component = normalizeComponent(
|
|
11393
11155
|
components_Framevue_type_script_lang_js_,
|
|
11394
|
-
|
|
11395
|
-
|
|
11156
|
+
Framevue_type_template_id_efc1ebfe_scoped_true_render,
|
|
11157
|
+
Framevue_type_template_id_efc1ebfe_scoped_true_staticRenderFns,
|
|
11396
11158
|
false,
|
|
11397
11159
|
null,
|
|
11398
|
-
"
|
|
11160
|
+
"efc1ebfe",
|
|
11399
11161
|
null
|
|
11400
11162
|
|
|
11401
11163
|
)
|
|
@@ -14978,22 +14740,25 @@ FramesInterface.prototype.getVideoRequestByUrl = function (url_path, t) {
|
|
|
14978
14740
|
return url + 'StreamFromVideo?url=' + url_path + params + '#t=' + t;
|
|
14979
14741
|
};
|
|
14980
14742
|
/* harmony default export */ var utils_FramesInterface = (FramesInterface);
|
|
14981
|
-
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Commands.vue?vue&type=template&id=
|
|
14982
|
-
var
|
|
14743
|
+
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Commands.vue?vue&type=template&id=156a7328&
|
|
14744
|
+
var Commandsvue_type_template_id_156a7328_render = function render() {
|
|
14983
14745
|
var _vm = this,
|
|
14984
14746
|
_c = _vm._self._c;
|
|
14985
14747
|
return _c('div', {
|
|
14986
|
-
staticClass: "col pa-0",
|
|
14748
|
+
staticClass: "visualization-col pa-0",
|
|
14749
|
+
staticStyle: {
|
|
14750
|
+
"border-top-right-radius": "6px"
|
|
14751
|
+
},
|
|
14987
14752
|
attrs: {
|
|
14988
14753
|
"id": "command-bar"
|
|
14989
14754
|
}
|
|
14990
14755
|
}, [_vm.commandBarShow ? _c('div', {
|
|
14991
|
-
staticClass: "row justify-center"
|
|
14756
|
+
staticClass: "visualization-row visualization-justify-center"
|
|
14992
14757
|
}, _vm._l(_vm.commandBarBtns, function (btn, index) {
|
|
14993
14758
|
return _c('div', {
|
|
14994
14759
|
key: 'command-btn-' + index
|
|
14995
14760
|
}, [!btn ? _c('hr', {
|
|
14996
|
-
staticClass: "divider vertical",
|
|
14761
|
+
staticClass: "visualization-divider vertical",
|
|
14997
14762
|
staticStyle: {
|
|
14998
14763
|
"margin": "0 4px"
|
|
14999
14764
|
}
|
|
@@ -15018,10 +14783,10 @@ var Commandsvue_type_template_id_e71d900a_render = function render() {
|
|
|
15018
14783
|
}
|
|
15019
14784
|
})], 1) : _vm._e()]);
|
|
15020
14785
|
}), 0) : _vm._e(), _c('hr', {
|
|
15021
|
-
staticClass: "divider"
|
|
14786
|
+
staticClass: "visualization-divider"
|
|
15022
14787
|
})]);
|
|
15023
14788
|
};
|
|
15024
|
-
var
|
|
14789
|
+
var Commandsvue_type_template_id_156a7328_staticRenderFns = [];
|
|
15025
14790
|
|
|
15026
14791
|
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Commands.vue?vue&type=script&lang=js&
|
|
15027
14792
|
/* harmony default export */ var Commandsvue_type_script_lang_js_ = ({
|
|
@@ -15168,8 +14933,8 @@ var Commandsvue_type_template_id_e71d900a_staticRenderFns = [];
|
|
|
15168
14933
|
;
|
|
15169
14934
|
var Commands_component = normalizeComponent(
|
|
15170
14935
|
components_Commandsvue_type_script_lang_js_,
|
|
15171
|
-
|
|
15172
|
-
|
|
14936
|
+
Commandsvue_type_template_id_156a7328_render,
|
|
14937
|
+
Commandsvue_type_template_id_156a7328_staticRenderFns,
|
|
15173
14938
|
false,
|
|
15174
14939
|
null,
|
|
15175
14940
|
null,
|
|
@@ -15178,20 +14943,18 @@ var Commands_component = normalizeComponent(
|
|
|
15178
14943
|
)
|
|
15179
14944
|
|
|
15180
14945
|
/* harmony default export */ var Commands = (Commands_component.exports);
|
|
15181
|
-
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Infos.vue?vue&type=template&id=
|
|
15182
|
-
var
|
|
14946
|
+
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Infos.vue?vue&type=template&id=363c35bb&
|
|
14947
|
+
var Infosvue_type_template_id_363c35bb_render = function render() {
|
|
15183
14948
|
var _vm = this,
|
|
15184
14949
|
_c = _vm._self._c;
|
|
15185
14950
|
return _c('div', {
|
|
15186
|
-
staticClass: "row justify-center align-center",
|
|
15187
|
-
|
|
15188
|
-
"padding": "4px"
|
|
15189
|
-
},
|
|
14951
|
+
staticClass: "visualization-row visualization-justify-center visualization-align-center",
|
|
14952
|
+
style: !_vm.commandsShow ? 'border-top-right-radius: 6px; padding: 4px' : 'padding: 4px',
|
|
15190
14953
|
attrs: {
|
|
15191
14954
|
"id": "info-bar"
|
|
15192
14955
|
}
|
|
15193
14956
|
}, [_c('span', [_vm._v(" " + _vm._s(_vm.playbackRate) + "x ")]), _c('hr', {
|
|
15194
|
-
staticClass: "divider vertical",
|
|
14957
|
+
staticClass: "visualization-divider vertical",
|
|
15195
14958
|
staticStyle: {
|
|
15196
14959
|
"margin": "0 8px"
|
|
15197
14960
|
}
|
|
@@ -15200,14 +14963,14 @@ var Infosvue_type_template_id_c15b4388_render = function render() {
|
|
|
15200
14963
|
hour_ini: _vm.convertToAudienceTime(_vm.hourIni),
|
|
15201
14964
|
hour_end: _vm.convertToAudienceTime(_vm.hourEnd)
|
|
15202
14965
|
})) + " ")]), _c('hr', {
|
|
15203
|
-
staticClass: "divider vertical",
|
|
14966
|
+
staticClass: "visualization-divider vertical",
|
|
15204
14967
|
staticStyle: {
|
|
15205
14968
|
"margin": "0 8px"
|
|
15206
14969
|
}
|
|
15207
14970
|
}), _c('span', [_vm._v(" " + _vm._s(_vm.$t('infoBar.interval', {
|
|
15208
14971
|
seconds: _vm.secondsPerFrame
|
|
15209
14972
|
})) + " ")]), _c('hr', {
|
|
15210
|
-
staticClass: "divider vertical",
|
|
14973
|
+
staticClass: "visualization-divider vertical",
|
|
15211
14974
|
staticStyle: {
|
|
15212
14975
|
"margin": "0 8px"
|
|
15213
14976
|
}
|
|
@@ -15215,17 +14978,17 @@ var Infosvue_type_template_id_c15b4388_render = function render() {
|
|
|
15215
14978
|
time1: _vm.convertToAudienceTime(_vm.blockStartTime),
|
|
15216
14979
|
time2: _vm.convertToAudienceTime(_vm.blockTotalTime)
|
|
15217
14980
|
})) + " ")]), _c('hr', {
|
|
15218
|
-
staticClass: "divider vertical",
|
|
14981
|
+
staticClass: "visualization-divider vertical",
|
|
15219
14982
|
staticStyle: {
|
|
15220
14983
|
"margin": "0 8px"
|
|
15221
14984
|
}
|
|
15222
14985
|
}), _vm._v(" " + _vm._s(_vm.framesPerRow * _vm.numberOfRows) + " "), _c('hr', {
|
|
15223
|
-
staticClass: "divider vertical",
|
|
14986
|
+
staticClass: "visualization-divider vertical",
|
|
15224
14987
|
staticStyle: {
|
|
15225
14988
|
"margin": "0 8px"
|
|
15226
14989
|
}
|
|
15227
14990
|
}), _vm._v(" " + _vm._s(_vm.framesPerRow + '*' + _vm.numberOfRows) + " "), _vm.alternativeServer || !_vm.cache ? _c('span', {
|
|
15228
|
-
staticClass: "divider vertical",
|
|
14991
|
+
staticClass: "visualization-divider vertical",
|
|
15229
14992
|
staticStyle: {
|
|
15230
14993
|
"margin": "0 8px"
|
|
15231
14994
|
}
|
|
@@ -15236,7 +14999,7 @@ var Infosvue_type_template_id_c15b4388_render = function render() {
|
|
|
15236
14999
|
"left": ""
|
|
15237
15000
|
}
|
|
15238
15001
|
}, [_vm._v("fa-exclamation-triangle")]), _c('strong', [_vm._v(_vm._s(_vm.$t('infoBar.alternativeServer')))])], 1) : _vm._e(), _vm.alternativeServer && !_vm.cache ? _c('span', {
|
|
15239
|
-
staticClass: "divider vertical",
|
|
15002
|
+
staticClass: "visualization-divider vertical",
|
|
15240
15003
|
staticStyle: {
|
|
15241
15004
|
"margin": "0 8px"
|
|
15242
15005
|
}
|
|
@@ -15295,7 +15058,7 @@ var Infosvue_type_template_id_c15b4388_render = function render() {
|
|
|
15295
15058
|
}
|
|
15296
15059
|
})], 1)]);
|
|
15297
15060
|
};
|
|
15298
|
-
var
|
|
15061
|
+
var Infosvue_type_template_id_363c35bb_staticRenderFns = [];
|
|
15299
15062
|
|
|
15300
15063
|
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Infos.vue?vue&type=script&lang=js&
|
|
15301
15064
|
/* harmony default export */ var Infosvue_type_script_lang_js_ = ({
|
|
@@ -15390,8 +15153,8 @@ var Infosvue_type_template_id_c15b4388_staticRenderFns = [];
|
|
|
15390
15153
|
;
|
|
15391
15154
|
var Infos_component = normalizeComponent(
|
|
15392
15155
|
components_Infosvue_type_script_lang_js_,
|
|
15393
|
-
|
|
15394
|
-
|
|
15156
|
+
Infosvue_type_template_id_363c35bb_render,
|
|
15157
|
+
Infosvue_type_template_id_363c35bb_staticRenderFns,
|
|
15395
15158
|
false,
|
|
15396
15159
|
null,
|
|
15397
15160
|
null,
|
|
@@ -15400,12 +15163,12 @@ var Infos_component = normalizeComponent(
|
|
|
15400
15163
|
)
|
|
15401
15164
|
|
|
15402
15165
|
/* harmony default export */ var Infos = (Infos_component.exports);
|
|
15403
|
-
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/VideoProgress.vue?vue&type=template&id=
|
|
15404
|
-
var
|
|
15166
|
+
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/VideoProgress.vue?vue&type=template&id=7fe6f244&scoped=true&
|
|
15167
|
+
var VideoProgressvue_type_template_id_7fe6f244_scoped_true_render = function render() {
|
|
15405
15168
|
var _vm = this,
|
|
15406
15169
|
_c = _vm._self._c;
|
|
15407
15170
|
return _c('div', [_c('div', {
|
|
15408
|
-
staticClass: "row",
|
|
15171
|
+
staticClass: "visualization-row",
|
|
15409
15172
|
attrs: {
|
|
15410
15173
|
"id": "progress"
|
|
15411
15174
|
},
|
|
@@ -15417,10 +15180,10 @@ var VideoProgressvue_type_template_id_816cceb8_scoped_true_render = function ren
|
|
|
15417
15180
|
}, [_vm._v(" " + _vm._s(_vm.convertToAudienceTime(_vm.videoTime)) + " ")]), _c('span', {
|
|
15418
15181
|
staticClass: "progressBar"
|
|
15419
15182
|
})]), _c('hr', {
|
|
15420
|
-
staticClass: "divider"
|
|
15183
|
+
staticClass: "visualization-divider"
|
|
15421
15184
|
})]);
|
|
15422
15185
|
};
|
|
15423
|
-
var
|
|
15186
|
+
var VideoProgressvue_type_template_id_7fe6f244_scoped_true_staticRenderFns = [];
|
|
15424
15187
|
|
|
15425
15188
|
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/VideoProgress.vue?vue&type=script&lang=js&
|
|
15426
15189
|
/* harmony default export */ var VideoProgressvue_type_script_lang_js_ = ({
|
|
@@ -15512,10 +15275,10 @@ var VideoProgressvue_type_template_id_816cceb8_scoped_true_staticRenderFns = [];
|
|
|
15512
15275
|
});
|
|
15513
15276
|
;// CONCATENATED MODULE: ./src/components/VideoProgress.vue?vue&type=script&lang=js&
|
|
15514
15277
|
/* harmony default export */ var components_VideoProgressvue_type_script_lang_js_ = (VideoProgressvue_type_script_lang_js_);
|
|
15515
|
-
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/VideoProgress.vue?vue&type=style&index=0&id=
|
|
15278
|
+
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/VideoProgress.vue?vue&type=style&index=0&id=7fe6f244&prod&scoped=true&lang=css&
|
|
15516
15279
|
// extracted by mini-css-extract-plugin
|
|
15517
15280
|
|
|
15518
|
-
;// CONCATENATED MODULE: ./src/components/VideoProgress.vue?vue&type=style&index=0&id=
|
|
15281
|
+
;// CONCATENATED MODULE: ./src/components/VideoProgress.vue?vue&type=style&index=0&id=7fe6f244&prod&scoped=true&lang=css&
|
|
15519
15282
|
|
|
15520
15283
|
;// CONCATENATED MODULE: ./src/components/VideoProgress.vue
|
|
15521
15284
|
|
|
@@ -15528,37 +15291,47 @@ var VideoProgressvue_type_template_id_816cceb8_scoped_true_staticRenderFns = [];
|
|
|
15528
15291
|
|
|
15529
15292
|
var VideoProgress_component = normalizeComponent(
|
|
15530
15293
|
components_VideoProgressvue_type_script_lang_js_,
|
|
15531
|
-
|
|
15532
|
-
|
|
15294
|
+
VideoProgressvue_type_template_id_7fe6f244_scoped_true_render,
|
|
15295
|
+
VideoProgressvue_type_template_id_7fe6f244_scoped_true_staticRenderFns,
|
|
15533
15296
|
false,
|
|
15534
15297
|
null,
|
|
15535
|
-
"
|
|
15298
|
+
"7fe6f244",
|
|
15536
15299
|
null
|
|
15537
15300
|
|
|
15538
15301
|
)
|
|
15539
15302
|
|
|
15540
15303
|
/* harmony default export */ var VideoProgress = (VideoProgress_component.exports);
|
|
15541
|
-
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Settings.vue?vue&type=template&id=
|
|
15542
|
-
var
|
|
15304
|
+
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Settings.vue?vue&type=template&id=bf2f3c16&scoped=true&
|
|
15305
|
+
var Settingsvue_type_template_id_bf2f3c16_scoped_true_render = function render() {
|
|
15543
15306
|
var _vm = this,
|
|
15544
15307
|
_c = _vm._self._c;
|
|
15545
|
-
return _c('div', [_c('
|
|
15308
|
+
return _c('div', [_vm.dialogsVisibility.frames ? _c('GlobalEvents', {
|
|
15309
|
+
on: {
|
|
15310
|
+
"keydown": [function ($event) {
|
|
15311
|
+
if (!$event.type.indexOf('key') && $event.keyCode !== 37) return null;
|
|
15312
|
+
return _vm.prevFormat.apply(null, arguments);
|
|
15313
|
+
}, function ($event) {
|
|
15314
|
+
if (!$event.type.indexOf('key') && $event.keyCode !== 39) return null;
|
|
15315
|
+
return _vm.nextFormat.apply(null, arguments);
|
|
15316
|
+
}]
|
|
15317
|
+
}
|
|
15318
|
+
}) : _vm._e(), _c('dialog', {
|
|
15546
15319
|
ref: "frames"
|
|
15547
15320
|
}, [_c('div', {
|
|
15548
|
-
staticClass: "row",
|
|
15321
|
+
staticClass: "visualization-row",
|
|
15549
15322
|
staticStyle: {
|
|
15550
15323
|
"padding": "12px",
|
|
15551
15324
|
"font-weight": "bold"
|
|
15552
15325
|
}
|
|
15553
15326
|
}, [_vm._v(" Formato da grelha ")]), _c('div', {
|
|
15554
|
-
staticClass: "row",
|
|
15327
|
+
staticClass: "visualization-row",
|
|
15555
15328
|
staticStyle: {
|
|
15556
15329
|
"justify-content": "center"
|
|
15557
15330
|
}
|
|
15558
15331
|
}, _vm._l(_vm.items, function (item, index) {
|
|
15559
15332
|
return _c('div', {
|
|
15560
15333
|
key: index,
|
|
15561
|
-
staticClass: "col",
|
|
15334
|
+
staticClass: "visualization-col",
|
|
15562
15335
|
staticStyle: {
|
|
15563
15336
|
"min-width": "200px",
|
|
15564
15337
|
"max-width": "200px"
|
|
@@ -15566,7 +15339,7 @@ var Settingsvue_type_template_id_3f38ed2c_scoped_true_render = function render()
|
|
|
15566
15339
|
}, [_c('img', {
|
|
15567
15340
|
style: _vm.framesValue !== item.value ? 'filter: grayscale(1)' : '',
|
|
15568
15341
|
attrs: {
|
|
15569
|
-
"src":
|
|
15342
|
+
"src": item.image,
|
|
15570
15343
|
"width": "100%"
|
|
15571
15344
|
},
|
|
15572
15345
|
on: {
|
|
@@ -15574,9 +15347,9 @@ var Settingsvue_type_template_id_3f38ed2c_scoped_true_render = function render()
|
|
|
15574
15347
|
}
|
|
15575
15348
|
})]);
|
|
15576
15349
|
}), 0), _c('div', {
|
|
15577
|
-
staticClass: "divider"
|
|
15350
|
+
staticClass: "visualization-divider"
|
|
15578
15351
|
}), _c('div', {
|
|
15579
|
-
staticClass: "row"
|
|
15352
|
+
staticClass: "visualization-row"
|
|
15580
15353
|
}, [_c('button', {
|
|
15581
15354
|
on: {
|
|
15582
15355
|
"click": function ($event) {
|
|
@@ -15586,13 +15359,13 @@ var Settingsvue_type_template_id_3f38ed2c_scoped_true_render = function render()
|
|
|
15586
15359
|
}, [_vm._v("Ok")])])]), _c('dialog', {
|
|
15587
15360
|
ref: "secondsPerFrame"
|
|
15588
15361
|
}, [_c('div', {
|
|
15589
|
-
staticClass: "row",
|
|
15362
|
+
staticClass: "visualization-row",
|
|
15590
15363
|
staticStyle: {
|
|
15591
15364
|
"padding": "12px",
|
|
15592
15365
|
"font-weight": "bold"
|
|
15593
15366
|
}
|
|
15594
15367
|
}, [_vm._v(" Segundos por Imagem ")]), _c('div', {
|
|
15595
|
-
staticClass: "row"
|
|
15368
|
+
staticClass: "visualization-row"
|
|
15596
15369
|
}, [_c('input', {
|
|
15597
15370
|
directives: [{
|
|
15598
15371
|
name: "model",
|
|
@@ -15616,9 +15389,9 @@ var Settingsvue_type_template_id_3f38ed2c_scoped_true_render = function render()
|
|
|
15616
15389
|
}
|
|
15617
15390
|
}
|
|
15618
15391
|
})]), _c('div', {
|
|
15619
|
-
staticClass: "divider"
|
|
15392
|
+
staticClass: "visualization-divider"
|
|
15620
15393
|
}), _c('div', {
|
|
15621
|
-
staticClass: "row"
|
|
15394
|
+
staticClass: "visualization-row"
|
|
15622
15395
|
}, [_c('button', {
|
|
15623
15396
|
on: {
|
|
15624
15397
|
"click": function ($event) {
|
|
@@ -15628,13 +15401,13 @@ var Settingsvue_type_template_id_3f38ed2c_scoped_true_render = function render()
|
|
|
15628
15401
|
}, [_vm._v("Ok")])])]), _c('dialog', {
|
|
15629
15402
|
ref: "goTo"
|
|
15630
15403
|
}, [_c('div', {
|
|
15631
|
-
staticClass: "row",
|
|
15404
|
+
staticClass: "visualization-row",
|
|
15632
15405
|
staticStyle: {
|
|
15633
15406
|
"padding": "12px",
|
|
15634
15407
|
"font-weight": "bold"
|
|
15635
15408
|
}
|
|
15636
15409
|
}, [_vm._v(" Saltar para: ")]), _c('div', {
|
|
15637
|
-
staticClass: "row"
|
|
15410
|
+
staticClass: "visualization-row"
|
|
15638
15411
|
}, [_c('input', {
|
|
15639
15412
|
directives: [{
|
|
15640
15413
|
name: "model",
|
|
@@ -15661,9 +15434,9 @@ var Settingsvue_type_template_id_3f38ed2c_scoped_true_render = function render()
|
|
|
15661
15434
|
}
|
|
15662
15435
|
}
|
|
15663
15436
|
})]), _c('div', {
|
|
15664
|
-
staticClass: "divider"
|
|
15437
|
+
staticClass: "visualization-divider"
|
|
15665
15438
|
}), _c('div', {
|
|
15666
|
-
staticClass: "row"
|
|
15439
|
+
staticClass: "visualization-row"
|
|
15667
15440
|
}, [_c('button', {
|
|
15668
15441
|
on: {
|
|
15669
15442
|
"click": () => {
|
|
@@ -15685,13 +15458,13 @@ var Settingsvue_type_template_id_3f38ed2c_scoped_true_render = function render()
|
|
|
15685
15458
|
}), _c('dialog', {
|
|
15686
15459
|
ref: "playbackRate"
|
|
15687
15460
|
}, [_c('div', {
|
|
15688
|
-
staticClass: "row",
|
|
15461
|
+
staticClass: "visualization-row",
|
|
15689
15462
|
staticStyle: {
|
|
15690
15463
|
"padding": "12px",
|
|
15691
15464
|
"font-weight": "bold"
|
|
15692
15465
|
}
|
|
15693
15466
|
}, [_vm._v(" Velocidade de Reprodução ")]), _c('div', {
|
|
15694
|
-
staticClass: "row"
|
|
15467
|
+
staticClass: "visualization-row"
|
|
15695
15468
|
}, [_c('input', {
|
|
15696
15469
|
directives: [{
|
|
15697
15470
|
name: "model",
|
|
@@ -15715,9 +15488,9 @@ var Settingsvue_type_template_id_3f38ed2c_scoped_true_render = function render()
|
|
|
15715
15488
|
}
|
|
15716
15489
|
}
|
|
15717
15490
|
})]), _c('div', {
|
|
15718
|
-
staticClass: "divider"
|
|
15491
|
+
staticClass: "visualization-divider"
|
|
15719
15492
|
}), _c('div', {
|
|
15720
|
-
staticClass: "row"
|
|
15493
|
+
staticClass: "visualization-row"
|
|
15721
15494
|
}, [_c('button', {
|
|
15722
15495
|
on: {
|
|
15723
15496
|
"click": function ($event) {
|
|
@@ -15726,11 +15499,53 @@ var Settingsvue_type_template_id_3f38ed2c_scoped_true_render = function render()
|
|
|
15726
15499
|
}
|
|
15727
15500
|
}, [_vm._v("Ok")])])])], 1);
|
|
15728
15501
|
};
|
|
15729
|
-
var
|
|
15502
|
+
var Settingsvue_type_template_id_bf2f3c16_scoped_true_staticRenderFns = [];
|
|
15503
|
+
|
|
15504
|
+
;// CONCATENATED MODULE: ./src/assets/grid/1x1.svg
|
|
15505
|
+
var _1x1_namespaceObject = __webpack_require__.p + "img/1x1.f865594b.svg";
|
|
15506
|
+
;// CONCATENATED MODULE: ./src/assets/grid/2x1.svg
|
|
15507
|
+
var _2x1_namespaceObject = __webpack_require__.p + "img/2x1.6bc80fec.svg";
|
|
15508
|
+
;// CONCATENATED MODULE: ./src/assets/grid/3x1.svg
|
|
15509
|
+
var _3x1_namespaceObject = __webpack_require__.p + "img/3x1.8fe1c055.svg";
|
|
15510
|
+
;// CONCATENATED MODULE: ./src/assets/grid/3x2.svg
|
|
15511
|
+
var _3x2_namespaceObject = __webpack_require__.p + "img/3x2.f5153612.svg";
|
|
15512
|
+
;// CONCATENATED MODULE: ./src/assets/grid/4x1.svg
|
|
15513
|
+
var _4x1_namespaceObject = __webpack_require__.p + "img/4x1.22f434b0.svg";
|
|
15514
|
+
;// CONCATENATED MODULE: ./src/assets/grid/4x2.svg
|
|
15515
|
+
var _4x2_namespaceObject = __webpack_require__.p + "img/4x2.3810a721.svg";
|
|
15516
|
+
;// CONCATENATED MODULE: ./src/assets/grid/5x1.svg
|
|
15517
|
+
var _5x1_namespaceObject = __webpack_require__.p + "img/5x1.c0878e49.svg";
|
|
15518
|
+
;// CONCATENATED MODULE: ./src/assets/grid/5x2.svg
|
|
15519
|
+
var _5x2_namespaceObject = __webpack_require__.p + "img/5x2.b70b5289.svg";
|
|
15520
|
+
;// CONCATENATED MODULE: ./src/assets/grid/6x1.svg
|
|
15521
|
+
var _6x1_namespaceObject = __webpack_require__.p + "img/6x1.28b9840c.svg";
|
|
15522
|
+
;// CONCATENATED MODULE: ./src/assets/grid/6x2.svg
|
|
15523
|
+
var _6x2_namespaceObject = __webpack_require__.p + "img/6x2.6b117ba7.svg";
|
|
15524
|
+
;// CONCATENATED MODULE: ./src/assets/grid/index.js
|
|
15525
|
+
|
|
15526
|
+
|
|
15527
|
+
|
|
15730
15528
|
|
|
15731
|
-
;// CONCATENATED MODULE: ./src/components/Settings.vue?vue&type=template&id=3f38ed2c&scoped=true&
|
|
15732
15529
|
|
|
15530
|
+
|
|
15531
|
+
|
|
15532
|
+
|
|
15533
|
+
|
|
15534
|
+
|
|
15535
|
+
/* harmony default export */ var grid = ({
|
|
15536
|
+
'1x1': _1x1_namespaceObject,
|
|
15537
|
+
'2x1': _2x1_namespaceObject,
|
|
15538
|
+
'3x1': _3x1_namespaceObject,
|
|
15539
|
+
'3x2': _3x2_namespaceObject,
|
|
15540
|
+
'4x1': _4x1_namespaceObject,
|
|
15541
|
+
'4x2': _4x2_namespaceObject,
|
|
15542
|
+
'5x1': _5x1_namespaceObject,
|
|
15543
|
+
'5x2': _5x2_namespaceObject,
|
|
15544
|
+
'6x1': _6x1_namespaceObject,
|
|
15545
|
+
'6x2': _6x2_namespaceObject
|
|
15546
|
+
});
|
|
15733
15547
|
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Settings.vue?vue&type=script&lang=js&
|
|
15548
|
+
|
|
15734
15549
|
/* harmony default export */ var Settingsvue_type_script_lang_js_ = ({
|
|
15735
15550
|
props: {
|
|
15736
15551
|
dialogsVisibility: {
|
|
@@ -15765,31 +15580,40 @@ var Settingsvue_type_template_id_3f38ed2c_scoped_true_staticRenderFns = [];
|
|
|
15765
15580
|
},
|
|
15766
15581
|
items: [{
|
|
15767
15582
|
text: '2x1',
|
|
15768
|
-
value: 1
|
|
15583
|
+
value: 1,
|
|
15584
|
+
image: grid['2x1']
|
|
15769
15585
|
}, {
|
|
15770
15586
|
text: '3x1',
|
|
15771
|
-
value: 2
|
|
15587
|
+
value: 2,
|
|
15588
|
+
image: grid['3x1']
|
|
15772
15589
|
}, {
|
|
15773
15590
|
text: '3x2',
|
|
15774
|
-
value: 3
|
|
15591
|
+
value: 3,
|
|
15592
|
+
image: grid['3x2']
|
|
15775
15593
|
}, {
|
|
15776
15594
|
text: '4x1',
|
|
15777
|
-
value: 4
|
|
15595
|
+
value: 4,
|
|
15596
|
+
image: grid['4x1']
|
|
15778
15597
|
}, {
|
|
15779
15598
|
text: '4x2',
|
|
15780
|
-
value: 5
|
|
15599
|
+
value: 5,
|
|
15600
|
+
image: grid['4x2']
|
|
15781
15601
|
}, {
|
|
15782
15602
|
text: '5x1',
|
|
15783
|
-
value: 6
|
|
15603
|
+
value: 6,
|
|
15604
|
+
image: grid['5x1']
|
|
15784
15605
|
}, {
|
|
15785
15606
|
text: '5x2',
|
|
15786
|
-
value: 7
|
|
15607
|
+
value: 7,
|
|
15608
|
+
image: grid['5x2']
|
|
15787
15609
|
}, {
|
|
15788
15610
|
text: '6x1',
|
|
15789
|
-
value: 8
|
|
15611
|
+
value: 8,
|
|
15612
|
+
image: grid['6x1']
|
|
15790
15613
|
}, {
|
|
15791
15614
|
text: '6x2',
|
|
15792
|
-
value: 9
|
|
15615
|
+
value: 9,
|
|
15616
|
+
image: grid['6x2']
|
|
15793
15617
|
}],
|
|
15794
15618
|
// NEW
|
|
15795
15619
|
goToValue: ''
|
|
@@ -15825,6 +15649,16 @@ var Settingsvue_type_template_id_3f38ed2c_scoped_true_staticRenderFns = [];
|
|
|
15825
15649
|
}
|
|
15826
15650
|
},
|
|
15827
15651
|
methods: {
|
|
15652
|
+
prevFormat() {
|
|
15653
|
+
if (this.items.find(format => format.value === this.framesValue - 1)) {
|
|
15654
|
+
this.framesValue--;
|
|
15655
|
+
}
|
|
15656
|
+
},
|
|
15657
|
+
nextFormat() {
|
|
15658
|
+
if (this.items.find(format => format.value === this.framesValue + 1)) {
|
|
15659
|
+
this.framesValue++;
|
|
15660
|
+
}
|
|
15661
|
+
},
|
|
15828
15662
|
changePlaybackRate() {
|
|
15829
15663
|
let direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
15830
15664
|
if (direction === 1) {
|
|
@@ -15871,10 +15705,10 @@ var Settingsvue_type_template_id_3f38ed2c_scoped_true_staticRenderFns = [];
|
|
|
15871
15705
|
});
|
|
15872
15706
|
;// CONCATENATED MODULE: ./src/components/Settings.vue?vue&type=script&lang=js&
|
|
15873
15707
|
/* harmony default export */ var components_Settingsvue_type_script_lang_js_ = (Settingsvue_type_script_lang_js_);
|
|
15874
|
-
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Settings.vue?vue&type=style&index=0&id=
|
|
15708
|
+
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/Settings.vue?vue&type=style&index=0&id=bf2f3c16&prod&scoped=true&lang=css&
|
|
15875
15709
|
// extracted by mini-css-extract-plugin
|
|
15876
15710
|
|
|
15877
|
-
;// CONCATENATED MODULE: ./src/components/Settings.vue?vue&type=style&index=0&id=
|
|
15711
|
+
;// CONCATENATED MODULE: ./src/components/Settings.vue?vue&type=style&index=0&id=bf2f3c16&prod&scoped=true&lang=css&
|
|
15878
15712
|
|
|
15879
15713
|
;// CONCATENATED MODULE: ./src/components/Settings.vue
|
|
15880
15714
|
|
|
@@ -15887,11 +15721,11 @@ var Settingsvue_type_template_id_3f38ed2c_scoped_true_staticRenderFns = [];
|
|
|
15887
15721
|
|
|
15888
15722
|
var Settings_component = normalizeComponent(
|
|
15889
15723
|
components_Settingsvue_type_script_lang_js_,
|
|
15890
|
-
|
|
15891
|
-
|
|
15724
|
+
Settingsvue_type_template_id_bf2f3c16_scoped_true_render,
|
|
15725
|
+
Settingsvue_type_template_id_bf2f3c16_scoped_true_staticRenderFns,
|
|
15892
15726
|
false,
|
|
15893
15727
|
null,
|
|
15894
|
-
"
|
|
15728
|
+
"bf2f3c16",
|
|
15895
15729
|
null
|
|
15896
15730
|
|
|
15897
15731
|
)
|
|
@@ -15936,6 +15770,10 @@ const Positions = Object.freeze({
|
|
|
15936
15770
|
type: Boolean,
|
|
15937
15771
|
default: false
|
|
15938
15772
|
},
|
|
15773
|
+
jumpOnInsert: {
|
|
15774
|
+
type: Boolean,
|
|
15775
|
+
default: false
|
|
15776
|
+
},
|
|
15939
15777
|
framesFormat: {
|
|
15940
15778
|
type: [Number, String],
|
|
15941
15779
|
default: 6
|
|
@@ -16499,6 +16337,9 @@ const Positions = Object.freeze({
|
|
|
16499
16337
|
hour_end: this.hourEndSelected ? this.convertToAudienceTime(this.hourEndSelected, '') : null,
|
|
16500
16338
|
force: false
|
|
16501
16339
|
});
|
|
16340
|
+
if (this.jumpOnInsert) {
|
|
16341
|
+
this.changeHour(this.convertToAudienceTime((this.hourEndSelected || this.hourIniSelected) + 1));
|
|
16342
|
+
}
|
|
16502
16343
|
this.hourIniSelected = null;
|
|
16503
16344
|
this.hourEndSelected = null;
|
|
16504
16345
|
this.canInsertTime = false;
|
|
@@ -16544,13 +16385,13 @@ const Positions = Object.freeze({
|
|
|
16544
16385
|
}
|
|
16545
16386
|
},
|
|
16546
16387
|
computed: {
|
|
16388
|
+
settingsClosed() {
|
|
16389
|
+
return !Object.values(this.dialogs).find(v => v);
|
|
16390
|
+
},
|
|
16547
16391
|
startAudienceSeconds() {
|
|
16548
16392
|
const t = this.startAudienceTime.match(/.{1,2}/g);
|
|
16549
16393
|
return parseInt(t[0] * 3600 + t[1] * 60 + t[2]);
|
|
16550
16394
|
},
|
|
16551
|
-
user() {
|
|
16552
|
-
return this.$store.state.user;
|
|
16553
|
-
},
|
|
16554
16395
|
loadingArray() {
|
|
16555
16396
|
return Array.from(Array(this.numberOfRows * this.framesPerRow).keys());
|
|
16556
16397
|
},
|
|
@@ -16581,25 +16422,25 @@ const Positions = Object.freeze({
|
|
|
16581
16422
|
if (value) {
|
|
16582
16423
|
this.stopPlayingBar();
|
|
16583
16424
|
}
|
|
16425
|
+
},
|
|
16426
|
+
channel() {
|
|
16427
|
+
this.updatingChannel = new Promise((resolve, reject) => {
|
|
16428
|
+
try {
|
|
16429
|
+
this.createFramesInterface();
|
|
16430
|
+
resolve(true);
|
|
16431
|
+
} catch (err) {
|
|
16432
|
+
reject(err);
|
|
16433
|
+
}
|
|
16434
|
+
});
|
|
16584
16435
|
}
|
|
16585
|
-
// channel() {
|
|
16586
|
-
// this.updatingChannel = new Promise((resolve, reject) => {
|
|
16587
|
-
// try {
|
|
16588
|
-
// this.createFramesInterface()
|
|
16589
|
-
// resolve(true)
|
|
16590
|
-
// } catch (err) {
|
|
16591
|
-
// reject(err)
|
|
16592
|
-
// }
|
|
16593
|
-
// })
|
|
16594
|
-
// },
|
|
16595
16436
|
}
|
|
16596
16437
|
});
|
|
16597
16438
|
;// CONCATENATED MODULE: ./src/Visualization.vue?vue&type=script&lang=js&
|
|
16598
16439
|
/* harmony default export */ var src_Visualizationvue_type_script_lang_js_ = (Visualizationvue_type_script_lang_js_);
|
|
16599
|
-
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/Visualization.vue?vue&type=style&index=0&id=
|
|
16440
|
+
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/Visualization.vue?vue&type=style&index=0&id=f4735614&prod&scoped=true&lang=css&
|
|
16600
16441
|
// extracted by mini-css-extract-plugin
|
|
16601
16442
|
|
|
16602
|
-
;// CONCATENATED MODULE: ./src/Visualization.vue?vue&type=style&index=0&id=
|
|
16443
|
+
;// CONCATENATED MODULE: ./src/Visualization.vue?vue&type=style&index=0&id=f4735614&prod&scoped=true&lang=css&
|
|
16603
16444
|
|
|
16604
16445
|
;// CONCATENATED MODULE: ./src/Visualization.vue
|
|
16605
16446
|
|
|
@@ -16616,7 +16457,7 @@ var Visualization_component = normalizeComponent(
|
|
|
16616
16457
|
staticRenderFns,
|
|
16617
16458
|
false,
|
|
16618
16459
|
null,
|
|
16619
|
-
"
|
|
16460
|
+
"f4735614",
|
|
16620
16461
|
null
|
|
16621
16462
|
|
|
16622
16463
|
)
|
|
@@ -25065,2739 +24906,68 @@ var v_mask_esm_plugin = function (Vue) {
|
|
|
25065
24906
|
Vue.filter('VMask', createFilter(options));
|
|
25066
24907
|
};
|
|
25067
24908
|
|
|
25068
|
-
;// CONCATENATED MODULE: ./
|
|
25069
|
-
|
|
25070
|
-
|
|
25071
|
-
|
|
25072
|
-
|
|
25073
|
-
|
|
25074
|
-
|
|
25075
|
-
|
|
25076
|
-
|
|
25077
|
-
|
|
25078
|
-
|
|
25079
|
-
|
|
25080
|
-
|
|
25081
|
-
|
|
25082
|
-
|
|
25083
|
-
|
|
25084
|
-
|
|
25085
|
-
|
|
25086
|
-
|
|
25087
|
-
this.init(concreteLogger, options);
|
|
25088
|
-
}
|
|
25089
|
-
init(concreteLogger) {
|
|
25090
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
25091
|
-
this.prefix = options.prefix || 'i18next:';
|
|
25092
|
-
this.logger = concreteLogger || consoleLogger;
|
|
25093
|
-
this.options = options;
|
|
25094
|
-
this.debug = options.debug;
|
|
25095
|
-
}
|
|
25096
|
-
log() {
|
|
25097
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25098
|
-
args[_key] = arguments[_key];
|
|
25099
|
-
}
|
|
25100
|
-
return this.forward(args, 'log', '', true);
|
|
25101
|
-
}
|
|
25102
|
-
warn() {
|
|
25103
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
25104
|
-
args[_key2] = arguments[_key2];
|
|
25105
|
-
}
|
|
25106
|
-
return this.forward(args, 'warn', '', true);
|
|
25107
|
-
}
|
|
25108
|
-
error() {
|
|
25109
|
-
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
25110
|
-
args[_key3] = arguments[_key3];
|
|
25111
|
-
}
|
|
25112
|
-
return this.forward(args, 'error', '');
|
|
25113
|
-
}
|
|
25114
|
-
deprecate() {
|
|
25115
|
-
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
25116
|
-
args[_key4] = arguments[_key4];
|
|
25117
|
-
}
|
|
25118
|
-
return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
|
|
25119
|
-
}
|
|
25120
|
-
forward(args, lvl, prefix, debugOnly) {
|
|
25121
|
-
if (debugOnly && !this.debug) return null;
|
|
25122
|
-
if (typeof args[0] === 'string') args[0] = `${prefix}${this.prefix} ${args[0]}`;
|
|
25123
|
-
return this.logger[lvl](args);
|
|
25124
|
-
}
|
|
25125
|
-
create(moduleName) {
|
|
25126
|
-
return new Logger(this.logger, {
|
|
25127
|
-
...{
|
|
25128
|
-
prefix: `${this.prefix}:${moduleName}:`
|
|
25129
|
-
},
|
|
25130
|
-
...this.options
|
|
25131
|
-
});
|
|
25132
|
-
}
|
|
25133
|
-
clone(options) {
|
|
25134
|
-
options = options || this.options;
|
|
25135
|
-
options.prefix = options.prefix || this.prefix;
|
|
25136
|
-
return new Logger(this.logger, options);
|
|
25137
|
-
}
|
|
25138
|
-
}
|
|
25139
|
-
var baseLogger = new Logger();
|
|
25140
|
-
class EventEmitter {
|
|
25141
|
-
constructor() {
|
|
25142
|
-
this.observers = {};
|
|
25143
|
-
}
|
|
25144
|
-
on(events, listener) {
|
|
25145
|
-
events.split(' ').forEach(event => {
|
|
25146
|
-
this.observers[event] = this.observers[event] || [];
|
|
25147
|
-
this.observers[event].push(listener);
|
|
25148
|
-
});
|
|
25149
|
-
return this;
|
|
25150
|
-
}
|
|
25151
|
-
off(event, listener) {
|
|
25152
|
-
if (!this.observers[event]) return;
|
|
25153
|
-
if (!listener) {
|
|
25154
|
-
delete this.observers[event];
|
|
24909
|
+
;// CONCATENATED MODULE: ./src/index.js
|
|
24910
|
+
|
|
24911
|
+
|
|
24912
|
+
|
|
24913
|
+
|
|
24914
|
+
|
|
24915
|
+
|
|
24916
|
+
|
|
24917
|
+
// import i18next from 'i18next'
|
|
24918
|
+
// import I18NextVue from 'i18next-vue'
|
|
24919
|
+
// import LanguageDetector from 'i18next-browser-languagedetector'
|
|
24920
|
+
// import en from './assets/locales/en-GB'
|
|
24921
|
+
// import pt from './assets/locales/pt-PT'
|
|
24922
|
+
|
|
24923
|
+
/* harmony default export */ var src_0 = ({
|
|
24924
|
+
install(Vue) {
|
|
24925
|
+
let settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
24926
|
+
if (!settings.client || !settings.base_url || !settings.theme?.primary) {
|
|
24927
|
+
console.error('Visualization: Missing required settings');
|
|
25155
24928
|
return;
|
|
25156
24929
|
}
|
|
25157
|
-
|
|
25158
|
-
|
|
25159
|
-
emit(event) {
|
|
25160
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
25161
|
-
args[_key - 1] = arguments[_key];
|
|
25162
|
-
}
|
|
25163
|
-
if (this.observers[event]) {
|
|
25164
|
-
const cloned = [].concat(this.observers[event]);
|
|
25165
|
-
cloned.forEach(observer => {
|
|
25166
|
-
observer(...args);
|
|
25167
|
-
});
|
|
25168
|
-
}
|
|
25169
|
-
if (this.observers['*']) {
|
|
25170
|
-
const cloned = [].concat(this.observers['*']);
|
|
25171
|
-
cloned.forEach(observer => {
|
|
25172
|
-
observer.apply(observer, [event, ...args]);
|
|
25173
|
-
});
|
|
25174
|
-
}
|
|
25175
|
-
}
|
|
25176
|
-
}
|
|
25177
|
-
function defer() {
|
|
25178
|
-
let res;
|
|
25179
|
-
let rej;
|
|
25180
|
-
const promise = new Promise((resolve, reject) => {
|
|
25181
|
-
res = resolve;
|
|
25182
|
-
rej = reject;
|
|
25183
|
-
});
|
|
25184
|
-
promise.resolve = res;
|
|
25185
|
-
promise.reject = rej;
|
|
25186
|
-
return promise;
|
|
25187
|
-
}
|
|
25188
|
-
function makeString(object) {
|
|
25189
|
-
if (object == null) return '';
|
|
25190
|
-
return '' + object;
|
|
25191
|
-
}
|
|
25192
|
-
function copy(a, s, t) {
|
|
25193
|
-
a.forEach(m => {
|
|
25194
|
-
if (s[m]) t[m] = s[m];
|
|
25195
|
-
});
|
|
25196
|
-
}
|
|
25197
|
-
function getLastOfPath(object, path, Empty) {
|
|
25198
|
-
function cleanKey(key) {
|
|
25199
|
-
return key && key.indexOf('###') > -1 ? key.replace(/###/g, '.') : key;
|
|
25200
|
-
}
|
|
25201
|
-
function canNotTraverseDeeper() {
|
|
25202
|
-
return !object || typeof object === 'string';
|
|
25203
|
-
}
|
|
25204
|
-
const stack = typeof path !== 'string' ? [].concat(path) : path.split('.');
|
|
25205
|
-
while (stack.length > 1) {
|
|
25206
|
-
if (canNotTraverseDeeper()) return {};
|
|
25207
|
-
const key = cleanKey(stack.shift());
|
|
25208
|
-
if (!object[key] && Empty) object[key] = new Empty();
|
|
25209
|
-
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
|
25210
|
-
object = object[key];
|
|
25211
|
-
} else {
|
|
25212
|
-
object = {};
|
|
25213
|
-
}
|
|
25214
|
-
}
|
|
25215
|
-
if (canNotTraverseDeeper()) return {};
|
|
25216
|
-
return {
|
|
25217
|
-
obj: object,
|
|
25218
|
-
k: cleanKey(stack.shift())
|
|
25219
|
-
};
|
|
25220
|
-
}
|
|
25221
|
-
function setPath(object, path, newValue) {
|
|
25222
|
-
const {
|
|
25223
|
-
obj,
|
|
25224
|
-
k
|
|
25225
|
-
} = getLastOfPath(object, path, Object);
|
|
25226
|
-
obj[k] = newValue;
|
|
25227
|
-
}
|
|
25228
|
-
function pushPath(object, path, newValue, concat) {
|
|
25229
|
-
const {
|
|
25230
|
-
obj,
|
|
25231
|
-
k
|
|
25232
|
-
} = getLastOfPath(object, path, Object);
|
|
25233
|
-
obj[k] = obj[k] || [];
|
|
25234
|
-
if (concat) obj[k] = obj[k].concat(newValue);
|
|
25235
|
-
if (!concat) obj[k].push(newValue);
|
|
25236
|
-
}
|
|
25237
|
-
function getPath(object, path) {
|
|
25238
|
-
const {
|
|
25239
|
-
obj,
|
|
25240
|
-
k
|
|
25241
|
-
} = getLastOfPath(object, path);
|
|
25242
|
-
if (!obj) return undefined;
|
|
25243
|
-
return obj[k];
|
|
25244
|
-
}
|
|
25245
|
-
function getPathWithDefaults(data, defaultData, key) {
|
|
25246
|
-
const value = getPath(data, key);
|
|
25247
|
-
if (value !== undefined) {
|
|
25248
|
-
return value;
|
|
25249
|
-
}
|
|
25250
|
-
return getPath(defaultData, key);
|
|
25251
|
-
}
|
|
25252
|
-
function deepExtend(target, source, overwrite) {
|
|
25253
|
-
for (const prop in source) {
|
|
25254
|
-
if (prop !== '__proto__' && prop !== 'constructor') {
|
|
25255
|
-
if (prop in target) {
|
|
25256
|
-
if (typeof target[prop] === 'string' || target[prop] instanceof String || typeof source[prop] === 'string' || source[prop] instanceof String) {
|
|
25257
|
-
if (overwrite) target[prop] = source[prop];
|
|
25258
|
-
} else {
|
|
25259
|
-
deepExtend(target[prop], source[prop], overwrite);
|
|
25260
|
-
}
|
|
25261
|
-
} else {
|
|
25262
|
-
target[prop] = source[prop];
|
|
25263
|
-
}
|
|
24930
|
+
if (this.installed) {
|
|
24931
|
+
return;
|
|
25264
24932
|
}
|
|
25265
|
-
|
|
25266
|
-
return target;
|
|
25267
|
-
}
|
|
25268
|
-
function regexEscape(str) {
|
|
25269
|
-
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
|
25270
|
-
}
|
|
25271
|
-
var _entityMap = {
|
|
25272
|
-
'&': '&',
|
|
25273
|
-
'<': '<',
|
|
25274
|
-
'>': '>',
|
|
25275
|
-
'"': '"',
|
|
25276
|
-
"'": ''',
|
|
25277
|
-
'/': '/'
|
|
25278
|
-
};
|
|
25279
|
-
function i18next_escape(data) {
|
|
25280
|
-
if (typeof data === 'string') {
|
|
25281
|
-
return data.replace(/[&<>"'\/]/g, s => _entityMap[s]);
|
|
25282
|
-
}
|
|
25283
|
-
return data;
|
|
25284
|
-
}
|
|
25285
|
-
const chars = [' ', ',', '?', '!', ';'];
|
|
25286
|
-
function looksLikeObjectPath(key, nsSeparator, keySeparator) {
|
|
25287
|
-
nsSeparator = nsSeparator || '';
|
|
25288
|
-
keySeparator = keySeparator || '';
|
|
25289
|
-
const possibleChars = chars.filter(c => nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0);
|
|
25290
|
-
if (possibleChars.length === 0) return true;
|
|
25291
|
-
const r = new RegExp(`(${possibleChars.map(c => c === '?' ? '\\?' : c).join('|')})`);
|
|
25292
|
-
let matched = !r.test(key);
|
|
25293
|
-
if (!matched) {
|
|
25294
|
-
const ki = key.indexOf(keySeparator);
|
|
25295
|
-
if (ki > 0 && !r.test(key.substring(0, ki))) {
|
|
25296
|
-
matched = true;
|
|
25297
|
-
}
|
|
25298
|
-
}
|
|
25299
|
-
return matched;
|
|
25300
|
-
}
|
|
25301
|
-
function deepFind(obj, path) {
|
|
25302
|
-
let keySeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
|
|
25303
|
-
if (!obj) return undefined;
|
|
25304
|
-
if (obj[path]) return obj[path];
|
|
25305
|
-
const paths = path.split(keySeparator);
|
|
25306
|
-
let current = obj;
|
|
25307
|
-
for (let i = 0; i < paths.length; ++i) {
|
|
25308
|
-
if (!current) return undefined;
|
|
25309
|
-
if (typeof current[paths[i]] === 'string' && i + 1 < paths.length) {
|
|
25310
|
-
return undefined;
|
|
25311
|
-
}
|
|
25312
|
-
if (current[paths[i]] === undefined) {
|
|
25313
|
-
let j = 2;
|
|
25314
|
-
let p = paths.slice(i, i + j).join(keySeparator);
|
|
25315
|
-
let mix = current[p];
|
|
25316
|
-
while (mix === undefined && paths.length > i + j) {
|
|
25317
|
-
j++;
|
|
25318
|
-
p = paths.slice(i, i + j).join(keySeparator);
|
|
25319
|
-
mix = current[p];
|
|
25320
|
-
}
|
|
25321
|
-
if (mix === undefined) return undefined;
|
|
25322
|
-
if (mix === null) return null;
|
|
25323
|
-
if (path.endsWith(p)) {
|
|
25324
|
-
if (typeof mix === 'string') return mix;
|
|
25325
|
-
if (p && typeof mix[p] === 'string') return mix[p];
|
|
25326
|
-
}
|
|
25327
|
-
const joinedPath = paths.slice(i + j).join(keySeparator);
|
|
25328
|
-
if (joinedPath) return deepFind(mix, joinedPath, keySeparator);
|
|
25329
|
-
return undefined;
|
|
25330
|
-
}
|
|
25331
|
-
current = current[paths[i]];
|
|
25332
|
-
}
|
|
25333
|
-
return current;
|
|
25334
|
-
}
|
|
25335
|
-
function getCleanedCode(code) {
|
|
25336
|
-
if (code && code.indexOf('_') > 0) return code.replace('_', '-');
|
|
25337
|
-
return code;
|
|
25338
|
-
}
|
|
25339
|
-
class ResourceStore extends EventEmitter {
|
|
25340
|
-
constructor(data) {
|
|
25341
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
25342
|
-
ns: ['translation'],
|
|
25343
|
-
defaultNS: 'translation'
|
|
25344
|
-
};
|
|
25345
|
-
super();
|
|
25346
|
-
this.data = data || {};
|
|
25347
|
-
this.options = options;
|
|
25348
|
-
if (this.options.keySeparator === undefined) {
|
|
25349
|
-
this.options.keySeparator = '.';
|
|
25350
|
-
}
|
|
25351
|
-
if (this.options.ignoreJSONStructure === undefined) {
|
|
25352
|
-
this.options.ignoreJSONStructure = true;
|
|
25353
|
-
}
|
|
25354
|
-
}
|
|
25355
|
-
addNamespaces(ns) {
|
|
25356
|
-
if (this.options.ns.indexOf(ns) < 0) {
|
|
25357
|
-
this.options.ns.push(ns);
|
|
25358
|
-
}
|
|
25359
|
-
}
|
|
25360
|
-
removeNamespaces(ns) {
|
|
25361
|
-
const index = this.options.ns.indexOf(ns);
|
|
25362
|
-
if (index > -1) {
|
|
25363
|
-
this.options.ns.splice(index, 1);
|
|
25364
|
-
}
|
|
25365
|
-
}
|
|
25366
|
-
getResource(lng, ns, key) {
|
|
25367
|
-
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
25368
|
-
const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
25369
|
-
const ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
25370
|
-
let path = [lng, ns];
|
|
25371
|
-
if (key && typeof key !== 'string') path = path.concat(key);
|
|
25372
|
-
if (key && typeof key === 'string') path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
25373
|
-
if (lng.indexOf('.') > -1) {
|
|
25374
|
-
path = lng.split('.');
|
|
25375
|
-
}
|
|
25376
|
-
const result = getPath(this.data, path);
|
|
25377
|
-
if (result || !ignoreJSONStructure || typeof key !== 'string') return result;
|
|
25378
|
-
return deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);
|
|
25379
|
-
}
|
|
25380
|
-
addResource(lng, ns, key, value) {
|
|
25381
|
-
let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
|
|
25382
|
-
silent: false
|
|
25383
|
-
};
|
|
25384
|
-
const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
25385
|
-
let path = [lng, ns];
|
|
25386
|
-
if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
25387
|
-
if (lng.indexOf('.') > -1) {
|
|
25388
|
-
path = lng.split('.');
|
|
25389
|
-
value = ns;
|
|
25390
|
-
ns = path[1];
|
|
25391
|
-
}
|
|
25392
|
-
this.addNamespaces(ns);
|
|
25393
|
-
setPath(this.data, path, value);
|
|
25394
|
-
if (!options.silent) this.emit('added', lng, ns, key, value);
|
|
25395
|
-
}
|
|
25396
|
-
addResources(lng, ns, resources) {
|
|
25397
|
-
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
|
|
25398
|
-
silent: false
|
|
25399
|
-
};
|
|
25400
|
-
for (const m in resources) {
|
|
25401
|
-
if (typeof resources[m] === 'string' || Object.prototype.toString.apply(resources[m]) === '[object Array]') this.addResource(lng, ns, m, resources[m], {
|
|
25402
|
-
silent: true
|
|
25403
|
-
});
|
|
25404
|
-
}
|
|
25405
|
-
if (!options.silent) this.emit('added', lng, ns, resources);
|
|
25406
|
-
}
|
|
25407
|
-
addResourceBundle(lng, ns, resources, deep, overwrite) {
|
|
25408
|
-
let options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {
|
|
25409
|
-
silent: false
|
|
25410
|
-
};
|
|
25411
|
-
let path = [lng, ns];
|
|
25412
|
-
if (lng.indexOf('.') > -1) {
|
|
25413
|
-
path = lng.split('.');
|
|
25414
|
-
deep = resources;
|
|
25415
|
-
resources = ns;
|
|
25416
|
-
ns = path[1];
|
|
25417
|
-
}
|
|
25418
|
-
this.addNamespaces(ns);
|
|
25419
|
-
let pack = getPath(this.data, path) || {};
|
|
25420
|
-
if (deep) {
|
|
25421
|
-
deepExtend(pack, resources, overwrite);
|
|
25422
|
-
} else {
|
|
25423
|
-
pack = {
|
|
25424
|
-
...pack,
|
|
25425
|
-
...resources
|
|
25426
|
-
};
|
|
25427
|
-
}
|
|
25428
|
-
setPath(this.data, path, pack);
|
|
25429
|
-
if (!options.silent) this.emit('added', lng, ns, resources);
|
|
25430
|
-
}
|
|
25431
|
-
removeResourceBundle(lng, ns) {
|
|
25432
|
-
if (this.hasResourceBundle(lng, ns)) {
|
|
25433
|
-
delete this.data[lng][ns];
|
|
25434
|
-
}
|
|
25435
|
-
this.removeNamespaces(ns);
|
|
25436
|
-
this.emit('removed', lng, ns);
|
|
25437
|
-
}
|
|
25438
|
-
hasResourceBundle(lng, ns) {
|
|
25439
|
-
return this.getResource(lng, ns) !== undefined;
|
|
25440
|
-
}
|
|
25441
|
-
getResourceBundle(lng, ns) {
|
|
25442
|
-
if (!ns) ns = this.options.defaultNS;
|
|
25443
|
-
if (this.options.compatibilityAPI === 'v1') return {
|
|
25444
|
-
...{},
|
|
25445
|
-
...this.getResource(lng, ns)
|
|
25446
|
-
};
|
|
25447
|
-
return this.getResource(lng, ns);
|
|
25448
|
-
}
|
|
25449
|
-
getDataByLanguage(lng) {
|
|
25450
|
-
return this.data[lng];
|
|
25451
|
-
}
|
|
25452
|
-
hasLanguageSomeTranslations(lng) {
|
|
25453
|
-
const data = this.getDataByLanguage(lng);
|
|
25454
|
-
const n = data && Object.keys(data) || [];
|
|
25455
|
-
return !!n.find(v => data[v] && Object.keys(data[v]).length > 0);
|
|
25456
|
-
}
|
|
25457
|
-
toJSON() {
|
|
25458
|
-
return this.data;
|
|
25459
|
-
}
|
|
25460
|
-
}
|
|
25461
|
-
var postProcessor = {
|
|
25462
|
-
processors: {},
|
|
25463
|
-
addPostProcessor(module) {
|
|
25464
|
-
this.processors[module.name] = module;
|
|
25465
|
-
},
|
|
25466
|
-
handle(processors, value, key, options, translator) {
|
|
25467
|
-
processors.forEach(processor => {
|
|
25468
|
-
if (this.processors[processor]) value = this.processors[processor].process(value, key, options, translator);
|
|
25469
|
-
});
|
|
25470
|
-
return value;
|
|
25471
|
-
}
|
|
25472
|
-
};
|
|
25473
|
-
const checkedLoadedFor = {};
|
|
25474
|
-
class Translator extends EventEmitter {
|
|
25475
|
-
constructor(services) {
|
|
25476
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
25477
|
-
super();
|
|
25478
|
-
copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, this);
|
|
25479
|
-
this.options = options;
|
|
25480
|
-
if (this.options.keySeparator === undefined) {
|
|
25481
|
-
this.options.keySeparator = '.';
|
|
25482
|
-
}
|
|
25483
|
-
this.logger = baseLogger.create('translator');
|
|
25484
|
-
}
|
|
25485
|
-
changeLanguage(lng) {
|
|
25486
|
-
if (lng) this.language = lng;
|
|
25487
|
-
}
|
|
25488
|
-
exists(key) {
|
|
25489
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
25490
|
-
interpolation: {}
|
|
25491
|
-
};
|
|
25492
|
-
if (key === undefined || key === null) {
|
|
25493
|
-
return false;
|
|
25494
|
-
}
|
|
25495
|
-
const resolved = this.resolve(key, options);
|
|
25496
|
-
return resolved && resolved.res !== undefined;
|
|
25497
|
-
}
|
|
25498
|
-
extractFromKey(key, options) {
|
|
25499
|
-
let nsSeparator = options.nsSeparator !== undefined ? options.nsSeparator : this.options.nsSeparator;
|
|
25500
|
-
if (nsSeparator === undefined) nsSeparator = ':';
|
|
25501
|
-
const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
25502
|
-
let namespaces = options.ns || this.options.defaultNS || [];
|
|
25503
|
-
const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
|
|
25504
|
-
const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !options.keySeparator && !this.options.userDefinedNsSeparator && !options.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
|
|
25505
|
-
if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
|
|
25506
|
-
const m = key.match(this.interpolator.nestingRegexp);
|
|
25507
|
-
if (m && m.length > 0) {
|
|
25508
|
-
return {
|
|
25509
|
-
key,
|
|
25510
|
-
namespaces
|
|
25511
|
-
};
|
|
25512
|
-
}
|
|
25513
|
-
const parts = key.split(nsSeparator);
|
|
25514
|
-
if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
|
|
25515
|
-
key = parts.join(keySeparator);
|
|
25516
|
-
}
|
|
25517
|
-
if (typeof namespaces === 'string') namespaces = [namespaces];
|
|
25518
|
-
return {
|
|
25519
|
-
key,
|
|
25520
|
-
namespaces
|
|
25521
|
-
};
|
|
25522
|
-
}
|
|
25523
|
-
translate(keys, options, lastKey) {
|
|
25524
|
-
if (typeof options !== 'object' && this.options.overloadTranslationOptionHandler) {
|
|
25525
|
-
options = this.options.overloadTranslationOptionHandler(arguments);
|
|
25526
|
-
}
|
|
25527
|
-
if (typeof options === 'object') options = {
|
|
25528
|
-
...options
|
|
25529
|
-
};
|
|
25530
|
-
if (!options) options = {};
|
|
25531
|
-
if (keys === undefined || keys === null) return '';
|
|
25532
|
-
if (!Array.isArray(keys)) keys = [String(keys)];
|
|
25533
|
-
const returnDetails = options.returnDetails !== undefined ? options.returnDetails : this.options.returnDetails;
|
|
25534
|
-
const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
25535
|
-
const {
|
|
25536
|
-
key,
|
|
25537
|
-
namespaces
|
|
25538
|
-
} = this.extractFromKey(keys[keys.length - 1], options);
|
|
25539
|
-
const namespace = namespaces[namespaces.length - 1];
|
|
25540
|
-
const lng = options.lng || this.language;
|
|
25541
|
-
const appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
25542
|
-
if (lng && lng.toLowerCase() === 'cimode') {
|
|
25543
|
-
if (appendNamespaceToCIMode) {
|
|
25544
|
-
const nsSeparator = options.nsSeparator || this.options.nsSeparator;
|
|
25545
|
-
if (returnDetails) {
|
|
25546
|
-
return {
|
|
25547
|
-
res: `${namespace}${nsSeparator}${key}`,
|
|
25548
|
-
usedKey: key,
|
|
25549
|
-
exactUsedKey: key,
|
|
25550
|
-
usedLng: lng,
|
|
25551
|
-
usedNS: namespace,
|
|
25552
|
-
usedParams: this.getUsedParamsDetails(options)
|
|
25553
|
-
};
|
|
25554
|
-
}
|
|
25555
|
-
return `${namespace}${nsSeparator}${key}`;
|
|
25556
|
-
}
|
|
25557
|
-
if (returnDetails) {
|
|
25558
|
-
return {
|
|
25559
|
-
res: key,
|
|
25560
|
-
usedKey: key,
|
|
25561
|
-
exactUsedKey: key,
|
|
25562
|
-
usedLng: lng,
|
|
25563
|
-
usedNS: namespace,
|
|
25564
|
-
usedParams: this.getUsedParamsDetails(options)
|
|
25565
|
-
};
|
|
25566
|
-
}
|
|
25567
|
-
return key;
|
|
25568
|
-
}
|
|
25569
|
-
const resolved = this.resolve(keys, options);
|
|
25570
|
-
let res = resolved && resolved.res;
|
|
25571
|
-
const resUsedKey = resolved && resolved.usedKey || key;
|
|
25572
|
-
const resExactUsedKey = resolved && resolved.exactUsedKey || key;
|
|
25573
|
-
const resType = Object.prototype.toString.apply(res);
|
|
25574
|
-
const noObject = ['[object Number]', '[object Function]', '[object RegExp]'];
|
|
25575
|
-
const joinArrays = options.joinArrays !== undefined ? options.joinArrays : this.options.joinArrays;
|
|
25576
|
-
const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
|
|
25577
|
-
const handleAsObject = typeof res !== 'string' && typeof res !== 'boolean' && typeof res !== 'number';
|
|
25578
|
-
if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === 'string' && resType === '[object Array]')) {
|
|
25579
|
-
if (!options.returnObjects && !this.options.returnObjects) {
|
|
25580
|
-
if (!this.options.returnedObjectHandler) {
|
|
25581
|
-
this.logger.warn('accessing an object - but returnObjects options is not enabled!');
|
|
25582
|
-
}
|
|
25583
|
-
const r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, {
|
|
25584
|
-
...options,
|
|
25585
|
-
ns: namespaces
|
|
25586
|
-
}) : `key '${key} (${this.language})' returned an object instead of string.`;
|
|
25587
|
-
if (returnDetails) {
|
|
25588
|
-
resolved.res = r;
|
|
25589
|
-
resolved.usedParams = this.getUsedParamsDetails(options);
|
|
25590
|
-
return resolved;
|
|
25591
|
-
}
|
|
25592
|
-
return r;
|
|
25593
|
-
}
|
|
25594
|
-
if (keySeparator) {
|
|
25595
|
-
const resTypeIsArray = resType === '[object Array]';
|
|
25596
|
-
const copy = resTypeIsArray ? [] : {};
|
|
25597
|
-
const newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
|
|
25598
|
-
for (const m in res) {
|
|
25599
|
-
if (Object.prototype.hasOwnProperty.call(res, m)) {
|
|
25600
|
-
const deepKey = `${newKeyToUse}${keySeparator}${m}`;
|
|
25601
|
-
copy[m] = this.translate(deepKey, {
|
|
25602
|
-
...options,
|
|
25603
|
-
...{
|
|
25604
|
-
joinArrays: false,
|
|
25605
|
-
ns: namespaces
|
|
25606
|
-
}
|
|
25607
|
-
});
|
|
25608
|
-
if (copy[m] === deepKey) copy[m] = res[m];
|
|
25609
|
-
}
|
|
25610
|
-
}
|
|
25611
|
-
res = copy;
|
|
25612
|
-
}
|
|
25613
|
-
} else if (handleAsObjectInI18nFormat && typeof joinArrays === 'string' && resType === '[object Array]') {
|
|
25614
|
-
res = res.join(joinArrays);
|
|
25615
|
-
if (res) res = this.extendTranslation(res, keys, options, lastKey);
|
|
25616
|
-
} else {
|
|
25617
|
-
let usedDefault = false;
|
|
25618
|
-
let usedKey = false;
|
|
25619
|
-
const needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
|
|
25620
|
-
const hasDefaultValue = Translator.hasDefaultValue(options);
|
|
25621
|
-
const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : '';
|
|
25622
|
-
const defaultValueSuffixOrdinalFallback = options.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, {
|
|
25623
|
-
ordinal: false
|
|
25624
|
-
}) : '';
|
|
25625
|
-
const defaultValue = options[`defaultValue${defaultValueSuffix}`] || options[`defaultValue${defaultValueSuffixOrdinalFallback}`] || options.defaultValue;
|
|
25626
|
-
if (!this.isValidLookup(res) && hasDefaultValue) {
|
|
25627
|
-
usedDefault = true;
|
|
25628
|
-
res = defaultValue;
|
|
25629
|
-
}
|
|
25630
|
-
if (!this.isValidLookup(res)) {
|
|
25631
|
-
usedKey = true;
|
|
25632
|
-
res = key;
|
|
25633
|
-
}
|
|
25634
|
-
const missingKeyNoValueFallbackToKey = options.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
|
|
25635
|
-
const resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;
|
|
25636
|
-
const updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
|
|
25637
|
-
if (usedKey || usedDefault || updateMissing) {
|
|
25638
|
-
this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);
|
|
25639
|
-
if (keySeparator) {
|
|
25640
|
-
const fk = this.resolve(key, {
|
|
25641
|
-
...options,
|
|
25642
|
-
keySeparator: false
|
|
25643
|
-
});
|
|
25644
|
-
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.');
|
|
25645
|
-
}
|
|
25646
|
-
let lngs = [];
|
|
25647
|
-
const fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);
|
|
25648
|
-
if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {
|
|
25649
|
-
for (let i = 0; i < fallbackLngs.length; i++) {
|
|
25650
|
-
lngs.push(fallbackLngs[i]);
|
|
25651
|
-
}
|
|
25652
|
-
} else if (this.options.saveMissingTo === 'all') {
|
|
25653
|
-
lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);
|
|
25654
|
-
} else {
|
|
25655
|
-
lngs.push(options.lng || this.language);
|
|
25656
|
-
}
|
|
25657
|
-
const send = (l, k, specificDefaultValue) => {
|
|
25658
|
-
const defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
|
|
25659
|
-
if (this.options.missingKeyHandler) {
|
|
25660
|
-
this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, options);
|
|
25661
|
-
} else if (this.backendConnector && this.backendConnector.saveMissing) {
|
|
25662
|
-
this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, options);
|
|
25663
|
-
}
|
|
25664
|
-
this.emit('missingKey', l, namespace, k, res);
|
|
25665
|
-
};
|
|
25666
|
-
if (this.options.saveMissing) {
|
|
25667
|
-
if (this.options.saveMissingPlurals && needsPluralHandling) {
|
|
25668
|
-
lngs.forEach(language => {
|
|
25669
|
-
this.pluralResolver.getSuffixes(language, options).forEach(suffix => {
|
|
25670
|
-
send([language], key + suffix, options[`defaultValue${suffix}`] || defaultValue);
|
|
25671
|
-
});
|
|
25672
|
-
});
|
|
25673
|
-
} else {
|
|
25674
|
-
send(lngs, key, defaultValue);
|
|
25675
|
-
}
|
|
25676
|
-
}
|
|
25677
|
-
}
|
|
25678
|
-
res = this.extendTranslation(res, keys, options, resolved, lastKey);
|
|
25679
|
-
if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = `${namespace}:${key}`;
|
|
25680
|
-
if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
|
|
25681
|
-
if (this.options.compatibilityAPI !== 'v1') {
|
|
25682
|
-
res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}:${key}` : key, usedDefault ? res : undefined);
|
|
25683
|
-
} else {
|
|
25684
|
-
res = this.options.parseMissingKeyHandler(res);
|
|
25685
|
-
}
|
|
25686
|
-
}
|
|
25687
|
-
}
|
|
25688
|
-
if (returnDetails) {
|
|
25689
|
-
resolved.res = res;
|
|
25690
|
-
resolved.usedParams = this.getUsedParamsDetails(options);
|
|
25691
|
-
return resolved;
|
|
25692
|
-
}
|
|
25693
|
-
return res;
|
|
25694
|
-
}
|
|
25695
|
-
extendTranslation(res, key, options, resolved, lastKey) {
|
|
25696
|
-
var _this = this;
|
|
25697
|
-
if (this.i18nFormat && this.i18nFormat.parse) {
|
|
25698
|
-
res = this.i18nFormat.parse(res, {
|
|
25699
|
-
...this.options.interpolation.defaultVariables,
|
|
25700
|
-
...options
|
|
25701
|
-
}, options.lng || this.language || resolved.usedLng, resolved.usedNS, resolved.usedKey, {
|
|
25702
|
-
resolved
|
|
25703
|
-
});
|
|
25704
|
-
} else if (!options.skipInterpolation) {
|
|
25705
|
-
if (options.interpolation) this.interpolator.init({
|
|
25706
|
-
...options,
|
|
25707
|
-
...{
|
|
25708
|
-
interpolation: {
|
|
25709
|
-
...this.options.interpolation,
|
|
25710
|
-
...options.interpolation
|
|
25711
|
-
}
|
|
25712
|
-
}
|
|
25713
|
-
});
|
|
25714
|
-
const skipOnVariables = typeof res === 'string' && (options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
25715
|
-
let nestBef;
|
|
25716
|
-
if (skipOnVariables) {
|
|
25717
|
-
const nb = res.match(this.interpolator.nestingRegexp);
|
|
25718
|
-
nestBef = nb && nb.length;
|
|
25719
|
-
}
|
|
25720
|
-
let data = options.replace && typeof options.replace !== 'string' ? options.replace : options;
|
|
25721
|
-
if (this.options.interpolation.defaultVariables) data = {
|
|
25722
|
-
...this.options.interpolation.defaultVariables,
|
|
25723
|
-
...data
|
|
25724
|
-
};
|
|
25725
|
-
res = this.interpolator.interpolate(res, data, options.lng || this.language, options);
|
|
25726
|
-
if (skipOnVariables) {
|
|
25727
|
-
const na = res.match(this.interpolator.nestingRegexp);
|
|
25728
|
-
const nestAft = na && na.length;
|
|
25729
|
-
if (nestBef < nestAft) options.nest = false;
|
|
25730
|
-
}
|
|
25731
|
-
if (!options.lng && this.options.compatibilityAPI !== 'v1' && resolved && resolved.res) options.lng = resolved.usedLng;
|
|
25732
|
-
if (options.nest !== false) res = this.interpolator.nest(res, function () {
|
|
25733
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25734
|
-
args[_key] = arguments[_key];
|
|
25735
|
-
}
|
|
25736
|
-
if (lastKey && lastKey[0] === args[0] && !options.context) {
|
|
25737
|
-
_this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
|
|
25738
|
-
return null;
|
|
25739
|
-
}
|
|
25740
|
-
return _this.translate(...args, key);
|
|
25741
|
-
}, options);
|
|
25742
|
-
if (options.interpolation) this.interpolator.reset();
|
|
25743
|
-
}
|
|
25744
|
-
const postProcess = options.postProcess || this.options.postProcess;
|
|
25745
|
-
const postProcessorNames = typeof postProcess === 'string' ? [postProcess] : postProcess;
|
|
25746
|
-
if (res !== undefined && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {
|
|
25747
|
-
res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? {
|
|
25748
|
-
i18nResolved: resolved,
|
|
25749
|
-
...options
|
|
25750
|
-
} : options, this);
|
|
25751
|
-
}
|
|
25752
|
-
return res;
|
|
25753
|
-
}
|
|
25754
|
-
resolve(keys) {
|
|
25755
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
25756
|
-
let found;
|
|
25757
|
-
let usedKey;
|
|
25758
|
-
let exactUsedKey;
|
|
25759
|
-
let usedLng;
|
|
25760
|
-
let usedNS;
|
|
25761
|
-
if (typeof keys === 'string') keys = [keys];
|
|
25762
|
-
keys.forEach(k => {
|
|
25763
|
-
if (this.isValidLookup(found)) return;
|
|
25764
|
-
const extracted = this.extractFromKey(k, options);
|
|
25765
|
-
const key = extracted.key;
|
|
25766
|
-
usedKey = key;
|
|
25767
|
-
let namespaces = extracted.namespaces;
|
|
25768
|
-
if (this.options.fallbackNS) namespaces = namespaces.concat(this.options.fallbackNS);
|
|
25769
|
-
const needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
|
|
25770
|
-
const needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0 && this.pluralResolver.shouldUseIntlApi();
|
|
25771
|
-
const needsContextHandling = options.context !== undefined && (typeof options.context === 'string' || typeof options.context === 'number') && options.context !== '';
|
|
25772
|
-
const codes = options.lngs ? options.lngs : this.languageUtils.toResolveHierarchy(options.lng || this.language, options.fallbackLng);
|
|
25773
|
-
namespaces.forEach(ns => {
|
|
25774
|
-
if (this.isValidLookup(found)) return;
|
|
25775
|
-
usedNS = ns;
|
|
25776
|
-
if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils && this.utils.hasLoadedNamespace && !this.utils.hasLoadedNamespace(usedNS)) {
|
|
25777
|
-
checkedLoadedFor[`${codes[0]}-${ns}`] = true;
|
|
25778
|
-
this.logger.warn(`key "${usedKey}" for languages "${codes.join(', ')}" won't get resolved as namespace "${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!!!');
|
|
25779
|
-
}
|
|
25780
|
-
codes.forEach(code => {
|
|
25781
|
-
if (this.isValidLookup(found)) return;
|
|
25782
|
-
usedLng = code;
|
|
25783
|
-
const finalKeys = [key];
|
|
25784
|
-
if (this.i18nFormat && this.i18nFormat.addLookupKeys) {
|
|
25785
|
-
this.i18nFormat.addLookupKeys(finalKeys, key, code, ns, options);
|
|
25786
|
-
} else {
|
|
25787
|
-
let pluralSuffix;
|
|
25788
|
-
if (needsPluralHandling) pluralSuffix = this.pluralResolver.getSuffix(code, options.count, options);
|
|
25789
|
-
const zeroSuffix = `${this.options.pluralSeparator}zero`;
|
|
25790
|
-
const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
25791
|
-
if (needsPluralHandling) {
|
|
25792
|
-
finalKeys.push(key + pluralSuffix);
|
|
25793
|
-
if (options.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
|
|
25794
|
-
finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
|
|
25795
|
-
}
|
|
25796
|
-
if (needsZeroSuffixLookup) {
|
|
25797
|
-
finalKeys.push(key + zeroSuffix);
|
|
25798
|
-
}
|
|
25799
|
-
}
|
|
25800
|
-
if (needsContextHandling) {
|
|
25801
|
-
const contextKey = `${key}${this.options.contextSeparator}${options.context}`;
|
|
25802
|
-
finalKeys.push(contextKey);
|
|
25803
|
-
if (needsPluralHandling) {
|
|
25804
|
-
finalKeys.push(contextKey + pluralSuffix);
|
|
25805
|
-
if (options.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
|
|
25806
|
-
finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
|
|
25807
|
-
}
|
|
25808
|
-
if (needsZeroSuffixLookup) {
|
|
25809
|
-
finalKeys.push(contextKey + zeroSuffix);
|
|
25810
|
-
}
|
|
25811
|
-
}
|
|
25812
|
-
}
|
|
25813
|
-
}
|
|
25814
|
-
let possibleKey;
|
|
25815
|
-
while (possibleKey = finalKeys.pop()) {
|
|
25816
|
-
if (!this.isValidLookup(found)) {
|
|
25817
|
-
exactUsedKey = possibleKey;
|
|
25818
|
-
found = this.getResource(code, ns, possibleKey, options);
|
|
25819
|
-
}
|
|
25820
|
-
}
|
|
25821
|
-
});
|
|
25822
|
-
});
|
|
25823
|
-
});
|
|
25824
|
-
return {
|
|
25825
|
-
res: found,
|
|
25826
|
-
usedKey,
|
|
25827
|
-
exactUsedKey,
|
|
25828
|
-
usedLng,
|
|
25829
|
-
usedNS
|
|
25830
|
-
};
|
|
25831
|
-
}
|
|
25832
|
-
isValidLookup(res) {
|
|
25833
|
-
return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');
|
|
25834
|
-
}
|
|
25835
|
-
getResource(code, ns, key) {
|
|
25836
|
-
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
25837
|
-
if (this.i18nFormat && this.i18nFormat.getResource) return this.i18nFormat.getResource(code, ns, key, options);
|
|
25838
|
-
return this.resourceStore.getResource(code, ns, key, options);
|
|
25839
|
-
}
|
|
25840
|
-
getUsedParamsDetails() {
|
|
25841
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
25842
|
-
const optionsKeys = ['defaultValue', 'ordinal', 'context', 'replace', 'lng', 'lngs', 'fallbackLng', 'ns', 'keySeparator', 'nsSeparator', 'returnObjects', 'returnDetails', 'joinArrays', 'postProcess', 'interpolation'];
|
|
25843
|
-
const useOptionsReplaceForData = options.replace && typeof options.replace !== 'string';
|
|
25844
|
-
let data = useOptionsReplaceForData ? options.replace : options;
|
|
25845
|
-
if (useOptionsReplaceForData && typeof options.count !== 'undefined') {
|
|
25846
|
-
data.count = options.count;
|
|
25847
|
-
}
|
|
25848
|
-
if (this.options.interpolation.defaultVariables) {
|
|
25849
|
-
data = {
|
|
25850
|
-
...this.options.interpolation.defaultVariables,
|
|
25851
|
-
...data
|
|
25852
|
-
};
|
|
25853
|
-
}
|
|
25854
|
-
if (!useOptionsReplaceForData) {
|
|
25855
|
-
data = {
|
|
25856
|
-
...data
|
|
25857
|
-
};
|
|
25858
|
-
for (const key of optionsKeys) {
|
|
25859
|
-
delete data[key];
|
|
25860
|
-
}
|
|
25861
|
-
}
|
|
25862
|
-
return data;
|
|
25863
|
-
}
|
|
25864
|
-
static hasDefaultValue(options) {
|
|
25865
|
-
const prefix = 'defaultValue';
|
|
25866
|
-
for (const option in options) {
|
|
25867
|
-
if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {
|
|
25868
|
-
return true;
|
|
25869
|
-
}
|
|
25870
|
-
}
|
|
25871
|
-
return false;
|
|
25872
|
-
}
|
|
25873
|
-
}
|
|
25874
|
-
function capitalize(string) {
|
|
25875
|
-
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
25876
|
-
}
|
|
25877
|
-
class LanguageUtil {
|
|
25878
|
-
constructor(options) {
|
|
25879
|
-
this.options = options;
|
|
25880
|
-
this.supportedLngs = this.options.supportedLngs || false;
|
|
25881
|
-
this.logger = baseLogger.create('languageUtils');
|
|
25882
|
-
}
|
|
25883
|
-
getScriptPartFromCode(code) {
|
|
25884
|
-
code = getCleanedCode(code);
|
|
25885
|
-
if (!code || code.indexOf('-') < 0) return null;
|
|
25886
|
-
const p = code.split('-');
|
|
25887
|
-
if (p.length === 2) return null;
|
|
25888
|
-
p.pop();
|
|
25889
|
-
if (p[p.length - 1].toLowerCase() === 'x') return null;
|
|
25890
|
-
return this.formatLanguageCode(p.join('-'));
|
|
25891
|
-
}
|
|
25892
|
-
getLanguagePartFromCode(code) {
|
|
25893
|
-
code = getCleanedCode(code);
|
|
25894
|
-
if (!code || code.indexOf('-') < 0) return code;
|
|
25895
|
-
const p = code.split('-');
|
|
25896
|
-
return this.formatLanguageCode(p[0]);
|
|
25897
|
-
}
|
|
25898
|
-
formatLanguageCode(code) {
|
|
25899
|
-
if (typeof code === 'string' && code.indexOf('-') > -1) {
|
|
25900
|
-
const specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];
|
|
25901
|
-
let p = code.split('-');
|
|
25902
|
-
if (this.options.lowerCaseLng) {
|
|
25903
|
-
p = p.map(part => part.toLowerCase());
|
|
25904
|
-
} else if (p.length === 2) {
|
|
25905
|
-
p[0] = p[0].toLowerCase();
|
|
25906
|
-
p[1] = p[1].toUpperCase();
|
|
25907
|
-
if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());
|
|
25908
|
-
} else if (p.length === 3) {
|
|
25909
|
-
p[0] = p[0].toLowerCase();
|
|
25910
|
-
if (p[1].length === 2) p[1] = p[1].toUpperCase();
|
|
25911
|
-
if (p[0] !== 'sgn' && p[2].length === 2) p[2] = p[2].toUpperCase();
|
|
25912
|
-
if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());
|
|
25913
|
-
if (specialCases.indexOf(p[2].toLowerCase()) > -1) p[2] = capitalize(p[2].toLowerCase());
|
|
25914
|
-
}
|
|
25915
|
-
return p.join('-');
|
|
25916
|
-
}
|
|
25917
|
-
return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
|
|
25918
|
-
}
|
|
25919
|
-
isSupportedCode(code) {
|
|
25920
|
-
if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
|
|
25921
|
-
code = this.getLanguagePartFromCode(code);
|
|
25922
|
-
}
|
|
25923
|
-
return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
|
|
25924
|
-
}
|
|
25925
|
-
getBestMatchFromCodes(codes) {
|
|
25926
|
-
if (!codes) return null;
|
|
25927
|
-
let found;
|
|
25928
|
-
codes.forEach(code => {
|
|
25929
|
-
if (found) return;
|
|
25930
|
-
const cleanedLng = this.formatLanguageCode(code);
|
|
25931
|
-
if (!this.options.supportedLngs || this.isSupportedCode(cleanedLng)) found = cleanedLng;
|
|
25932
|
-
});
|
|
25933
|
-
if (!found && this.options.supportedLngs) {
|
|
25934
|
-
codes.forEach(code => {
|
|
25935
|
-
if (found) return;
|
|
25936
|
-
const lngOnly = this.getLanguagePartFromCode(code);
|
|
25937
|
-
if (this.isSupportedCode(lngOnly)) return found = lngOnly;
|
|
25938
|
-
found = this.options.supportedLngs.find(supportedLng => {
|
|
25939
|
-
if (supportedLng === lngOnly) return supportedLng;
|
|
25940
|
-
if (supportedLng.indexOf('-') < 0 && lngOnly.indexOf('-') < 0) return;
|
|
25941
|
-
if (supportedLng.indexOf(lngOnly) === 0) return supportedLng;
|
|
25942
|
-
});
|
|
25943
|
-
});
|
|
25944
|
-
}
|
|
25945
|
-
if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
|
|
25946
|
-
return found;
|
|
25947
|
-
}
|
|
25948
|
-
getFallbackCodes(fallbacks, code) {
|
|
25949
|
-
if (!fallbacks) return [];
|
|
25950
|
-
if (typeof fallbacks === 'function') fallbacks = fallbacks(code);
|
|
25951
|
-
if (typeof fallbacks === 'string') fallbacks = [fallbacks];
|
|
25952
|
-
if (Object.prototype.toString.apply(fallbacks) === '[object Array]') return fallbacks;
|
|
25953
|
-
if (!code) return fallbacks.default || [];
|
|
25954
|
-
let found = fallbacks[code];
|
|
25955
|
-
if (!found) found = fallbacks[this.getScriptPartFromCode(code)];
|
|
25956
|
-
if (!found) found = fallbacks[this.formatLanguageCode(code)];
|
|
25957
|
-
if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];
|
|
25958
|
-
if (!found) found = fallbacks.default;
|
|
25959
|
-
return found || [];
|
|
25960
|
-
}
|
|
25961
|
-
toResolveHierarchy(code, fallbackCode) {
|
|
25962
|
-
const fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
|
|
25963
|
-
const codes = [];
|
|
25964
|
-
const addCode = c => {
|
|
25965
|
-
if (!c) return;
|
|
25966
|
-
if (this.isSupportedCode(c)) {
|
|
25967
|
-
codes.push(c);
|
|
25968
|
-
} else {
|
|
25969
|
-
this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);
|
|
25970
|
-
}
|
|
25971
|
-
};
|
|
25972
|
-
if (typeof code === 'string' && (code.indexOf('-') > -1 || code.indexOf('_') > -1)) {
|
|
25973
|
-
if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
|
|
25974
|
-
if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
|
|
25975
|
-
if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
|
|
25976
|
-
} else if (typeof code === 'string') {
|
|
25977
|
-
addCode(this.formatLanguageCode(code));
|
|
25978
|
-
}
|
|
25979
|
-
fallbackCodes.forEach(fc => {
|
|
25980
|
-
if (codes.indexOf(fc) < 0) addCode(this.formatLanguageCode(fc));
|
|
25981
|
-
});
|
|
25982
|
-
return codes;
|
|
25983
|
-
}
|
|
25984
|
-
}
|
|
25985
|
-
let sets = [{
|
|
25986
|
-
lngs: ['ach', 'ak', 'am', 'arn', 'br', 'fil', 'gun', 'ln', 'mfe', 'mg', 'mi', 'oc', 'pt', 'pt-BR', 'tg', 'tl', 'ti', 'tr', 'uz', 'wa'],
|
|
25987
|
-
nr: [1, 2],
|
|
25988
|
-
fc: 1
|
|
25989
|
-
}, {
|
|
25990
|
-
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'],
|
|
25991
|
-
nr: [1, 2],
|
|
25992
|
-
fc: 2
|
|
25993
|
-
}, {
|
|
25994
|
-
lngs: ['ay', 'bo', 'cgg', 'fa', 'ht', 'id', 'ja', 'jbo', 'ka', 'km', 'ko', 'ky', 'lo', 'ms', 'sah', 'su', 'th', 'tt', 'ug', 'vi', 'wo', 'zh'],
|
|
25995
|
-
nr: [1],
|
|
25996
|
-
fc: 3
|
|
25997
|
-
}, {
|
|
25998
|
-
lngs: ['be', 'bs', 'cnr', 'dz', 'hr', 'ru', 'sr', 'uk'],
|
|
25999
|
-
nr: [1, 2, 5],
|
|
26000
|
-
fc: 4
|
|
26001
|
-
}, {
|
|
26002
|
-
lngs: ['ar'],
|
|
26003
|
-
nr: [0, 1, 2, 3, 11, 100],
|
|
26004
|
-
fc: 5
|
|
26005
|
-
}, {
|
|
26006
|
-
lngs: ['cs', 'sk'],
|
|
26007
|
-
nr: [1, 2, 5],
|
|
26008
|
-
fc: 6
|
|
26009
|
-
}, {
|
|
26010
|
-
lngs: ['csb', 'pl'],
|
|
26011
|
-
nr: [1, 2, 5],
|
|
26012
|
-
fc: 7
|
|
26013
|
-
}, {
|
|
26014
|
-
lngs: ['cy'],
|
|
26015
|
-
nr: [1, 2, 3, 8],
|
|
26016
|
-
fc: 8
|
|
26017
|
-
}, {
|
|
26018
|
-
lngs: ['fr'],
|
|
26019
|
-
nr: [1, 2],
|
|
26020
|
-
fc: 9
|
|
26021
|
-
}, {
|
|
26022
|
-
lngs: ['ga'],
|
|
26023
|
-
nr: [1, 2, 3, 7, 11],
|
|
26024
|
-
fc: 10
|
|
26025
|
-
}, {
|
|
26026
|
-
lngs: ['gd'],
|
|
26027
|
-
nr: [1, 2, 3, 20],
|
|
26028
|
-
fc: 11
|
|
26029
|
-
}, {
|
|
26030
|
-
lngs: ['is'],
|
|
26031
|
-
nr: [1, 2],
|
|
26032
|
-
fc: 12
|
|
26033
|
-
}, {
|
|
26034
|
-
lngs: ['jv'],
|
|
26035
|
-
nr: [0, 1],
|
|
26036
|
-
fc: 13
|
|
26037
|
-
}, {
|
|
26038
|
-
lngs: ['kw'],
|
|
26039
|
-
nr: [1, 2, 3, 4],
|
|
26040
|
-
fc: 14
|
|
26041
|
-
}, {
|
|
26042
|
-
lngs: ['lt'],
|
|
26043
|
-
nr: [1, 2, 10],
|
|
26044
|
-
fc: 15
|
|
26045
|
-
}, {
|
|
26046
|
-
lngs: ['lv'],
|
|
26047
|
-
nr: [1, 2, 0],
|
|
26048
|
-
fc: 16
|
|
26049
|
-
}, {
|
|
26050
|
-
lngs: ['mk'],
|
|
26051
|
-
nr: [1, 2],
|
|
26052
|
-
fc: 17
|
|
26053
|
-
}, {
|
|
26054
|
-
lngs: ['mnk'],
|
|
26055
|
-
nr: [0, 1, 2],
|
|
26056
|
-
fc: 18
|
|
26057
|
-
}, {
|
|
26058
|
-
lngs: ['mt'],
|
|
26059
|
-
nr: [1, 2, 11, 20],
|
|
26060
|
-
fc: 19
|
|
26061
|
-
}, {
|
|
26062
|
-
lngs: ['or'],
|
|
26063
|
-
nr: [2, 1],
|
|
26064
|
-
fc: 2
|
|
26065
|
-
}, {
|
|
26066
|
-
lngs: ['ro'],
|
|
26067
|
-
nr: [1, 2, 20],
|
|
26068
|
-
fc: 20
|
|
26069
|
-
}, {
|
|
26070
|
-
lngs: ['sl'],
|
|
26071
|
-
nr: [5, 1, 2, 3],
|
|
26072
|
-
fc: 21
|
|
26073
|
-
}, {
|
|
26074
|
-
lngs: ['he', 'iw'],
|
|
26075
|
-
nr: [1, 2, 20, 21],
|
|
26076
|
-
fc: 22
|
|
26077
|
-
}];
|
|
26078
|
-
let _rulesPluralsTypes = {
|
|
26079
|
-
1: function (n) {
|
|
26080
|
-
return Number(n > 1);
|
|
26081
|
-
},
|
|
26082
|
-
2: function (n) {
|
|
26083
|
-
return Number(n != 1);
|
|
26084
|
-
},
|
|
26085
|
-
3: function (n) {
|
|
26086
|
-
return 0;
|
|
26087
|
-
},
|
|
26088
|
-
4: function (n) {
|
|
26089
|
-
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
26090
|
-
},
|
|
26091
|
-
5: function (n) {
|
|
26092
|
-
return Number(n == 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5);
|
|
26093
|
-
},
|
|
26094
|
-
6: function (n) {
|
|
26095
|
-
return Number(n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2);
|
|
26096
|
-
},
|
|
26097
|
-
7: function (n) {
|
|
26098
|
-
return Number(n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
26099
|
-
},
|
|
26100
|
-
8: function (n) {
|
|
26101
|
-
return Number(n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3);
|
|
26102
|
-
},
|
|
26103
|
-
9: function (n) {
|
|
26104
|
-
return Number(n >= 2);
|
|
26105
|
-
},
|
|
26106
|
-
10: function (n) {
|
|
26107
|
-
return Number(n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4);
|
|
26108
|
-
},
|
|
26109
|
-
11: function (n) {
|
|
26110
|
-
return Number(n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3);
|
|
26111
|
-
},
|
|
26112
|
-
12: function (n) {
|
|
26113
|
-
return Number(n % 10 != 1 || n % 100 == 11);
|
|
26114
|
-
},
|
|
26115
|
-
13: function (n) {
|
|
26116
|
-
return Number(n !== 0);
|
|
26117
|
-
},
|
|
26118
|
-
14: function (n) {
|
|
26119
|
-
return Number(n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3);
|
|
26120
|
-
},
|
|
26121
|
-
15: function (n) {
|
|
26122
|
-
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
26123
|
-
},
|
|
26124
|
-
16: function (n) {
|
|
26125
|
-
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2);
|
|
26126
|
-
},
|
|
26127
|
-
17: function (n) {
|
|
26128
|
-
return Number(n == 1 || n % 10 == 1 && n % 100 != 11 ? 0 : 1);
|
|
26129
|
-
},
|
|
26130
|
-
18: function (n) {
|
|
26131
|
-
return Number(n == 0 ? 0 : n == 1 ? 1 : 2);
|
|
26132
|
-
},
|
|
26133
|
-
19: function (n) {
|
|
26134
|
-
return Number(n == 1 ? 0 : n == 0 || n % 100 > 1 && n % 100 < 11 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3);
|
|
26135
|
-
},
|
|
26136
|
-
20: function (n) {
|
|
26137
|
-
return Number(n == 1 ? 0 : n == 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2);
|
|
26138
|
-
},
|
|
26139
|
-
21: function (n) {
|
|
26140
|
-
return Number(n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0);
|
|
26141
|
-
},
|
|
26142
|
-
22: function (n) {
|
|
26143
|
-
return Number(n == 1 ? 0 : n == 2 ? 1 : (n < 0 || n > 10) && n % 10 == 0 ? 2 : 3);
|
|
26144
|
-
}
|
|
26145
|
-
};
|
|
26146
|
-
const nonIntlVersions = ['v1', 'v2', 'v3'];
|
|
26147
|
-
const intlVersions = ['v4'];
|
|
26148
|
-
const suffixesOrder = {
|
|
26149
|
-
zero: 0,
|
|
26150
|
-
one: 1,
|
|
26151
|
-
two: 2,
|
|
26152
|
-
few: 3,
|
|
26153
|
-
many: 4,
|
|
26154
|
-
other: 5
|
|
26155
|
-
};
|
|
26156
|
-
function createRules() {
|
|
26157
|
-
const rules = {};
|
|
26158
|
-
sets.forEach(set => {
|
|
26159
|
-
set.lngs.forEach(l => {
|
|
26160
|
-
rules[l] = {
|
|
26161
|
-
numbers: set.nr,
|
|
26162
|
-
plurals: _rulesPluralsTypes[set.fc]
|
|
26163
|
-
};
|
|
26164
|
-
});
|
|
26165
|
-
});
|
|
26166
|
-
return rules;
|
|
26167
|
-
}
|
|
26168
|
-
class PluralResolver {
|
|
26169
|
-
constructor(languageUtils) {
|
|
26170
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
26171
|
-
this.languageUtils = languageUtils;
|
|
26172
|
-
this.options = options;
|
|
26173
|
-
this.logger = baseLogger.create('pluralResolver');
|
|
26174
|
-
if ((!this.options.compatibilityJSON || intlVersions.includes(this.options.compatibilityJSON)) && (typeof Intl === 'undefined' || !Intl.PluralRules)) {
|
|
26175
|
-
this.options.compatibilityJSON = 'v3';
|
|
26176
|
-
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.');
|
|
26177
|
-
}
|
|
26178
|
-
this.rules = createRules();
|
|
26179
|
-
}
|
|
26180
|
-
addRule(lng, obj) {
|
|
26181
|
-
this.rules[lng] = obj;
|
|
26182
|
-
}
|
|
26183
|
-
getRule(code) {
|
|
26184
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
26185
|
-
if (this.shouldUseIntlApi()) {
|
|
26186
|
-
try {
|
|
26187
|
-
return new Intl.PluralRules(getCleanedCode(code), {
|
|
26188
|
-
type: options.ordinal ? 'ordinal' : 'cardinal'
|
|
26189
|
-
});
|
|
26190
|
-
} catch {
|
|
26191
|
-
return;
|
|
26192
|
-
}
|
|
26193
|
-
}
|
|
26194
|
-
return this.rules[code] || this.rules[this.languageUtils.getLanguagePartFromCode(code)];
|
|
26195
|
-
}
|
|
26196
|
-
needsPlural(code) {
|
|
26197
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
26198
|
-
const rule = this.getRule(code, options);
|
|
26199
|
-
if (this.shouldUseIntlApi()) {
|
|
26200
|
-
return rule && rule.resolvedOptions().pluralCategories.length > 1;
|
|
26201
|
-
}
|
|
26202
|
-
return rule && rule.numbers.length > 1;
|
|
26203
|
-
}
|
|
26204
|
-
getPluralFormsOfKey(code, key) {
|
|
26205
|
-
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
26206
|
-
return this.getSuffixes(code, options).map(suffix => `${key}${suffix}`);
|
|
26207
|
-
}
|
|
26208
|
-
getSuffixes(code) {
|
|
26209
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
26210
|
-
const rule = this.getRule(code, options);
|
|
26211
|
-
if (!rule) {
|
|
26212
|
-
return [];
|
|
26213
|
-
}
|
|
26214
|
-
if (this.shouldUseIntlApi()) {
|
|
26215
|
-
return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map(pluralCategory => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${pluralCategory}`);
|
|
26216
|
-
}
|
|
26217
|
-
return rule.numbers.map(number => this.getSuffix(code, number, options));
|
|
26218
|
-
}
|
|
26219
|
-
getSuffix(code, count) {
|
|
26220
|
-
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
26221
|
-
const rule = this.getRule(code, options);
|
|
26222
|
-
if (rule) {
|
|
26223
|
-
if (this.shouldUseIntlApi()) {
|
|
26224
|
-
return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${rule.select(count)}`;
|
|
26225
|
-
}
|
|
26226
|
-
return this.getSuffixRetroCompatible(rule, count);
|
|
26227
|
-
}
|
|
26228
|
-
this.logger.warn(`no plural rule found for: ${code}`);
|
|
26229
|
-
return '';
|
|
26230
|
-
}
|
|
26231
|
-
getSuffixRetroCompatible(rule, count) {
|
|
26232
|
-
const idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));
|
|
26233
|
-
let suffix = rule.numbers[idx];
|
|
26234
|
-
if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
|
|
26235
|
-
if (suffix === 2) {
|
|
26236
|
-
suffix = 'plural';
|
|
26237
|
-
} else if (suffix === 1) {
|
|
26238
|
-
suffix = '';
|
|
26239
|
-
}
|
|
26240
|
-
}
|
|
26241
|
-
const returnSuffix = () => this.options.prepend && suffix.toString() ? this.options.prepend + suffix.toString() : suffix.toString();
|
|
26242
|
-
if (this.options.compatibilityJSON === 'v1') {
|
|
26243
|
-
if (suffix === 1) return '';
|
|
26244
|
-
if (typeof suffix === 'number') return `_plural_${suffix.toString()}`;
|
|
26245
|
-
return returnSuffix();
|
|
26246
|
-
} else if (this.options.compatibilityJSON === 'v2') {
|
|
26247
|
-
return returnSuffix();
|
|
26248
|
-
} else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
|
|
26249
|
-
return returnSuffix();
|
|
26250
|
-
}
|
|
26251
|
-
return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();
|
|
26252
|
-
}
|
|
26253
|
-
shouldUseIntlApi() {
|
|
26254
|
-
return !nonIntlVersions.includes(this.options.compatibilityJSON);
|
|
26255
|
-
}
|
|
26256
|
-
}
|
|
26257
|
-
function deepFindWithDefaults(data, defaultData, key) {
|
|
26258
|
-
let keySeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '.';
|
|
26259
|
-
let ignoreJSONStructure = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
26260
|
-
let path = getPathWithDefaults(data, defaultData, key);
|
|
26261
|
-
if (!path && ignoreJSONStructure && typeof key === 'string') {
|
|
26262
|
-
path = deepFind(data, key, keySeparator);
|
|
26263
|
-
if (path === undefined) path = deepFind(defaultData, key, keySeparator);
|
|
26264
|
-
}
|
|
26265
|
-
return path;
|
|
26266
|
-
}
|
|
26267
|
-
class Interpolator {
|
|
26268
|
-
constructor() {
|
|
26269
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
26270
|
-
this.logger = baseLogger.create('interpolator');
|
|
26271
|
-
this.options = options;
|
|
26272
|
-
this.format = options.interpolation && options.interpolation.format || (value => value);
|
|
26273
|
-
this.init(options);
|
|
26274
|
-
}
|
|
26275
|
-
init() {
|
|
26276
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
26277
|
-
if (!options.interpolation) options.interpolation = {
|
|
26278
|
-
escapeValue: true
|
|
26279
|
-
};
|
|
26280
|
-
const iOpts = options.interpolation;
|
|
26281
|
-
this.escape = iOpts.escape !== undefined ? iOpts.escape : i18next_escape;
|
|
26282
|
-
this.escapeValue = iOpts.escapeValue !== undefined ? iOpts.escapeValue : true;
|
|
26283
|
-
this.useRawValueToEscape = iOpts.useRawValueToEscape !== undefined ? iOpts.useRawValueToEscape : false;
|
|
26284
|
-
this.prefix = iOpts.prefix ? regexEscape(iOpts.prefix) : iOpts.prefixEscaped || '{{';
|
|
26285
|
-
this.suffix = iOpts.suffix ? regexEscape(iOpts.suffix) : iOpts.suffixEscaped || '}}';
|
|
26286
|
-
this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
|
|
26287
|
-
this.unescapePrefix = iOpts.unescapeSuffix ? '' : iOpts.unescapePrefix || '-';
|
|
26288
|
-
this.unescapeSuffix = this.unescapePrefix ? '' : iOpts.unescapeSuffix || '';
|
|
26289
|
-
this.nestingPrefix = iOpts.nestingPrefix ? regexEscape(iOpts.nestingPrefix) : iOpts.nestingPrefixEscaped || regexEscape('$t(');
|
|
26290
|
-
this.nestingSuffix = iOpts.nestingSuffix ? regexEscape(iOpts.nestingSuffix) : iOpts.nestingSuffixEscaped || regexEscape(')');
|
|
26291
|
-
this.nestingOptionsSeparator = iOpts.nestingOptionsSeparator ? iOpts.nestingOptionsSeparator : iOpts.nestingOptionsSeparator || ',';
|
|
26292
|
-
this.maxReplaces = iOpts.maxReplaces ? iOpts.maxReplaces : 1000;
|
|
26293
|
-
this.alwaysFormat = iOpts.alwaysFormat !== undefined ? iOpts.alwaysFormat : false;
|
|
26294
|
-
this.resetRegExp();
|
|
26295
|
-
}
|
|
26296
|
-
reset() {
|
|
26297
|
-
if (this.options) this.init(this.options);
|
|
26298
|
-
}
|
|
26299
|
-
resetRegExp() {
|
|
26300
|
-
const regexpStr = `${this.prefix}(.+?)${this.suffix}`;
|
|
26301
|
-
this.regexp = new RegExp(regexpStr, 'g');
|
|
26302
|
-
const regexpUnescapeStr = `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;
|
|
26303
|
-
this.regexpUnescape = new RegExp(regexpUnescapeStr, 'g');
|
|
26304
|
-
const nestingRegexpStr = `${this.nestingPrefix}(.+?)${this.nestingSuffix}`;
|
|
26305
|
-
this.nestingRegexp = new RegExp(nestingRegexpStr, 'g');
|
|
26306
|
-
}
|
|
26307
|
-
interpolate(str, data, lng, options) {
|
|
26308
|
-
let match;
|
|
26309
|
-
let value;
|
|
26310
|
-
let replaces;
|
|
26311
|
-
const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
|
|
26312
|
-
function regexSafe(val) {
|
|
26313
|
-
return val.replace(/\$/g, '$$$$');
|
|
26314
|
-
}
|
|
26315
|
-
const handleFormat = key => {
|
|
26316
|
-
if (key.indexOf(this.formatSeparator) < 0) {
|
|
26317
|
-
const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
26318
|
-
return this.alwaysFormat ? this.format(path, undefined, lng, {
|
|
26319
|
-
...options,
|
|
26320
|
-
...data,
|
|
26321
|
-
interpolationkey: key
|
|
26322
|
-
}) : path;
|
|
26323
|
-
}
|
|
26324
|
-
const p = key.split(this.formatSeparator);
|
|
26325
|
-
const k = p.shift().trim();
|
|
26326
|
-
const f = p.join(this.formatSeparator).trim();
|
|
26327
|
-
return this.format(deepFindWithDefaults(data, defaultData, k, this.options.keySeparator, this.options.ignoreJSONStructure), f, lng, {
|
|
26328
|
-
...options,
|
|
26329
|
-
...data,
|
|
26330
|
-
interpolationkey: k
|
|
26331
|
-
});
|
|
26332
|
-
};
|
|
26333
|
-
this.resetRegExp();
|
|
26334
|
-
const missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler;
|
|
26335
|
-
const skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
26336
|
-
const todos = [{
|
|
26337
|
-
regex: this.regexpUnescape,
|
|
26338
|
-
safeValue: val => regexSafe(val)
|
|
26339
|
-
}, {
|
|
26340
|
-
regex: this.regexp,
|
|
26341
|
-
safeValue: val => this.escapeValue ? regexSafe(this.escape(val)) : regexSafe(val)
|
|
26342
|
-
}];
|
|
26343
|
-
todos.forEach(todo => {
|
|
26344
|
-
replaces = 0;
|
|
26345
|
-
while (match = todo.regex.exec(str)) {
|
|
26346
|
-
const matchedVar = match[1].trim();
|
|
26347
|
-
value = handleFormat(matchedVar);
|
|
26348
|
-
if (value === undefined) {
|
|
26349
|
-
if (typeof missingInterpolationHandler === 'function') {
|
|
26350
|
-
const temp = missingInterpolationHandler(str, match, options);
|
|
26351
|
-
value = typeof temp === 'string' ? temp : '';
|
|
26352
|
-
} else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
|
|
26353
|
-
value = '';
|
|
26354
|
-
} else if (skipOnVariables) {
|
|
26355
|
-
value = match[0];
|
|
26356
|
-
continue;
|
|
26357
|
-
} else {
|
|
26358
|
-
this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);
|
|
26359
|
-
value = '';
|
|
26360
|
-
}
|
|
26361
|
-
} else if (typeof value !== 'string' && !this.useRawValueToEscape) {
|
|
26362
|
-
value = makeString(value);
|
|
26363
|
-
}
|
|
26364
|
-
const safeValue = todo.safeValue(value);
|
|
26365
|
-
str = str.replace(match[0], safeValue);
|
|
26366
|
-
if (skipOnVariables) {
|
|
26367
|
-
todo.regex.lastIndex += value.length;
|
|
26368
|
-
todo.regex.lastIndex -= match[0].length;
|
|
26369
|
-
} else {
|
|
26370
|
-
todo.regex.lastIndex = 0;
|
|
26371
|
-
}
|
|
26372
|
-
replaces++;
|
|
26373
|
-
if (replaces >= this.maxReplaces) {
|
|
26374
|
-
break;
|
|
26375
|
-
}
|
|
26376
|
-
}
|
|
26377
|
-
});
|
|
26378
|
-
return str;
|
|
26379
|
-
}
|
|
26380
|
-
nest(str, fc) {
|
|
26381
|
-
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
26382
|
-
let match;
|
|
26383
|
-
let value;
|
|
26384
|
-
let clonedOptions;
|
|
26385
|
-
function handleHasOptions(key, inheritedOptions) {
|
|
26386
|
-
const sep = this.nestingOptionsSeparator;
|
|
26387
|
-
if (key.indexOf(sep) < 0) return key;
|
|
26388
|
-
const c = key.split(new RegExp(`${sep}[ ]*{`));
|
|
26389
|
-
let optionsString = `{${c[1]}`;
|
|
26390
|
-
key = c[0];
|
|
26391
|
-
optionsString = this.interpolate(optionsString, clonedOptions);
|
|
26392
|
-
const matchedSingleQuotes = optionsString.match(/'/g);
|
|
26393
|
-
const matchedDoubleQuotes = optionsString.match(/"/g);
|
|
26394
|
-
if (matchedSingleQuotes && matchedSingleQuotes.length % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
|
|
26395
|
-
optionsString = optionsString.replace(/'/g, '"');
|
|
26396
|
-
}
|
|
26397
|
-
try {
|
|
26398
|
-
clonedOptions = JSON.parse(optionsString);
|
|
26399
|
-
if (inheritedOptions) clonedOptions = {
|
|
26400
|
-
...inheritedOptions,
|
|
26401
|
-
...clonedOptions
|
|
26402
|
-
};
|
|
26403
|
-
} catch (e) {
|
|
26404
|
-
this.logger.warn(`failed parsing options string in nesting for key ${key}`, e);
|
|
26405
|
-
return `${key}${sep}${optionsString}`;
|
|
26406
|
-
}
|
|
26407
|
-
delete clonedOptions.defaultValue;
|
|
26408
|
-
return key;
|
|
26409
|
-
}
|
|
26410
|
-
while (match = this.nestingRegexp.exec(str)) {
|
|
26411
|
-
let formatters = [];
|
|
26412
|
-
clonedOptions = {
|
|
26413
|
-
...options
|
|
26414
|
-
};
|
|
26415
|
-
clonedOptions = clonedOptions.replace && typeof clonedOptions.replace !== 'string' ? clonedOptions.replace : clonedOptions;
|
|
26416
|
-
clonedOptions.applyPostProcessor = false;
|
|
26417
|
-
delete clonedOptions.defaultValue;
|
|
26418
|
-
let doReduce = false;
|
|
26419
|
-
if (match[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(match[1])) {
|
|
26420
|
-
const r = match[1].split(this.formatSeparator).map(elem => elem.trim());
|
|
26421
|
-
match[1] = r.shift();
|
|
26422
|
-
formatters = r;
|
|
26423
|
-
doReduce = true;
|
|
26424
|
-
}
|
|
26425
|
-
value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
|
|
26426
|
-
if (value && match[0] === str && typeof value !== 'string') return value;
|
|
26427
|
-
if (typeof value !== 'string') value = makeString(value);
|
|
26428
|
-
if (!value) {
|
|
26429
|
-
this.logger.warn(`missed to resolve ${match[1]} for nesting ${str}`);
|
|
26430
|
-
value = '';
|
|
26431
|
-
}
|
|
26432
|
-
if (doReduce) {
|
|
26433
|
-
value = formatters.reduce((v, f) => this.format(v, f, options.lng, {
|
|
26434
|
-
...options,
|
|
26435
|
-
interpolationkey: match[1].trim()
|
|
26436
|
-
}), value.trim());
|
|
26437
|
-
}
|
|
26438
|
-
str = str.replace(match[0], value);
|
|
26439
|
-
this.regexp.lastIndex = 0;
|
|
26440
|
-
}
|
|
26441
|
-
return str;
|
|
26442
|
-
}
|
|
26443
|
-
}
|
|
26444
|
-
function parseFormatStr(formatStr) {
|
|
26445
|
-
let formatName = formatStr.toLowerCase().trim();
|
|
26446
|
-
const formatOptions = {};
|
|
26447
|
-
if (formatStr.indexOf('(') > -1) {
|
|
26448
|
-
const p = formatStr.split('(');
|
|
26449
|
-
formatName = p[0].toLowerCase().trim();
|
|
26450
|
-
const optStr = p[1].substring(0, p[1].length - 1);
|
|
26451
|
-
if (formatName === 'currency' && optStr.indexOf(':') < 0) {
|
|
26452
|
-
if (!formatOptions.currency) formatOptions.currency = optStr.trim();
|
|
26453
|
-
} else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {
|
|
26454
|
-
if (!formatOptions.range) formatOptions.range = optStr.trim();
|
|
26455
|
-
} else {
|
|
26456
|
-
const opts = optStr.split(';');
|
|
26457
|
-
opts.forEach(opt => {
|
|
26458
|
-
if (!opt) return;
|
|
26459
|
-
const [key, ...rest] = opt.split(':');
|
|
26460
|
-
const val = rest.join(':').trim().replace(/^'+|'+$/g, '');
|
|
26461
|
-
if (!formatOptions[key.trim()]) formatOptions[key.trim()] = val;
|
|
26462
|
-
if (val === 'false') formatOptions[key.trim()] = false;
|
|
26463
|
-
if (val === 'true') formatOptions[key.trim()] = true;
|
|
26464
|
-
if (!isNaN(val)) formatOptions[key.trim()] = parseInt(val, 10);
|
|
26465
|
-
});
|
|
26466
|
-
}
|
|
26467
|
-
}
|
|
26468
|
-
return {
|
|
26469
|
-
formatName,
|
|
26470
|
-
formatOptions
|
|
26471
|
-
};
|
|
26472
|
-
}
|
|
26473
|
-
function createCachedFormatter(fn) {
|
|
26474
|
-
const cache = {};
|
|
26475
|
-
return function invokeFormatter(val, lng, options) {
|
|
26476
|
-
const key = lng + JSON.stringify(options);
|
|
26477
|
-
let formatter = cache[key];
|
|
26478
|
-
if (!formatter) {
|
|
26479
|
-
formatter = fn(getCleanedCode(lng), options);
|
|
26480
|
-
cache[key] = formatter;
|
|
26481
|
-
}
|
|
26482
|
-
return formatter(val);
|
|
26483
|
-
};
|
|
26484
|
-
}
|
|
26485
|
-
class Formatter {
|
|
26486
|
-
constructor() {
|
|
26487
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
26488
|
-
this.logger = baseLogger.create('formatter');
|
|
26489
|
-
this.options = options;
|
|
26490
|
-
this.formats = {
|
|
26491
|
-
number: createCachedFormatter((lng, opt) => {
|
|
26492
|
-
const formatter = new Intl.NumberFormat(lng, {
|
|
26493
|
-
...opt
|
|
26494
|
-
});
|
|
26495
|
-
return val => formatter.format(val);
|
|
26496
|
-
}),
|
|
26497
|
-
currency: createCachedFormatter((lng, opt) => {
|
|
26498
|
-
const formatter = new Intl.NumberFormat(lng, {
|
|
26499
|
-
...opt,
|
|
26500
|
-
style: 'currency'
|
|
26501
|
-
});
|
|
26502
|
-
return val => formatter.format(val);
|
|
26503
|
-
}),
|
|
26504
|
-
datetime: createCachedFormatter((lng, opt) => {
|
|
26505
|
-
const formatter = new Intl.DateTimeFormat(lng, {
|
|
26506
|
-
...opt
|
|
26507
|
-
});
|
|
26508
|
-
return val => formatter.format(val);
|
|
26509
|
-
}),
|
|
26510
|
-
relativetime: createCachedFormatter((lng, opt) => {
|
|
26511
|
-
const formatter = new Intl.RelativeTimeFormat(lng, {
|
|
26512
|
-
...opt
|
|
26513
|
-
});
|
|
26514
|
-
return val => formatter.format(val, opt.range || 'day');
|
|
26515
|
-
}),
|
|
26516
|
-
list: createCachedFormatter((lng, opt) => {
|
|
26517
|
-
const formatter = new Intl.ListFormat(lng, {
|
|
26518
|
-
...opt
|
|
26519
|
-
});
|
|
26520
|
-
return val => formatter.format(val);
|
|
26521
|
-
})
|
|
26522
|
-
};
|
|
26523
|
-
this.init(options);
|
|
26524
|
-
}
|
|
26525
|
-
init(services) {
|
|
26526
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
26527
|
-
interpolation: {}
|
|
26528
|
-
};
|
|
26529
|
-
const iOpts = options.interpolation;
|
|
26530
|
-
this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
|
|
26531
|
-
}
|
|
26532
|
-
add(name, fc) {
|
|
26533
|
-
this.formats[name.toLowerCase().trim()] = fc;
|
|
26534
|
-
}
|
|
26535
|
-
addCached(name, fc) {
|
|
26536
|
-
this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
|
|
26537
|
-
}
|
|
26538
|
-
format(value, format, lng) {
|
|
26539
|
-
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
26540
|
-
const formats = format.split(this.formatSeparator);
|
|
26541
|
-
const result = formats.reduce((mem, f) => {
|
|
26542
|
-
const {
|
|
26543
|
-
formatName,
|
|
26544
|
-
formatOptions
|
|
26545
|
-
} = parseFormatStr(f);
|
|
26546
|
-
if (this.formats[formatName]) {
|
|
26547
|
-
let formatted = mem;
|
|
26548
|
-
try {
|
|
26549
|
-
const valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || {};
|
|
26550
|
-
const l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
|
|
26551
|
-
formatted = this.formats[formatName](mem, l, {
|
|
26552
|
-
...formatOptions,
|
|
26553
|
-
...options,
|
|
26554
|
-
...valOptions
|
|
26555
|
-
});
|
|
26556
|
-
} catch (error) {
|
|
26557
|
-
this.logger.warn(error);
|
|
26558
|
-
}
|
|
26559
|
-
return formatted;
|
|
26560
|
-
} else {
|
|
26561
|
-
this.logger.warn(`there was no format function for ${formatName}`);
|
|
26562
|
-
}
|
|
26563
|
-
return mem;
|
|
26564
|
-
}, value);
|
|
26565
|
-
return result;
|
|
26566
|
-
}
|
|
26567
|
-
}
|
|
26568
|
-
function removePending(q, name) {
|
|
26569
|
-
if (q.pending[name] !== undefined) {
|
|
26570
|
-
delete q.pending[name];
|
|
26571
|
-
q.pendingCount--;
|
|
26572
|
-
}
|
|
26573
|
-
}
|
|
26574
|
-
class Connector extends EventEmitter {
|
|
26575
|
-
constructor(backend, store, services) {
|
|
26576
|
-
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
26577
|
-
super();
|
|
26578
|
-
this.backend = backend;
|
|
26579
|
-
this.store = store;
|
|
26580
|
-
this.services = services;
|
|
26581
|
-
this.languageUtils = services.languageUtils;
|
|
26582
|
-
this.options = options;
|
|
26583
|
-
this.logger = baseLogger.create('backendConnector');
|
|
26584
|
-
this.waitingReads = [];
|
|
26585
|
-
this.maxParallelReads = options.maxParallelReads || 10;
|
|
26586
|
-
this.readingCalls = 0;
|
|
26587
|
-
this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
|
|
26588
|
-
this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
|
|
26589
|
-
this.state = {};
|
|
26590
|
-
this.queue = [];
|
|
26591
|
-
if (this.backend && this.backend.init) {
|
|
26592
|
-
this.backend.init(services, options.backend, options);
|
|
26593
|
-
}
|
|
26594
|
-
}
|
|
26595
|
-
queueLoad(languages, namespaces, options, callback) {
|
|
26596
|
-
const toLoad = {};
|
|
26597
|
-
const pending = {};
|
|
26598
|
-
const toLoadLanguages = {};
|
|
26599
|
-
const toLoadNamespaces = {};
|
|
26600
|
-
languages.forEach(lng => {
|
|
26601
|
-
let hasAllNamespaces = true;
|
|
26602
|
-
namespaces.forEach(ns => {
|
|
26603
|
-
const name = `${lng}|${ns}`;
|
|
26604
|
-
if (!options.reload && this.store.hasResourceBundle(lng, ns)) {
|
|
26605
|
-
this.state[name] = 2;
|
|
26606
|
-
} else if (this.state[name] < 0) ;else if (this.state[name] === 1) {
|
|
26607
|
-
if (pending[name] === undefined) pending[name] = true;
|
|
26608
|
-
} else {
|
|
26609
|
-
this.state[name] = 1;
|
|
26610
|
-
hasAllNamespaces = false;
|
|
26611
|
-
if (pending[name] === undefined) pending[name] = true;
|
|
26612
|
-
if (toLoad[name] === undefined) toLoad[name] = true;
|
|
26613
|
-
if (toLoadNamespaces[ns] === undefined) toLoadNamespaces[ns] = true;
|
|
26614
|
-
}
|
|
26615
|
-
});
|
|
26616
|
-
if (!hasAllNamespaces) toLoadLanguages[lng] = true;
|
|
26617
|
-
});
|
|
26618
|
-
if (Object.keys(toLoad).length || Object.keys(pending).length) {
|
|
26619
|
-
this.queue.push({
|
|
26620
|
-
pending,
|
|
26621
|
-
pendingCount: Object.keys(pending).length,
|
|
26622
|
-
loaded: {},
|
|
26623
|
-
errors: [],
|
|
26624
|
-
callback
|
|
26625
|
-
});
|
|
26626
|
-
}
|
|
26627
|
-
return {
|
|
26628
|
-
toLoad: Object.keys(toLoad),
|
|
26629
|
-
pending: Object.keys(pending),
|
|
26630
|
-
toLoadLanguages: Object.keys(toLoadLanguages),
|
|
26631
|
-
toLoadNamespaces: Object.keys(toLoadNamespaces)
|
|
26632
|
-
};
|
|
26633
|
-
}
|
|
26634
|
-
loaded(name, err, data) {
|
|
26635
|
-
const s = name.split('|');
|
|
26636
|
-
const lng = s[0];
|
|
26637
|
-
const ns = s[1];
|
|
26638
|
-
if (err) this.emit('failedLoading', lng, ns, err);
|
|
26639
|
-
if (data) {
|
|
26640
|
-
this.store.addResourceBundle(lng, ns, data);
|
|
26641
|
-
}
|
|
26642
|
-
this.state[name] = err ? -1 : 2;
|
|
26643
|
-
const loaded = {};
|
|
26644
|
-
this.queue.forEach(q => {
|
|
26645
|
-
pushPath(q.loaded, [lng], ns);
|
|
26646
|
-
removePending(q, name);
|
|
26647
|
-
if (err) q.errors.push(err);
|
|
26648
|
-
if (q.pendingCount === 0 && !q.done) {
|
|
26649
|
-
Object.keys(q.loaded).forEach(l => {
|
|
26650
|
-
if (!loaded[l]) loaded[l] = {};
|
|
26651
|
-
const loadedKeys = q.loaded[l];
|
|
26652
|
-
if (loadedKeys.length) {
|
|
26653
|
-
loadedKeys.forEach(n => {
|
|
26654
|
-
if (loaded[l][n] === undefined) loaded[l][n] = true;
|
|
26655
|
-
});
|
|
26656
|
-
}
|
|
26657
|
-
});
|
|
26658
|
-
q.done = true;
|
|
26659
|
-
if (q.errors.length) {
|
|
26660
|
-
q.callback(q.errors);
|
|
26661
|
-
} else {
|
|
26662
|
-
q.callback();
|
|
26663
|
-
}
|
|
26664
|
-
}
|
|
26665
|
-
});
|
|
26666
|
-
this.emit('loaded', loaded);
|
|
26667
|
-
this.queue = this.queue.filter(q => !q.done);
|
|
26668
|
-
}
|
|
26669
|
-
read(lng, ns, fcName) {
|
|
26670
|
-
let tried = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
26671
|
-
let wait = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : this.retryTimeout;
|
|
26672
|
-
let callback = arguments.length > 5 ? arguments[5] : undefined;
|
|
26673
|
-
if (!lng.length) return callback(null, {});
|
|
26674
|
-
if (this.readingCalls >= this.maxParallelReads) {
|
|
26675
|
-
this.waitingReads.push({
|
|
26676
|
-
lng,
|
|
26677
|
-
ns,
|
|
26678
|
-
fcName,
|
|
26679
|
-
tried,
|
|
26680
|
-
wait,
|
|
26681
|
-
callback
|
|
26682
|
-
});
|
|
26683
|
-
return;
|
|
26684
|
-
}
|
|
26685
|
-
this.readingCalls++;
|
|
26686
|
-
const resolver = (err, data) => {
|
|
26687
|
-
this.readingCalls--;
|
|
26688
|
-
if (this.waitingReads.length > 0) {
|
|
26689
|
-
const next = this.waitingReads.shift();
|
|
26690
|
-
this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
|
|
26691
|
-
}
|
|
26692
|
-
if (err && data && tried < this.maxRetries) {
|
|
26693
|
-
setTimeout(() => {
|
|
26694
|
-
this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
|
|
26695
|
-
}, wait);
|
|
26696
|
-
return;
|
|
26697
|
-
}
|
|
26698
|
-
callback(err, data);
|
|
26699
|
-
};
|
|
26700
|
-
const fc = this.backend[fcName].bind(this.backend);
|
|
26701
|
-
if (fc.length === 2) {
|
|
26702
|
-
try {
|
|
26703
|
-
const r = fc(lng, ns);
|
|
26704
|
-
if (r && typeof r.then === 'function') {
|
|
26705
|
-
r.then(data => resolver(null, data)).catch(resolver);
|
|
26706
|
-
} else {
|
|
26707
|
-
resolver(null, r);
|
|
26708
|
-
}
|
|
26709
|
-
} catch (err) {
|
|
26710
|
-
resolver(err);
|
|
26711
|
-
}
|
|
26712
|
-
return;
|
|
26713
|
-
}
|
|
26714
|
-
return fc(lng, ns, resolver);
|
|
26715
|
-
}
|
|
26716
|
-
prepareLoading(languages, namespaces) {
|
|
26717
|
-
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
26718
|
-
let callback = arguments.length > 3 ? arguments[3] : undefined;
|
|
26719
|
-
if (!this.backend) {
|
|
26720
|
-
this.logger.warn('No backend was added via i18next.use. Will not load resources.');
|
|
26721
|
-
return callback && callback();
|
|
26722
|
-
}
|
|
26723
|
-
if (typeof languages === 'string') languages = this.languageUtils.toResolveHierarchy(languages);
|
|
26724
|
-
if (typeof namespaces === 'string') namespaces = [namespaces];
|
|
26725
|
-
const toLoad = this.queueLoad(languages, namespaces, options, callback);
|
|
26726
|
-
if (!toLoad.toLoad.length) {
|
|
26727
|
-
if (!toLoad.pending.length) callback();
|
|
26728
|
-
return null;
|
|
26729
|
-
}
|
|
26730
|
-
toLoad.toLoad.forEach(name => {
|
|
26731
|
-
this.loadOne(name);
|
|
26732
|
-
});
|
|
26733
|
-
}
|
|
26734
|
-
load(languages, namespaces, callback) {
|
|
26735
|
-
this.prepareLoading(languages, namespaces, {}, callback);
|
|
26736
|
-
}
|
|
26737
|
-
reload(languages, namespaces, callback) {
|
|
26738
|
-
this.prepareLoading(languages, namespaces, {
|
|
26739
|
-
reload: true
|
|
26740
|
-
}, callback);
|
|
26741
|
-
}
|
|
26742
|
-
loadOne(name) {
|
|
26743
|
-
let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
26744
|
-
const s = name.split('|');
|
|
26745
|
-
const lng = s[0];
|
|
26746
|
-
const ns = s[1];
|
|
26747
|
-
this.read(lng, ns, 'read', undefined, undefined, (err, data) => {
|
|
26748
|
-
if (err) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err);
|
|
26749
|
-
if (!err && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);
|
|
26750
|
-
this.loaded(name, err, data);
|
|
26751
|
-
});
|
|
26752
|
-
}
|
|
26753
|
-
saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
|
|
26754
|
-
let options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
|
|
26755
|
-
let clb = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : () => {};
|
|
26756
|
-
if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) {
|
|
26757
|
-
this.logger.warn(`did not save key "${key}" as the namespace "${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!!!');
|
|
26758
|
-
return;
|
|
26759
|
-
}
|
|
26760
|
-
if (key === undefined || key === null || key === '') return;
|
|
26761
|
-
if (this.backend && this.backend.create) {
|
|
26762
|
-
const opts = {
|
|
26763
|
-
...options,
|
|
26764
|
-
isUpdate
|
|
26765
|
-
};
|
|
26766
|
-
const fc = this.backend.create.bind(this.backend);
|
|
26767
|
-
if (fc.length < 6) {
|
|
26768
|
-
try {
|
|
26769
|
-
let r;
|
|
26770
|
-
if (fc.length === 5) {
|
|
26771
|
-
r = fc(languages, namespace, key, fallbackValue, opts);
|
|
26772
|
-
} else {
|
|
26773
|
-
r = fc(languages, namespace, key, fallbackValue);
|
|
26774
|
-
}
|
|
26775
|
-
if (r && typeof r.then === 'function') {
|
|
26776
|
-
r.then(data => clb(null, data)).catch(clb);
|
|
26777
|
-
} else {
|
|
26778
|
-
clb(null, r);
|
|
26779
|
-
}
|
|
26780
|
-
} catch (err) {
|
|
26781
|
-
clb(err);
|
|
26782
|
-
}
|
|
26783
|
-
} else {
|
|
26784
|
-
fc(languages, namespace, key, fallbackValue, clb, opts);
|
|
26785
|
-
}
|
|
26786
|
-
}
|
|
26787
|
-
if (!languages || !languages[0]) return;
|
|
26788
|
-
this.store.addResource(languages[0], namespace, key, fallbackValue);
|
|
26789
|
-
}
|
|
26790
|
-
}
|
|
26791
|
-
function get() {
|
|
26792
|
-
return {
|
|
26793
|
-
debug: false,
|
|
26794
|
-
initImmediate: true,
|
|
26795
|
-
ns: ['translation'],
|
|
26796
|
-
defaultNS: ['translation'],
|
|
26797
|
-
fallbackLng: ['dev'],
|
|
26798
|
-
fallbackNS: false,
|
|
26799
|
-
supportedLngs: false,
|
|
26800
|
-
nonExplicitSupportedLngs: false,
|
|
26801
|
-
load: 'all',
|
|
26802
|
-
preload: false,
|
|
26803
|
-
simplifyPluralSuffix: true,
|
|
26804
|
-
keySeparator: '.',
|
|
26805
|
-
nsSeparator: ':',
|
|
26806
|
-
pluralSeparator: '_',
|
|
26807
|
-
contextSeparator: '_',
|
|
26808
|
-
partialBundledLanguages: false,
|
|
26809
|
-
saveMissing: false,
|
|
26810
|
-
updateMissing: false,
|
|
26811
|
-
saveMissingTo: 'fallback',
|
|
26812
|
-
saveMissingPlurals: true,
|
|
26813
|
-
missingKeyHandler: false,
|
|
26814
|
-
missingInterpolationHandler: false,
|
|
26815
|
-
postProcess: false,
|
|
26816
|
-
postProcessPassResolved: false,
|
|
26817
|
-
returnNull: false,
|
|
26818
|
-
returnEmptyString: true,
|
|
26819
|
-
returnObjects: false,
|
|
26820
|
-
joinArrays: false,
|
|
26821
|
-
returnedObjectHandler: false,
|
|
26822
|
-
parseMissingKeyHandler: false,
|
|
26823
|
-
appendNamespaceToMissingKey: false,
|
|
26824
|
-
appendNamespaceToCIMode: false,
|
|
26825
|
-
overloadTranslationOptionHandler: function handle(args) {
|
|
26826
|
-
let ret = {};
|
|
26827
|
-
if (typeof args[1] === 'object') ret = args[1];
|
|
26828
|
-
if (typeof args[1] === 'string') ret.defaultValue = args[1];
|
|
26829
|
-
if (typeof args[2] === 'string') ret.tDescription = args[2];
|
|
26830
|
-
if (typeof args[2] === 'object' || typeof args[3] === 'object') {
|
|
26831
|
-
const options = args[3] || args[2];
|
|
26832
|
-
Object.keys(options).forEach(key => {
|
|
26833
|
-
ret[key] = options[key];
|
|
26834
|
-
});
|
|
26835
|
-
}
|
|
26836
|
-
return ret;
|
|
26837
|
-
},
|
|
26838
|
-
interpolation: {
|
|
26839
|
-
escapeValue: true,
|
|
26840
|
-
format: (value, format, lng, options) => value,
|
|
26841
|
-
prefix: '{{',
|
|
26842
|
-
suffix: '}}',
|
|
26843
|
-
formatSeparator: ',',
|
|
26844
|
-
unescapePrefix: '-',
|
|
26845
|
-
nestingPrefix: '$t(',
|
|
26846
|
-
nestingSuffix: ')',
|
|
26847
|
-
nestingOptionsSeparator: ',',
|
|
26848
|
-
maxReplaces: 1000,
|
|
26849
|
-
skipOnVariables: true
|
|
26850
|
-
}
|
|
26851
|
-
};
|
|
26852
|
-
}
|
|
26853
|
-
function transformOptions(options) {
|
|
26854
|
-
if (typeof options.ns === 'string') options.ns = [options.ns];
|
|
26855
|
-
if (typeof options.fallbackLng === 'string') options.fallbackLng = [options.fallbackLng];
|
|
26856
|
-
if (typeof options.fallbackNS === 'string') options.fallbackNS = [options.fallbackNS];
|
|
26857
|
-
if (options.supportedLngs && options.supportedLngs.indexOf('cimode') < 0) {
|
|
26858
|
-
options.supportedLngs = options.supportedLngs.concat(['cimode']);
|
|
26859
|
-
}
|
|
26860
|
-
return options;
|
|
26861
|
-
}
|
|
26862
|
-
function i18next_noop() {}
|
|
26863
|
-
function bindMemberFunctions(inst) {
|
|
26864
|
-
const mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
|
|
26865
|
-
mems.forEach(mem => {
|
|
26866
|
-
if (typeof inst[mem] === 'function') {
|
|
26867
|
-
inst[mem] = inst[mem].bind(inst);
|
|
26868
|
-
}
|
|
26869
|
-
});
|
|
26870
|
-
}
|
|
26871
|
-
class I18n extends EventEmitter {
|
|
26872
|
-
constructor() {
|
|
26873
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
26874
|
-
let callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
26875
|
-
super();
|
|
26876
|
-
this.options = transformOptions(options);
|
|
26877
|
-
this.services = {};
|
|
26878
|
-
this.logger = baseLogger;
|
|
26879
|
-
this.modules = {
|
|
26880
|
-
external: []
|
|
26881
|
-
};
|
|
26882
|
-
bindMemberFunctions(this);
|
|
26883
|
-
if (callback && !this.isInitialized && !options.isClone) {
|
|
26884
|
-
if (!this.options.initImmediate) {
|
|
26885
|
-
this.init(options, callback);
|
|
26886
|
-
return this;
|
|
26887
|
-
}
|
|
26888
|
-
setTimeout(() => {
|
|
26889
|
-
this.init(options, callback);
|
|
26890
|
-
}, 0);
|
|
26891
|
-
}
|
|
26892
|
-
}
|
|
26893
|
-
init() {
|
|
26894
|
-
var _this = this;
|
|
26895
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
26896
|
-
let callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
26897
|
-
if (typeof options === 'function') {
|
|
26898
|
-
callback = options;
|
|
26899
|
-
options = {};
|
|
26900
|
-
}
|
|
26901
|
-
if (!options.defaultNS && options.defaultNS !== false && options.ns) {
|
|
26902
|
-
if (typeof options.ns === 'string') {
|
|
26903
|
-
options.defaultNS = options.ns;
|
|
26904
|
-
} else if (options.ns.indexOf('translation') < 0) {
|
|
26905
|
-
options.defaultNS = options.ns[0];
|
|
26906
|
-
}
|
|
26907
|
-
}
|
|
26908
|
-
const defOpts = get();
|
|
26909
|
-
this.options = {
|
|
26910
|
-
...defOpts,
|
|
26911
|
-
...this.options,
|
|
26912
|
-
...transformOptions(options)
|
|
26913
|
-
};
|
|
26914
|
-
if (this.options.compatibilityAPI !== 'v1') {
|
|
26915
|
-
this.options.interpolation = {
|
|
26916
|
-
...defOpts.interpolation,
|
|
26917
|
-
...this.options.interpolation
|
|
26918
|
-
};
|
|
26919
|
-
}
|
|
26920
|
-
if (options.keySeparator !== undefined) {
|
|
26921
|
-
this.options.userDefinedKeySeparator = options.keySeparator;
|
|
26922
|
-
}
|
|
26923
|
-
if (options.nsSeparator !== undefined) {
|
|
26924
|
-
this.options.userDefinedNsSeparator = options.nsSeparator;
|
|
26925
|
-
}
|
|
26926
|
-
function createClassOnDemand(ClassOrObject) {
|
|
26927
|
-
if (!ClassOrObject) return null;
|
|
26928
|
-
if (typeof ClassOrObject === 'function') return new ClassOrObject();
|
|
26929
|
-
return ClassOrObject;
|
|
26930
|
-
}
|
|
26931
|
-
if (!this.options.isClone) {
|
|
26932
|
-
if (this.modules.logger) {
|
|
26933
|
-
baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
|
|
26934
|
-
} else {
|
|
26935
|
-
baseLogger.init(null, this.options);
|
|
26936
|
-
}
|
|
26937
|
-
let formatter;
|
|
26938
|
-
if (this.modules.formatter) {
|
|
26939
|
-
formatter = this.modules.formatter;
|
|
26940
|
-
} else if (typeof Intl !== 'undefined') {
|
|
26941
|
-
formatter = Formatter;
|
|
26942
|
-
}
|
|
26943
|
-
const lu = new LanguageUtil(this.options);
|
|
26944
|
-
this.store = new ResourceStore(this.options.resources, this.options);
|
|
26945
|
-
const s = this.services;
|
|
26946
|
-
s.logger = baseLogger;
|
|
26947
|
-
s.resourceStore = this.store;
|
|
26948
|
-
s.languageUtils = lu;
|
|
26949
|
-
s.pluralResolver = new PluralResolver(lu, {
|
|
26950
|
-
prepend: this.options.pluralSeparator,
|
|
26951
|
-
compatibilityJSON: this.options.compatibilityJSON,
|
|
26952
|
-
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
26953
|
-
});
|
|
26954
|
-
if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
|
|
26955
|
-
s.formatter = createClassOnDemand(formatter);
|
|
26956
|
-
s.formatter.init(s, this.options);
|
|
26957
|
-
this.options.interpolation.format = s.formatter.format.bind(s.formatter);
|
|
26958
|
-
}
|
|
26959
|
-
s.interpolator = new Interpolator(this.options);
|
|
26960
|
-
s.utils = {
|
|
26961
|
-
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
26962
|
-
};
|
|
26963
|
-
s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
|
|
26964
|
-
s.backendConnector.on('*', function (event) {
|
|
26965
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
26966
|
-
args[_key - 1] = arguments[_key];
|
|
26967
|
-
}
|
|
26968
|
-
_this.emit(event, ...args);
|
|
26969
|
-
});
|
|
26970
|
-
if (this.modules.languageDetector) {
|
|
26971
|
-
s.languageDetector = createClassOnDemand(this.modules.languageDetector);
|
|
26972
|
-
if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);
|
|
26973
|
-
}
|
|
26974
|
-
if (this.modules.i18nFormat) {
|
|
26975
|
-
s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
|
|
26976
|
-
if (s.i18nFormat.init) s.i18nFormat.init(this);
|
|
26977
|
-
}
|
|
26978
|
-
this.translator = new Translator(this.services, this.options);
|
|
26979
|
-
this.translator.on('*', function (event) {
|
|
26980
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
26981
|
-
args[_key2 - 1] = arguments[_key2];
|
|
26982
|
-
}
|
|
26983
|
-
_this.emit(event, ...args);
|
|
26984
|
-
});
|
|
26985
|
-
this.modules.external.forEach(m => {
|
|
26986
|
-
if (m.init) m.init(this);
|
|
26987
|
-
});
|
|
26988
|
-
}
|
|
26989
|
-
this.format = this.options.interpolation.format;
|
|
26990
|
-
if (!callback) callback = i18next_noop;
|
|
26991
|
-
if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
26992
|
-
const codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
26993
|
-
if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];
|
|
26994
|
-
}
|
|
26995
|
-
if (!this.services.languageDetector && !this.options.lng) {
|
|
26996
|
-
this.logger.warn('init: no languageDetector is used and no lng is defined');
|
|
26997
|
-
}
|
|
26998
|
-
const storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];
|
|
26999
|
-
storeApi.forEach(fcName => {
|
|
27000
|
-
this[fcName] = function () {
|
|
27001
|
-
return _this.store[fcName](...arguments);
|
|
27002
|
-
};
|
|
27003
|
-
});
|
|
27004
|
-
const storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];
|
|
27005
|
-
storeApiChained.forEach(fcName => {
|
|
27006
|
-
this[fcName] = function () {
|
|
27007
|
-
_this.store[fcName](...arguments);
|
|
27008
|
-
return _this;
|
|
27009
|
-
};
|
|
27010
|
-
});
|
|
27011
|
-
const deferred = defer();
|
|
27012
|
-
const load = () => {
|
|
27013
|
-
const finish = (err, t) => {
|
|
27014
|
-
if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn('init: i18next is already initialized. You should call init just once!');
|
|
27015
|
-
this.isInitialized = true;
|
|
27016
|
-
if (!this.options.isClone) this.logger.log('initialized', this.options);
|
|
27017
|
-
this.emit('initialized', this.options);
|
|
27018
|
-
deferred.resolve(t);
|
|
27019
|
-
callback(err, t);
|
|
27020
|
-
};
|
|
27021
|
-
if (this.languages && this.options.compatibilityAPI !== 'v1' && !this.isInitialized) return finish(null, this.t.bind(this));
|
|
27022
|
-
this.changeLanguage(this.options.lng, finish);
|
|
27023
|
-
};
|
|
27024
|
-
if (this.options.resources || !this.options.initImmediate) {
|
|
27025
|
-
load();
|
|
27026
|
-
} else {
|
|
27027
|
-
setTimeout(load, 0);
|
|
27028
|
-
}
|
|
27029
|
-
return deferred;
|
|
27030
|
-
}
|
|
27031
|
-
loadResources(language) {
|
|
27032
|
-
let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : i18next_noop;
|
|
27033
|
-
let usedCallback = callback;
|
|
27034
|
-
const usedLng = typeof language === 'string' ? language : this.language;
|
|
27035
|
-
if (typeof language === 'function') usedCallback = language;
|
|
27036
|
-
if (!this.options.resources || this.options.partialBundledLanguages) {
|
|
27037
|
-
if (usedLng && usedLng.toLowerCase() === 'cimode' && (!this.options.preload || this.options.preload.length === 0)) return usedCallback();
|
|
27038
|
-
const toLoad = [];
|
|
27039
|
-
const append = lng => {
|
|
27040
|
-
if (!lng) return;
|
|
27041
|
-
if (lng === 'cimode') return;
|
|
27042
|
-
const lngs = this.services.languageUtils.toResolveHierarchy(lng);
|
|
27043
|
-
lngs.forEach(l => {
|
|
27044
|
-
if (l === 'cimode') return;
|
|
27045
|
-
if (toLoad.indexOf(l) < 0) toLoad.push(l);
|
|
27046
|
-
});
|
|
27047
|
-
};
|
|
27048
|
-
if (!usedLng) {
|
|
27049
|
-
const fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
27050
|
-
fallbacks.forEach(l => append(l));
|
|
27051
|
-
} else {
|
|
27052
|
-
append(usedLng);
|
|
27053
|
-
}
|
|
27054
|
-
if (this.options.preload) {
|
|
27055
|
-
this.options.preload.forEach(l => append(l));
|
|
27056
|
-
}
|
|
27057
|
-
this.services.backendConnector.load(toLoad, this.options.ns, e => {
|
|
27058
|
-
if (!e && !this.resolvedLanguage && this.language) this.setResolvedLanguage(this.language);
|
|
27059
|
-
usedCallback(e);
|
|
27060
|
-
});
|
|
27061
|
-
} else {
|
|
27062
|
-
usedCallback(null);
|
|
27063
|
-
}
|
|
27064
|
-
}
|
|
27065
|
-
reloadResources(lngs, ns, callback) {
|
|
27066
|
-
const deferred = defer();
|
|
27067
|
-
if (!lngs) lngs = this.languages;
|
|
27068
|
-
if (!ns) ns = this.options.ns;
|
|
27069
|
-
if (!callback) callback = i18next_noop;
|
|
27070
|
-
this.services.backendConnector.reload(lngs, ns, err => {
|
|
27071
|
-
deferred.resolve();
|
|
27072
|
-
callback(err);
|
|
27073
|
-
});
|
|
27074
|
-
return deferred;
|
|
27075
|
-
}
|
|
27076
|
-
use(module) {
|
|
27077
|
-
if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');
|
|
27078
|
-
if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');
|
|
27079
|
-
if (module.type === 'backend') {
|
|
27080
|
-
this.modules.backend = module;
|
|
27081
|
-
}
|
|
27082
|
-
if (module.type === 'logger' || module.log && module.warn && module.error) {
|
|
27083
|
-
this.modules.logger = module;
|
|
27084
|
-
}
|
|
27085
|
-
if (module.type === 'languageDetector') {
|
|
27086
|
-
this.modules.languageDetector = module;
|
|
27087
|
-
}
|
|
27088
|
-
if (module.type === 'i18nFormat') {
|
|
27089
|
-
this.modules.i18nFormat = module;
|
|
27090
|
-
}
|
|
27091
|
-
if (module.type === 'postProcessor') {
|
|
27092
|
-
postProcessor.addPostProcessor(module);
|
|
27093
|
-
}
|
|
27094
|
-
if (module.type === 'formatter') {
|
|
27095
|
-
this.modules.formatter = module;
|
|
27096
|
-
}
|
|
27097
|
-
if (module.type === '3rdParty') {
|
|
27098
|
-
this.modules.external.push(module);
|
|
27099
|
-
}
|
|
27100
|
-
return this;
|
|
27101
|
-
}
|
|
27102
|
-
setResolvedLanguage(l) {
|
|
27103
|
-
if (!l || !this.languages) return;
|
|
27104
|
-
if (['cimode', 'dev'].indexOf(l) > -1) return;
|
|
27105
|
-
for (let li = 0; li < this.languages.length; li++) {
|
|
27106
|
-
const lngInLngs = this.languages[li];
|
|
27107
|
-
if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;
|
|
27108
|
-
if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
|
|
27109
|
-
this.resolvedLanguage = lngInLngs;
|
|
27110
|
-
break;
|
|
27111
|
-
}
|
|
27112
|
-
}
|
|
27113
|
-
}
|
|
27114
|
-
changeLanguage(lng, callback) {
|
|
27115
|
-
var _this2 = this;
|
|
27116
|
-
this.isLanguageChangingTo = lng;
|
|
27117
|
-
const deferred = defer();
|
|
27118
|
-
this.emit('languageChanging', lng);
|
|
27119
|
-
const setLngProps = l => {
|
|
27120
|
-
this.language = l;
|
|
27121
|
-
this.languages = this.services.languageUtils.toResolveHierarchy(l);
|
|
27122
|
-
this.resolvedLanguage = undefined;
|
|
27123
|
-
this.setResolvedLanguage(l);
|
|
27124
|
-
};
|
|
27125
|
-
const done = (err, l) => {
|
|
27126
|
-
if (l) {
|
|
27127
|
-
setLngProps(l);
|
|
27128
|
-
this.translator.changeLanguage(l);
|
|
27129
|
-
this.isLanguageChangingTo = undefined;
|
|
27130
|
-
this.emit('languageChanged', l);
|
|
27131
|
-
this.logger.log('languageChanged', l);
|
|
27132
|
-
} else {
|
|
27133
|
-
this.isLanguageChangingTo = undefined;
|
|
27134
|
-
}
|
|
27135
|
-
deferred.resolve(function () {
|
|
27136
|
-
return _this2.t(...arguments);
|
|
27137
|
-
});
|
|
27138
|
-
if (callback) callback(err, function () {
|
|
27139
|
-
return _this2.t(...arguments);
|
|
27140
|
-
});
|
|
27141
|
-
};
|
|
27142
|
-
const setLng = lngs => {
|
|
27143
|
-
if (!lng && !lngs && this.services.languageDetector) lngs = [];
|
|
27144
|
-
const l = typeof lngs === 'string' ? lngs : this.services.languageUtils.getBestMatchFromCodes(lngs);
|
|
27145
|
-
if (l) {
|
|
27146
|
-
if (!this.language) {
|
|
27147
|
-
setLngProps(l);
|
|
27148
|
-
}
|
|
27149
|
-
if (!this.translator.language) this.translator.changeLanguage(l);
|
|
27150
|
-
if (this.services.languageDetector && this.services.languageDetector.cacheUserLanguage) this.services.languageDetector.cacheUserLanguage(l);
|
|
27151
|
-
}
|
|
27152
|
-
this.loadResources(l, err => {
|
|
27153
|
-
done(err, l);
|
|
27154
|
-
});
|
|
27155
|
-
};
|
|
27156
|
-
if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
|
|
27157
|
-
setLng(this.services.languageDetector.detect());
|
|
27158
|
-
} else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
|
|
27159
|
-
if (this.services.languageDetector.detect.length === 0) {
|
|
27160
|
-
this.services.languageDetector.detect().then(setLng);
|
|
27161
|
-
} else {
|
|
27162
|
-
this.services.languageDetector.detect(setLng);
|
|
27163
|
-
}
|
|
27164
|
-
} else {
|
|
27165
|
-
setLng(lng);
|
|
27166
|
-
}
|
|
27167
|
-
return deferred;
|
|
27168
|
-
}
|
|
27169
|
-
getFixedT(lng, ns, keyPrefix) {
|
|
27170
|
-
var _this3 = this;
|
|
27171
|
-
const fixedT = function (key, opts) {
|
|
27172
|
-
let options;
|
|
27173
|
-
if (typeof opts !== 'object') {
|
|
27174
|
-
for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
|
27175
|
-
rest[_key3 - 2] = arguments[_key3];
|
|
27176
|
-
}
|
|
27177
|
-
options = _this3.options.overloadTranslationOptionHandler([key, opts].concat(rest));
|
|
27178
|
-
} else {
|
|
27179
|
-
options = {
|
|
27180
|
-
...opts
|
|
27181
|
-
};
|
|
27182
|
-
}
|
|
27183
|
-
options.lng = options.lng || fixedT.lng;
|
|
27184
|
-
options.lngs = options.lngs || fixedT.lngs;
|
|
27185
|
-
options.ns = options.ns || fixedT.ns;
|
|
27186
|
-
options.keyPrefix = options.keyPrefix || keyPrefix || fixedT.keyPrefix;
|
|
27187
|
-
const keySeparator = _this3.options.keySeparator || '.';
|
|
27188
|
-
let resultKey;
|
|
27189
|
-
if (options.keyPrefix && Array.isArray(key)) {
|
|
27190
|
-
resultKey = key.map(k => `${options.keyPrefix}${keySeparator}${k}`);
|
|
27191
|
-
} else {
|
|
27192
|
-
resultKey = options.keyPrefix ? `${options.keyPrefix}${keySeparator}${key}` : key;
|
|
27193
|
-
}
|
|
27194
|
-
return _this3.t(resultKey, options);
|
|
27195
|
-
};
|
|
27196
|
-
if (typeof lng === 'string') {
|
|
27197
|
-
fixedT.lng = lng;
|
|
27198
|
-
} else {
|
|
27199
|
-
fixedT.lngs = lng;
|
|
27200
|
-
}
|
|
27201
|
-
fixedT.ns = ns;
|
|
27202
|
-
fixedT.keyPrefix = keyPrefix;
|
|
27203
|
-
return fixedT;
|
|
27204
|
-
}
|
|
27205
|
-
t() {
|
|
27206
|
-
return this.translator && this.translator.translate(...arguments);
|
|
27207
|
-
}
|
|
27208
|
-
exists() {
|
|
27209
|
-
return this.translator && this.translator.exists(...arguments);
|
|
27210
|
-
}
|
|
27211
|
-
setDefaultNamespace(ns) {
|
|
27212
|
-
this.options.defaultNS = ns;
|
|
27213
|
-
}
|
|
27214
|
-
hasLoadedNamespace(ns) {
|
|
27215
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
27216
|
-
if (!this.isInitialized) {
|
|
27217
|
-
this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);
|
|
27218
|
-
return false;
|
|
27219
|
-
}
|
|
27220
|
-
if (!this.languages || !this.languages.length) {
|
|
27221
|
-
this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);
|
|
27222
|
-
return false;
|
|
27223
|
-
}
|
|
27224
|
-
const lng = options.lng || this.resolvedLanguage || this.languages[0];
|
|
27225
|
-
const fallbackLng = this.options ? this.options.fallbackLng : false;
|
|
27226
|
-
const lastLng = this.languages[this.languages.length - 1];
|
|
27227
|
-
if (lng.toLowerCase() === 'cimode') return true;
|
|
27228
|
-
const loadNotPending = (l, n) => {
|
|
27229
|
-
const loadState = this.services.backendConnector.state[`${l}|${n}`];
|
|
27230
|
-
return loadState === -1 || loadState === 2;
|
|
27231
|
-
};
|
|
27232
|
-
if (options.precheck) {
|
|
27233
|
-
const preResult = options.precheck(this, loadNotPending);
|
|
27234
|
-
if (preResult !== undefined) return preResult;
|
|
27235
|
-
}
|
|
27236
|
-
if (this.hasResourceBundle(lng, ns)) return true;
|
|
27237
|
-
if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;
|
|
27238
|
-
if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
|
|
27239
|
-
return false;
|
|
27240
|
-
}
|
|
27241
|
-
loadNamespaces(ns, callback) {
|
|
27242
|
-
const deferred = defer();
|
|
27243
|
-
if (!this.options.ns) {
|
|
27244
|
-
if (callback) callback();
|
|
27245
|
-
return Promise.resolve();
|
|
27246
|
-
}
|
|
27247
|
-
if (typeof ns === 'string') ns = [ns];
|
|
27248
|
-
ns.forEach(n => {
|
|
27249
|
-
if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
|
|
27250
|
-
});
|
|
27251
|
-
this.loadResources(err => {
|
|
27252
|
-
deferred.resolve();
|
|
27253
|
-
if (callback) callback(err);
|
|
27254
|
-
});
|
|
27255
|
-
return deferred;
|
|
27256
|
-
}
|
|
27257
|
-
loadLanguages(lngs, callback) {
|
|
27258
|
-
const deferred = defer();
|
|
27259
|
-
if (typeof lngs === 'string') lngs = [lngs];
|
|
27260
|
-
const preloaded = this.options.preload || [];
|
|
27261
|
-
const newLngs = lngs.filter(lng => preloaded.indexOf(lng) < 0);
|
|
27262
|
-
if (!newLngs.length) {
|
|
27263
|
-
if (callback) callback();
|
|
27264
|
-
return Promise.resolve();
|
|
27265
|
-
}
|
|
27266
|
-
this.options.preload = preloaded.concat(newLngs);
|
|
27267
|
-
this.loadResources(err => {
|
|
27268
|
-
deferred.resolve();
|
|
27269
|
-
if (callback) callback(err);
|
|
27270
|
-
});
|
|
27271
|
-
return deferred;
|
|
27272
|
-
}
|
|
27273
|
-
dir(lng) {
|
|
27274
|
-
if (!lng) lng = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language);
|
|
27275
|
-
if (!lng) return 'rtl';
|
|
27276
|
-
const 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'];
|
|
27277
|
-
const languageUtils = this.services && this.services.languageUtils || new LanguageUtil(get());
|
|
27278
|
-
return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
|
|
27279
|
-
}
|
|
27280
|
-
static createInstance() {
|
|
27281
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
27282
|
-
let callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
27283
|
-
return new I18n(options, callback);
|
|
27284
|
-
}
|
|
27285
|
-
cloneInstance() {
|
|
27286
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
27287
|
-
let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : i18next_noop;
|
|
27288
|
-
const forkResourceStore = options.forkResourceStore;
|
|
27289
|
-
if (forkResourceStore) delete options.forkResourceStore;
|
|
27290
|
-
const mergedOptions = {
|
|
27291
|
-
...this.options,
|
|
27292
|
-
...options,
|
|
27293
|
-
...{
|
|
27294
|
-
isClone: true
|
|
27295
|
-
}
|
|
27296
|
-
};
|
|
27297
|
-
const clone = new I18n(mergedOptions);
|
|
27298
|
-
if (options.debug !== undefined || options.prefix !== undefined) {
|
|
27299
|
-
clone.logger = clone.logger.clone(options);
|
|
27300
|
-
}
|
|
27301
|
-
const membersToCopy = ['store', 'services', 'language'];
|
|
27302
|
-
membersToCopy.forEach(m => {
|
|
27303
|
-
clone[m] = this[m];
|
|
27304
|
-
});
|
|
27305
|
-
clone.services = {
|
|
27306
|
-
...this.services
|
|
27307
|
-
};
|
|
27308
|
-
clone.services.utils = {
|
|
27309
|
-
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
27310
|
-
};
|
|
27311
|
-
if (forkResourceStore) {
|
|
27312
|
-
clone.store = new ResourceStore(this.store.data, mergedOptions);
|
|
27313
|
-
clone.services.resourceStore = clone.store;
|
|
27314
|
-
}
|
|
27315
|
-
clone.translator = new Translator(clone.services, mergedOptions);
|
|
27316
|
-
clone.translator.on('*', function (event) {
|
|
27317
|
-
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
27318
|
-
args[_key4 - 1] = arguments[_key4];
|
|
27319
|
-
}
|
|
27320
|
-
clone.emit(event, ...args);
|
|
27321
|
-
});
|
|
27322
|
-
clone.init(mergedOptions, callback);
|
|
27323
|
-
clone.translator.options = mergedOptions;
|
|
27324
|
-
clone.translator.backendConnector.services.utils = {
|
|
27325
|
-
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
27326
|
-
};
|
|
27327
|
-
return clone;
|
|
27328
|
-
}
|
|
27329
|
-
toJSON() {
|
|
27330
|
-
return {
|
|
27331
|
-
options: this.options,
|
|
27332
|
-
store: this.store,
|
|
27333
|
-
language: this.language,
|
|
27334
|
-
languages: this.languages,
|
|
27335
|
-
resolvedLanguage: this.resolvedLanguage
|
|
27336
|
-
};
|
|
27337
|
-
}
|
|
27338
|
-
}
|
|
27339
|
-
const instance = I18n.createInstance();
|
|
27340
|
-
instance.createInstance = I18n.createInstance;
|
|
27341
|
-
const i18next_createInstance = instance.createInstance;
|
|
27342
|
-
const dir = instance.dir;
|
|
27343
|
-
const init = instance.init;
|
|
27344
|
-
const loadResources = instance.loadResources;
|
|
27345
|
-
const reloadResources = instance.reloadResources;
|
|
27346
|
-
const use = instance.use;
|
|
27347
|
-
const changeLanguage = instance.changeLanguage;
|
|
27348
|
-
const getFixedT = instance.getFixedT;
|
|
27349
|
-
const t = instance.t;
|
|
27350
|
-
const exists = instance.exists;
|
|
27351
|
-
const setDefaultNamespace = instance.setDefaultNamespace;
|
|
27352
|
-
const hasLoadedNamespace = instance.hasLoadedNamespace;
|
|
27353
|
-
const loadNamespaces = instance.loadNamespaces;
|
|
27354
|
-
const loadLanguages = instance.loadLanguages;
|
|
27355
|
-
|
|
27356
|
-
// EXTERNAL MODULE: ./node_modules/i18next-vue/dist/index.js
|
|
27357
|
-
var dist = __webpack_require__(3875);
|
|
27358
|
-
;// CONCATENATED MODULE: ./node_modules/i18next-browser-languagedetector/dist/esm/i18nextBrowserLanguageDetector.js
|
|
27359
|
-
|
|
27360
|
-
|
|
27361
|
-
var arr = [];
|
|
27362
|
-
var each = arr.forEach;
|
|
27363
|
-
var slice = arr.slice;
|
|
27364
|
-
function i18nextBrowserLanguageDetector_defaults(obj) {
|
|
27365
|
-
each.call(slice.call(arguments, 1), function (source) {
|
|
27366
|
-
if (source) {
|
|
27367
|
-
for (var prop in source) {
|
|
27368
|
-
if (obj[prop] === undefined) obj[prop] = source[prop];
|
|
27369
|
-
}
|
|
27370
|
-
}
|
|
27371
|
-
});
|
|
27372
|
-
return obj;
|
|
27373
|
-
}
|
|
24933
|
+
this.installed = true;
|
|
27374
24934
|
|
|
27375
|
-
//
|
|
27376
|
-
|
|
27377
|
-
|
|
27378
|
-
|
|
27379
|
-
|
|
27380
|
-
|
|
27381
|
-
|
|
27382
|
-
|
|
27383
|
-
|
|
27384
|
-
|
|
27385
|
-
|
|
27386
|
-
|
|
27387
|
-
|
|
27388
|
-
|
|
27389
|
-
|
|
27390
|
-
|
|
27391
|
-
|
|
27392
|
-
}
|
|
27393
|
-
if (opt.path) {
|
|
27394
|
-
if (!fieldContentRegExp.test(opt.path)) {
|
|
27395
|
-
throw new TypeError('option path is invalid');
|
|
27396
|
-
}
|
|
27397
|
-
str += "; Path=".concat(opt.path);
|
|
27398
|
-
}
|
|
27399
|
-
if (opt.expires) {
|
|
27400
|
-
if (typeof opt.expires.toUTCString !== 'function') {
|
|
27401
|
-
throw new TypeError('option expires is invalid');
|
|
27402
|
-
}
|
|
27403
|
-
str += "; Expires=".concat(opt.expires.toUTCString());
|
|
27404
|
-
}
|
|
27405
|
-
if (opt.httpOnly) str += '; HttpOnly';
|
|
27406
|
-
if (opt.secure) str += '; Secure';
|
|
27407
|
-
if (opt.sameSite) {
|
|
27408
|
-
var sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;
|
|
27409
|
-
switch (sameSite) {
|
|
27410
|
-
case true:
|
|
27411
|
-
str += '; SameSite=Strict';
|
|
27412
|
-
break;
|
|
27413
|
-
case 'lax':
|
|
27414
|
-
str += '; SameSite=Lax';
|
|
27415
|
-
break;
|
|
27416
|
-
case 'strict':
|
|
27417
|
-
str += '; SameSite=Strict';
|
|
27418
|
-
break;
|
|
27419
|
-
case 'none':
|
|
27420
|
-
str += '; SameSite=None';
|
|
27421
|
-
break;
|
|
27422
|
-
default:
|
|
27423
|
-
throw new TypeError('option sameSite is invalid');
|
|
27424
|
-
}
|
|
27425
|
-
}
|
|
27426
|
-
return str;
|
|
27427
|
-
};
|
|
27428
|
-
var cookie = {
|
|
27429
|
-
create: function create(name, value, minutes, domain) {
|
|
27430
|
-
var cookieOptions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
|
|
27431
|
-
path: '/',
|
|
27432
|
-
sameSite: 'strict'
|
|
24935
|
+
// Vue.use(I18NextVue, { i18next })
|
|
24936
|
+
|
|
24937
|
+
// i18next.on('initialized', () => {
|
|
24938
|
+
Vue.use(v_tooltip_esm);
|
|
24939
|
+
Vue.use(v_mask_esm_plugin);
|
|
24940
|
+
assets_icons();
|
|
24941
|
+
Vue.component('font-awesome-icon', FontAwesomeIcon);
|
|
24942
|
+
sessionStorage.setItem('server', 'principal');
|
|
24943
|
+
sessionStorage.setItem('client', settings.client);
|
|
24944
|
+
sessionStorage.setItem('base_url', settings.base_url);
|
|
24945
|
+
const headTag = document.getElementsByTagName('head')[0];
|
|
24946
|
+
const styleTag = document.createElement('style');
|
|
24947
|
+
const theme = {
|
|
24948
|
+
primary: settings.theme.primary,
|
|
24949
|
+
secondary: colorVariation(settings.theme.primary),
|
|
24950
|
+
start: settings.theme.start || '#4caf50',
|
|
24951
|
+
end: settings.theme.end || '#ff5252'
|
|
27433
24952
|
};
|
|
27434
|
-
|
|
27435
|
-
|
|
27436
|
-
|
|
27437
|
-
}
|
|
27438
|
-
|
|
27439
|
-
|
|
27440
|
-
|
|
27441
|
-
|
|
27442
|
-
|
|
27443
|
-
|
|
27444
|
-
|
|
27445
|
-
|
|
27446
|
-
|
|
27447
|
-
|
|
27448
|
-
|
|
27449
|
-
|
|
27450
|
-
}
|
|
27451
|
-
|
|
27452
|
-
},
|
|
27453
|
-
remove: function remove(name) {
|
|
27454
|
-
this.create(name, '', -1);
|
|
27455
|
-
}
|
|
27456
|
-
};
|
|
27457
|
-
var cookie$1 = {
|
|
27458
|
-
name: 'cookie',
|
|
27459
|
-
lookup: function lookup(options) {
|
|
27460
|
-
var found;
|
|
27461
|
-
if (options.lookupCookie && typeof document !== 'undefined') {
|
|
27462
|
-
var c = cookie.read(options.lookupCookie);
|
|
27463
|
-
if (c) found = c;
|
|
27464
|
-
}
|
|
27465
|
-
return found;
|
|
27466
|
-
},
|
|
27467
|
-
cacheUserLanguage: function cacheUserLanguage(lng, options) {
|
|
27468
|
-
if (options.lookupCookie && typeof document !== 'undefined') {
|
|
27469
|
-
cookie.create(options.lookupCookie, lng, options.cookieMinutes, options.cookieDomain, options.cookieOptions);
|
|
27470
|
-
}
|
|
27471
|
-
}
|
|
27472
|
-
};
|
|
27473
|
-
var querystring = {
|
|
27474
|
-
name: 'querystring',
|
|
27475
|
-
lookup: function lookup(options) {
|
|
27476
|
-
var found;
|
|
27477
|
-
if (typeof window !== 'undefined') {
|
|
27478
|
-
var search = window.location.search;
|
|
27479
|
-
if (!window.location.search && window.location.hash && window.location.hash.indexOf('?') > -1) {
|
|
27480
|
-
search = window.location.hash.substring(window.location.hash.indexOf('?'));
|
|
27481
|
-
}
|
|
27482
|
-
var query = search.substring(1);
|
|
27483
|
-
var params = query.split('&');
|
|
27484
|
-
for (var i = 0; i < params.length; i++) {
|
|
27485
|
-
var pos = params[i].indexOf('=');
|
|
27486
|
-
if (pos > 0) {
|
|
27487
|
-
var key = params[i].substring(0, pos);
|
|
27488
|
-
if (key === options.lookupQuerystring) {
|
|
27489
|
-
found = params[i].substring(pos + 1);
|
|
27490
|
-
}
|
|
27491
|
-
}
|
|
27492
|
-
}
|
|
27493
|
-
}
|
|
27494
|
-
return found;
|
|
27495
|
-
}
|
|
27496
|
-
};
|
|
27497
|
-
var hasLocalStorageSupport = null;
|
|
27498
|
-
var localStorageAvailable = function localStorageAvailable() {
|
|
27499
|
-
if (hasLocalStorageSupport !== null) return hasLocalStorageSupport;
|
|
27500
|
-
try {
|
|
27501
|
-
hasLocalStorageSupport = window !== 'undefined' && window.localStorage !== null;
|
|
27502
|
-
var testKey = 'i18next.translate.boo';
|
|
27503
|
-
window.localStorage.setItem(testKey, 'foo');
|
|
27504
|
-
window.localStorage.removeItem(testKey);
|
|
27505
|
-
} catch (e) {
|
|
27506
|
-
hasLocalStorageSupport = false;
|
|
27507
|
-
}
|
|
27508
|
-
return hasLocalStorageSupport;
|
|
27509
|
-
};
|
|
27510
|
-
var localStorage = {
|
|
27511
|
-
name: 'localStorage',
|
|
27512
|
-
lookup: function lookup(options) {
|
|
27513
|
-
var found;
|
|
27514
|
-
if (options.lookupLocalStorage && localStorageAvailable()) {
|
|
27515
|
-
var lng = window.localStorage.getItem(options.lookupLocalStorage);
|
|
27516
|
-
if (lng) found = lng;
|
|
27517
|
-
}
|
|
27518
|
-
return found;
|
|
27519
|
-
},
|
|
27520
|
-
cacheUserLanguage: function cacheUserLanguage(lng, options) {
|
|
27521
|
-
if (options.lookupLocalStorage && localStorageAvailable()) {
|
|
27522
|
-
window.localStorage.setItem(options.lookupLocalStorage, lng);
|
|
27523
|
-
}
|
|
27524
|
-
}
|
|
27525
|
-
};
|
|
27526
|
-
var hasSessionStorageSupport = null;
|
|
27527
|
-
var sessionStorageAvailable = function sessionStorageAvailable() {
|
|
27528
|
-
if (hasSessionStorageSupport !== null) return hasSessionStorageSupport;
|
|
27529
|
-
try {
|
|
27530
|
-
hasSessionStorageSupport = window !== 'undefined' && window.sessionStorage !== null;
|
|
27531
|
-
var testKey = 'i18next.translate.boo';
|
|
27532
|
-
window.sessionStorage.setItem(testKey, 'foo');
|
|
27533
|
-
window.sessionStorage.removeItem(testKey);
|
|
27534
|
-
} catch (e) {
|
|
27535
|
-
hasSessionStorageSupport = false;
|
|
27536
|
-
}
|
|
27537
|
-
return hasSessionStorageSupport;
|
|
27538
|
-
};
|
|
27539
|
-
var i18nextBrowserLanguageDetector_sessionStorage = {
|
|
27540
|
-
name: 'sessionStorage',
|
|
27541
|
-
lookup: function lookup(options) {
|
|
27542
|
-
var found;
|
|
27543
|
-
if (options.lookupSessionStorage && sessionStorageAvailable()) {
|
|
27544
|
-
var lng = window.sessionStorage.getItem(options.lookupSessionStorage);
|
|
27545
|
-
if (lng) found = lng;
|
|
27546
|
-
}
|
|
27547
|
-
return found;
|
|
27548
|
-
},
|
|
27549
|
-
cacheUserLanguage: function cacheUserLanguage(lng, options) {
|
|
27550
|
-
if (options.lookupSessionStorage && sessionStorageAvailable()) {
|
|
27551
|
-
window.sessionStorage.setItem(options.lookupSessionStorage, lng);
|
|
27552
|
-
}
|
|
27553
|
-
}
|
|
27554
|
-
};
|
|
27555
|
-
var navigator$1 = {
|
|
27556
|
-
name: 'navigator',
|
|
27557
|
-
lookup: function lookup(options) {
|
|
27558
|
-
var found = [];
|
|
27559
|
-
if (typeof navigator !== 'undefined') {
|
|
27560
|
-
if (navigator.languages) {
|
|
27561
|
-
// chrome only; not an array, so can't use .push.apply instead of iterating
|
|
27562
|
-
for (var i = 0; i < navigator.languages.length; i++) {
|
|
27563
|
-
found.push(navigator.languages[i]);
|
|
27564
|
-
}
|
|
27565
|
-
}
|
|
27566
|
-
if (navigator.userLanguage) {
|
|
27567
|
-
found.push(navigator.userLanguage);
|
|
27568
|
-
}
|
|
27569
|
-
if (navigator.language) {
|
|
27570
|
-
found.push(navigator.language);
|
|
27571
|
-
}
|
|
27572
|
-
}
|
|
27573
|
-
return found.length > 0 ? found : undefined;
|
|
27574
|
-
}
|
|
27575
|
-
};
|
|
27576
|
-
var htmlTag = {
|
|
27577
|
-
name: 'htmlTag',
|
|
27578
|
-
lookup: function lookup(options) {
|
|
27579
|
-
var found;
|
|
27580
|
-
var htmlTag = options.htmlTag || (typeof document !== 'undefined' ? document.documentElement : null);
|
|
27581
|
-
if (htmlTag && typeof htmlTag.getAttribute === 'function') {
|
|
27582
|
-
found = htmlTag.getAttribute('lang');
|
|
27583
|
-
}
|
|
27584
|
-
return found;
|
|
27585
|
-
}
|
|
27586
|
-
};
|
|
27587
|
-
var path = {
|
|
27588
|
-
name: 'path',
|
|
27589
|
-
lookup: function lookup(options) {
|
|
27590
|
-
var found;
|
|
27591
|
-
if (typeof window !== 'undefined') {
|
|
27592
|
-
var language = window.location.pathname.match(/\/([a-zA-Z-]*)/g);
|
|
27593
|
-
if (language instanceof Array) {
|
|
27594
|
-
if (typeof options.lookupFromPathIndex === 'number') {
|
|
27595
|
-
if (typeof language[options.lookupFromPathIndex] !== 'string') {
|
|
27596
|
-
return undefined;
|
|
27597
|
-
}
|
|
27598
|
-
found = language[options.lookupFromPathIndex].replace('/', '');
|
|
27599
|
-
} else {
|
|
27600
|
-
found = language[0].replace('/', '');
|
|
27601
|
-
}
|
|
27602
|
-
}
|
|
27603
|
-
}
|
|
27604
|
-
return found;
|
|
27605
|
-
}
|
|
27606
|
-
};
|
|
27607
|
-
var subdomain = {
|
|
27608
|
-
name: 'subdomain',
|
|
27609
|
-
lookup: function lookup(options) {
|
|
27610
|
-
// If given get the subdomain index else 1
|
|
27611
|
-
var lookupFromSubdomainIndex = typeof options.lookupFromSubdomainIndex === 'number' ? options.lookupFromSubdomainIndex + 1 : 1;
|
|
27612
|
-
// get all matches if window.location. is existing
|
|
27613
|
-
// first item of match is the match itself and the second is the first group macht which sould be the first subdomain match
|
|
27614
|
-
// is the hostname no public domain get the or option of localhost
|
|
27615
|
-
var language = typeof window !== 'undefined' && window.location && window.location.hostname && window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);
|
|
27616
|
-
|
|
27617
|
-
// if there is no match (null) return undefined
|
|
27618
|
-
if (!language) return undefined;
|
|
27619
|
-
// return the given group match
|
|
27620
|
-
return language[lookupFromSubdomainIndex];
|
|
27621
|
-
}
|
|
27622
|
-
};
|
|
27623
|
-
function getDefaults() {
|
|
27624
|
-
return {
|
|
27625
|
-
order: ['querystring', 'cookie', 'localStorage', 'sessionStorage', 'navigator', 'htmlTag'],
|
|
27626
|
-
lookupQuerystring: 'lng',
|
|
27627
|
-
lookupCookie: 'i18next',
|
|
27628
|
-
lookupLocalStorage: 'i18nextLng',
|
|
27629
|
-
lookupSessionStorage: 'i18nextLng',
|
|
27630
|
-
// cache user language
|
|
27631
|
-
caches: ['localStorage'],
|
|
27632
|
-
excludeCacheFor: ['cimode'],
|
|
27633
|
-
// cookieMinutes: 10,
|
|
27634
|
-
// cookieDomain: 'myDomain'
|
|
27635
|
-
|
|
27636
|
-
convertDetectedLanguage: function convertDetectedLanguage(l) {
|
|
27637
|
-
return l;
|
|
27638
|
-
}
|
|
27639
|
-
};
|
|
27640
|
-
}
|
|
27641
|
-
var Browser = /*#__PURE__*/function () {
|
|
27642
|
-
function Browser(services) {
|
|
27643
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
27644
|
-
_classCallCheck(this, Browser);
|
|
27645
|
-
this.type = 'languageDetector';
|
|
27646
|
-
this.detectors = {};
|
|
27647
|
-
this.init(services, options);
|
|
27648
|
-
}
|
|
27649
|
-
_createClass(Browser, [{
|
|
27650
|
-
key: "init",
|
|
27651
|
-
value: function init(services) {
|
|
27652
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
27653
|
-
var i18nOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
27654
|
-
this.services = services || {
|
|
27655
|
-
languageUtils: {}
|
|
27656
|
-
}; // this way the language detector can be used without i18next
|
|
27657
|
-
this.options = i18nextBrowserLanguageDetector_defaults(options, this.options || {}, getDefaults());
|
|
27658
|
-
if (typeof this.options.convertDetectedLanguage === 'string' && this.options.convertDetectedLanguage.indexOf('15897') > -1) {
|
|
27659
|
-
this.options.convertDetectedLanguage = function (l) {
|
|
27660
|
-
return l.replace('-', '_');
|
|
27661
|
-
};
|
|
27662
|
-
}
|
|
27663
|
-
|
|
27664
|
-
// backwards compatibility
|
|
27665
|
-
if (this.options.lookupFromUrlIndex) this.options.lookupFromPathIndex = this.options.lookupFromUrlIndex;
|
|
27666
|
-
this.i18nOptions = i18nOptions;
|
|
27667
|
-
this.addDetector(cookie$1);
|
|
27668
|
-
this.addDetector(querystring);
|
|
27669
|
-
this.addDetector(localStorage);
|
|
27670
|
-
this.addDetector(i18nextBrowserLanguageDetector_sessionStorage);
|
|
27671
|
-
this.addDetector(navigator$1);
|
|
27672
|
-
this.addDetector(htmlTag);
|
|
27673
|
-
this.addDetector(path);
|
|
27674
|
-
this.addDetector(subdomain);
|
|
27675
|
-
}
|
|
27676
|
-
}, {
|
|
27677
|
-
key: "addDetector",
|
|
27678
|
-
value: function addDetector(detector) {
|
|
27679
|
-
this.detectors[detector.name] = detector;
|
|
27680
|
-
}
|
|
27681
|
-
}, {
|
|
27682
|
-
key: "detect",
|
|
27683
|
-
value: function detect(detectionOrder) {
|
|
27684
|
-
var _this = this;
|
|
27685
|
-
if (!detectionOrder) detectionOrder = this.options.order;
|
|
27686
|
-
var detected = [];
|
|
27687
|
-
detectionOrder.forEach(function (detectorName) {
|
|
27688
|
-
if (_this.detectors[detectorName]) {
|
|
27689
|
-
var lookup = _this.detectors[detectorName].lookup(_this.options);
|
|
27690
|
-
if (lookup && typeof lookup === 'string') lookup = [lookup];
|
|
27691
|
-
if (lookup) detected = detected.concat(lookup);
|
|
27692
|
-
}
|
|
27693
|
-
});
|
|
27694
|
-
detected = detected.map(function (d) {
|
|
27695
|
-
return _this.options.convertDetectedLanguage(d);
|
|
27696
|
-
});
|
|
27697
|
-
if (this.services.languageUtils.getBestMatchFromCodes) return detected; // new i18next v19.5.0
|
|
27698
|
-
return detected.length > 0 ? detected[0] : null; // a little backward compatibility
|
|
27699
|
-
}
|
|
27700
|
-
}, {
|
|
27701
|
-
key: "cacheUserLanguage",
|
|
27702
|
-
value: function cacheUserLanguage(lng, caches) {
|
|
27703
|
-
var _this2 = this;
|
|
27704
|
-
if (!caches) caches = this.options.caches;
|
|
27705
|
-
if (!caches) return;
|
|
27706
|
-
if (this.options.excludeCacheFor && this.options.excludeCacheFor.indexOf(lng) > -1) return;
|
|
27707
|
-
caches.forEach(function (cacheName) {
|
|
27708
|
-
if (_this2.detectors[cacheName]) _this2.detectors[cacheName].cacheUserLanguage(lng, _this2.options);
|
|
27709
|
-
});
|
|
27710
|
-
}
|
|
27711
|
-
}]);
|
|
27712
|
-
return Browser;
|
|
27713
|
-
}();
|
|
27714
|
-
Browser.type = 'languageDetector';
|
|
27715
|
-
|
|
27716
|
-
;// CONCATENATED MODULE: ./src/assets/locales/en-GB.js
|
|
27717
|
-
/* harmony default export */ var en_GB = ({
|
|
27718
|
-
translation: {
|
|
27719
|
-
infoBar: {
|
|
27720
|
-
selected: 'Selected {seconds}s: < {hour_ini} - {hour_end} >',
|
|
27721
|
-
interval: 'Interval: {seconds}s',
|
|
27722
|
-
time: 'Time: {time}',
|
|
27723
|
-
block: 'Block: {time1} - {time2}',
|
|
27724
|
-
alternativeServer: 'Alternative server',
|
|
27725
|
-
changeServer: 'Change server of frames'
|
|
27726
|
-
}
|
|
27727
|
-
}
|
|
27728
|
-
});
|
|
27729
|
-
;// CONCATENATED MODULE: ./src/assets/locales/pt-PT.js
|
|
27730
|
-
/* harmony default export */ var pt_PT = ({
|
|
27731
|
-
translation: {
|
|
27732
|
-
infoBar: {
|
|
27733
|
-
selected: 'Selecionados {{seconds}}s: < {{hour_ini}} - {{hour_end}} >',
|
|
27734
|
-
interval: 'Intervalo: {{seconds}}s',
|
|
27735
|
-
time: 'Tempo: {{time}}',
|
|
27736
|
-
block: 'Bloco: {{time1}} - {{time2}}',
|
|
27737
|
-
alternativeServer: 'Servidor alternativo',
|
|
27738
|
-
changeServer: 'Trocar de servidor de frames'
|
|
27739
|
-
}
|
|
27740
|
-
}
|
|
27741
|
-
});
|
|
27742
|
-
;// CONCATENATED MODULE: ./src/index.js
|
|
27743
|
-
|
|
27744
|
-
|
|
27745
|
-
|
|
27746
|
-
|
|
27747
|
-
|
|
27748
|
-
|
|
27749
|
-
|
|
27750
|
-
|
|
27751
|
-
|
|
27752
|
-
|
|
27753
|
-
|
|
27754
|
-
/* harmony default export */ var src_0 = ({
|
|
27755
|
-
install(Vue) {
|
|
27756
|
-
let settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
27757
|
-
if (!settings.client || !settings.base_url || !settings.theme?.primary) {
|
|
27758
|
-
console.error('Visualization: Missing required settings');
|
|
27759
|
-
return;
|
|
27760
|
-
}
|
|
27761
|
-
if (this.installed) {
|
|
27762
|
-
return;
|
|
27763
|
-
}
|
|
27764
|
-
this.installed = true;
|
|
27765
|
-
Vue.use(dist/* default */.Z, {
|
|
27766
|
-
i18next: instance
|
|
27767
|
-
});
|
|
27768
|
-
instance.on('initialized', () => {
|
|
27769
|
-
Vue.use(v_tooltip_esm);
|
|
27770
|
-
Vue.use(v_mask_esm_plugin);
|
|
27771
|
-
assets_icons();
|
|
27772
|
-
Vue.component('font-awesome-icon', FontAwesomeIcon);
|
|
27773
|
-
sessionStorage.setItem('server', 'principal');
|
|
27774
|
-
sessionStorage.setItem('client', settings.client);
|
|
27775
|
-
sessionStorage.setItem('base_url', settings.base_url);
|
|
27776
|
-
const headTag = document.getElementsByTagName('head')[0];
|
|
27777
|
-
const styleTag = document.createElement('style');
|
|
27778
|
-
const theme = {
|
|
27779
|
-
primary: settings.theme.primary,
|
|
27780
|
-
secondary: colorVariation(settings.theme.primary),
|
|
27781
|
-
start: settings.theme.start || '#4caf50',
|
|
27782
|
-
end: settings.theme.end || '#ff5252'
|
|
27783
|
-
};
|
|
27784
|
-
let themeCss = [];
|
|
27785
|
-
for (const color in theme) {
|
|
27786
|
-
themeCss.push(`--visualization-${color}: ${theme[color]};`);
|
|
27787
|
-
}
|
|
27788
|
-
themeCss = [':root {', ...themeCss, '}'].join(' ');
|
|
27789
|
-
styleTag.innerHTML = themeCss;
|
|
27790
|
-
headTag.appendChild(styleTag);
|
|
27791
|
-
Vue.component('Visualization', Visualization);
|
|
27792
|
-
});
|
|
27793
|
-
instance.use(Browser).init({
|
|
27794
|
-
debug: true,
|
|
27795
|
-
fallbackLng: 'en',
|
|
27796
|
-
resources: {
|
|
27797
|
-
en: en_GB,
|
|
27798
|
-
'pt-PT': pt_PT
|
|
27799
|
-
}
|
|
27800
|
-
});
|
|
24953
|
+
let themeCss = [];
|
|
24954
|
+
for (const color in theme) {
|
|
24955
|
+
themeCss.push(`--visualization-${color}: ${theme[color]};`);
|
|
24956
|
+
}
|
|
24957
|
+
themeCss = [':root {', ...themeCss, '}'].join(' ');
|
|
24958
|
+
styleTag.innerHTML = themeCss;
|
|
24959
|
+
headTag.appendChild(styleTag);
|
|
24960
|
+
Vue.component('Visualization', Visualization);
|
|
24961
|
+
// })
|
|
24962
|
+
|
|
24963
|
+
// i18next.use(LanguageDetector).init({
|
|
24964
|
+
// debug: true,
|
|
24965
|
+
// fallbackLng: 'en',
|
|
24966
|
+
// resources: {
|
|
24967
|
+
// en: en,
|
|
24968
|
+
// 'pt-PT': pt,
|
|
24969
|
+
// },
|
|
24970
|
+
// })
|
|
27801
24971
|
}
|
|
27802
24972
|
});
|
|
27803
24973
|
;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
|