lido-player 0.0.2-alpha-50-dev → 0.0.2-alpha-52-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/dist/cjs/{index-6a69c33a.js → index-baff5c15.js} +48 -14
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/{lido-avatar_21.cjs.entry.js → lido-avatar_22.cjs.entry.js} +3043 -162
- package/dist/cjs/lido-player.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{utils-079a5e7d.js → utils-ce99b0d0.js} +294 -108
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/avatar/lido-avatar.css +4 -4
- package/dist/collection/components/avatar/lido-avatar.js +1 -1
- package/dist/collection/components/calculator/lido-calculator.css +87 -87
- package/dist/collection/components/calculator/lido-calculator.js +14 -8
- package/dist/collection/components/canvas/lido-canvas.css +35 -0
- package/dist/collection/components/canvas/lido-canvas.js +220 -0
- package/dist/collection/components/cell/lido-cell.css +100 -100
- package/dist/collection/components/cell/lido-cell.js +12 -12
- package/dist/collection/components/column/lido-col.css +19 -19
- package/dist/collection/components/column/lido-col.js +6 -6
- package/dist/collection/components/container/lido-container.css +10 -10
- package/dist/collection/components/container/lido-container.js +70 -8
- package/dist/collection/components/flashCard/lido-flash-card.css +28 -28
- package/dist/collection/components/flashCard/lido-flash-card.js +4 -4
- package/dist/collection/components/float/lido-float.css +30 -30
- package/dist/collection/components/float/lido-float.js +2 -2
- package/dist/collection/components/home/lido-home.css +278 -278
- package/dist/collection/components/home/lido-home.js +92 -12
- package/dist/collection/components/image/lido-image.css +17 -17
- package/dist/collection/components/image/lido-image.js +6 -6
- package/dist/collection/components/keyboard/lido-keyboard.css +38 -38
- package/dist/collection/components/keyboard/lido-keyboard.js +3 -3
- package/dist/collection/components/mathMatrix/lido-math-matrix.css +56 -56
- package/dist/collection/components/mathMatrix/lido-math-matrix.js +69 -15
- package/dist/collection/components/position/lido-pos.css +16 -16
- package/dist/collection/components/position/lido-pos.js +2 -2
- package/dist/collection/components/random/lido-random.css +8 -8
- package/dist/collection/components/random/lido-random.js +2 -2
- package/dist/collection/components/root/lido-root.js +42 -6
- package/dist/collection/components/row/lido-row.css +10 -10
- package/dist/collection/components/row/lido-row.js +6 -6
- package/dist/collection/components/scale/lido-balance.css +145 -114
- package/dist/collection/components/scale/lido-balance.js +17 -17
- package/dist/collection/components/shape/lido-shape.css +96 -96
- package/dist/collection/components/shape/lido-shape.js +5 -5
- package/dist/collection/components/slideFill/lido-slide-fill.css +3 -3
- package/dist/collection/components/slideFill/lido-slide-fill.js +13 -13
- package/dist/collection/components/text/lido-text.css +53 -53
- package/dist/collection/components/text/lido-text.js +6 -5
- package/dist/collection/components/trace/lido-trace.css +97 -97
- package/dist/collection/components/trace/lido-trace.js +2 -2
- package/dist/collection/components/wrap/lido-wrap.css +18 -18
- package/dist/collection/components/wrap/lido-wrap.js +6 -6
- package/dist/collection/css/animation.css +194 -194
- package/dist/collection/css/index.css +277 -277
- package/dist/collection/stories/Templates/Fill-Up/fill-up.stories.js +60 -60
- package/dist/collection/stories/Templates/LetterPairing/LetterPairing.stories.js +123 -123
- package/dist/collection/stories/Templates/RocketGame/rocketGame.stories.js +55 -48
- package/dist/collection/stories/Templates/Tag/tagGame.stories.js +29 -29
- package/dist/collection/stories/Templates/arrangeLetters/arrangeLetters.stories.js +42 -42
- package/dist/collection/stories/Templates/balancing/balancing.stories.js +37 -31
- package/dist/collection/stories/Templates/balloonPop/balloonPop.stories.js +38 -38
- package/dist/collection/stories/Templates/blender/blender.stories.js +100 -0
- package/dist/collection/stories/Templates/bubbleType/bubbleType.stories.js +42 -42
- package/dist/collection/stories/Templates/calculator/calculator.stories.js +52 -0
- package/dist/collection/stories/Templates/categorize/categorize.stories.js +37 -37
- package/dist/collection/stories/Templates/categorize2/categorize2.stories.js +67 -67
- package/dist/collection/stories/Templates/checker-block/checkerBlock.stories.js +28 -22
- package/dist/collection/stories/Templates/checkerBlock/checkerBlock.stories.js +13 -13
- package/dist/collection/stories/Templates/create-sentence/createSentence.stories.js +74 -74
- package/dist/collection/stories/Templates/dragAndDrop/drag-drop.stories.js +69 -69
- package/dist/collection/stories/Templates/fillAnswer/fill-answer.stories.js +39 -38
- package/dist/collection/stories/Templates/fillBlank/fill-blank.stories.js +282 -282
- package/dist/collection/stories/Templates/foodJar/food-jar.stories.js +37 -35
- package/dist/collection/stories/Templates/grid/grid.stories.js +118 -118
- package/dist/collection/stories/Templates/gridGame/grid-game.stories.js +57 -57
- package/dist/collection/stories/Templates/jumpSentence/jumpSentence.stories.js +41 -41
- package/dist/collection/stories/Templates/letterboard/letterboard.stories.js +183 -183
- package/dist/collection/stories/Templates/makeSentence/make-sentence.stories.js +36 -36
- package/dist/collection/stories/Templates/matchBox/matchBox.stories.js +69 -69
- package/dist/collection/stories/Templates/matchBox/matchBox2.stories.js +54 -54
- package/dist/collection/stories/Templates/matchingCard/matching-card.stories.js +25 -23
- package/dist/collection/stories/Templates/multipleOption/mcqWithQuestionImage.stories.js +112 -112
- package/dist/collection/stories/Templates/multipleOption/multiple-option.stories.js +47 -47
- package/dist/collection/stories/Templates/multiplyBeeds/multiplyBeeds.stories.js +32 -28
- package/dist/collection/stories/Templates/nimbleTable/nimbleTable.stories.js +56 -54
- package/dist/collection/stories/Templates/numberBoard/numberBoard.stories.js +56 -45
- package/dist/collection/stories/Templates/numberBoardTwo/numberBoardTwo.stories.js +41 -39
- package/dist/collection/stories/Templates/numberPair/numberPair.stories.js +131 -127
- package/dist/collection/stories/Templates/openwindow/openwindow.stories.js +53 -49
- package/dist/collection/stories/Templates/openwindow/openwindow2.stories.js +44 -40
- package/dist/collection/stories/Templates/order-tractor/order-tractor-ascending-order.stories.js +98 -97
- package/dist/collection/stories/Templates/order-tractor/order-tractor.stories.js +92 -91
- package/dist/collection/stories/Templates/phonic-tractor/phonic-tractor.stories.js +47 -45
- package/dist/collection/stories/Templates/picturemeaning/pictureMeaningCocos.stories.js +20 -20
- package/dist/collection/stories/Templates/puzzleGame/puzzleGame.stories.js +17 -17
- package/dist/collection/stories/Templates/questionBoard/questionBoard.stories.js +62 -58
- package/dist/collection/stories/Templates/quizLiteracy/quizLiteracy.stories.js +50 -50
- package/dist/collection/stories/Templates/quizLiteracy/quizLiteracyImageWithText.stories.js +36 -36
- package/dist/collection/stories/Templates/quizLiteracy/quizLiteracyImageWord.stories.js +43 -43
- package/dist/collection/stories/Templates/reorder/reorder.stories.js +63 -63
- package/dist/collection/stories/Templates/rowBlocks/rowBlocks.stories.js +52 -48
- package/dist/collection/stories/Templates/sequenceBox/sequenceBox1.stories.js +65 -61
- package/dist/collection/stories/Templates/sequenceBox/sequenceBox2.stories.js +62 -58
- package/dist/collection/stories/Templates/shapePair/shape-pair.stories.js +111 -107
- package/dist/collection/stories/Templates/shapeTractor/shape-tractor.stories.js +46 -46
- package/dist/collection/stories/Templates/spellDoor/spellDoor.stories.js +41 -41
- package/dist/collection/stories/Templates/storyTale/storyTale.stories.js +39 -39
- package/dist/collection/stories/Templates/sumTogether/sumTogether.stories.js +51 -47
- package/dist/collection/stories/Templates/total/total.stories.js +27 -27
- package/dist/collection/stories/Templates/writeCard/writeCard.stories.js +35 -31
- package/dist/collection/stories/Templates/writeLetter/writeLetter.stories.js +62 -58
- package/dist/collection/stories/Templates/writeNumber/writeNumber.stories.js +44 -40
- package/dist/collection/stories/Templates/writeSet/writeSet.stories.js +36 -32
- package/dist/collection/stories/Templates/writeWord/writeWord.stories.js +37 -33
- package/dist/collection/stories/components/flash-card.stories.js +48 -48
- package/dist/collection/stories/components/keyboard.stories.js +10 -10
- package/dist/collection/stories/components/slider.stories.js +4 -4
- package/dist/collection/stories/components/trace.stories.js +5 -5
- package/dist/collection/utils/audioPlayer.js +43 -6
- package/dist/collection/utils/constants.js +1 -0
- package/dist/collection/utils/i18n.js +36 -0
- package/dist/collection/utils/utils.js +170 -36
- package/dist/collection/utils/utilsHandlers/clickHandler.js +5 -1
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +27 -15
- package/dist/collection/utils/utilsHandlers/highlightHandler.js +54 -54
- package/dist/collection/utils/utilsHandlers/lidoBalanceHandler.js +2 -2
- package/dist/collection/utils/utilsHandlers/lidoCalculatorHandler.js +9 -9
- package/dist/collection/utils/utilsHandlers/sortHandler.js +10 -10
- package/dist/components/index.js +1 -1
- package/dist/components/lido-avatar.js +1 -1
- package/dist/components/lido-balance.js +1 -1
- package/dist/components/lido-calculator.js +1 -1
- package/dist/components/lido-canvas.d.ts +11 -0
- package/dist/components/lido-canvas.js +6 -0
- package/dist/components/lido-cell.js +1 -1
- package/dist/components/lido-col.js +1 -1
- package/dist/components/lido-container.js +1 -1
- package/dist/components/lido-flash-card.js +1 -1
- package/dist/components/lido-float.js +1 -1
- package/dist/components/lido-home.js +1 -1
- package/dist/components/lido-image.js +1 -1
- package/dist/components/lido-keyboard.js +1 -1
- package/dist/components/lido-math-matrix.js +1 -1
- package/dist/components/lido-pos.js +1 -1
- package/dist/components/lido-random.js +1 -1
- package/dist/components/lido-root.js +49 -25
- package/dist/components/lido-row.js +1 -1
- package/dist/components/lido-shape.js +1 -1
- package/dist/components/lido-slide-fill.js +1 -1
- package/dist/components/lido-text.js +1 -1
- package/dist/components/lido-trace.js +1 -1
- package/dist/components/lido-wrap.js +1 -1
- package/dist/components/{p-9be56729.js → p-00777872.js} +46 -2
- package/dist/components/{p-3f406017.js → p-06171259.js} +2 -2
- package/dist/components/{p-08d0deab.js → p-09f1e2d2.js} +15 -9
- package/dist/components/{p-e4e42677.js → p-0c2aebfb.js} +2 -2
- package/dist/components/p-0fbeb3a1.js +2700 -0
- package/dist/components/{p-cbac3cbc.js → p-11bf64aa.js} +2 -2
- package/dist/components/{p-44808985.js → p-26df0769.js} +7 -7
- package/dist/components/{p-1fbdb431.js → p-2d53e1a5.js} +2 -2
- package/dist/components/{p-afbc196f.js → p-39a2e638.js} +3 -2
- package/dist/components/{p-e36ddcc1.js → p-3ce3744c.js} +14 -11
- package/dist/components/{p-7f7e5672.js → p-3f4d4c0a.js} +2 -2
- package/dist/components/{p-d37ab4dc.js → p-52e77394.js} +2 -2
- package/dist/components/{p-bed94c37.js → p-58c67252.js} +331 -118
- package/dist/components/p-5b5f59a8.js +129 -0
- package/dist/components/{p-52844fa4.js → p-68112f8c.js} +2 -2
- package/dist/components/{p-15971ede.js → p-8a34b98b.js} +1 -1
- package/dist/components/{p-904711c8.js → p-8f2ed62f.js} +2 -2
- package/dist/components/{p-74849cdd.js → p-9d34d59d.js} +4 -4
- package/dist/components/{p-73e31a86.js → p-a2f96840.js} +8 -8
- package/dist/components/{p-90465904.js → p-a516a324.js} +2 -2
- package/dist/components/{p-322acda6.js → p-b2125fc9.js} +67 -31
- package/dist/components/{p-835b973d.js → p-c4abfd0f.js} +2 -2
- package/dist/components/{p-29bdd953.js → p-cb56a853.js} +2 -2
- package/dist/esm/{index-170e58c7.js → index-37c2ad2d.js} +48 -14
- package/dist/esm/index.js +2 -2
- package/dist/esm/{lido-avatar_21.entry.js → lido-avatar_22.entry.js} +3043 -163
- package/dist/esm/lido-player.js +3 -3
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{utils-5df09162.js → utils-107b15a7.js} +294 -108
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/p-606ea279.entry.js +1 -0
- package/dist/lido-player/p-9a9d5339.js +2 -0
- package/dist/lido-player/{p-7556e652.js → p-d1251482.js} +2 -2
- package/dist/types/components/canvas/lido-canvas.d.ts +27 -0
- package/dist/types/components/container/lido-container.d.ts +6 -0
- package/dist/types/components/home/lido-home.d.ts +8 -0
- package/dist/types/components/mathMatrix/lido-math-matrix.d.ts +3 -1
- package/dist/types/components/root/lido-root.d.ts +5 -0
- package/dist/types/components.d.ts +71 -6
- package/dist/types/stories/Templates/RocketGame/rocketGame.stories.d.ts +1 -0
- package/dist/types/stories/Templates/blender/blender.stories.d.ts +4 -0
- package/dist/types/stories/Templates/calculator/calculator.stories.d.ts +4 -0
- package/dist/types/stories/Templates/multiplyBeeds/multiplyBeeds.stories.d.ts +1 -0
- package/dist/types/stories/Templates/openwindow/openwindow.stories.d.ts +1 -0
- package/dist/types/stories/Templates/openwindow/openwindow2.stories.d.ts +1 -0
- package/dist/types/stories/Templates/questionBoard/questionBoard.stories.d.ts +1 -0
- package/dist/types/stories/Templates/sequenceBox/sequenceBox1.stories.d.ts +1 -0
- package/dist/types/stories/Templates/sequenceBox/sequenceBox2.stories.d.ts +1 -0
- package/dist/types/stories/Templates/shapePair/shape-pair.stories.d.ts +1 -1
- package/dist/types/stories/Templates/sumTogether/sumTogether.stories.d.ts +1 -0
- package/dist/types/stories/Templates/writeCard/writeCard.stories.d.ts +1 -0
- package/dist/types/stories/Templates/writeLetter/writeLetter.stories.d.ts +1 -0
- package/dist/types/stories/Templates/writeNumber/writeNumber.stories.d.ts +1 -0
- package/dist/types/stories/Templates/writeWord/writeWord.stories.d.ts +1 -0
- package/dist/types/types/json.d.ts +4 -0
- package/dist/types/utils/audioPlayer.d.ts +2 -0
- package/dist/types/utils/constants.d.ts +1 -0
- package/dist/types/utils/i18n.d.ts +5 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +71 -69
- package/readme.md +113 -113
- package/dist/lido-player/p-137c99ce.js +0 -2
- package/dist/lido-player/p-eb956325.entry.js +0 -1
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const utils = require('./utils-
|
|
5
|
+
const index = require('./index-baff5c15.js');
|
|
6
|
+
const utils = require('./utils-ce99b0d0.js');
|
|
7
7
|
|
|
8
8
|
var rive = {exports: {}};
|
|
9
9
|
|
|
@@ -6590,13 +6590,13 @@ const LidoAvatar = class {
|
|
|
6590
6590
|
display: this.visible ? 'flex' : 'none',
|
|
6591
6591
|
zIndex: this.z,
|
|
6592
6592
|
};
|
|
6593
|
-
return (index.h(index.Host, { key: '
|
|
6593
|
+
return (index.h(index.Host, { key: '8a31ce98213ff51bf7cfc776690b6770bbeae604', id: this.id, type: this.type, "tab-index": this.tabIndex, value: this.value, style: style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry }, index.h("canvas", { key: '922568310a3be177e3185f86c54df95d16a0e42b', class: "lido-canvas" })));
|
|
6594
6594
|
}
|
|
6595
6595
|
get el() { return index.getElement(this); }
|
|
6596
6596
|
};
|
|
6597
6597
|
LidoAvatar.style = LidoAvatarStyle0;
|
|
6598
6598
|
|
|
6599
|
-
const lidoBalanceCss = "#lido-balance{position:relative;height:500px;width:1205px;top:20%;left:-91px;z-index:0}.lido-balance-symbol{position:absolute;top:64%;left:50%;transform:translate(-50%, -50%);font-size:5vw;font-weight:bold;color:black;pointer-events:none;z-index:999}@media (orientation: portrait){#pivotimg{position:absolute;height:auto;width:23%;bottom:18%;left:38%;z-index:100}}@media (orientation: landscape){#pivotimg{position:absolute;height:auto;width:23%;bottom:8%;left:38%;z-index:100}}.lido-balance .pivot svg{width:100%;height:auto}#scaleimg{position:absolute;width:73%;height:auto;top:61%;left:14%;z-index:90}.lido-balance .scale svg{width:100%;height:auto}@media (orientation: landscape){#handlerimg{position:absolute;width:35%;height:auto;top:49%;left:2%}}@media (orientation:portrait ){#handlerimg{position:absolute;width:35%;height:auto;top:53%;left:2%}}.lido-balance .handler svg{width:100%;height:auto;fill:brown}@media (orientation: landscape){#handimg{position:absolute;width:35%;height:auto;top:49%;right:2%}}@media (orientation:portrait){#handimg{position:absolute;width:35%;height:auto;top:53%;right:2%}}.lido-balance .hand svg{width:100%;height:auto;fill:brown}.pivot svg path:nth-of-type(1){fill:brown}.pivot svg path[d^=\"M78.9414\"]{fill:white}";
|
|
6599
|
+
const lidoBalanceCss = "#lido-balance{position:relative;height:500px;width:1205px;top:20%;left:-91px;z-index:0}.lido-balance-symbol{position:absolute;top:64%;left:50%;transform:translate(-50%, -50%);font-size:5vw;font-weight:bold;color:black;pointer-events:none;z-index:999}@media (orientation: portrait){.lido-balance-shadow{height:100px;position:absolute;top:80%;left:28%}}@media (orientation: landscape){.lido-balance-shadow{height:100px;position:absolute;top:90%;left:33%}}@media (orientation: portrait){#pivotimg{position:absolute;height:auto;width:23%;bottom:18%;left:38%;z-index:100}}#pivotimg::after{content:\"\";position:absolute;bottom:-30px;left:50%;transform:translateX(-50%);width:120%;height:60px;background-image:url(\"https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/balancing/Shadow.svg\");background-size:contain;background-repeat:no-repeat;background-position:center;pointer-events:none;z-index:10}@media (orientation: landscape){#pivotimg{position:absolute;height:auto;width:23%;bottom:8%;left:38%;z-index:100}}.lido-balance .pivot svg{width:100%;height:auto}#scaleimg{position:absolute;width:73%;height:auto;top:61%;left:14%;z-index:90}.lido-balance .scale svg{width:100%;height:auto}@media (orientation: landscape){#handlerimg{position:absolute;width:35%;height:auto;top:49%;left:2%}}@media (orientation:portrait ){#handlerimg{position:absolute;width:35%;height:auto;top:53%;left:2%}}.lido-balance .handler svg{width:100%;height:auto;fill:brown}@media (orientation: landscape){#handimg{position:absolute;width:35%;height:auto;top:49%;right:2%}}@media (orientation:portrait){#handimg{position:absolute;width:35%;height:auto;top:53%;right:2%}}.lido-balance .hand svg{width:100%;height:auto;fill:brown}.pivot svg path:nth-of-type(1){fill:brown}.pivot svg path[d^=\"M78.9414\"]{fill:white}";
|
|
6600
6600
|
const LidoBalanceStyle0 = lidoBalanceCss;
|
|
6601
6601
|
|
|
6602
6602
|
const LidoBalance = class {
|
|
@@ -6642,9 +6642,7 @@ const LidoBalance = class {
|
|
|
6642
6642
|
this.handlerSvg = await this.fetchAndApplyFill(this.handlerimage);
|
|
6643
6643
|
}
|
|
6644
6644
|
componentDidLoad() {
|
|
6645
|
-
|
|
6646
|
-
this.animateBalance();
|
|
6647
|
-
}, 4000);
|
|
6645
|
+
this.animateBalance();
|
|
6648
6646
|
this.leftParentEl = document.getElementById("leftparent");
|
|
6649
6647
|
this.rightParentEl = document.getElementById("rightparent");
|
|
6650
6648
|
utils.initEventsForElement(this.el);
|
|
@@ -6675,6 +6673,7 @@ const LidoBalance = class {
|
|
|
6675
6673
|
async updateTilt(leftVal, rightVal) {
|
|
6676
6674
|
const diff = rightVal - leftVal;
|
|
6677
6675
|
const newTilt = Math.max(-5, Math.min(5, diff));
|
|
6676
|
+
await new Promise(res => setTimeout(res, 350));
|
|
6678
6677
|
this.tiltf = newTilt;
|
|
6679
6678
|
}
|
|
6680
6679
|
animateBalance() {
|
|
@@ -6694,7 +6693,8 @@ const LidoBalance = class {
|
|
|
6694
6693
|
this.scaleEl.style.transformOrigin = '50% 80%';
|
|
6695
6694
|
}
|
|
6696
6695
|
if (this.leftParentEl && this.rightParentEl) {
|
|
6697
|
-
const
|
|
6696
|
+
const isPortrait = window.innerHeight > window.innerWidth;
|
|
6697
|
+
const maxOffset = isPortrait ? 40 : 60;
|
|
6698
6698
|
const offset = (this.currentAngle / this.maxTilt) * maxOffset;
|
|
6699
6699
|
this.leftParentEl.style.transform = `translateY(${-offset}px)`;
|
|
6700
6700
|
this.rightParentEl.style.transform = `translateY(${offset}px)`;
|
|
@@ -6724,7 +6724,7 @@ const LidoBalance = class {
|
|
|
6724
6724
|
};
|
|
6725
6725
|
}
|
|
6726
6726
|
render() {
|
|
6727
|
-
return (index.h(index.Host, { key: '
|
|
6727
|
+
return (index.h(index.Host, { key: 'd1da72f1bf298dd7c81b0cfefa0e9e563ccbfff1', id: "lido-balance", "bg-color": "red", onEntry: this.onEntry, class: "lido-balance", tilt: this.tilt.toString(), style: this.style, operation: this.operation.toString() }, index.h("div", { key: '737ab206a5156b402d4477a38567480f10419c14', innerHTML: this.pivotSvg, id: "pivotimg", class: "pivot" }), index.h("div", { key: '8bc60136950858d5d1b96c38ec4c0635024f8d24', innerHTML: this.scaleSvg, id: "scaleimg", class: "scale", ref: (el) => (this.scaleEl = el) }), index.h("div", { key: '07049a6b5c8e75d831c9287b2b4a0e633791174b', innerHTML: this.handlerSvg, id: "handlerimg", class: "handler", ref: (el) => (this.leftHandleEl = el) }), index.h("div", { key: '85361c27b1ab6fcc86969bfc9d4dff1df6040165', innerHTML: this.handlerSvg, id: "handimg", class: "hand", ref: (el) => (this.rightHandleEl = el) }), index.h("div", { key: 'c4208582bfa1b63e4381d44d9a95e9c537dfbc84', id: "balanceSymbol", class: "lido-balance-symbol", "aria-hidden": !this.showSymbol }, this.showSymbol ? this.balanceSymbol : '')));
|
|
6728
6728
|
}
|
|
6729
6729
|
get el() { return index.getElement(this); }
|
|
6730
6730
|
static get watchers() { return {
|
|
@@ -6749,7 +6749,7 @@ const LidoCalculator = class {
|
|
|
6749
6749
|
this.x = '0px';
|
|
6750
6750
|
this.y = '0px';
|
|
6751
6751
|
this.bgColor = '#60DADA';
|
|
6752
|
-
this.penIcon = "https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/calculator/
|
|
6752
|
+
this.penIcon = "https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/calculator/penIcon.png";
|
|
6753
6753
|
this.displayValue = '';
|
|
6754
6754
|
this.style = {};
|
|
6755
6755
|
}
|
|
@@ -6766,7 +6766,7 @@ const LidoCalculator = class {
|
|
|
6766
6766
|
this.updateValueAttr();
|
|
6767
6767
|
}
|
|
6768
6768
|
handleClick(value) {
|
|
6769
|
-
const MAX_LENGTH =
|
|
6769
|
+
const MAX_LENGTH = 8;
|
|
6770
6770
|
if (value === 'OK') {
|
|
6771
6771
|
this.verifyAnswer();
|
|
6772
6772
|
}
|
|
@@ -6788,7 +6788,8 @@ const LidoCalculator = class {
|
|
|
6788
6788
|
const container = this.el.closest('lido-container');
|
|
6789
6789
|
if (!container)
|
|
6790
6790
|
return;
|
|
6791
|
-
if (this.objective && this.objective
|
|
6791
|
+
if (this.objective && this.objective != '' && !this.objective.includes(',')) {
|
|
6792
|
+
console.log("hi iscorrect verified");
|
|
6792
6793
|
isCorrect = userInput === this.objective;
|
|
6793
6794
|
}
|
|
6794
6795
|
// --- Multiple Objectives ---
|
|
@@ -6800,9 +6801,6 @@ const LidoCalculator = class {
|
|
|
6800
6801
|
if (currentIndex < objectives.length && Number(userInput) === Number(objectives[currentIndex])) {
|
|
6801
6802
|
isCorrect = true;
|
|
6802
6803
|
}
|
|
6803
|
-
else {
|
|
6804
|
-
isCorrect = false;
|
|
6805
|
-
}
|
|
6806
6804
|
// Store behavior based on mode
|
|
6807
6805
|
if (isContinueOnCorrect) {
|
|
6808
6806
|
// PRACTICE MODE → store only correct answers
|
|
@@ -6835,7 +6833,12 @@ const LidoCalculator = class {
|
|
|
6835
6833
|
utils.storingEachActivityScore(isCorrect);
|
|
6836
6834
|
const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
|
|
6837
6835
|
await utils.executeActions(onCorrect, container);
|
|
6838
|
-
if (
|
|
6836
|
+
if (onCorrect.includes('scrollCellAfterEquationSolved')) {
|
|
6837
|
+
if (this.objective.length === 0) {
|
|
6838
|
+
window.dispatchEvent(new CustomEvent(utils.NextContainerKey));
|
|
6839
|
+
}
|
|
6840
|
+
}
|
|
6841
|
+
else {
|
|
6839
6842
|
window.dispatchEvent(new CustomEvent(utils.NextContainerKey));
|
|
6840
6843
|
}
|
|
6841
6844
|
}
|
|
@@ -6848,7 +6851,7 @@ const LidoCalculator = class {
|
|
|
6848
6851
|
}
|
|
6849
6852
|
render() {
|
|
6850
6853
|
const numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '←', '0', 'OK'];
|
|
6851
|
-
return (index.h(index.Host, { key: '
|
|
6854
|
+
return (index.h(index.Host, { key: 'de394a3b14826c7fb6d6cf33fbbf1726238cbe3b', onEntry: this.onEntry, id: "lidoCalculator", style: { width: this.width, height: this.height, backgroundColor: this.bgColor, left: this.x, top: this.y } }, index.h("lido-cell", { key: '6dbc01d1032553ba6376d60d451b546851f5ebed', visible: "true", height: "94px", width: "60px" }, index.h("lido-text", { key: '353396c173bbdeb5f2fbb235e54fa900d2d0b771', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, index.h("img", { key: '083b53c01a3d7bfff1c39a408ed064fd18d3e8a3', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), index.h("div", { key: 'b0936ba134feda621d5f0f26b7de70db51f56cf8', class: "lido-calculator-displayParent" }, index.h("div", { key: '35507ac35c70c4bf515c904a402e5312dafeffc3', class: "lido-calculator-display" }, this.displayValue)), index.h("div", { key: 'd7412b0d4c8971aa09d9ca22ee8d25f2773cd2c8', class: "lido-calculator-buttons" }, numbers.map((num, i) => (index.h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
|
|
6852
6855
|
'lido-calculator-btn-special': num === '←' || num === 'OK',
|
|
6853
6856
|
'lido-calculator-btn-default': num !== '←' && num !== 'OK'
|
|
6854
6857
|
}, onClick: () => this.handleClick(num) }))))));
|
|
@@ -6857,6 +6860,102 @@ const LidoCalculator = class {
|
|
|
6857
6860
|
};
|
|
6858
6861
|
LidoCalculator.style = LidoCalculatorStyle0;
|
|
6859
6862
|
|
|
6863
|
+
const lidoCanvasCss = ":host{display:flex;justify-content:center;align-items:center}.lido-canvas{background:red;border:2px solid #ccc;border-radius:8px;display:flex;flex-direction:column;overflow:hidden;position:relative}#lido-exit-button{padding:6px 14px;border:none;background:transparent;color:#fff;border-radius:6px;cursor:pointer;font-size:14px;position:relative;top:-43%;left:18%;z-index:10}canvas{touch-action:none;display:block}";
|
|
6864
|
+
const LidoCanvasStyle0 = lidoCanvasCss;
|
|
6865
|
+
|
|
6866
|
+
const LidoCanvas = class {
|
|
6867
|
+
constructor(hostRef) {
|
|
6868
|
+
index.registerInstance(this, hostRef);
|
|
6869
|
+
// Flag to track drawing state
|
|
6870
|
+
this.drawing = false;
|
|
6871
|
+
this.bgImage = undefined;
|
|
6872
|
+
this.width = '800px';
|
|
6873
|
+
this.height = '700px';
|
|
6874
|
+
this.x = '0px';
|
|
6875
|
+
this.y = '0px';
|
|
6876
|
+
this.onEntry = '';
|
|
6877
|
+
this.style = {};
|
|
6878
|
+
}
|
|
6879
|
+
updateStyles() {
|
|
6880
|
+
const orientation = window.innerHeight > window.innerWidth ? 'portrait' : 'landscape';
|
|
6881
|
+
this.style = {
|
|
6882
|
+
width: utils.parseProp(this.width, orientation),
|
|
6883
|
+
height: utils.parseProp(this.height, orientation),
|
|
6884
|
+
left: utils.parseProp(this.x, orientation),
|
|
6885
|
+
top: utils.parseProp(this.y, orientation),
|
|
6886
|
+
position: 'absolute',
|
|
6887
|
+
};
|
|
6888
|
+
if (this.canvas) {
|
|
6889
|
+
this.canvas.width = parseInt(utils.parseProp(this.width, orientation));
|
|
6890
|
+
this.canvas.height = parseInt(utils.parseProp(this.height, orientation));
|
|
6891
|
+
this.ctx.strokeStyle = '#000';
|
|
6892
|
+
this.ctx.lineWidth = 10;
|
|
6893
|
+
this.ctx.lineCap = 'round';
|
|
6894
|
+
this.ctx.lineJoin = 'round';
|
|
6895
|
+
this.loadBackground();
|
|
6896
|
+
}
|
|
6897
|
+
}
|
|
6898
|
+
componentDidLoad() {
|
|
6899
|
+
this.canvas = this.el.shadowRoot.querySelector('#lido-canvas');
|
|
6900
|
+
this.ctx = this.canvas.getContext('2d');
|
|
6901
|
+
this.ctx.strokeStyle = '#000';
|
|
6902
|
+
this.ctx.lineWidth = 10;
|
|
6903
|
+
this.ctx.lineCap = 'round';
|
|
6904
|
+
this.ctx.lineJoin = 'round';
|
|
6905
|
+
this.updateStyles();
|
|
6906
|
+
this.loadBackground();
|
|
6907
|
+
this.canvas.addEventListener('pointerdown', e => this.start(e));
|
|
6908
|
+
this.canvas.addEventListener('pointermove', e => this.move(e));
|
|
6909
|
+
window.addEventListener('pointerup', () => this.stop());
|
|
6910
|
+
window.addEventListener('resize', () => this.updateStyles());
|
|
6911
|
+
}
|
|
6912
|
+
loadBackground() {
|
|
6913
|
+
if (!this.bgImage) {
|
|
6914
|
+
this.ctx.fillStyle = '#fff';
|
|
6915
|
+
this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);
|
|
6916
|
+
return;
|
|
6917
|
+
}
|
|
6918
|
+
const img = new Image();
|
|
6919
|
+
img.crossOrigin = 'anonymous';
|
|
6920
|
+
img.src = this.bgImage;
|
|
6921
|
+
img.onload = () => {
|
|
6922
|
+
this.ctx.drawImage(img, 0, 0, this.canvas.width, this.canvas.height);
|
|
6923
|
+
};
|
|
6924
|
+
}
|
|
6925
|
+
getPos(e) {
|
|
6926
|
+
const r = this.canvas.getBoundingClientRect();
|
|
6927
|
+
return {
|
|
6928
|
+
x: (e.clientX - r.left) * (this.canvas.width / r.width),
|
|
6929
|
+
y: (e.clientY - r.top) * (this.canvas.height / r.height),
|
|
6930
|
+
};
|
|
6931
|
+
}
|
|
6932
|
+
start(e) {
|
|
6933
|
+
this.drawing = true;
|
|
6934
|
+
const pos = this.getPos(e);
|
|
6935
|
+
this.ctx.beginPath();
|
|
6936
|
+
this.ctx.moveTo(pos.x, pos.y);
|
|
6937
|
+
}
|
|
6938
|
+
move(e) {
|
|
6939
|
+
if (!this.drawing)
|
|
6940
|
+
return;
|
|
6941
|
+
const pos = this.getPos(e);
|
|
6942
|
+
this.ctx.lineTo(pos.x, pos.y);
|
|
6943
|
+
this.ctx.stroke();
|
|
6944
|
+
}
|
|
6945
|
+
stop() {
|
|
6946
|
+
this.drawing = false;
|
|
6947
|
+
this.ctx.closePath();
|
|
6948
|
+
}
|
|
6949
|
+
clearCanvas() {
|
|
6950
|
+
this.loadBackground();
|
|
6951
|
+
}
|
|
6952
|
+
render() {
|
|
6953
|
+
return (index.h(index.Host, { key: '6768ff870d132528267f2e824fdc6edf5a5fa2be', id: "lido-canvas", class: "lido-canvas", style: this.style }, index.h("button", { key: 'ba3d5456edfa4618b6c3f57b97fa18cef45f7ae9', id: "lido-exit-button", onClick: () => this.clearCanvas() }, index.h("lido-text", { key: '3484c9005819e3d08adf8d36b247d3c45610d0b5', visible: "true", height: "92px", width: "43px", id: "lido-exit-icon", "font-color": "white", onEntry: "this.font-weight='900';", "font-size": "96px", string: 'X' })), index.h("canvas", { key: 'cd4167cefde8d4cf159779c46283cafbc3b0afcc', id: "lido-canvas", style: { width: this.style.width, height: this.style.height, } })));
|
|
6954
|
+
}
|
|
6955
|
+
get el() { return index.getElement(this); }
|
|
6956
|
+
};
|
|
6957
|
+
LidoCanvas.style = LidoCanvasStyle0;
|
|
6958
|
+
|
|
6860
6959
|
const lidoCellCss = ".lido-col{top:var(--y, 0);left:var(--x, 0);height:var(--height, 100%);width:var(--width, 100%);background-color:var(--bgColor, #eeeeee);padding:15px;border-radius:10px;display:flex;justify-content:space-around;flex-direction:column;align-items:center}.lido-col>*{}.lido-row{display:flex;justify-content:space-around;align-items:center;}.lido-row>*{}.lido-wrap{display:grid;grid-gap:10px;grid-template-columns:repeat(auto-fill, minmax(186px, auto))}.lido-wrap>*{padding:10px;box-sizing:border-box}.lido-flex{display:flex;flex-wrap:wrap;align-content:flex-start;gap:10px}.lido-pos{top:var(--y, 0);left:var(--x, 0);height:var(--height, 100%);width:var(--width, 100%);background-color:var(--bgColor, #eeeeee);display:flex;justify-content:space-around;flex-direction:column;position:fixed}.lido-pos>*{position:absolute}.lido-random{position:relative;width:100%;height:100%}.lido-random>*{position:absolute}.lido-col::-webkit-scrollbar,.lido-wrap::-webkit-scrollbar,.lido-flex::-webkit-scrollbar{width:var(--scrollbar-width);height:var(--scrollbar-width)}.lido-col::-webkit-scrollbar-thumb,.lido-wrap::-webkit-scrollbar-thumb,.lido-flex::-webkit-scrollbar-thumb{background-color:#888;border-radius:10px;border:3px solid transparent;background-clip:content-box}.lido-col::-webkit-scrollbar-track,.lido-wrap::-webkit-scrollbar-track,.lido-flex::-webkit-scrollbar-track{background:#f1f1f1}";
|
|
6861
6960
|
const LidoCellStyle0 = lidoCellCss;
|
|
6862
6961
|
|
|
@@ -6945,136 +7044,2835 @@ const LidoCell = class {
|
|
|
6945
7044
|
utils.attachSpeakIcon(this.el);
|
|
6946
7045
|
}
|
|
6947
7046
|
}
|
|
6948
|
-
/**
|
|
6949
|
-
* Lifecycle method that runs before the component is rendered.
|
|
6950
|
-
* Initializes styles and sets up event listeners for resize and load events.
|
|
6951
|
-
*/
|
|
6952
|
-
componentWillLoad() {
|
|
6953
|
-
this.updateStyles();
|
|
6954
|
-
window.addEventListener('resize', this.updateStyles.bind(this));
|
|
6955
|
-
window.addEventListener('load', this.updateStyles.bind(this));
|
|
7047
|
+
/**
|
|
7048
|
+
* Lifecycle method that runs before the component is rendered.
|
|
7049
|
+
* Initializes styles and sets up event listeners for resize and load events.
|
|
7050
|
+
*/
|
|
7051
|
+
componentWillLoad() {
|
|
7052
|
+
this.updateStyles();
|
|
7053
|
+
window.addEventListener('resize', this.updateStyles.bind(this));
|
|
7054
|
+
window.addEventListener('load', this.updateStyles.bind(this));
|
|
7055
|
+
}
|
|
7056
|
+
disconnectedCallback() {
|
|
7057
|
+
window.removeEventListener('resize', this.updateStyles.bind(this));
|
|
7058
|
+
window.removeEventListener('load', this.updateStyles.bind(this));
|
|
7059
|
+
}
|
|
7060
|
+
updateStyles() {
|
|
7061
|
+
const orientation = window.innerHeight > window.innerWidth ? 'portrait' : 'landscape';
|
|
7062
|
+
this.style = {
|
|
7063
|
+
'height': utils.parseProp(this.height, orientation),
|
|
7064
|
+
'width': utils.parseProp(this.width, orientation),
|
|
7065
|
+
'backgroundColor': utils.parseProp(this.bgColor, orientation),
|
|
7066
|
+
'top': utils.parseProp(this.y, orientation),
|
|
7067
|
+
'left': utils.parseProp(this.x, orientation),
|
|
7068
|
+
'zIndex': this.z,
|
|
7069
|
+
'margin': utils.parseProp(this.margin, orientation),
|
|
7070
|
+
'padding': utils.parseProp(this.padding, orientation),
|
|
7071
|
+
'borderRadius': utils.parseProp(this.borderRadius, orientation),
|
|
7072
|
+
'gap': utils.parseProp(this.gap, orientation),
|
|
7073
|
+
'--scrollbar-width': utils.parseProp(this.scrollbarWidth || '0px', orientation),
|
|
7074
|
+
'display': JSON.parse(utils.parseProp(`${this.visible}`, orientation))
|
|
7075
|
+
? utils.parseProp(this.layout, orientation) === 'wrap'
|
|
7076
|
+
? 'grid'
|
|
7077
|
+
: utils.parseProp(this.layout, orientation) === 'pos' || utils.parseProp(this.layout, orientation) === 'random'
|
|
7078
|
+
? 'block'
|
|
7079
|
+
: 'flex'
|
|
7080
|
+
: 'none',
|
|
7081
|
+
'flexDirection': this.flexDirection ? utils.parseProp(this.flexDirection, orientation) : '',
|
|
7082
|
+
'alignItems': this.alignItems ? utils.parseProp(this.alignItems, orientation) : '',
|
|
7083
|
+
};
|
|
7084
|
+
this.el.className = `lido-${utils.parseProp(this.layout, orientation)}`;
|
|
7085
|
+
}
|
|
7086
|
+
render() {
|
|
7087
|
+
return (index.h(index.Host, { key: '0f7d35324da319917dec546cbb1f25065897bb02', id: this.id, class: "lido-cell", value: this.value, type: this.type, "tab-index": this.tabIndex, style: this.style, minDrops: this.minDrops, maxDrops: this.maxDrops, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, "flex-direction": this.flexDirection, "disable-speak": this.disableSpeak }, index.h("slot", { key: '2a337b5fae7641bbe78c5f1aa1c96e12c1281f4a' })));
|
|
7088
|
+
}
|
|
7089
|
+
get el() { return index.getElement(this); }
|
|
7090
|
+
};
|
|
7091
|
+
LidoCell.style = LidoCellStyle0;
|
|
7092
|
+
|
|
7093
|
+
const lidoColCss = ".lido-col{top:var(--y, 0);left:var(--x, 0);height:var(--height, 100%);width:var(--width, 100%);background-color:var(--bgColor, #eeeeee);padding:15px;border-radius:10px;display:flex;justify-content:space-around;flex-direction:column;align-items:center}.lido-col>*{}";
|
|
7094
|
+
const LidoColStyle0 = lidoColCss;
|
|
7095
|
+
|
|
7096
|
+
const LidoCol = class {
|
|
7097
|
+
constructor(hostRef) {
|
|
7098
|
+
index.registerInstance(this, hostRef);
|
|
7099
|
+
this.showSpeakIcon = false;
|
|
7100
|
+
this.id = undefined;
|
|
7101
|
+
this.value = undefined;
|
|
7102
|
+
this.height = undefined;
|
|
7103
|
+
this.width = undefined;
|
|
7104
|
+
this.ariaLabel = undefined;
|
|
7105
|
+
this.ariaHidden = undefined;
|
|
7106
|
+
this.x = undefined;
|
|
7107
|
+
this.y = undefined;
|
|
7108
|
+
this.z = undefined;
|
|
7109
|
+
this.bgColor = undefined;
|
|
7110
|
+
this.type = undefined;
|
|
7111
|
+
this.tabIndex = undefined;
|
|
7112
|
+
this.visible = undefined;
|
|
7113
|
+
this.audio = undefined;
|
|
7114
|
+
this.onTouch = undefined;
|
|
7115
|
+
this.onInCorrect = undefined;
|
|
7116
|
+
this.onCorrect = undefined;
|
|
7117
|
+
this.onEntry = undefined;
|
|
7118
|
+
this.childElementsLength = undefined;
|
|
7119
|
+
this.minLength = undefined;
|
|
7120
|
+
this.maxLength = undefined;
|
|
7121
|
+
this.direction = undefined;
|
|
7122
|
+
this.borderImage = undefined;
|
|
7123
|
+
this.boxShadow = undefined;
|
|
7124
|
+
this.minDrops = 1;
|
|
7125
|
+
this.maxDrops = 1;
|
|
7126
|
+
this.margin = '';
|
|
7127
|
+
this.style = {};
|
|
7128
|
+
}
|
|
7129
|
+
/**
|
|
7130
|
+
* This lifecycle hook is called after the component is rendered in the DOM.
|
|
7131
|
+
* It initializes events for the column based on the provided type.
|
|
7132
|
+
*/
|
|
7133
|
+
componentDidLoad() {
|
|
7134
|
+
utils.initEventsForElement(this.el, this.type);
|
|
7135
|
+
utils.handlingChildElements(this.el, this.minLength, this.maxLength, this.childElementsLength);
|
|
7136
|
+
if (this.showSpeakIcon) {
|
|
7137
|
+
utils.attachSpeakIcon(this.el);
|
|
7138
|
+
}
|
|
7139
|
+
}
|
|
7140
|
+
/**
|
|
7141
|
+
* Lifecycle method that runs before the component is rendered.
|
|
7142
|
+
* Initializes styles and sets up event listeners for resize and load events.
|
|
7143
|
+
*/
|
|
7144
|
+
componentWillLoad() {
|
|
7145
|
+
this.updateStyles();
|
|
7146
|
+
window.addEventListener('resize', this.updateStyles.bind(this));
|
|
7147
|
+
window.addEventListener('load', this.updateStyles.bind(this));
|
|
7148
|
+
}
|
|
7149
|
+
disconnectedCallback() {
|
|
7150
|
+
window.removeEventListener('resize', this.updateStyles.bind(this));
|
|
7151
|
+
window.removeEventListener('load', this.updateStyles.bind(this));
|
|
7152
|
+
}
|
|
7153
|
+
updateStyles() {
|
|
7154
|
+
const borderImg = this.borderImage ? utils.convertUrlToRelative(this.borderImage) : '';
|
|
7155
|
+
const orientation = window.innerHeight > window.innerWidth ? 'portrait' : 'landscape';
|
|
7156
|
+
this.style = {
|
|
7157
|
+
height: utils.parseProp(this.height, orientation),
|
|
7158
|
+
width: utils.parseProp(this.width, orientation),
|
|
7159
|
+
backgroundColor: utils.parseProp(this.bgColor, orientation),
|
|
7160
|
+
top: utils.parseProp(this.y, orientation),
|
|
7161
|
+
left: utils.parseProp(this.x, orientation),
|
|
7162
|
+
zIndex: this.z,
|
|
7163
|
+
display: this.visible ? 'flex' : 'none', // Toggle visibility
|
|
7164
|
+
flexDirection: !this.direction ? 'column' : utils.parseProp(this.direction, orientation),
|
|
7165
|
+
borderImage: `url(${borderImg})`,
|
|
7166
|
+
borderImageSlice: borderImg ? '0 fill' : '',
|
|
7167
|
+
boxShadow: this.boxShadow ? this.boxShadow : 'unset',
|
|
7168
|
+
margin: utils.parseProp(this.margin, orientation),
|
|
7169
|
+
};
|
|
7170
|
+
}
|
|
7171
|
+
render() {
|
|
7172
|
+
return (index.h(index.Host, { key: '7845d3364dd13cb42959f67610254ee892119c39', id: this.id, class: "lido-col", type: this.type, "tab-index": this.tabIndex, value: this.value, style: this.style, minDrops: this.minDrops, maxDrops: this.maxDrops, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry }, index.h("slot", { key: '09a68a30534c5ea83d7166acd720b4b8f23f494e' })));
|
|
7173
|
+
}
|
|
7174
|
+
get el() { return index.getElement(this); }
|
|
7175
|
+
};
|
|
7176
|
+
LidoCol.style = LidoColStyle0;
|
|
7177
|
+
|
|
7178
|
+
const isString = obj => typeof obj === 'string';
|
|
7179
|
+
const defer = () => {
|
|
7180
|
+
let res;
|
|
7181
|
+
let rej;
|
|
7182
|
+
const promise = new Promise((resolve, reject) => {
|
|
7183
|
+
res = resolve;
|
|
7184
|
+
rej = reject;
|
|
7185
|
+
});
|
|
7186
|
+
promise.resolve = res;
|
|
7187
|
+
promise.reject = rej;
|
|
7188
|
+
return promise;
|
|
7189
|
+
};
|
|
7190
|
+
const makeString = object => {
|
|
7191
|
+
if (object == null) return '';
|
|
7192
|
+
return '' + object;
|
|
7193
|
+
};
|
|
7194
|
+
const copy = (a, s, t) => {
|
|
7195
|
+
a.forEach(m => {
|
|
7196
|
+
if (s[m]) t[m] = s[m];
|
|
7197
|
+
});
|
|
7198
|
+
};
|
|
7199
|
+
const lastOfPathSeparatorRegExp = /###/g;
|
|
7200
|
+
const cleanKey = key => key && key.indexOf('###') > -1 ? key.replace(lastOfPathSeparatorRegExp, '.') : key;
|
|
7201
|
+
const canNotTraverseDeeper = object => !object || isString(object);
|
|
7202
|
+
const getLastOfPath = (object, path, Empty) => {
|
|
7203
|
+
const stack = !isString(path) ? path : path.split('.');
|
|
7204
|
+
let stackIndex = 0;
|
|
7205
|
+
while (stackIndex < stack.length - 1) {
|
|
7206
|
+
if (canNotTraverseDeeper(object)) return {};
|
|
7207
|
+
const key = cleanKey(stack[stackIndex]);
|
|
7208
|
+
if (!object[key] && Empty) object[key] = new Empty();
|
|
7209
|
+
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
|
7210
|
+
object = object[key];
|
|
7211
|
+
} else {
|
|
7212
|
+
object = {};
|
|
7213
|
+
}
|
|
7214
|
+
++stackIndex;
|
|
7215
|
+
}
|
|
7216
|
+
if (canNotTraverseDeeper(object)) return {};
|
|
7217
|
+
return {
|
|
7218
|
+
obj: object,
|
|
7219
|
+
k: cleanKey(stack[stackIndex])
|
|
7220
|
+
};
|
|
7221
|
+
};
|
|
7222
|
+
const setPath = (object, path, newValue) => {
|
|
7223
|
+
const {
|
|
7224
|
+
obj,
|
|
7225
|
+
k
|
|
7226
|
+
} = getLastOfPath(object, path, Object);
|
|
7227
|
+
if (obj !== undefined || path.length === 1) {
|
|
7228
|
+
obj[k] = newValue;
|
|
7229
|
+
return;
|
|
7230
|
+
}
|
|
7231
|
+
let e = path[path.length - 1];
|
|
7232
|
+
let p = path.slice(0, path.length - 1);
|
|
7233
|
+
let last = getLastOfPath(object, p, Object);
|
|
7234
|
+
while (last.obj === undefined && p.length) {
|
|
7235
|
+
e = `${p[p.length - 1]}.${e}`;
|
|
7236
|
+
p = p.slice(0, p.length - 1);
|
|
7237
|
+
last = getLastOfPath(object, p, Object);
|
|
7238
|
+
if (last?.obj && typeof last.obj[`${last.k}.${e}`] !== 'undefined') {
|
|
7239
|
+
last.obj = undefined;
|
|
7240
|
+
}
|
|
7241
|
+
}
|
|
7242
|
+
last.obj[`${last.k}.${e}`] = newValue;
|
|
7243
|
+
};
|
|
7244
|
+
const pushPath = (object, path, newValue, concat) => {
|
|
7245
|
+
const {
|
|
7246
|
+
obj,
|
|
7247
|
+
k
|
|
7248
|
+
} = getLastOfPath(object, path, Object);
|
|
7249
|
+
obj[k] = obj[k] || [];
|
|
7250
|
+
obj[k].push(newValue);
|
|
7251
|
+
};
|
|
7252
|
+
const getPath = (object, path) => {
|
|
7253
|
+
const {
|
|
7254
|
+
obj,
|
|
7255
|
+
k
|
|
7256
|
+
} = getLastOfPath(object, path);
|
|
7257
|
+
if (!obj) return undefined;
|
|
7258
|
+
if (!Object.prototype.hasOwnProperty.call(obj, k)) return undefined;
|
|
7259
|
+
return obj[k];
|
|
7260
|
+
};
|
|
7261
|
+
const getPathWithDefaults = (data, defaultData, key) => {
|
|
7262
|
+
const value = getPath(data, key);
|
|
7263
|
+
if (value !== undefined) {
|
|
7264
|
+
return value;
|
|
7265
|
+
}
|
|
7266
|
+
return getPath(defaultData, key);
|
|
7267
|
+
};
|
|
7268
|
+
const deepExtend = (target, source, overwrite) => {
|
|
7269
|
+
for (const prop in source) {
|
|
7270
|
+
if (prop !== '__proto__' && prop !== 'constructor') {
|
|
7271
|
+
if (prop in target) {
|
|
7272
|
+
if (isString(target[prop]) || target[prop] instanceof String || isString(source[prop]) || source[prop] instanceof String) {
|
|
7273
|
+
if (overwrite) target[prop] = source[prop];
|
|
7274
|
+
} else {
|
|
7275
|
+
deepExtend(target[prop], source[prop], overwrite);
|
|
7276
|
+
}
|
|
7277
|
+
} else {
|
|
7278
|
+
target[prop] = source[prop];
|
|
7279
|
+
}
|
|
7280
|
+
}
|
|
7281
|
+
}
|
|
7282
|
+
return target;
|
|
7283
|
+
};
|
|
7284
|
+
const regexEscape = str => str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
|
7285
|
+
var _entityMap = {
|
|
7286
|
+
'&': '&',
|
|
7287
|
+
'<': '<',
|
|
7288
|
+
'>': '>',
|
|
7289
|
+
'"': '"',
|
|
7290
|
+
"'": ''',
|
|
7291
|
+
'/': '/'
|
|
7292
|
+
};
|
|
7293
|
+
const escape = data => {
|
|
7294
|
+
if (isString(data)) {
|
|
7295
|
+
return data.replace(/[&<>"'\/]/g, s => _entityMap[s]);
|
|
7296
|
+
}
|
|
7297
|
+
return data;
|
|
7298
|
+
};
|
|
7299
|
+
class RegExpCache {
|
|
7300
|
+
constructor(capacity) {
|
|
7301
|
+
this.capacity = capacity;
|
|
7302
|
+
this.regExpMap = new Map();
|
|
7303
|
+
this.regExpQueue = [];
|
|
7304
|
+
}
|
|
7305
|
+
getRegExp(pattern) {
|
|
7306
|
+
const regExpFromCache = this.regExpMap.get(pattern);
|
|
7307
|
+
if (regExpFromCache !== undefined) {
|
|
7308
|
+
return regExpFromCache;
|
|
7309
|
+
}
|
|
7310
|
+
const regExpNew = new RegExp(pattern);
|
|
7311
|
+
if (this.regExpQueue.length === this.capacity) {
|
|
7312
|
+
this.regExpMap.delete(this.regExpQueue.shift());
|
|
7313
|
+
}
|
|
7314
|
+
this.regExpMap.set(pattern, regExpNew);
|
|
7315
|
+
this.regExpQueue.push(pattern);
|
|
7316
|
+
return regExpNew;
|
|
7317
|
+
}
|
|
7318
|
+
}
|
|
7319
|
+
const chars = [' ', ',', '?', '!', ';'];
|
|
7320
|
+
const looksLikeObjectPathRegExpCache = new RegExpCache(20);
|
|
7321
|
+
const looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
|
|
7322
|
+
nsSeparator = nsSeparator || '';
|
|
7323
|
+
keySeparator = keySeparator || '';
|
|
7324
|
+
const possibleChars = chars.filter(c => nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0);
|
|
7325
|
+
if (possibleChars.length === 0) return true;
|
|
7326
|
+
const r = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map(c => c === '?' ? '\\?' : c).join('|')})`);
|
|
7327
|
+
let matched = !r.test(key);
|
|
7328
|
+
if (!matched) {
|
|
7329
|
+
const ki = key.indexOf(keySeparator);
|
|
7330
|
+
if (ki > 0 && !r.test(key.substring(0, ki))) {
|
|
7331
|
+
matched = true;
|
|
7332
|
+
}
|
|
7333
|
+
}
|
|
7334
|
+
return matched;
|
|
7335
|
+
};
|
|
7336
|
+
const deepFind = (obj, path, keySeparator = '.') => {
|
|
7337
|
+
if (!obj) return undefined;
|
|
7338
|
+
if (obj[path]) {
|
|
7339
|
+
if (!Object.prototype.hasOwnProperty.call(obj, path)) return undefined;
|
|
7340
|
+
return obj[path];
|
|
7341
|
+
}
|
|
7342
|
+
const tokens = path.split(keySeparator);
|
|
7343
|
+
let current = obj;
|
|
7344
|
+
for (let i = 0; i < tokens.length;) {
|
|
7345
|
+
if (!current || typeof current !== 'object') {
|
|
7346
|
+
return undefined;
|
|
7347
|
+
}
|
|
7348
|
+
let next;
|
|
7349
|
+
let nextPath = '';
|
|
7350
|
+
for (let j = i; j < tokens.length; ++j) {
|
|
7351
|
+
if (j !== i) {
|
|
7352
|
+
nextPath += keySeparator;
|
|
7353
|
+
}
|
|
7354
|
+
nextPath += tokens[j];
|
|
7355
|
+
next = current[nextPath];
|
|
7356
|
+
if (next !== undefined) {
|
|
7357
|
+
if (['string', 'number', 'boolean'].indexOf(typeof next) > -1 && j < tokens.length - 1) {
|
|
7358
|
+
continue;
|
|
7359
|
+
}
|
|
7360
|
+
i += j - i + 1;
|
|
7361
|
+
break;
|
|
7362
|
+
}
|
|
7363
|
+
}
|
|
7364
|
+
current = next;
|
|
7365
|
+
}
|
|
7366
|
+
return current;
|
|
7367
|
+
};
|
|
7368
|
+
const getCleanedCode = code => code?.replace('_', '-');
|
|
7369
|
+
|
|
7370
|
+
const consoleLogger = {
|
|
7371
|
+
type: 'logger',
|
|
7372
|
+
log(args) {
|
|
7373
|
+
this.output('log', args);
|
|
7374
|
+
},
|
|
7375
|
+
warn(args) {
|
|
7376
|
+
this.output('warn', args);
|
|
7377
|
+
},
|
|
7378
|
+
error(args) {
|
|
7379
|
+
this.output('error', args);
|
|
7380
|
+
},
|
|
7381
|
+
output(type, args) {
|
|
7382
|
+
console?.[type]?.apply?.(console, args);
|
|
7383
|
+
}
|
|
7384
|
+
};
|
|
7385
|
+
class Logger {
|
|
7386
|
+
constructor(concreteLogger, options = {}) {
|
|
7387
|
+
this.init(concreteLogger, options);
|
|
7388
|
+
}
|
|
7389
|
+
init(concreteLogger, options = {}) {
|
|
7390
|
+
this.prefix = options.prefix || 'i18next:';
|
|
7391
|
+
this.logger = concreteLogger || consoleLogger;
|
|
7392
|
+
this.options = options;
|
|
7393
|
+
this.debug = options.debug;
|
|
7394
|
+
}
|
|
7395
|
+
log(...args) {
|
|
7396
|
+
return this.forward(args, 'log', '', true);
|
|
7397
|
+
}
|
|
7398
|
+
warn(...args) {
|
|
7399
|
+
return this.forward(args, 'warn', '', true);
|
|
7400
|
+
}
|
|
7401
|
+
error(...args) {
|
|
7402
|
+
return this.forward(args, 'error', '');
|
|
7403
|
+
}
|
|
7404
|
+
deprecate(...args) {
|
|
7405
|
+
return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
|
|
7406
|
+
}
|
|
7407
|
+
forward(args, lvl, prefix, debugOnly) {
|
|
7408
|
+
if (debugOnly && !this.debug) return null;
|
|
7409
|
+
if (isString(args[0])) args[0] = `${prefix}${this.prefix} ${args[0]}`;
|
|
7410
|
+
return this.logger[lvl](args);
|
|
7411
|
+
}
|
|
7412
|
+
create(moduleName) {
|
|
7413
|
+
return new Logger(this.logger, {
|
|
7414
|
+
...{
|
|
7415
|
+
prefix: `${this.prefix}:${moduleName}:`
|
|
7416
|
+
},
|
|
7417
|
+
...this.options
|
|
7418
|
+
});
|
|
7419
|
+
}
|
|
7420
|
+
clone(options) {
|
|
7421
|
+
options = options || this.options;
|
|
7422
|
+
options.prefix = options.prefix || this.prefix;
|
|
7423
|
+
return new Logger(this.logger, options);
|
|
7424
|
+
}
|
|
7425
|
+
}
|
|
7426
|
+
var baseLogger = new Logger();
|
|
7427
|
+
|
|
7428
|
+
class EventEmitter {
|
|
7429
|
+
constructor() {
|
|
7430
|
+
this.observers = {};
|
|
7431
|
+
}
|
|
7432
|
+
on(events, listener) {
|
|
7433
|
+
events.split(' ').forEach(event => {
|
|
7434
|
+
if (!this.observers[event]) this.observers[event] = new Map();
|
|
7435
|
+
const numListeners = this.observers[event].get(listener) || 0;
|
|
7436
|
+
this.observers[event].set(listener, numListeners + 1);
|
|
7437
|
+
});
|
|
7438
|
+
return this;
|
|
7439
|
+
}
|
|
7440
|
+
off(event, listener) {
|
|
7441
|
+
if (!this.observers[event]) return;
|
|
7442
|
+
if (!listener) {
|
|
7443
|
+
delete this.observers[event];
|
|
7444
|
+
return;
|
|
7445
|
+
}
|
|
7446
|
+
this.observers[event].delete(listener);
|
|
7447
|
+
}
|
|
7448
|
+
emit(event, ...args) {
|
|
7449
|
+
if (this.observers[event]) {
|
|
7450
|
+
const cloned = Array.from(this.observers[event].entries());
|
|
7451
|
+
cloned.forEach(([observer, numTimesAdded]) => {
|
|
7452
|
+
for (let i = 0; i < numTimesAdded; i++) {
|
|
7453
|
+
observer(...args);
|
|
7454
|
+
}
|
|
7455
|
+
});
|
|
7456
|
+
}
|
|
7457
|
+
if (this.observers['*']) {
|
|
7458
|
+
const cloned = Array.from(this.observers['*'].entries());
|
|
7459
|
+
cloned.forEach(([observer, numTimesAdded]) => {
|
|
7460
|
+
for (let i = 0; i < numTimesAdded; i++) {
|
|
7461
|
+
observer.apply(observer, [event, ...args]);
|
|
7462
|
+
}
|
|
7463
|
+
});
|
|
7464
|
+
}
|
|
7465
|
+
}
|
|
7466
|
+
}
|
|
7467
|
+
|
|
7468
|
+
class ResourceStore extends EventEmitter {
|
|
7469
|
+
constructor(data, options = {
|
|
7470
|
+
ns: ['translation'],
|
|
7471
|
+
defaultNS: 'translation'
|
|
7472
|
+
}) {
|
|
7473
|
+
super();
|
|
7474
|
+
this.data = data || {};
|
|
7475
|
+
this.options = options;
|
|
7476
|
+
if (this.options.keySeparator === undefined) {
|
|
7477
|
+
this.options.keySeparator = '.';
|
|
7478
|
+
}
|
|
7479
|
+
if (this.options.ignoreJSONStructure === undefined) {
|
|
7480
|
+
this.options.ignoreJSONStructure = true;
|
|
7481
|
+
}
|
|
7482
|
+
}
|
|
7483
|
+
addNamespaces(ns) {
|
|
7484
|
+
if (this.options.ns.indexOf(ns) < 0) {
|
|
7485
|
+
this.options.ns.push(ns);
|
|
7486
|
+
}
|
|
7487
|
+
}
|
|
7488
|
+
removeNamespaces(ns) {
|
|
7489
|
+
const index = this.options.ns.indexOf(ns);
|
|
7490
|
+
if (index > -1) {
|
|
7491
|
+
this.options.ns.splice(index, 1);
|
|
7492
|
+
}
|
|
7493
|
+
}
|
|
7494
|
+
getResource(lng, ns, key, options = {}) {
|
|
7495
|
+
const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
7496
|
+
const ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
7497
|
+
let path;
|
|
7498
|
+
if (lng.indexOf('.') > -1) {
|
|
7499
|
+
path = lng.split('.');
|
|
7500
|
+
} else {
|
|
7501
|
+
path = [lng, ns];
|
|
7502
|
+
if (key) {
|
|
7503
|
+
if (Array.isArray(key)) {
|
|
7504
|
+
path.push(...key);
|
|
7505
|
+
} else if (isString(key) && keySeparator) {
|
|
7506
|
+
path.push(...key.split(keySeparator));
|
|
7507
|
+
} else {
|
|
7508
|
+
path.push(key);
|
|
7509
|
+
}
|
|
7510
|
+
}
|
|
7511
|
+
}
|
|
7512
|
+
const result = getPath(this.data, path);
|
|
7513
|
+
if (!result && !ns && !key && lng.indexOf('.') > -1) {
|
|
7514
|
+
lng = path[0];
|
|
7515
|
+
ns = path[1];
|
|
7516
|
+
key = path.slice(2).join('.');
|
|
7517
|
+
}
|
|
7518
|
+
if (result || !ignoreJSONStructure || !isString(key)) return result;
|
|
7519
|
+
return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
|
|
7520
|
+
}
|
|
7521
|
+
addResource(lng, ns, key, value, options = {
|
|
7522
|
+
silent: false
|
|
7523
|
+
}) {
|
|
7524
|
+
const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
7525
|
+
let path = [lng, ns];
|
|
7526
|
+
if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
7527
|
+
if (lng.indexOf('.') > -1) {
|
|
7528
|
+
path = lng.split('.');
|
|
7529
|
+
value = ns;
|
|
7530
|
+
ns = path[1];
|
|
7531
|
+
}
|
|
7532
|
+
this.addNamespaces(ns);
|
|
7533
|
+
setPath(this.data, path, value);
|
|
7534
|
+
if (!options.silent) this.emit('added', lng, ns, key, value);
|
|
7535
|
+
}
|
|
7536
|
+
addResources(lng, ns, resources, options = {
|
|
7537
|
+
silent: false
|
|
7538
|
+
}) {
|
|
7539
|
+
for (const m in resources) {
|
|
7540
|
+
if (isString(resources[m]) || Array.isArray(resources[m])) this.addResource(lng, ns, m, resources[m], {
|
|
7541
|
+
silent: true
|
|
7542
|
+
});
|
|
7543
|
+
}
|
|
7544
|
+
if (!options.silent) this.emit('added', lng, ns, resources);
|
|
7545
|
+
}
|
|
7546
|
+
addResourceBundle(lng, ns, resources, deep, overwrite, options = {
|
|
7547
|
+
silent: false,
|
|
7548
|
+
skipCopy: false
|
|
7549
|
+
}) {
|
|
7550
|
+
let path = [lng, ns];
|
|
7551
|
+
if (lng.indexOf('.') > -1) {
|
|
7552
|
+
path = lng.split('.');
|
|
7553
|
+
deep = resources;
|
|
7554
|
+
resources = ns;
|
|
7555
|
+
ns = path[1];
|
|
7556
|
+
}
|
|
7557
|
+
this.addNamespaces(ns);
|
|
7558
|
+
let pack = getPath(this.data, path) || {};
|
|
7559
|
+
if (!options.skipCopy) resources = JSON.parse(JSON.stringify(resources));
|
|
7560
|
+
if (deep) {
|
|
7561
|
+
deepExtend(pack, resources, overwrite);
|
|
7562
|
+
} else {
|
|
7563
|
+
pack = {
|
|
7564
|
+
...pack,
|
|
7565
|
+
...resources
|
|
7566
|
+
};
|
|
7567
|
+
}
|
|
7568
|
+
setPath(this.data, path, pack);
|
|
7569
|
+
if (!options.silent) this.emit('added', lng, ns, resources);
|
|
7570
|
+
}
|
|
7571
|
+
removeResourceBundle(lng, ns) {
|
|
7572
|
+
if (this.hasResourceBundle(lng, ns)) {
|
|
7573
|
+
delete this.data[lng][ns];
|
|
7574
|
+
}
|
|
7575
|
+
this.removeNamespaces(ns);
|
|
7576
|
+
this.emit('removed', lng, ns);
|
|
7577
|
+
}
|
|
7578
|
+
hasResourceBundle(lng, ns) {
|
|
7579
|
+
return this.getResource(lng, ns) !== undefined;
|
|
7580
|
+
}
|
|
7581
|
+
getResourceBundle(lng, ns) {
|
|
7582
|
+
if (!ns) ns = this.options.defaultNS;
|
|
7583
|
+
return this.getResource(lng, ns);
|
|
7584
|
+
}
|
|
7585
|
+
getDataByLanguage(lng) {
|
|
7586
|
+
return this.data[lng];
|
|
7587
|
+
}
|
|
7588
|
+
hasLanguageSomeTranslations(lng) {
|
|
7589
|
+
const data = this.getDataByLanguage(lng);
|
|
7590
|
+
const n = data && Object.keys(data) || [];
|
|
7591
|
+
return !!n.find(v => data[v] && Object.keys(data[v]).length > 0);
|
|
7592
|
+
}
|
|
7593
|
+
toJSON() {
|
|
7594
|
+
return this.data;
|
|
7595
|
+
}
|
|
7596
|
+
}
|
|
7597
|
+
|
|
7598
|
+
var postProcessor = {
|
|
7599
|
+
processors: {},
|
|
7600
|
+
addPostProcessor(module) {
|
|
7601
|
+
this.processors[module.name] = module;
|
|
7602
|
+
},
|
|
7603
|
+
handle(processors, value, key, options, translator) {
|
|
7604
|
+
processors.forEach(processor => {
|
|
7605
|
+
value = this.processors[processor]?.process(value, key, options, translator) ?? value;
|
|
7606
|
+
});
|
|
7607
|
+
return value;
|
|
7608
|
+
}
|
|
7609
|
+
};
|
|
7610
|
+
|
|
7611
|
+
const PATH_KEY = Symbol('i18next/PATH_KEY');
|
|
7612
|
+
function createProxy() {
|
|
7613
|
+
const state = [];
|
|
7614
|
+
const handler = Object.create(null);
|
|
7615
|
+
let proxy;
|
|
7616
|
+
handler.get = (target, key) => {
|
|
7617
|
+
proxy?.revoke?.();
|
|
7618
|
+
if (key === PATH_KEY) return state;
|
|
7619
|
+
state.push(key);
|
|
7620
|
+
proxy = Proxy.revocable(target, handler);
|
|
7621
|
+
return proxy.proxy;
|
|
7622
|
+
};
|
|
7623
|
+
return Proxy.revocable(Object.create(null), handler).proxy;
|
|
7624
|
+
}
|
|
7625
|
+
function keysFromSelector(selector, opts) {
|
|
7626
|
+
const {
|
|
7627
|
+
[PATH_KEY]: path
|
|
7628
|
+
} = selector(createProxy());
|
|
7629
|
+
return path.join(opts?.keySeparator ?? '.');
|
|
7630
|
+
}
|
|
7631
|
+
|
|
7632
|
+
const checkedLoadedFor = {};
|
|
7633
|
+
const shouldHandleAsObject = res => !isString(res) && typeof res !== 'boolean' && typeof res !== 'number';
|
|
7634
|
+
class Translator extends EventEmitter {
|
|
7635
|
+
constructor(services, options = {}) {
|
|
7636
|
+
super();
|
|
7637
|
+
copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, this);
|
|
7638
|
+
this.options = options;
|
|
7639
|
+
if (this.options.keySeparator === undefined) {
|
|
7640
|
+
this.options.keySeparator = '.';
|
|
7641
|
+
}
|
|
7642
|
+
this.logger = baseLogger.create('translator');
|
|
7643
|
+
}
|
|
7644
|
+
changeLanguage(lng) {
|
|
7645
|
+
if (lng) this.language = lng;
|
|
7646
|
+
}
|
|
7647
|
+
exists(key, o = {
|
|
7648
|
+
interpolation: {}
|
|
7649
|
+
}) {
|
|
7650
|
+
const opt = {
|
|
7651
|
+
...o
|
|
7652
|
+
};
|
|
7653
|
+
if (key == null) return false;
|
|
7654
|
+
const resolved = this.resolve(key, opt);
|
|
7655
|
+
if (resolved?.res === undefined) return false;
|
|
7656
|
+
const isObject = shouldHandleAsObject(resolved.res);
|
|
7657
|
+
if (opt.returnObjects === false && isObject) {
|
|
7658
|
+
return false;
|
|
7659
|
+
}
|
|
7660
|
+
return true;
|
|
7661
|
+
}
|
|
7662
|
+
extractFromKey(key, opt) {
|
|
7663
|
+
let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator;
|
|
7664
|
+
if (nsSeparator === undefined) nsSeparator = ':';
|
|
7665
|
+
const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
|
|
7666
|
+
let namespaces = opt.ns || this.options.defaultNS || [];
|
|
7667
|
+
const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
|
|
7668
|
+
const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
|
|
7669
|
+
if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
|
|
7670
|
+
const m = key.match(this.interpolator.nestingRegexp);
|
|
7671
|
+
if (m && m.length > 0) {
|
|
7672
|
+
return {
|
|
7673
|
+
key,
|
|
7674
|
+
namespaces: isString(namespaces) ? [namespaces] : namespaces
|
|
7675
|
+
};
|
|
7676
|
+
}
|
|
7677
|
+
const parts = key.split(nsSeparator);
|
|
7678
|
+
if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
|
|
7679
|
+
key = parts.join(keySeparator);
|
|
7680
|
+
}
|
|
7681
|
+
return {
|
|
7682
|
+
key,
|
|
7683
|
+
namespaces: isString(namespaces) ? [namespaces] : namespaces
|
|
7684
|
+
};
|
|
7685
|
+
}
|
|
7686
|
+
translate(keys, o, lastKey) {
|
|
7687
|
+
let opt = typeof o === 'object' ? {
|
|
7688
|
+
...o
|
|
7689
|
+
} : o;
|
|
7690
|
+
if (typeof opt !== 'object' && this.options.overloadTranslationOptionHandler) {
|
|
7691
|
+
opt = this.options.overloadTranslationOptionHandler(arguments);
|
|
7692
|
+
}
|
|
7693
|
+
if (typeof opt === 'object') opt = {
|
|
7694
|
+
...opt
|
|
7695
|
+
};
|
|
7696
|
+
if (!opt) opt = {};
|
|
7697
|
+
if (keys == null) return '';
|
|
7698
|
+
if (typeof keys === 'function') keys = keysFromSelector(keys, {
|
|
7699
|
+
...this.options,
|
|
7700
|
+
...opt
|
|
7701
|
+
});
|
|
7702
|
+
if (!Array.isArray(keys)) keys = [String(keys)];
|
|
7703
|
+
const returnDetails = opt.returnDetails !== undefined ? opt.returnDetails : this.options.returnDetails;
|
|
7704
|
+
const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
|
|
7705
|
+
const {
|
|
7706
|
+
key,
|
|
7707
|
+
namespaces
|
|
7708
|
+
} = this.extractFromKey(keys[keys.length - 1], opt);
|
|
7709
|
+
const namespace = namespaces[namespaces.length - 1];
|
|
7710
|
+
let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator;
|
|
7711
|
+
if (nsSeparator === undefined) nsSeparator = ':';
|
|
7712
|
+
const lng = opt.lng || this.language;
|
|
7713
|
+
const appendNamespaceToCIMode = opt.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
7714
|
+
if (lng?.toLowerCase() === 'cimode') {
|
|
7715
|
+
if (appendNamespaceToCIMode) {
|
|
7716
|
+
if (returnDetails) {
|
|
7717
|
+
return {
|
|
7718
|
+
res: `${namespace}${nsSeparator}${key}`,
|
|
7719
|
+
usedKey: key,
|
|
7720
|
+
exactUsedKey: key,
|
|
7721
|
+
usedLng: lng,
|
|
7722
|
+
usedNS: namespace,
|
|
7723
|
+
usedParams: this.getUsedParamsDetails(opt)
|
|
7724
|
+
};
|
|
7725
|
+
}
|
|
7726
|
+
return `${namespace}${nsSeparator}${key}`;
|
|
7727
|
+
}
|
|
7728
|
+
if (returnDetails) {
|
|
7729
|
+
return {
|
|
7730
|
+
res: key,
|
|
7731
|
+
usedKey: key,
|
|
7732
|
+
exactUsedKey: key,
|
|
7733
|
+
usedLng: lng,
|
|
7734
|
+
usedNS: namespace,
|
|
7735
|
+
usedParams: this.getUsedParamsDetails(opt)
|
|
7736
|
+
};
|
|
7737
|
+
}
|
|
7738
|
+
return key;
|
|
7739
|
+
}
|
|
7740
|
+
const resolved = this.resolve(keys, opt);
|
|
7741
|
+
let res = resolved?.res;
|
|
7742
|
+
const resUsedKey = resolved?.usedKey || key;
|
|
7743
|
+
const resExactUsedKey = resolved?.exactUsedKey || key;
|
|
7744
|
+
const noObject = ['[object Number]', '[object Function]', '[object RegExp]'];
|
|
7745
|
+
const joinArrays = opt.joinArrays !== undefined ? opt.joinArrays : this.options.joinArrays;
|
|
7746
|
+
const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
|
|
7747
|
+
const needsPluralHandling = opt.count !== undefined && !isString(opt.count);
|
|
7748
|
+
const hasDefaultValue = Translator.hasDefaultValue(opt);
|
|
7749
|
+
const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, opt) : '';
|
|
7750
|
+
const defaultValueSuffixOrdinalFallback = opt.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, {
|
|
7751
|
+
ordinal: false
|
|
7752
|
+
}) : '';
|
|
7753
|
+
const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
|
|
7754
|
+
const defaultValue = needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] || opt[`defaultValue${defaultValueSuffix}`] || opt[`defaultValue${defaultValueSuffixOrdinalFallback}`] || opt.defaultValue;
|
|
7755
|
+
let resForObjHndl = res;
|
|
7756
|
+
if (handleAsObjectInI18nFormat && !res && hasDefaultValue) {
|
|
7757
|
+
resForObjHndl = defaultValue;
|
|
7758
|
+
}
|
|
7759
|
+
const handleAsObject = shouldHandleAsObject(resForObjHndl);
|
|
7760
|
+
const resType = Object.prototype.toString.apply(resForObjHndl);
|
|
7761
|
+
if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
|
|
7762
|
+
if (!opt.returnObjects && !this.options.returnObjects) {
|
|
7763
|
+
if (!this.options.returnedObjectHandler) {
|
|
7764
|
+
this.logger.warn('accessing an object - but returnObjects options is not enabled!');
|
|
7765
|
+
}
|
|
7766
|
+
const r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, resForObjHndl, {
|
|
7767
|
+
...opt,
|
|
7768
|
+
ns: namespaces
|
|
7769
|
+
}) : `key '${key} (${this.language})' returned an object instead of string.`;
|
|
7770
|
+
if (returnDetails) {
|
|
7771
|
+
resolved.res = r;
|
|
7772
|
+
resolved.usedParams = this.getUsedParamsDetails(opt);
|
|
7773
|
+
return resolved;
|
|
7774
|
+
}
|
|
7775
|
+
return r;
|
|
7776
|
+
}
|
|
7777
|
+
if (keySeparator) {
|
|
7778
|
+
const resTypeIsArray = Array.isArray(resForObjHndl);
|
|
7779
|
+
const copy = resTypeIsArray ? [] : {};
|
|
7780
|
+
const newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
|
|
7781
|
+
for (const m in resForObjHndl) {
|
|
7782
|
+
if (Object.prototype.hasOwnProperty.call(resForObjHndl, m)) {
|
|
7783
|
+
const deepKey = `${newKeyToUse}${keySeparator}${m}`;
|
|
7784
|
+
if (hasDefaultValue && !res) {
|
|
7785
|
+
copy[m] = this.translate(deepKey, {
|
|
7786
|
+
...opt,
|
|
7787
|
+
defaultValue: shouldHandleAsObject(defaultValue) ? defaultValue[m] : undefined,
|
|
7788
|
+
...{
|
|
7789
|
+
joinArrays: false,
|
|
7790
|
+
ns: namespaces
|
|
7791
|
+
}
|
|
7792
|
+
});
|
|
7793
|
+
} else {
|
|
7794
|
+
copy[m] = this.translate(deepKey, {
|
|
7795
|
+
...opt,
|
|
7796
|
+
...{
|
|
7797
|
+
joinArrays: false,
|
|
7798
|
+
ns: namespaces
|
|
7799
|
+
}
|
|
7800
|
+
});
|
|
7801
|
+
}
|
|
7802
|
+
if (copy[m] === deepKey) copy[m] = resForObjHndl[m];
|
|
7803
|
+
}
|
|
7804
|
+
}
|
|
7805
|
+
res = copy;
|
|
7806
|
+
}
|
|
7807
|
+
} else if (handleAsObjectInI18nFormat && isString(joinArrays) && Array.isArray(res)) {
|
|
7808
|
+
res = res.join(joinArrays);
|
|
7809
|
+
if (res) res = this.extendTranslation(res, keys, opt, lastKey);
|
|
7810
|
+
} else {
|
|
7811
|
+
let usedDefault = false;
|
|
7812
|
+
let usedKey = false;
|
|
7813
|
+
if (!this.isValidLookup(res) && hasDefaultValue) {
|
|
7814
|
+
usedDefault = true;
|
|
7815
|
+
res = defaultValue;
|
|
7816
|
+
}
|
|
7817
|
+
if (!this.isValidLookup(res)) {
|
|
7818
|
+
usedKey = true;
|
|
7819
|
+
res = key;
|
|
7820
|
+
}
|
|
7821
|
+
const missingKeyNoValueFallbackToKey = opt.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
|
|
7822
|
+
const resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;
|
|
7823
|
+
const updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
|
|
7824
|
+
if (usedKey || usedDefault || updateMissing) {
|
|
7825
|
+
this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);
|
|
7826
|
+
if (keySeparator) {
|
|
7827
|
+
const fk = this.resolve(key, {
|
|
7828
|
+
...opt,
|
|
7829
|
+
keySeparator: false
|
|
7830
|
+
});
|
|
7831
|
+
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.');
|
|
7832
|
+
}
|
|
7833
|
+
let lngs = [];
|
|
7834
|
+
const fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, opt.lng || this.language);
|
|
7835
|
+
if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {
|
|
7836
|
+
for (let i = 0; i < fallbackLngs.length; i++) {
|
|
7837
|
+
lngs.push(fallbackLngs[i]);
|
|
7838
|
+
}
|
|
7839
|
+
} else if (this.options.saveMissingTo === 'all') {
|
|
7840
|
+
lngs = this.languageUtils.toResolveHierarchy(opt.lng || this.language);
|
|
7841
|
+
} else {
|
|
7842
|
+
lngs.push(opt.lng || this.language);
|
|
7843
|
+
}
|
|
7844
|
+
const send = (l, k, specificDefaultValue) => {
|
|
7845
|
+
const defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
|
|
7846
|
+
if (this.options.missingKeyHandler) {
|
|
7847
|
+
this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, opt);
|
|
7848
|
+
} else if (this.backendConnector?.saveMissing) {
|
|
7849
|
+
this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, opt);
|
|
7850
|
+
}
|
|
7851
|
+
this.emit('missingKey', l, namespace, k, res);
|
|
7852
|
+
};
|
|
7853
|
+
if (this.options.saveMissing) {
|
|
7854
|
+
if (this.options.saveMissingPlurals && needsPluralHandling) {
|
|
7855
|
+
lngs.forEach(language => {
|
|
7856
|
+
const suffixes = this.pluralResolver.getSuffixes(language, opt);
|
|
7857
|
+
if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0) {
|
|
7858
|
+
suffixes.push(`${this.options.pluralSeparator}zero`);
|
|
7859
|
+
}
|
|
7860
|
+
suffixes.forEach(suffix => {
|
|
7861
|
+
send([language], key + suffix, opt[`defaultValue${suffix}`] || defaultValue);
|
|
7862
|
+
});
|
|
7863
|
+
});
|
|
7864
|
+
} else {
|
|
7865
|
+
send(lngs, key, defaultValue);
|
|
7866
|
+
}
|
|
7867
|
+
}
|
|
7868
|
+
}
|
|
7869
|
+
res = this.extendTranslation(res, keys, opt, resolved, lastKey);
|
|
7870
|
+
if (usedKey && res === key && this.options.appendNamespaceToMissingKey) {
|
|
7871
|
+
res = `${namespace}${nsSeparator}${key}`;
|
|
7872
|
+
}
|
|
7873
|
+
if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
|
|
7874
|
+
res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}${nsSeparator}${key}` : key, usedDefault ? res : undefined, opt);
|
|
7875
|
+
}
|
|
7876
|
+
}
|
|
7877
|
+
if (returnDetails) {
|
|
7878
|
+
resolved.res = res;
|
|
7879
|
+
resolved.usedParams = this.getUsedParamsDetails(opt);
|
|
7880
|
+
return resolved;
|
|
7881
|
+
}
|
|
7882
|
+
return res;
|
|
7883
|
+
}
|
|
7884
|
+
extendTranslation(res, key, opt, resolved, lastKey) {
|
|
7885
|
+
if (this.i18nFormat?.parse) {
|
|
7886
|
+
res = this.i18nFormat.parse(res, {
|
|
7887
|
+
...this.options.interpolation.defaultVariables,
|
|
7888
|
+
...opt
|
|
7889
|
+
}, opt.lng || this.language || resolved.usedLng, resolved.usedNS, resolved.usedKey, {
|
|
7890
|
+
resolved
|
|
7891
|
+
});
|
|
7892
|
+
} else if (!opt.skipInterpolation) {
|
|
7893
|
+
if (opt.interpolation) this.interpolator.init({
|
|
7894
|
+
...opt,
|
|
7895
|
+
...{
|
|
7896
|
+
interpolation: {
|
|
7897
|
+
...this.options.interpolation,
|
|
7898
|
+
...opt.interpolation
|
|
7899
|
+
}
|
|
7900
|
+
}
|
|
7901
|
+
});
|
|
7902
|
+
const skipOnVariables = isString(res) && (opt?.interpolation?.skipOnVariables !== undefined ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
7903
|
+
let nestBef;
|
|
7904
|
+
if (skipOnVariables) {
|
|
7905
|
+
const nb = res.match(this.interpolator.nestingRegexp);
|
|
7906
|
+
nestBef = nb && nb.length;
|
|
7907
|
+
}
|
|
7908
|
+
let data = opt.replace && !isString(opt.replace) ? opt.replace : opt;
|
|
7909
|
+
if (this.options.interpolation.defaultVariables) data = {
|
|
7910
|
+
...this.options.interpolation.defaultVariables,
|
|
7911
|
+
...data
|
|
7912
|
+
};
|
|
7913
|
+
res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt);
|
|
7914
|
+
if (skipOnVariables) {
|
|
7915
|
+
const na = res.match(this.interpolator.nestingRegexp);
|
|
7916
|
+
const nestAft = na && na.length;
|
|
7917
|
+
if (nestBef < nestAft) opt.nest = false;
|
|
7918
|
+
}
|
|
7919
|
+
if (!opt.lng && resolved && resolved.res) opt.lng = this.language || resolved.usedLng;
|
|
7920
|
+
if (opt.nest !== false) res = this.interpolator.nest(res, (...args) => {
|
|
7921
|
+
if (lastKey?.[0] === args[0] && !opt.context) {
|
|
7922
|
+
this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
|
|
7923
|
+
return null;
|
|
7924
|
+
}
|
|
7925
|
+
return this.translate(...args, key);
|
|
7926
|
+
}, opt);
|
|
7927
|
+
if (opt.interpolation) this.interpolator.reset();
|
|
7928
|
+
}
|
|
7929
|
+
const postProcess = opt.postProcess || this.options.postProcess;
|
|
7930
|
+
const postProcessorNames = isString(postProcess) ? [postProcess] : postProcess;
|
|
7931
|
+
if (res != null && postProcessorNames?.length && opt.applyPostProcessor !== false) {
|
|
7932
|
+
res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? {
|
|
7933
|
+
i18nResolved: {
|
|
7934
|
+
...resolved,
|
|
7935
|
+
usedParams: this.getUsedParamsDetails(opt)
|
|
7936
|
+
},
|
|
7937
|
+
...opt
|
|
7938
|
+
} : opt, this);
|
|
7939
|
+
}
|
|
7940
|
+
return res;
|
|
7941
|
+
}
|
|
7942
|
+
resolve(keys, opt = {}) {
|
|
7943
|
+
let found;
|
|
7944
|
+
let usedKey;
|
|
7945
|
+
let exactUsedKey;
|
|
7946
|
+
let usedLng;
|
|
7947
|
+
let usedNS;
|
|
7948
|
+
if (isString(keys)) keys = [keys];
|
|
7949
|
+
keys.forEach(k => {
|
|
7950
|
+
if (this.isValidLookup(found)) return;
|
|
7951
|
+
const extracted = this.extractFromKey(k, opt);
|
|
7952
|
+
const key = extracted.key;
|
|
7953
|
+
usedKey = key;
|
|
7954
|
+
let namespaces = extracted.namespaces;
|
|
7955
|
+
if (this.options.fallbackNS) namespaces = namespaces.concat(this.options.fallbackNS);
|
|
7956
|
+
const needsPluralHandling = opt.count !== undefined && !isString(opt.count);
|
|
7957
|
+
const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
|
|
7958
|
+
const needsContextHandling = opt.context !== undefined && (isString(opt.context) || typeof opt.context === 'number') && opt.context !== '';
|
|
7959
|
+
const codes = opt.lngs ? opt.lngs : this.languageUtils.toResolveHierarchy(opt.lng || this.language, opt.fallbackLng);
|
|
7960
|
+
namespaces.forEach(ns => {
|
|
7961
|
+
if (this.isValidLookup(found)) return;
|
|
7962
|
+
usedNS = ns;
|
|
7963
|
+
if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
|
|
7964
|
+
checkedLoadedFor[`${codes[0]}-${ns}`] = true;
|
|
7965
|
+
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!!!');
|
|
7966
|
+
}
|
|
7967
|
+
codes.forEach(code => {
|
|
7968
|
+
if (this.isValidLookup(found)) return;
|
|
7969
|
+
usedLng = code;
|
|
7970
|
+
const finalKeys = [key];
|
|
7971
|
+
if (this.i18nFormat?.addLookupKeys) {
|
|
7972
|
+
this.i18nFormat.addLookupKeys(finalKeys, key, code, ns, opt);
|
|
7973
|
+
} else {
|
|
7974
|
+
let pluralSuffix;
|
|
7975
|
+
if (needsPluralHandling) pluralSuffix = this.pluralResolver.getSuffix(code, opt.count, opt);
|
|
7976
|
+
const zeroSuffix = `${this.options.pluralSeparator}zero`;
|
|
7977
|
+
const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
7978
|
+
if (needsPluralHandling) {
|
|
7979
|
+
if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
|
|
7980
|
+
finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
|
|
7981
|
+
}
|
|
7982
|
+
finalKeys.push(key + pluralSuffix);
|
|
7983
|
+
if (needsZeroSuffixLookup) {
|
|
7984
|
+
finalKeys.push(key + zeroSuffix);
|
|
7985
|
+
}
|
|
7986
|
+
}
|
|
7987
|
+
if (needsContextHandling) {
|
|
7988
|
+
const contextKey = `${key}${this.options.contextSeparator || '_'}${opt.context}`;
|
|
7989
|
+
finalKeys.push(contextKey);
|
|
7990
|
+
if (needsPluralHandling) {
|
|
7991
|
+
if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
|
|
7992
|
+
finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
|
|
7993
|
+
}
|
|
7994
|
+
finalKeys.push(contextKey + pluralSuffix);
|
|
7995
|
+
if (needsZeroSuffixLookup) {
|
|
7996
|
+
finalKeys.push(contextKey + zeroSuffix);
|
|
7997
|
+
}
|
|
7998
|
+
}
|
|
7999
|
+
}
|
|
8000
|
+
}
|
|
8001
|
+
let possibleKey;
|
|
8002
|
+
while (possibleKey = finalKeys.pop()) {
|
|
8003
|
+
if (!this.isValidLookup(found)) {
|
|
8004
|
+
exactUsedKey = possibleKey;
|
|
8005
|
+
found = this.getResource(code, ns, possibleKey, opt);
|
|
8006
|
+
}
|
|
8007
|
+
}
|
|
8008
|
+
});
|
|
8009
|
+
});
|
|
8010
|
+
});
|
|
8011
|
+
return {
|
|
8012
|
+
res: found,
|
|
8013
|
+
usedKey,
|
|
8014
|
+
exactUsedKey,
|
|
8015
|
+
usedLng,
|
|
8016
|
+
usedNS
|
|
8017
|
+
};
|
|
8018
|
+
}
|
|
8019
|
+
isValidLookup(res) {
|
|
8020
|
+
return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');
|
|
8021
|
+
}
|
|
8022
|
+
getResource(code, ns, key, options = {}) {
|
|
8023
|
+
if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options);
|
|
8024
|
+
return this.resourceStore.getResource(code, ns, key, options);
|
|
8025
|
+
}
|
|
8026
|
+
getUsedParamsDetails(options = {}) {
|
|
8027
|
+
const optionsKeys = ['defaultValue', 'ordinal', 'context', 'replace', 'lng', 'lngs', 'fallbackLng', 'ns', 'keySeparator', 'nsSeparator', 'returnObjects', 'returnDetails', 'joinArrays', 'postProcess', 'interpolation'];
|
|
8028
|
+
const useOptionsReplaceForData = options.replace && !isString(options.replace);
|
|
8029
|
+
let data = useOptionsReplaceForData ? options.replace : options;
|
|
8030
|
+
if (useOptionsReplaceForData && typeof options.count !== 'undefined') {
|
|
8031
|
+
data.count = options.count;
|
|
8032
|
+
}
|
|
8033
|
+
if (this.options.interpolation.defaultVariables) {
|
|
8034
|
+
data = {
|
|
8035
|
+
...this.options.interpolation.defaultVariables,
|
|
8036
|
+
...data
|
|
8037
|
+
};
|
|
8038
|
+
}
|
|
8039
|
+
if (!useOptionsReplaceForData) {
|
|
8040
|
+
data = {
|
|
8041
|
+
...data
|
|
8042
|
+
};
|
|
8043
|
+
for (const key of optionsKeys) {
|
|
8044
|
+
delete data[key];
|
|
8045
|
+
}
|
|
8046
|
+
}
|
|
8047
|
+
return data;
|
|
8048
|
+
}
|
|
8049
|
+
static hasDefaultValue(options) {
|
|
8050
|
+
const prefix = 'defaultValue';
|
|
8051
|
+
for (const option in options) {
|
|
8052
|
+
if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {
|
|
8053
|
+
return true;
|
|
8054
|
+
}
|
|
8055
|
+
}
|
|
8056
|
+
return false;
|
|
8057
|
+
}
|
|
8058
|
+
}
|
|
8059
|
+
|
|
8060
|
+
class LanguageUtil {
|
|
8061
|
+
constructor(options) {
|
|
8062
|
+
this.options = options;
|
|
8063
|
+
this.supportedLngs = this.options.supportedLngs || false;
|
|
8064
|
+
this.logger = baseLogger.create('languageUtils');
|
|
8065
|
+
}
|
|
8066
|
+
getScriptPartFromCode(code) {
|
|
8067
|
+
code = getCleanedCode(code);
|
|
8068
|
+
if (!code || code.indexOf('-') < 0) return null;
|
|
8069
|
+
const p = code.split('-');
|
|
8070
|
+
if (p.length === 2) return null;
|
|
8071
|
+
p.pop();
|
|
8072
|
+
if (p[p.length - 1].toLowerCase() === 'x') return null;
|
|
8073
|
+
return this.formatLanguageCode(p.join('-'));
|
|
8074
|
+
}
|
|
8075
|
+
getLanguagePartFromCode(code) {
|
|
8076
|
+
code = getCleanedCode(code);
|
|
8077
|
+
if (!code || code.indexOf('-') < 0) return code;
|
|
8078
|
+
const p = code.split('-');
|
|
8079
|
+
return this.formatLanguageCode(p[0]);
|
|
8080
|
+
}
|
|
8081
|
+
formatLanguageCode(code) {
|
|
8082
|
+
if (isString(code) && code.indexOf('-') > -1) {
|
|
8083
|
+
let formattedCode;
|
|
8084
|
+
try {
|
|
8085
|
+
formattedCode = Intl.getCanonicalLocales(code)[0];
|
|
8086
|
+
} catch (e) {}
|
|
8087
|
+
if (formattedCode && this.options.lowerCaseLng) {
|
|
8088
|
+
formattedCode = formattedCode.toLowerCase();
|
|
8089
|
+
}
|
|
8090
|
+
if (formattedCode) return formattedCode;
|
|
8091
|
+
if (this.options.lowerCaseLng) {
|
|
8092
|
+
return code.toLowerCase();
|
|
8093
|
+
}
|
|
8094
|
+
return code;
|
|
8095
|
+
}
|
|
8096
|
+
return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
|
|
8097
|
+
}
|
|
8098
|
+
isSupportedCode(code) {
|
|
8099
|
+
if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
|
|
8100
|
+
code = this.getLanguagePartFromCode(code);
|
|
8101
|
+
}
|
|
8102
|
+
return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
|
|
8103
|
+
}
|
|
8104
|
+
getBestMatchFromCodes(codes) {
|
|
8105
|
+
if (!codes) return null;
|
|
8106
|
+
let found;
|
|
8107
|
+
codes.forEach(code => {
|
|
8108
|
+
if (found) return;
|
|
8109
|
+
const cleanedLng = this.formatLanguageCode(code);
|
|
8110
|
+
if (!this.options.supportedLngs || this.isSupportedCode(cleanedLng)) found = cleanedLng;
|
|
8111
|
+
});
|
|
8112
|
+
if (!found && this.options.supportedLngs) {
|
|
8113
|
+
codes.forEach(code => {
|
|
8114
|
+
if (found) return;
|
|
8115
|
+
const lngScOnly = this.getScriptPartFromCode(code);
|
|
8116
|
+
if (this.isSupportedCode(lngScOnly)) return found = lngScOnly;
|
|
8117
|
+
const lngOnly = this.getLanguagePartFromCode(code);
|
|
8118
|
+
if (this.isSupportedCode(lngOnly)) return found = lngOnly;
|
|
8119
|
+
found = this.options.supportedLngs.find(supportedLng => {
|
|
8120
|
+
if (supportedLng === lngOnly) return supportedLng;
|
|
8121
|
+
if (supportedLng.indexOf('-') < 0 && lngOnly.indexOf('-') < 0) return;
|
|
8122
|
+
if (supportedLng.indexOf('-') > 0 && lngOnly.indexOf('-') < 0 && supportedLng.substring(0, supportedLng.indexOf('-')) === lngOnly) return supportedLng;
|
|
8123
|
+
if (supportedLng.indexOf(lngOnly) === 0 && lngOnly.length > 1) return supportedLng;
|
|
8124
|
+
});
|
|
8125
|
+
});
|
|
8126
|
+
}
|
|
8127
|
+
if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
|
|
8128
|
+
return found;
|
|
8129
|
+
}
|
|
8130
|
+
getFallbackCodes(fallbacks, code) {
|
|
8131
|
+
if (!fallbacks) return [];
|
|
8132
|
+
if (typeof fallbacks === 'function') fallbacks = fallbacks(code);
|
|
8133
|
+
if (isString(fallbacks)) fallbacks = [fallbacks];
|
|
8134
|
+
if (Array.isArray(fallbacks)) return fallbacks;
|
|
8135
|
+
if (!code) return fallbacks.default || [];
|
|
8136
|
+
let found = fallbacks[code];
|
|
8137
|
+
if (!found) found = fallbacks[this.getScriptPartFromCode(code)];
|
|
8138
|
+
if (!found) found = fallbacks[this.formatLanguageCode(code)];
|
|
8139
|
+
if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];
|
|
8140
|
+
if (!found) found = fallbacks.default;
|
|
8141
|
+
return found || [];
|
|
8142
|
+
}
|
|
8143
|
+
toResolveHierarchy(code, fallbackCode) {
|
|
8144
|
+
const fallbackCodes = this.getFallbackCodes((fallbackCode === false ? [] : fallbackCode) || this.options.fallbackLng || [], code);
|
|
8145
|
+
const codes = [];
|
|
8146
|
+
const addCode = c => {
|
|
8147
|
+
if (!c) return;
|
|
8148
|
+
if (this.isSupportedCode(c)) {
|
|
8149
|
+
codes.push(c);
|
|
8150
|
+
} else {
|
|
8151
|
+
this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);
|
|
8152
|
+
}
|
|
8153
|
+
};
|
|
8154
|
+
if (isString(code) && (code.indexOf('-') > -1 || code.indexOf('_') > -1)) {
|
|
8155
|
+
if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
|
|
8156
|
+
if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
|
|
8157
|
+
if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
|
|
8158
|
+
} else if (isString(code)) {
|
|
8159
|
+
addCode(this.formatLanguageCode(code));
|
|
8160
|
+
}
|
|
8161
|
+
fallbackCodes.forEach(fc => {
|
|
8162
|
+
if (codes.indexOf(fc) < 0) addCode(this.formatLanguageCode(fc));
|
|
8163
|
+
});
|
|
8164
|
+
return codes;
|
|
8165
|
+
}
|
|
8166
|
+
}
|
|
8167
|
+
|
|
8168
|
+
const suffixesOrder = {
|
|
8169
|
+
zero: 0,
|
|
8170
|
+
one: 1,
|
|
8171
|
+
two: 2,
|
|
8172
|
+
few: 3,
|
|
8173
|
+
many: 4,
|
|
8174
|
+
other: 5
|
|
8175
|
+
};
|
|
8176
|
+
const dummyRule = {
|
|
8177
|
+
select: count => count === 1 ? 'one' : 'other',
|
|
8178
|
+
resolvedOptions: () => ({
|
|
8179
|
+
pluralCategories: ['one', 'other']
|
|
8180
|
+
})
|
|
8181
|
+
};
|
|
8182
|
+
class PluralResolver {
|
|
8183
|
+
constructor(languageUtils, options = {}) {
|
|
8184
|
+
this.languageUtils = languageUtils;
|
|
8185
|
+
this.options = options;
|
|
8186
|
+
this.logger = baseLogger.create('pluralResolver');
|
|
8187
|
+
this.pluralRulesCache = {};
|
|
8188
|
+
}
|
|
8189
|
+
addRule(lng, obj) {
|
|
8190
|
+
this.rules[lng] = obj;
|
|
8191
|
+
}
|
|
8192
|
+
clearCache() {
|
|
8193
|
+
this.pluralRulesCache = {};
|
|
8194
|
+
}
|
|
8195
|
+
getRule(code, options = {}) {
|
|
8196
|
+
const cleanedCode = getCleanedCode(code === 'dev' ? 'en' : code);
|
|
8197
|
+
const type = options.ordinal ? 'ordinal' : 'cardinal';
|
|
8198
|
+
const cacheKey = JSON.stringify({
|
|
8199
|
+
cleanedCode,
|
|
8200
|
+
type
|
|
8201
|
+
});
|
|
8202
|
+
if (cacheKey in this.pluralRulesCache) {
|
|
8203
|
+
return this.pluralRulesCache[cacheKey];
|
|
8204
|
+
}
|
|
8205
|
+
let rule;
|
|
8206
|
+
try {
|
|
8207
|
+
rule = new Intl.PluralRules(cleanedCode, {
|
|
8208
|
+
type
|
|
8209
|
+
});
|
|
8210
|
+
} catch (err) {
|
|
8211
|
+
if (!Intl) {
|
|
8212
|
+
this.logger.error('No Intl support, please use an Intl polyfill!');
|
|
8213
|
+
return dummyRule;
|
|
8214
|
+
}
|
|
8215
|
+
if (!code.match(/-|_/)) return dummyRule;
|
|
8216
|
+
const lngPart = this.languageUtils.getLanguagePartFromCode(code);
|
|
8217
|
+
rule = this.getRule(lngPart, options);
|
|
8218
|
+
}
|
|
8219
|
+
this.pluralRulesCache[cacheKey] = rule;
|
|
8220
|
+
return rule;
|
|
8221
|
+
}
|
|
8222
|
+
needsPlural(code, options = {}) {
|
|
8223
|
+
let rule = this.getRule(code, options);
|
|
8224
|
+
if (!rule) rule = this.getRule('dev', options);
|
|
8225
|
+
return rule?.resolvedOptions().pluralCategories.length > 1;
|
|
8226
|
+
}
|
|
8227
|
+
getPluralFormsOfKey(code, key, options = {}) {
|
|
8228
|
+
return this.getSuffixes(code, options).map(suffix => `${key}${suffix}`);
|
|
8229
|
+
}
|
|
8230
|
+
getSuffixes(code, options = {}) {
|
|
8231
|
+
let rule = this.getRule(code, options);
|
|
8232
|
+
if (!rule) rule = this.getRule('dev', options);
|
|
8233
|
+
if (!rule) return [];
|
|
8234
|
+
return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map(pluralCategory => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${pluralCategory}`);
|
|
8235
|
+
}
|
|
8236
|
+
getSuffix(code, count, options = {}) {
|
|
8237
|
+
const rule = this.getRule(code, options);
|
|
8238
|
+
if (rule) {
|
|
8239
|
+
return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${rule.select(count)}`;
|
|
8240
|
+
}
|
|
8241
|
+
this.logger.warn(`no plural rule found for: ${code}`);
|
|
8242
|
+
return this.getSuffix('dev', count, options);
|
|
8243
|
+
}
|
|
8244
|
+
}
|
|
8245
|
+
|
|
8246
|
+
const deepFindWithDefaults = (data, defaultData, key, keySeparator = '.', ignoreJSONStructure = true) => {
|
|
8247
|
+
let path = getPathWithDefaults(data, defaultData, key);
|
|
8248
|
+
if (!path && ignoreJSONStructure && isString(key)) {
|
|
8249
|
+
path = deepFind(data, key, keySeparator);
|
|
8250
|
+
if (path === undefined) path = deepFind(defaultData, key, keySeparator);
|
|
8251
|
+
}
|
|
8252
|
+
return path;
|
|
8253
|
+
};
|
|
8254
|
+
const regexSafe = val => val.replace(/\$/g, '$$$$');
|
|
8255
|
+
class Interpolator {
|
|
8256
|
+
constructor(options = {}) {
|
|
8257
|
+
this.logger = baseLogger.create('interpolator');
|
|
8258
|
+
this.options = options;
|
|
8259
|
+
this.format = options?.interpolation?.format || (value => value);
|
|
8260
|
+
this.init(options);
|
|
8261
|
+
}
|
|
8262
|
+
init(options = {}) {
|
|
8263
|
+
if (!options.interpolation) options.interpolation = {
|
|
8264
|
+
escapeValue: true
|
|
8265
|
+
};
|
|
8266
|
+
const {
|
|
8267
|
+
escape: escape$1,
|
|
8268
|
+
escapeValue,
|
|
8269
|
+
useRawValueToEscape,
|
|
8270
|
+
prefix,
|
|
8271
|
+
prefixEscaped,
|
|
8272
|
+
suffix,
|
|
8273
|
+
suffixEscaped,
|
|
8274
|
+
formatSeparator,
|
|
8275
|
+
unescapeSuffix,
|
|
8276
|
+
unescapePrefix,
|
|
8277
|
+
nestingPrefix,
|
|
8278
|
+
nestingPrefixEscaped,
|
|
8279
|
+
nestingSuffix,
|
|
8280
|
+
nestingSuffixEscaped,
|
|
8281
|
+
nestingOptionsSeparator,
|
|
8282
|
+
maxReplaces,
|
|
8283
|
+
alwaysFormat
|
|
8284
|
+
} = options.interpolation;
|
|
8285
|
+
this.escape = escape$1 !== undefined ? escape$1 : escape;
|
|
8286
|
+
this.escapeValue = escapeValue !== undefined ? escapeValue : true;
|
|
8287
|
+
this.useRawValueToEscape = useRawValueToEscape !== undefined ? useRawValueToEscape : false;
|
|
8288
|
+
this.prefix = prefix ? regexEscape(prefix) : prefixEscaped || '{{';
|
|
8289
|
+
this.suffix = suffix ? regexEscape(suffix) : suffixEscaped || '}}';
|
|
8290
|
+
this.formatSeparator = formatSeparator || ',';
|
|
8291
|
+
this.unescapePrefix = unescapeSuffix ? '' : unescapePrefix || '-';
|
|
8292
|
+
this.unescapeSuffix = this.unescapePrefix ? '' : unescapeSuffix || '';
|
|
8293
|
+
this.nestingPrefix = nestingPrefix ? regexEscape(nestingPrefix) : nestingPrefixEscaped || regexEscape('$t(');
|
|
8294
|
+
this.nestingSuffix = nestingSuffix ? regexEscape(nestingSuffix) : nestingSuffixEscaped || regexEscape(')');
|
|
8295
|
+
this.nestingOptionsSeparator = nestingOptionsSeparator || ',';
|
|
8296
|
+
this.maxReplaces = maxReplaces || 1000;
|
|
8297
|
+
this.alwaysFormat = alwaysFormat !== undefined ? alwaysFormat : false;
|
|
8298
|
+
this.resetRegExp();
|
|
8299
|
+
}
|
|
8300
|
+
reset() {
|
|
8301
|
+
if (this.options) this.init(this.options);
|
|
8302
|
+
}
|
|
8303
|
+
resetRegExp() {
|
|
8304
|
+
const getOrResetRegExp = (existingRegExp, pattern) => {
|
|
8305
|
+
if (existingRegExp?.source === pattern) {
|
|
8306
|
+
existingRegExp.lastIndex = 0;
|
|
8307
|
+
return existingRegExp;
|
|
8308
|
+
}
|
|
8309
|
+
return new RegExp(pattern, 'g');
|
|
8310
|
+
};
|
|
8311
|
+
this.regexp = getOrResetRegExp(this.regexp, `${this.prefix}(.+?)${this.suffix}`);
|
|
8312
|
+
this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);
|
|
8313
|
+
this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
|
|
8314
|
+
}
|
|
8315
|
+
interpolate(str, data, lng, options) {
|
|
8316
|
+
let match;
|
|
8317
|
+
let value;
|
|
8318
|
+
let replaces;
|
|
8319
|
+
const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
|
|
8320
|
+
const handleFormat = key => {
|
|
8321
|
+
if (key.indexOf(this.formatSeparator) < 0) {
|
|
8322
|
+
const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
8323
|
+
return this.alwaysFormat ? this.format(path, undefined, lng, {
|
|
8324
|
+
...options,
|
|
8325
|
+
...data,
|
|
8326
|
+
interpolationkey: key
|
|
8327
|
+
}) : path;
|
|
8328
|
+
}
|
|
8329
|
+
const p = key.split(this.formatSeparator);
|
|
8330
|
+
const k = p.shift().trim();
|
|
8331
|
+
const f = p.join(this.formatSeparator).trim();
|
|
8332
|
+
return this.format(deepFindWithDefaults(data, defaultData, k, this.options.keySeparator, this.options.ignoreJSONStructure), f, lng, {
|
|
8333
|
+
...options,
|
|
8334
|
+
...data,
|
|
8335
|
+
interpolationkey: k
|
|
8336
|
+
});
|
|
8337
|
+
};
|
|
8338
|
+
this.resetRegExp();
|
|
8339
|
+
const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
|
|
8340
|
+
const skipOnVariables = options?.interpolation?.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
8341
|
+
const todos = [{
|
|
8342
|
+
regex: this.regexpUnescape,
|
|
8343
|
+
safeValue: val => regexSafe(val)
|
|
8344
|
+
}, {
|
|
8345
|
+
regex: this.regexp,
|
|
8346
|
+
safeValue: val => this.escapeValue ? regexSafe(this.escape(val)) : regexSafe(val)
|
|
8347
|
+
}];
|
|
8348
|
+
todos.forEach(todo => {
|
|
8349
|
+
replaces = 0;
|
|
8350
|
+
while (match = todo.regex.exec(str)) {
|
|
8351
|
+
const matchedVar = match[1].trim();
|
|
8352
|
+
value = handleFormat(matchedVar);
|
|
8353
|
+
if (value === undefined) {
|
|
8354
|
+
if (typeof missingInterpolationHandler === 'function') {
|
|
8355
|
+
const temp = missingInterpolationHandler(str, match, options);
|
|
8356
|
+
value = isString(temp) ? temp : '';
|
|
8357
|
+
} else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
|
|
8358
|
+
value = '';
|
|
8359
|
+
} else if (skipOnVariables) {
|
|
8360
|
+
value = match[0];
|
|
8361
|
+
continue;
|
|
8362
|
+
} else {
|
|
8363
|
+
this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);
|
|
8364
|
+
value = '';
|
|
8365
|
+
}
|
|
8366
|
+
} else if (!isString(value) && !this.useRawValueToEscape) {
|
|
8367
|
+
value = makeString(value);
|
|
8368
|
+
}
|
|
8369
|
+
const safeValue = todo.safeValue(value);
|
|
8370
|
+
str = str.replace(match[0], safeValue);
|
|
8371
|
+
if (skipOnVariables) {
|
|
8372
|
+
todo.regex.lastIndex += value.length;
|
|
8373
|
+
todo.regex.lastIndex -= match[0].length;
|
|
8374
|
+
} else {
|
|
8375
|
+
todo.regex.lastIndex = 0;
|
|
8376
|
+
}
|
|
8377
|
+
replaces++;
|
|
8378
|
+
if (replaces >= this.maxReplaces) {
|
|
8379
|
+
break;
|
|
8380
|
+
}
|
|
8381
|
+
}
|
|
8382
|
+
});
|
|
8383
|
+
return str;
|
|
8384
|
+
}
|
|
8385
|
+
nest(str, fc, options = {}) {
|
|
8386
|
+
let match;
|
|
8387
|
+
let value;
|
|
8388
|
+
let clonedOptions;
|
|
8389
|
+
const handleHasOptions = (key, inheritedOptions) => {
|
|
8390
|
+
const sep = this.nestingOptionsSeparator;
|
|
8391
|
+
if (key.indexOf(sep) < 0) return key;
|
|
8392
|
+
const c = key.split(new RegExp(`${sep}[ ]*{`));
|
|
8393
|
+
let optionsString = `{${c[1]}`;
|
|
8394
|
+
key = c[0];
|
|
8395
|
+
optionsString = this.interpolate(optionsString, clonedOptions);
|
|
8396
|
+
const matchedSingleQuotes = optionsString.match(/'/g);
|
|
8397
|
+
const matchedDoubleQuotes = optionsString.match(/"/g);
|
|
8398
|
+
if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
|
|
8399
|
+
optionsString = optionsString.replace(/'/g, '"');
|
|
8400
|
+
}
|
|
8401
|
+
try {
|
|
8402
|
+
clonedOptions = JSON.parse(optionsString);
|
|
8403
|
+
if (inheritedOptions) clonedOptions = {
|
|
8404
|
+
...inheritedOptions,
|
|
8405
|
+
...clonedOptions
|
|
8406
|
+
};
|
|
8407
|
+
} catch (e) {
|
|
8408
|
+
this.logger.warn(`failed parsing options string in nesting for key ${key}`, e);
|
|
8409
|
+
return `${key}${sep}${optionsString}`;
|
|
8410
|
+
}
|
|
8411
|
+
if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1) delete clonedOptions.defaultValue;
|
|
8412
|
+
return key;
|
|
8413
|
+
};
|
|
8414
|
+
while (match = this.nestingRegexp.exec(str)) {
|
|
8415
|
+
let formatters = [];
|
|
8416
|
+
clonedOptions = {
|
|
8417
|
+
...options
|
|
8418
|
+
};
|
|
8419
|
+
clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
|
|
8420
|
+
clonedOptions.applyPostProcessor = false;
|
|
8421
|
+
delete clonedOptions.defaultValue;
|
|
8422
|
+
const keyEndIndex = /{.*}/.test(match[1]) ? match[1].lastIndexOf('}') + 1 : match[1].indexOf(this.formatSeparator);
|
|
8423
|
+
if (keyEndIndex !== -1) {
|
|
8424
|
+
formatters = match[1].slice(keyEndIndex).split(this.formatSeparator).map(elem => elem.trim()).filter(Boolean);
|
|
8425
|
+
match[1] = match[1].slice(0, keyEndIndex);
|
|
8426
|
+
}
|
|
8427
|
+
value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
|
|
8428
|
+
if (value && match[0] === str && !isString(value)) return value;
|
|
8429
|
+
if (!isString(value)) value = makeString(value);
|
|
8430
|
+
if (!value) {
|
|
8431
|
+
this.logger.warn(`missed to resolve ${match[1]} for nesting ${str}`);
|
|
8432
|
+
value = '';
|
|
8433
|
+
}
|
|
8434
|
+
if (formatters.length) {
|
|
8435
|
+
value = formatters.reduce((v, f) => this.format(v, f, options.lng, {
|
|
8436
|
+
...options,
|
|
8437
|
+
interpolationkey: match[1].trim()
|
|
8438
|
+
}), value.trim());
|
|
8439
|
+
}
|
|
8440
|
+
str = str.replace(match[0], value);
|
|
8441
|
+
this.regexp.lastIndex = 0;
|
|
8442
|
+
}
|
|
8443
|
+
return str;
|
|
8444
|
+
}
|
|
8445
|
+
}
|
|
8446
|
+
|
|
8447
|
+
const parseFormatStr = formatStr => {
|
|
8448
|
+
let formatName = formatStr.toLowerCase().trim();
|
|
8449
|
+
const formatOptions = {};
|
|
8450
|
+
if (formatStr.indexOf('(') > -1) {
|
|
8451
|
+
const p = formatStr.split('(');
|
|
8452
|
+
formatName = p[0].toLowerCase().trim();
|
|
8453
|
+
const optStr = p[1].substring(0, p[1].length - 1);
|
|
8454
|
+
if (formatName === 'currency' && optStr.indexOf(':') < 0) {
|
|
8455
|
+
if (!formatOptions.currency) formatOptions.currency = optStr.trim();
|
|
8456
|
+
} else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {
|
|
8457
|
+
if (!formatOptions.range) formatOptions.range = optStr.trim();
|
|
8458
|
+
} else {
|
|
8459
|
+
const opts = optStr.split(';');
|
|
8460
|
+
opts.forEach(opt => {
|
|
8461
|
+
if (opt) {
|
|
8462
|
+
const [key, ...rest] = opt.split(':');
|
|
8463
|
+
const val = rest.join(':').trim().replace(/^'+|'+$/g, '');
|
|
8464
|
+
const trimmedKey = key.trim();
|
|
8465
|
+
if (!formatOptions[trimmedKey]) formatOptions[trimmedKey] = val;
|
|
8466
|
+
if (val === 'false') formatOptions[trimmedKey] = false;
|
|
8467
|
+
if (val === 'true') formatOptions[trimmedKey] = true;
|
|
8468
|
+
if (!isNaN(val)) formatOptions[trimmedKey] = parseInt(val, 10);
|
|
8469
|
+
}
|
|
8470
|
+
});
|
|
8471
|
+
}
|
|
8472
|
+
}
|
|
8473
|
+
return {
|
|
8474
|
+
formatName,
|
|
8475
|
+
formatOptions
|
|
8476
|
+
};
|
|
8477
|
+
};
|
|
8478
|
+
const createCachedFormatter = fn => {
|
|
8479
|
+
const cache = {};
|
|
8480
|
+
return (v, l, o) => {
|
|
8481
|
+
let optForCache = o;
|
|
8482
|
+
if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) {
|
|
8483
|
+
optForCache = {
|
|
8484
|
+
...optForCache,
|
|
8485
|
+
[o.interpolationkey]: undefined
|
|
8486
|
+
};
|
|
8487
|
+
}
|
|
8488
|
+
const key = l + JSON.stringify(optForCache);
|
|
8489
|
+
let frm = cache[key];
|
|
8490
|
+
if (!frm) {
|
|
8491
|
+
frm = fn(getCleanedCode(l), o);
|
|
8492
|
+
cache[key] = frm;
|
|
8493
|
+
}
|
|
8494
|
+
return frm(v);
|
|
8495
|
+
};
|
|
8496
|
+
};
|
|
8497
|
+
const createNonCachedFormatter = fn => (v, l, o) => fn(getCleanedCode(l), o)(v);
|
|
8498
|
+
class Formatter {
|
|
8499
|
+
constructor(options = {}) {
|
|
8500
|
+
this.logger = baseLogger.create('formatter');
|
|
8501
|
+
this.options = options;
|
|
8502
|
+
this.init(options);
|
|
8503
|
+
}
|
|
8504
|
+
init(services, options = {
|
|
8505
|
+
interpolation: {}
|
|
8506
|
+
}) {
|
|
8507
|
+
this.formatSeparator = options.interpolation.formatSeparator || ',';
|
|
8508
|
+
const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
|
|
8509
|
+
this.formats = {
|
|
8510
|
+
number: cf((lng, opt) => {
|
|
8511
|
+
const formatter = new Intl.NumberFormat(lng, {
|
|
8512
|
+
...opt
|
|
8513
|
+
});
|
|
8514
|
+
return val => formatter.format(val);
|
|
8515
|
+
}),
|
|
8516
|
+
currency: cf((lng, opt) => {
|
|
8517
|
+
const formatter = new Intl.NumberFormat(lng, {
|
|
8518
|
+
...opt,
|
|
8519
|
+
style: 'currency'
|
|
8520
|
+
});
|
|
8521
|
+
return val => formatter.format(val);
|
|
8522
|
+
}),
|
|
8523
|
+
datetime: cf((lng, opt) => {
|
|
8524
|
+
const formatter = new Intl.DateTimeFormat(lng, {
|
|
8525
|
+
...opt
|
|
8526
|
+
});
|
|
8527
|
+
return val => formatter.format(val);
|
|
8528
|
+
}),
|
|
8529
|
+
relativetime: cf((lng, opt) => {
|
|
8530
|
+
const formatter = new Intl.RelativeTimeFormat(lng, {
|
|
8531
|
+
...opt
|
|
8532
|
+
});
|
|
8533
|
+
return val => formatter.format(val, opt.range || 'day');
|
|
8534
|
+
}),
|
|
8535
|
+
list: cf((lng, opt) => {
|
|
8536
|
+
const formatter = new Intl.ListFormat(lng, {
|
|
8537
|
+
...opt
|
|
8538
|
+
});
|
|
8539
|
+
return val => formatter.format(val);
|
|
8540
|
+
})
|
|
8541
|
+
};
|
|
8542
|
+
}
|
|
8543
|
+
add(name, fc) {
|
|
8544
|
+
this.formats[name.toLowerCase().trim()] = fc;
|
|
8545
|
+
}
|
|
8546
|
+
addCached(name, fc) {
|
|
8547
|
+
this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
|
|
8548
|
+
}
|
|
8549
|
+
format(value, format, lng, options = {}) {
|
|
8550
|
+
const formats = format.split(this.formatSeparator);
|
|
8551
|
+
if (formats.length > 1 && formats[0].indexOf('(') > 1 && formats[0].indexOf(')') < 0 && formats.find(f => f.indexOf(')') > -1)) {
|
|
8552
|
+
const lastIndex = formats.findIndex(f => f.indexOf(')') > -1);
|
|
8553
|
+
formats[0] = [formats[0], ...formats.splice(1, lastIndex)].join(this.formatSeparator);
|
|
8554
|
+
}
|
|
8555
|
+
const result = formats.reduce((mem, f) => {
|
|
8556
|
+
const {
|
|
8557
|
+
formatName,
|
|
8558
|
+
formatOptions
|
|
8559
|
+
} = parseFormatStr(f);
|
|
8560
|
+
if (this.formats[formatName]) {
|
|
8561
|
+
let formatted = mem;
|
|
8562
|
+
try {
|
|
8563
|
+
const valOptions = options?.formatParams?.[options.interpolationkey] || {};
|
|
8564
|
+
const l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
|
|
8565
|
+
formatted = this.formats[formatName](mem, l, {
|
|
8566
|
+
...formatOptions,
|
|
8567
|
+
...options,
|
|
8568
|
+
...valOptions
|
|
8569
|
+
});
|
|
8570
|
+
} catch (error) {
|
|
8571
|
+
this.logger.warn(error);
|
|
8572
|
+
}
|
|
8573
|
+
return formatted;
|
|
8574
|
+
} else {
|
|
8575
|
+
this.logger.warn(`there was no format function for ${formatName}`);
|
|
8576
|
+
}
|
|
8577
|
+
return mem;
|
|
8578
|
+
}, value);
|
|
8579
|
+
return result;
|
|
8580
|
+
}
|
|
8581
|
+
}
|
|
8582
|
+
|
|
8583
|
+
const removePending = (q, name) => {
|
|
8584
|
+
if (q.pending[name] !== undefined) {
|
|
8585
|
+
delete q.pending[name];
|
|
8586
|
+
q.pendingCount--;
|
|
8587
|
+
}
|
|
8588
|
+
};
|
|
8589
|
+
class Connector extends EventEmitter {
|
|
8590
|
+
constructor(backend, store, services, options = {}) {
|
|
8591
|
+
super();
|
|
8592
|
+
this.backend = backend;
|
|
8593
|
+
this.store = store;
|
|
8594
|
+
this.services = services;
|
|
8595
|
+
this.languageUtils = services.languageUtils;
|
|
8596
|
+
this.options = options;
|
|
8597
|
+
this.logger = baseLogger.create('backendConnector');
|
|
8598
|
+
this.waitingReads = [];
|
|
8599
|
+
this.maxParallelReads = options.maxParallelReads || 10;
|
|
8600
|
+
this.readingCalls = 0;
|
|
8601
|
+
this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
|
|
8602
|
+
this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
|
|
8603
|
+
this.state = {};
|
|
8604
|
+
this.queue = [];
|
|
8605
|
+
this.backend?.init?.(services, options.backend, options);
|
|
8606
|
+
}
|
|
8607
|
+
queueLoad(languages, namespaces, options, callback) {
|
|
8608
|
+
const toLoad = {};
|
|
8609
|
+
const pending = {};
|
|
8610
|
+
const toLoadLanguages = {};
|
|
8611
|
+
const toLoadNamespaces = {};
|
|
8612
|
+
languages.forEach(lng => {
|
|
8613
|
+
let hasAllNamespaces = true;
|
|
8614
|
+
namespaces.forEach(ns => {
|
|
8615
|
+
const name = `${lng}|${ns}`;
|
|
8616
|
+
if (!options.reload && this.store.hasResourceBundle(lng, ns)) {
|
|
8617
|
+
this.state[name] = 2;
|
|
8618
|
+
} else if (this.state[name] < 0) ; else if (this.state[name] === 1) {
|
|
8619
|
+
if (pending[name] === undefined) pending[name] = true;
|
|
8620
|
+
} else {
|
|
8621
|
+
this.state[name] = 1;
|
|
8622
|
+
hasAllNamespaces = false;
|
|
8623
|
+
if (pending[name] === undefined) pending[name] = true;
|
|
8624
|
+
if (toLoad[name] === undefined) toLoad[name] = true;
|
|
8625
|
+
if (toLoadNamespaces[ns] === undefined) toLoadNamespaces[ns] = true;
|
|
8626
|
+
}
|
|
8627
|
+
});
|
|
8628
|
+
if (!hasAllNamespaces) toLoadLanguages[lng] = true;
|
|
8629
|
+
});
|
|
8630
|
+
if (Object.keys(toLoad).length || Object.keys(pending).length) {
|
|
8631
|
+
this.queue.push({
|
|
8632
|
+
pending,
|
|
8633
|
+
pendingCount: Object.keys(pending).length,
|
|
8634
|
+
loaded: {},
|
|
8635
|
+
errors: [],
|
|
8636
|
+
callback
|
|
8637
|
+
});
|
|
8638
|
+
}
|
|
8639
|
+
return {
|
|
8640
|
+
toLoad: Object.keys(toLoad),
|
|
8641
|
+
pending: Object.keys(pending),
|
|
8642
|
+
toLoadLanguages: Object.keys(toLoadLanguages),
|
|
8643
|
+
toLoadNamespaces: Object.keys(toLoadNamespaces)
|
|
8644
|
+
};
|
|
8645
|
+
}
|
|
8646
|
+
loaded(name, err, data) {
|
|
8647
|
+
const s = name.split('|');
|
|
8648
|
+
const lng = s[0];
|
|
8649
|
+
const ns = s[1];
|
|
8650
|
+
if (err) this.emit('failedLoading', lng, ns, err);
|
|
8651
|
+
if (!err && data) {
|
|
8652
|
+
this.store.addResourceBundle(lng, ns, data, undefined, undefined, {
|
|
8653
|
+
skipCopy: true
|
|
8654
|
+
});
|
|
8655
|
+
}
|
|
8656
|
+
this.state[name] = err ? -1 : 2;
|
|
8657
|
+
if (err && data) this.state[name] = 0;
|
|
8658
|
+
const loaded = {};
|
|
8659
|
+
this.queue.forEach(q => {
|
|
8660
|
+
pushPath(q.loaded, [lng], ns);
|
|
8661
|
+
removePending(q, name);
|
|
8662
|
+
if (err) q.errors.push(err);
|
|
8663
|
+
if (q.pendingCount === 0 && !q.done) {
|
|
8664
|
+
Object.keys(q.loaded).forEach(l => {
|
|
8665
|
+
if (!loaded[l]) loaded[l] = {};
|
|
8666
|
+
const loadedKeys = q.loaded[l];
|
|
8667
|
+
if (loadedKeys.length) {
|
|
8668
|
+
loadedKeys.forEach(n => {
|
|
8669
|
+
if (loaded[l][n] === undefined) loaded[l][n] = true;
|
|
8670
|
+
});
|
|
8671
|
+
}
|
|
8672
|
+
});
|
|
8673
|
+
q.done = true;
|
|
8674
|
+
if (q.errors.length) {
|
|
8675
|
+
q.callback(q.errors);
|
|
8676
|
+
} else {
|
|
8677
|
+
q.callback();
|
|
8678
|
+
}
|
|
8679
|
+
}
|
|
8680
|
+
});
|
|
8681
|
+
this.emit('loaded', loaded);
|
|
8682
|
+
this.queue = this.queue.filter(q => !q.done);
|
|
8683
|
+
}
|
|
8684
|
+
read(lng, ns, fcName, tried = 0, wait = this.retryTimeout, callback) {
|
|
8685
|
+
if (!lng.length) return callback(null, {});
|
|
8686
|
+
if (this.readingCalls >= this.maxParallelReads) {
|
|
8687
|
+
this.waitingReads.push({
|
|
8688
|
+
lng,
|
|
8689
|
+
ns,
|
|
8690
|
+
fcName,
|
|
8691
|
+
tried,
|
|
8692
|
+
wait,
|
|
8693
|
+
callback
|
|
8694
|
+
});
|
|
8695
|
+
return;
|
|
8696
|
+
}
|
|
8697
|
+
this.readingCalls++;
|
|
8698
|
+
const resolver = (err, data) => {
|
|
8699
|
+
this.readingCalls--;
|
|
8700
|
+
if (this.waitingReads.length > 0) {
|
|
8701
|
+
const next = this.waitingReads.shift();
|
|
8702
|
+
this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
|
|
8703
|
+
}
|
|
8704
|
+
if (err && data && tried < this.maxRetries) {
|
|
8705
|
+
setTimeout(() => {
|
|
8706
|
+
this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
|
|
8707
|
+
}, wait);
|
|
8708
|
+
return;
|
|
8709
|
+
}
|
|
8710
|
+
callback(err, data);
|
|
8711
|
+
};
|
|
8712
|
+
const fc = this.backend[fcName].bind(this.backend);
|
|
8713
|
+
if (fc.length === 2) {
|
|
8714
|
+
try {
|
|
8715
|
+
const r = fc(lng, ns);
|
|
8716
|
+
if (r && typeof r.then === 'function') {
|
|
8717
|
+
r.then(data => resolver(null, data)).catch(resolver);
|
|
8718
|
+
} else {
|
|
8719
|
+
resolver(null, r);
|
|
8720
|
+
}
|
|
8721
|
+
} catch (err) {
|
|
8722
|
+
resolver(err);
|
|
8723
|
+
}
|
|
8724
|
+
return;
|
|
8725
|
+
}
|
|
8726
|
+
return fc(lng, ns, resolver);
|
|
8727
|
+
}
|
|
8728
|
+
prepareLoading(languages, namespaces, options = {}, callback) {
|
|
8729
|
+
if (!this.backend) {
|
|
8730
|
+
this.logger.warn('No backend was added via i18next.use. Will not load resources.');
|
|
8731
|
+
return callback && callback();
|
|
8732
|
+
}
|
|
8733
|
+
if (isString(languages)) languages = this.languageUtils.toResolveHierarchy(languages);
|
|
8734
|
+
if (isString(namespaces)) namespaces = [namespaces];
|
|
8735
|
+
const toLoad = this.queueLoad(languages, namespaces, options, callback);
|
|
8736
|
+
if (!toLoad.toLoad.length) {
|
|
8737
|
+
if (!toLoad.pending.length) callback();
|
|
8738
|
+
return null;
|
|
8739
|
+
}
|
|
8740
|
+
toLoad.toLoad.forEach(name => {
|
|
8741
|
+
this.loadOne(name);
|
|
8742
|
+
});
|
|
8743
|
+
}
|
|
8744
|
+
load(languages, namespaces, callback) {
|
|
8745
|
+
this.prepareLoading(languages, namespaces, {}, callback);
|
|
8746
|
+
}
|
|
8747
|
+
reload(languages, namespaces, callback) {
|
|
8748
|
+
this.prepareLoading(languages, namespaces, {
|
|
8749
|
+
reload: true
|
|
8750
|
+
}, callback);
|
|
8751
|
+
}
|
|
8752
|
+
loadOne(name, prefix = '') {
|
|
8753
|
+
const s = name.split('|');
|
|
8754
|
+
const lng = s[0];
|
|
8755
|
+
const ns = s[1];
|
|
8756
|
+
this.read(lng, ns, 'read', undefined, undefined, (err, data) => {
|
|
8757
|
+
if (err) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err);
|
|
8758
|
+
if (!err && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);
|
|
8759
|
+
this.loaded(name, err, data);
|
|
8760
|
+
});
|
|
8761
|
+
}
|
|
8762
|
+
saveMissing(languages, namespace, key, fallbackValue, isUpdate, options = {}, clb = () => {}) {
|
|
8763
|
+
if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {
|
|
8764
|
+
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!!!');
|
|
8765
|
+
return;
|
|
8766
|
+
}
|
|
8767
|
+
if (key === undefined || key === null || key === '') return;
|
|
8768
|
+
if (this.backend?.create) {
|
|
8769
|
+
const opts = {
|
|
8770
|
+
...options,
|
|
8771
|
+
isUpdate
|
|
8772
|
+
};
|
|
8773
|
+
const fc = this.backend.create.bind(this.backend);
|
|
8774
|
+
if (fc.length < 6) {
|
|
8775
|
+
try {
|
|
8776
|
+
let r;
|
|
8777
|
+
if (fc.length === 5) {
|
|
8778
|
+
r = fc(languages, namespace, key, fallbackValue, opts);
|
|
8779
|
+
} else {
|
|
8780
|
+
r = fc(languages, namespace, key, fallbackValue);
|
|
8781
|
+
}
|
|
8782
|
+
if (r && typeof r.then === 'function') {
|
|
8783
|
+
r.then(data => clb(null, data)).catch(clb);
|
|
8784
|
+
} else {
|
|
8785
|
+
clb(null, r);
|
|
8786
|
+
}
|
|
8787
|
+
} catch (err) {
|
|
8788
|
+
clb(err);
|
|
8789
|
+
}
|
|
8790
|
+
} else {
|
|
8791
|
+
fc(languages, namespace, key, fallbackValue, clb, opts);
|
|
8792
|
+
}
|
|
8793
|
+
}
|
|
8794
|
+
if (!languages || !languages[0]) return;
|
|
8795
|
+
this.store.addResource(languages[0], namespace, key, fallbackValue);
|
|
8796
|
+
}
|
|
8797
|
+
}
|
|
8798
|
+
|
|
8799
|
+
const get = () => ({
|
|
8800
|
+
debug: false,
|
|
8801
|
+
initAsync: true,
|
|
8802
|
+
ns: ['translation'],
|
|
8803
|
+
defaultNS: ['translation'],
|
|
8804
|
+
fallbackLng: ['dev'],
|
|
8805
|
+
fallbackNS: false,
|
|
8806
|
+
supportedLngs: false,
|
|
8807
|
+
nonExplicitSupportedLngs: false,
|
|
8808
|
+
load: 'all',
|
|
8809
|
+
preload: false,
|
|
8810
|
+
simplifyPluralSuffix: true,
|
|
8811
|
+
keySeparator: '.',
|
|
8812
|
+
nsSeparator: ':',
|
|
8813
|
+
pluralSeparator: '_',
|
|
8814
|
+
contextSeparator: '_',
|
|
8815
|
+
partialBundledLanguages: false,
|
|
8816
|
+
saveMissing: false,
|
|
8817
|
+
updateMissing: false,
|
|
8818
|
+
saveMissingTo: 'fallback',
|
|
8819
|
+
saveMissingPlurals: true,
|
|
8820
|
+
missingKeyHandler: false,
|
|
8821
|
+
missingInterpolationHandler: false,
|
|
8822
|
+
postProcess: false,
|
|
8823
|
+
postProcessPassResolved: false,
|
|
8824
|
+
returnNull: false,
|
|
8825
|
+
returnEmptyString: true,
|
|
8826
|
+
returnObjects: false,
|
|
8827
|
+
joinArrays: false,
|
|
8828
|
+
returnedObjectHandler: false,
|
|
8829
|
+
parseMissingKeyHandler: false,
|
|
8830
|
+
appendNamespaceToMissingKey: false,
|
|
8831
|
+
appendNamespaceToCIMode: false,
|
|
8832
|
+
overloadTranslationOptionHandler: args => {
|
|
8833
|
+
let ret = {};
|
|
8834
|
+
if (typeof args[1] === 'object') ret = args[1];
|
|
8835
|
+
if (isString(args[1])) ret.defaultValue = args[1];
|
|
8836
|
+
if (isString(args[2])) ret.tDescription = args[2];
|
|
8837
|
+
if (typeof args[2] === 'object' || typeof args[3] === 'object') {
|
|
8838
|
+
const options = args[3] || args[2];
|
|
8839
|
+
Object.keys(options).forEach(key => {
|
|
8840
|
+
ret[key] = options[key];
|
|
8841
|
+
});
|
|
8842
|
+
}
|
|
8843
|
+
return ret;
|
|
8844
|
+
},
|
|
8845
|
+
interpolation: {
|
|
8846
|
+
escapeValue: true,
|
|
8847
|
+
format: value => value,
|
|
8848
|
+
prefix: '{{',
|
|
8849
|
+
suffix: '}}',
|
|
8850
|
+
formatSeparator: ',',
|
|
8851
|
+
unescapePrefix: '-',
|
|
8852
|
+
nestingPrefix: '$t(',
|
|
8853
|
+
nestingSuffix: ')',
|
|
8854
|
+
nestingOptionsSeparator: ',',
|
|
8855
|
+
maxReplaces: 1000,
|
|
8856
|
+
skipOnVariables: true
|
|
8857
|
+
},
|
|
8858
|
+
cacheInBuiltFormats: true
|
|
8859
|
+
});
|
|
8860
|
+
const transformOptions = options => {
|
|
8861
|
+
if (isString(options.ns)) options.ns = [options.ns];
|
|
8862
|
+
if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
|
|
8863
|
+
if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
|
|
8864
|
+
if (options.supportedLngs?.indexOf?.('cimode') < 0) {
|
|
8865
|
+
options.supportedLngs = options.supportedLngs.concat(['cimode']);
|
|
8866
|
+
}
|
|
8867
|
+
if (typeof options.initImmediate === 'boolean') options.initAsync = options.initImmediate;
|
|
8868
|
+
return options;
|
|
8869
|
+
};
|
|
8870
|
+
|
|
8871
|
+
const noop = () => {};
|
|
8872
|
+
const bindMemberFunctions = inst => {
|
|
8873
|
+
const mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
|
|
8874
|
+
mems.forEach(mem => {
|
|
8875
|
+
if (typeof inst[mem] === 'function') {
|
|
8876
|
+
inst[mem] = inst[mem].bind(inst);
|
|
8877
|
+
}
|
|
8878
|
+
});
|
|
8879
|
+
};
|
|
8880
|
+
class I18n extends EventEmitter {
|
|
8881
|
+
constructor(options = {}, callback) {
|
|
8882
|
+
super();
|
|
8883
|
+
this.options = transformOptions(options);
|
|
8884
|
+
this.services = {};
|
|
8885
|
+
this.logger = baseLogger;
|
|
8886
|
+
this.modules = {
|
|
8887
|
+
external: []
|
|
8888
|
+
};
|
|
8889
|
+
bindMemberFunctions(this);
|
|
8890
|
+
if (callback && !this.isInitialized && !options.isClone) {
|
|
8891
|
+
if (!this.options.initAsync) {
|
|
8892
|
+
this.init(options, callback);
|
|
8893
|
+
return this;
|
|
8894
|
+
}
|
|
8895
|
+
setTimeout(() => {
|
|
8896
|
+
this.init(options, callback);
|
|
8897
|
+
}, 0);
|
|
8898
|
+
}
|
|
8899
|
+
}
|
|
8900
|
+
init(options = {}, callback) {
|
|
8901
|
+
this.isInitializing = true;
|
|
8902
|
+
if (typeof options === 'function') {
|
|
8903
|
+
callback = options;
|
|
8904
|
+
options = {};
|
|
8905
|
+
}
|
|
8906
|
+
if (options.defaultNS == null && options.ns) {
|
|
8907
|
+
if (isString(options.ns)) {
|
|
8908
|
+
options.defaultNS = options.ns;
|
|
8909
|
+
} else if (options.ns.indexOf('translation') < 0) {
|
|
8910
|
+
options.defaultNS = options.ns[0];
|
|
8911
|
+
}
|
|
8912
|
+
}
|
|
8913
|
+
const defOpts = get();
|
|
8914
|
+
this.options = {
|
|
8915
|
+
...defOpts,
|
|
8916
|
+
...this.options,
|
|
8917
|
+
...transformOptions(options)
|
|
8918
|
+
};
|
|
8919
|
+
this.options.interpolation = {
|
|
8920
|
+
...defOpts.interpolation,
|
|
8921
|
+
...this.options.interpolation
|
|
8922
|
+
};
|
|
8923
|
+
if (options.keySeparator !== undefined) {
|
|
8924
|
+
this.options.userDefinedKeySeparator = options.keySeparator;
|
|
8925
|
+
}
|
|
8926
|
+
if (options.nsSeparator !== undefined) {
|
|
8927
|
+
this.options.userDefinedNsSeparator = options.nsSeparator;
|
|
8928
|
+
}
|
|
8929
|
+
const createClassOnDemand = ClassOrObject => {
|
|
8930
|
+
if (!ClassOrObject) return null;
|
|
8931
|
+
if (typeof ClassOrObject === 'function') return new ClassOrObject();
|
|
8932
|
+
return ClassOrObject;
|
|
8933
|
+
};
|
|
8934
|
+
if (!this.options.isClone) {
|
|
8935
|
+
if (this.modules.logger) {
|
|
8936
|
+
baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
|
|
8937
|
+
} else {
|
|
8938
|
+
baseLogger.init(null, this.options);
|
|
8939
|
+
}
|
|
8940
|
+
let formatter;
|
|
8941
|
+
if (this.modules.formatter) {
|
|
8942
|
+
formatter = this.modules.formatter;
|
|
8943
|
+
} else {
|
|
8944
|
+
formatter = Formatter;
|
|
8945
|
+
}
|
|
8946
|
+
const lu = new LanguageUtil(this.options);
|
|
8947
|
+
this.store = new ResourceStore(this.options.resources, this.options);
|
|
8948
|
+
const s = this.services;
|
|
8949
|
+
s.logger = baseLogger;
|
|
8950
|
+
s.resourceStore = this.store;
|
|
8951
|
+
s.languageUtils = lu;
|
|
8952
|
+
s.pluralResolver = new PluralResolver(lu, {
|
|
8953
|
+
prepend: this.options.pluralSeparator,
|
|
8954
|
+
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
8955
|
+
});
|
|
8956
|
+
const usingLegacyFormatFunction = this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format;
|
|
8957
|
+
if (usingLegacyFormatFunction) {
|
|
8958
|
+
this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`);
|
|
8959
|
+
}
|
|
8960
|
+
if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
|
|
8961
|
+
s.formatter = createClassOnDemand(formatter);
|
|
8962
|
+
if (s.formatter.init) s.formatter.init(s, this.options);
|
|
8963
|
+
this.options.interpolation.format = s.formatter.format.bind(s.formatter);
|
|
8964
|
+
}
|
|
8965
|
+
s.interpolator = new Interpolator(this.options);
|
|
8966
|
+
s.utils = {
|
|
8967
|
+
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
8968
|
+
};
|
|
8969
|
+
s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
|
|
8970
|
+
s.backendConnector.on('*', (event, ...args) => {
|
|
8971
|
+
this.emit(event, ...args);
|
|
8972
|
+
});
|
|
8973
|
+
if (this.modules.languageDetector) {
|
|
8974
|
+
s.languageDetector = createClassOnDemand(this.modules.languageDetector);
|
|
8975
|
+
if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);
|
|
8976
|
+
}
|
|
8977
|
+
if (this.modules.i18nFormat) {
|
|
8978
|
+
s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
|
|
8979
|
+
if (s.i18nFormat.init) s.i18nFormat.init(this);
|
|
8980
|
+
}
|
|
8981
|
+
this.translator = new Translator(this.services, this.options);
|
|
8982
|
+
this.translator.on('*', (event, ...args) => {
|
|
8983
|
+
this.emit(event, ...args);
|
|
8984
|
+
});
|
|
8985
|
+
this.modules.external.forEach(m => {
|
|
8986
|
+
if (m.init) m.init(this);
|
|
8987
|
+
});
|
|
8988
|
+
}
|
|
8989
|
+
this.format = this.options.interpolation.format;
|
|
8990
|
+
if (!callback) callback = noop;
|
|
8991
|
+
if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
8992
|
+
const codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
8993
|
+
if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];
|
|
8994
|
+
}
|
|
8995
|
+
if (!this.services.languageDetector && !this.options.lng) {
|
|
8996
|
+
this.logger.warn('init: no languageDetector is used and no lng is defined');
|
|
8997
|
+
}
|
|
8998
|
+
const storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];
|
|
8999
|
+
storeApi.forEach(fcName => {
|
|
9000
|
+
this[fcName] = (...args) => this.store[fcName](...args);
|
|
9001
|
+
});
|
|
9002
|
+
const storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];
|
|
9003
|
+
storeApiChained.forEach(fcName => {
|
|
9004
|
+
this[fcName] = (...args) => {
|
|
9005
|
+
this.store[fcName](...args);
|
|
9006
|
+
return this;
|
|
9007
|
+
};
|
|
9008
|
+
});
|
|
9009
|
+
const deferred = defer();
|
|
9010
|
+
const load = () => {
|
|
9011
|
+
const finish = (err, t) => {
|
|
9012
|
+
this.isInitializing = false;
|
|
9013
|
+
if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn('init: i18next is already initialized. You should call init just once!');
|
|
9014
|
+
this.isInitialized = true;
|
|
9015
|
+
if (!this.options.isClone) this.logger.log('initialized', this.options);
|
|
9016
|
+
this.emit('initialized', this.options);
|
|
9017
|
+
deferred.resolve(t);
|
|
9018
|
+
callback(err, t);
|
|
9019
|
+
};
|
|
9020
|
+
if (this.languages && !this.isInitialized) return finish(null, this.t.bind(this));
|
|
9021
|
+
this.changeLanguage(this.options.lng, finish);
|
|
9022
|
+
};
|
|
9023
|
+
if (this.options.resources || !this.options.initAsync) {
|
|
9024
|
+
load();
|
|
9025
|
+
} else {
|
|
9026
|
+
setTimeout(load, 0);
|
|
9027
|
+
}
|
|
9028
|
+
return deferred;
|
|
9029
|
+
}
|
|
9030
|
+
loadResources(language, callback = noop) {
|
|
9031
|
+
let usedCallback = callback;
|
|
9032
|
+
const usedLng = isString(language) ? language : this.language;
|
|
9033
|
+
if (typeof language === 'function') usedCallback = language;
|
|
9034
|
+
if (!this.options.resources || this.options.partialBundledLanguages) {
|
|
9035
|
+
if (usedLng?.toLowerCase() === 'cimode' && (!this.options.preload || this.options.preload.length === 0)) return usedCallback();
|
|
9036
|
+
const toLoad = [];
|
|
9037
|
+
const append = lng => {
|
|
9038
|
+
if (!lng) return;
|
|
9039
|
+
if (lng === 'cimode') return;
|
|
9040
|
+
const lngs = this.services.languageUtils.toResolveHierarchy(lng);
|
|
9041
|
+
lngs.forEach(l => {
|
|
9042
|
+
if (l === 'cimode') return;
|
|
9043
|
+
if (toLoad.indexOf(l) < 0) toLoad.push(l);
|
|
9044
|
+
});
|
|
9045
|
+
};
|
|
9046
|
+
if (!usedLng) {
|
|
9047
|
+
const fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
9048
|
+
fallbacks.forEach(l => append(l));
|
|
9049
|
+
} else {
|
|
9050
|
+
append(usedLng);
|
|
9051
|
+
}
|
|
9052
|
+
this.options.preload?.forEach?.(l => append(l));
|
|
9053
|
+
this.services.backendConnector.load(toLoad, this.options.ns, e => {
|
|
9054
|
+
if (!e && !this.resolvedLanguage && this.language) this.setResolvedLanguage(this.language);
|
|
9055
|
+
usedCallback(e);
|
|
9056
|
+
});
|
|
9057
|
+
} else {
|
|
9058
|
+
usedCallback(null);
|
|
9059
|
+
}
|
|
9060
|
+
}
|
|
9061
|
+
reloadResources(lngs, ns, callback) {
|
|
9062
|
+
const deferred = defer();
|
|
9063
|
+
if (typeof lngs === 'function') {
|
|
9064
|
+
callback = lngs;
|
|
9065
|
+
lngs = undefined;
|
|
9066
|
+
}
|
|
9067
|
+
if (typeof ns === 'function') {
|
|
9068
|
+
callback = ns;
|
|
9069
|
+
ns = undefined;
|
|
9070
|
+
}
|
|
9071
|
+
if (!lngs) lngs = this.languages;
|
|
9072
|
+
if (!ns) ns = this.options.ns;
|
|
9073
|
+
if (!callback) callback = noop;
|
|
9074
|
+
this.services.backendConnector.reload(lngs, ns, err => {
|
|
9075
|
+
deferred.resolve();
|
|
9076
|
+
callback(err);
|
|
9077
|
+
});
|
|
9078
|
+
return deferred;
|
|
9079
|
+
}
|
|
9080
|
+
use(module) {
|
|
9081
|
+
if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');
|
|
9082
|
+
if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');
|
|
9083
|
+
if (module.type === 'backend') {
|
|
9084
|
+
this.modules.backend = module;
|
|
9085
|
+
}
|
|
9086
|
+
if (module.type === 'logger' || module.log && module.warn && module.error) {
|
|
9087
|
+
this.modules.logger = module;
|
|
9088
|
+
}
|
|
9089
|
+
if (module.type === 'languageDetector') {
|
|
9090
|
+
this.modules.languageDetector = module;
|
|
9091
|
+
}
|
|
9092
|
+
if (module.type === 'i18nFormat') {
|
|
9093
|
+
this.modules.i18nFormat = module;
|
|
9094
|
+
}
|
|
9095
|
+
if (module.type === 'postProcessor') {
|
|
9096
|
+
postProcessor.addPostProcessor(module);
|
|
9097
|
+
}
|
|
9098
|
+
if (module.type === 'formatter') {
|
|
9099
|
+
this.modules.formatter = module;
|
|
9100
|
+
}
|
|
9101
|
+
if (module.type === '3rdParty') {
|
|
9102
|
+
this.modules.external.push(module);
|
|
9103
|
+
}
|
|
9104
|
+
return this;
|
|
9105
|
+
}
|
|
9106
|
+
setResolvedLanguage(l) {
|
|
9107
|
+
if (!l || !this.languages) return;
|
|
9108
|
+
if (['cimode', 'dev'].indexOf(l) > -1) return;
|
|
9109
|
+
for (let li = 0; li < this.languages.length; li++) {
|
|
9110
|
+
const lngInLngs = this.languages[li];
|
|
9111
|
+
if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;
|
|
9112
|
+
if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
|
|
9113
|
+
this.resolvedLanguage = lngInLngs;
|
|
9114
|
+
break;
|
|
9115
|
+
}
|
|
9116
|
+
}
|
|
9117
|
+
if (!this.resolvedLanguage && this.languages.indexOf(l) < 0 && this.store.hasLanguageSomeTranslations(l)) {
|
|
9118
|
+
this.resolvedLanguage = l;
|
|
9119
|
+
this.languages.unshift(l);
|
|
9120
|
+
}
|
|
9121
|
+
}
|
|
9122
|
+
changeLanguage(lng, callback) {
|
|
9123
|
+
this.isLanguageChangingTo = lng;
|
|
9124
|
+
const deferred = defer();
|
|
9125
|
+
this.emit('languageChanging', lng);
|
|
9126
|
+
const setLngProps = l => {
|
|
9127
|
+
this.language = l;
|
|
9128
|
+
this.languages = this.services.languageUtils.toResolveHierarchy(l);
|
|
9129
|
+
this.resolvedLanguage = undefined;
|
|
9130
|
+
this.setResolvedLanguage(l);
|
|
9131
|
+
};
|
|
9132
|
+
const done = (err, l) => {
|
|
9133
|
+
if (l) {
|
|
9134
|
+
if (this.isLanguageChangingTo === lng) {
|
|
9135
|
+
setLngProps(l);
|
|
9136
|
+
this.translator.changeLanguage(l);
|
|
9137
|
+
this.isLanguageChangingTo = undefined;
|
|
9138
|
+
this.emit('languageChanged', l);
|
|
9139
|
+
this.logger.log('languageChanged', l);
|
|
9140
|
+
}
|
|
9141
|
+
} else {
|
|
9142
|
+
this.isLanguageChangingTo = undefined;
|
|
9143
|
+
}
|
|
9144
|
+
deferred.resolve((...args) => this.t(...args));
|
|
9145
|
+
if (callback) callback(err, (...args) => this.t(...args));
|
|
9146
|
+
};
|
|
9147
|
+
const setLng = lngs => {
|
|
9148
|
+
if (!lng && !lngs && this.services.languageDetector) lngs = [];
|
|
9149
|
+
const fl = isString(lngs) ? lngs : lngs && lngs[0];
|
|
9150
|
+
const l = this.store.hasLanguageSomeTranslations(fl) ? fl : this.services.languageUtils.getBestMatchFromCodes(isString(lngs) ? [lngs] : lngs);
|
|
9151
|
+
if (l) {
|
|
9152
|
+
if (!this.language) {
|
|
9153
|
+
setLngProps(l);
|
|
9154
|
+
}
|
|
9155
|
+
if (!this.translator.language) this.translator.changeLanguage(l);
|
|
9156
|
+
this.services.languageDetector?.cacheUserLanguage?.(l);
|
|
9157
|
+
}
|
|
9158
|
+
this.loadResources(l, err => {
|
|
9159
|
+
done(err, l);
|
|
9160
|
+
});
|
|
9161
|
+
};
|
|
9162
|
+
if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
|
|
9163
|
+
setLng(this.services.languageDetector.detect());
|
|
9164
|
+
} else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
|
|
9165
|
+
if (this.services.languageDetector.detect.length === 0) {
|
|
9166
|
+
this.services.languageDetector.detect().then(setLng);
|
|
9167
|
+
} else {
|
|
9168
|
+
this.services.languageDetector.detect(setLng);
|
|
9169
|
+
}
|
|
9170
|
+
} else {
|
|
9171
|
+
setLng(lng);
|
|
9172
|
+
}
|
|
9173
|
+
return deferred;
|
|
9174
|
+
}
|
|
9175
|
+
getFixedT(lng, ns, keyPrefix) {
|
|
9176
|
+
const fixedT = (key, opts, ...rest) => {
|
|
9177
|
+
let o;
|
|
9178
|
+
if (typeof opts !== 'object') {
|
|
9179
|
+
o = this.options.overloadTranslationOptionHandler([key, opts].concat(rest));
|
|
9180
|
+
} else {
|
|
9181
|
+
o = {
|
|
9182
|
+
...opts
|
|
9183
|
+
};
|
|
9184
|
+
}
|
|
9185
|
+
o.lng = o.lng || fixedT.lng;
|
|
9186
|
+
o.lngs = o.lngs || fixedT.lngs;
|
|
9187
|
+
o.ns = o.ns || fixedT.ns;
|
|
9188
|
+
if (o.keyPrefix !== '') o.keyPrefix = o.keyPrefix || keyPrefix || fixedT.keyPrefix;
|
|
9189
|
+
const keySeparator = this.options.keySeparator || '.';
|
|
9190
|
+
let resultKey;
|
|
9191
|
+
if (o.keyPrefix && Array.isArray(key)) {
|
|
9192
|
+
resultKey = key.map(k => {
|
|
9193
|
+
if (typeof k === 'function') k = keysFromSelector(k, {
|
|
9194
|
+
...this.options,
|
|
9195
|
+
...opts
|
|
9196
|
+
});
|
|
9197
|
+
return `${o.keyPrefix}${keySeparator}${k}`;
|
|
9198
|
+
});
|
|
9199
|
+
} else {
|
|
9200
|
+
if (typeof key === 'function') key = keysFromSelector(key, {
|
|
9201
|
+
...this.options,
|
|
9202
|
+
...opts
|
|
9203
|
+
});
|
|
9204
|
+
resultKey = o.keyPrefix ? `${o.keyPrefix}${keySeparator}${key}` : key;
|
|
9205
|
+
}
|
|
9206
|
+
return this.t(resultKey, o);
|
|
9207
|
+
};
|
|
9208
|
+
if (isString(lng)) {
|
|
9209
|
+
fixedT.lng = lng;
|
|
9210
|
+
} else {
|
|
9211
|
+
fixedT.lngs = lng;
|
|
6956
9212
|
}
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
9213
|
+
fixedT.ns = ns;
|
|
9214
|
+
fixedT.keyPrefix = keyPrefix;
|
|
9215
|
+
return fixedT;
|
|
9216
|
+
}
|
|
9217
|
+
t(...args) {
|
|
9218
|
+
return this.translator?.translate(...args);
|
|
9219
|
+
}
|
|
9220
|
+
exists(...args) {
|
|
9221
|
+
return this.translator?.exists(...args);
|
|
9222
|
+
}
|
|
9223
|
+
setDefaultNamespace(ns) {
|
|
9224
|
+
this.options.defaultNS = ns;
|
|
9225
|
+
}
|
|
9226
|
+
hasLoadedNamespace(ns, options = {}) {
|
|
9227
|
+
if (!this.isInitialized) {
|
|
9228
|
+
this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);
|
|
9229
|
+
return false;
|
|
6960
9230
|
}
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
9231
|
+
if (!this.languages || !this.languages.length) {
|
|
9232
|
+
this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);
|
|
9233
|
+
return false;
|
|
9234
|
+
}
|
|
9235
|
+
const lng = options.lng || this.resolvedLanguage || this.languages[0];
|
|
9236
|
+
const fallbackLng = this.options ? this.options.fallbackLng : false;
|
|
9237
|
+
const lastLng = this.languages[this.languages.length - 1];
|
|
9238
|
+
if (lng.toLowerCase() === 'cimode') return true;
|
|
9239
|
+
const loadNotPending = (l, n) => {
|
|
9240
|
+
const loadState = this.services.backendConnector.state[`${l}|${n}`];
|
|
9241
|
+
return loadState === -1 || loadState === 0 || loadState === 2;
|
|
9242
|
+
};
|
|
9243
|
+
if (options.precheck) {
|
|
9244
|
+
const preResult = options.precheck(this, loadNotPending);
|
|
9245
|
+
if (preResult !== undefined) return preResult;
|
|
9246
|
+
}
|
|
9247
|
+
if (this.hasResourceBundle(lng, ns)) return true;
|
|
9248
|
+
if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;
|
|
9249
|
+
if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
|
|
9250
|
+
return false;
|
|
9251
|
+
}
|
|
9252
|
+
loadNamespaces(ns, callback) {
|
|
9253
|
+
const deferred = defer();
|
|
9254
|
+
if (!this.options.ns) {
|
|
9255
|
+
if (callback) callback();
|
|
9256
|
+
return Promise.resolve();
|
|
9257
|
+
}
|
|
9258
|
+
if (isString(ns)) ns = [ns];
|
|
9259
|
+
ns.forEach(n => {
|
|
9260
|
+
if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
|
|
9261
|
+
});
|
|
9262
|
+
this.loadResources(err => {
|
|
9263
|
+
deferred.resolve();
|
|
9264
|
+
if (callback) callback(err);
|
|
9265
|
+
});
|
|
9266
|
+
return deferred;
|
|
9267
|
+
}
|
|
9268
|
+
loadLanguages(lngs, callback) {
|
|
9269
|
+
const deferred = defer();
|
|
9270
|
+
if (isString(lngs)) lngs = [lngs];
|
|
9271
|
+
const preloaded = this.options.preload || [];
|
|
9272
|
+
const newLngs = lngs.filter(lng => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));
|
|
9273
|
+
if (!newLngs.length) {
|
|
9274
|
+
if (callback) callback();
|
|
9275
|
+
return Promise.resolve();
|
|
9276
|
+
}
|
|
9277
|
+
this.options.preload = preloaded.concat(newLngs);
|
|
9278
|
+
this.loadResources(err => {
|
|
9279
|
+
deferred.resolve();
|
|
9280
|
+
if (callback) callback(err);
|
|
9281
|
+
});
|
|
9282
|
+
return deferred;
|
|
9283
|
+
}
|
|
9284
|
+
dir(lng) {
|
|
9285
|
+
if (!lng) lng = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language);
|
|
9286
|
+
if (!lng) return 'rtl';
|
|
9287
|
+
try {
|
|
9288
|
+
const l = new Intl.Locale(lng);
|
|
9289
|
+
if (l && l.getTextInfo) {
|
|
9290
|
+
const ti = l.getTextInfo();
|
|
9291
|
+
if (ti && ti.direction) return ti.direction;
|
|
9292
|
+
}
|
|
9293
|
+
} catch (e) {}
|
|
9294
|
+
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'];
|
|
9295
|
+
const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
|
|
9296
|
+
if (lng.toLowerCase().indexOf('-latn') > 1) return 'ltr';
|
|
9297
|
+
return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
|
|
9298
|
+
}
|
|
9299
|
+
static createInstance(options = {}, callback) {
|
|
9300
|
+
const instance = new I18n(options, callback);
|
|
9301
|
+
instance.createInstance = I18n.createInstance;
|
|
9302
|
+
return instance;
|
|
9303
|
+
}
|
|
9304
|
+
cloneInstance(options = {}, callback = noop) {
|
|
9305
|
+
const forkResourceStore = options.forkResourceStore;
|
|
9306
|
+
if (forkResourceStore) delete options.forkResourceStore;
|
|
9307
|
+
const mergedOptions = {
|
|
9308
|
+
...this.options,
|
|
9309
|
+
...options,
|
|
9310
|
+
...{
|
|
9311
|
+
isClone: true
|
|
9312
|
+
}
|
|
9313
|
+
};
|
|
9314
|
+
const clone = new I18n(mergedOptions);
|
|
9315
|
+
if (options.debug !== undefined || options.prefix !== undefined) {
|
|
9316
|
+
clone.logger = clone.logger.clone(options);
|
|
9317
|
+
}
|
|
9318
|
+
const membersToCopy = ['store', 'services', 'language'];
|
|
9319
|
+
membersToCopy.forEach(m => {
|
|
9320
|
+
clone[m] = this[m];
|
|
9321
|
+
});
|
|
9322
|
+
clone.services = {
|
|
9323
|
+
...this.services
|
|
9324
|
+
};
|
|
9325
|
+
clone.services.utils = {
|
|
9326
|
+
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
9327
|
+
};
|
|
9328
|
+
if (forkResourceStore) {
|
|
9329
|
+
const clonedData = Object.keys(this.store.data).reduce((prev, l) => {
|
|
9330
|
+
prev[l] = {
|
|
9331
|
+
...this.store.data[l]
|
|
6984
9332
|
};
|
|
6985
|
-
|
|
9333
|
+
prev[l] = Object.keys(prev[l]).reduce((acc, n) => {
|
|
9334
|
+
acc[n] = {
|
|
9335
|
+
...prev[l][n]
|
|
9336
|
+
};
|
|
9337
|
+
return acc;
|
|
9338
|
+
}, prev[l]);
|
|
9339
|
+
return prev;
|
|
9340
|
+
}, {});
|
|
9341
|
+
clone.store = new ResourceStore(clonedData, mergedOptions);
|
|
9342
|
+
clone.services.resourceStore = clone.store;
|
|
9343
|
+
}
|
|
9344
|
+
clone.translator = new Translator(clone.services, mergedOptions);
|
|
9345
|
+
clone.translator.on('*', (event, ...args) => {
|
|
9346
|
+
clone.emit(event, ...args);
|
|
9347
|
+
});
|
|
9348
|
+
clone.init(mergedOptions, callback);
|
|
9349
|
+
clone.translator.options = mergedOptions;
|
|
9350
|
+
clone.translator.backendConnector.services.utils = {
|
|
9351
|
+
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
9352
|
+
};
|
|
9353
|
+
return clone;
|
|
9354
|
+
}
|
|
9355
|
+
toJSON() {
|
|
9356
|
+
return {
|
|
9357
|
+
options: this.options,
|
|
9358
|
+
store: this.store,
|
|
9359
|
+
language: this.language,
|
|
9360
|
+
languages: this.languages,
|
|
9361
|
+
resolvedLanguage: this.resolvedLanguage
|
|
9362
|
+
};
|
|
9363
|
+
}
|
|
9364
|
+
}
|
|
9365
|
+
const instance = I18n.createInstance();
|
|
9366
|
+
|
|
9367
|
+
const {
|
|
9368
|
+
slice,
|
|
9369
|
+
forEach
|
|
9370
|
+
} = [];
|
|
9371
|
+
function defaults(obj) {
|
|
9372
|
+
forEach.call(slice.call(arguments, 1), source => {
|
|
9373
|
+
if (source) {
|
|
9374
|
+
for (const prop in source) {
|
|
9375
|
+
if (obj[prop] === undefined) obj[prop] = source[prop];
|
|
9376
|
+
}
|
|
6986
9377
|
}
|
|
6987
|
-
|
|
6988
|
-
|
|
9378
|
+
});
|
|
9379
|
+
return obj;
|
|
9380
|
+
}
|
|
9381
|
+
function hasXSS(input) {
|
|
9382
|
+
if (typeof input !== 'string') return false;
|
|
9383
|
+
|
|
9384
|
+
// Common XSS attack patterns
|
|
9385
|
+
const xssPatterns = [/<\s*script.*?>/i, /<\s*\/\s*script\s*>/i, /<\s*img.*?on\w+\s*=/i, /<\s*\w+\s*on\w+\s*=.*?>/i, /javascript\s*:/i, /vbscript\s*:/i, /expression\s*\(/i, /eval\s*\(/i, /alert\s*\(/i, /document\.cookie/i, /document\.write\s*\(/i, /window\.location/i, /innerHTML/i];
|
|
9386
|
+
return xssPatterns.some(pattern => pattern.test(input));
|
|
9387
|
+
}
|
|
9388
|
+
|
|
9389
|
+
// eslint-disable-next-line no-control-regex
|
|
9390
|
+
const fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
9391
|
+
const serializeCookie = function (name, val) {
|
|
9392
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
9393
|
+
path: '/'
|
|
9394
|
+
};
|
|
9395
|
+
const opt = options;
|
|
9396
|
+
const value = encodeURIComponent(val);
|
|
9397
|
+
let str = `${name}=${value}`;
|
|
9398
|
+
if (opt.maxAge > 0) {
|
|
9399
|
+
const maxAge = opt.maxAge - 0;
|
|
9400
|
+
if (Number.isNaN(maxAge)) throw new Error('maxAge should be a Number');
|
|
9401
|
+
str += `; Max-Age=${Math.floor(maxAge)}`;
|
|
9402
|
+
}
|
|
9403
|
+
if (opt.domain) {
|
|
9404
|
+
if (!fieldContentRegExp.test(opt.domain)) {
|
|
9405
|
+
throw new TypeError('option domain is invalid');
|
|
9406
|
+
}
|
|
9407
|
+
str += `; Domain=${opt.domain}`;
|
|
9408
|
+
}
|
|
9409
|
+
if (opt.path) {
|
|
9410
|
+
if (!fieldContentRegExp.test(opt.path)) {
|
|
9411
|
+
throw new TypeError('option path is invalid');
|
|
9412
|
+
}
|
|
9413
|
+
str += `; Path=${opt.path}`;
|
|
9414
|
+
}
|
|
9415
|
+
if (opt.expires) {
|
|
9416
|
+
if (typeof opt.expires.toUTCString !== 'function') {
|
|
9417
|
+
throw new TypeError('option expires is invalid');
|
|
9418
|
+
}
|
|
9419
|
+
str += `; Expires=${opt.expires.toUTCString()}`;
|
|
9420
|
+
}
|
|
9421
|
+
if (opt.httpOnly) str += '; HttpOnly';
|
|
9422
|
+
if (opt.secure) str += '; Secure';
|
|
9423
|
+
if (opt.sameSite) {
|
|
9424
|
+
const sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;
|
|
9425
|
+
switch (sameSite) {
|
|
9426
|
+
case true:
|
|
9427
|
+
str += '; SameSite=Strict';
|
|
9428
|
+
break;
|
|
9429
|
+
case 'lax':
|
|
9430
|
+
str += '; SameSite=Lax';
|
|
9431
|
+
break;
|
|
9432
|
+
case 'strict':
|
|
9433
|
+
str += '; SameSite=Strict';
|
|
9434
|
+
break;
|
|
9435
|
+
case 'none':
|
|
9436
|
+
str += '; SameSite=None';
|
|
9437
|
+
break;
|
|
9438
|
+
default:
|
|
9439
|
+
throw new TypeError('option sameSite is invalid');
|
|
6989
9440
|
}
|
|
6990
|
-
|
|
9441
|
+
}
|
|
9442
|
+
if (opt.partitioned) str += '; Partitioned';
|
|
9443
|
+
return str;
|
|
9444
|
+
};
|
|
9445
|
+
const cookie = {
|
|
9446
|
+
create(name, value, minutes, domain) {
|
|
9447
|
+
let cookieOptions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
|
|
9448
|
+
path: '/',
|
|
9449
|
+
sameSite: 'strict'
|
|
9450
|
+
};
|
|
9451
|
+
if (minutes) {
|
|
9452
|
+
cookieOptions.expires = new Date();
|
|
9453
|
+
cookieOptions.expires.setTime(cookieOptions.expires.getTime() + minutes * 60 * 1000);
|
|
9454
|
+
}
|
|
9455
|
+
if (domain) cookieOptions.domain = domain;
|
|
9456
|
+
document.cookie = serializeCookie(name, value, cookieOptions);
|
|
9457
|
+
},
|
|
9458
|
+
read(name) {
|
|
9459
|
+
const nameEQ = `${name}=`;
|
|
9460
|
+
const ca = document.cookie.split(';');
|
|
9461
|
+
for (let i = 0; i < ca.length; i++) {
|
|
9462
|
+
let c = ca[i];
|
|
9463
|
+
while (c.charAt(0) === ' ') c = c.substring(1, c.length);
|
|
9464
|
+
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
|
|
9465
|
+
}
|
|
9466
|
+
return null;
|
|
9467
|
+
},
|
|
9468
|
+
remove(name, domain) {
|
|
9469
|
+
this.create(name, '', -1, domain);
|
|
9470
|
+
}
|
|
9471
|
+
};
|
|
9472
|
+
var cookie$1 = {
|
|
9473
|
+
name: 'cookie',
|
|
9474
|
+
// Deconstruct the options object and extract the lookupCookie property
|
|
9475
|
+
lookup(_ref) {
|
|
9476
|
+
let {
|
|
9477
|
+
lookupCookie
|
|
9478
|
+
} = _ref;
|
|
9479
|
+
if (lookupCookie && typeof document !== 'undefined') {
|
|
9480
|
+
return cookie.read(lookupCookie) || undefined;
|
|
9481
|
+
}
|
|
9482
|
+
return undefined;
|
|
9483
|
+
},
|
|
9484
|
+
// Deconstruct the options object and extract the lookupCookie, cookieMinutes, cookieDomain, and cookieOptions properties
|
|
9485
|
+
cacheUserLanguage(lng, _ref2) {
|
|
9486
|
+
let {
|
|
9487
|
+
lookupCookie,
|
|
9488
|
+
cookieMinutes,
|
|
9489
|
+
cookieDomain,
|
|
9490
|
+
cookieOptions
|
|
9491
|
+
} = _ref2;
|
|
9492
|
+
if (lookupCookie && typeof document !== 'undefined') {
|
|
9493
|
+
cookie.create(lookupCookie, lng, cookieMinutes, cookieDomain, cookieOptions);
|
|
9494
|
+
}
|
|
9495
|
+
}
|
|
6991
9496
|
};
|
|
6992
|
-
LidoCell.style = LidoCellStyle0;
|
|
6993
|
-
|
|
6994
|
-
const lidoColCss = ".lido-col{top:var(--y, 0);left:var(--x, 0);height:var(--height, 100%);width:var(--width, 100%);background-color:var(--bgColor, #eeeeee);padding:15px;border-radius:10px;display:flex;justify-content:space-around;flex-direction:column;align-items:center}.lido-col>*{}";
|
|
6995
|
-
const LidoColStyle0 = lidoColCss;
|
|
6996
9497
|
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
this.borderImage = undefined;
|
|
7024
|
-
this.boxShadow = undefined;
|
|
7025
|
-
this.minDrops = 1;
|
|
7026
|
-
this.maxDrops = 1;
|
|
7027
|
-
this.margin = '';
|
|
7028
|
-
this.style = {};
|
|
9498
|
+
var querystring = {
|
|
9499
|
+
name: 'querystring',
|
|
9500
|
+
// Deconstruct the options object and extract the lookupQuerystring property
|
|
9501
|
+
lookup(_ref) {
|
|
9502
|
+
let {
|
|
9503
|
+
lookupQuerystring
|
|
9504
|
+
} = _ref;
|
|
9505
|
+
let found;
|
|
9506
|
+
if (typeof window !== 'undefined') {
|
|
9507
|
+
let {
|
|
9508
|
+
search
|
|
9509
|
+
} = window.location;
|
|
9510
|
+
if (!window.location.search && window.location.hash?.indexOf('?') > -1) {
|
|
9511
|
+
search = window.location.hash.substring(window.location.hash.indexOf('?'));
|
|
9512
|
+
}
|
|
9513
|
+
const query = search.substring(1);
|
|
9514
|
+
const params = query.split('&');
|
|
9515
|
+
for (let i = 0; i < params.length; i++) {
|
|
9516
|
+
const pos = params[i].indexOf('=');
|
|
9517
|
+
if (pos > 0) {
|
|
9518
|
+
const key = params[i].substring(0, pos);
|
|
9519
|
+
if (key === lookupQuerystring) {
|
|
9520
|
+
found = params[i].substring(pos + 1);
|
|
9521
|
+
}
|
|
9522
|
+
}
|
|
9523
|
+
}
|
|
7029
9524
|
}
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
9525
|
+
return found;
|
|
9526
|
+
}
|
|
9527
|
+
};
|
|
9528
|
+
|
|
9529
|
+
var hash = {
|
|
9530
|
+
name: 'hash',
|
|
9531
|
+
// Deconstruct the options object and extract the lookupHash property and the lookupFromHashIndex property
|
|
9532
|
+
lookup(_ref) {
|
|
9533
|
+
let {
|
|
9534
|
+
lookupHash,
|
|
9535
|
+
lookupFromHashIndex
|
|
9536
|
+
} = _ref;
|
|
9537
|
+
let found;
|
|
9538
|
+
if (typeof window !== 'undefined') {
|
|
9539
|
+
const {
|
|
9540
|
+
hash
|
|
9541
|
+
} = window.location;
|
|
9542
|
+
if (hash && hash.length > 2) {
|
|
9543
|
+
const query = hash.substring(1);
|
|
9544
|
+
if (lookupHash) {
|
|
9545
|
+
const params = query.split('&');
|
|
9546
|
+
for (let i = 0; i < params.length; i++) {
|
|
9547
|
+
const pos = params[i].indexOf('=');
|
|
9548
|
+
if (pos > 0) {
|
|
9549
|
+
const key = params[i].substring(0, pos);
|
|
9550
|
+
if (key === lookupHash) {
|
|
9551
|
+
found = params[i].substring(pos + 1);
|
|
9552
|
+
}
|
|
9553
|
+
}
|
|
9554
|
+
}
|
|
7039
9555
|
}
|
|
9556
|
+
if (found) return found;
|
|
9557
|
+
if (!found && lookupFromHashIndex > -1) {
|
|
9558
|
+
const language = hash.match(/\/([a-zA-Z-]*)/g);
|
|
9559
|
+
if (!Array.isArray(language)) return undefined;
|
|
9560
|
+
const index = typeof lookupFromHashIndex === 'number' ? lookupFromHashIndex : 0;
|
|
9561
|
+
return language[index]?.replace('/', '');
|
|
9562
|
+
}
|
|
9563
|
+
}
|
|
7040
9564
|
}
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
9565
|
+
return found;
|
|
9566
|
+
}
|
|
9567
|
+
};
|
|
9568
|
+
|
|
9569
|
+
let hasLocalStorageSupport = null;
|
|
9570
|
+
const localStorageAvailable = () => {
|
|
9571
|
+
if (hasLocalStorageSupport !== null) return hasLocalStorageSupport;
|
|
9572
|
+
try {
|
|
9573
|
+
hasLocalStorageSupport = typeof window !== 'undefined' && window.localStorage !== null;
|
|
9574
|
+
if (!hasLocalStorageSupport) {
|
|
9575
|
+
return false;
|
|
7049
9576
|
}
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
9577
|
+
const testKey = 'i18next.translate.boo';
|
|
9578
|
+
window.localStorage.setItem(testKey, 'foo');
|
|
9579
|
+
window.localStorage.removeItem(testKey);
|
|
9580
|
+
} catch (e) {
|
|
9581
|
+
hasLocalStorageSupport = false;
|
|
9582
|
+
}
|
|
9583
|
+
return hasLocalStorageSupport;
|
|
9584
|
+
};
|
|
9585
|
+
var localStorage$1 = {
|
|
9586
|
+
name: 'localStorage',
|
|
9587
|
+
// Deconstruct the options object and extract the lookupLocalStorage property
|
|
9588
|
+
lookup(_ref) {
|
|
9589
|
+
let {
|
|
9590
|
+
lookupLocalStorage
|
|
9591
|
+
} = _ref;
|
|
9592
|
+
if (lookupLocalStorage && localStorageAvailable()) {
|
|
9593
|
+
return window.localStorage.getItem(lookupLocalStorage) || undefined; // Undefined ensures type consistency with the previous version of this function
|
|
9594
|
+
}
|
|
9595
|
+
return undefined;
|
|
9596
|
+
},
|
|
9597
|
+
// Deconstruct the options object and extract the lookupLocalStorage property
|
|
9598
|
+
cacheUserLanguage(lng, _ref2) {
|
|
9599
|
+
let {
|
|
9600
|
+
lookupLocalStorage
|
|
9601
|
+
} = _ref2;
|
|
9602
|
+
if (lookupLocalStorage && localStorageAvailable()) {
|
|
9603
|
+
window.localStorage.setItem(lookupLocalStorage, lng);
|
|
7053
9604
|
}
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
display: this.visible ? 'flex' : 'none', // Toggle visibility
|
|
7065
|
-
flexDirection: !this.direction ? 'column' : utils.parseProp(this.direction, orientation),
|
|
7066
|
-
borderImage: `url(${borderImg})`,
|
|
7067
|
-
borderImageSlice: borderImg ? '0 fill' : '',
|
|
7068
|
-
boxShadow: this.boxShadow ? this.boxShadow : 'unset',
|
|
7069
|
-
margin: utils.parseProp(this.margin, orientation),
|
|
7070
|
-
};
|
|
9605
|
+
}
|
|
9606
|
+
};
|
|
9607
|
+
|
|
9608
|
+
let hasSessionStorageSupport = null;
|
|
9609
|
+
const sessionStorageAvailable = () => {
|
|
9610
|
+
if (hasSessionStorageSupport !== null) return hasSessionStorageSupport;
|
|
9611
|
+
try {
|
|
9612
|
+
hasSessionStorageSupport = typeof window !== 'undefined' && window.sessionStorage !== null;
|
|
9613
|
+
if (!hasSessionStorageSupport) {
|
|
9614
|
+
return false;
|
|
7071
9615
|
}
|
|
7072
|
-
|
|
7073
|
-
|
|
9616
|
+
const testKey = 'i18next.translate.boo';
|
|
9617
|
+
window.sessionStorage.setItem(testKey, 'foo');
|
|
9618
|
+
window.sessionStorage.removeItem(testKey);
|
|
9619
|
+
} catch (e) {
|
|
9620
|
+
hasSessionStorageSupport = false;
|
|
9621
|
+
}
|
|
9622
|
+
return hasSessionStorageSupport;
|
|
9623
|
+
};
|
|
9624
|
+
var sessionStorage = {
|
|
9625
|
+
name: 'sessionStorage',
|
|
9626
|
+
lookup(_ref) {
|
|
9627
|
+
let {
|
|
9628
|
+
lookupSessionStorage
|
|
9629
|
+
} = _ref;
|
|
9630
|
+
if (lookupSessionStorage && sessionStorageAvailable()) {
|
|
9631
|
+
return window.sessionStorage.getItem(lookupSessionStorage) || undefined;
|
|
9632
|
+
}
|
|
9633
|
+
return undefined;
|
|
9634
|
+
},
|
|
9635
|
+
cacheUserLanguage(lng, _ref2) {
|
|
9636
|
+
let {
|
|
9637
|
+
lookupSessionStorage
|
|
9638
|
+
} = _ref2;
|
|
9639
|
+
if (lookupSessionStorage && sessionStorageAvailable()) {
|
|
9640
|
+
window.sessionStorage.setItem(lookupSessionStorage, lng);
|
|
7074
9641
|
}
|
|
7075
|
-
|
|
9642
|
+
}
|
|
7076
9643
|
};
|
|
7077
|
-
|
|
9644
|
+
|
|
9645
|
+
var navigator$1 = {
|
|
9646
|
+
name: 'navigator',
|
|
9647
|
+
lookup(options) {
|
|
9648
|
+
const found = [];
|
|
9649
|
+
if (typeof navigator !== 'undefined') {
|
|
9650
|
+
const {
|
|
9651
|
+
languages,
|
|
9652
|
+
userLanguage,
|
|
9653
|
+
language
|
|
9654
|
+
} = navigator;
|
|
9655
|
+
if (languages) {
|
|
9656
|
+
// chrome only; not an array, so can't use .push.apply instead of iterating
|
|
9657
|
+
for (let i = 0; i < languages.length; i++) {
|
|
9658
|
+
found.push(languages[i]);
|
|
9659
|
+
}
|
|
9660
|
+
}
|
|
9661
|
+
if (userLanguage) {
|
|
9662
|
+
found.push(userLanguage);
|
|
9663
|
+
}
|
|
9664
|
+
if (language) {
|
|
9665
|
+
found.push(language);
|
|
9666
|
+
}
|
|
9667
|
+
}
|
|
9668
|
+
return found.length > 0 ? found : undefined;
|
|
9669
|
+
}
|
|
9670
|
+
};
|
|
9671
|
+
|
|
9672
|
+
var htmlTag = {
|
|
9673
|
+
name: 'htmlTag',
|
|
9674
|
+
// Deconstruct the options object and extract the htmlTag property
|
|
9675
|
+
lookup(_ref) {
|
|
9676
|
+
let {
|
|
9677
|
+
htmlTag
|
|
9678
|
+
} = _ref;
|
|
9679
|
+
let found;
|
|
9680
|
+
const internalHtmlTag = htmlTag || (typeof document !== 'undefined' ? document.documentElement : null);
|
|
9681
|
+
if (internalHtmlTag && typeof internalHtmlTag.getAttribute === 'function') {
|
|
9682
|
+
found = internalHtmlTag.getAttribute('lang');
|
|
9683
|
+
}
|
|
9684
|
+
return found;
|
|
9685
|
+
}
|
|
9686
|
+
};
|
|
9687
|
+
|
|
9688
|
+
var path = {
|
|
9689
|
+
name: 'path',
|
|
9690
|
+
// Deconstruct the options object and extract the lookupFromPathIndex property
|
|
9691
|
+
lookup(_ref) {
|
|
9692
|
+
let {
|
|
9693
|
+
lookupFromPathIndex
|
|
9694
|
+
} = _ref;
|
|
9695
|
+
if (typeof window === 'undefined') return undefined;
|
|
9696
|
+
const language = window.location.pathname.match(/\/([a-zA-Z-]*)/g);
|
|
9697
|
+
if (!Array.isArray(language)) return undefined;
|
|
9698
|
+
const index = typeof lookupFromPathIndex === 'number' ? lookupFromPathIndex : 0;
|
|
9699
|
+
return language[index]?.replace('/', '');
|
|
9700
|
+
}
|
|
9701
|
+
};
|
|
9702
|
+
|
|
9703
|
+
var subdomain = {
|
|
9704
|
+
name: 'subdomain',
|
|
9705
|
+
lookup(_ref) {
|
|
9706
|
+
let {
|
|
9707
|
+
lookupFromSubdomainIndex
|
|
9708
|
+
} = _ref;
|
|
9709
|
+
// If given get the subdomain index else 1
|
|
9710
|
+
const internalLookupFromSubdomainIndex = typeof lookupFromSubdomainIndex === 'number' ? lookupFromSubdomainIndex + 1 : 1;
|
|
9711
|
+
// get all matches if window.location. is existing
|
|
9712
|
+
// first item of match is the match itself and the second is the first group match which should be the first subdomain match
|
|
9713
|
+
// is the hostname no public domain get the or option of localhost
|
|
9714
|
+
const language = typeof window !== 'undefined' && window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);
|
|
9715
|
+
|
|
9716
|
+
// if there is no match (null) return undefined
|
|
9717
|
+
if (!language) return undefined;
|
|
9718
|
+
// return the given group match
|
|
9719
|
+
return language[internalLookupFromSubdomainIndex];
|
|
9720
|
+
}
|
|
9721
|
+
};
|
|
9722
|
+
|
|
9723
|
+
// some environments, throws when accessing document.cookie
|
|
9724
|
+
let canCookies = false;
|
|
9725
|
+
try {
|
|
9726
|
+
canCookies = true;
|
|
9727
|
+
// eslint-disable-next-line no-empty
|
|
9728
|
+
} catch (e) {}
|
|
9729
|
+
const order = ['querystring', 'cookie', 'localStorage', 'sessionStorage', 'navigator', 'htmlTag'];
|
|
9730
|
+
if (!canCookies) order.splice(1, 1);
|
|
9731
|
+
const getDefaults = () => ({
|
|
9732
|
+
order,
|
|
9733
|
+
lookupQuerystring: 'lng',
|
|
9734
|
+
lookupCookie: 'i18next',
|
|
9735
|
+
lookupLocalStorage: 'i18nextLng',
|
|
9736
|
+
lookupSessionStorage: 'i18nextLng',
|
|
9737
|
+
// cache user language
|
|
9738
|
+
caches: ['localStorage'],
|
|
9739
|
+
excludeCacheFor: ['cimode'],
|
|
9740
|
+
// cookieMinutes: 10,
|
|
9741
|
+
// cookieDomain: 'myDomain'
|
|
9742
|
+
|
|
9743
|
+
convertDetectedLanguage: l => l
|
|
9744
|
+
});
|
|
9745
|
+
class Browser {
|
|
9746
|
+
constructor(services) {
|
|
9747
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9748
|
+
this.type = 'languageDetector';
|
|
9749
|
+
this.detectors = {};
|
|
9750
|
+
this.init(services, options);
|
|
9751
|
+
}
|
|
9752
|
+
init() {
|
|
9753
|
+
let services = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
9754
|
+
languageUtils: {}
|
|
9755
|
+
};
|
|
9756
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9757
|
+
let i18nOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
9758
|
+
this.services = services;
|
|
9759
|
+
this.options = defaults(options, this.options || {}, getDefaults());
|
|
9760
|
+
if (typeof this.options.convertDetectedLanguage === 'string' && this.options.convertDetectedLanguage.indexOf('15897') > -1) {
|
|
9761
|
+
this.options.convertDetectedLanguage = l => l.replace('-', '_');
|
|
9762
|
+
}
|
|
9763
|
+
|
|
9764
|
+
// backwards compatibility
|
|
9765
|
+
if (this.options.lookupFromUrlIndex) this.options.lookupFromPathIndex = this.options.lookupFromUrlIndex;
|
|
9766
|
+
this.i18nOptions = i18nOptions;
|
|
9767
|
+
this.addDetector(cookie$1);
|
|
9768
|
+
this.addDetector(querystring);
|
|
9769
|
+
this.addDetector(localStorage$1);
|
|
9770
|
+
this.addDetector(sessionStorage);
|
|
9771
|
+
this.addDetector(navigator$1);
|
|
9772
|
+
this.addDetector(htmlTag);
|
|
9773
|
+
this.addDetector(path);
|
|
9774
|
+
this.addDetector(subdomain);
|
|
9775
|
+
this.addDetector(hash);
|
|
9776
|
+
}
|
|
9777
|
+
addDetector(detector) {
|
|
9778
|
+
this.detectors[detector.name] = detector;
|
|
9779
|
+
return this;
|
|
9780
|
+
}
|
|
9781
|
+
detect() {
|
|
9782
|
+
let detectionOrder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.order;
|
|
9783
|
+
let detected = [];
|
|
9784
|
+
detectionOrder.forEach(detectorName => {
|
|
9785
|
+
if (this.detectors[detectorName]) {
|
|
9786
|
+
let lookup = this.detectors[detectorName].lookup(this.options);
|
|
9787
|
+
if (lookup && typeof lookup === 'string') lookup = [lookup];
|
|
9788
|
+
if (lookup) detected = detected.concat(lookup);
|
|
9789
|
+
}
|
|
9790
|
+
});
|
|
9791
|
+
detected = detected.filter(d => d !== undefined && d !== null && !hasXSS(d)).map(d => this.options.convertDetectedLanguage(d));
|
|
9792
|
+
if (this.services && this.services.languageUtils && this.services.languageUtils.getBestMatchFromCodes) return detected; // new i18next v19.5.0
|
|
9793
|
+
return detected.length > 0 ? detected[0] : null; // a little backward compatibility
|
|
9794
|
+
}
|
|
9795
|
+
cacheUserLanguage(lng) {
|
|
9796
|
+
let caches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options.caches;
|
|
9797
|
+
if (!caches) return;
|
|
9798
|
+
if (this.options.excludeCacheFor && this.options.excludeCacheFor.indexOf(lng) > -1) return;
|
|
9799
|
+
caches.forEach(cacheName => {
|
|
9800
|
+
if (this.detectors[cacheName]) this.detectors[cacheName].cacheUserLanguage(lng, this.options);
|
|
9801
|
+
});
|
|
9802
|
+
}
|
|
9803
|
+
}
|
|
9804
|
+
Browser.type = 'languageDetector';
|
|
9805
|
+
|
|
9806
|
+
const Exit$5 = "Exit";
|
|
9807
|
+
const en = {
|
|
9808
|
+
"Do you want to exit?": "Do you want to exit?",
|
|
9809
|
+
Exit: Exit$5,
|
|
9810
|
+
"Continue playing": "Continue playing",
|
|
9811
|
+
"Drop the elements to match the given symbol order": "Drop the elements to match the given symbol order"
|
|
9812
|
+
};
|
|
9813
|
+
|
|
9814
|
+
const Exit$4 = "Quitter";
|
|
9815
|
+
const fr = {
|
|
9816
|
+
"Do you want to exit?": "Voulez-vous quitter?",
|
|
9817
|
+
Exit: Exit$4,
|
|
9818
|
+
"Continue playing": "Continuer à jouer",
|
|
9819
|
+
"Drop the elements to match the given symbol order": "Déposez les éléments pour correspondre au symbole donné"
|
|
9820
|
+
};
|
|
9821
|
+
|
|
9822
|
+
const Exit$3 = "बाहर निकलें";
|
|
9823
|
+
const hi = {
|
|
9824
|
+
"Do you want to exit?": "क्या आप बाहर निकलना चाहते हैं?",
|
|
9825
|
+
Exit: Exit$3,
|
|
9826
|
+
"Continue playing": "खेलना जारी रखें",
|
|
9827
|
+
"Drop the elements to match the given symbol order": "दिए गए चिन्ह से मिलाने के लिए तत्वों को ड्रॉप करें"
|
|
9828
|
+
};
|
|
9829
|
+
|
|
9830
|
+
const Exit$2 = "ನಿರ್ಗಮಿಸು";
|
|
9831
|
+
const ka = {
|
|
9832
|
+
"Do you want to exit?": "ನೀವು ನಿರ್ಗಮಿಸಲು ಬಯಸುವಿರಾ?",
|
|
9833
|
+
Exit: Exit$2,
|
|
9834
|
+
"Continue playing": "ಆಟವನ್ನು ಮುಂದುವರಿಸಿ",
|
|
9835
|
+
"Drop the elements to match the given symbol order": "ನೀಡಿರುವ ಸಂಕೇತಕ್ಕೆ ಹೊಂದುವಂತೆ ಅಂಶಗಳನ್ನು ಬಿಡಿ"
|
|
9836
|
+
};
|
|
9837
|
+
|
|
9838
|
+
const Exit$1 = "బయటకు వెళ్ళు";
|
|
9839
|
+
const te = {
|
|
9840
|
+
"Do you want to exit?": "మీరు బయటకు వెళ్లాలనుకుంటున్నారా?",
|
|
9841
|
+
Exit: Exit$1,
|
|
9842
|
+
"Continue playing": "ఆటను కొనసాగించు",
|
|
9843
|
+
"Drop the elements to match the given symbol order": "ఇచ్చిన చిహ్నానికి సరిపడేలా అంశాలను డ్రాప్ చేయండి"
|
|
9844
|
+
};
|
|
9845
|
+
|
|
9846
|
+
const Exit = "Sair";
|
|
9847
|
+
const port = {
|
|
9848
|
+
"Do you want to exit?": "Você deseja sair?",
|
|
9849
|
+
Exit: Exit,
|
|
9850
|
+
"Continue playing": "Continuar jogando",
|
|
9851
|
+
"Drop the elements to match the given symbol order": "Solte os elementos para corresponder à ordem dos símbolos fornecida"
|
|
9852
|
+
};
|
|
9853
|
+
|
|
9854
|
+
instance
|
|
9855
|
+
.use(Browser)
|
|
9856
|
+
.init({
|
|
9857
|
+
resources: {
|
|
9858
|
+
en: { translation: en },
|
|
9859
|
+
fr: { translation: fr },
|
|
9860
|
+
hi: { translation: hi },
|
|
9861
|
+
ka: { translation: ka },
|
|
9862
|
+
te: { translation: te },
|
|
9863
|
+
port: { translation: port },
|
|
9864
|
+
},
|
|
9865
|
+
fallbackLng: 'en', // fallback if current lang not found
|
|
9866
|
+
debug: false,
|
|
9867
|
+
interpolation: {
|
|
9868
|
+
escapeValue: false, // Stencil already handles escaping
|
|
9869
|
+
},
|
|
9870
|
+
detection: {
|
|
9871
|
+
// optional: tune detection logic
|
|
9872
|
+
order: ['querystring', 'localStorage', 'navigator', 'htmlTag'],
|
|
9873
|
+
caches: ['localStorage'],
|
|
9874
|
+
},
|
|
9875
|
+
});
|
|
7078
9876
|
|
|
7079
9877
|
const lidoContainerCss = ".lido-container{position:relative;height:100%;width:100%;background-color:var(--bgColor, transparent);display:flex;flex-direction:column;justify-content:center;align-items:center}";
|
|
7080
9878
|
const LidoContainerStyle0 = lidoContainerCss;
|
|
@@ -7082,6 +9880,7 @@ const LidoContainerStyle0 = lidoContainerCss;
|
|
|
7082
9880
|
const LidoContainer = class {
|
|
7083
9881
|
constructor(hostRef) {
|
|
7084
9882
|
index.registerInstance(this, hostRef);
|
|
9883
|
+
this.locale = '';
|
|
7085
9884
|
this.showDropBorder = true;
|
|
7086
9885
|
this.appendToDropOnCompletion = false;
|
|
7087
9886
|
this.id = '';
|
|
@@ -7120,6 +9919,31 @@ const LidoContainer = class {
|
|
|
7120
9919
|
this.delayVisible = '';
|
|
7121
9920
|
this.disableSpeak = false;
|
|
7122
9921
|
}
|
|
9922
|
+
languageChanged(newLang) {
|
|
9923
|
+
const langToApply = newLang || this.resolveLanguage();
|
|
9924
|
+
this.updateChildTextLanguage(langToApply);
|
|
9925
|
+
}
|
|
9926
|
+
componentWillLoad() {
|
|
9927
|
+
const langToApply = this.resolveLanguage();
|
|
9928
|
+
this.updateChildTextLanguage(langToApply);
|
|
9929
|
+
}
|
|
9930
|
+
resolveLanguage() {
|
|
9931
|
+
var _a, _b;
|
|
9932
|
+
const rootEl = this.el.closest('lido-root');
|
|
9933
|
+
const rootLang = (rootEl === null || rootEl === void 0 ? void 0 : rootEl.locale) || '';
|
|
9934
|
+
if (rootLang === null || rootLang === void 0 ? void 0 : rootLang.trim())
|
|
9935
|
+
return rootLang;
|
|
9936
|
+
const homeEl = this.el.closest('lido-home');
|
|
9937
|
+
const homeLang = (homeEl === null || homeEl === void 0 ? void 0 : homeEl.locale) || '';
|
|
9938
|
+
if (homeLang === null || homeLang === void 0 ? void 0 : homeLang.trim())
|
|
9939
|
+
return homeLang;
|
|
9940
|
+
if ((_a = this.locale) === null || _a === void 0 ? void 0 : _a.trim())
|
|
9941
|
+
return this.locale;
|
|
9942
|
+
const xmlLang = this.el.getAttribute('locale');
|
|
9943
|
+
if (xmlLang === null || xmlLang === void 0 ? void 0 : xmlLang.trim())
|
|
9944
|
+
return xmlLang;
|
|
9945
|
+
return (_b = this.el.textContent) === null || _b === void 0 ? void 0 : _b.trim();
|
|
9946
|
+
}
|
|
7123
9947
|
convertToPixels(height, parentElement = document.body) {
|
|
7124
9948
|
if (!height)
|
|
7125
9949
|
return 0; // Handle empty or invalid input
|
|
@@ -7161,6 +9985,15 @@ const LidoContainer = class {
|
|
|
7161
9985
|
this.el.style.width = '1600px';
|
|
7162
9986
|
}
|
|
7163
9987
|
}
|
|
9988
|
+
updateChildTextLanguage(lang) {
|
|
9989
|
+
const appliedLang = lang || instance.language || 'en';
|
|
9990
|
+
instance.changeLanguage(appliedLang);
|
|
9991
|
+
const texts = this.el.querySelectorAll('lido-text');
|
|
9992
|
+
texts.forEach((textEl) => {
|
|
9993
|
+
textEl.locale = appliedLang;
|
|
9994
|
+
textEl.dispatchEvent(new CustomEvent('languageChanged', { bubbles: true }));
|
|
9995
|
+
});
|
|
9996
|
+
}
|
|
7164
9997
|
/**
|
|
7165
9998
|
* Lifecycle hook that runs after the component is loaded.
|
|
7166
9999
|
* - It scales the container.
|
|
@@ -7182,6 +10015,8 @@ const LidoContainer = class {
|
|
|
7182
10015
|
styleElement.innerHTML = this.customStyle;
|
|
7183
10016
|
document.head.appendChild(styleElement);
|
|
7184
10017
|
}
|
|
10018
|
+
const langToApply = this.resolveLanguage();
|
|
10019
|
+
this.updateChildTextLanguage(langToApply);
|
|
7185
10020
|
}
|
|
7186
10021
|
disconnectedCallback() {
|
|
7187
10022
|
window.removeEventListener('resize', () => this.scaleContainer(this.el));
|
|
@@ -7201,9 +10036,12 @@ const LidoContainer = class {
|
|
|
7201
10036
|
userSelect: 'none', // Prevent any field selection
|
|
7202
10037
|
};
|
|
7203
10038
|
console.log('🚀 ~ LidoContainer ~ canplay:', this.canplay);
|
|
7204
|
-
return (index.h(index.Host, { key: '
|
|
10039
|
+
return (index.h(index.Host, { key: '5d7f2f02c5a231a18897942ea0d2f3a200efa502', id: "lido-container", locale: this.locale, "tab-index": 0, class: "lido-container", objective: this.objective, baseUrl: this.baseUrl, style: style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, onTouch: this.onTouch, onInCorrect: this.onInCorrect, onCorrect: this.onCorrect, onEntry: this.onEntry, "show-check": `${this.showCheck}`, "is-continue-on-correct": `${this.isContinueOnCorrect}`, "is-allow-only-correct": `${this.isAllowOnlyCorrect}`, canplay: `${this.canplay}`, appendToDropOnCompletion: `${this.appendToDropOnCompletion}`, "show-prev-button": `${this.showPrevButton}`, "show-next-button": `${this.showNextButton}`, "show-drop-border": `${this.showDropBorder}`, "bg-image": this.bgImage, "exit-button-url": this.exitButtonUrl, "prev-button-url": this.prevButtonUrl, "next-button-url": this.nextButtonUrl, "speaker-button-url": this.speakerButtonUrl, "disable-speak": this.disableSpeak }, index.h("slot", { key: 'b82aff47d621fc4f9d6abe5b7add974853f69219' })));
|
|
7205
10040
|
}
|
|
7206
10041
|
get el() { return index.getElement(this); }
|
|
10042
|
+
static get watchers() { return {
|
|
10043
|
+
"locale": ["languageChanged"]
|
|
10044
|
+
}; }
|
|
7207
10045
|
};
|
|
7208
10046
|
LidoContainer.style = LidoContainerStyle0;
|
|
7209
10047
|
|
|
@@ -7282,7 +10120,7 @@ const LidoFlash = class {
|
|
|
7282
10120
|
}
|
|
7283
10121
|
/* ---------- Render ---------- */
|
|
7284
10122
|
render() {
|
|
7285
|
-
return (index.h(index.Host, { key: '
|
|
10123
|
+
return (index.h(index.Host, { key: 'b8f000d4e9d04d9954f81dc7e05b109dc16cb223', value: this.value, "tab-index": this.tabIndex, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, type: this.type, onClick: this.handleFlip, "disable-speak": this.disableSpeak }, index.h("div", { key: 'cea63b67d1b6a925ab0520eaa7c5166288bcd71e', class: `card ${this.flipped ? 'flipped' : ''}` }, index.h("div", { key: '3517e09bb91ac4c6fb2c066539f2d4f51436938f', class: "card-face card-front" }, this.front != null ? this.front : index.h("slot", { name: "front" })), index.h("div", { key: '5a14a4ab70898852046f1128c99e5a285c1c37f7', class: "card-face card-back" }, this.back != null ? this.back : index.h("slot", { name: "back" })))));
|
|
7286
10124
|
}
|
|
7287
10125
|
get el() { return index.getElement(this); }
|
|
7288
10126
|
static get watchers() { return {
|
|
@@ -7350,7 +10188,7 @@ const LidoFloat = class {
|
|
|
7350
10188
|
};
|
|
7351
10189
|
}
|
|
7352
10190
|
render() {
|
|
7353
|
-
return (index.h(index.Host, { key: '
|
|
10191
|
+
return (index.h(index.Host, { key: 'e8bc37c1220b708872748bd49c2d7fc448bdd01c', class: "lido-float", "float-direction": this.floatDirection, id: this.id, "tab-index": this.tabIndex, style: this.style, onEntry: this.onEntry }, index.h("slot", { key: '991afa719c6fc35f489fae30f77bad81cf2b4c3e' })));
|
|
7354
10192
|
}
|
|
7355
10193
|
get el() { return index.getElement(this); }
|
|
7356
10194
|
};
|
|
@@ -7359,7 +10197,7 @@ LidoFloat.style = LidoFloatStyle0;
|
|
|
7359
10197
|
const indexCss = "@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400..800&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Baloo+Bhai+2:wght@400..800&display=swap'); body{overflow:hidden;background-position:center;background-size:cover;background-repeat:no-repeat;height:100vh}*{user-select:none}.lido-disable-check-button{pointer-events:none;background-color:#9393935c !important;color:white}.lido-element-selected{border:2px solid;background-color:#ffdf7d !important}.diagonal-target,.diagonal-drop *{transform:scale(0.8) !important;opacity:1 !important}.cloned-element{display:flex !important;position:absolute !important;filter:grayscale(100%);pointer-events:none}.removeShadow{box-shadow:0px 0px 0px 0px #ff8900 !important}.highlight-element{border:2px solid white;box-shadow:0 2px 4px rgba(151, 150, 150, 0.1) !important}.drop-element.empty{border:4px dashed #f34d08 !important}.drop-element.filled{border:'none' !important}.drag-element{box-shadow:0px 15px 11px rgba(43, 0, 0, 0.3) !important}.drag-element.dropped{box-shadow:none !important}.click-element{background-color:var(--btn-bg-color, rgba(255, 172, 76, 1)) !important;box-shadow:var(--btn-shadow-px) var(--btn-shadow-color, rgba(225, 121, 76, 1)) !important;cursor:pointer;transition:box-shadow 0.1s ease-out, transform 0.2s ease-out;}.click-element:active{box-shadow:0px 0px 0px var(--btn-shadow-color, rgba(225, 121, 76, 1)) !important;transform:translateY(var(--btn-active));}.click-element:focus{outline:2px solid dodgerblue;outline-offset:3px}.after-drop-popup-container{width:200%;height:200%;background-color:rgba(0, 0, 0, 0.8);position:absolute;display:flex;flex-direction:row-reverse;align-items:center;justify-content:center !important;gap:80px}.after-drop-popup-drag-element{scale:1.5;border-radius:8px;transform:none !important;position:unset !important}.after-drop-popup-drop-element{scale:1.5;border:unset;border-radius:8px;transform:none !important;position:unset !important}@keyframes zoomFadeIn{0%{transform:scale(0.6);opacity:0}100%{transform:scale(1);opacity:1}}.zoom-fade-in{animation:zoomFadeIn 0.8s ease-out forwards}@keyframes zoomFadeOut{0%{transform:scale(1);opacity:1}100%{transform:scale(0.6);opacity:0}}.zoom-fade-out{animation:zoomFadeOut 0.8s ease-in forwards}.slide-numbers{width:70px;height:70px;border:1px solid #f57139;background-color:white;font-weight:500;color:#f57139;font-size:44px;border-radius:40px;display:flex;align-items:center;justify-content:center;font-family:'Baloo Bhai 2', serif}.slide-numbers-bottom{position:absolute;display:flex;justify-content:space-around;align-items:center;bottom:-25px;width:100%;height:50px}.slide-numbers-left{position:absolute;display:flex;flex-direction:column;justify-content:space-around;height:100%;width:50px;left:-25px;bottom:0px}.lido-speak-icon{width:56px;height:56px;position:absolute;top:-25px;right:-25px;z-index:10;background-image:url(\"https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/template/audioIcon.png\");background-color:white;border:4px solid #F34D08;border-radius:16px;box-shadow:0px 4px 0px 0px #F34D08;background-size:contain;background-repeat:no-repeat;cursor:pointer}.lido-speak-icon:active{transform:translateY(8px);box-shadow:0px 0px 0px 0px !important}.lido-strong-shake{animation:strongShake 0.3s ease}.lido-scaled-shake{animation:scaledShake 0.6s ease-in-out}.lido-horizontal-shake{animation:horizontalShake 0.6s ease-in-out;border-radius:20px}.lido-vertical-shake{animation:verticalShake 0.6s ease-in-out;border-radius:20px}.lido-diagonal-shake{animation:diagonalShake 0.5s ease-in-out;border-radius:20px;will-change:transform}.lido-glow{animation:glowPulse 1s infinite alternate;transition:opacity 0.5s ease-in-out}.lido-box-highlight{animation:topToPlace 0.3s linear}.lido-display-hiddenvalue{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:80px;font-weight:1000;color:brown;-webkit-text-stroke:2px white;font-family:'Baloo Bhai 2', sans-serif;pointer-events:none}.lido-image-colorize{position:relative;display:inline-block}.lido-image-colorize::after{content:'';position:absolute;inset:0;background:var(--tint-color);mix-blend-mode:multiply;opacity:0.8;pointer-events:none;mask-image:var(--mask-url);mask-size:cover;mask-repeat:no-repeat;mask-position:center}";
|
|
7360
10198
|
const LidoHomeStyle0 = indexCss;
|
|
7361
10199
|
|
|
7362
|
-
const animationCss = "@keyframes rightToPlace{from{transform:translateX(2000px)}to{transform:translateX(0)}}@keyframes topToPlace{from{transform:translateY(-1000px)}to{transform:translateY(0)}}@keyframes bottomToPlace{from{transform:translateY(1000px)}to{transform:translateY(0)}}@keyframes placeToLeft{from{}to{transform:translateX(-2000px)}}@keyframes leftToPlace{from{transform:translateX(-2000px)}to{transform:translateX(0)}}@keyframes shake{0%{transform:translateX(0)}10%{transform:translateX(-5px)}20%{transform:translateX(5px)}30%{transform:translateX(-5px)}40%{transform:translateX(5px)}50%{transform:translateX(-5px)}60%{transform:translateX(5px)}70%{transform:translateX(-5px)}80%{transform:translateX(5px)}90%{transform:translateX(-5px)}100%{transform:translateX(0)}}@keyframes fallAndBounce{0%{transform:translateY(-1000px)}25%{transform:translateY(0px)}50%{transform:translateY(-200px)}75%{transform:translateY(0)}90%{transform:translateY(-100px)}100%{transform:translateY(0)}}@keyframes placeToDown{0%{transform:translateY(0)}100%{transform:translateY(1000px)}}@keyframes strongShake{0%{transform:translateX(0)}20%{transform:translateX(-8px)}40%{transform:translateX(8px)}60%{transform:translateX(-6px)}80%{transform:translateX(6px)}100%{transform:translateX(0)}}@keyframes scaledShake{0%{transform:scale(1) translateX(0);box-shadow:0 0 0 transparent}20%{transform:scale(1.10) translateX(-12px);box-shadow:0 0 10px red}40%{transform:scale(1.10) translateX(12px);box-shadow:0 0 12px red}60%{transform:scale(1.10) translateX(-8px);box-shadow:0 0 10px red}80%{transform:scale(1.10) translateX(8px);box-shadow:0 0 12px red}100%{transform:scale(1) translateX(0);box-shadow:none}}@keyframes horizontalShake{0%{transform:scale(1) translateX(0);background-color:transparent}20%{transform:translateX(-20px);background-color:rgba(255, 0, 0, 0.2)}40%{transform:translateX(20px);background-color:rgba(255, 0, 0, 0.4)}60%{transform:translateX(-10px);background-color:rgba(255, 0, 0, 0.3)}80%{transform:translateX(10px);background-color:rgba(255, 0, 0, 0.2)}100%{transform:translateX(0);background-color:transparent}}@keyframes verticalShake{0%{transform:translateY(0);background-color:transparent}20%{transform:translateY(-20px);background-color:rgba(255, 0, 0, 0.2)}40%{transform:translateY(0);background-color:rgba(255, 0, 0, 0.4)}60%{transform:translateY(20px);background-color:rgba(255, 0, 0, 0.2)}80%{transform:translateY(0);background-color:rgba(255, 0, 0, 0.1)}100%{transform:translateY(0);background-color:transparent}}@keyframes diagonalShake{0%{transform:translate(0, 0);background-color:transparent}25%{transform:translate(20px, -20px);background-color:rgba(255, 0, 0, 0.2)}50%{transform:translate(-20px, 20px);background-color:rgba(255, 0, 0, 0.3)}75%{transform:translate(10px, -10px);background-color:rgba(255, 0, 0, 0.2)}100%{transform:translate(0, 0);background-color:transparent}}@keyframes glowPulse{0%{filter:drop-shadow(0 0 5px yellow)\n drop-shadow(0 0 10px yellow)\n drop-shadow(0 0 20px yellow)\n drop-shadow(0 0 30px orange)}50%{filter:drop-shadow(0 0 10px yellow)\n drop-shadow(0 0 20px yellow)\n drop-shadow(0 0 40px yellow)\n drop-shadow(0 0 50px orange)}100%{filter:drop-shadow(0 0 5px yellow)\n drop-shadow(0 0 10px yellow)\n drop-shadow(0 0 20px yellow)\n drop-shadow(0 0 30px orange)}}";
|
|
10200
|
+
const animationCss = "@keyframes rightToPlace{from{transform:translateX(2000px)}to{transform:translateX(0)}}@keyframes topToPlace{from{transform:translateY(-1000px)}to{transform:translateY(0)}}@keyframes bottomToPlace{from{transform:translateY(1000px)}to{transform:translateY(0)}}@keyframes placeToLeft{from{}to{transform:translateX(-2000px)}}@keyframes leftToPlace{from{transform:translateX(-2000px)}to{transform:translateX(0)}}@keyframes shake{0%{transform:translateX(0)}10%{transform:translateX(-5px)}20%{transform:translateX(5px)}30%{transform:translateX(-5px)}40%{transform:translateX(5px)}50%{transform:translateX(-5px)}60%{transform:translateX(5px)}70%{transform:translateX(-5px)}80%{transform:translateX(5px)}90%{transform:translateX(-5px)}100%{transform:translateX(0)}}@keyframes fallAndBounce{0%{transform:translateY(-1000px)}25%{transform:translateY(0px)}50%{transform:translateY(-200px)}75%{transform:translateY(0)}90%{transform:translateY(-100px)}100%{transform:translateY(0)}}@keyframes placeToDown{0%{transform:translateY(0)}100%{transform:translateY(1000px)}}@keyframes strongShake{0%{transform:translateX(0)}20%{transform:translateX(-8px)}40%{transform:translateX(8px)}60%{transform:translateX(-6px)}80%{transform:translateX(6px)}100%{transform:translateX(0)}}@keyframes scaledShake{0%{transform:scale(1) translateX(0);box-shadow:0 0 0 transparent}20%{transform:scale(1.10) translateX(-12px);box-shadow:0 0 10px red}40%{transform:scale(1.10) translateX(12px);box-shadow:0 0 12px red}60%{transform:scale(1.10) translateX(-8px);box-shadow:0 0 10px red}80%{transform:scale(1.10) translateX(8px);box-shadow:0 0 12px red}100%{transform:scale(1) translateX(0);box-shadow:none}}@keyframes horizontalShake{0%{transform:scale(1) translateX(0);background-color:transparent}20%{transform:translateX(-20px);background-color:rgba(255, 0, 0, 0.2)}40%{transform:translateX(20px);background-color:rgba(255, 0, 0, 0.4)}60%{transform:translateX(-10px);background-color:rgba(255, 0, 0, 0.3)}80%{transform:translateX(10px);background-color:rgba(255, 0, 0, 0.2)}100%{transform:translateX(0);background-color:transparent}}@keyframes verticalShake{0%{transform:translateY(0);background-color:transparent}20%{transform:translateY(-20px);background-color:rgba(255, 0, 0, 0.2)}40%{transform:translateY(0);background-color:rgba(255, 0, 0, 0.4)}60%{transform:translateY(20px);background-color:rgba(255, 0, 0, 0.2)}80%{transform:translateY(0);background-color:rgba(255, 0, 0, 0.1)}100%{transform:translateY(0);background-color:transparent}}@keyframes diagonalShake{0%{transform:translate(0, 0);background-color:transparent}25%{transform:translate(20px, -20px);background-color:rgba(255, 0, 0, 0.2)}50%{transform:translate(-20px, 20px);background-color:rgba(255, 0, 0, 0.3)}75%{transform:translate(10px, -10px);background-color:rgba(255, 0, 0, 0.2)}100%{transform:translate(0, 0);background-color:transparent}}@keyframes glowPulse{0%{filter:drop-shadow(0 0 5px yellow)\r\n drop-shadow(0 0 10px yellow)\r\n drop-shadow(0 0 20px yellow)\r\n drop-shadow(0 0 30px orange)}50%{filter:drop-shadow(0 0 10px yellow)\r\n drop-shadow(0 0 20px yellow)\r\n drop-shadow(0 0 40px yellow)\r\n drop-shadow(0 0 50px orange)}100%{filter:drop-shadow(0 0 5px yellow)\r\n drop-shadow(0 0 10px yellow)\r\n drop-shadow(0 0 20px yellow)\r\n drop-shadow(0 0 30px orange)}}";
|
|
7363
10201
|
const LidoHomeStyle1 = animationCss;
|
|
7364
10202
|
|
|
7365
10203
|
const lidoHomeCss = ".lido-snackbar{visibility:visible;min-width:250px;background-color:#333;color:#fff;text-align:center;border-radius:2px;padding:16px;position:fixed;z-index:1;bottom:30px;left:50%;transform:translateX(-50%);font-size:17px}.lido-dot-container{display:flex;justify-content:space-between;align-items:center;visibility:hidden;position:absolute;left:50%;padding:0 5px;z-index:1;width:100vw;max-width:100vw;box-sizing:border-box;height:0px}.lido-dot{height:18px;width:18px;margin:0 4px;background-color:#bbb;border-radius:50%;display:inline-block;transition:background-color 0.3s;cursor:pointer;z-index:1}.lido-btn-dot-container{flex-shrink:1;flex-grow:1;display:flex;justify-content:center;align-items:center;text-align:center;z-index:1;min-width:0;height:0px}.lido-dot.completed{background-color:grey}.lido-dot.current{background-color:green}.lido-dot:not(.completed):not(.current){background-color:#bbb}#lido-arrow-left,#lido-arrow-right{width:88px;height:88px;display:flex;align-items:center;justify-content:center;border-radius:12px;z-index:1000;box-shadow:0px 8px 0px 0px #8b310f;background-color:#f34d08;cursor:pointer;visibility:hidden;flex-shrink:0}#lido-arrow-left:active,#lido-arrow-right:active{transform:translateY(8px);box-shadow:0px 0px 0px 0px}.navbar{display:flex;justify-content:center}.lido-exit-button,#main-audio{width:80px;height:80px;z-index:1000;cursor:pointer;background-color:white;display:flex;align-items:center;justify-content:center;border:4px solid #f34d08;border-radius:16px;box-shadow:0px 8px #f34d08;flex-shrink:0;}#main-audio:active,.popup-button:active .lido-exit-button:active{margin-bottom:-8px;box-shadow:0px 0px 0px 0px !important}.lido-alert-popup{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0, 0, 0, 0.5);display:flex;align-items:center;justify-content:center;z-index:1000}@media (max-width: 768px){#lido-arrow-left,#lido-arrow-right{width:70px;height:70px;margin:0 8px}.lido-exit-button,#main-audio{width:65px;height:65px;margin:0 8px}.lido-dot{height:16px;width:16px;margin:0 2.5px}}@media (max-width: 480px){#lido-arrow-left,#lido-arrow-right{width:74px;height:74px;margin:0px 5px}.lido-exit-button,#main-audio{width:65px;height:65px;margin:0px 5px}.lido-dot{height:15px;width:15px;margin:0 1.5px}.lido-dot-container{padding:0 3px}}@media (max-width: 375px){#lido-arrow-left,#lido-arrow-right{width:70px;height:70px;margin:0px 3px}.lido-exit-button,#main-audio{width:70px;height:70px;margin:0px 3px}.lido-dot{height:14px;width:14px;margin:0 1px}.lido-dot-container{padding:0 2px}}@media (max-width: 320px){#lido-arrow-left,#lido-arrow-right,.lido-exit-button,#main-audio{width:70px;height:70px;margin:0px 2px}.lido-dot{height:12px;width:12px;margin:0 0.5px}.lido-dot-container{padding:0 2px}}@media (max-width: 900px) and (orientation: landscape){#lido-arrow-left,#lido-arrow-right{width:70px;height:70px;margin:0px 5px}.lido-exit-button,#main-audio{width:70px;height:70px;margin:0px 5px}.lido-dot{height:14px;width:14px;margin:0 1px}.lido-dot-container{padding:0 5px}}.popup-exit-text{white-space:nowrap;font-size:22px;font-weight:600;margin-top:-8%}.lido-alert-parent{z-index:10000 !important;position:absolute;top:0;left:0}.popup-button{width:80px;height:80px;z-index:1000;cursor:pointer;display:flex;align-items:center;justify-content:center;border:4px solid #F34D08;border-radius:16px;box-shadow:0 8px 0 #F34D08}.nav-for-lanai{position:absolute;top:0%;left:0%;max-width:none;width:100%;height:auto;visibility:visible}";
|
|
@@ -7422,6 +10260,8 @@ const LidoHome = class {
|
|
|
7422
10260
|
};
|
|
7423
10261
|
// update arrow visibility
|
|
7424
10262
|
this.updateArrowVisibility = () => {
|
|
10263
|
+
if (!this.showNav)
|
|
10264
|
+
return;
|
|
7425
10265
|
setTimeout(() => {
|
|
7426
10266
|
const containerElement = this.el.querySelector('lido-container');
|
|
7427
10267
|
if (!containerElement)
|
|
@@ -7462,6 +10302,9 @@ const LidoHome = class {
|
|
|
7462
10302
|
}
|
|
7463
10303
|
}
|
|
7464
10304
|
};
|
|
10305
|
+
this.showNav = true;
|
|
10306
|
+
this.activeContainerIndexes = [];
|
|
10307
|
+
this.locale = '';
|
|
7465
10308
|
this.xmlData = '';
|
|
7466
10309
|
this.initialIndex = 0;
|
|
7467
10310
|
this.canplay = true;
|
|
@@ -7479,6 +10322,17 @@ const LidoHome = class {
|
|
|
7479
10322
|
this.containers = [];
|
|
7480
10323
|
this.showDotsandbtn = false;
|
|
7481
10324
|
}
|
|
10325
|
+
onLangChange(newLang) {
|
|
10326
|
+
this.setLanguage(newLang);
|
|
10327
|
+
// re-render all containers with updated locale
|
|
10328
|
+
this.containers = [...this.containers];
|
|
10329
|
+
}
|
|
10330
|
+
setLanguage(lang) {
|
|
10331
|
+
const effectiveLang = lang || instance.language; // fallback to current
|
|
10332
|
+
instance.changeLanguage(effectiveLang);
|
|
10333
|
+
// Trigger re-render of containers to update <lido-text> dynamically
|
|
10334
|
+
this.containers = [...this.containers];
|
|
10335
|
+
}
|
|
7482
10336
|
/**
|
|
7483
10337
|
* Lifecycle method that runs before the component is loaded. It sets up event listeners for transitioning
|
|
7484
10338
|
* between containers and parses the XML data into containers.
|
|
@@ -7634,6 +10488,9 @@ const LidoHome = class {
|
|
|
7634
10488
|
return null;
|
|
7635
10489
|
})
|
|
7636
10490
|
.filter(Boolean);
|
|
10491
|
+
if (tagName === 'lido-text' && props.string) {
|
|
10492
|
+
props.string = instance.t(props.string);
|
|
10493
|
+
}
|
|
7637
10494
|
// Map XML tags to Stencil components
|
|
7638
10495
|
const componentMapping = {
|
|
7639
10496
|
'lido-container': (index.h("lido-container", Object.assign({}, props, { canplay: this.canplay, baseUrl: this.baseUrl, height: this.height }), children)),
|
|
@@ -7655,6 +10512,7 @@ const LidoHome = class {
|
|
|
7655
10512
|
'lido-math-matrix': index.h("lido-math-matrix", Object.assign({}, props), children),
|
|
7656
10513
|
'lido-balance': index.h("lido-balance", Object.assign({}, props), children),
|
|
7657
10514
|
'lido-calculator': index.h("lido-calculator", Object.assign({}, props), children),
|
|
10515
|
+
'lido-canvas': index.h("lido-canvas", Object.assign({}, props), children),
|
|
7658
10516
|
};
|
|
7659
10517
|
// If the tag is known, return the corresponding Stencil component, otherwise log a warning
|
|
7660
10518
|
if (componentMapping[tagName]) {
|
|
@@ -7672,11 +10530,15 @@ const LidoHome = class {
|
|
|
7672
10530
|
*/
|
|
7673
10531
|
parseContainers(rootElement) {
|
|
7674
10532
|
const containerElements = rootElement.querySelectorAll('lido-container');
|
|
7675
|
-
const containers = Array.from(containerElements).map(container => {
|
|
10533
|
+
const containers = Array.from(containerElements).map((container, index) => {
|
|
10534
|
+
console.log("nammadhaaaaaaa", this.activeContainerIndexes.length && !this.activeContainerIndexes.includes(index));
|
|
10535
|
+
if (this.activeContainerIndexes.length && !this.activeContainerIndexes.includes(index))
|
|
10536
|
+
return;
|
|
7676
10537
|
// Return a factory function that generates a fresh JSX node each time
|
|
7677
10538
|
return () => this.parseElement(container);
|
|
7678
|
-
});
|
|
10539
|
+
}).filter(Boolean); // Remove any undefined entries
|
|
7679
10540
|
this.containers = containers;
|
|
10541
|
+
console.log("container :::", containers);
|
|
7680
10542
|
}
|
|
7681
10543
|
async btnpopup() {
|
|
7682
10544
|
utils.setCancelBtnPopup(false);
|
|
@@ -7732,17 +10594,17 @@ const LidoHome = class {
|
|
|
7732
10594
|
*/
|
|
7733
10595
|
renderDots() {
|
|
7734
10596
|
const style = { pointerEvents: this.canplay ? 'none' : '' };
|
|
7735
|
-
return (index.h("div", { id: "lido-dot-indicator", class: "lido-dot-container" }, index.h("div", { class: "lido-exit-button popup\n -button", onClick: () => {
|
|
10597
|
+
return (index.h("div", { id: "lido-dot-indicator", class: "lido-dot-container" }, index.h("div", { class: "lido-exit-button popup\r\n -button", onClick: () => {
|
|
7736
10598
|
this.exitFlag = true;
|
|
7737
10599
|
utils.AudioPlayer.getI().stop();
|
|
7738
|
-
} }, index.h("lido-image", { src: this.navBarIcons.exit })), index.h("div", { class: "lido-btn-dot-container" }, index.h("div", { id: "lido-arrow-left", onClick: () => {
|
|
10600
|
+
}, style: { visibility: this.showNav ? "visible" : "hidden" } }, index.h("lido-image", { src: this.navBarIcons.exit })), index.h("div", { class: "lido-btn-dot-container" }, index.h("div", { id: "lido-arrow-left", onClick: () => {
|
|
7739
10601
|
utils.triggerPrevcontainer();
|
|
7740
|
-
} }, index.h("lido-image", { src: this.navBarIcons.prev })), this.containers.map((_, index$1) => (index.h("div", { class: "parent_dots" }, index.h("span", { class: `lido-dot ${index$1 < this.currentContainerIndex ? 'completed' : index$1 === this.currentContainerIndex ? 'current' : ''}`, onClick: () => this.jumpToContainer(index$1), style: style })))), index.h("div", { id: "lido-arrow-right", onClick: event => {
|
|
10602
|
+
}, style: { visibility: this.showNav ? "visible" : "hidden" } }, index.h("lido-image", { src: this.navBarIcons.prev })), this.containers.map((_, index$1) => (index.h("div", { class: "parent_dots" }, index.h("span", { class: `lido-dot ${index$1 < this.currentContainerIndex ? 'completed' : index$1 === this.currentContainerIndex ? 'current' : ''}`, onClick: () => this.jumpToContainer(index$1), style: style })))), index.h("div", { id: "lido-arrow-right", onClick: event => {
|
|
7741
10603
|
console.log('Target:', event.target); // What was clicked
|
|
7742
10604
|
console.log('Current Target:', event.currentTarget); // Where the onClick is bound
|
|
7743
10605
|
console.log('✅ Button clicked - nextBtn action triggered');
|
|
7744
10606
|
utils.executeActions("this.nextBtn='true'", event.currentTarget);
|
|
7745
|
-
} }, index.h("lido-image", { src: this.navBarIcons.next }))), index.h("div", { id: "main-audio", class: "popup-button", onClick: () => this.btnpopup() }, index.h("lido-image", { visible: "true", src: this.navBarIcons.speak }))));
|
|
10607
|
+
}, style: { visibility: this.showNav ? "visible" : "hidden" } }, index.h("lido-image", { src: this.navBarIcons.next }))), index.h("div", { id: "main-audio", class: "popup-button", onClick: () => this.btnpopup(), style: { visibility: this.showNav ? "visible" : "hidden" } }, index.h("lido-image", { visible: "true", src: this.navBarIcons.speak }))));
|
|
7746
10608
|
}
|
|
7747
10609
|
/**
|
|
7748
10610
|
* Jumps to a specific container based on the index of the dot clicked.
|
|
@@ -7764,10 +10626,11 @@ const LidoHome = class {
|
|
|
7764
10626
|
const style = {
|
|
7765
10627
|
userSelect: 'none', // Prevent any field selection
|
|
7766
10628
|
};
|
|
7767
|
-
return (index.h(index.Host, { class: "lido-home", uuid: this.uuid, index: this.currentContainerIndex, totalIndex: this.containers.length, style: style }, index.h("div", { key: this.currentContainerIndex }, (_b = (_a = this.containers)[this.currentContainerIndex]) === null || _b === void 0 ? void 0 : _b.call(_a)), this.renderDots(), this.exitFlag && (index.h("div", { class: "lido-alert-parent" }, index.h("div", { class: "lido-alert-popup" }, index.h("lido-cell", { class: "lido-alert-content", visible: "true", layout: "col", width: "340px", height: "210px", "bg-color": "#fff", "border-radius": "16px", onEntry: "this.box-shadow= '0 4px 8px 0 rgba(0, 0, 0, 0.25)';" }, index.h("lido-text", { visible: "true", string: "
|
|
10629
|
+
return (index.h(index.Host, { class: "lido-home", uuid: this.uuid, index: this.currentContainerIndex, totalIndex: this.containers.length, style: style }, index.h("div", { key: this.currentContainerIndex }, (_b = (_a = this.containers)[this.currentContainerIndex]) === null || _b === void 0 ? void 0 : _b.call(_a)), this.renderDots(), this.exitFlag && (index.h("div", { class: "lido-alert-parent" }, index.h("div", { class: "lido-alert-popup" }, index.h("lido-cell", { class: "lido-alert-content", visible: "true", layout: "col", width: "340px", height: "210px", "bg-color": "#fff", "border-radius": "16px", onEntry: "this.box-shadow= '0 4px 8px 0 rgba(0, 0, 0, 0.25)';" }, index.h("lido-text", { visible: "true", string: "Do you want to exit?", width: "294px", height: "38px", class: "popup-exit-text", "font-size": "22px", onEntry: "this.margin-bottom =' -36px';" }), index.h("lido-cell", { visible: "true", layout: "row", width: "294px", class: "btn-cell" }, index.h("lido-text", { visible: "true", string: "Exit", width: "92px", height: "53px", "font-size": "16px", margin: "0px 50px 0px 0px", class: "popup-button", onClick: () => this.popUpClick('exit'), borderRadius: "16px", onEntry: 'this.color="#F34D08"; this.font-weight="700"; this.box-shadow="0 2px 0 #F34D08";', fontFamily: "Baloo Bhai 2", "font-weight": "700", bgColor: "white", "border-radius": "16px" }), index.h("lido-text", { visible: "true", string: "Continue playing", width: "155px", height: "53px", "font-size": "16px", class: "popup-button", onClick: () => this.popUpClick('cancel'), borderRadius: "16px", onEntry: 'this.color=white; this.font-weight="700"; this.box-shadow="0 2px 0 #F34D08";', "font-family": "Baloo Bhai 2", "font-weight": "700", bgColor: "#F34D08", "border-radius": "16px" }))))))));
|
|
7768
10630
|
}
|
|
7769
10631
|
get el() { return index.getElement(this); }
|
|
7770
10632
|
static get watchers() { return {
|
|
10633
|
+
"locale": ["onLangChange"],
|
|
7771
10634
|
"xmlData": ["onXmlDataChange"]
|
|
7772
10635
|
}; }
|
|
7773
10636
|
};
|
|
@@ -10696,10 +13559,10 @@ const LidoKeyboard = class {
|
|
|
10696
13559
|
const keysArray = this.keys.split(',').map(k => k.trim());
|
|
10697
13560
|
const container = document.getElementById(utils.LidoContainer);
|
|
10698
13561
|
const showCheck = container.getAttribute('show-check') === 'true';
|
|
10699
|
-
return (index.h(index.Host, { key: '
|
|
13562
|
+
return (index.h(index.Host, { key: '030937c20c1e5652a528e9f5e3335faafe18fff1', class: "lido-keyboard", style: { width: this.style.width, height: this.style.height, position: 'relative', margin: this.style.margin, zIndex: this.z } }, this.keyboardInput && (index.h("div", { key: '4c928db14ba00f8aa20dcdb9e220f0486949e861', class: "input-area" }, index.h("input", { key: 'f8db5e6f76aba08fb5893fd3fff7e6739dd5f854', type: "text", value: this.inputString, class: "input-area", readonly: true, onInput: (e) => (this.inputString = e.target.value) }), index.h("lido-text", { key: '58156eabbdd1fe9d06fa0ff3e192ab0f434fcd9e', visible: showCheck ? 'true' : 'false', string: "<<", "bg-color": "black", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "100px", height: "70px", type: "click", onClick: () => {
|
|
10700
13563
|
this.inputString = this.inputString.slice(0, -1);
|
|
10701
13564
|
this.inputValidation(event);
|
|
10702
|
-
} }), index.h("lido-text", { key: '
|
|
13565
|
+
} }), index.h("lido-text", { key: '79538fe14d2645dc7ae62f4e24da2300a680b1cc', visible: showCheck ? 'true' : 'false', id: "lido-checkButton", string: "Enter", "bg-color": "green", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "150px", height: "70px", type: "click" }))), this.letterLength && (index.h("lido-text", { key: '0d09084f44fe8a69e19006daccd1029e291b43e5', visible: "true", string: `${this.numberOfClick}/${this.letterLength}`, "font-size": "60px", "font-color": "white", onEntry: "this.position='absolute'; this.right='0'; this.fontWeight='800';", x: "unset" })), index.h("div", { key: '9b2686af38ffed8e792f93f8302f01d59dbd2748', class: "keyboard-wrapper", style: {
|
|
10703
13566
|
display: 'flex',
|
|
10704
13567
|
flexWrap: 'wrap',
|
|
10705
13568
|
justifyContent: 'center',
|
|
@@ -10757,6 +13620,9 @@ const LidoMathMatrix = class {
|
|
|
10757
13620
|
this.fontColor = undefined;
|
|
10758
13621
|
this.previousFilledSlot = -1;
|
|
10759
13622
|
this.previousFilledSlotElement = null;
|
|
13623
|
+
this.onCorrect = undefined;
|
|
13624
|
+
this.onInCorrect = undefined;
|
|
13625
|
+
this.onEntry = undefined;
|
|
10760
13626
|
this.style = {};
|
|
10761
13627
|
}
|
|
10762
13628
|
updateValue(index) {
|
|
@@ -10909,14 +13775,14 @@ const LidoMathMatrix = class {
|
|
|
10909
13775
|
render() {
|
|
10910
13776
|
let slotNumber = 1;
|
|
10911
13777
|
const slotData = this.getSlotData();
|
|
10912
|
-
return (index.h(index.Host, { key: '
|
|
13778
|
+
return (index.h(index.Host, { key: '8232965fc3fb0b298233d21d7f50412508dc2256', class: "math-matrix", style: {
|
|
10913
13779
|
height: this.style.height,
|
|
10914
13780
|
width: this.style.width,
|
|
10915
13781
|
z: this.style.z,
|
|
10916
13782
|
display: this.style.display,
|
|
10917
13783
|
top: this.style.top,
|
|
10918
13784
|
left: this.style.left,
|
|
10919
|
-
}, type: this.type, value: this.value, "tab-index": this.tabIndex, rows: this.style.rows, cols: this.style.cols, text: this.text }, Array.from({ length: parseInt(this.style.rows) + 1 }, (_, rowIndex) => (index.h("div", { class: "slot-parent", key: `row-${rowIndex}` }, index.h("div", { style: rowIndex === 0 && { visibility: 'hidden' }, class: "topIndex" }, rowIndex), Array.from({ length: parseInt(this.style.cols) }, (_, colIndex) => {
|
|
13785
|
+
}, type: this.type, value: this.value, "tab-index": this.tabIndex, rows: this.style.rows, cols: this.style.cols, text: this.text, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry }, Array.from({ length: parseInt(this.style.rows) + 1 }, (_, rowIndex) => (index.h("div", { class: "slot-parent", key: `row-${rowIndex}` }, index.h("div", { style: rowIndex === 0 && { visibility: 'hidden' }, class: "topIndex" }, rowIndex), Array.from({ length: parseInt(this.style.cols) }, (_, colIndex) => {
|
|
10920
13786
|
var _a, _b;
|
|
10921
13787
|
return rowIndex === 0 ? (index.h("div", { class: "leftIndex" }, ++colIndex)) : (index.h("div", { class: `slot slot-${slotNumber} ${this.defualtFill >= slotNumber ? 'slot-active' : 'slot-inactive'}`, onClick: (ev) => this.handleClickSlot(ev.currentTarget), key: `slot-${rowIndex}-${colIndex}`, style: {
|
|
10922
13788
|
borderRadius: this.style.borderRadius,
|
|
@@ -10992,7 +13858,7 @@ const LidoPos = class {
|
|
|
10992
13858
|
};
|
|
10993
13859
|
}
|
|
10994
13860
|
render() {
|
|
10995
|
-
return (index.h(index.Host, { key: '
|
|
13861
|
+
return (index.h(index.Host, { key: '0eea8147ee3845668e83bed01164dce740aae785', id: this.id, class: "lido-pos", type: this.type, "tab-index": this.tabIndex, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, minDrops: this.minDrops, maxDrops: this.maxDrops, value: this.value, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry }, index.h("slot", { key: 'ca9378dc185eeb4d495ab3045d6b17424de908dc' })));
|
|
10996
13862
|
}
|
|
10997
13863
|
get el() { return index.getElement(this); }
|
|
10998
13864
|
};
|
|
@@ -11073,7 +13939,7 @@ const LidoRandom = class {
|
|
|
11073
13939
|
backgroundColor: this.bgColor,
|
|
11074
13940
|
margin: this.margin,
|
|
11075
13941
|
};
|
|
11076
|
-
return (index.h(index.Host, { key: '
|
|
13942
|
+
return (index.h(index.Host, { key: 'cc8bb9d31ff6c36201d266f5579288c92c05bf82', class: "lido-random", type: this.type, "tab-index": this.tabIndex, value: this.value, style: style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, minDrops: this.minDrops, maxDrops: this.maxDrops, onInCorrect: this.onInCorrect, onEntry: this.onEntry }, index.h("slot", { key: 'd91a2403fa78320cbae40456dc0c86b44493bb5a' })));
|
|
11077
13943
|
}
|
|
11078
13944
|
get el() { return index.getElement(this); }
|
|
11079
13945
|
};
|
|
@@ -11082,6 +13948,7 @@ LidoRandom.style = LidoRandomStyle0;
|
|
|
11082
13948
|
const LidoRoot = class {
|
|
11083
13949
|
constructor(hostRef) {
|
|
11084
13950
|
index.registerInstance(this, hostRef);
|
|
13951
|
+
this.locale = '';
|
|
11085
13952
|
this.xmlPath = '';
|
|
11086
13953
|
this.initialIndex = 0;
|
|
11087
13954
|
this.margin = '';
|
|
@@ -11097,6 +13964,16 @@ const LidoRoot = class {
|
|
|
11097
13964
|
* Lifecycle method that runs before the component is loaded.
|
|
11098
13965
|
* It fetches the XML data from the specified path or URL and sets it to the component's state.
|
|
11099
13966
|
*/
|
|
13967
|
+
connectedCallback() {
|
|
13968
|
+
this.setLanguage(this.locale);
|
|
13969
|
+
}
|
|
13970
|
+
onLangChange(newLang) {
|
|
13971
|
+
this.setLanguage(newLang);
|
|
13972
|
+
}
|
|
13973
|
+
setLanguage(lang) {
|
|
13974
|
+
const effectiveLang = lang || instance.language;
|
|
13975
|
+
instance.changeLanguage(effectiveLang);
|
|
13976
|
+
}
|
|
11100
13977
|
async componentWillLoad() {
|
|
11101
13978
|
var _a, _b;
|
|
11102
13979
|
// Validate the xmlPath prop
|
|
@@ -11136,9 +14013,12 @@ const LidoRoot = class {
|
|
|
11136
14013
|
return index.h("div", null, "Error loading XML data. Please check the path or URL.");
|
|
11137
14014
|
}
|
|
11138
14015
|
// Once the XML data is loaded, pass it to the `lido-home` component
|
|
11139
|
-
return index.h("lido-home", { initialIndex: this.initialIndex, canplay: this.canplay, xmlData: this.xmlData, baseUrl: this.baseUrl, exitButtonUrl: this.exitButtonUrl, prevButtonUrl: this.prevButtonUrl, nextButtonUrl: this.nextButtonUrl, speakerButtonUrl: this.speakerButtonUrl });
|
|
14016
|
+
return index.h("lido-home", { showNav: true, activeContainerIndexes: [], initialIndex: this.initialIndex, canplay: this.canplay, xmlData: this.xmlData, baseUrl: this.baseUrl, exitButtonUrl: this.exitButtonUrl, prevButtonUrl: this.prevButtonUrl, nextButtonUrl: this.nextButtonUrl, speakerButtonUrl: this.speakerButtonUrl });
|
|
11140
14017
|
}
|
|
11141
14018
|
static get assetsDirs() { return ["assets"]; }
|
|
14019
|
+
static get watchers() { return {
|
|
14020
|
+
"locale": ["onLangChange"]
|
|
14021
|
+
}; }
|
|
11142
14022
|
};
|
|
11143
14023
|
|
|
11144
14024
|
const lidoRowCss = ".lido-row{display:flex;justify-content:space-around;align-items:center;}.lido-row>*{}";
|
|
@@ -11217,7 +14097,7 @@ const LidoRow = class {
|
|
|
11217
14097
|
};
|
|
11218
14098
|
}
|
|
11219
14099
|
render() {
|
|
11220
|
-
return (index.h(index.Host, { key: '
|
|
14100
|
+
return (index.h(index.Host, { key: '2d2f701dda922276d2485e91f15c8912c90d7b8d', class: "lido-row", type: this.type, "tab-index": this.tabIndex, value: this.value, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, minDrops: this.minDrops, maxDrops: this.maxDrops, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, "disable-speak": this.disableSpeak }, index.h("slot", { key: 'b00002ecc9d5de422094beffc33ae5137b958fa3' })));
|
|
11221
14101
|
}
|
|
11222
14102
|
get el() { return index.getElement(this); }
|
|
11223
14103
|
};
|
|
@@ -11274,7 +14154,7 @@ const LidoShape = class {
|
|
|
11274
14154
|
backgroundColor: this.shapeType !== 'polygon' ? this.bgColor : 'transparent', // Apply background only if not a polygon
|
|
11275
14155
|
margin: this.margin,
|
|
11276
14156
|
};
|
|
11277
|
-
return (index.h(index.Host, { key: '
|
|
14157
|
+
return (index.h(index.Host, { key: '7a626d9f00854cf190c08524153086d0e9f139af', class: `lido-shape ${this.shapeType}`, value: this.value, type: this.type, "tab-index": this.tabIndex, style: style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, minDrops: this.minDrops, maxDrops: this.maxDrops, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, "disable-speak": this.disableSpeak }));
|
|
11278
14158
|
}
|
|
11279
14159
|
get el() { return index.getElement(this); }
|
|
11280
14160
|
};
|
|
@@ -11342,13 +14222,13 @@ const LidoSlideFill = class {
|
|
|
11342
14222
|
const id = pathIndex === 1 ? 'glassPath' : pathIndex === 2 ? 'rulerPath' : `path${pathIndex}`;
|
|
11343
14223
|
return `<path id="${id}"${attrs}>`;
|
|
11344
14224
|
});
|
|
11345
|
-
const clipPathDef = `
|
|
11346
|
-
<clipPath id="clipGlass">
|
|
11347
|
-
<use xlink:href="#glassPath" />
|
|
11348
|
-
</clipPath>
|
|
14225
|
+
const clipPathDef = `
|
|
14226
|
+
<clipPath id="clipGlass">
|
|
14227
|
+
<use xlink:href="#glassPath" />
|
|
14228
|
+
</clipPath>
|
|
11349
14229
|
`;
|
|
11350
|
-
svgText = svgText.replace(/<svg([^>]*)>/, `<svg$1>
|
|
11351
|
-
${clipPathDef}
|
|
14230
|
+
svgText = svgText.replace(/<svg([^>]*)>/, `<svg$1>
|
|
14231
|
+
${clipPathDef}
|
|
11352
14232
|
`);
|
|
11353
14233
|
svgText = svgText.replace(/<rect([^>]*)\/?>/, `<rect id="fillArea" $1 clip-path="url(#clipGlass)" />`);
|
|
11354
14234
|
this.svgContent = svgText;
|
|
@@ -11473,7 +14353,7 @@ const LidoSlideFill = class {
|
|
|
11473
14353
|
}
|
|
11474
14354
|
}
|
|
11475
14355
|
render() {
|
|
11476
|
-
return (index.h(index.Host, { key: '
|
|
14356
|
+
return (index.h(index.Host, { key: '3918ed476b3de4977c53ff0bf576253f68e8c84f', id: this.id, class: "lido-slide-fill", src: this.src, fill: this.fill, fillDirection: this.fillDirection, slider: this.slider, style: this.style, min: this.min, max: this.max, division: this.division, numberType: this.numberType, onEntry: this.onEntry, type: this.type, "disable-speak": this.disableSpeak }, index.h("div", { key: '8f54b0e5de490a162aaa1d7ac9ed485d1628c484', innerHTML: this.svgContent, class: "svg-element" })));
|
|
11477
14357
|
}
|
|
11478
14358
|
get el() { return index.getElement(this); }
|
|
11479
14359
|
static get watchers() { return {
|
|
@@ -11608,7 +14488,7 @@ const LidoText = class {
|
|
|
11608
14488
|
}
|
|
11609
14489
|
}
|
|
11610
14490
|
render() {
|
|
11611
|
-
return (index.h(index.Host, { key: '
|
|
14491
|
+
return (index.h(index.Host, { key: '89ed432cbbf1f3ca2cdcaf4df80628350badef6d', class: "lido-text", value: this.value, type: this.type, "tab-index": this.tabIndex, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, minDrops: this.minDrops, maxDrops: this.maxDrops, id: this.id, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, "span-type": this.spanType, "disable-speak": this.disableSpeak }, this.spanType !== '' ? index.h("div", { class: "lido-text-content" }, " ", instance.t(this.string)) : instance.t(this.string)));
|
|
11612
14492
|
}
|
|
11613
14493
|
get el() { return index.getElement(this); }
|
|
11614
14494
|
};
|
|
@@ -12328,7 +15208,7 @@ const LidoTrace = class {
|
|
|
12328
15208
|
};
|
|
12329
15209
|
}
|
|
12330
15210
|
render() {
|
|
12331
|
-
return (index.h(index.Host, { key: '
|
|
15211
|
+
return (index.h(index.Host, { key: '204d2999e3d6f0c36c991566e19608870e287d7a', class: "lido-trace", id: this.id, audio: this.audio, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, tabindex: this.tabIndex, "disable-speak": this.disableSpeak }, index.h("div", { key: '9c97878119641e2efc26fa7d711c7639276417ac', style: this.style, id: "lido-svgContainer" })));
|
|
12332
15212
|
}
|
|
12333
15213
|
static get assetsDirs() { return ["svg", "images"]; }
|
|
12334
15214
|
get el() { return index.getElement(this); }
|
|
@@ -12416,7 +15296,7 @@ const LidoWrap = class {
|
|
|
12416
15296
|
};
|
|
12417
15297
|
}
|
|
12418
15298
|
render() {
|
|
12419
|
-
return (index.h(index.Host, { key: '
|
|
15299
|
+
return (index.h(index.Host, { key: '50bc5770105477d0ef7cb080957c8d00198c8b09', class: "lido-wrap", value: this.value, type: this.type, "tab-index": this.tabIndex, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, minDrops: this.minDrops, maxDrops: this.maxDrops, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, disableSpeak: this.disableSpeak }, index.h("slot", { key: 'fcd1f5801e34171d1925e39f6c543f229a5d42bd' })));
|
|
12420
15300
|
}
|
|
12421
15301
|
get el() { return index.getElement(this); }
|
|
12422
15302
|
};
|
|
@@ -12425,6 +15305,7 @@ LidoWrap.style = LidoWrapStyle0;
|
|
|
12425
15305
|
exports.lido_avatar = LidoAvatar;
|
|
12426
15306
|
exports.lido_balance = LidoBalance;
|
|
12427
15307
|
exports.lido_calculator = LidoCalculator;
|
|
15308
|
+
exports.lido_canvas = LidoCanvas;
|
|
12428
15309
|
exports.lido_cell = LidoCell;
|
|
12429
15310
|
exports.lido_col = LidoCol;
|
|
12430
15311
|
exports.lido_container = LidoContainer;
|