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