@oj-module/cli 0.2.64 → 0.2.66
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/devkit/README.md +9 -3
- package/devkit/SKILL.md +5 -2
- package/devkit/framework-dev.md +12 -7
- package/devkit/manual.md +123 -56
- package/devkit/menu-rules.md +4 -1
- package/package.json +3 -2
- package/shell-dist/assets/ahooks.2l850ymmh0.js +18 -0
- package/shell-dist/assets/antd-es-locale-zh_CN.1gjjsvxbf0.js +1 -0
- package/shell-dist/assets/antd-img-crop.196rkty480.js +99 -0
- package/shell-dist/assets/antd-locale-en_US.561tozx860.js +1 -0
- package/shell-dist/assets/antd-locale-zh_CN.1cmpmgzh70.js +1 -0
- package/shell-dist/assets/antd.uw1coq15l0.js +348 -0
- package/shell-dist/assets/clsx.jotilrt2e0.js +1 -0
- package/shell-dist/assets/contract-errors.2o17vz9u50.js +1 -0
- package/shell-dist/assets/contract.3h327o3mj0.js +57 -0
- package/shell-dist/assets/cssinjs.atgmhan7m0.js +3 -0
- package/shell-dist/assets/dayjs-plugin-advancedFormat.3vsyd2eis0.js +1 -0
- package/shell-dist/assets/dayjs-plugin-customParseFormat.13xhghv1d0.js +1 -0
- package/shell-dist/assets/dayjs-plugin-isoWeek.1fn1tw82p0.js +1 -0
- package/shell-dist/assets/dayjs-plugin-localeData.2rwbjp9nk0.js +1 -0
- package/shell-dist/assets/dayjs-plugin-quarterOfYear.2oqo1lcx80.js +1 -0
- package/shell-dist/assets/dayjs-plugin-relativeTime.2pqs3et4y0.js +1 -0
- package/shell-dist/assets/dayjs-plugin-weekOfYear.gvn9iph080.js +1 -0
- package/shell-dist/assets/dayjs-plugin-weekYear.2u78l3ex10.js +1 -0
- package/shell-dist/assets/dayjs-plugin-weekday.2d56a4tml0.js +1 -0
- package/shell-dist/assets/dayjs.pa60l6wjo0.js +1 -0
- package/shell-dist/assets/dnd-kit-core.1xyreig6r0.js +5 -0
- package/shell-dist/assets/dnd-kit-sortable.s94qciuft0.js +1 -0
- package/shell-dist/assets/dnd-kit-utilities.1umw4xphb0.js +1 -0
- package/shell-dist/assets/i18next.33zqofapj0.js +1 -0
- package/shell-dist/assets/icons-es-components-Context.365qmflwg0.js +1 -0
- package/shell-dist/assets/icons.159wjwals0.js +57 -0
- package/shell-dist/assets/jsx-dev-runtime.3uibuc82f0.js +14 -0
- package/shell-dist/assets/jsx-runtime.h40xu4o5b0.js +14 -0
- package/shell-dist/assets/keepalive-for-react.xenu5vam70.js +1 -0
- package/shell-dist/assets/kit.37kr8ui390.js +1 -0
- package/shell-dist/assets/ky.1cgch7gu60.js +6 -0
- package/shell-dist/assets/motion-react.pjsxytvjs0.js +12 -0
- package/shell-dist/assets/motion.21tciqutg0.js +4 -0
- package/shell-dist/assets/nprogress.2nz76n9ny0.js +7 -0
- package/shell-dist/assets/ojm-dayjs-locale-zh-cn.3vr3beiyp0.js +9 -0
- package/shell-dist/assets/pinyin-pro.3v0mnxczn0.js +1 -0
- package/shell-dist/assets/pro-components.2kyot1vcl0.js +83 -0
- package/shell-dist/assets/react-countup.2x8idnr8y0.js +10 -0
- package/shell-dist/assets/react-dom-client.ick0v05ob0.js +43 -0
- package/shell-dist/assets/react-dom.2so9uxg3f0.js +22 -0
- package/shell-dist/assets/react-error-boundary.2dncdfj3b0.js +1 -0
- package/shell-dist/assets/react-i18next.auhvjhqv00.js +1 -0
- package/shell-dist/assets/react-jss.1ei6dr9e00.js +29 -0
- package/shell-dist/assets/react-query.3rln45ow00.js +1 -0
- package/shell-dist/assets/react-router-dom.3c6zld8h40.js +44 -0
- package/shell-dist/assets/react-router.2h9rebcv50.js +56 -0
- package/shell-dist/assets/react.1ew63mwts0.js +14 -0
- package/shell-dist/assets/runtime.1xfsxcajj0.js +21702 -0
- package/shell-dist/assets/simplebar-react.2g739uvai0.js +1 -0
- package/shell-dist/assets/spin-delay.yjeyj6iwp0.js +9 -0
- package/shell-dist/assets/tailwind-merge.125ehiqjw0.js +1 -0
- package/shell-dist/assets/use-sync-external-store-shim.1nz1pi9bb0.js +22 -0
- package/shell-dist/assets/zustand-middleware.1xaxjueme0.js +6 -0
- package/shell-dist/assets/zustand-react-shallow.pybayv1hx0.js +1 -0
- package/shell-dist/assets/zustand-react.9fsl9brxy0.js +1 -0
- package/shell-dist/assets/zustand-shallow.6cz0yyv9x0.js +1 -0
- package/shell-dist/assets/zustand-vanilla-shallow.3424monv50.js +1 -0
- package/shell-dist/assets/zustand-vanilla.1mo3ka3g30.js +1 -0
- package/shell-dist/assets/zustand.3gjgzlnqo0.js +1 -0
- package/shell-dist/index.html +67 -118
- package/shell-dist/versions.json +3 -3
- package/src/esm-exports.ts +152 -70
- package/src/shared-deps.ts +69 -19
- package/src/site-base.ts +4 -0
- package/templates/src/app/web/home/pages/components/bar-chart.tsx +5 -3
- package/templates/src/app/web/home/pages/components/echarts-setup.ts +30 -0
- package/templates/src/app/web/home/pages/components/line-chart.tsx +5 -3
- package/templates/src/app/web/home/pages/components/pie-chart.tsx +6 -3
- package/templates/src/app/web/home/pages/index.tsx +3 -2
- package/templates/src/app/web/home/routes.ts +3 -2
- package/vendor/host-versions.json +3 -3
- package/shell-dist/assets/ahooks.js +0 -6909
- package/shell-dist/assets/antd-es-locale-zh_CN.js +0 -257
- package/shell-dist/assets/antd-img-crop.js +0 -1495
- package/shell-dist/assets/antd-locale-en_US.js +0 -374
- package/shell-dist/assets/antd-locale-zh_CN.js +0 -379
- package/shell-dist/assets/antd.js +0 -106874
- package/shell-dist/assets/clsx.js +0 -33
- package/shell-dist/assets/contract-errors.js +0 -30
- package/shell-dist/assets/contract.js +0 -18900
- package/shell-dist/assets/cssinjs.js +0 -2595
- package/shell-dist/assets/dayjs-plugin-advancedFormat.js +0 -98
- package/shell-dist/assets/dayjs-plugin-customParseFormat.js +0 -173
- package/shell-dist/assets/dayjs-plugin-isoWeek.js +0 -77
- package/shell-dist/assets/dayjs-plugin-localeData.js +0 -126
- package/shell-dist/assets/dayjs-plugin-quarterOfYear.js +0 -77
- package/shell-dist/assets/dayjs-plugin-relativeTime.js +0 -92
- package/shell-dist/assets/dayjs-plugin-weekOfYear.js +0 -73
- package/shell-dist/assets/dayjs-plugin-weekYear.js +0 -63
- package/shell-dist/assets/dayjs-plugin-weekday.js +0 -63
- package/shell-dist/assets/dayjs.js +0 -326
- package/shell-dist/assets/dnd-kit-core.js +0 -3601
- package/shell-dist/assets/dnd-kit-sortable.js +0 -717
- package/shell-dist/assets/dnd-kit-utilities.js +0 -340
- package/shell-dist/assets/i18next.js +0 -2321
- package/shell-dist/assets/icons-es-components-Context.js +0 -20
- package/shell-dist/assets/icons.js +0 -34961
- package/shell-dist/assets/jsx-dev-runtime.js +0 -75
- package/shell-dist/assets/jsx-runtime.js +0 -97
- package/shell-dist/assets/keepalive-for-react.js +0 -283
- package/shell-dist/assets/kit.js +0 -151
- package/shell-dist/assets/ky.js +0 -1427
- package/shell-dist/assets/motion-react.js +0 -13589
- package/shell-dist/assets/motion.js +0 -9959
- package/shell-dist/assets/nprogress.js +0 -314
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-BarsOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-CalendarOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-CaretDownFilled.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-CaretDownOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-CaretUpOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-CheckCircleFilled.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-CheckOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-ClockCircleOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-CloseCircleFilled.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-CloseOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-CopyOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-DeleteOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-DoubleLeftOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-DoubleRightOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-DownOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-DownloadOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-EditOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-EllipsisOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-EnterOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-ExclamationCircleFilled.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-EyeInvisibleOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-EyeOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-FileOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-FileTextOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-FilterFilled.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-FolderOpenOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-FolderOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-HolderOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-InfoCircleFilled.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-LeftOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-LoadingOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-MinusOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-MinusSquareOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-PaperClipOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-PictureOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-PlusOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-PlusSquareOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-QuestionCircleOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-ReloadOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-RightOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-RotateLeftOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-RotateRightOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-SearchOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-StarFilled.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-SwapOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-SwapRightOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-UpOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-VerticalAlignTopOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-WarningFilled.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-ZoomInOutlined.js +0 -7
- package/shell-dist/assets/ojm--ant-design-icons-es-icons-ZoomOutOutlined.js +0 -7
- package/shell-dist/assets/ojm-dayjs-locale-zh-cn.js +0 -81
- package/shell-dist/assets/pinyin-pro.js +0 -25175
- package/shell-dist/assets/pro-components.js +0 -44627
- package/shell-dist/assets/react-countup.js +0 -525
- package/shell-dist/assets/react-dom-client.js +0 -12134
- package/shell-dist/assets/react-dom.js +0 -266
- package/shell-dist/assets/react-error-boundary.js +0 -141
- package/shell-dist/assets/react-i18next.js +0 -1773
- package/shell-dist/assets/react-jss.js +0 -4089
- package/shell-dist/assets/react-query.js +0 -3072
- package/shell-dist/assets/react-router-dom.js +0 -9927
- package/shell-dist/assets/react-router.js +0 -14584
- package/shell-dist/assets/react.js +0 -590
- package/shell-dist/assets/runtime.js +0 -28311
- package/shell-dist/assets/simplebar-react.js +0 -1119
- package/shell-dist/assets/spin-delay.js +0 -111
- package/shell-dist/assets/tailwind-merge.js +0 -3364
- package/shell-dist/assets/use-sync-external-store-shim.js +0 -130
- package/shell-dist/assets/zustand-middleware.js +0 -513
- package/shell-dist/assets/zustand-react-shallow.js +0 -27
- package/shell-dist/assets/zustand-react.js +0 -39
- package/shell-dist/assets/zustand-shallow.js +0 -22
- package/shell-dist/assets/zustand-vanilla-shallow.js +0 -71
- package/shell-dist/assets/zustand-vanilla.js +0 -40
- package/shell-dist/assets/zustand.js +0 -32
- /package/shell-dist/assets/{index-xZhmujjM.js → index.i0kqbxp050.js} +0 -0
- /package/shell-dist/assets/{nprogress-css.js → nprogress-css.1cq2pzkre0.js} +0 -0
- /package/shell-dist/assets/{ojm-antd-es-button.js → ojm-antd-es-button.2uriphio50.js} +0 -0
- /package/shell-dist/assets/{ojm-antd-es-modal.js → ojm-antd-es-modal.bf3tgdh8v0.js} +0 -0
- /package/shell-dist/assets/{ojm-antd-es-slider.js → ojm-antd-es-slider.xyvptuhid0.js} +0 -0
- /package/shell-dist/assets/{ojm-antd-es-upload.js → ojm-antd-es-upload.13gx45e0g0.js} +0 -0
|
@@ -1,1773 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __export = (target, all) => {
|
|
3
|
-
for (var name in all)
|
|
4
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/index.js
|
|
8
|
-
var es_exports = {};
|
|
9
|
-
__export(es_exports, {
|
|
10
|
-
I18nContext: () => I18nContext,
|
|
11
|
-
I18nextProvider: () => I18nextProvider,
|
|
12
|
-
IcuTrans: () => IcuTrans,
|
|
13
|
-
IcuTransWithoutContext: () => IcuTransWithoutContext,
|
|
14
|
-
Trans: () => Trans2,
|
|
15
|
-
TransWithoutContext: () => Trans,
|
|
16
|
-
Translation: () => Translation,
|
|
17
|
-
composeInitialProps: () => composeInitialProps,
|
|
18
|
-
date: () => date,
|
|
19
|
-
getDefaults: () => getDefaults,
|
|
20
|
-
getI18n: () => getI18n,
|
|
21
|
-
getInitialProps: () => getInitialProps,
|
|
22
|
-
initReactI18next: () => initReactI18next,
|
|
23
|
-
nodesToString: () => nodesToString,
|
|
24
|
-
number: () => number,
|
|
25
|
-
plural: () => plural,
|
|
26
|
-
select: () => select,
|
|
27
|
-
selectOrdinal: () => selectOrdinal,
|
|
28
|
-
setDefaults: () => setDefaults,
|
|
29
|
-
setI18n: () => setI18n,
|
|
30
|
-
time: () => time,
|
|
31
|
-
useSSR: () => useSSR,
|
|
32
|
-
useTranslation: () => useTranslation,
|
|
33
|
-
withSSR: () => withSSR,
|
|
34
|
-
withTranslation: () => withTranslation
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/Trans.js
|
|
38
|
-
import { useContext } from "react";
|
|
39
|
-
|
|
40
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/TransWithoutContext.js
|
|
41
|
-
import { Fragment, isValidElement, cloneElement, createElement, Children } from "react";
|
|
42
|
-
import { keyFromSelector } from "i18next";
|
|
43
|
-
|
|
44
|
-
// ../../node_modules/.pnpm/html-parse-stringify@4.0.1/node_modules/html-parse-stringify/dist/esm/html-parse-stringify.js
|
|
45
|
-
var voidElements = {
|
|
46
|
-
area: true,
|
|
47
|
-
base: true,
|
|
48
|
-
br: true,
|
|
49
|
-
col: true,
|
|
50
|
-
embed: true,
|
|
51
|
-
hr: true,
|
|
52
|
-
img: true,
|
|
53
|
-
input: true,
|
|
54
|
-
link: true,
|
|
55
|
-
meta: true,
|
|
56
|
-
param: true,
|
|
57
|
-
source: true,
|
|
58
|
-
track: true,
|
|
59
|
-
wbr: true,
|
|
60
|
-
"!doctype": true,
|
|
61
|
-
"!DOCTYPE": true
|
|
62
|
-
};
|
|
63
|
-
var attrRE = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?("[^"]*"|'[^']*')/g;
|
|
64
|
-
function parseTag(tag) {
|
|
65
|
-
const res = {
|
|
66
|
-
type: "tag",
|
|
67
|
-
name: "",
|
|
68
|
-
voidElement: false,
|
|
69
|
-
attrs: {},
|
|
70
|
-
children: []
|
|
71
|
-
};
|
|
72
|
-
const tagMatch = tag.match(/<\/?([^\s]+?)[/\s>]/);
|
|
73
|
-
if (tagMatch) {
|
|
74
|
-
res.name = tagMatch[1];
|
|
75
|
-
if (voidElements[tagMatch[1]] || tag.charAt(tag.length - 2) === "/") {
|
|
76
|
-
res.voidElement = true;
|
|
77
|
-
}
|
|
78
|
-
if (res.name.startsWith("!--")) {
|
|
79
|
-
const endIndex = tag.indexOf("-->");
|
|
80
|
-
return {
|
|
81
|
-
type: "comment",
|
|
82
|
-
comment: endIndex !== -1 ? tag.slice(4, endIndex) : ""
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
const reg = new RegExp(attrRE);
|
|
87
|
-
let result = null;
|
|
88
|
-
for (; ; ) {
|
|
89
|
-
result = reg.exec(tag);
|
|
90
|
-
if (result === null) {
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
if (!result[0].trim()) {
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
if (result[1]) {
|
|
97
|
-
const attr = result[1].trim();
|
|
98
|
-
let arr = [attr, null];
|
|
99
|
-
const eq = attr.indexOf("=");
|
|
100
|
-
if (eq > -1) {
|
|
101
|
-
arr = [attr.slice(0, eq), attr.slice(eq + 1)];
|
|
102
|
-
}
|
|
103
|
-
res.attrs[arr[0]] = arr[1];
|
|
104
|
-
reg.lastIndex--;
|
|
105
|
-
} else if (result[2]) {
|
|
106
|
-
res.attrs[result[2]] = result[3].trim().substring(1, result[3].length - 1);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return res;
|
|
110
|
-
}
|
|
111
|
-
var tagRE = /<!--[\s\S]*?-->|<[a-zA-Z0-9\-!/](?:"[^"]*"|'[^']*'|[^'">])*>/g;
|
|
112
|
-
var tagNameRE = /<\/?([^\s]+?)[/\s>]/;
|
|
113
|
-
var whitespaceRE = /^\s*$/;
|
|
114
|
-
var rawTextRE = /^(script|style)$/i;
|
|
115
|
-
var sentinel = "\0";
|
|
116
|
-
var empty = /* @__PURE__ */ Object.create(null);
|
|
117
|
-
function restoreSentinels(nodes) {
|
|
118
|
-
nodes.forEach(function(node) {
|
|
119
|
-
if (node.type === "text") {
|
|
120
|
-
node.content = node.content.split(sentinel).join("<");
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (node.type === "comment") {
|
|
124
|
-
node.comment = node.comment.split(sentinel).join("<");
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
for (const key in node.attrs) {
|
|
128
|
-
const value = node.attrs[key];
|
|
129
|
-
if (typeof value === "string" && value.indexOf(sentinel) > -1) {
|
|
130
|
-
node.attrs[key] = value.split(sentinel).join("<");
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
if (node.children.length) {
|
|
134
|
-
restoreSentinels(node.children);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
function parse(html, options) {
|
|
139
|
-
const components = options && options.components || empty;
|
|
140
|
-
const allowedTags = options && options.allowedTags;
|
|
141
|
-
let restoreNeeded = false;
|
|
142
|
-
if (allowedTags) {
|
|
143
|
-
const isAllowed = typeof allowedTags === "function" ? allowedTags : function(name) {
|
|
144
|
-
return allowedTags.indexOf(name) > -1;
|
|
145
|
-
};
|
|
146
|
-
let out = "";
|
|
147
|
-
let pos = 0;
|
|
148
|
-
tagRE.lastIndex = 0;
|
|
149
|
-
let am;
|
|
150
|
-
while (am = tagRE.exec(html)) {
|
|
151
|
-
const tag = am[0];
|
|
152
|
-
out += html.slice(pos, am.index);
|
|
153
|
-
const nameMatch = tag.match(tagNameRE);
|
|
154
|
-
if (tag.startsWith("<!--") || nameMatch && isAllowed(nameMatch[1])) {
|
|
155
|
-
out += tag;
|
|
156
|
-
pos = am.index + tag.length;
|
|
157
|
-
} else {
|
|
158
|
-
restoreNeeded = true;
|
|
159
|
-
out += sentinel;
|
|
160
|
-
pos = am.index + 1;
|
|
161
|
-
tagRE.lastIndex = pos;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
html = out + html.slice(pos);
|
|
165
|
-
}
|
|
166
|
-
const result = [];
|
|
167
|
-
const arr = [];
|
|
168
|
-
let current;
|
|
169
|
-
let level = -1;
|
|
170
|
-
let inComponent = false;
|
|
171
|
-
let rawUntil = 0;
|
|
172
|
-
let htmlLower;
|
|
173
|
-
if (html.indexOf("<") !== 0) {
|
|
174
|
-
const end = html.indexOf("<");
|
|
175
|
-
result.push({
|
|
176
|
-
type: "text",
|
|
177
|
-
content: end === -1 ? html : html.substring(0, end)
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
const matches = [];
|
|
181
|
-
let m;
|
|
182
|
-
while (m = tagRE.exec(html)) {
|
|
183
|
-
matches.push(m);
|
|
184
|
-
}
|
|
185
|
-
matches.forEach(function(match, i) {
|
|
186
|
-
const tag = match[0];
|
|
187
|
-
if (!tag) return;
|
|
188
|
-
if (tag.startsWith("<!--")) return;
|
|
189
|
-
let lts = 0;
|
|
190
|
-
let gts = 0;
|
|
191
|
-
let secondLt = -1;
|
|
192
|
-
let quote = null;
|
|
193
|
-
for (let j = 0; j < tag.length; j++) {
|
|
194
|
-
const c = tag.charAt(j);
|
|
195
|
-
if (quote) {
|
|
196
|
-
if (c === quote) quote = null;
|
|
197
|
-
} else if (c === '"' || c === "'") {
|
|
198
|
-
quote = c;
|
|
199
|
-
} else if (c === "<") {
|
|
200
|
-
lts++;
|
|
201
|
-
if (lts === 2) secondLt = j;
|
|
202
|
-
} else if (c === ">") {
|
|
203
|
-
gts++;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
const validSplit = secondLt > -1 && /[a-zA-Z0-9\-!/]/.test(tag.charAt(secondLt + 1));
|
|
207
|
-
if (lts > gts && validSplit) {
|
|
208
|
-
const firstPart = tag.substring(0, secondLt);
|
|
209
|
-
const secondPart = tag.substring(firstPart.length);
|
|
210
|
-
matches[i][0] = secondPart;
|
|
211
|
-
matches[i].index += firstPart.length;
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
matches.forEach(function(match, i) {
|
|
215
|
-
const tag = match[0];
|
|
216
|
-
if (!tag) return;
|
|
217
|
-
const index2 = match.index;
|
|
218
|
-
if (index2 < rawUntil) return;
|
|
219
|
-
if (inComponent) {
|
|
220
|
-
if (tag !== "</" + current.name + ">") {
|
|
221
|
-
return;
|
|
222
|
-
} else {
|
|
223
|
-
inComponent = false;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
const isOpen = tag.charAt(1) !== "/";
|
|
227
|
-
const isComment = tag.startsWith("<!--");
|
|
228
|
-
const start = index2 + tag.length;
|
|
229
|
-
const nextChar = html.charAt(start);
|
|
230
|
-
const nextMatch = matches[i + 1];
|
|
231
|
-
let isText;
|
|
232
|
-
if (nextChar === "<" && nextMatch) {
|
|
233
|
-
const nextTag = html.substring(start, nextMatch.index);
|
|
234
|
-
isText = nextTag.split("<").length > nextTag.split(">").length;
|
|
235
|
-
}
|
|
236
|
-
let parent;
|
|
237
|
-
if (isComment) {
|
|
238
|
-
const comment = parseTag(tag);
|
|
239
|
-
if (level < 0) {
|
|
240
|
-
result.push(comment);
|
|
241
|
-
return result;
|
|
242
|
-
}
|
|
243
|
-
parent = arr[level];
|
|
244
|
-
parent.children.push(comment);
|
|
245
|
-
const text = html.slice(start, nextMatch ? nextMatch.index : void 0);
|
|
246
|
-
if (text.length > 0) {
|
|
247
|
-
parent.children.push({
|
|
248
|
-
type: "text",
|
|
249
|
-
content: text
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
return result;
|
|
253
|
-
}
|
|
254
|
-
if (isOpen) {
|
|
255
|
-
level++;
|
|
256
|
-
current = parseTag(tag);
|
|
257
|
-
if (current.type === "tag" && components[current.name]) {
|
|
258
|
-
current.type = "component";
|
|
259
|
-
inComponent = true;
|
|
260
|
-
}
|
|
261
|
-
let isRawText = false;
|
|
262
|
-
if (!inComponent && !current.voidElement && rawTextRE.test(current.name)) {
|
|
263
|
-
isRawText = true;
|
|
264
|
-
htmlLower || (htmlLower = html.toLowerCase());
|
|
265
|
-
const closeIndex = htmlLower.indexOf(
|
|
266
|
-
"</" + current.name.toLowerCase() + ">",
|
|
267
|
-
start
|
|
268
|
-
);
|
|
269
|
-
const contentEnd = closeIndex === -1 ? html.length : closeIndex;
|
|
270
|
-
const content = html.slice(start, contentEnd);
|
|
271
|
-
if (content) {
|
|
272
|
-
current.children.push({
|
|
273
|
-
type: "text",
|
|
274
|
-
content
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
rawUntil = contentEnd;
|
|
278
|
-
}
|
|
279
|
-
if (!current.voidElement && !inComponent && !isRawText && nextChar && nextChar !== "<") {
|
|
280
|
-
current.children.push({
|
|
281
|
-
type: "text",
|
|
282
|
-
content: html.slice(start, nextMatch ? nextMatch.index : void 0)
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
if (level === 0) {
|
|
286
|
-
result.push(current);
|
|
287
|
-
}
|
|
288
|
-
parent = arr[level - 1];
|
|
289
|
-
if (parent) {
|
|
290
|
-
parent.children.push(current);
|
|
291
|
-
}
|
|
292
|
-
arr[level] = current;
|
|
293
|
-
}
|
|
294
|
-
if (!isOpen || current.voidElement) {
|
|
295
|
-
if (level > -1 && (current.voidElement || current.name === tag.slice(2, -1))) {
|
|
296
|
-
level--;
|
|
297
|
-
current = level === -1 ? result : arr[level];
|
|
298
|
-
}
|
|
299
|
-
if (!inComponent && (nextChar !== "<" || isText) && nextChar) {
|
|
300
|
-
parent = level === -1 ? result : arr[level].children;
|
|
301
|
-
const end = nextMatch ? nextMatch.index : -1;
|
|
302
|
-
let content = html.slice(start, end === -1 ? void 0 : end);
|
|
303
|
-
if (whitespaceRE.test(content)) {
|
|
304
|
-
content = " ";
|
|
305
|
-
}
|
|
306
|
-
if (end > -1 && level + parent.length >= 0 || content !== " ") {
|
|
307
|
-
parent.push({
|
|
308
|
-
type: "text",
|
|
309
|
-
content
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
if (restoreNeeded) {
|
|
316
|
-
restoreSentinels(result);
|
|
317
|
-
}
|
|
318
|
-
return result;
|
|
319
|
-
}
|
|
320
|
-
function attrString(attrs) {
|
|
321
|
-
const buff = [];
|
|
322
|
-
for (const key in attrs) {
|
|
323
|
-
if (attrs[key] === null) {
|
|
324
|
-
buff.push(key);
|
|
325
|
-
} else {
|
|
326
|
-
buff.push(key + '="' + String(attrs[key]).replace(/"/g, """) + '"');
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
if (!buff.length) {
|
|
330
|
-
return "";
|
|
331
|
-
}
|
|
332
|
-
return " " + buff.join(" ");
|
|
333
|
-
}
|
|
334
|
-
function stringifyNode(buff, doc) {
|
|
335
|
-
switch (doc.type) {
|
|
336
|
-
case "text":
|
|
337
|
-
return buff + doc.content;
|
|
338
|
-
case "tag": {
|
|
339
|
-
const tagEnd = doc.voidElement && doc.name.toLowerCase() !== "!doctype" ? "/>" : ">";
|
|
340
|
-
buff += "<" + doc.name + (doc.attrs ? attrString(doc.attrs) : "") + tagEnd;
|
|
341
|
-
if (doc.voidElement) {
|
|
342
|
-
return buff;
|
|
343
|
-
}
|
|
344
|
-
return buff + doc.children.reduce(stringifyNode, "") + "</" + doc.name + ">";
|
|
345
|
-
}
|
|
346
|
-
case "comment":
|
|
347
|
-
buff += "<!--" + doc.comment + "-->";
|
|
348
|
-
return buff;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
function stringify(doc) {
|
|
352
|
-
return doc.reduce(function(token, rootEl) {
|
|
353
|
-
return token + stringifyNode("", rootEl);
|
|
354
|
-
}, "");
|
|
355
|
-
}
|
|
356
|
-
var index = {
|
|
357
|
-
parse,
|
|
358
|
-
stringify
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/utils.js
|
|
362
|
-
var warn = (i18n, code, msg, rest) => {
|
|
363
|
-
const args = [msg, {
|
|
364
|
-
code,
|
|
365
|
-
...rest || {}
|
|
366
|
-
}];
|
|
367
|
-
if (i18n?.services?.logger?.forward) {
|
|
368
|
-
return i18n.services.logger.forward(args, "warn", "react-i18next::", true);
|
|
369
|
-
}
|
|
370
|
-
if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`;
|
|
371
|
-
if (i18n?.services?.logger?.warn) {
|
|
372
|
-
i18n.services.logger.warn(...args);
|
|
373
|
-
} else if (console?.warn) {
|
|
374
|
-
console.warn(...args);
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
var alreadyWarned = {};
|
|
378
|
-
var warnOnce = (i18n, code, msg, rest) => {
|
|
379
|
-
if (isString(msg) && alreadyWarned[msg]) return;
|
|
380
|
-
if (isString(msg)) alreadyWarned[msg] = /* @__PURE__ */ new Date();
|
|
381
|
-
warn(i18n, code, msg, rest);
|
|
382
|
-
};
|
|
383
|
-
var loadedClb = (i18n, cb) => () => {
|
|
384
|
-
if (i18n.isInitialized) {
|
|
385
|
-
cb();
|
|
386
|
-
} else {
|
|
387
|
-
const initialized = () => {
|
|
388
|
-
setTimeout(() => {
|
|
389
|
-
i18n.off("initialized", initialized);
|
|
390
|
-
}, 0);
|
|
391
|
-
cb();
|
|
392
|
-
};
|
|
393
|
-
i18n.on("initialized", initialized);
|
|
394
|
-
}
|
|
395
|
-
};
|
|
396
|
-
var loadNamespaces = (i18n, ns, cb) => {
|
|
397
|
-
i18n.loadNamespaces(ns, loadedClb(i18n, cb));
|
|
398
|
-
};
|
|
399
|
-
var loadLanguages = (i18n, lng, ns, cb) => {
|
|
400
|
-
if (isString(ns)) ns = [ns];
|
|
401
|
-
if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb);
|
|
402
|
-
ns.forEach((n) => {
|
|
403
|
-
if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
|
|
404
|
-
});
|
|
405
|
-
i18n.loadLanguages(lng, loadedClb(i18n, cb));
|
|
406
|
-
};
|
|
407
|
-
var hasLoadedNamespace = (ns, i18n, options = {}) => {
|
|
408
|
-
if (!i18n.languages || !i18n.languages.length) {
|
|
409
|
-
warnOnce(i18n, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
|
|
410
|
-
languages: i18n.languages
|
|
411
|
-
});
|
|
412
|
-
return true;
|
|
413
|
-
}
|
|
414
|
-
return i18n.hasLoadedNamespace(ns, {
|
|
415
|
-
lng: options.lng,
|
|
416
|
-
precheck: (i18nInstance2, loadNotPending) => {
|
|
417
|
-
if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns)) return false;
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
};
|
|
421
|
-
var getDisplayName = (Component) => Component.displayName || Component.name || (isString(Component) && Component.length > 0 ? Component : "Unknown");
|
|
422
|
-
var isString = (obj) => typeof obj === "string";
|
|
423
|
-
var isObject = (obj) => typeof obj === "object" && obj !== null;
|
|
424
|
-
|
|
425
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/unescape.js
|
|
426
|
-
var matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
|
|
427
|
-
var htmlEntities = {
|
|
428
|
-
"&": "&",
|
|
429
|
-
"&": "&",
|
|
430
|
-
"<": "<",
|
|
431
|
-
"<": "<",
|
|
432
|
-
">": ">",
|
|
433
|
-
">": ">",
|
|
434
|
-
"'": "'",
|
|
435
|
-
"'": "'",
|
|
436
|
-
""": '"',
|
|
437
|
-
""": '"',
|
|
438
|
-
" ": " ",
|
|
439
|
-
" ": " ",
|
|
440
|
-
"©": "\xA9",
|
|
441
|
-
"©": "\xA9",
|
|
442
|
-
"®": "\xAE",
|
|
443
|
-
"®": "\xAE",
|
|
444
|
-
"…": "\u2026",
|
|
445
|
-
"…": "\u2026",
|
|
446
|
-
"/": "/",
|
|
447
|
-
"/": "/"
|
|
448
|
-
};
|
|
449
|
-
var unescapeHtmlEntity = (m) => htmlEntities[m];
|
|
450
|
-
var unescape = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity);
|
|
451
|
-
|
|
452
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/defaults.js
|
|
453
|
-
var defaultOptions = {
|
|
454
|
-
bindI18n: "languageChanged",
|
|
455
|
-
bindI18nStore: "",
|
|
456
|
-
transEmptyNodeValue: "",
|
|
457
|
-
transSupportBasicHtmlNodes: true,
|
|
458
|
-
transWrapTextNodes: "",
|
|
459
|
-
transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
|
|
460
|
-
useSuspense: true,
|
|
461
|
-
unescape,
|
|
462
|
-
transDefaultProps: void 0
|
|
463
|
-
};
|
|
464
|
-
var setDefaults = (options = {}) => {
|
|
465
|
-
defaultOptions = {
|
|
466
|
-
...defaultOptions,
|
|
467
|
-
...options
|
|
468
|
-
};
|
|
469
|
-
};
|
|
470
|
-
var getDefaults = () => defaultOptions;
|
|
471
|
-
|
|
472
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/i18nInstance.js
|
|
473
|
-
var i18nInstance;
|
|
474
|
-
var setI18n = (instance) => {
|
|
475
|
-
i18nInstance = instance;
|
|
476
|
-
};
|
|
477
|
-
var getI18n = () => i18nInstance;
|
|
478
|
-
|
|
479
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/TransWithoutContext.js
|
|
480
|
-
var hasChildren = (node, checkLength) => {
|
|
481
|
-
if (!node) return false;
|
|
482
|
-
const base = node.props?.children ?? node.children;
|
|
483
|
-
if (checkLength) return base.length > 0;
|
|
484
|
-
return !!base;
|
|
485
|
-
};
|
|
486
|
-
var getChildren = (node) => {
|
|
487
|
-
if (!node) return [];
|
|
488
|
-
const children = node.props?.children ?? node.children;
|
|
489
|
-
return node.props?.i18nIsDynamicList ? getAsArray(children) : children;
|
|
490
|
-
};
|
|
491
|
-
var hasValidReactChildren = (children) => Array.isArray(children) && children.every(isValidElement);
|
|
492
|
-
var getAsArray = (data) => Array.isArray(data) ? data : [data];
|
|
493
|
-
var mergeProps = (source, target) => {
|
|
494
|
-
const newTarget = {
|
|
495
|
-
...target
|
|
496
|
-
};
|
|
497
|
-
newTarget.props = {
|
|
498
|
-
...target.props,
|
|
499
|
-
...source.props
|
|
500
|
-
};
|
|
501
|
-
return newTarget;
|
|
502
|
-
};
|
|
503
|
-
var getValuesFromChildren = (children) => {
|
|
504
|
-
const values = {};
|
|
505
|
-
if (!children) return values;
|
|
506
|
-
const getData = (childs) => {
|
|
507
|
-
const childrenArray = getAsArray(childs);
|
|
508
|
-
childrenArray.forEach((child) => {
|
|
509
|
-
if (isString(child)) return;
|
|
510
|
-
if (hasChildren(child)) getData(getChildren(child));
|
|
511
|
-
else if (isObject(child) && !isValidElement(child)) Object.assign(values, child);
|
|
512
|
-
});
|
|
513
|
-
};
|
|
514
|
-
getData(children);
|
|
515
|
-
return values;
|
|
516
|
-
};
|
|
517
|
-
var nodesToString = (children, i18nOptions, i18n, i18nKey) => {
|
|
518
|
-
if (!children) return "";
|
|
519
|
-
let stringNode = "";
|
|
520
|
-
const childrenArray = getAsArray(children);
|
|
521
|
-
const keepArray = i18nOptions?.transSupportBasicHtmlNodes ? i18nOptions.transKeepBasicHtmlNodesFor ?? [] : [];
|
|
522
|
-
childrenArray.forEach((child, childIndex) => {
|
|
523
|
-
if (isString(child)) {
|
|
524
|
-
stringNode += `${child}`;
|
|
525
|
-
return;
|
|
526
|
-
}
|
|
527
|
-
if (isValidElement(child)) {
|
|
528
|
-
const {
|
|
529
|
-
props,
|
|
530
|
-
type
|
|
531
|
-
} = child;
|
|
532
|
-
const childPropsCount = Object.keys(props).length;
|
|
533
|
-
const shouldKeepChild = keepArray.indexOf(type) > -1;
|
|
534
|
-
const childChildren = props.children;
|
|
535
|
-
if (!childChildren && shouldKeepChild && !childPropsCount) {
|
|
536
|
-
stringNode += `<${type}/>`;
|
|
537
|
-
return;
|
|
538
|
-
}
|
|
539
|
-
if (!childChildren && (!shouldKeepChild || childPropsCount) || props.i18nIsDynamicList) {
|
|
540
|
-
stringNode += `<${childIndex}></${childIndex}>`;
|
|
541
|
-
return;
|
|
542
|
-
}
|
|
543
|
-
if (shouldKeepChild && childPropsCount <= 1) {
|
|
544
|
-
const cnt = isString(childChildren) ? childChildren : nodesToString(childChildren, i18nOptions, i18n, i18nKey);
|
|
545
|
-
stringNode += `<${type}>${cnt}</${type}>`;
|
|
546
|
-
return;
|
|
547
|
-
}
|
|
548
|
-
const content = nodesToString(childChildren, i18nOptions, i18n, i18nKey);
|
|
549
|
-
stringNode += `<${childIndex}>${content}</${childIndex}>`;
|
|
550
|
-
return;
|
|
551
|
-
}
|
|
552
|
-
if (child === null) {
|
|
553
|
-
warn(i18n, "TRANS_NULL_VALUE", `Passed in a null value as child`, {
|
|
554
|
-
i18nKey
|
|
555
|
-
});
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
558
|
-
if (isObject(child)) {
|
|
559
|
-
const {
|
|
560
|
-
format,
|
|
561
|
-
...clone
|
|
562
|
-
} = child;
|
|
563
|
-
const keys = Object.keys(clone);
|
|
564
|
-
if (keys.length === 1) {
|
|
565
|
-
const value = format ? `${keys[0]}, ${format}` : keys[0];
|
|
566
|
-
stringNode += `{{${value}}}`;
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
569
|
-
warn(i18n, "TRANS_INVALID_OBJ", `Invalid child - Object should only have keys {{ value, format }} (format is optional).`, {
|
|
570
|
-
i18nKey,
|
|
571
|
-
child
|
|
572
|
-
});
|
|
573
|
-
return;
|
|
574
|
-
}
|
|
575
|
-
warn(i18n, "TRANS_INVALID_VAR", `Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`, {
|
|
576
|
-
i18nKey,
|
|
577
|
-
child
|
|
578
|
-
});
|
|
579
|
-
});
|
|
580
|
-
return stringNode;
|
|
581
|
-
};
|
|
582
|
-
var renderNodes = (children, knownComponentsMap, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) => {
|
|
583
|
-
if (targetString === "") return [];
|
|
584
|
-
const keepArray = i18nOptions.transKeepBasicHtmlNodesFor || [];
|
|
585
|
-
const emptyChildrenButNeedsHandling = targetString && new RegExp(keepArray.map((keep) => `<${keep}`).join("|")).test(targetString);
|
|
586
|
-
if (!children && !knownComponentsMap && !emptyChildrenButNeedsHandling && !shouldUnescape) return [targetString];
|
|
587
|
-
const data = knownComponentsMap ?? {};
|
|
588
|
-
const getData = (childs) => {
|
|
589
|
-
const childrenArray = getAsArray(childs);
|
|
590
|
-
childrenArray.forEach((child) => {
|
|
591
|
-
if (isString(child)) return;
|
|
592
|
-
if (hasChildren(child)) getData(getChildren(child));
|
|
593
|
-
else if (isObject(child) && !isValidElement(child)) Object.assign(data, child);
|
|
594
|
-
});
|
|
595
|
-
};
|
|
596
|
-
getData(children);
|
|
597
|
-
const knownNames = Object.keys(data);
|
|
598
|
-
const allowedTags = (name) => /^\d+$/.test(name) || keepArray.indexOf(name) > -1 || knownNames.indexOf(name) > -1;
|
|
599
|
-
const ast = index.parse(`<0>${targetString}</0>`, {
|
|
600
|
-
allowedTags
|
|
601
|
-
});
|
|
602
|
-
const opts = {
|
|
603
|
-
...data,
|
|
604
|
-
...combinedTOpts
|
|
605
|
-
};
|
|
606
|
-
const renderInner = (child, node, rootReactNode) => {
|
|
607
|
-
const childs = getChildren(child);
|
|
608
|
-
const mappedChildren = mapAST(childs, node.children, rootReactNode);
|
|
609
|
-
return hasValidReactChildren(childs) && mappedChildren.length === 0 || child.props?.i18nIsDynamicList ? childs : mappedChildren;
|
|
610
|
-
};
|
|
611
|
-
const pushTranslatedJSX = (child, inner, mem, i, isVoid) => {
|
|
612
|
-
if (child.dummy) {
|
|
613
|
-
child.children = inner;
|
|
614
|
-
mem.push(cloneElement(child, {
|
|
615
|
-
key: i
|
|
616
|
-
}, isVoid ? void 0 : inner));
|
|
617
|
-
} else {
|
|
618
|
-
mem.push(...Children.map([child], (c) => {
|
|
619
|
-
if (c.type === Fragment || c.props?.i18nIsDynamicList !== void 0) {
|
|
620
|
-
const freshProps = {
|
|
621
|
-
key: i
|
|
622
|
-
};
|
|
623
|
-
if (c && c.props) {
|
|
624
|
-
Object.keys(c.props).forEach((k) => {
|
|
625
|
-
if (k === "children" || k === "i18nIsDynamicList") return;
|
|
626
|
-
freshProps[k] = c.props[k];
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
return createElement(c.type, freshProps, isVoid ? null : inner);
|
|
630
|
-
}
|
|
631
|
-
const override = {
|
|
632
|
-
key: i
|
|
633
|
-
};
|
|
634
|
-
if (c && c.props) {
|
|
635
|
-
Object.keys(c.props).forEach((k) => {
|
|
636
|
-
if (k === "ref" || k === "children") return;
|
|
637
|
-
override[k] = c.props[k];
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
return cloneElement(c, override, isVoid ? null : inner);
|
|
641
|
-
}));
|
|
642
|
-
}
|
|
643
|
-
};
|
|
644
|
-
const mapAST = (reactNode, astNode, rootReactNode) => {
|
|
645
|
-
const reactNodes = getAsArray(reactNode);
|
|
646
|
-
const astNodes = getAsArray(astNode);
|
|
647
|
-
const keepTagOccurrence = {};
|
|
648
|
-
return astNodes.reduce((mem, node, i) => {
|
|
649
|
-
const translationContent = node.children?.[0]?.content && i18n.services.interpolator.interpolate(node.children[0].content, opts, i18n.language);
|
|
650
|
-
if (node.type === "tag") {
|
|
651
|
-
let tmp = reactNodes[parseInt(node.name, 10)];
|
|
652
|
-
if (!tmp && knownComponentsMap) tmp = knownComponentsMap[node.name];
|
|
653
|
-
if (rootReactNode.length === 1 && !tmp) tmp = rootReactNode[0][node.name];
|
|
654
|
-
if (!tmp) tmp = {};
|
|
655
|
-
const props = {
|
|
656
|
-
...node.attrs
|
|
657
|
-
};
|
|
658
|
-
if (shouldUnescape) {
|
|
659
|
-
Object.keys(props).forEach((p) => {
|
|
660
|
-
const val = props[p];
|
|
661
|
-
if (isString(val)) {
|
|
662
|
-
props[p] = unescape(val);
|
|
663
|
-
}
|
|
664
|
-
});
|
|
665
|
-
}
|
|
666
|
-
const child = Object.keys(props).length !== 0 ? mergeProps({
|
|
667
|
-
props
|
|
668
|
-
}, tmp) : tmp;
|
|
669
|
-
const isElement = isValidElement(child);
|
|
670
|
-
const isValidTranslationWithChildren = isElement && hasChildren(node, true) && !node.voidElement;
|
|
671
|
-
const isEmptyTransWithHTML = emptyChildrenButNeedsHandling && isObject(child) && child.dummy && !isElement;
|
|
672
|
-
const isKnownComponent = isObject(knownComponentsMap) && Object.hasOwnProperty.call(knownComponentsMap, node.name);
|
|
673
|
-
if (isString(child)) {
|
|
674
|
-
const value = i18n.services.interpolator.interpolate(child, opts, i18n.language);
|
|
675
|
-
mem.push(value);
|
|
676
|
-
} else if (hasChildren(child) || isValidTranslationWithChildren) {
|
|
677
|
-
const inner = renderInner(child, node, rootReactNode);
|
|
678
|
-
pushTranslatedJSX(child, inner, mem, i);
|
|
679
|
-
} else if (isEmptyTransWithHTML) {
|
|
680
|
-
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
681
|
-
pushTranslatedJSX(child, inner, mem, i);
|
|
682
|
-
} else if (Number.isNaN(parseFloat(node.name))) {
|
|
683
|
-
if (isKnownComponent) {
|
|
684
|
-
const inner = renderInner(child, node, rootReactNode);
|
|
685
|
-
pushTranslatedJSX(child, inner, mem, i, node.voidElement);
|
|
686
|
-
} else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node.name) > -1) {
|
|
687
|
-
if (node.voidElement) {
|
|
688
|
-
mem.push(createElement(node.name, {
|
|
689
|
-
key: `${node.name}-${i}`
|
|
690
|
-
}));
|
|
691
|
-
} else {
|
|
692
|
-
const occurrence = keepTagOccurrence[node.name] || 0;
|
|
693
|
-
keepTagOccurrence[node.name] = occurrence + 1;
|
|
694
|
-
let matched;
|
|
695
|
-
let seen = 0;
|
|
696
|
-
for (let r = 0; r < reactNodes.length; r += 1) {
|
|
697
|
-
const rn = reactNodes[r];
|
|
698
|
-
if (isValidElement(rn) && rn.type === node.name) {
|
|
699
|
-
if (seen === occurrence) {
|
|
700
|
-
matched = rn;
|
|
701
|
-
break;
|
|
702
|
-
}
|
|
703
|
-
seen += 1;
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
const innerScope = matched ? getAsArray(getChildren(matched)) : reactNodes;
|
|
707
|
-
const inner = mapAST(innerScope, node.children, rootReactNode);
|
|
708
|
-
mem.push(createElement(node.name, {
|
|
709
|
-
key: `${node.name}-${i}`
|
|
710
|
-
}, inner));
|
|
711
|
-
}
|
|
712
|
-
} else if (node.voidElement) {
|
|
713
|
-
mem.push(`<${node.name} />`);
|
|
714
|
-
} else {
|
|
715
|
-
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
716
|
-
mem.push(`<${node.name}>${inner}</${node.name}>`);
|
|
717
|
-
}
|
|
718
|
-
} else if (isObject(child) && !isElement) {
|
|
719
|
-
const content = node.children[0] ? translationContent : null;
|
|
720
|
-
if (content) mem.push(content);
|
|
721
|
-
} else {
|
|
722
|
-
pushTranslatedJSX(child, translationContent, mem, i, node.children.length !== 1 || !translationContent);
|
|
723
|
-
}
|
|
724
|
-
} else if (node.type === "text") {
|
|
725
|
-
const wrapTextNodes = i18nOptions.transWrapTextNodes;
|
|
726
|
-
const unescapeFn = typeof i18nOptions.unescape === "function" ? i18nOptions.unescape : getDefaults().unescape;
|
|
727
|
-
const content = shouldUnescape ? unescapeFn(i18n.services.interpolator.interpolate(node.content, opts, i18n.language)) : i18n.services.interpolator.interpolate(node.content, opts, i18n.language);
|
|
728
|
-
if (wrapTextNodes) {
|
|
729
|
-
mem.push(createElement(wrapTextNodes, {
|
|
730
|
-
key: `${node.name}-${i}`
|
|
731
|
-
}, content));
|
|
732
|
-
} else {
|
|
733
|
-
mem.push(content);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
return mem;
|
|
737
|
-
}, []);
|
|
738
|
-
};
|
|
739
|
-
const result = mapAST([{
|
|
740
|
-
dummy: true,
|
|
741
|
-
children: children || []
|
|
742
|
-
}], ast, getAsArray(children || []));
|
|
743
|
-
return getChildren(result[0]);
|
|
744
|
-
};
|
|
745
|
-
var fixComponentProps = (component, index2, translation) => {
|
|
746
|
-
const componentKey = component.key || index2;
|
|
747
|
-
const comp = cloneElement(component, {
|
|
748
|
-
key: componentKey
|
|
749
|
-
});
|
|
750
|
-
if (!comp.props || !comp.props.children || translation.indexOf(`${index2}/>`) < 0 && translation.indexOf(`${index2} />`) < 0) {
|
|
751
|
-
return comp;
|
|
752
|
-
}
|
|
753
|
-
function Componentized() {
|
|
754
|
-
return createElement(Fragment, null, comp);
|
|
755
|
-
}
|
|
756
|
-
return createElement(Componentized, {
|
|
757
|
-
key: componentKey
|
|
758
|
-
});
|
|
759
|
-
};
|
|
760
|
-
var generateArrayComponents = (components, translation) => components.map((c, index2) => fixComponentProps(c, index2, translation));
|
|
761
|
-
var generateObjectComponents = (components, translation) => {
|
|
762
|
-
const componentMap = {};
|
|
763
|
-
Object.keys(components).forEach((c) => {
|
|
764
|
-
Object.assign(componentMap, {
|
|
765
|
-
[c]: fixComponentProps(components[c], c, translation)
|
|
766
|
-
});
|
|
767
|
-
});
|
|
768
|
-
return componentMap;
|
|
769
|
-
};
|
|
770
|
-
var generateComponents = (components, translation, i18n, i18nKey) => {
|
|
771
|
-
if (!components) return null;
|
|
772
|
-
if (Array.isArray(components)) {
|
|
773
|
-
return generateArrayComponents(components, translation);
|
|
774
|
-
}
|
|
775
|
-
if (isObject(components)) {
|
|
776
|
-
return generateObjectComponents(components, translation);
|
|
777
|
-
}
|
|
778
|
-
warnOnce(i18n, "TRANS_INVALID_COMPONENTS", `<Trans /> "components" prop expects an object or array`, {
|
|
779
|
-
i18nKey
|
|
780
|
-
});
|
|
781
|
-
return null;
|
|
782
|
-
};
|
|
783
|
-
var isComponentsMap = (object) => {
|
|
784
|
-
if (!isObject(object)) return false;
|
|
785
|
-
if (Array.isArray(object)) return false;
|
|
786
|
-
return Object.keys(object).reduce((acc, key) => acc && Number.isNaN(Number.parseFloat(key)), true);
|
|
787
|
-
};
|
|
788
|
-
function Trans({
|
|
789
|
-
children,
|
|
790
|
-
count,
|
|
791
|
-
parent,
|
|
792
|
-
i18nKey,
|
|
793
|
-
context,
|
|
794
|
-
tOptions = {},
|
|
795
|
-
values,
|
|
796
|
-
defaults,
|
|
797
|
-
components,
|
|
798
|
-
ns,
|
|
799
|
-
i18n: i18nFromProps,
|
|
800
|
-
t: tFromProps,
|
|
801
|
-
shouldUnescape,
|
|
802
|
-
...additionalProps
|
|
803
|
-
}) {
|
|
804
|
-
const i18n = i18nFromProps || getI18n();
|
|
805
|
-
if (!i18n) {
|
|
806
|
-
warnOnce(i18n, "NO_I18NEXT_INSTANCE", `Trans: You need to pass in an i18next instance using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.`, {
|
|
807
|
-
i18nKey
|
|
808
|
-
});
|
|
809
|
-
return children;
|
|
810
|
-
}
|
|
811
|
-
const t = tFromProps || i18n.t.bind(i18n) || ((k) => k);
|
|
812
|
-
const reactI18nextOptions = {
|
|
813
|
-
...getDefaults(),
|
|
814
|
-
...i18n.options?.react
|
|
815
|
-
};
|
|
816
|
-
let namespaces = ns || t.ns || i18n.options?.defaultNS;
|
|
817
|
-
namespaces = isString(namespaces) ? [namespaces] : namespaces || ["translation"];
|
|
818
|
-
const {
|
|
819
|
-
transDefaultProps
|
|
820
|
-
} = reactI18nextOptions;
|
|
821
|
-
const mergedTOptions = transDefaultProps?.tOptions ? {
|
|
822
|
-
...transDefaultProps.tOptions,
|
|
823
|
-
...tOptions
|
|
824
|
-
} : tOptions;
|
|
825
|
-
const mergedShouldUnescape = shouldUnescape ?? transDefaultProps?.shouldUnescape;
|
|
826
|
-
const mergedValues = transDefaultProps?.values ? {
|
|
827
|
-
...transDefaultProps.values,
|
|
828
|
-
...values
|
|
829
|
-
} : values;
|
|
830
|
-
const mergedComponents = transDefaultProps?.components ? {
|
|
831
|
-
...transDefaultProps.components,
|
|
832
|
-
...components
|
|
833
|
-
} : components;
|
|
834
|
-
const nodeAsString = nodesToString(children, reactI18nextOptions, i18n, i18nKey);
|
|
835
|
-
const defaultValue = defaults || mergedTOptions?.defaultValue || nodeAsString || reactI18nextOptions.transEmptyNodeValue || (typeof i18nKey === "function" ? keyFromSelector(i18nKey) : i18nKey);
|
|
836
|
-
const {
|
|
837
|
-
hashTransKey
|
|
838
|
-
} = reactI18nextOptions;
|
|
839
|
-
const key = i18nKey || (hashTransKey ? hashTransKey(nodeAsString || defaultValue) : nodeAsString || defaultValue);
|
|
840
|
-
if (i18n.options?.interpolation?.defaultVariables) {
|
|
841
|
-
values = mergedValues && Object.keys(mergedValues).length > 0 ? {
|
|
842
|
-
...mergedValues,
|
|
843
|
-
...i18n.options.interpolation.defaultVariables
|
|
844
|
-
} : {
|
|
845
|
-
...i18n.options.interpolation.defaultVariables
|
|
846
|
-
};
|
|
847
|
-
} else {
|
|
848
|
-
values = mergedValues;
|
|
849
|
-
}
|
|
850
|
-
const valuesFromChildren = getValuesFromChildren(children);
|
|
851
|
-
if (valuesFromChildren && typeof valuesFromChildren.count === "number" && count === void 0) {
|
|
852
|
-
count = valuesFromChildren.count;
|
|
853
|
-
}
|
|
854
|
-
const interpolationOverride = values || count !== void 0 && !i18n.options?.interpolation?.alwaysFormat || !children ? mergedTOptions.interpolation : {
|
|
855
|
-
interpolation: {
|
|
856
|
-
...mergedTOptions.interpolation,
|
|
857
|
-
prefix: "#$?",
|
|
858
|
-
suffix: "?$#"
|
|
859
|
-
}
|
|
860
|
-
};
|
|
861
|
-
const combinedTOpts = {
|
|
862
|
-
...mergedTOptions,
|
|
863
|
-
context: context || mergedTOptions.context,
|
|
864
|
-
count,
|
|
865
|
-
...values,
|
|
866
|
-
...interpolationOverride,
|
|
867
|
-
defaultValue,
|
|
868
|
-
ns: namespaces
|
|
869
|
-
};
|
|
870
|
-
let translation = key ? t(key, combinedTOpts) : defaultValue;
|
|
871
|
-
if (translation === key && defaultValue) translation = defaultValue;
|
|
872
|
-
const generatedComponents = generateComponents(mergedComponents, translation, i18n, i18nKey);
|
|
873
|
-
let indexedChildren = generatedComponents || children;
|
|
874
|
-
let componentsMap = null;
|
|
875
|
-
if (isComponentsMap(generatedComponents)) {
|
|
876
|
-
componentsMap = generatedComponents;
|
|
877
|
-
indexedChildren = children;
|
|
878
|
-
}
|
|
879
|
-
const content = renderNodes(indexedChildren, componentsMap, translation, i18n, reactI18nextOptions, combinedTOpts, mergedShouldUnescape);
|
|
880
|
-
const useAsParent = parent ?? reactI18nextOptions.defaultTransParent;
|
|
881
|
-
return useAsParent ? createElement(useAsParent, additionalProps, content) : content;
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/context.js
|
|
885
|
-
import { createContext } from "react";
|
|
886
|
-
|
|
887
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/initReactI18next.js
|
|
888
|
-
var initReactI18next = {
|
|
889
|
-
type: "3rdParty",
|
|
890
|
-
init(instance) {
|
|
891
|
-
setDefaults(instance.options.react);
|
|
892
|
-
setI18n(instance);
|
|
893
|
-
}
|
|
894
|
-
};
|
|
895
|
-
|
|
896
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/context.js
|
|
897
|
-
var I18nContext = createContext();
|
|
898
|
-
var ReportNamespaces = class {
|
|
899
|
-
constructor() {
|
|
900
|
-
this.usedNamespaces = {};
|
|
901
|
-
}
|
|
902
|
-
addUsedNamespaces(namespaces) {
|
|
903
|
-
namespaces.forEach((ns) => {
|
|
904
|
-
if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
|
|
905
|
-
});
|
|
906
|
-
}
|
|
907
|
-
getUsedNamespaces() {
|
|
908
|
-
return Object.keys(this.usedNamespaces);
|
|
909
|
-
}
|
|
910
|
-
};
|
|
911
|
-
var composeInitialProps = (ForComponent) => async (ctx) => {
|
|
912
|
-
const componentsInitialProps = await ForComponent.getInitialProps?.(ctx) ?? {};
|
|
913
|
-
const i18nInitialProps = getInitialProps();
|
|
914
|
-
return {
|
|
915
|
-
...componentsInitialProps,
|
|
916
|
-
...i18nInitialProps
|
|
917
|
-
};
|
|
918
|
-
};
|
|
919
|
-
var getInitialProps = () => {
|
|
920
|
-
const i18n = getI18n();
|
|
921
|
-
if (!i18n) {
|
|
922
|
-
console.warn("react-i18next:: getInitialProps: You will need to pass in an i18next instance by using initReactI18next");
|
|
923
|
-
return {};
|
|
924
|
-
}
|
|
925
|
-
const namespaces = i18n.reportNamespaces?.getUsedNamespaces() ?? [];
|
|
926
|
-
const ret = {};
|
|
927
|
-
const initialI18nStore = {};
|
|
928
|
-
i18n.languages.forEach((l) => {
|
|
929
|
-
initialI18nStore[l] = {};
|
|
930
|
-
namespaces.forEach((ns) => {
|
|
931
|
-
initialI18nStore[l][ns] = i18n.getResourceBundle(l, ns) || {};
|
|
932
|
-
});
|
|
933
|
-
});
|
|
934
|
-
ret.initialI18nStore = initialI18nStore;
|
|
935
|
-
ret.initialLanguage = i18n.language;
|
|
936
|
-
return ret;
|
|
937
|
-
};
|
|
938
|
-
|
|
939
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/Trans.js
|
|
940
|
-
function Trans2({
|
|
941
|
-
children,
|
|
942
|
-
count,
|
|
943
|
-
parent,
|
|
944
|
-
i18nKey,
|
|
945
|
-
context,
|
|
946
|
-
tOptions = {},
|
|
947
|
-
values,
|
|
948
|
-
defaults,
|
|
949
|
-
components,
|
|
950
|
-
ns,
|
|
951
|
-
i18n: i18nFromProps,
|
|
952
|
-
t: tFromProps,
|
|
953
|
-
shouldUnescape,
|
|
954
|
-
...additionalProps
|
|
955
|
-
}) {
|
|
956
|
-
const {
|
|
957
|
-
i18n: i18nFromContext,
|
|
958
|
-
defaultNS: defaultNSFromContext
|
|
959
|
-
} = useContext(I18nContext) || {};
|
|
960
|
-
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
961
|
-
const t = tFromProps || i18n?.t.bind(i18n);
|
|
962
|
-
return Trans({
|
|
963
|
-
children,
|
|
964
|
-
count,
|
|
965
|
-
parent,
|
|
966
|
-
i18nKey,
|
|
967
|
-
context,
|
|
968
|
-
tOptions,
|
|
969
|
-
values,
|
|
970
|
-
defaults,
|
|
971
|
-
components,
|
|
972
|
-
ns: ns || t?.ns || defaultNSFromContext || i18n?.options?.defaultNS,
|
|
973
|
-
i18n,
|
|
974
|
-
t: tFromProps,
|
|
975
|
-
shouldUnescape,
|
|
976
|
-
...additionalProps
|
|
977
|
-
});
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/IcuTrans.js
|
|
981
|
-
import { useContext as useContext2 } from "react";
|
|
982
|
-
|
|
983
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/IcuTransWithoutContext.js
|
|
984
|
-
import React2 from "react";
|
|
985
|
-
|
|
986
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/IcuTransUtils/TranslationParserError.js
|
|
987
|
-
var TranslationParserError = class _TranslationParserError extends Error {
|
|
988
|
-
constructor(message, position, translationString) {
|
|
989
|
-
super(message);
|
|
990
|
-
this.name = "TranslationParserError";
|
|
991
|
-
this.position = position;
|
|
992
|
-
this.translationString = translationString;
|
|
993
|
-
if (Error.captureStackTrace) {
|
|
994
|
-
Error.captureStackTrace(this, _TranslationParserError);
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
};
|
|
998
|
-
|
|
999
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/IcuTransUtils/htmlEntityDecoder.js
|
|
1000
|
-
var commonEntities = {
|
|
1001
|
-
" ": "\xA0",
|
|
1002
|
-
"&": "&",
|
|
1003
|
-
"<": "<",
|
|
1004
|
-
">": ">",
|
|
1005
|
-
""": '"',
|
|
1006
|
-
"'": "'",
|
|
1007
|
-
"©": "\xA9",
|
|
1008
|
-
"®": "\xAE",
|
|
1009
|
-
"™": "\u2122",
|
|
1010
|
-
"…": "\u2026",
|
|
1011
|
-
"–": "\u2013",
|
|
1012
|
-
"—": "\u2014",
|
|
1013
|
-
"‘": "\u2018",
|
|
1014
|
-
"’": "\u2019",
|
|
1015
|
-
"‚": "\u201A",
|
|
1016
|
-
"“": "\u201C",
|
|
1017
|
-
"”": "\u201D",
|
|
1018
|
-
"„": "\u201E",
|
|
1019
|
-
"†": "\u2020",
|
|
1020
|
-
"‡": "\u2021",
|
|
1021
|
-
"•": "\u2022",
|
|
1022
|
-
"′": "\u2032",
|
|
1023
|
-
"″": "\u2033",
|
|
1024
|
-
"‹": "\u2039",
|
|
1025
|
-
"›": "\u203A",
|
|
1026
|
-
"§": "\xA7",
|
|
1027
|
-
"¶": "\xB6",
|
|
1028
|
-
"·": "\xB7",
|
|
1029
|
-
" ": "\u2002",
|
|
1030
|
-
" ": "\u2003",
|
|
1031
|
-
" ": "\u2009",
|
|
1032
|
-
"€": "\u20AC",
|
|
1033
|
-
"£": "\xA3",
|
|
1034
|
-
"¥": "\xA5",
|
|
1035
|
-
"¢": "\xA2",
|
|
1036
|
-
"¤": "\xA4",
|
|
1037
|
-
"×": "\xD7",
|
|
1038
|
-
"÷": "\xF7",
|
|
1039
|
-
"−": "\u2212",
|
|
1040
|
-
"±": "\xB1",
|
|
1041
|
-
"≠": "\u2260",
|
|
1042
|
-
"≤": "\u2264",
|
|
1043
|
-
"≥": "\u2265",
|
|
1044
|
-
"≈": "\u2248",
|
|
1045
|
-
"≡": "\u2261",
|
|
1046
|
-
"∞": "\u221E",
|
|
1047
|
-
"∫": "\u222B",
|
|
1048
|
-
"∑": "\u2211",
|
|
1049
|
-
"∏": "\u220F",
|
|
1050
|
-
"√": "\u221A",
|
|
1051
|
-
"∂": "\u2202",
|
|
1052
|
-
"‰": "\u2030",
|
|
1053
|
-
"°": "\xB0",
|
|
1054
|
-
"µ": "\xB5",
|
|
1055
|
-
"←": "\u2190",
|
|
1056
|
-
"↑": "\u2191",
|
|
1057
|
-
"→": "\u2192",
|
|
1058
|
-
"↓": "\u2193",
|
|
1059
|
-
"↔": "\u2194",
|
|
1060
|
-
"↵": "\u21B5",
|
|
1061
|
-
"⇐": "\u21D0",
|
|
1062
|
-
"⇑": "\u21D1",
|
|
1063
|
-
"⇒": "\u21D2",
|
|
1064
|
-
"⇓": "\u21D3",
|
|
1065
|
-
"⇔": "\u21D4",
|
|
1066
|
-
"α": "\u03B1",
|
|
1067
|
-
"β": "\u03B2",
|
|
1068
|
-
"γ": "\u03B3",
|
|
1069
|
-
"δ": "\u03B4",
|
|
1070
|
-
"ε": "\u03B5",
|
|
1071
|
-
"ζ": "\u03B6",
|
|
1072
|
-
"η": "\u03B7",
|
|
1073
|
-
"θ": "\u03B8",
|
|
1074
|
-
"ι": "\u03B9",
|
|
1075
|
-
"κ": "\u03BA",
|
|
1076
|
-
"λ": "\u03BB",
|
|
1077
|
-
"μ": "\u03BC",
|
|
1078
|
-
"ν": "\u03BD",
|
|
1079
|
-
"ξ": "\u03BE",
|
|
1080
|
-
"ο": "\u03BF",
|
|
1081
|
-
"π": "\u03C0",
|
|
1082
|
-
"ρ": "\u03C1",
|
|
1083
|
-
"σ": "\u03C3",
|
|
1084
|
-
"τ": "\u03C4",
|
|
1085
|
-
"υ": "\u03C5",
|
|
1086
|
-
"φ": "\u03C6",
|
|
1087
|
-
"χ": "\u03C7",
|
|
1088
|
-
"ψ": "\u03C8",
|
|
1089
|
-
"ω": "\u03C9",
|
|
1090
|
-
"Α": "\u0391",
|
|
1091
|
-
"Β": "\u0392",
|
|
1092
|
-
"Γ": "\u0393",
|
|
1093
|
-
"Δ": "\u0394",
|
|
1094
|
-
"Ε": "\u0395",
|
|
1095
|
-
"Ζ": "\u0396",
|
|
1096
|
-
"Η": "\u0397",
|
|
1097
|
-
"Θ": "\u0398",
|
|
1098
|
-
"Ι": "\u0399",
|
|
1099
|
-
"Κ": "\u039A",
|
|
1100
|
-
"Λ": "\u039B",
|
|
1101
|
-
"Μ": "\u039C",
|
|
1102
|
-
"Ν": "\u039D",
|
|
1103
|
-
"Ξ": "\u039E",
|
|
1104
|
-
"Ο": "\u039F",
|
|
1105
|
-
"Π": "\u03A0",
|
|
1106
|
-
"Ρ": "\u03A1",
|
|
1107
|
-
"Σ": "\u03A3",
|
|
1108
|
-
"Τ": "\u03A4",
|
|
1109
|
-
"Υ": "\u03A5",
|
|
1110
|
-
"Φ": "\u03A6",
|
|
1111
|
-
"Χ": "\u03A7",
|
|
1112
|
-
"Ψ": "\u03A8",
|
|
1113
|
-
"Ω": "\u03A9",
|
|
1114
|
-
"À": "\xC0",
|
|
1115
|
-
"Á": "\xC1",
|
|
1116
|
-
"Â": "\xC2",
|
|
1117
|
-
"Ã": "\xC3",
|
|
1118
|
-
"Ä": "\xC4",
|
|
1119
|
-
"Å": "\xC5",
|
|
1120
|
-
"Æ": "\xC6",
|
|
1121
|
-
"Ç": "\xC7",
|
|
1122
|
-
"È": "\xC8",
|
|
1123
|
-
"É": "\xC9",
|
|
1124
|
-
"Ê": "\xCA",
|
|
1125
|
-
"Ë": "\xCB",
|
|
1126
|
-
"Ì": "\xCC",
|
|
1127
|
-
"Í": "\xCD",
|
|
1128
|
-
"Î": "\xCE",
|
|
1129
|
-
"Ï": "\xCF",
|
|
1130
|
-
"Ð": "\xD0",
|
|
1131
|
-
"Ñ": "\xD1",
|
|
1132
|
-
"Ò": "\xD2",
|
|
1133
|
-
"Ó": "\xD3",
|
|
1134
|
-
"Ô": "\xD4",
|
|
1135
|
-
"Õ": "\xD5",
|
|
1136
|
-
"Ö": "\xD6",
|
|
1137
|
-
"Ø": "\xD8",
|
|
1138
|
-
"Ù": "\xD9",
|
|
1139
|
-
"Ú": "\xDA",
|
|
1140
|
-
"Û": "\xDB",
|
|
1141
|
-
"Ü": "\xDC",
|
|
1142
|
-
"Ý": "\xDD",
|
|
1143
|
-
"Þ": "\xDE",
|
|
1144
|
-
"ß": "\xDF",
|
|
1145
|
-
"à": "\xE0",
|
|
1146
|
-
"á": "\xE1",
|
|
1147
|
-
"â": "\xE2",
|
|
1148
|
-
"ã": "\xE3",
|
|
1149
|
-
"ä": "\xE4",
|
|
1150
|
-
"å": "\xE5",
|
|
1151
|
-
"æ": "\xE6",
|
|
1152
|
-
"ç": "\xE7",
|
|
1153
|
-
"è": "\xE8",
|
|
1154
|
-
"é": "\xE9",
|
|
1155
|
-
"ê": "\xEA",
|
|
1156
|
-
"ë": "\xEB",
|
|
1157
|
-
"ì": "\xEC",
|
|
1158
|
-
"í": "\xED",
|
|
1159
|
-
"î": "\xEE",
|
|
1160
|
-
"ï": "\xEF",
|
|
1161
|
-
"ð": "\xF0",
|
|
1162
|
-
"ñ": "\xF1",
|
|
1163
|
-
"ò": "\xF2",
|
|
1164
|
-
"ó": "\xF3",
|
|
1165
|
-
"ô": "\xF4",
|
|
1166
|
-
"õ": "\xF5",
|
|
1167
|
-
"ö": "\xF6",
|
|
1168
|
-
"ø": "\xF8",
|
|
1169
|
-
"ù": "\xF9",
|
|
1170
|
-
"ú": "\xFA",
|
|
1171
|
-
"û": "\xFB",
|
|
1172
|
-
"ü": "\xFC",
|
|
1173
|
-
"ý": "\xFD",
|
|
1174
|
-
"þ": "\xFE",
|
|
1175
|
-
"ÿ": "\xFF",
|
|
1176
|
-
"¡": "\xA1",
|
|
1177
|
-
"¿": "\xBF",
|
|
1178
|
-
"ƒ": "\u0192",
|
|
1179
|
-
"ˆ": "\u02C6",
|
|
1180
|
-
"˜": "\u02DC",
|
|
1181
|
-
"Œ": "\u0152",
|
|
1182
|
-
"œ": "\u0153",
|
|
1183
|
-
"Š": "\u0160",
|
|
1184
|
-
"š": "\u0161",
|
|
1185
|
-
"Ÿ": "\u0178",
|
|
1186
|
-
"ª": "\xAA",
|
|
1187
|
-
"º": "\xBA",
|
|
1188
|
-
"¯": "\xAF",
|
|
1189
|
-
"´": "\xB4",
|
|
1190
|
-
"¸": "\xB8",
|
|
1191
|
-
"¹": "\xB9",
|
|
1192
|
-
"²": "\xB2",
|
|
1193
|
-
"³": "\xB3",
|
|
1194
|
-
"¼": "\xBC",
|
|
1195
|
-
"½": "\xBD",
|
|
1196
|
-
"¾": "\xBE",
|
|
1197
|
-
"♠": "\u2660",
|
|
1198
|
-
"♣": "\u2663",
|
|
1199
|
-
"♥": "\u2665",
|
|
1200
|
-
"♦": "\u2666",
|
|
1201
|
-
"◊": "\u25CA",
|
|
1202
|
-
"‾": "\u203E",
|
|
1203
|
-
"⁄": "\u2044",
|
|
1204
|
-
"℘": "\u2118",
|
|
1205
|
-
"ℑ": "\u2111",
|
|
1206
|
-
"ℜ": "\u211C",
|
|
1207
|
-
"ℵ": "\u2135"
|
|
1208
|
-
};
|
|
1209
|
-
var entityPattern = new RegExp(Object.keys(commonEntities).map((entity) => entity.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), "g");
|
|
1210
|
-
var decodeHtmlEntities = (text) => text.replace(entityPattern, (match) => commonEntities[match]).replace(/&#(\d+);/g, (_, num) => String.fromCharCode(parseInt(num, 10))).replace(/&#x([0-9a-fA-F]+);/g, (_, hex) => String.fromCharCode(parseInt(hex, 16)));
|
|
1211
|
-
|
|
1212
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/IcuTransUtils/tokenizer.js
|
|
1213
|
-
var tokenize = (translation) => {
|
|
1214
|
-
const tokens = [];
|
|
1215
|
-
let position = 0;
|
|
1216
|
-
let currentText = "";
|
|
1217
|
-
const flushText = () => {
|
|
1218
|
-
if (currentText) {
|
|
1219
|
-
tokens.push({
|
|
1220
|
-
type: "Text",
|
|
1221
|
-
value: currentText,
|
|
1222
|
-
position: position - currentText.length
|
|
1223
|
-
});
|
|
1224
|
-
currentText = "";
|
|
1225
|
-
}
|
|
1226
|
-
};
|
|
1227
|
-
while (position < translation.length) {
|
|
1228
|
-
const char = translation[position];
|
|
1229
|
-
if (char === "<") {
|
|
1230
|
-
const tagMatch = translation.slice(position).match(/^<(\d+)>/);
|
|
1231
|
-
if (tagMatch) {
|
|
1232
|
-
flushText();
|
|
1233
|
-
tokens.push({
|
|
1234
|
-
type: "TagOpen",
|
|
1235
|
-
value: tagMatch[0],
|
|
1236
|
-
position,
|
|
1237
|
-
tagNumber: parseInt(tagMatch[1], 10)
|
|
1238
|
-
});
|
|
1239
|
-
position += tagMatch[0].length;
|
|
1240
|
-
} else {
|
|
1241
|
-
const closeTagMatch = translation.slice(position).match(/^<\/(\d+)>/);
|
|
1242
|
-
if (closeTagMatch) {
|
|
1243
|
-
flushText();
|
|
1244
|
-
tokens.push({
|
|
1245
|
-
type: "TagClose",
|
|
1246
|
-
value: closeTagMatch[0],
|
|
1247
|
-
position,
|
|
1248
|
-
tagNumber: parseInt(closeTagMatch[1], 10)
|
|
1249
|
-
});
|
|
1250
|
-
position += closeTagMatch[0].length;
|
|
1251
|
-
} else {
|
|
1252
|
-
currentText += char;
|
|
1253
|
-
position += 1;
|
|
1254
|
-
}
|
|
1255
|
-
}
|
|
1256
|
-
} else {
|
|
1257
|
-
currentText += char;
|
|
1258
|
-
position += 1;
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
flushText();
|
|
1262
|
-
return tokens;
|
|
1263
|
-
};
|
|
1264
|
-
|
|
1265
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/IcuTransUtils/renderTranslation.js
|
|
1266
|
-
import React from "react";
|
|
1267
|
-
var renderDeclarationNode = (declaration, children, childDeclarations) => {
|
|
1268
|
-
const {
|
|
1269
|
-
type,
|
|
1270
|
-
props = {}
|
|
1271
|
-
} = declaration;
|
|
1272
|
-
if (props.children && Array.isArray(props.children) && childDeclarations) {
|
|
1273
|
-
const {
|
|
1274
|
-
children: _childrenToRemove,
|
|
1275
|
-
...propsWithoutChildren
|
|
1276
|
-
} = props;
|
|
1277
|
-
return React.createElement(type, propsWithoutChildren, ...children);
|
|
1278
|
-
}
|
|
1279
|
-
if (children.length === 0) {
|
|
1280
|
-
return React.createElement(type, props);
|
|
1281
|
-
}
|
|
1282
|
-
if (children.length === 1) {
|
|
1283
|
-
return React.createElement(type, props, children[0]);
|
|
1284
|
-
}
|
|
1285
|
-
return React.createElement(type, props, ...children);
|
|
1286
|
-
};
|
|
1287
|
-
var renderTranslation = (translation, declarations = []) => {
|
|
1288
|
-
if (!translation) {
|
|
1289
|
-
return [];
|
|
1290
|
-
}
|
|
1291
|
-
const tokens = tokenize(translation);
|
|
1292
|
-
const result = [];
|
|
1293
|
-
const stack = [];
|
|
1294
|
-
const literalTagNumbers = /* @__PURE__ */ new Set();
|
|
1295
|
-
const getCurrentDeclarations = () => {
|
|
1296
|
-
if (stack.length === 0) {
|
|
1297
|
-
return declarations;
|
|
1298
|
-
}
|
|
1299
|
-
const parentFrame = stack[stack.length - 1];
|
|
1300
|
-
if (parentFrame.declaration.props?.children && Array.isArray(parentFrame.declaration.props.children)) {
|
|
1301
|
-
return parentFrame.declaration.props.children;
|
|
1302
|
-
}
|
|
1303
|
-
return parentFrame.declarations;
|
|
1304
|
-
};
|
|
1305
|
-
tokens.forEach((token) => {
|
|
1306
|
-
switch (token.type) {
|
|
1307
|
-
case "Text":
|
|
1308
|
-
{
|
|
1309
|
-
const decoded = decodeHtmlEntities(token.value);
|
|
1310
|
-
const targetArray = stack.length > 0 ? stack[stack.length - 1].children : result;
|
|
1311
|
-
targetArray.push(decoded);
|
|
1312
|
-
}
|
|
1313
|
-
break;
|
|
1314
|
-
case "TagOpen":
|
|
1315
|
-
{
|
|
1316
|
-
const {
|
|
1317
|
-
tagNumber
|
|
1318
|
-
} = token;
|
|
1319
|
-
const currentDeclarations = getCurrentDeclarations();
|
|
1320
|
-
const declaration = currentDeclarations[tagNumber];
|
|
1321
|
-
if (!declaration) {
|
|
1322
|
-
literalTagNumbers.add(tagNumber);
|
|
1323
|
-
const literalText = `<${tagNumber}>`;
|
|
1324
|
-
const targetArray = stack.length > 0 ? stack[stack.length - 1].children : result;
|
|
1325
|
-
targetArray.push(literalText);
|
|
1326
|
-
break;
|
|
1327
|
-
}
|
|
1328
|
-
stack.push({
|
|
1329
|
-
tagNumber,
|
|
1330
|
-
children: [],
|
|
1331
|
-
position: token.position,
|
|
1332
|
-
declaration,
|
|
1333
|
-
declarations: currentDeclarations
|
|
1334
|
-
});
|
|
1335
|
-
}
|
|
1336
|
-
break;
|
|
1337
|
-
case "TagClose":
|
|
1338
|
-
{
|
|
1339
|
-
const {
|
|
1340
|
-
tagNumber
|
|
1341
|
-
} = token;
|
|
1342
|
-
if (literalTagNumbers.has(tagNumber)) {
|
|
1343
|
-
const literalText = `</${tagNumber}>`;
|
|
1344
|
-
const literalTargetArray = stack.length > 0 ? stack[stack.length - 1].children : result;
|
|
1345
|
-
literalTargetArray.push(literalText);
|
|
1346
|
-
literalTagNumbers.delete(tagNumber);
|
|
1347
|
-
break;
|
|
1348
|
-
}
|
|
1349
|
-
if (stack.length === 0) {
|
|
1350
|
-
throw new TranslationParserError(`Unexpected closing tag </${tagNumber}> at position ${token.position}`, token.position, translation);
|
|
1351
|
-
}
|
|
1352
|
-
const frame = stack.pop();
|
|
1353
|
-
if (frame.tagNumber !== tagNumber) {
|
|
1354
|
-
throw new TranslationParserError(`Mismatched tags: expected </${frame.tagNumber}> but got </${tagNumber}> at position ${token.position}`, token.position, translation);
|
|
1355
|
-
}
|
|
1356
|
-
const element = renderDeclarationNode(frame.declaration, frame.children, frame.declarations);
|
|
1357
|
-
const elementTargetArray = stack.length > 0 ? stack[stack.length - 1].children : result;
|
|
1358
|
-
elementTargetArray.push(element);
|
|
1359
|
-
}
|
|
1360
|
-
break;
|
|
1361
|
-
}
|
|
1362
|
-
});
|
|
1363
|
-
if (stack.length > 0) {
|
|
1364
|
-
const unclosed = stack[stack.length - 1];
|
|
1365
|
-
throw new TranslationParserError(`Unclosed tag <${unclosed.tagNumber}> at position ${unclosed.position}`, unclosed.position, translation);
|
|
1366
|
-
}
|
|
1367
|
-
return result;
|
|
1368
|
-
};
|
|
1369
|
-
|
|
1370
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/IcuTransWithoutContext.js
|
|
1371
|
-
function IcuTransWithoutContext({
|
|
1372
|
-
i18nKey,
|
|
1373
|
-
defaultTranslation,
|
|
1374
|
-
content,
|
|
1375
|
-
ns,
|
|
1376
|
-
values = {},
|
|
1377
|
-
i18n: i18nFromProps,
|
|
1378
|
-
t: tFromProps
|
|
1379
|
-
}) {
|
|
1380
|
-
const i18n = i18nFromProps || getI18n();
|
|
1381
|
-
if (!i18n) {
|
|
1382
|
-
warnOnce(i18n, "NO_I18NEXT_INSTANCE", `IcuTrans: You need to pass in an i18next instance using i18nextReactModule`, {
|
|
1383
|
-
i18nKey
|
|
1384
|
-
});
|
|
1385
|
-
return React2.createElement(React2.Fragment, {}, defaultTranslation);
|
|
1386
|
-
}
|
|
1387
|
-
const t = tFromProps || i18n.t?.bind(i18n) || ((k) => k);
|
|
1388
|
-
let namespaces = ns || t.ns || i18n.options?.defaultNS;
|
|
1389
|
-
namespaces = isString(namespaces) ? [namespaces] : namespaces || ["translation"];
|
|
1390
|
-
let mergedValues = values;
|
|
1391
|
-
if (i18n.options?.interpolation?.defaultVariables) {
|
|
1392
|
-
mergedValues = values && Object.keys(values).length > 0 ? {
|
|
1393
|
-
...values,
|
|
1394
|
-
...i18n.options.interpolation.defaultVariables
|
|
1395
|
-
} : {
|
|
1396
|
-
...i18n.options.interpolation.defaultVariables
|
|
1397
|
-
};
|
|
1398
|
-
}
|
|
1399
|
-
const translation = t(i18nKey || defaultTranslation, {
|
|
1400
|
-
defaultValue: defaultTranslation,
|
|
1401
|
-
...mergedValues,
|
|
1402
|
-
ns: namespaces
|
|
1403
|
-
});
|
|
1404
|
-
try {
|
|
1405
|
-
const rendered = renderTranslation(translation, content);
|
|
1406
|
-
return React2.createElement(React2.Fragment, {}, ...rendered);
|
|
1407
|
-
} catch (error) {
|
|
1408
|
-
warn(i18n, "ICU_TRANS_RENDER_ERROR", `IcuTrans component error for key "${i18nKey}": ${error.message}`, {
|
|
1409
|
-
i18nKey,
|
|
1410
|
-
error
|
|
1411
|
-
});
|
|
1412
|
-
return React2.createElement(React2.Fragment, {}, translation);
|
|
1413
|
-
}
|
|
1414
|
-
}
|
|
1415
|
-
IcuTransWithoutContext.displayName = "IcuTransWithoutContext";
|
|
1416
|
-
|
|
1417
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/IcuTrans.js
|
|
1418
|
-
function IcuTrans({
|
|
1419
|
-
i18nKey,
|
|
1420
|
-
defaultTranslation,
|
|
1421
|
-
content,
|
|
1422
|
-
ns,
|
|
1423
|
-
values = {},
|
|
1424
|
-
i18n: i18nFromProps,
|
|
1425
|
-
t: tFromProps
|
|
1426
|
-
}) {
|
|
1427
|
-
const {
|
|
1428
|
-
i18n: i18nFromContext,
|
|
1429
|
-
defaultNS: defaultNSFromContext
|
|
1430
|
-
} = useContext2(I18nContext) || {};
|
|
1431
|
-
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
1432
|
-
const t = tFromProps || i18n?.t.bind(i18n);
|
|
1433
|
-
return IcuTransWithoutContext({
|
|
1434
|
-
i18nKey,
|
|
1435
|
-
defaultTranslation,
|
|
1436
|
-
content,
|
|
1437
|
-
ns: ns || t?.ns || defaultNSFromContext || i18n?.options?.defaultNS,
|
|
1438
|
-
values,
|
|
1439
|
-
i18n,
|
|
1440
|
-
t: tFromProps
|
|
1441
|
-
});
|
|
1442
|
-
}
|
|
1443
|
-
IcuTrans.displayName = "IcuTrans";
|
|
1444
|
-
|
|
1445
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/useTranslation.js
|
|
1446
|
-
import { useContext as useContext3, useCallback, useMemo, useEffect, useRef, useState } from "react";
|
|
1447
|
-
import { useSyncExternalStore } from "use-sync-external-store/shim";
|
|
1448
|
-
var notReadyT = (k, optsOrDefaultValue) => {
|
|
1449
|
-
if (isString(optsOrDefaultValue)) return optsOrDefaultValue;
|
|
1450
|
-
if (isObject(optsOrDefaultValue) && isString(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue;
|
|
1451
|
-
if (typeof k === "function") return "";
|
|
1452
|
-
if (Array.isArray(k)) {
|
|
1453
|
-
const last = k[k.length - 1];
|
|
1454
|
-
return typeof last === "function" ? "" : last;
|
|
1455
|
-
}
|
|
1456
|
-
return k;
|
|
1457
|
-
};
|
|
1458
|
-
var notReadySnapshot = {
|
|
1459
|
-
t: notReadyT,
|
|
1460
|
-
ready: false
|
|
1461
|
-
};
|
|
1462
|
-
var dummySubscribe = () => () => {
|
|
1463
|
-
};
|
|
1464
|
-
var useTranslation = (ns, props = {}) => {
|
|
1465
|
-
const {
|
|
1466
|
-
i18n: i18nFromProps
|
|
1467
|
-
} = props;
|
|
1468
|
-
const {
|
|
1469
|
-
i18n: i18nFromContext,
|
|
1470
|
-
defaultNS: defaultNSFromContext
|
|
1471
|
-
} = useContext3(I18nContext) || {};
|
|
1472
|
-
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
1473
|
-
if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
|
|
1474
|
-
if (!i18n) {
|
|
1475
|
-
warnOnce(i18n, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.");
|
|
1476
|
-
}
|
|
1477
|
-
const i18nOptions = useMemo(() => ({
|
|
1478
|
-
...getDefaults(),
|
|
1479
|
-
...i18n?.options?.react,
|
|
1480
|
-
...props
|
|
1481
|
-
}), [i18n, props]);
|
|
1482
|
-
const {
|
|
1483
|
-
useSuspense,
|
|
1484
|
-
keyPrefix
|
|
1485
|
-
} = i18nOptions;
|
|
1486
|
-
const nsOrContext = ns || defaultNSFromContext || i18n?.options?.defaultNS;
|
|
1487
|
-
const unstableNamespaces = isString(nsOrContext) ? [nsOrContext] : nsOrContext || ["translation"];
|
|
1488
|
-
const namespaces = useMemo(() => unstableNamespaces, unstableNamespaces);
|
|
1489
|
-
i18n?.reportNamespaces?.addUsedNamespaces?.(namespaces);
|
|
1490
|
-
const revisionRef = useRef(0);
|
|
1491
|
-
const subscribe = useCallback((callback) => {
|
|
1492
|
-
if (!i18n) return dummySubscribe;
|
|
1493
|
-
const {
|
|
1494
|
-
bindI18n,
|
|
1495
|
-
bindI18nStore
|
|
1496
|
-
} = i18nOptions;
|
|
1497
|
-
const wrappedCallback = () => {
|
|
1498
|
-
revisionRef.current += 1;
|
|
1499
|
-
callback();
|
|
1500
|
-
};
|
|
1501
|
-
if (bindI18n) i18n.on(bindI18n, wrappedCallback);
|
|
1502
|
-
if (bindI18nStore) i18n.store.on(bindI18nStore, wrappedCallback);
|
|
1503
|
-
return () => {
|
|
1504
|
-
if (bindI18n) bindI18n.split(" ").forEach((e) => i18n.off(e, wrappedCallback));
|
|
1505
|
-
if (bindI18nStore) bindI18nStore.split(" ").forEach((e) => i18n.store.off(e, wrappedCallback));
|
|
1506
|
-
};
|
|
1507
|
-
}, [i18n, i18nOptions]);
|
|
1508
|
-
const snapshotRef = useRef();
|
|
1509
|
-
const getSnapshot = useCallback(() => {
|
|
1510
|
-
if (!i18n) {
|
|
1511
|
-
return notReadySnapshot;
|
|
1512
|
-
}
|
|
1513
|
-
const calculatedReady = !!(i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n) => hasLoadedNamespace(n, i18n, i18nOptions));
|
|
1514
|
-
const currentLng = props.lng || i18n.language;
|
|
1515
|
-
const currentRevision = revisionRef.current;
|
|
1516
|
-
const lastSnapshot = snapshotRef.current;
|
|
1517
|
-
if (lastSnapshot && lastSnapshot.ready === calculatedReady && lastSnapshot.lng === currentLng && lastSnapshot.keyPrefix === keyPrefix && lastSnapshot.revision === currentRevision) {
|
|
1518
|
-
return lastSnapshot;
|
|
1519
|
-
}
|
|
1520
|
-
const calculatedT = i18n.getFixedT(currentLng, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix, {
|
|
1521
|
-
scopeNs: namespaces
|
|
1522
|
-
});
|
|
1523
|
-
const newSnapshot = {
|
|
1524
|
-
t: calculatedT,
|
|
1525
|
-
ready: calculatedReady,
|
|
1526
|
-
lng: currentLng,
|
|
1527
|
-
keyPrefix,
|
|
1528
|
-
revision: currentRevision
|
|
1529
|
-
};
|
|
1530
|
-
snapshotRef.current = newSnapshot;
|
|
1531
|
-
return newSnapshot;
|
|
1532
|
-
}, [i18n, namespaces, keyPrefix, i18nOptions, props.lng]);
|
|
1533
|
-
const [loadCount, setLoadCount] = useState(0);
|
|
1534
|
-
const {
|
|
1535
|
-
t,
|
|
1536
|
-
ready
|
|
1537
|
-
} = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
1538
|
-
useEffect(() => {
|
|
1539
|
-
if (i18n && !ready && !useSuspense) {
|
|
1540
|
-
const onLoaded = () => setLoadCount((c) => c + 1);
|
|
1541
|
-
if (props.lng) {
|
|
1542
|
-
loadLanguages(i18n, props.lng, namespaces, onLoaded);
|
|
1543
|
-
} else {
|
|
1544
|
-
loadNamespaces(i18n, namespaces, onLoaded);
|
|
1545
|
-
}
|
|
1546
|
-
}
|
|
1547
|
-
}, [i18n, props.lng, namespaces, ready, useSuspense, loadCount]);
|
|
1548
|
-
const finalI18n = i18n || {};
|
|
1549
|
-
const wrapperRef = useRef(null);
|
|
1550
|
-
const wrapperLangRef = useRef();
|
|
1551
|
-
const createI18nWrapper = (original) => {
|
|
1552
|
-
const descriptors = Object.getOwnPropertyDescriptors(original);
|
|
1553
|
-
if (descriptors.__original) delete descriptors.__original;
|
|
1554
|
-
const wrapper = Object.create(Object.getPrototypeOf(original), descriptors);
|
|
1555
|
-
if (!Object.prototype.hasOwnProperty.call(wrapper, "__original")) {
|
|
1556
|
-
try {
|
|
1557
|
-
Object.defineProperty(wrapper, "__original", {
|
|
1558
|
-
value: original,
|
|
1559
|
-
writable: false,
|
|
1560
|
-
enumerable: false,
|
|
1561
|
-
configurable: false
|
|
1562
|
-
});
|
|
1563
|
-
} catch (_) {
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
|
-
return wrapper;
|
|
1567
|
-
};
|
|
1568
|
-
const ret = useMemo(() => {
|
|
1569
|
-
const original = finalI18n;
|
|
1570
|
-
const lang = original?.language;
|
|
1571
|
-
let i18nWrapper = original;
|
|
1572
|
-
if (original) {
|
|
1573
|
-
if (wrapperRef.current && wrapperRef.current.__original === original) {
|
|
1574
|
-
if (wrapperLangRef.current !== lang) {
|
|
1575
|
-
i18nWrapper = createI18nWrapper(original);
|
|
1576
|
-
wrapperRef.current = i18nWrapper;
|
|
1577
|
-
wrapperLangRef.current = lang;
|
|
1578
|
-
} else {
|
|
1579
|
-
i18nWrapper = wrapperRef.current;
|
|
1580
|
-
}
|
|
1581
|
-
} else {
|
|
1582
|
-
i18nWrapper = createI18nWrapper(original);
|
|
1583
|
-
wrapperRef.current = i18nWrapper;
|
|
1584
|
-
wrapperLangRef.current = lang;
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
const effectiveT = !ready && !useSuspense ? (...args) => {
|
|
1588
|
-
warnOnce(i18n, "USE_T_BEFORE_READY", "useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.");
|
|
1589
|
-
return t(...args);
|
|
1590
|
-
} : t;
|
|
1591
|
-
const arr = [effectiveT, i18nWrapper, ready];
|
|
1592
|
-
arr.t = effectiveT;
|
|
1593
|
-
arr.i18n = i18nWrapper;
|
|
1594
|
-
arr.ready = ready;
|
|
1595
|
-
return arr;
|
|
1596
|
-
}, [t, finalI18n, ready, finalI18n.resolvedLanguage, finalI18n.language, finalI18n.languages]);
|
|
1597
|
-
if (i18n && useSuspense && !ready) {
|
|
1598
|
-
let inDevelopment = false;
|
|
1599
|
-
try {
|
|
1600
|
-
inDevelopment = false;
|
|
1601
|
-
} catch (e) {
|
|
1602
|
-
}
|
|
1603
|
-
if (inDevelopment) {
|
|
1604
|
-
warnOnce(i18n, "SUSPENDED_WHILE_LOADING", "useTranslation: suspended while translations are loading (useSuspense is true by default). Add a <Suspense> boundary above this component, or set react.useSuspense: false in the i18next init options. https://react.i18next.com/latest/usetranslation-hook");
|
|
1605
|
-
}
|
|
1606
|
-
throw new Promise((resolve) => {
|
|
1607
|
-
const onLoaded = () => resolve();
|
|
1608
|
-
if (props.lng) {
|
|
1609
|
-
loadLanguages(i18n, props.lng, namespaces, onLoaded);
|
|
1610
|
-
} else {
|
|
1611
|
-
loadNamespaces(i18n, namespaces, onLoaded);
|
|
1612
|
-
}
|
|
1613
|
-
});
|
|
1614
|
-
}
|
|
1615
|
-
return ret;
|
|
1616
|
-
};
|
|
1617
|
-
|
|
1618
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/withTranslation.js
|
|
1619
|
-
import { createElement as createElement2, forwardRef as forwardRefReact } from "react";
|
|
1620
|
-
var withTranslation = (ns, options = {}) => function Extend(WrappedComponent) {
|
|
1621
|
-
function I18nextWithTranslation({
|
|
1622
|
-
forwardedRef,
|
|
1623
|
-
...rest
|
|
1624
|
-
}) {
|
|
1625
|
-
const [t, i18n, ready] = useTranslation(ns, {
|
|
1626
|
-
...rest,
|
|
1627
|
-
keyPrefix: options.keyPrefix
|
|
1628
|
-
});
|
|
1629
|
-
const passDownProps = {
|
|
1630
|
-
...rest,
|
|
1631
|
-
t,
|
|
1632
|
-
i18n,
|
|
1633
|
-
tReady: ready
|
|
1634
|
-
};
|
|
1635
|
-
if (options.withRef && forwardedRef) {
|
|
1636
|
-
passDownProps.ref = forwardedRef;
|
|
1637
|
-
} else if (!options.withRef && forwardedRef) {
|
|
1638
|
-
passDownProps.forwardedRef = forwardedRef;
|
|
1639
|
-
}
|
|
1640
|
-
return createElement2(WrappedComponent, passDownProps);
|
|
1641
|
-
}
|
|
1642
|
-
I18nextWithTranslation.displayName = `withI18nextTranslation(${getDisplayName(WrappedComponent)})`;
|
|
1643
|
-
I18nextWithTranslation.WrappedComponent = WrappedComponent;
|
|
1644
|
-
const forwardRef = (props, ref) => createElement2(I18nextWithTranslation, Object.assign({}, props, {
|
|
1645
|
-
forwardedRef: ref
|
|
1646
|
-
}));
|
|
1647
|
-
return options.withRef ? forwardRefReact(forwardRef) : I18nextWithTranslation;
|
|
1648
|
-
};
|
|
1649
|
-
|
|
1650
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/Translation.js
|
|
1651
|
-
var Translation = ({
|
|
1652
|
-
ns,
|
|
1653
|
-
children,
|
|
1654
|
-
...options
|
|
1655
|
-
}) => {
|
|
1656
|
-
const [t, i18n, ready] = useTranslation(ns, options);
|
|
1657
|
-
return children(t, {
|
|
1658
|
-
i18n,
|
|
1659
|
-
lng: i18n?.language
|
|
1660
|
-
}, ready);
|
|
1661
|
-
};
|
|
1662
|
-
|
|
1663
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/I18nextProvider.js
|
|
1664
|
-
import { createElement as createElement3, useMemo as useMemo2 } from "react";
|
|
1665
|
-
function I18nextProvider({
|
|
1666
|
-
i18n,
|
|
1667
|
-
defaultNS,
|
|
1668
|
-
children
|
|
1669
|
-
}) {
|
|
1670
|
-
const value = useMemo2(() => ({
|
|
1671
|
-
i18n,
|
|
1672
|
-
defaultNS
|
|
1673
|
-
}), [i18n, defaultNS]);
|
|
1674
|
-
return createElement3(I18nContext.Provider, {
|
|
1675
|
-
value
|
|
1676
|
-
}, children);
|
|
1677
|
-
}
|
|
1678
|
-
|
|
1679
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/withSSR.js
|
|
1680
|
-
import { createElement as createElement4 } from "react";
|
|
1681
|
-
|
|
1682
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/useSSR.js
|
|
1683
|
-
import { useContext as useContext4 } from "react";
|
|
1684
|
-
var useSSR = (initialI18nStore, initialLanguage, props = {}) => {
|
|
1685
|
-
const {
|
|
1686
|
-
i18n: i18nFromProps
|
|
1687
|
-
} = props;
|
|
1688
|
-
const {
|
|
1689
|
-
i18n: i18nFromContext
|
|
1690
|
-
} = useContext4(I18nContext) || {};
|
|
1691
|
-
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
1692
|
-
if (!i18n) {
|
|
1693
|
-
warnOnce(i18n, "NO_I18NEXT_INSTANCE", "useSSR: You will need to pass in an i18next instance by using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.");
|
|
1694
|
-
return;
|
|
1695
|
-
}
|
|
1696
|
-
if (i18n.options?.isClone) return;
|
|
1697
|
-
if (initialI18nStore && !i18n.initializedStoreOnce) {
|
|
1698
|
-
if (!i18n.services?.resourceStore) {
|
|
1699
|
-
warnOnce(i18n, "I18N_NOT_INITIALIZED", "useSSR: i18n instance was found but not initialized (services.resourceStore is missing). Make sure you call i18next.init() before using useSSR \u2014 e.g. at module level, not only in getStaticProps/getServerSideProps.");
|
|
1700
|
-
return;
|
|
1701
|
-
}
|
|
1702
|
-
i18n.services.resourceStore.data = initialI18nStore;
|
|
1703
|
-
i18n.options.ns = Object.values(initialI18nStore).reduce((mem, lngResources) => {
|
|
1704
|
-
Object.keys(lngResources).forEach((ns) => {
|
|
1705
|
-
if (mem.indexOf(ns) < 0) mem.push(ns);
|
|
1706
|
-
});
|
|
1707
|
-
return mem;
|
|
1708
|
-
}, i18n.options.ns);
|
|
1709
|
-
i18n.initializedStoreOnce = true;
|
|
1710
|
-
i18n.isInitialized = true;
|
|
1711
|
-
}
|
|
1712
|
-
if (initialLanguage && !i18n.initializedLanguageOnce) {
|
|
1713
|
-
i18n.changeLanguage(initialLanguage);
|
|
1714
|
-
i18n.initializedLanguageOnce = true;
|
|
1715
|
-
}
|
|
1716
|
-
};
|
|
1717
|
-
|
|
1718
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/withSSR.js
|
|
1719
|
-
var withSSR = () => function Extend(WrappedComponent) {
|
|
1720
|
-
function I18nextWithSSR({
|
|
1721
|
-
initialI18nStore,
|
|
1722
|
-
initialLanguage,
|
|
1723
|
-
...rest
|
|
1724
|
-
}) {
|
|
1725
|
-
useSSR(initialI18nStore, initialLanguage);
|
|
1726
|
-
return createElement4(WrappedComponent, {
|
|
1727
|
-
...rest
|
|
1728
|
-
});
|
|
1729
|
-
}
|
|
1730
|
-
I18nextWithSSR.getInitialProps = composeInitialProps(WrappedComponent);
|
|
1731
|
-
I18nextWithSSR.displayName = `withI18nextSSR(${getDisplayName(WrappedComponent)})`;
|
|
1732
|
-
I18nextWithSSR.WrappedComponent = WrappedComponent;
|
|
1733
|
-
return I18nextWithSSR;
|
|
1734
|
-
};
|
|
1735
|
-
|
|
1736
|
-
// ../../node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react-dom@19.2.8_react@19.2.8__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/dist/es/index.js
|
|
1737
|
-
var date = () => "";
|
|
1738
|
-
var time = () => "";
|
|
1739
|
-
var number = () => "";
|
|
1740
|
-
var select = () => "";
|
|
1741
|
-
var plural = () => "";
|
|
1742
|
-
var selectOrdinal = () => "";
|
|
1743
|
-
|
|
1744
|
-
// shell/.ojm-shim-react-i18next.mjs
|
|
1745
|
-
var ojm_shim_react_i18next_default = void 0 ?? es_exports;
|
|
1746
|
-
export {
|
|
1747
|
-
I18nContext,
|
|
1748
|
-
I18nextProvider,
|
|
1749
|
-
IcuTrans,
|
|
1750
|
-
IcuTransWithoutContext,
|
|
1751
|
-
Trans2 as Trans,
|
|
1752
|
-
Trans as TransWithoutContext,
|
|
1753
|
-
Translation,
|
|
1754
|
-
composeInitialProps,
|
|
1755
|
-
date,
|
|
1756
|
-
ojm_shim_react_i18next_default as default,
|
|
1757
|
-
getDefaults,
|
|
1758
|
-
getI18n,
|
|
1759
|
-
getInitialProps,
|
|
1760
|
-
initReactI18next,
|
|
1761
|
-
nodesToString,
|
|
1762
|
-
number,
|
|
1763
|
-
plural,
|
|
1764
|
-
select,
|
|
1765
|
-
selectOrdinal,
|
|
1766
|
-
setDefaults,
|
|
1767
|
-
setI18n,
|
|
1768
|
-
time,
|
|
1769
|
-
useSSR,
|
|
1770
|
-
useTranslation,
|
|
1771
|
-
withSSR,
|
|
1772
|
-
withTranslation
|
|
1773
|
-
};
|