@jackuait/blok 0.7.0-beta.4 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blok.mjs +3 -7
- package/dist/chunks/blok-Ufr5cPq-.mjs +12435 -0
- package/dist/chunks/constants-DT17zmu_.mjs +2934 -0
- package/dist/chunks/i18next-DymC16cN.mjs +1146 -0
- package/dist/chunks/i18next-loader-qjweOJ-t.mjs +35 -0
- package/dist/chunks/lightweight-i18n-vbtPx5C4.mjs +105 -0
- package/dist/chunks/messages-3bOAVT3X2.mjs +80 -0
- package/dist/chunks/messages-43N0Vfg42.mjs +80 -0
- package/dist/chunks/messages-B0cg-ThO2.mjs +80 -0
- package/dist/chunks/messages-B3StvafX.mjs +80 -0
- package/dist/chunks/messages-B7LU-b6n2.mjs +80 -0
- package/dist/chunks/messages-B87-89os.mjs +80 -0
- package/dist/chunks/messages-BFiMCfDX2.mjs +80 -0
- package/dist/chunks/messages-BLxyso1L.mjs +80 -0
- package/dist/chunks/messages-BQZtOYxr2.mjs +80 -0
- package/dist/chunks/messages-BRrtoRdw2.mjs +80 -0
- package/dist/chunks/messages-BU_YdaAf.mjs +80 -0
- package/dist/chunks/messages-BWbZYIs12.mjs +80 -0
- package/dist/chunks/messages-B_Qcy8kr2.mjs +80 -0
- package/dist/chunks/messages-B_uTiuQ-.mjs +80 -0
- package/dist/chunks/messages-BdWTM73p.mjs +80 -0
- package/dist/chunks/messages-BhZcNoIQ.mjs +80 -0
- package/dist/chunks/messages-Bn6LwI4B.mjs +80 -0
- package/dist/chunks/messages-BoTtYEct2.mjs +80 -0
- package/dist/chunks/messages-BrvAiuWT.mjs +80 -0
- package/dist/chunks/messages-Byp0YFMg.mjs +80 -0
- package/dist/chunks/messages-C0ZWDShx2.mjs +80 -0
- package/dist/chunks/messages-CA-jms9R.mjs +80 -0
- package/dist/chunks/messages-CFr0Ha6p2.mjs +80 -0
- package/dist/chunks/messages-CG2xl0IV.mjs +80 -0
- package/dist/chunks/messages-CIGX0FfW.mjs +80 -0
- package/dist/chunks/messages-CRMdL0jG.mjs +80 -0
- package/dist/chunks/messages-CRdl14uE.mjs +80 -0
- package/dist/chunks/messages-Cimsel4e.mjs +80 -0
- package/dist/chunks/messages-CjcSWeud.mjs +80 -0
- package/dist/chunks/messages-ClDJuy8K2.mjs +80 -0
- package/dist/chunks/messages-Cn1AC0Qk.mjs +80 -0
- package/dist/chunks/messages-CpnXbVOK2.mjs +80 -0
- package/dist/chunks/messages-CqsES1wk2.mjs +80 -0
- package/dist/chunks/messages-Csq7JatN.mjs +80 -0
- package/dist/chunks/messages-CtufKbaD.mjs +80 -0
- package/dist/chunks/messages-Cuk0QaLM.mjs +80 -0
- package/dist/chunks/messages-CvamFN6x.mjs +80 -0
- package/dist/chunks/messages-CwRhVVui.mjs +80 -0
- package/dist/chunks/messages-CzCezryo.mjs +80 -0
- package/dist/chunks/messages-D0v0Xa_i2.mjs +80 -0
- package/dist/chunks/messages-D3JVx_CH2.mjs +80 -0
- package/dist/chunks/messages-D4jR5Oc-.mjs +80 -0
- package/dist/chunks/messages-D7fI9Pj52.mjs +80 -0
- package/dist/chunks/messages-DGodJU2R.mjs +80 -0
- package/dist/chunks/messages-DLrmLkco2.mjs +80 -0
- package/dist/chunks/messages-DPe7kW6J.mjs +80 -0
- package/dist/chunks/messages-DRYKKPk8.mjs +80 -0
- package/dist/chunks/messages-DV5c_ZRQ.mjs +80 -0
- package/dist/chunks/messages-Dg6kSnxq.mjs +80 -0
- package/dist/chunks/messages-Dgfbmyf-.mjs +80 -0
- package/dist/chunks/messages-DihczS7L.mjs +80 -0
- package/dist/chunks/messages-DkSwQvmi2.mjs +80 -0
- package/dist/chunks/messages-Doxcj7Qy.mjs +80 -0
- package/dist/chunks/messages-DqGQvcXv2.mjs +80 -0
- package/dist/chunks/messages-Dr7yA3xM.mjs +80 -0
- package/dist/chunks/messages-DriB5lEF.mjs +80 -0
- package/dist/chunks/messages-FB_MePlt.mjs +80 -0
- package/dist/chunks/messages-JyZvGvrN.mjs +80 -0
- package/dist/chunks/messages-KdvbGwLH.mjs +80 -0
- package/dist/chunks/messages-M0HT-kBW.mjs +80 -0
- package/dist/chunks/messages-M8noQ6Kp2.mjs +80 -0
- package/dist/chunks/messages-elZUbCrN.mjs +80 -0
- package/dist/chunks/messages-iWMOMK822.mjs +80 -0
- package/dist/chunks/messages-kC92TJI72.mjs +80 -0
- package/dist/chunks/messages-tfyq1JIh2.mjs +80 -0
- package/dist/chunks/messages-v1HkA3kF2.mjs +80 -0
- package/dist/chunks/messages-yuqArCc6.mjs +80 -0
- package/dist/chunks/notifier-BqYxvxnV.mjs +96 -0
- package/dist/chunks/objectSpread2-CyPxu8-u.mjs +62 -0
- package/dist/chunks/tools-CJIETS-H.mjs +6004 -0
- package/dist/chunks/tw-DmW6-pCY.mjs +237 -0
- package/dist/cli.mjs +36 -49
- package/dist/full.mjs +26 -52
- package/dist/locales.mjs +181 -254
- package/dist/messages-2iHnlF0U.mjs +80 -0
- package/dist/messages-49ZJ_ISf.mjs +80 -0
- package/dist/messages-B8jjwMLK.mjs +80 -0
- package/dist/messages-BEDVb3ZX.mjs +80 -0
- package/dist/messages-BEEr6Vh82.mjs +80 -0
- package/dist/messages-BFT0F9pw.mjs +80 -0
- package/dist/messages-BHOI7R4K.mjs +80 -0
- package/dist/messages-BRPH_a6a.mjs +80 -0
- package/dist/messages-BSlQrYwp.mjs +80 -0
- package/dist/messages-BTNuOkhL.mjs +80 -0
- package/dist/messages-BX2KVzJp2.mjs +80 -0
- package/dist/messages-BaGwIHPb2.mjs +80 -0
- package/dist/messages-BdA_xvxj.mjs +80 -0
- package/dist/messages-BeJaje7e2.mjs +80 -0
- package/dist/messages-BfgHOkAy.mjs +80 -0
- package/dist/messages-BflWzIcP2.mjs +80 -0
- package/dist/messages-BigRnQS92.mjs +80 -0
- package/dist/messages-BjnJajTO2.mjs +80 -0
- package/dist/messages-BpA30dPf.mjs +80 -0
- package/dist/messages-BrPEPj382.mjs +80 -0
- package/dist/messages-Bt_9ptDu.mjs +80 -0
- package/dist/messages-C0cXOCHN2.mjs +80 -0
- package/dist/messages-C3tLCwJp2.mjs +80 -0
- package/dist/messages-C45IBZtA2.mjs +80 -0
- package/dist/messages-CA0hwajz.mjs +80 -0
- package/dist/messages-CCKZS2f4.mjs +80 -0
- package/dist/messages-CCm71gq3.mjs +80 -0
- package/dist/messages-CERs9LC9.mjs +80 -0
- package/dist/messages-CLQvtc_8.mjs +80 -0
- package/dist/messages-CPx1R-PH.mjs +80 -0
- package/dist/messages-CYFdbooL2.mjs +80 -0
- package/dist/messages-CYLYnOV82.mjs +80 -0
- package/dist/messages-CYZVFnaF.mjs +80 -0
- package/dist/messages-CaAdEXoh2.mjs +80 -0
- package/dist/messages-CicggErN2.mjs +80 -0
- package/dist/messages-CkAWTSc4.mjs +80 -0
- package/dist/messages-CkVfziK_2.mjs +80 -0
- package/dist/messages-CsM2iz1H2.mjs +80 -0
- package/dist/messages-D-12TeCM2.mjs +80 -0
- package/dist/messages-D0i5Vdyy2.mjs +80 -0
- package/dist/messages-D5KmRsUV2.mjs +80 -0
- package/dist/messages-DBwaWI0X.mjs +80 -0
- package/dist/messages-DDGzypb4.mjs +80 -0
- package/dist/messages-DQGzw4IC.mjs +80 -0
- package/dist/messages-DWZyaZNA.mjs +80 -0
- package/dist/messages-DYlxQEIv.mjs +80 -0
- package/dist/messages-DZo0x7Bd.mjs +80 -0
- package/dist/messages-Dc1yFFBM.mjs +80 -0
- package/dist/messages-DdUpYaJ1.mjs +80 -0
- package/dist/messages-DgstU8GH.mjs +80 -0
- package/dist/messages-DhdWq5oQ2.mjs +80 -0
- package/dist/messages-DmX52AQr.mjs +80 -0
- package/dist/messages-Dr-YJYIK2.mjs +80 -0
- package/dist/messages-DuubRyFf.mjs +80 -0
- package/dist/messages-DvTVsLOK2.mjs +80 -0
- package/dist/messages-DwPfgL_u.mjs +80 -0
- package/dist/messages-DxKIxLKw.mjs +80 -0
- package/dist/messages-DzhR8Klk.mjs +80 -0
- package/dist/messages-MBBSKGjJ2.mjs +80 -0
- package/dist/messages-RNusm48G2.mjs +80 -0
- package/dist/messages-XwPD18Kk.mjs +80 -0
- package/dist/messages-YfjdnhUF.mjs +80 -0
- package/dist/messages-aNMLsF8T2.mjs +80 -0
- package/dist/messages-cOqXp22e.mjs +80 -0
- package/dist/messages-g58itYPI.mjs +80 -0
- package/dist/messages-vfkwiKQo.mjs +80 -0
- package/dist/messages-vssmW7KO.mjs +80 -0
- package/dist/react.mjs +108 -0
- package/dist/tools.mjs +3 -7485
- package/dist/vendor.LICENSE.txt +86 -86
- package/package.json +56 -29
- package/src/blok.ts +52 -2
- package/src/components/block/api.ts +8 -0
- package/src/components/block/mutation-handler.ts +29 -4
- package/src/components/block/style-manager.ts +1 -1
- package/src/components/block-tunes/block-tune-width.ts +39 -0
- package/src/components/blocks.ts +56 -2
- package/src/components/core.ts +1 -0
- package/src/components/i18n/locales/am/messages.json +6 -1
- package/src/components/i18n/locales/ar/messages.json +6 -1
- package/src/components/i18n/locales/az/messages.json +6 -1
- package/src/components/i18n/locales/bg/messages.json +8 -3
- package/src/components/i18n/locales/bn/messages.json +6 -1
- package/src/components/i18n/locales/bs/messages.json +6 -1
- package/src/components/i18n/locales/cs/messages.json +6 -1
- package/src/components/i18n/locales/da/messages.json +6 -1
- package/src/components/i18n/locales/de/messages.json +8 -3
- package/src/components/i18n/locales/dv/messages.json +6 -1
- package/src/components/i18n/locales/el/messages.json +8 -3
- package/src/components/i18n/locales/en/messages.json +5 -0
- package/src/components/i18n/locales/es/messages.json +6 -1
- package/src/components/i18n/locales/et/messages.json +6 -1
- package/src/components/i18n/locales/fa/messages.json +8 -3
- package/src/components/i18n/locales/fi/messages.json +6 -1
- package/src/components/i18n/locales/fil/messages.json +21 -16
- package/src/components/i18n/locales/fr/messages.json +6 -1
- package/src/components/i18n/locales/gu/messages.json +6 -1
- package/src/components/i18n/locales/he/messages.json +6 -1
- package/src/components/i18n/locales/hi/messages.json +6 -1
- package/src/components/i18n/locales/hr/messages.json +6 -1
- package/src/components/i18n/locales/hu/messages.json +6 -1
- package/src/components/i18n/locales/hy/messages.json +8 -3
- package/src/components/i18n/locales/id/messages.json +12 -7
- package/src/components/i18n/locales/it/messages.json +6 -1
- package/src/components/i18n/locales/ja/messages.json +6 -1
- package/src/components/i18n/locales/ka/messages.json +6 -1
- package/src/components/i18n/locales/km/messages.json +6 -1
- package/src/components/i18n/locales/kn/messages.json +6 -1
- package/src/components/i18n/locales/ko/messages.json +6 -1
- package/src/components/i18n/locales/ku/messages.json +7 -2
- package/src/components/i18n/locales/lo/messages.json +7 -2
- package/src/components/i18n/locales/lt/messages.json +6 -1
- package/src/components/i18n/locales/lv/messages.json +6 -1
- package/src/components/i18n/locales/mk/messages.json +6 -1
- package/src/components/i18n/locales/ml/messages.json +6 -1
- package/src/components/i18n/locales/mn/messages.json +6 -1
- package/src/components/i18n/locales/mr/messages.json +6 -1
- package/src/components/i18n/locales/ms/messages.json +6 -1
- package/src/components/i18n/locales/my/messages.json +6 -1
- package/src/components/i18n/locales/ne/messages.json +9 -4
- package/src/components/i18n/locales/nl/messages.json +6 -1
- package/src/components/i18n/locales/no/messages.json +6 -1
- package/src/components/i18n/locales/pa/messages.json +6 -1
- package/src/components/i18n/locales/pl/messages.json +6 -1
- package/src/components/i18n/locales/ps/messages.json +8 -3
- package/src/components/i18n/locales/pt/messages.json +6 -1
- package/src/components/i18n/locales/ro/messages.json +6 -1
- package/src/components/i18n/locales/ru/messages.json +10 -5
- package/src/components/i18n/locales/sd/messages.json +6 -1
- package/src/components/i18n/locales/si/messages.json +6 -1
- package/src/components/i18n/locales/sk/messages.json +6 -1
- package/src/components/i18n/locales/sl/messages.json +6 -1
- package/src/components/i18n/locales/sq/messages.json +6 -1
- package/src/components/i18n/locales/sr/messages.json +6 -1
- package/src/components/i18n/locales/sv/messages.json +6 -1
- package/src/components/i18n/locales/sw/messages.json +6 -1
- package/src/components/i18n/locales/ta/messages.json +6 -1
- package/src/components/i18n/locales/te/messages.json +9 -4
- package/src/components/i18n/locales/th/messages.json +6 -1
- package/src/components/i18n/locales/tr/messages.json +6 -1
- package/src/components/i18n/locales/ug/messages.json +7 -2
- package/src/components/i18n/locales/uk/messages.json +6 -1
- package/src/components/i18n/locales/ur/messages.json +6 -1
- package/src/components/i18n/locales/vi/messages.json +6 -1
- package/src/components/i18n/locales/yi/messages.json +7 -2
- package/src/components/i18n/locales/zh/messages.json +6 -1
- package/src/components/icons/index.ts +16 -0
- package/src/components/inline-tools/inline-tool-link.ts +1 -1
- package/src/components/modules/api/blocks.ts +45 -2
- package/src/components/modules/api/index.ts +1 -0
- package/src/components/modules/api/width.ts +17 -0
- package/src/components/modules/blockEvents/composers/keyboardNavigation.ts +99 -0
- package/src/components/modules/blockEvents/composers/markdownShortcuts.ts +109 -2
- package/src/components/modules/blockEvents/constants.ts +7 -0
- package/src/components/modules/blockManager/blockManager.ts +113 -9
- package/src/components/modules/blockManager/hierarchy.ts +61 -0
- package/src/components/modules/blockManager/operations.ts +133 -15
- package/src/components/modules/blockManager/yjs-sync.ts +112 -4
- package/src/components/modules/blockSelection.ts +36 -2
- package/src/components/modules/crossBlockSelection.ts +22 -2
- package/src/components/modules/drag/DragController.ts +178 -4
- package/src/components/modules/drag/operations/DragOperations.ts +48 -9
- package/src/components/modules/drag/preview/DragPreview.ts +21 -1
- package/src/components/modules/drag/state/DragStateMachine.ts +6 -1
- package/src/components/modules/drag/target/DropTargetDetector.ts +80 -4
- package/src/components/modules/drag/utils/ToggleSpringLoader.ts +71 -0
- package/src/components/modules/index.ts +7 -1
- package/src/components/modules/modificationsObserver.ts +19 -0
- package/src/components/modules/paste/constants.ts +2 -0
- package/src/components/modules/paste/handlers/base.ts +33 -1
- package/src/components/modules/paste/handlers/html-handler.ts +121 -54
- package/src/components/modules/paste/index.ts +5 -0
- package/src/components/modules/paste/types.ts +5 -0
- package/src/components/modules/rectangleSelection.ts +74 -81
- package/src/components/modules/toolbar/blockSettings.ts +25 -7
- package/src/components/modules/toolbar/index.ts +9 -7
- package/src/components/modules/toolbar/inline/index.ts +6 -1
- package/src/components/modules/toolbar/plus-button.ts +2 -6
- package/src/components/modules/toolbar/positioning.ts +10 -1
- package/src/components/modules/toolbar/settings-toggler.ts +1 -1
- package/src/components/modules/toolbar/styles.ts +3 -7
- package/src/components/modules/ui.ts +59 -5
- package/src/components/modules/uiControllers/handlers/click.ts +3 -2
- package/src/components/modules/widthManager.ts +69 -0
- package/src/components/modules/yjs/document-store.ts +11 -0
- package/src/components/modules/yjs/index.ts +11 -0
- package/src/components/shared/color-picker.ts +3 -3
- package/src/components/tools/block.ts +1 -11
- package/src/components/ui/toolbox.ts +52 -8
- package/src/components/utils/blocks.ts +37 -7
- package/src/components/utils/mutations.ts +2 -2
- package/src/components/utils/notifier/draw.ts +1 -1
- package/src/components/utils/placeholder.ts +5 -6
- package/src/components/utils/popover/components/popover-header/popover-header.const.ts +1 -1
- package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.const.ts +4 -4
- package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.ts +6 -6
- package/src/components/utils/popover/components/popover-item/popover-item-separator/popover-item-separator.const.ts +2 -2
- package/src/components/utils/popover/components/search-input/search-input.const.ts +2 -2
- package/src/components/utils/popover/components/search-input/search-input.ts +7 -11
- package/src/components/utils/popover/components/search-input/search-input.types.ts +149 -10
- package/src/components/utils/popover/popover-abstract.ts +3 -2
- package/src/components/utils/popover/popover-desktop.ts +133 -11
- package/src/components/utils/popover/popover-inline.ts +1 -1
- package/src/components/utils/popover/popover.const.ts +3 -3
- package/src/components/utils/shortcut.ts +2 -0
- package/src/components/utils/tooltip.ts +11 -1
- package/src/react/BlokContent.tsx +46 -0
- package/src/react/holder-map.ts +17 -0
- package/src/react/index.ts +3 -0
- package/src/react/types.ts +16 -0
- package/src/react/useBlok.ts +173 -0
- package/src/stories/Placeholder.stories.ts +0 -59
- package/src/styles/main.css +663 -52
- package/src/tools/header/header-toggle-keyboard.ts +115 -0
- package/src/tools/header/index.ts +382 -187
- package/src/tools/list/block-operations.ts +1 -1
- package/src/tools/list/caret-manager.ts +9 -12
- package/src/tools/list/index.ts +2 -6
- package/src/tools/list/list-keyboard.ts +2 -2
- package/src/tools/paragraph/index.ts +1 -1
- package/src/tools/table/index.ts +37 -3
- package/src/tools/table/table-add-controls.ts +97 -8
- package/src/tools/table/table-cell-blocks.ts +17 -8
- package/src/tools/table/table-cell-clipboard.ts +1 -1
- package/src/tools/table/table-cell-selection.ts +27 -2
- package/src/tools/table/table-operations.ts +3 -2
- package/src/tools/toggle/block-operations.ts +4 -2
- package/src/tools/toggle/constants.ts +26 -2
- package/src/tools/toggle/dom-builder.ts +90 -25
- package/src/tools/toggle/index.ts +112 -9
- package/src/tools/toggle/toggle-keyboard.ts +5 -3
- package/src/tools/toggle/toggle-lifecycle.ts +79 -7
- package/src/tools/toggle/toggle-shortcuts.ts +214 -20
- package/src/tools/toggle/types.ts +2 -0
- package/src/types-internal/blok-modules.d.ts +4 -0
- package/types/api/block.d.ts +5 -0
- package/types/api/blocks.d.ts +29 -0
- package/types/api/index.d.ts +1 -0
- package/types/api/width.d.ts +19 -0
- package/types/configs/blok-config.d.ts +33 -0
- package/types/index.d.ts +4 -0
- package/types/react.d.ts +58 -0
- package/types/utils/popover/popover.d.ts +7 -0
- package/dist/chunks/blok-B0pAWdVk.mjs +0 -20102
- package/dist/chunks/constants-DmDwNSTM.mjs +0 -5123
- package/dist/chunks/i18next-B47TKgbU.mjs +0 -1303
- package/dist/chunks/i18next-loader-v9SlYZ0i.mjs +0 -43
- package/dist/chunks/index-DHLWzZaA.mjs +0 -130
- package/dist/chunks/messages-0Pxnqd4N.mjs +0 -75
- package/dist/chunks/messages-0ZXYUq7S.mjs +0 -75
- package/dist/chunks/messages-2OD2uUDS.mjs +0 -75
- package/dist/chunks/messages-7cEMfYzh.mjs +0 -75
- package/dist/chunks/messages-8mwfda1Q.mjs +0 -75
- package/dist/chunks/messages-B-FqWsBM.mjs +0 -75
- package/dist/chunks/messages-B1jzqWiQ.mjs +0 -75
- package/dist/chunks/messages-B5wk4Ezz.mjs +0 -75
- package/dist/chunks/messages-BAZ5Ld8x.mjs +0 -75
- package/dist/chunks/messages-BBhGp198.mjs +0 -75
- package/dist/chunks/messages-BC9IjIb7.mjs +0 -75
- package/dist/chunks/messages-BFEmpeV-.mjs +0 -75
- package/dist/chunks/messages-BGqzTZy0.mjs +0 -75
- package/dist/chunks/messages-BICs1abK.mjs +0 -75
- package/dist/chunks/messages-BJX6rOnd.mjs +0 -75
- package/dist/chunks/messages-BL2bXRhN.mjs +0 -75
- package/dist/chunks/messages-BMs5qdlH.mjs +0 -75
- package/dist/chunks/messages-BRsjUNwB.mjs +0 -75
- package/dist/chunks/messages-BSqV8OUR.mjs +0 -75
- package/dist/chunks/messages-BTqu3DfG.mjs +0 -75
- package/dist/chunks/messages-BXnDEsur.mjs +0 -75
- package/dist/chunks/messages-BYcre4-6.mjs +0 -75
- package/dist/chunks/messages-BZ9LRJf-.mjs +0 -75
- package/dist/chunks/messages-BgypBy7y.mjs +0 -75
- package/dist/chunks/messages-BsuGf70G.mjs +0 -75
- package/dist/chunks/messages-BwaoF4lQ.mjs +0 -75
- package/dist/chunks/messages-C1l8_7-y.mjs +0 -75
- package/dist/chunks/messages-C5NA_r9v.mjs +0 -75
- package/dist/chunks/messages-C6zgZ5pA.mjs +0 -75
- package/dist/chunks/messages-CAo5ghFI.mjs +0 -75
- package/dist/chunks/messages-CH9qlJ9I.mjs +0 -75
- package/dist/chunks/messages-CI0HqAeS.mjs +0 -75
- package/dist/chunks/messages-CJJtms9k.mjs +0 -75
- package/dist/chunks/messages-CM2hJqk6.mjs +0 -75
- package/dist/chunks/messages-CRMiDPIQ.mjs +0 -75
- package/dist/chunks/messages-CWsZuBj1.mjs +0 -75
- package/dist/chunks/messages-C_gLHo6A.mjs +0 -75
- package/dist/chunks/messages-Cbu-NUDn.mjs +0 -75
- package/dist/chunks/messages-Cjb_MCeh.mjs +0 -75
- package/dist/chunks/messages-ClXYO9Wn.mjs +0 -75
- package/dist/chunks/messages-CsH20vhP.mjs +0 -75
- package/dist/chunks/messages-CsjAGhzA.mjs +0 -75
- package/dist/chunks/messages-Cx7VKFOE.mjs +0 -75
- package/dist/chunks/messages-D3JeBwxo.mjs +0 -75
- package/dist/chunks/messages-D541fieJ.mjs +0 -75
- package/dist/chunks/messages-D7XPdglc.mjs +0 -75
- package/dist/chunks/messages-DBhylfvt.mjs +0 -75
- package/dist/chunks/messages-DCA120lW.mjs +0 -75
- package/dist/chunks/messages-DCf_xZMN.mjs +0 -75
- package/dist/chunks/messages-DDwXKCpe.mjs +0 -75
- package/dist/chunks/messages-DNKDlxcy.mjs +0 -75
- package/dist/chunks/messages-DPvEjrGK.mjs +0 -75
- package/dist/chunks/messages-DQ-AkNxA.mjs +0 -75
- package/dist/chunks/messages-DVuvkNap.mjs +0 -75
- package/dist/chunks/messages-DaglyqUT.mjs +0 -75
- package/dist/chunks/messages-Di0bAfwA.mjs +0 -75
- package/dist/chunks/messages-DuLct0Yr.mjs +0 -75
- package/dist/chunks/messages-DzEYYhZh.mjs +0 -75
- package/dist/chunks/messages-DznNGAB2.mjs +0 -75
- package/dist/chunks/messages-DzoIzyu8.mjs +0 -75
- package/dist/chunks/messages-QYOGmket.mjs +0 -75
- package/dist/chunks/messages-cEjGDAgI.mjs +0 -75
- package/dist/chunks/messages-ddhvrdpE.mjs +0 -75
- package/dist/chunks/messages-mwfNK5nZ.mjs +0 -75
- package/dist/chunks/messages-nG_vNDte.mjs +0 -75
- package/dist/chunks/messages-tDq3Owh7.mjs +0 -75
- package/dist/chunks/messages-x6VJVZKx.mjs +0 -75
- package/dist/messages-0Pxnqd4N.mjs +0 -75
- package/dist/messages-0ZXYUq7S.mjs +0 -75
- package/dist/messages-2OD2uUDS.mjs +0 -75
- package/dist/messages-7cEMfYzh.mjs +0 -75
- package/dist/messages-8mwfda1Q.mjs +0 -75
- package/dist/messages-B-FqWsBM.mjs +0 -75
- package/dist/messages-B1jzqWiQ.mjs +0 -75
- package/dist/messages-B5wk4Ezz.mjs +0 -75
- package/dist/messages-BAZ5Ld8x.mjs +0 -75
- package/dist/messages-BBhGp198.mjs +0 -75
- package/dist/messages-BC9IjIb7.mjs +0 -75
- package/dist/messages-BFEmpeV-.mjs +0 -75
- package/dist/messages-BGqzTZy0.mjs +0 -75
- package/dist/messages-BICs1abK.mjs +0 -75
- package/dist/messages-BJX6rOnd.mjs +0 -75
- package/dist/messages-BL2bXRhN.mjs +0 -75
- package/dist/messages-BMs5qdlH.mjs +0 -75
- package/dist/messages-BRsjUNwB.mjs +0 -75
- package/dist/messages-BSqV8OUR.mjs +0 -75
- package/dist/messages-BTqu3DfG.mjs +0 -75
- package/dist/messages-BXnDEsur.mjs +0 -75
- package/dist/messages-BYcre4-6.mjs +0 -75
- package/dist/messages-BZ9LRJf-.mjs +0 -75
- package/dist/messages-BgypBy7y.mjs +0 -75
- package/dist/messages-BsuGf70G.mjs +0 -75
- package/dist/messages-BwaoF4lQ.mjs +0 -75
- package/dist/messages-C1l8_7-y.mjs +0 -75
- package/dist/messages-C5NA_r9v.mjs +0 -75
- package/dist/messages-C6zgZ5pA.mjs +0 -75
- package/dist/messages-CAo5ghFI.mjs +0 -75
- package/dist/messages-CH9qlJ9I.mjs +0 -75
- package/dist/messages-CI0HqAeS.mjs +0 -75
- package/dist/messages-CJJtms9k.mjs +0 -75
- package/dist/messages-CM2hJqk6.mjs +0 -75
- package/dist/messages-CRMiDPIQ.mjs +0 -75
- package/dist/messages-CWsZuBj1.mjs +0 -75
- package/dist/messages-C_gLHo6A.mjs +0 -75
- package/dist/messages-Cbu-NUDn.mjs +0 -75
- package/dist/messages-Cjb_MCeh.mjs +0 -75
- package/dist/messages-ClXYO9Wn.mjs +0 -75
- package/dist/messages-CsH20vhP.mjs +0 -75
- package/dist/messages-CsjAGhzA.mjs +0 -75
- package/dist/messages-Cx7VKFOE.mjs +0 -75
- package/dist/messages-D3JeBwxo.mjs +0 -75
- package/dist/messages-D541fieJ.mjs +0 -75
- package/dist/messages-D7XPdglc.mjs +0 -75
- package/dist/messages-DBhylfvt.mjs +0 -75
- package/dist/messages-DCA120lW.mjs +0 -75
- package/dist/messages-DCf_xZMN.mjs +0 -75
- package/dist/messages-DDwXKCpe.mjs +0 -75
- package/dist/messages-DNKDlxcy.mjs +0 -75
- package/dist/messages-DPvEjrGK.mjs +0 -75
- package/dist/messages-DQ-AkNxA.mjs +0 -75
- package/dist/messages-DVuvkNap.mjs +0 -75
- package/dist/messages-DaglyqUT.mjs +0 -75
- package/dist/messages-Di0bAfwA.mjs +0 -75
- package/dist/messages-DuLct0Yr.mjs +0 -75
- package/dist/messages-DzEYYhZh.mjs +0 -75
- package/dist/messages-DznNGAB2.mjs +0 -75
- package/dist/messages-DzoIzyu8.mjs +0 -75
- package/dist/messages-QYOGmket.mjs +0 -75
- package/dist/messages-cEjGDAgI.mjs +0 -75
- package/dist/messages-ddhvrdpE.mjs +0 -75
- package/dist/messages-mwfNK5nZ.mjs +0 -75
- package/dist/messages-nG_vNDte.mjs +0 -75
- package/dist/messages-tDq3Owh7.mjs +0 -75
- package/dist/messages-x6VJVZKx.mjs +0 -75
|
@@ -0,0 +1,1146 @@
|
|
|
1
|
+
import { t as e } from "./objectSpread2-CyPxu8-u.mjs";
|
|
2
|
+
//#region node_modules/i18next/dist/esm/i18next.js
|
|
3
|
+
var t = (e) => typeof e == "string", n = () => {
|
|
4
|
+
let e, t, n = new Promise((n, r) => {
|
|
5
|
+
e = n, t = r;
|
|
6
|
+
});
|
|
7
|
+
return n.resolve = e, n.reject = t, n;
|
|
8
|
+
}, r = (e) => e == null ? "" : "" + e, i = (e, t, n) => {
|
|
9
|
+
e.forEach((e) => {
|
|
10
|
+
t[e] && (n[e] = t[e]);
|
|
11
|
+
});
|
|
12
|
+
}, a = /###/g, o = (e) => e && e.indexOf("###") > -1 ? e.replace(a, ".") : e, s = (e) => !e || t(e), c = (e, n, r) => {
|
|
13
|
+
let i = t(n) ? n.split(".") : n, a = 0;
|
|
14
|
+
for (; a < i.length - 1;) {
|
|
15
|
+
if (s(e)) return {};
|
|
16
|
+
let t = o(i[a]);
|
|
17
|
+
!e[t] && r && (e[t] = new r()), e = Object.prototype.hasOwnProperty.call(e, t) ? e[t] : {}, ++a;
|
|
18
|
+
}
|
|
19
|
+
return s(e) ? {} : {
|
|
20
|
+
obj: e,
|
|
21
|
+
k: o(i[a])
|
|
22
|
+
};
|
|
23
|
+
}, l = (e, t, n) => {
|
|
24
|
+
let { obj: r, k: i } = c(e, t, Object);
|
|
25
|
+
if (r !== void 0 || t.length === 1) {
|
|
26
|
+
r[i] = n;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s = c(e, o, Object);
|
|
30
|
+
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s = c(e, o, Object), s != null && s.obj && s.obj[`${s.k}.${a}`] !== void 0 && (s.obj = void 0);
|
|
31
|
+
s.obj[`${s.k}.${a}`] = n;
|
|
32
|
+
}, u = (e, t, n, r) => {
|
|
33
|
+
let { obj: i, k: a } = c(e, t, Object);
|
|
34
|
+
i[a] = i[a] || [], i[a].push(n);
|
|
35
|
+
}, d = (e, t) => {
|
|
36
|
+
let { obj: n, k: r } = c(e, t);
|
|
37
|
+
if (n && Object.prototype.hasOwnProperty.call(n, r)) return n[r];
|
|
38
|
+
}, f = (e, t, n) => {
|
|
39
|
+
let r = d(e, n);
|
|
40
|
+
return r === void 0 ? d(t, n) : r;
|
|
41
|
+
}, p = (e, n, r) => {
|
|
42
|
+
for (let i in n) i !== "__proto__" && i !== "constructor" && (i in e ? t(e[i]) || e[i] instanceof String || t(n[i]) || n[i] instanceof String ? r && (e[i] = n[i]) : p(e[i], n[i], r) : e[i] = n[i]);
|
|
43
|
+
return e;
|
|
44
|
+
}, m = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), h = {
|
|
45
|
+
"&": "&",
|
|
46
|
+
"<": "<",
|
|
47
|
+
">": ">",
|
|
48
|
+
"\"": """,
|
|
49
|
+
"'": "'",
|
|
50
|
+
"/": "/"
|
|
51
|
+
}, g = (e) => t(e) ? e.replace(/[&<>"'\/]/g, (e) => h[e]) : e, _ = class {
|
|
52
|
+
constructor(e) {
|
|
53
|
+
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
54
|
+
}
|
|
55
|
+
getRegExp(e) {
|
|
56
|
+
let t = this.regExpMap.get(e);
|
|
57
|
+
if (t !== void 0) return t;
|
|
58
|
+
let n = new RegExp(e);
|
|
59
|
+
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
|
|
60
|
+
}
|
|
61
|
+
}, v = [
|
|
62
|
+
" ",
|
|
63
|
+
",",
|
|
64
|
+
"?",
|
|
65
|
+
"!",
|
|
66
|
+
";"
|
|
67
|
+
], y = new _(20), b = (e, t, n) => {
|
|
68
|
+
t = t || "", n = n || "";
|
|
69
|
+
let r = v.filter((e) => t.indexOf(e) < 0 && n.indexOf(e) < 0);
|
|
70
|
+
if (r.length === 0) return !0;
|
|
71
|
+
let i = y.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
|
|
72
|
+
if (!a) {
|
|
73
|
+
let t = e.indexOf(n);
|
|
74
|
+
t > 0 && !i.test(e.substring(0, t)) && (a = !0);
|
|
75
|
+
}
|
|
76
|
+
return a;
|
|
77
|
+
}, x = (e, t, n = ".") => {
|
|
78
|
+
if (!e) return;
|
|
79
|
+
if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
|
|
80
|
+
let r = t.split(n), i = e;
|
|
81
|
+
for (let e = 0; e < r.length;) {
|
|
82
|
+
if (!i || typeof i != "object") return;
|
|
83
|
+
let t, a = "";
|
|
84
|
+
for (let o = e; o < r.length; ++o) if (o !== e && (a += n), a += r[o], t = i[a], t !== void 0) {
|
|
85
|
+
if ([
|
|
86
|
+
"string",
|
|
87
|
+
"number",
|
|
88
|
+
"boolean"
|
|
89
|
+
].indexOf(typeof t) > -1 && o < r.length - 1) continue;
|
|
90
|
+
e += o - e + 1;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
i = t;
|
|
94
|
+
}
|
|
95
|
+
return i;
|
|
96
|
+
}, S = (e) => e == null ? void 0 : e.replace(/_/g, "-"), C = {
|
|
97
|
+
type: "logger",
|
|
98
|
+
log(e) {
|
|
99
|
+
this.output("log", e);
|
|
100
|
+
},
|
|
101
|
+
warn(e) {
|
|
102
|
+
this.output("warn", e);
|
|
103
|
+
},
|
|
104
|
+
error(e) {
|
|
105
|
+
this.output("error", e);
|
|
106
|
+
},
|
|
107
|
+
output(e, t) {
|
|
108
|
+
var n, r;
|
|
109
|
+
(n = console) == null || (n = n[e]) == null || (r = n.apply) == null || r.call(n, console, t);
|
|
110
|
+
}
|
|
111
|
+
}, w = new class n {
|
|
112
|
+
constructor(e, t = {}) {
|
|
113
|
+
this.init(e, t);
|
|
114
|
+
}
|
|
115
|
+
init(e, t = {}) {
|
|
116
|
+
this.prefix = t.prefix || "i18next:", this.logger = e || C, this.options = t, this.debug = t.debug;
|
|
117
|
+
}
|
|
118
|
+
log(...e) {
|
|
119
|
+
return this.forward(e, "log", "", !0);
|
|
120
|
+
}
|
|
121
|
+
warn(...e) {
|
|
122
|
+
return this.forward(e, "warn", "", !0);
|
|
123
|
+
}
|
|
124
|
+
error(...e) {
|
|
125
|
+
return this.forward(e, "error", "");
|
|
126
|
+
}
|
|
127
|
+
deprecate(...e) {
|
|
128
|
+
return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
|
|
129
|
+
}
|
|
130
|
+
forward(e, n, r, i) {
|
|
131
|
+
return i && !this.debug ? null : (t(e[0]) && (e[0] = `${r}${this.prefix} ${e[0]}`), this.logger[n](e));
|
|
132
|
+
}
|
|
133
|
+
create(t) {
|
|
134
|
+
return new n(this.logger, e(e({}, { prefix: `${this.prefix}:${t}:` }), this.options));
|
|
135
|
+
}
|
|
136
|
+
clone(e) {
|
|
137
|
+
return e = e || this.options, e.prefix = e.prefix || this.prefix, new n(this.logger, e);
|
|
138
|
+
}
|
|
139
|
+
}(), T = class {
|
|
140
|
+
constructor() {
|
|
141
|
+
this.observers = {};
|
|
142
|
+
}
|
|
143
|
+
on(e, t) {
|
|
144
|
+
return e.split(" ").forEach((e) => {
|
|
145
|
+
this.observers[e] || (this.observers[e] = /* @__PURE__ */ new Map());
|
|
146
|
+
let n = this.observers[e].get(t) || 0;
|
|
147
|
+
this.observers[e].set(t, n + 1);
|
|
148
|
+
}), this;
|
|
149
|
+
}
|
|
150
|
+
off(e, t) {
|
|
151
|
+
if (this.observers[e]) {
|
|
152
|
+
if (!t) {
|
|
153
|
+
delete this.observers[e];
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.observers[e].delete(t);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
emit(e, ...t) {
|
|
160
|
+
this.observers[e] && Array.from(this.observers[e].entries()).forEach(([e, n]) => {
|
|
161
|
+
for (let r = 0; r < n; r++) e(...t);
|
|
162
|
+
}), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([n, r]) => {
|
|
163
|
+
for (let i = 0; i < r; i++) n.apply(n, [e, ...t]);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}, E = class extends T {
|
|
167
|
+
constructor(e, t = {
|
|
168
|
+
ns: ["translation"],
|
|
169
|
+
defaultNS: "translation"
|
|
170
|
+
}) {
|
|
171
|
+
super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
|
|
172
|
+
}
|
|
173
|
+
addNamespaces(e) {
|
|
174
|
+
this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
|
|
175
|
+
}
|
|
176
|
+
removeNamespaces(e) {
|
|
177
|
+
let t = this.options.ns.indexOf(e);
|
|
178
|
+
t > -1 && this.options.ns.splice(t, 1);
|
|
179
|
+
}
|
|
180
|
+
getResource(e, n, r, i = {}) {
|
|
181
|
+
var a;
|
|
182
|
+
let o = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, s = i.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : i.ignoreJSONStructure, c;
|
|
183
|
+
e.indexOf(".") > -1 ? c = e.split(".") : (c = [e, n], r && (Array.isArray(r) ? c.push(...r) : t(r) && o ? c.push(...r.split(o)) : c.push(r)));
|
|
184
|
+
let l = d(this.data, c);
|
|
185
|
+
return !l && !n && !r && e.indexOf(".") > -1 && (e = c[0], n = c[1], r = c.slice(2).join(".")), l || !s || !t(r) ? l : x((a = this.data) == null || (a = a[e]) == null ? void 0 : a[n], r, o);
|
|
186
|
+
}
|
|
187
|
+
addResource(e, t, n, r, i = { silent: !1 }) {
|
|
188
|
+
let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
|
|
189
|
+
n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t), l(this.data, o, r), i.silent || this.emit("added", e, t, n, r);
|
|
190
|
+
}
|
|
191
|
+
addResources(e, n, r, i = { silent: !1 }) {
|
|
192
|
+
for (let i in r) (t(r[i]) || Array.isArray(r[i])) && this.addResource(e, n, i, r[i], { silent: !0 });
|
|
193
|
+
i.silent || this.emit("added", e, n, r);
|
|
194
|
+
}
|
|
195
|
+
addResourceBundle(t, n, r, i, a, o = {
|
|
196
|
+
silent: !1,
|
|
197
|
+
skipCopy: !1
|
|
198
|
+
}) {
|
|
199
|
+
let s = [t, n];
|
|
200
|
+
t.indexOf(".") > -1 && (s = t.split("."), i = r, r = n, n = s[1]), this.addNamespaces(n);
|
|
201
|
+
let c = d(this.data, s) || {};
|
|
202
|
+
o.skipCopy || (r = JSON.parse(JSON.stringify(r))), i ? p(c, r, a) : c = e(e({}, c), r), l(this.data, s, c), o.silent || this.emit("added", t, n, r);
|
|
203
|
+
}
|
|
204
|
+
removeResourceBundle(e, t) {
|
|
205
|
+
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
206
|
+
}
|
|
207
|
+
hasResourceBundle(e, t) {
|
|
208
|
+
return this.getResource(e, t) !== void 0;
|
|
209
|
+
}
|
|
210
|
+
getResourceBundle(e, t) {
|
|
211
|
+
return t || (t = this.options.defaultNS), this.getResource(e, t);
|
|
212
|
+
}
|
|
213
|
+
getDataByLanguage(e) {
|
|
214
|
+
return this.data[e];
|
|
215
|
+
}
|
|
216
|
+
hasLanguageSomeTranslations(e) {
|
|
217
|
+
let t = this.getDataByLanguage(e);
|
|
218
|
+
return !!(t && Object.keys(t) || []).find((e) => t[e] && Object.keys(t[e]).length > 0);
|
|
219
|
+
}
|
|
220
|
+
toJSON() {
|
|
221
|
+
return this.data;
|
|
222
|
+
}
|
|
223
|
+
}, D = {
|
|
224
|
+
processors: {},
|
|
225
|
+
addPostProcessor(e) {
|
|
226
|
+
this.processors[e.name] = e;
|
|
227
|
+
},
|
|
228
|
+
handle(e, t, n, r, i) {
|
|
229
|
+
return e.forEach((e) => {
|
|
230
|
+
var a, o;
|
|
231
|
+
t = (a = (o = this.processors[e]) == null ? void 0 : o.process(t, n, r, i)) == null ? t : a;
|
|
232
|
+
}), t;
|
|
233
|
+
}
|
|
234
|
+
}, O = Symbol("i18next/PATH_KEY");
|
|
235
|
+
function k() {
|
|
236
|
+
let e = [], t = Object.create(null), n;
|
|
237
|
+
return t.get = (r, i) => {
|
|
238
|
+
var a;
|
|
239
|
+
return n == null || (a = n.revoke) == null || a.call(n), i === O ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy);
|
|
240
|
+
}, Proxy.revocable(Object.create(null), t).proxy;
|
|
241
|
+
}
|
|
242
|
+
function A(e, t) {
|
|
243
|
+
var n, r;
|
|
244
|
+
let { [O]: i } = e(k()), a = (n = t == null ? void 0 : t.keySeparator) == null ? "." : n, o = (r = t == null ? void 0 : t.nsSeparator) == null ? ":" : r;
|
|
245
|
+
if (i.length > 1 && o) {
|
|
246
|
+
let e = t == null ? void 0 : t.ns;
|
|
247
|
+
if ((e ? Array.isArray(e) ? e : [e] : []).includes(i[0])) return `${i[0]}${o}${i.slice(1).join(a)}`;
|
|
248
|
+
}
|
|
249
|
+
return i.join(a);
|
|
250
|
+
}
|
|
251
|
+
var j = {}, M = (e) => !t(e) && typeof e != "boolean" && typeof e != "number", N = class n extends T {
|
|
252
|
+
constructor(e, t = {}) {
|
|
253
|
+
super(), i([
|
|
254
|
+
"resourceStore",
|
|
255
|
+
"languageUtils",
|
|
256
|
+
"pluralResolver",
|
|
257
|
+
"interpolator",
|
|
258
|
+
"backendConnector",
|
|
259
|
+
"i18nFormat",
|
|
260
|
+
"utils"
|
|
261
|
+
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = w.create("translator");
|
|
262
|
+
}
|
|
263
|
+
changeLanguage(e) {
|
|
264
|
+
e && (this.language = e);
|
|
265
|
+
}
|
|
266
|
+
exists(t, n = { interpolation: {} }) {
|
|
267
|
+
let r = e({}, n);
|
|
268
|
+
if (t == null) return !1;
|
|
269
|
+
let i = this.resolve(t, r);
|
|
270
|
+
if ((i == null ? void 0 : i.res) === void 0) return !1;
|
|
271
|
+
let a = M(i.res);
|
|
272
|
+
return !(r.returnObjects === !1 && a);
|
|
273
|
+
}
|
|
274
|
+
extractFromKey(e, n) {
|
|
275
|
+
let r = n.nsSeparator === void 0 ? this.options.nsSeparator : n.nsSeparator;
|
|
276
|
+
r === void 0 && (r = ":");
|
|
277
|
+
let i = n.keySeparator === void 0 ? this.options.keySeparator : n.keySeparator, a = n.ns || this.options.defaultNS || [], o = r && e.indexOf(r) > -1, s = !this.options.userDefinedKeySeparator && !n.keySeparator && !this.options.userDefinedNsSeparator && !n.nsSeparator && !b(e, r, i);
|
|
278
|
+
if (o && !s) {
|
|
279
|
+
let n = e.match(this.interpolator.nestingRegexp);
|
|
280
|
+
if (n && n.length > 0) return {
|
|
281
|
+
key: e,
|
|
282
|
+
namespaces: t(a) ? [a] : a
|
|
283
|
+
};
|
|
284
|
+
let o = e.split(r);
|
|
285
|
+
(r !== i || r === i && this.options.ns.indexOf(o[0]) > -1) && (a = o.shift()), e = o.join(i);
|
|
286
|
+
}
|
|
287
|
+
return {
|
|
288
|
+
key: e,
|
|
289
|
+
namespaces: t(a) ? [a] : a
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
translate(r, i, a) {
|
|
293
|
+
let o = typeof i == "object" ? e({}, i) : i;
|
|
294
|
+
if (typeof o != "object" && this.options.overloadTranslationOptionHandler && (o = this.options.overloadTranslationOptionHandler(arguments)), typeof o == "object" && (o = e({}, o)), o || (o = {}), r == null) return "";
|
|
295
|
+
typeof r == "function" && (r = A(r, e(e({}, this.options), o))), Array.isArray(r) || (r = [String(r)]), r = r.map((t) => typeof t == "function" ? A(t, e(e({}, this.options), o)) : String(t));
|
|
296
|
+
let s = o.returnDetails === void 0 ? this.options.returnDetails : o.returnDetails, c = o.keySeparator === void 0 ? this.options.keySeparator : o.keySeparator, { key: l, namespaces: u } = this.extractFromKey(r[r.length - 1], o), d = u[u.length - 1], f = o.nsSeparator === void 0 ? this.options.nsSeparator : o.nsSeparator;
|
|
297
|
+
f === void 0 && (f = ":");
|
|
298
|
+
let p = o.lng || this.language, m = o.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
299
|
+
if ((p == null ? void 0 : p.toLowerCase()) === "cimode") return m ? s ? {
|
|
300
|
+
res: `${d}${f}${l}`,
|
|
301
|
+
usedKey: l,
|
|
302
|
+
exactUsedKey: l,
|
|
303
|
+
usedLng: p,
|
|
304
|
+
usedNS: d,
|
|
305
|
+
usedParams: this.getUsedParamsDetails(o)
|
|
306
|
+
} : `${d}${f}${l}` : s ? {
|
|
307
|
+
res: l,
|
|
308
|
+
usedKey: l,
|
|
309
|
+
exactUsedKey: l,
|
|
310
|
+
usedLng: p,
|
|
311
|
+
usedNS: d,
|
|
312
|
+
usedParams: this.getUsedParamsDetails(o)
|
|
313
|
+
} : l;
|
|
314
|
+
let h = this.resolve(r, o), g = h == null ? void 0 : h.res, _ = (h == null ? void 0 : h.usedKey) || l, v = (h == null ? void 0 : h.exactUsedKey) || l, y = [
|
|
315
|
+
"[object Number]",
|
|
316
|
+
"[object Function]",
|
|
317
|
+
"[object RegExp]"
|
|
318
|
+
], b = o.joinArrays === void 0 ? this.options.joinArrays : o.joinArrays, x = !this.i18nFormat || this.i18nFormat.handleAsObject, S = o.count !== void 0 && !t(o.count), C = n.hasDefaultValue(o), w = S ? this.pluralResolver.getSuffix(p, o.count, o) : "", T = o.ordinal && S ? this.pluralResolver.getSuffix(p, o.count, { ordinal: !1 }) : "", E = S && !o.ordinal && o.count === 0, D = E && o[`defaultValue${this.options.pluralSeparator}zero`] || o[`defaultValue${w}`] || o[`defaultValue${T}`] || o.defaultValue, O = g;
|
|
319
|
+
x && !g && C && (O = D);
|
|
320
|
+
let k = M(O), j = Object.prototype.toString.apply(O);
|
|
321
|
+
if (x && O && k && y.indexOf(j) < 0 && !(t(b) && Array.isArray(O))) {
|
|
322
|
+
if (!o.returnObjects && !this.options.returnObjects) {
|
|
323
|
+
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
324
|
+
let t = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(_, O, e(e({}, o), {}, { ns: u })) : `key '${l} (${this.language})' returned an object instead of string.`;
|
|
325
|
+
return s ? (h.res = t, h.usedParams = this.getUsedParamsDetails(o), h) : t;
|
|
326
|
+
}
|
|
327
|
+
if (c) {
|
|
328
|
+
let t = Array.isArray(O), n = t ? [] : {}, r = t ? v : _;
|
|
329
|
+
for (let t in O) if (Object.prototype.hasOwnProperty.call(O, t)) {
|
|
330
|
+
let i = `${r}${c}${t}`;
|
|
331
|
+
C && !g ? n[t] = this.translate(i, e(e({}, o), {}, { defaultValue: M(D) ? D[t] : void 0 }, {
|
|
332
|
+
joinArrays: !1,
|
|
333
|
+
ns: u
|
|
334
|
+
})) : n[t] = this.translate(i, e(e({}, o), {
|
|
335
|
+
joinArrays: !1,
|
|
336
|
+
ns: u
|
|
337
|
+
})), n[t] === i && (n[t] = O[t]);
|
|
338
|
+
}
|
|
339
|
+
g = n;
|
|
340
|
+
}
|
|
341
|
+
} else if (x && t(b) && Array.isArray(g)) g = g.join(b), g && (g = this.extendTranslation(g, r, o, a));
|
|
342
|
+
else {
|
|
343
|
+
let t = !1, n = !1;
|
|
344
|
+
!this.isValidLookup(g) && C && (t = !0, g = D), this.isValidLookup(g) || (n = !0, g = l);
|
|
345
|
+
let i = (o.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : g, s = C && D !== g && this.options.updateMissing;
|
|
346
|
+
if (n || t || s) {
|
|
347
|
+
if (this.logger.log(s ? "updateKey" : "missingKey", p, d, l, s ? D : g), c) {
|
|
348
|
+
let t = this.resolve(l, e(e({}, o), {}, { keySeparator: !1 }));
|
|
349
|
+
t && t.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.");
|
|
350
|
+
}
|
|
351
|
+
let t = [], n = this.languageUtils.getFallbackCodes(this.options.fallbackLng, o.lng || this.language);
|
|
352
|
+
if (this.options.saveMissingTo === "fallback" && n && n[0]) for (let e = 0; e < n.length; e++) t.push(n[e]);
|
|
353
|
+
else this.options.saveMissingTo === "all" ? t = this.languageUtils.toResolveHierarchy(o.lng || this.language) : t.push(o.lng || this.language);
|
|
354
|
+
let r = (e, t, n) => {
|
|
355
|
+
var r;
|
|
356
|
+
let a = C && n !== g ? n : i;
|
|
357
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(e, d, t, a, s, o) : (r = this.backendConnector) != null && r.saveMissing && this.backendConnector.saveMissing(e, d, t, a, s, o), this.emit("missingKey", e, d, t, g);
|
|
358
|
+
};
|
|
359
|
+
this.options.saveMissing && (this.options.saveMissingPlurals && S ? t.forEach((e) => {
|
|
360
|
+
let t = this.pluralResolver.getSuffixes(e, o);
|
|
361
|
+
E && o[`defaultValue${this.options.pluralSeparator}zero`] && t.indexOf(`${this.options.pluralSeparator}zero`) < 0 && t.push(`${this.options.pluralSeparator}zero`), t.forEach((t) => {
|
|
362
|
+
r([e], l + t, o[`defaultValue${t}`] || D);
|
|
363
|
+
});
|
|
364
|
+
}) : r(t, l, D));
|
|
365
|
+
}
|
|
366
|
+
g = this.extendTranslation(g, r, o, h, a), n && g === l && this.options.appendNamespaceToMissingKey && (g = `${d}${f}${l}`), (n || t) && this.options.parseMissingKeyHandler && (g = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${d}${f}${l}` : l, t ? g : void 0, o));
|
|
367
|
+
}
|
|
368
|
+
return s ? (h.res = g, h.usedParams = this.getUsedParamsDetails(o), h) : g;
|
|
369
|
+
}
|
|
370
|
+
extendTranslation(n, r, i, a, o) {
|
|
371
|
+
var s;
|
|
372
|
+
if ((s = this.i18nFormat) != null && s.parse) n = this.i18nFormat.parse(n, e(e({}, this.options.interpolation.defaultVariables), i), i.lng || this.language || a.usedLng, a.usedNS, a.usedKey, { resolved: a });
|
|
373
|
+
else if (!i.skipInterpolation) {
|
|
374
|
+
var c;
|
|
375
|
+
i.interpolation && this.interpolator.init(e(e({}, i), { interpolation: e(e({}, this.options.interpolation), i.interpolation) }));
|
|
376
|
+
let s = t(n) && ((i == null || (c = i.interpolation) == null ? void 0 : c.skipOnVariables) === void 0 ? this.options.interpolation.skipOnVariables : i.interpolation.skipOnVariables), l;
|
|
377
|
+
if (s) {
|
|
378
|
+
let e = n.match(this.interpolator.nestingRegexp);
|
|
379
|
+
l = e && e.length;
|
|
380
|
+
}
|
|
381
|
+
let u = i.replace && !t(i.replace) ? i.replace : i;
|
|
382
|
+
if (this.options.interpolation.defaultVariables && (u = e(e({}, this.options.interpolation.defaultVariables), u)), n = this.interpolator.interpolate(n, u, i.lng || this.language || a.usedLng, i), s) {
|
|
383
|
+
let e = n.match(this.interpolator.nestingRegexp), t = e && e.length;
|
|
384
|
+
l < t && (i.nest = !1);
|
|
385
|
+
}
|
|
386
|
+
!i.lng && a && a.res && (i.lng = this.language || a.usedLng), i.nest !== !1 && (n = this.interpolator.nest(n, (...e) => (o == null ? void 0 : o[0]) === e[0] && !i.context ? (this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${r[0]}`), null) : this.translate(...e, r), i)), i.interpolation && this.interpolator.reset();
|
|
387
|
+
}
|
|
388
|
+
let l = i.postProcess || this.options.postProcess, u = t(l) ? [l] : l;
|
|
389
|
+
return n != null && u != null && u.length && i.applyPostProcessor !== !1 && (n = D.handle(u, n, r, this.options && this.options.postProcessPassResolved ? e({ i18nResolved: e(e({}, a), {}, { usedParams: this.getUsedParamsDetails(i) }) }, i) : i, this)), n;
|
|
390
|
+
}
|
|
391
|
+
resolve(n, r = {}) {
|
|
392
|
+
let i, a, o, s, c;
|
|
393
|
+
return t(n) && (n = [n]), Array.isArray(n) && (n = n.map((t) => typeof t == "function" ? A(t, e(e({}, this.options), r)) : t)), n.forEach((e) => {
|
|
394
|
+
if (this.isValidLookup(i)) return;
|
|
395
|
+
let n = this.extractFromKey(e, r), l = n.key;
|
|
396
|
+
a = l;
|
|
397
|
+
let u = n.namespaces;
|
|
398
|
+
this.options.fallbackNS && (u = u.concat(this.options.fallbackNS));
|
|
399
|
+
let d = r.count !== void 0 && !t(r.count), f = d && !r.ordinal && r.count === 0, p = r.context !== void 0 && (t(r.context) || typeof r.context == "number") && r.context !== "", m = r.lngs ? r.lngs : this.languageUtils.toResolveHierarchy(r.lng || this.language, r.fallbackLng);
|
|
400
|
+
u.forEach((e) => {
|
|
401
|
+
var t, n;
|
|
402
|
+
this.isValidLookup(i) || (c = e, !j[`${m[0]}-${e}`] && (t = this.utils) != null && t.hasLoadedNamespace && !((n = this.utils) != null && n.hasLoadedNamespace(c)) && (j[`${m[0]}-${e}`] = !0, this.logger.warn(`key "${a}" for languages "${m.join(", ")}" won't get resolved as namespace "${c}" 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!!!")), m.forEach((t) => {
|
|
403
|
+
var n;
|
|
404
|
+
if (this.isValidLookup(i)) return;
|
|
405
|
+
s = t;
|
|
406
|
+
let a = [l];
|
|
407
|
+
if ((n = this.i18nFormat) != null && n.addLookupKeys) this.i18nFormat.addLookupKeys(a, l, t, e, r);
|
|
408
|
+
else {
|
|
409
|
+
let e;
|
|
410
|
+
d && (e = this.pluralResolver.getSuffix(t, r.count, r));
|
|
411
|
+
let n = `${this.options.pluralSeparator}zero`, i = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
412
|
+
if (d && (r.ordinal && e.indexOf(i) === 0 && a.push(l + e.replace(i, this.options.pluralSeparator)), a.push(l + e), f && a.push(l + n)), p) {
|
|
413
|
+
let t = `${l}${this.options.contextSeparator || "_"}${r.context}`;
|
|
414
|
+
a.push(t), d && (r.ordinal && e.indexOf(i) === 0 && a.push(t + e.replace(i, this.options.pluralSeparator)), a.push(t + e), f && a.push(t + n));
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
let c;
|
|
418
|
+
for (; c = a.pop();) this.isValidLookup(i) || (o = c, i = this.getResource(t, e, c, r));
|
|
419
|
+
}));
|
|
420
|
+
});
|
|
421
|
+
}), {
|
|
422
|
+
res: i,
|
|
423
|
+
usedKey: a,
|
|
424
|
+
exactUsedKey: o,
|
|
425
|
+
usedLng: s,
|
|
426
|
+
usedNS: c
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
isValidLookup(e) {
|
|
430
|
+
return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
|
|
431
|
+
}
|
|
432
|
+
getResource(e, t, n, r = {}) {
|
|
433
|
+
var i;
|
|
434
|
+
return (i = this.i18nFormat) != null && i.getResource ? this.i18nFormat.getResource(e, t, n, r) : this.resourceStore.getResource(e, t, n, r);
|
|
435
|
+
}
|
|
436
|
+
getUsedParamsDetails(n = {}) {
|
|
437
|
+
let r = [
|
|
438
|
+
"defaultValue",
|
|
439
|
+
"ordinal",
|
|
440
|
+
"context",
|
|
441
|
+
"replace",
|
|
442
|
+
"lng",
|
|
443
|
+
"lngs",
|
|
444
|
+
"fallbackLng",
|
|
445
|
+
"ns",
|
|
446
|
+
"keySeparator",
|
|
447
|
+
"nsSeparator",
|
|
448
|
+
"returnObjects",
|
|
449
|
+
"returnDetails",
|
|
450
|
+
"joinArrays",
|
|
451
|
+
"postProcess",
|
|
452
|
+
"interpolation"
|
|
453
|
+
], i = n.replace && !t(n.replace), a = i ? n.replace : n;
|
|
454
|
+
if (i && n.count !== void 0 && (a.count = n.count), this.options.interpolation.defaultVariables && (a = e(e({}, this.options.interpolation.defaultVariables), a)), !i) {
|
|
455
|
+
a = e({}, a);
|
|
456
|
+
for (let e of r) delete a[e];
|
|
457
|
+
}
|
|
458
|
+
return a;
|
|
459
|
+
}
|
|
460
|
+
static hasDefaultValue(e) {
|
|
461
|
+
for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && t.substring(0, 12) === "defaultValue" && e[t] !== void 0) return !0;
|
|
462
|
+
return !1;
|
|
463
|
+
}
|
|
464
|
+
}, P = class {
|
|
465
|
+
constructor(e) {
|
|
466
|
+
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = w.create("languageUtils");
|
|
467
|
+
}
|
|
468
|
+
getScriptPartFromCode(e) {
|
|
469
|
+
if (e = S(e), !e || e.indexOf("-") < 0) return null;
|
|
470
|
+
let t = e.split("-");
|
|
471
|
+
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
472
|
+
}
|
|
473
|
+
getLanguagePartFromCode(e) {
|
|
474
|
+
if (e = S(e), !e || e.indexOf("-") < 0) return e;
|
|
475
|
+
let t = e.split("-");
|
|
476
|
+
return this.formatLanguageCode(t[0]);
|
|
477
|
+
}
|
|
478
|
+
formatLanguageCode(e) {
|
|
479
|
+
if (t(e) && e.indexOf("-") > -1) {
|
|
480
|
+
let t;
|
|
481
|
+
try {
|
|
482
|
+
t = Intl.getCanonicalLocales(e)[0];
|
|
483
|
+
} catch (e) {}
|
|
484
|
+
return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
|
|
485
|
+
}
|
|
486
|
+
return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
|
|
487
|
+
}
|
|
488
|
+
isSupportedCode(e) {
|
|
489
|
+
return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
|
|
490
|
+
}
|
|
491
|
+
getBestMatchFromCodes(e) {
|
|
492
|
+
if (!e) return null;
|
|
493
|
+
let t;
|
|
494
|
+
return e.forEach((e) => {
|
|
495
|
+
if (t) return;
|
|
496
|
+
let n = this.formatLanguageCode(e);
|
|
497
|
+
(!this.options.supportedLngs || this.isSupportedCode(n)) && (t = n);
|
|
498
|
+
}), !t && this.options.supportedLngs && e.forEach((e) => {
|
|
499
|
+
if (t) return;
|
|
500
|
+
let n = this.getScriptPartFromCode(e);
|
|
501
|
+
if (this.isSupportedCode(n)) return t = n;
|
|
502
|
+
let r = this.getLanguagePartFromCode(e);
|
|
503
|
+
if (this.isSupportedCode(r)) return t = r;
|
|
504
|
+
t = this.options.supportedLngs.find((e) => {
|
|
505
|
+
if (e === r || !(e.indexOf("-") < 0 && r.indexOf("-") < 0) && (e.indexOf("-") > 0 && r.indexOf("-") < 0 && e.substring(0, e.indexOf("-")) === r || e.indexOf(r) === 0 && r.length > 1)) return e;
|
|
506
|
+
});
|
|
507
|
+
}), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
|
|
508
|
+
}
|
|
509
|
+
getFallbackCodes(e, n) {
|
|
510
|
+
if (!e) return [];
|
|
511
|
+
if (typeof e == "function" && (e = e(n)), t(e) && (e = [e]), Array.isArray(e)) return e;
|
|
512
|
+
if (!n) return e.default || [];
|
|
513
|
+
let r = e[n];
|
|
514
|
+
return r || (r = e[this.getScriptPartFromCode(n)]), r || (r = e[this.formatLanguageCode(n)]), r || (r = e[this.getLanguagePartFromCode(n)]), r || (r = e.default), r || [];
|
|
515
|
+
}
|
|
516
|
+
toResolveHierarchy(e, n) {
|
|
517
|
+
let r = this.getFallbackCodes((n === !1 ? [] : n) || this.options.fallbackLng || [], e), i = [], a = (e) => {
|
|
518
|
+
e && (this.isSupportedCode(e) ? i.push(e) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`));
|
|
519
|
+
};
|
|
520
|
+
return t(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && a(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && a(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && a(this.getLanguagePartFromCode(e))) : t(e) && a(this.formatLanguageCode(e)), r.forEach((e) => {
|
|
521
|
+
i.indexOf(e) < 0 && a(this.formatLanguageCode(e));
|
|
522
|
+
}), i;
|
|
523
|
+
}
|
|
524
|
+
}, F = {
|
|
525
|
+
zero: 0,
|
|
526
|
+
one: 1,
|
|
527
|
+
two: 2,
|
|
528
|
+
few: 3,
|
|
529
|
+
many: 4,
|
|
530
|
+
other: 5
|
|
531
|
+
}, I = {
|
|
532
|
+
select: (e) => e === 1 ? "one" : "other",
|
|
533
|
+
resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
|
|
534
|
+
}, L = class {
|
|
535
|
+
constructor(e, t = {}) {
|
|
536
|
+
this.languageUtils = e, this.options = t, this.logger = w.create("pluralResolver"), this.pluralRulesCache = {};
|
|
537
|
+
}
|
|
538
|
+
clearCache() {
|
|
539
|
+
this.pluralRulesCache = {};
|
|
540
|
+
}
|
|
541
|
+
getRule(e, t = {}) {
|
|
542
|
+
let n = S(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
|
|
543
|
+
cleanedCode: n,
|
|
544
|
+
type: r
|
|
545
|
+
});
|
|
546
|
+
if (i in this.pluralRulesCache) return this.pluralRulesCache[i];
|
|
547
|
+
let a;
|
|
548
|
+
try {
|
|
549
|
+
a = new Intl.PluralRules(n, { type: r });
|
|
550
|
+
} catch (n) {
|
|
551
|
+
if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), I;
|
|
552
|
+
if (!e.match(/-|_/)) return I;
|
|
553
|
+
let r = this.languageUtils.getLanguagePartFromCode(e);
|
|
554
|
+
a = this.getRule(r, t);
|
|
555
|
+
}
|
|
556
|
+
return this.pluralRulesCache[i] = a, a;
|
|
557
|
+
}
|
|
558
|
+
needsPlural(e, t = {}) {
|
|
559
|
+
let n = this.getRule(e, t);
|
|
560
|
+
return n || (n = this.getRule("dev", t)), (n == null ? void 0 : n.resolvedOptions().pluralCategories.length) > 1;
|
|
561
|
+
}
|
|
562
|
+
getPluralFormsOfKey(e, t, n = {}) {
|
|
563
|
+
return this.getSuffixes(e, n).map((e) => `${t}${e}`);
|
|
564
|
+
}
|
|
565
|
+
getSuffixes(e, t = {}) {
|
|
566
|
+
let n = this.getRule(e, t);
|
|
567
|
+
return n || (n = this.getRule("dev", t)), n ? n.resolvedOptions().pluralCategories.sort((e, t) => F[e] - F[t]).map((e) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${e}`) : [];
|
|
568
|
+
}
|
|
569
|
+
getSuffix(e, t, n = {}) {
|
|
570
|
+
let r = this.getRule(e, n);
|
|
571
|
+
return r ? `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${r.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, n));
|
|
572
|
+
}
|
|
573
|
+
}, R = (e, n, r, i = ".", a = !0) => {
|
|
574
|
+
let o = f(e, n, r);
|
|
575
|
+
return !o && a && t(r) && (o = x(e, r, i), o === void 0 && (o = x(n, r, i))), o;
|
|
576
|
+
}, z = (e) => e.replace(/\$/g, "$$$$"), B = class {
|
|
577
|
+
constructor(e = {}) {
|
|
578
|
+
var t;
|
|
579
|
+
this.logger = w.create("interpolator"), this.options = e, this.format = (e == null || (t = e.interpolation) == null ? void 0 : t.format) || ((e) => e), this.init(e);
|
|
580
|
+
}
|
|
581
|
+
init(e = {}) {
|
|
582
|
+
e.interpolation || (e.interpolation = { escapeValue: !0 });
|
|
583
|
+
let { escape: t, escapeValue: n, useRawValueToEscape: r, prefix: i, prefixEscaped: a, suffix: o, suffixEscaped: s, formatSeparator: c, unescapeSuffix: l, unescapePrefix: u, nestingPrefix: d, nestingPrefixEscaped: f, nestingSuffix: p, nestingSuffixEscaped: h, nestingOptionsSeparator: _, maxReplaces: v, alwaysFormat: y } = e.interpolation;
|
|
584
|
+
this.escape = t === void 0 ? g : t, this.escapeValue = n === void 0 ? !0 : n, this.useRawValueToEscape = r === void 0 ? !1 : r, this.prefix = i ? m(i) : a || "{{", this.suffix = o ? m(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? m(d) : f || m("$t("), this.nestingSuffix = p ? m(p) : h || m(")"), this.nestingOptionsSeparator = _ || ",", this.maxReplaces = v || 1e3, this.alwaysFormat = y === void 0 ? !1 : y, this.resetRegExp();
|
|
585
|
+
}
|
|
586
|
+
reset() {
|
|
587
|
+
this.options && this.init(this.options);
|
|
588
|
+
}
|
|
589
|
+
resetRegExp() {
|
|
590
|
+
let e = (e, t) => (e == null ? void 0 : e.source) === t ? (e.lastIndex = 0, e) : new RegExp(t, "g");
|
|
591
|
+
this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
|
|
592
|
+
}
|
|
593
|
+
interpolate(n, i, a, o) {
|
|
594
|
+
var s;
|
|
595
|
+
let c, l, u, d = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, f = (t) => {
|
|
596
|
+
if (t.indexOf(this.formatSeparator) < 0) {
|
|
597
|
+
let n = R(i, d, t, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
598
|
+
return this.alwaysFormat ? this.format(n, void 0, a, e(e(e({}, o), i), {}, { interpolationkey: t })) : n;
|
|
599
|
+
}
|
|
600
|
+
let n = t.split(this.formatSeparator), r = n.shift().trim(), s = n.join(this.formatSeparator).trim();
|
|
601
|
+
return this.format(R(i, d, r, this.options.keySeparator, this.options.ignoreJSONStructure), s, a, e(e(e({}, o), i), {}, { interpolationkey: r }));
|
|
602
|
+
};
|
|
603
|
+
this.resetRegExp();
|
|
604
|
+
let p = (o == null ? void 0 : o.missingInterpolationHandler) || this.options.missingInterpolationHandler, m = (o == null || (s = o.interpolation) == null ? void 0 : s.skipOnVariables) === void 0 ? this.options.interpolation.skipOnVariables : o.interpolation.skipOnVariables;
|
|
605
|
+
return [{
|
|
606
|
+
regex: this.regexpUnescape,
|
|
607
|
+
safeValue: (e) => z(e)
|
|
608
|
+
}, {
|
|
609
|
+
regex: this.regexp,
|
|
610
|
+
safeValue: (e) => this.escapeValue ? z(this.escape(e)) : z(e)
|
|
611
|
+
}].forEach((e) => {
|
|
612
|
+
for (u = 0; c = e.regex.exec(n);) {
|
|
613
|
+
let i = c[1].trim();
|
|
614
|
+
if (l = f(i), l === void 0) if (typeof p == "function") {
|
|
615
|
+
let e = p(n, c, o);
|
|
616
|
+
l = t(e) ? e : "";
|
|
617
|
+
} else if (o && Object.prototype.hasOwnProperty.call(o, i)) l = "";
|
|
618
|
+
else if (m) {
|
|
619
|
+
l = c[0];
|
|
620
|
+
continue;
|
|
621
|
+
} else this.logger.warn(`missed to pass in variable ${i} for interpolating ${n}`), l = "";
|
|
622
|
+
else !t(l) && !this.useRawValueToEscape && (l = r(l));
|
|
623
|
+
let a = e.safeValue(l);
|
|
624
|
+
if (n = n.replace(c[0], a), m ? (e.regex.lastIndex += l.length, e.regex.lastIndex -= c[0].length) : e.regex.lastIndex = 0, u++, u >= this.maxReplaces) break;
|
|
625
|
+
}
|
|
626
|
+
}), n;
|
|
627
|
+
}
|
|
628
|
+
nest(n, i, a = {}) {
|
|
629
|
+
let o, s, c, l = (t, n) => {
|
|
630
|
+
var r, i;
|
|
631
|
+
let a = this.nestingOptionsSeparator;
|
|
632
|
+
if (t.indexOf(a) < 0) return t;
|
|
633
|
+
let o = t.split(RegExp(`${m(a)}[ ]*{`)), s = `{${o[1]}`;
|
|
634
|
+
t = o[0], s = this.interpolate(s, c);
|
|
635
|
+
let l = s.match(/'/g), u = s.match(/"/g);
|
|
636
|
+
(((r = l == null ? void 0 : l.length) == null ? 0 : r) % 2 == 0 && !u || ((i = u == null ? void 0 : u.length) == null ? 0 : i) % 2 != 0) && (s = s.replace(/'/g, "\""));
|
|
637
|
+
try {
|
|
638
|
+
c = JSON.parse(s), n && (c = e(e({}, n), c));
|
|
639
|
+
} catch (e) {
|
|
640
|
+
return this.logger.warn(`failed parsing options string in nesting for key ${t}`, e), `${t}${a}${s}`;
|
|
641
|
+
}
|
|
642
|
+
return c.defaultValue && c.defaultValue.indexOf(this.prefix) > -1 && delete c.defaultValue, t;
|
|
643
|
+
};
|
|
644
|
+
for (; o = this.nestingRegexp.exec(n);) {
|
|
645
|
+
let u = [];
|
|
646
|
+
c = e({}, a), c = c.replace && !t(c.replace) ? c.replace : c, c.applyPostProcessor = !1, delete c.defaultValue;
|
|
647
|
+
let d = /{.*}/.test(o[1]) ? o[1].lastIndexOf("}") + 1 : o[1].indexOf(this.formatSeparator);
|
|
648
|
+
if (d !== -1 && (u = o[1].slice(d).split(this.formatSeparator).map((e) => e.trim()).filter(Boolean), o[1] = o[1].slice(0, d)), s = i(l.call(this, o[1].trim(), c), c), s && o[0] === n && !t(s)) return s;
|
|
649
|
+
t(s) || (s = r(s)), s || (this.logger.warn(`missed to resolve ${o[1]} for nesting ${n}`), s = ""), u.length && (s = u.reduce((t, n) => this.format(t, n, a.lng, e(e({}, a), {}, { interpolationkey: o[1].trim() })), s.trim())), n = n.replace(o[0], s), this.regexp.lastIndex = 0;
|
|
650
|
+
}
|
|
651
|
+
return n;
|
|
652
|
+
}
|
|
653
|
+
}, V = (e) => {
|
|
654
|
+
let t = e.toLowerCase().trim(), n = {};
|
|
655
|
+
if (e.indexOf("(") > -1) {
|
|
656
|
+
let r = e.split("(");
|
|
657
|
+
t = r[0].toLowerCase().trim();
|
|
658
|
+
let i = r[1].substring(0, r[1].length - 1);
|
|
659
|
+
t === "currency" && i.indexOf(":") < 0 ? n.currency || (n.currency = i.trim()) : t === "relativetime" && i.indexOf(":") < 0 ? n.range || (n.range = i.trim()) : i.split(";").forEach((e) => {
|
|
660
|
+
if (e) {
|
|
661
|
+
let [t, ...r] = e.split(":"), i = r.join(":").trim().replace(/^'+|'+$/g, ""), a = t.trim();
|
|
662
|
+
n[a] || (n[a] = i), i === "false" && (n[a] = !1), i === "true" && (n[a] = !0), isNaN(i) || (n[a] = parseInt(i, 10));
|
|
663
|
+
}
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
return {
|
|
667
|
+
formatName: t,
|
|
668
|
+
formatOptions: n
|
|
669
|
+
};
|
|
670
|
+
}, H = (t) => {
|
|
671
|
+
let n = {};
|
|
672
|
+
return (r, i, a) => {
|
|
673
|
+
let o = a;
|
|
674
|
+
a && a.interpolationkey && a.formatParams && a.formatParams[a.interpolationkey] && a[a.interpolationkey] && (o = e(e({}, o), {}, { [a.interpolationkey]: void 0 }));
|
|
675
|
+
let s = i + JSON.stringify(o), c = n[s];
|
|
676
|
+
return c || (c = t(S(i), a), n[s] = c), c(r);
|
|
677
|
+
};
|
|
678
|
+
}, U = (e) => (t, n, r) => e(S(n), r)(t), W = class {
|
|
679
|
+
constructor(e = {}) {
|
|
680
|
+
this.logger = w.create("formatter"), this.options = e, this.init(e);
|
|
681
|
+
}
|
|
682
|
+
init(t, n = { interpolation: {} }) {
|
|
683
|
+
this.formatSeparator = n.interpolation.formatSeparator || ",";
|
|
684
|
+
let r = n.cacheInBuiltFormats ? H : U;
|
|
685
|
+
this.formats = {
|
|
686
|
+
number: r((t, n) => {
|
|
687
|
+
let r = new Intl.NumberFormat(t, e({}, n));
|
|
688
|
+
return (e) => r.format(e);
|
|
689
|
+
}),
|
|
690
|
+
currency: r((t, n) => {
|
|
691
|
+
let r = new Intl.NumberFormat(t, e(e({}, n), {}, { style: "currency" }));
|
|
692
|
+
return (e) => r.format(e);
|
|
693
|
+
}),
|
|
694
|
+
datetime: r((t, n) => {
|
|
695
|
+
let r = new Intl.DateTimeFormat(t, e({}, n));
|
|
696
|
+
return (e) => r.format(e);
|
|
697
|
+
}),
|
|
698
|
+
relativetime: r((t, n) => {
|
|
699
|
+
let r = new Intl.RelativeTimeFormat(t, e({}, n));
|
|
700
|
+
return (e) => r.format(e, n.range || "day");
|
|
701
|
+
}),
|
|
702
|
+
list: r((t, n) => {
|
|
703
|
+
let r = new Intl.ListFormat(t, e({}, n));
|
|
704
|
+
return (e) => r.format(e);
|
|
705
|
+
})
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
add(e, t) {
|
|
709
|
+
this.formats[e.toLowerCase().trim()] = t;
|
|
710
|
+
}
|
|
711
|
+
addCached(e, t) {
|
|
712
|
+
this.formats[e.toLowerCase().trim()] = H(t);
|
|
713
|
+
}
|
|
714
|
+
format(t, n, r, i = {}) {
|
|
715
|
+
let a = n.split(this.formatSeparator);
|
|
716
|
+
if (a.length > 1 && a[0].indexOf("(") > 1 && a[0].indexOf(")") < 0 && a.find((e) => e.indexOf(")") > -1)) {
|
|
717
|
+
let e = a.findIndex((e) => e.indexOf(")") > -1);
|
|
718
|
+
a[0] = [a[0], ...a.splice(1, e)].join(this.formatSeparator);
|
|
719
|
+
}
|
|
720
|
+
return a.reduce((t, n) => {
|
|
721
|
+
let { formatName: a, formatOptions: o } = V(n);
|
|
722
|
+
if (this.formats[a]) {
|
|
723
|
+
let n = t;
|
|
724
|
+
try {
|
|
725
|
+
var s;
|
|
726
|
+
let c = (i == null || (s = i.formatParams) == null ? void 0 : s[i.interpolationkey]) || {}, l = c.locale || c.lng || i.locale || i.lng || r;
|
|
727
|
+
n = this.formats[a](t, l, e(e(e({}, o), i), c));
|
|
728
|
+
} catch (e) {
|
|
729
|
+
this.logger.warn(e);
|
|
730
|
+
}
|
|
731
|
+
return n;
|
|
732
|
+
} else this.logger.warn(`there was no format function for ${a}`);
|
|
733
|
+
return t;
|
|
734
|
+
}, t);
|
|
735
|
+
}
|
|
736
|
+
}, G = (e, t) => {
|
|
737
|
+
e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
|
|
738
|
+
}, K = class extends T {
|
|
739
|
+
constructor(e, t, n, r = {}) {
|
|
740
|
+
var i, a;
|
|
741
|
+
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = w.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = r.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = r.maxRetries >= 0 ? r.maxRetries : 5, this.retryTimeout = r.retryTimeout >= 1 ? r.retryTimeout : 350, this.state = {}, this.queue = [], (i = this.backend) == null || (a = i.init) == null || a.call(i, n, r.backend, r);
|
|
742
|
+
}
|
|
743
|
+
queueLoad(e, t, n, r) {
|
|
744
|
+
let i = {}, a = {}, o = {}, s = {};
|
|
745
|
+
return e.forEach((e) => {
|
|
746
|
+
let r = !0;
|
|
747
|
+
t.forEach((t) => {
|
|
748
|
+
let o = `${e}|${t}`;
|
|
749
|
+
!n.reload && this.store.hasResourceBundle(e, t) ? this.state[o] = 2 : this.state[o] < 0 || (this.state[o] === 1 ? a[o] === void 0 && (a[o] = !0) : (this.state[o] = 1, r = !1, a[o] === void 0 && (a[o] = !0), i[o] === void 0 && (i[o] = !0), s[t] === void 0 && (s[t] = !0)));
|
|
750
|
+
}), r || (o[e] = !0);
|
|
751
|
+
}), (Object.keys(i).length || Object.keys(a).length) && this.queue.push({
|
|
752
|
+
pending: a,
|
|
753
|
+
pendingCount: Object.keys(a).length,
|
|
754
|
+
loaded: {},
|
|
755
|
+
errors: [],
|
|
756
|
+
callback: r
|
|
757
|
+
}), {
|
|
758
|
+
toLoad: Object.keys(i),
|
|
759
|
+
pending: Object.keys(a),
|
|
760
|
+
toLoadLanguages: Object.keys(o),
|
|
761
|
+
toLoadNamespaces: Object.keys(s)
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
loaded(e, t, n) {
|
|
765
|
+
let r = e.split("|"), i = r[0], a = r[1];
|
|
766
|
+
t && this.emit("failedLoading", i, a, t), !t && n && this.store.addResourceBundle(i, a, n, void 0, void 0, { skipCopy: !0 }), this.state[e] = t ? -1 : 2, t && n && (this.state[e] = 0);
|
|
767
|
+
let o = {};
|
|
768
|
+
this.queue.forEach((n) => {
|
|
769
|
+
u(n.loaded, [i], a), G(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
|
|
770
|
+
o[e] || (o[e] = {});
|
|
771
|
+
let t = n.loaded[e];
|
|
772
|
+
t.length && t.forEach((t) => {
|
|
773
|
+
o[e][t] === void 0 && (o[e][t] = !0);
|
|
774
|
+
});
|
|
775
|
+
}), n.done = !0, n.errors.length ? n.callback(n.errors) : n.callback());
|
|
776
|
+
}), this.emit("loaded", o), this.queue = this.queue.filter((e) => !e.done);
|
|
777
|
+
}
|
|
778
|
+
read(e, t, n, r = 0, i = this.retryTimeout, a) {
|
|
779
|
+
if (!e.length) return a(null, {});
|
|
780
|
+
if (this.readingCalls >= this.maxParallelReads) {
|
|
781
|
+
this.waitingReads.push({
|
|
782
|
+
lng: e,
|
|
783
|
+
ns: t,
|
|
784
|
+
fcName: n,
|
|
785
|
+
tried: r,
|
|
786
|
+
wait: i,
|
|
787
|
+
callback: a
|
|
788
|
+
});
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
this.readingCalls++;
|
|
792
|
+
let o = (o, s) => {
|
|
793
|
+
if (this.readingCalls--, this.waitingReads.length > 0) {
|
|
794
|
+
let e = this.waitingReads.shift();
|
|
795
|
+
this.read(e.lng, e.ns, e.fcName, e.tried, e.wait, e.callback);
|
|
796
|
+
}
|
|
797
|
+
if (o && s && r < this.maxRetries) {
|
|
798
|
+
setTimeout(() => {
|
|
799
|
+
this.read.call(this, e, t, n, r + 1, i * 2, a);
|
|
800
|
+
}, i);
|
|
801
|
+
return;
|
|
802
|
+
}
|
|
803
|
+
a(o, s);
|
|
804
|
+
}, s = this.backend[n].bind(this.backend);
|
|
805
|
+
if (s.length === 2) {
|
|
806
|
+
try {
|
|
807
|
+
let n = s(e, t);
|
|
808
|
+
n && typeof n.then == "function" ? n.then((e) => o(null, e)).catch(o) : o(null, n);
|
|
809
|
+
} catch (e) {
|
|
810
|
+
o(e);
|
|
811
|
+
}
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
return s(e, t, o);
|
|
815
|
+
}
|
|
816
|
+
prepareLoading(e, n, r = {}, i) {
|
|
817
|
+
if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), i && i();
|
|
818
|
+
t(e) && (e = this.languageUtils.toResolveHierarchy(e)), t(n) && (n = [n]);
|
|
819
|
+
let a = this.queueLoad(e, n, r, i);
|
|
820
|
+
if (!a.toLoad.length) return a.pending.length || i(), null;
|
|
821
|
+
a.toLoad.forEach((e) => {
|
|
822
|
+
this.loadOne(e);
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
load(e, t, n) {
|
|
826
|
+
this.prepareLoading(e, t, {}, n);
|
|
827
|
+
}
|
|
828
|
+
reload(e, t, n) {
|
|
829
|
+
this.prepareLoading(e, t, { reload: !0 }, n);
|
|
830
|
+
}
|
|
831
|
+
loadOne(e, t = "") {
|
|
832
|
+
let n = e.split("|"), r = n[0], i = n[1];
|
|
833
|
+
this.read(r, i, "read", void 0, void 0, (n, a) => {
|
|
834
|
+
n && this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`, n), !n && a && this.logger.log(`${t}loaded namespace ${i} for language ${r}`, a), this.loaded(e, n, a);
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
saveMissing(t, n, r, i, a, o = {}, s = () => {}) {
|
|
838
|
+
var c, l, u;
|
|
839
|
+
if (!((c = this.services) == null || (c = c.utils) == null) && c.hasLoadedNamespace && !(!((l = this.services) == null || (l = l.utils) == null) && l.hasLoadedNamespace(n))) {
|
|
840
|
+
this.logger.warn(`did not save key "${r}" as the namespace "${n}" 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!!!");
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
if (!(r == null || r === "")) {
|
|
844
|
+
if ((u = this.backend) != null && u.create) {
|
|
845
|
+
let c = e(e({}, o), {}, { isUpdate: a }), l = this.backend.create.bind(this.backend);
|
|
846
|
+
if (l.length < 6) try {
|
|
847
|
+
let e;
|
|
848
|
+
e = l.length === 5 ? l(t, n, r, i, c) : l(t, n, r, i), e && typeof e.then == "function" ? e.then((e) => s(null, e)).catch(s) : s(null, e);
|
|
849
|
+
} catch (e) {
|
|
850
|
+
s(e);
|
|
851
|
+
}
|
|
852
|
+
else l(t, n, r, i, s, c);
|
|
853
|
+
}
|
|
854
|
+
!t || !t[0] || this.store.addResource(t[0], n, r, i);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
}, q = () => ({
|
|
858
|
+
debug: !1,
|
|
859
|
+
initAsync: !0,
|
|
860
|
+
ns: ["translation"],
|
|
861
|
+
defaultNS: ["translation"],
|
|
862
|
+
fallbackLng: ["dev"],
|
|
863
|
+
fallbackNS: !1,
|
|
864
|
+
supportedLngs: !1,
|
|
865
|
+
nonExplicitSupportedLngs: !1,
|
|
866
|
+
load: "all",
|
|
867
|
+
preload: !1,
|
|
868
|
+
simplifyPluralSuffix: !0,
|
|
869
|
+
keySeparator: ".",
|
|
870
|
+
nsSeparator: ":",
|
|
871
|
+
pluralSeparator: "_",
|
|
872
|
+
contextSeparator: "_",
|
|
873
|
+
partialBundledLanguages: !1,
|
|
874
|
+
saveMissing: !1,
|
|
875
|
+
updateMissing: !1,
|
|
876
|
+
saveMissingTo: "fallback",
|
|
877
|
+
saveMissingPlurals: !0,
|
|
878
|
+
missingKeyHandler: !1,
|
|
879
|
+
missingInterpolationHandler: !1,
|
|
880
|
+
postProcess: !1,
|
|
881
|
+
postProcessPassResolved: !1,
|
|
882
|
+
returnNull: !1,
|
|
883
|
+
returnEmptyString: !0,
|
|
884
|
+
returnObjects: !1,
|
|
885
|
+
joinArrays: !1,
|
|
886
|
+
returnedObjectHandler: !1,
|
|
887
|
+
parseMissingKeyHandler: !1,
|
|
888
|
+
appendNamespaceToMissingKey: !1,
|
|
889
|
+
appendNamespaceToCIMode: !1,
|
|
890
|
+
overloadTranslationOptionHandler: (e) => {
|
|
891
|
+
let n = {};
|
|
892
|
+
if (typeof e[1] == "object" && (n = e[1]), t(e[1]) && (n.defaultValue = e[1]), t(e[2]) && (n.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
|
|
893
|
+
let t = e[3] || e[2];
|
|
894
|
+
Object.keys(t).forEach((e) => {
|
|
895
|
+
n[e] = t[e];
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
return n;
|
|
899
|
+
},
|
|
900
|
+
interpolation: {
|
|
901
|
+
escapeValue: !0,
|
|
902
|
+
format: (e) => e,
|
|
903
|
+
prefix: "{{",
|
|
904
|
+
suffix: "}}",
|
|
905
|
+
formatSeparator: ",",
|
|
906
|
+
unescapePrefix: "-",
|
|
907
|
+
nestingPrefix: "$t(",
|
|
908
|
+
nestingSuffix: ")",
|
|
909
|
+
nestingOptionsSeparator: ",",
|
|
910
|
+
maxReplaces: 1e3,
|
|
911
|
+
skipOnVariables: !0
|
|
912
|
+
},
|
|
913
|
+
cacheInBuiltFormats: !0
|
|
914
|
+
}), J = (e) => {
|
|
915
|
+
var n, r;
|
|
916
|
+
return t(e.ns) && (e.ns = [e.ns]), t(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), t(e.fallbackNS) && (e.fallbackNS = [e.fallbackNS]), ((n = e.supportedLngs) == null || (r = n.indexOf) == null ? void 0 : r.call(n, "cimode")) < 0 && (e.supportedLngs = e.supportedLngs.concat(["cimode"])), typeof e.initImmediate == "boolean" && (e.initAsync = e.initImmediate), e;
|
|
917
|
+
}, Y = () => {}, X = (e) => {
|
|
918
|
+
Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
|
|
919
|
+
typeof e[t] == "function" && (e[t] = e[t].bind(e));
|
|
920
|
+
});
|
|
921
|
+
}, Z = "__i18next_supportNoticeShown", Q = () => typeof globalThis < "u" && !!globalThis[Z], ee = () => {
|
|
922
|
+
typeof globalThis < "u" && (globalThis[Z] = !0);
|
|
923
|
+
}, te = (e) => {
|
|
924
|
+
var t, n, r, i, a;
|
|
925
|
+
return !!((e == null || (t = e.modules) == null || (t = t.backend) == null || (t = t.name) == null ? void 0 : t.indexOf("Locize")) > 0 || (e == null || (n = e.modules) == null || (n = n.backend) == null || (n = n.constructor) == null || (n = n.name) == null ? void 0 : n.indexOf("Locize")) > 0 || !(e == null || (r = e.options) == null || (r = r.backend) == null) && r.backends && e.options.backend.backends.some((e) => {
|
|
926
|
+
var t, n;
|
|
927
|
+
return (e == null || (t = e.name) == null ? void 0 : t.indexOf("Locize")) > 0 || (e == null || (n = e.constructor) == null || (n = n.name) == null ? void 0 : n.indexOf("Locize")) > 0;
|
|
928
|
+
}) || !(e == null || (i = e.options) == null || (i = i.backend) == null) && i.projectId || !(e == null || (a = e.options) == null || (a = a.backend) == null) && a.backendOptions && e.options.backend.backendOptions.some((e) => e == null ? void 0 : e.projectId));
|
|
929
|
+
}, $ = class r extends T {
|
|
930
|
+
constructor(e = {}, t) {
|
|
931
|
+
if (super(), this.options = J(e), this.services = {}, this.logger = w, this.modules = { external: [] }, X(this), t && !this.isInitialized && !e.isClone) {
|
|
932
|
+
if (!this.options.initAsync) return this.init(e, t), this;
|
|
933
|
+
setTimeout(() => {
|
|
934
|
+
this.init(e, t);
|
|
935
|
+
}, 0);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
init(r = {}, i) {
|
|
939
|
+
this.isInitializing = !0, typeof r == "function" && (i = r, r = {}), r.defaultNS == null && r.ns && (t(r.ns) ? r.defaultNS = r.ns : r.ns.indexOf("translation") < 0 && (r.defaultNS = r.ns[0]));
|
|
940
|
+
let a = q();
|
|
941
|
+
this.options = e(e(e({}, a), this.options), J(r)), this.options.interpolation = e(e({}, a.interpolation), this.options.interpolation), r.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = r.keySeparator), r.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = r.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = a.overloadTranslationOptionHandler), this.options.showSupportNotice !== !1 && !te(this) && !Q() && (typeof console < "u" && console.info !== void 0 && console.info("🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"), ee());
|
|
942
|
+
let o = (e) => e ? typeof e == "function" ? new e() : e : null;
|
|
943
|
+
if (!this.options.isClone) {
|
|
944
|
+
this.modules.logger ? w.init(o(this.modules.logger), this.options) : w.init(null, this.options);
|
|
945
|
+
let e;
|
|
946
|
+
e = this.modules.formatter ? this.modules.formatter : W;
|
|
947
|
+
let t = new P(this.options);
|
|
948
|
+
this.store = new E(this.options.resources, this.options);
|
|
949
|
+
let n = this.services;
|
|
950
|
+
n.logger = w, n.resourceStore = this.store, n.languageUtils = t, n.pluralResolver = new L(t, {
|
|
951
|
+
prepend: this.options.pluralSeparator,
|
|
952
|
+
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
953
|
+
}), this.options.interpolation.format && this.options.interpolation.format !== a.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), e && (!this.options.interpolation.format || this.options.interpolation.format === a.interpolation.format) && (n.formatter = o(e), n.formatter.init && n.formatter.init(n, this.options), this.options.interpolation.format = n.formatter.format.bind(n.formatter)), n.interpolator = new B(this.options), n.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, n.backendConnector = new K(o(this.modules.backend), n.resourceStore, n, this.options), n.backendConnector.on("*", (e, ...t) => {
|
|
954
|
+
this.emit(e, ...t);
|
|
955
|
+
}), this.modules.languageDetector && (n.languageDetector = o(this.modules.languageDetector), n.languageDetector.init && n.languageDetector.init(n, this.options.detection, this.options)), this.modules.i18nFormat && (n.i18nFormat = o(this.modules.i18nFormat), n.i18nFormat.init && n.i18nFormat.init(this)), this.translator = new N(this.services, this.options), this.translator.on("*", (e, ...t) => {
|
|
956
|
+
this.emit(e, ...t);
|
|
957
|
+
}), this.modules.external.forEach((e) => {
|
|
958
|
+
e.init && e.init(this);
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
if (this.format = this.options.interpolation.format, i || (i = Y), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
962
|
+
let e = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
963
|
+
e.length > 0 && e[0] !== "dev" && (this.options.lng = e[0]);
|
|
964
|
+
}
|
|
965
|
+
!this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), [
|
|
966
|
+
"getResource",
|
|
967
|
+
"hasResourceBundle",
|
|
968
|
+
"getResourceBundle",
|
|
969
|
+
"getDataByLanguage"
|
|
970
|
+
].forEach((e) => {
|
|
971
|
+
this[e] = (...t) => this.store[e](...t);
|
|
972
|
+
}), [
|
|
973
|
+
"addResource",
|
|
974
|
+
"addResources",
|
|
975
|
+
"addResourceBundle",
|
|
976
|
+
"removeResourceBundle"
|
|
977
|
+
].forEach((e) => {
|
|
978
|
+
this[e] = (...t) => (this.store[e](...t), this);
|
|
979
|
+
});
|
|
980
|
+
let s = n(), c = () => {
|
|
981
|
+
let e = (e, t) => {
|
|
982
|
+
this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), s.resolve(t), i(e, t);
|
|
983
|
+
};
|
|
984
|
+
if (this.languages && !this.isInitialized) return e(null, this.t.bind(this));
|
|
985
|
+
this.changeLanguage(this.options.lng, e);
|
|
986
|
+
};
|
|
987
|
+
return this.options.resources || !this.options.initAsync ? c() : setTimeout(c, 0), s;
|
|
988
|
+
}
|
|
989
|
+
loadResources(e, n = Y) {
|
|
990
|
+
let r = n, i = t(e) ? e : this.language;
|
|
991
|
+
if (typeof e == "function" && (r = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
992
|
+
var a, o;
|
|
993
|
+
if ((i == null ? void 0 : i.toLowerCase()) === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return r();
|
|
994
|
+
let e = [], t = (t) => {
|
|
995
|
+
t && t !== "cimode" && this.services.languageUtils.toResolveHierarchy(t).forEach((t) => {
|
|
996
|
+
t !== "cimode" && e.indexOf(t) < 0 && e.push(t);
|
|
997
|
+
});
|
|
998
|
+
};
|
|
999
|
+
i ? t(i) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((e) => t(e)), (a = this.options.preload) == null || (o = a.forEach) == null || o.call(a, (e) => t(e)), this.services.backendConnector.load(e, this.options.ns, (e) => {
|
|
1000
|
+
!e && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), r(e);
|
|
1001
|
+
});
|
|
1002
|
+
} else r(null);
|
|
1003
|
+
}
|
|
1004
|
+
reloadResources(e, t, r) {
|
|
1005
|
+
let i = n();
|
|
1006
|
+
return typeof e == "function" && (r = e, e = void 0), typeof t == "function" && (r = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), r || (r = Y), this.services.backendConnector.reload(e, t, (e) => {
|
|
1007
|
+
i.resolve(), r(e);
|
|
1008
|
+
}), i;
|
|
1009
|
+
}
|
|
1010
|
+
use(e) {
|
|
1011
|
+
if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1012
|
+
if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1013
|
+
return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && D.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1014
|
+
}
|
|
1015
|
+
setResolvedLanguage(e) {
|
|
1016
|
+
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
|
|
1017
|
+
for (let e = 0; e < this.languages.length; e++) {
|
|
1018
|
+
let t = this.languages[e];
|
|
1019
|
+
if (!(["cimode", "dev"].indexOf(t) > -1) && this.store.hasLanguageSomeTranslations(t)) {
|
|
1020
|
+
this.resolvedLanguage = t;
|
|
1021
|
+
break;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
!this.resolvedLanguage && this.languages.indexOf(e) < 0 && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
changeLanguage(e, r) {
|
|
1028
|
+
this.isLanguageChangingTo = e;
|
|
1029
|
+
let i = n();
|
|
1030
|
+
this.emit("languageChanging", e);
|
|
1031
|
+
let a = (e) => {
|
|
1032
|
+
this.language = e, this.languages = this.services.languageUtils.toResolveHierarchy(e), this.resolvedLanguage = void 0, this.setResolvedLanguage(e);
|
|
1033
|
+
}, o = (t, n) => {
|
|
1034
|
+
n ? this.isLanguageChangingTo === e && (a(n), this.translator.changeLanguage(n), this.isLanguageChangingTo = void 0, this.emit("languageChanged", n), this.logger.log("languageChanged", n)) : this.isLanguageChangingTo = void 0, i.resolve((...e) => this.t(...e)), r && r(t, (...e) => this.t(...e));
|
|
1035
|
+
}, s = (n) => {
|
|
1036
|
+
!e && !n && this.services.languageDetector && (n = []);
|
|
1037
|
+
let r = t(n) ? n : n && n[0], i = this.store.hasLanguageSomeTranslations(r) ? r : this.services.languageUtils.getBestMatchFromCodes(t(n) ? [n] : n);
|
|
1038
|
+
if (i) {
|
|
1039
|
+
var s, c;
|
|
1040
|
+
this.language || a(i), this.translator.language || this.translator.changeLanguage(i), (s = this.services.languageDetector) == null || (c = s.cacheUserLanguage) == null || c.call(s, i);
|
|
1041
|
+
}
|
|
1042
|
+
this.loadResources(i, (e) => {
|
|
1043
|
+
o(e, i);
|
|
1044
|
+
});
|
|
1045
|
+
};
|
|
1046
|
+
return !e && this.services.languageDetector && !this.services.languageDetector.async ? s(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(s) : this.services.languageDetector.detect(s) : s(e), i;
|
|
1047
|
+
}
|
|
1048
|
+
getFixedT(n, r, i) {
|
|
1049
|
+
let a = (t, n, ...r) => {
|
|
1050
|
+
let o;
|
|
1051
|
+
o = typeof n == "object" ? e({}, n) : this.options.overloadTranslationOptionHandler([t, n].concat(r)), o.lng = o.lng || a.lng, o.lngs = o.lngs || a.lngs, o.ns = o.ns || a.ns, o.keyPrefix !== "" && (o.keyPrefix = o.keyPrefix || i || a.keyPrefix);
|
|
1052
|
+
let s = this.options.keySeparator || ".", c;
|
|
1053
|
+
return o.keyPrefix && Array.isArray(t) ? c = t.map((t) => (typeof t == "function" && (t = A(t, e(e({}, this.options), n))), `${o.keyPrefix}${s}${t}`)) : (typeof t == "function" && (t = A(t, e(e({}, this.options), n))), c = o.keyPrefix ? `${o.keyPrefix}${s}${t}` : t), this.t(c, o);
|
|
1054
|
+
};
|
|
1055
|
+
return t(n) ? a.lng = n : a.lngs = n, a.ns = r, a.keyPrefix = i, a;
|
|
1056
|
+
}
|
|
1057
|
+
t(...e) {
|
|
1058
|
+
var t;
|
|
1059
|
+
return (t = this.translator) == null ? void 0 : t.translate(...e);
|
|
1060
|
+
}
|
|
1061
|
+
exists(...e) {
|
|
1062
|
+
var t;
|
|
1063
|
+
return (t = this.translator) == null ? void 0 : t.exists(...e);
|
|
1064
|
+
}
|
|
1065
|
+
setDefaultNamespace(e) {
|
|
1066
|
+
this.options.defaultNS = e;
|
|
1067
|
+
}
|
|
1068
|
+
hasLoadedNamespace(e, t = {}) {
|
|
1069
|
+
if (!this.isInitialized) return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
|
|
1070
|
+
if (!this.languages || !this.languages.length) return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
|
|
1071
|
+
let n = t.lng || this.resolvedLanguage || this.languages[0], r = this.options ? this.options.fallbackLng : !1, i = this.languages[this.languages.length - 1];
|
|
1072
|
+
if (n.toLowerCase() === "cimode") return !0;
|
|
1073
|
+
let a = (e, t) => {
|
|
1074
|
+
let n = this.services.backendConnector.state[`${e}|${t}`];
|
|
1075
|
+
return n === -1 || n === 0 || n === 2;
|
|
1076
|
+
};
|
|
1077
|
+
if (t.precheck) {
|
|
1078
|
+
let e = t.precheck(this, a);
|
|
1079
|
+
if (e !== void 0) return e;
|
|
1080
|
+
}
|
|
1081
|
+
return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!r || a(i, e)));
|
|
1082
|
+
}
|
|
1083
|
+
loadNamespaces(e, r) {
|
|
1084
|
+
let i = n();
|
|
1085
|
+
return this.options.ns ? (t(e) && (e = [e]), e.forEach((e) => {
|
|
1086
|
+
this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
|
|
1087
|
+
}), this.loadResources((e) => {
|
|
1088
|
+
i.resolve(), r && r(e);
|
|
1089
|
+
}), i) : (r && r(), Promise.resolve());
|
|
1090
|
+
}
|
|
1091
|
+
loadLanguages(e, r) {
|
|
1092
|
+
let i = n();
|
|
1093
|
+
t(e) && (e = [e]);
|
|
1094
|
+
let a = this.options.preload || [], o = e.filter((e) => a.indexOf(e) < 0 && this.services.languageUtils.isSupportedCode(e));
|
|
1095
|
+
return o.length ? (this.options.preload = a.concat(o), this.loadResources((e) => {
|
|
1096
|
+
i.resolve(), r && r(e);
|
|
1097
|
+
}), i) : (r && r(), Promise.resolve());
|
|
1098
|
+
}
|
|
1099
|
+
dir(e) {
|
|
1100
|
+
var t, n;
|
|
1101
|
+
if (e || (e = this.resolvedLanguage || (((t = this.languages) == null ? void 0 : t.length) > 0 ? this.languages[0] : this.language)), !e) return "rtl";
|
|
1102
|
+
try {
|
|
1103
|
+
let t = new Intl.Locale(e);
|
|
1104
|
+
if (t && t.getTextInfo) {
|
|
1105
|
+
let e = t.getTextInfo();
|
|
1106
|
+
if (e && e.direction) return e.direction;
|
|
1107
|
+
}
|
|
1108
|
+
} catch (e) {}
|
|
1109
|
+
let r = /* @__PURE__ */ "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".split("."), i = ((n = this.services) == null ? void 0 : n.languageUtils) || new P(q());
|
|
1110
|
+
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : r.indexOf(i.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1111
|
+
}
|
|
1112
|
+
static createInstance(e = {}, t) {
|
|
1113
|
+
let n = new r(e, t);
|
|
1114
|
+
return n.createInstance = r.createInstance, n;
|
|
1115
|
+
}
|
|
1116
|
+
cloneInstance(t = {}, n = Y) {
|
|
1117
|
+
let i = t.forkResourceStore;
|
|
1118
|
+
i && delete t.forkResourceStore;
|
|
1119
|
+
let a = e(e(e({}, this.options), t), { isClone: !0 }), o = new r(a);
|
|
1120
|
+
if ((t.debug !== void 0 || t.prefix !== void 0) && (o.logger = o.logger.clone(t)), [
|
|
1121
|
+
"store",
|
|
1122
|
+
"services",
|
|
1123
|
+
"language"
|
|
1124
|
+
].forEach((e) => {
|
|
1125
|
+
o[e] = this[e];
|
|
1126
|
+
}), o.services = e({}, this.services), o.services.utils = { hasLoadedNamespace: o.hasLoadedNamespace.bind(o) }, i && (o.store = new E(Object.keys(this.store.data).reduce((t, n) => (t[n] = e({}, this.store.data[n]), t[n] = Object.keys(t[n]).reduce((r, i) => (r[i] = e({}, t[n][i]), r), t[n]), t), {}), a), o.services.resourceStore = o.store), t.interpolation) {
|
|
1127
|
+
let n = e(e(e({}, q().interpolation), this.options.interpolation), t.interpolation), r = e(e({}, a), {}, { interpolation: n });
|
|
1128
|
+
o.services.interpolator = new B(r);
|
|
1129
|
+
}
|
|
1130
|
+
return o.translator = new N(o.services, a), o.translator.on("*", (e, ...t) => {
|
|
1131
|
+
o.emit(e, ...t);
|
|
1132
|
+
}), o.init(a, n), o.translator.options = a, o.translator.backendConnector.services.utils = { hasLoadedNamespace: o.hasLoadedNamespace.bind(o) }, o;
|
|
1133
|
+
}
|
|
1134
|
+
toJSON() {
|
|
1135
|
+
return {
|
|
1136
|
+
options: this.options,
|
|
1137
|
+
store: this.store,
|
|
1138
|
+
language: this.language,
|
|
1139
|
+
languages: this.languages,
|
|
1140
|
+
resolvedLanguage: this.resolvedLanguage
|
|
1141
|
+
};
|
|
1142
|
+
}
|
|
1143
|
+
}.createInstance();
|
|
1144
|
+
$.createInstance, $.dir, $.init, $.loadResources, $.reloadResources, $.use, $.changeLanguage, $.getFixedT, $.t, $.exists, $.setDefaultNamespace, $.hasLoadedNamespace, $.loadNamespaces, $.loadLanguages;
|
|
1145
|
+
//#endregion
|
|
1146
|
+
export { $ as default };
|