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