| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988 |
- "use strict";
- (wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([["vendors-node_modules_taro_weapp_prebundle_react-i18next_js"],{
- /***/ "./node_modules/.taro/weapp/prebundle/chunk-P7VEE7PG.js":
- /*!**************************************************************!*\
- !*** ./node_modules/.taro/weapp/prebundle/chunk-P7VEE7PG.js ***!
- \**************************************************************/
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ __commonJS: function() { return /* binding */ __commonJS; },
- /* harmony export */ __esm: function() { return /* binding */ __esm; },
- /* harmony export */ __export: function() { return /* binding */ __export; },
- /* harmony export */ __toCommonJS: function() { return /* binding */ __toCommonJS; },
- /* harmony export */ __toESM: function() { return /* binding */ __toESM; }
- /* harmony export */ });
- var __create = Object.create;
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __getOwnPropNames = Object.getOwnPropertyNames;
- var __getProtoOf = Object.getPrototypeOf;
- var __hasOwnProp = Object.prototype.hasOwnProperty;
- var __esm = (fn, res)=>function __init() {
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
- };
- var __commonJS = (cb, mod)=>function __require() {
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = {
- exports: {}
- }).exports, mod), mod.exports;
- };
- var __export = (target, all)=>{
- for(var name in all)__defProp(target, name, {
- get: all[name],
- enumerable: true
- });
- };
- var __copyProps = (to, from, except, desc)=>{
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
- get: ()=>from[key],
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
- });
- }
- return to;
- };
- var __toESM = (mod, isNodeMode, target)=>(target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
- value: mod,
- enumerable: true
- }) : target, mod));
- var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", {
- value: true
- }), mod);
- /***/ }),
- /***/ "./node_modules/.taro/weapp/prebundle/react-i18next.js":
- /*!*************************************************************!*\
- !*** ./node_modules/.taro/weapp/prebundle/react-i18next.js ***!
- \*************************************************************/
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ I18nContext: function() { return /* binding */ I18nContext; },
- /* harmony export */ I18nextProvider: function() { return /* binding */ I18nextProvider; },
- /* harmony export */ Trans: function() { return /* binding */ Trans2; },
- /* harmony export */ TransWithoutContext: function() { return /* binding */ Trans; },
- /* harmony export */ Translation: function() { return /* binding */ Translation; },
- /* harmony export */ composeInitialProps: function() { return /* binding */ composeInitialProps; },
- /* harmony export */ date: function() { return /* binding */ date; },
- /* harmony export */ getDefaults: function() { return /* binding */ getDefaults; },
- /* harmony export */ getI18n: function() { return /* binding */ getI18n; },
- /* harmony export */ getInitialProps: function() { return /* binding */ getInitialProps; },
- /* harmony export */ initReactI18next: function() { return /* binding */ initReactI18next; },
- /* harmony export */ number: function() { return /* binding */ number; },
- /* harmony export */ plural: function() { return /* binding */ plural; },
- /* harmony export */ select: function() { return /* binding */ select; },
- /* harmony export */ selectOrdinal: function() { return /* binding */ selectOrdinal; },
- /* harmony export */ setDefaults: function() { return /* binding */ setDefaults; },
- /* harmony export */ setI18n: function() { return /* binding */ setI18n; },
- /* harmony export */ time: function() { return /* binding */ time; },
- /* harmony export */ useSSR: function() { return /* binding */ useSSR; },
- /* harmony export */ useTranslation: function() { return /* binding */ useTranslation; },
- /* harmony export */ withSSR: function() { return /* binding */ withSSR; },
- /* harmony export */ withTranslation: function() { return /* binding */ withTranslation; }
- /* harmony export */ });
- /* harmony import */ var _chunk_LNJCN3VW_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./chunk-LNJCN3VW.js */ "./node_modules/.taro/weapp/prebundle/chunk-LNJCN3VW.js");
- /* harmony import */ var _chunk_P7VEE7PG_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./chunk-P7VEE7PG.js */ "./node_modules/.taro/weapp/prebundle/chunk-P7VEE7PG.js");
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- function _objectSpread(target) {
- for(var i = 1; i < arguments.length; i++){
- var source = arguments[i] != null ? arguments[i] : {};
- var ownKeys = Object.keys(source);
- if (typeof Object.getOwnPropertySymbols === 'function') {
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
- }));
- }
- ownKeys.forEach(function(key) {
- _defineProperty(target, key, source[key]);
- });
- }
- return target;
- }
- function ownKeys(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- if (enumerableOnly) {
- symbols = symbols.filter(function(sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- });
- }
- keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpreadProps(target, source) {
- source = source != null ? source : {};
- if (Object.getOwnPropertyDescriptors) {
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
- } else {
- ownKeys(Object(source)).forEach(function(key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
- }
- function _objectWithoutProperties(source, excluded) {
- if (source == null) return {};
- var target = _objectWithoutPropertiesLoose(source, excluded);
- var key, i;
- if (Object.getOwnPropertySymbols) {
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
- for(i = 0; i < sourceSymbolKeys.length; i++){
- key = sourceSymbolKeys[i];
- if (excluded.indexOf(key) >= 0) continue;
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
- target[key] = source[key];
- }
- }
- return target;
- }
- function _objectWithoutPropertiesLoose(source, excluded) {
- if (source == null) return {};
- var target = {};
- var sourceKeys = Object.keys(source);
- var key, i;
- for(i = 0; i < sourceKeys.length; i++){
- key = sourceKeys[i];
- if (excluded.indexOf(key) >= 0) continue;
- target[key] = source[key];
- }
- return target;
- }
- // node_modules/void-elements/index.js
- var require_void_elements = (0,_chunk_P7VEE7PG_js__WEBPACK_IMPORTED_MODULE_1__.__commonJS)({
- "node_modules/void-elements/index.js" (exports, module) {
- module.exports = {
- "area": true,
- "base": true,
- "br": true,
- "col": true,
- "embed": true,
- "hr": true,
- "img": true,
- "input": true,
- "link": true,
- "meta": true,
- "param": true,
- "source": true,
- "track": true,
- "wbr": true
- };
- }
- });
- // node_modules/react-i18next/dist/es/Trans.js
- var import_react3 = (0,_chunk_P7VEE7PG_js__WEBPACK_IMPORTED_MODULE_1__.__toESM)((0,_chunk_LNJCN3VW_js__WEBPACK_IMPORTED_MODULE_0__.require_react_production_min)(), 1);
- // node_modules/@babel/runtime/helpers/esm/extends.js
- function _extends() {
- _extends = Object.assign ? Object.assign.bind() : function(target) {
- for(var i2 = 1; i2 < arguments.length; i2++){
- var source = arguments[i2];
- for(var key in source){
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
- return target;
- };
- return _extends.apply(this, arguments);
- }
- // node_modules/react-i18next/dist/es/TransWithoutContext.js
- var import_react = (0,_chunk_P7VEE7PG_js__WEBPACK_IMPORTED_MODULE_1__.__toESM)((0,_chunk_LNJCN3VW_js__WEBPACK_IMPORTED_MODULE_0__.require_react_production_min)(), 1);
- // node_modules/html-parse-stringify/dist/html-parse-stringify.module.js
- var import_void_elements = (0,_chunk_P7VEE7PG_js__WEBPACK_IMPORTED_MODULE_1__.__toESM)(require_void_elements());
- var t = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;
- function n(n2) {
- var r2 = {
- type: "tag",
- name: "",
- voidElement: false,
- attrs: {},
- children: []
- }, i2 = n2.match(/<\/?([^\s]+?)[/\s>]/);
- if (i2 && (r2.name = i2[1], (import_void_elements.default[i2[1]] || "/" === n2.charAt(n2.length - 2)) && (r2.voidElement = true), r2.name.startsWith("!--"))) {
- var s2 = n2.indexOf("-->");
- return {
- type: "comment",
- comment: -1 !== s2 ? n2.slice(4, s2) : ""
- };
- }
- for(var a2 = new RegExp(t), c2 = null; null !== (c2 = a2.exec(n2));)if (c2[0].trim()) if (c2[1]) {
- var o = c2[1].trim(), l = [
- o,
- ""
- ];
- o.indexOf("=") > -1 && (l = o.split("=")), r2.attrs[l[0]] = l[1], a2.lastIndex--;
- } else c2[2] && (r2.attrs[c2[2]] = c2[3].trim().substring(1, c2[3].length - 1));
- return r2;
- }
- var r = /<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g;
- var i = /^\s*$/;
- var s = /* @__PURE__ */ Object.create(null);
- function a(e2, t2) {
- switch(t2.type){
- case "text":
- return e2 + t2.content;
- case "tag":
- return e2 += "<" + t2.name + (t2.attrs ? function(e3) {
- var t3 = [];
- for(var n2 in e3)t3.push(n2 + '="' + e3[n2] + '"');
- return t3.length ? " " + t3.join(" ") : "";
- }(t2.attrs) : "") + (t2.voidElement ? "/>" : ">"), t2.voidElement ? e2 : e2 + t2.children.reduce(a, "") + "</" + t2.name + ">";
- case "comment":
- return e2 + "<!--" + t2.comment + "-->";
- }
- }
- var c = {
- parse: function(e2, t2) {
- t2 || (t2 = {}), t2.components || (t2.components = s);
- var a2, c2 = [], o = [], l = -1, m = false;
- if (0 !== e2.indexOf("<")) {
- var u = e2.indexOf("<");
- c2.push({
- type: "text",
- content: -1 === u ? e2 : e2.substring(0, u)
- });
- }
- return e2.replace(r, function(r2, s2) {
- if (m) {
- if (r2 !== "</" + a2.name + ">") return;
- m = false;
- }
- var u2, f = "/" !== r2.charAt(1), h = r2.startsWith("<!--"), p = s2 + r2.length, d = e2.charAt(p);
- if (h) {
- var v = n(r2);
- return l < 0 ? (c2.push(v), c2) : ((u2 = o[l]).children.push(v), c2);
- }
- if (f && (l++, "tag" === (a2 = n(r2)).type && t2.components[a2.name] && (a2.type = "component", m = true), a2.voidElement || m || !d || "<" === d || a2.children.push({
- type: "text",
- content: e2.slice(p, e2.indexOf("<", p))
- }), 0 === l && c2.push(a2), (u2 = o[l - 1]) && u2.children.push(a2), o[l] = a2), (!f || a2.voidElement) && (l > -1 && (a2.voidElement || a2.name === r2.slice(2, -1)) && (l--, a2 = -1 === l ? c2 : o[l]), !m && "<" !== d && d)) {
- u2 = -1 === l ? c2 : o[l].children;
- var x = e2.indexOf("<", p), g = e2.slice(p, -1 === x ? void 0 : x);
- i.test(g) && (g = " "), (x > -1 && l + u2.length >= 0 || " " !== g) && u2.push({
- type: "text",
- content: g
- });
- }
- }), c2;
- },
- stringify: function(e2) {
- return e2.reduce(function(e3, t2) {
- return e3 + a("", t2);
- }, "");
- }
- };
- var html_parse_stringify_module_default = c;
- // node_modules/react-i18next/dist/es/utils.js
- function warn() {
- if (console && console.warn) {
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
- args[_key] = arguments[_key];
- }
- if (typeof args[0] === "string") args[0] = `react-i18next:: ${args[0]}`;
- console.warn(...args);
- }
- }
- var alreadyWarned = {};
- function warnOnce() {
- for(var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++){
- args[_key2] = arguments[_key2];
- }
- if (typeof args[0] === "string" && alreadyWarned[args[0]]) return;
- if (typeof args[0] === "string") alreadyWarned[args[0]] = new Date();
- warn(...args);
- }
- var loadedClb = (i18n, cb)=>()=>{
- if (i18n.isInitialized) {
- cb();
- } else {
- const initialized = ()=>{
- setTimeout(()=>{
- i18n.off("initialized", initialized);
- }, 0);
- cb();
- };
- i18n.on("initialized", initialized);
- }
- };
- function loadNamespaces(i18n, ns, cb) {
- i18n.loadNamespaces(ns, loadedClb(i18n, cb));
- }
- function loadLanguages(i18n, lng, ns, cb) {
- if (typeof ns === "string") ns = [
- ns
- ];
- ns.forEach((n2)=>{
- if (i18n.options.ns.indexOf(n2) < 0) i18n.options.ns.push(n2);
- });
- i18n.loadLanguages(lng, loadedClb(i18n, cb));
- }
- function oldI18nextHasLoadedNamespace(ns, i18n) {
- let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
- const lng = i18n.languages[0];
- const fallbackLng = i18n.options ? i18n.options.fallbackLng : false;
- const lastLng = i18n.languages[i18n.languages.length - 1];
- if (lng.toLowerCase() === "cimode") return true;
- const loadNotPending = (l, n2)=>{
- const loadState = i18n.services.backendConnector.state[`${l}|${n2}`];
- return loadState === -1 || loadState === 2;
- };
- if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18n.services.backendConnector.backend && i18n.isLanguageChangingTo && !loadNotPending(i18n.isLanguageChangingTo, ns)) return false;
- if (i18n.hasResourceBundle(lng, ns)) return true;
- if (!i18n.services.backendConnector.backend || i18n.options.resources && !i18n.options.partialBundledLanguages) return true;
- if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
- return false;
- }
- function hasLoadedNamespace(ns, i18n) {
- let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
- if (!i18n.languages || !i18n.languages.length) {
- warnOnce("i18n.languages were undefined or empty", i18n.languages);
- return true;
- }
- const isNewerI18next = i18n.options.ignoreJSONStructure !== void 0;
- if (!isNewerI18next) {
- return oldI18nextHasLoadedNamespace(ns, i18n, options);
- }
- return i18n.hasLoadedNamespace(ns, {
- lng: options.lng,
- precheck: (i18nInstance2, loadNotPending)=>{
- if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns)) return false;
- }
- });
- }
- function getDisplayName(Component) {
- return Component.displayName || Component.name || (typeof Component === "string" && Component.length > 0 ? Component : "Unknown");
- }
- // node_modules/react-i18next/dist/es/unescape.js
- var matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
- var htmlEntities = {
- "&": "&",
- "&": "&",
- "<": "<",
- "<": "<",
- ">": ">",
- ">": ">",
- "'": "'",
- "'": "'",
- """: '"',
- """: '"',
- " ": " ",
- " ": " ",
- "©": "\xA9",
- "©": "\xA9",
- "®": "\xAE",
- "®": "\xAE",
- "…": "\u2026",
- "…": "\u2026",
- "/": "/",
- "/": "/"
- };
- var unescapeHtmlEntity = (m)=>htmlEntities[m];
- var unescape = (text)=>text.replace(matchHtmlEntity, unescapeHtmlEntity);
- // node_modules/react-i18next/dist/es/defaults.js
- var defaultOptions = {
- bindI18n: "languageChanged",
- bindI18nStore: "",
- transEmptyNodeValue: "",
- transSupportBasicHtmlNodes: true,
- transWrapTextNodes: "",
- transKeepBasicHtmlNodesFor: [
- "br",
- "strong",
- "i",
- "p"
- ],
- useSuspense: true,
- unescape
- };
- function setDefaults() {
- let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
- defaultOptions = _objectSpread({}, defaultOptions, options);
- }
- function getDefaults() {
- return defaultOptions;
- }
- // node_modules/react-i18next/dist/es/i18nInstance.js
- var i18nInstance;
- function setI18n(instance) {
- i18nInstance = instance;
- }
- function getI18n() {
- return i18nInstance;
- }
- // node_modules/react-i18next/dist/es/TransWithoutContext.js
- function hasChildren(node, checkLength) {
- if (!node) return false;
- const base = node.props ? node.props.children : node.children;
- if (checkLength) return base.length > 0;
- return !!base;
- }
- function getChildren(node) {
- if (!node) return [];
- const children = node.props ? node.props.children : node.children;
- return node.props && node.props.i18nIsDynamicList ? getAsArray(children) : children;
- }
- function hasValidReactChildren(children) {
- if (Object.prototype.toString.call(children) !== "[object Array]") return false;
- return children.every((child)=>(0, import_react.isValidElement)(child));
- }
- function getAsArray(data) {
- return Array.isArray(data) ? data : [
- data
- ];
- }
- function mergeProps(source, target) {
- const newTarget = _objectSpread({}, target);
- newTarget.props = Object.assign(source.props, target.props);
- return newTarget;
- }
- function nodesToString(children, i18nOptions) {
- if (!children) return "";
- let stringNode = "";
- const childrenArray = getAsArray(children);
- const keepArray = i18nOptions.transSupportBasicHtmlNodes && i18nOptions.transKeepBasicHtmlNodesFor ? i18nOptions.transKeepBasicHtmlNodesFor : [];
- childrenArray.forEach((child, childIndex)=>{
- if (typeof child === "string") {
- stringNode += `${child}`;
- } else if ((0, import_react.isValidElement)(child)) {
- const childPropsCount = Object.keys(child.props).length;
- const shouldKeepChild = keepArray.indexOf(child.type) > -1;
- const childChildren = child.props.children;
- if (!childChildren && shouldKeepChild && childPropsCount === 0) {
- stringNode += `<${child.type}/>`;
- } else if (!childChildren && (!shouldKeepChild || childPropsCount !== 0)) {
- stringNode += `<${childIndex}></${childIndex}>`;
- } else if (child.props.i18nIsDynamicList) {
- stringNode += `<${childIndex}></${childIndex}>`;
- } else if (shouldKeepChild && childPropsCount === 1 && typeof childChildren === "string") {
- stringNode += `<${child.type}>${childChildren}</${child.type}>`;
- } else {
- const content = nodesToString(childChildren, i18nOptions);
- stringNode += `<${childIndex}>${content}</${childIndex}>`;
- }
- } else if (child === null) {
- warn(`Trans: the passed in value is invalid - seems you passed in a null child.`);
- } else if (typeof child === "object") {
- const { format } = child, clone = _objectWithoutProperties(child, [
- "format"
- ]);
- const keys = Object.keys(clone);
- if (keys.length === 1) {
- const value = format ? `${keys[0]}, ${format}` : keys[0];
- stringNode += `{{${value}}}`;
- } else {
- warn(`react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.`, child);
- }
- } else {
- warn(`Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.`, child);
- }
- });
- return stringNode;
- }
- function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) {
- if (targetString === "") return [];
- const keepArray = i18nOptions.transKeepBasicHtmlNodesFor || [];
- const emptyChildrenButNeedsHandling = targetString && new RegExp(keepArray.map((keep)=>`<${keep}`).join("|")).test(targetString);
- if (!children && !emptyChildrenButNeedsHandling && !shouldUnescape) return [
- targetString
- ];
- const data = {};
- function getData(childs) {
- const childrenArray = getAsArray(childs);
- childrenArray.forEach((child)=>{
- if (typeof child === "string") return;
- if (hasChildren(child)) getData(getChildren(child));
- else if (typeof child === "object" && !(0, import_react.isValidElement)(child)) Object.assign(data, child);
- });
- }
- getData(children);
- const ast = html_parse_stringify_module_default.parse(`<0>${targetString}</0>`);
- const opts = _objectSpread({}, data, combinedTOpts);
- function renderInner(child, node, rootReactNode) {
- const childs = getChildren(child);
- const mappedChildren = mapAST(childs, node.children, rootReactNode);
- return hasValidReactChildren(childs) && mappedChildren.length === 0 || child.props && child.props.i18nIsDynamicList ? childs : mappedChildren;
- }
- function pushTranslatedJSX(child, inner, mem, i2, isVoid) {
- if (child.dummy) {
- child.children = inner;
- mem.push((0, import_react.cloneElement)(child, {
- key: i2
- }, isVoid ? void 0 : inner));
- } else {
- mem.push(...import_react.Children.map([
- child
- ], (c2)=>{
- const props = _objectSpread({}, c2.props);
- delete props.i18nIsDynamicList;
- return import_react.default.createElement(c2.type, _extends({}, props, {
- key: i2,
- ref: c2.ref
- }, isVoid ? {} : {
- children: inner
- }));
- }));
- }
- }
- function mapAST(reactNode, astNode, rootReactNode) {
- const reactNodes = getAsArray(reactNode);
- const astNodes = getAsArray(astNode);
- return astNodes.reduce((mem, node, i2)=>{
- const translationContent = node.children && node.children[0] && node.children[0].content && i18n.services.interpolator.interpolate(node.children[0].content, opts, i18n.language);
- if (node.type === "tag") {
- let tmp = reactNodes[parseInt(node.name, 10)];
- if (rootReactNode.length === 1 && !tmp) tmp = rootReactNode[0][node.name];
- if (!tmp) tmp = {};
- const child = Object.keys(node.attrs).length !== 0 ? mergeProps({
- props: node.attrs
- }, tmp) : tmp;
- const isElement = (0, import_react.isValidElement)(child);
- const isValidTranslationWithChildren = isElement && hasChildren(node, true) && !node.voidElement;
- const isEmptyTransWithHTML = emptyChildrenButNeedsHandling && typeof child === "object" && child.dummy && !isElement;
- const isKnownComponent = typeof children === "object" && children !== null && Object.hasOwnProperty.call(children, node.name);
- if (typeof child === "string") {
- const value = i18n.services.interpolator.interpolate(child, opts, i18n.language);
- mem.push(value);
- } else if (hasChildren(child) || isValidTranslationWithChildren) {
- const inner = renderInner(child, node, rootReactNode);
- pushTranslatedJSX(child, inner, mem, i2);
- } else if (isEmptyTransWithHTML) {
- const inner1 = mapAST(reactNodes, node.children, rootReactNode);
- pushTranslatedJSX(child, inner1, mem, i2);
- } else if (Number.isNaN(parseFloat(node.name))) {
- if (isKnownComponent) {
- const inner2 = renderInner(child, node, rootReactNode);
- pushTranslatedJSX(child, inner2, mem, i2, node.voidElement);
- } else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node.name) > -1) {
- if (node.voidElement) {
- mem.push((0, import_react.createElement)(node.name, {
- key: `${node.name}-${i2}`
- }));
- } else {
- const inner3 = mapAST(reactNodes, node.children, rootReactNode);
- mem.push((0, import_react.createElement)(node.name, {
- key: `${node.name}-${i2}`
- }, inner3));
- }
- } else if (node.voidElement) {
- mem.push(`<${node.name} />`);
- } else {
- const inner4 = mapAST(reactNodes, node.children, rootReactNode);
- mem.push(`<${node.name}>${inner4}</${node.name}>`);
- }
- } else if (typeof child === "object" && !isElement) {
- const content = node.children[0] ? translationContent : null;
- if (content) mem.push(content);
- } else {
- pushTranslatedJSX(child, translationContent, mem, i2, node.children.length !== 1 || !translationContent);
- }
- } else if (node.type === "text") {
- const wrapTextNodes = i18nOptions.transWrapTextNodes;
- const content1 = shouldUnescape ? i18nOptions.unescape(i18n.services.interpolator.interpolate(node.content, opts, i18n.language)) : i18n.services.interpolator.interpolate(node.content, opts, i18n.language);
- if (wrapTextNodes) {
- mem.push((0, import_react.createElement)(wrapTextNodes, {
- key: `${node.name}-${i2}`
- }, content1));
- } else {
- mem.push(content1);
- }
- }
- return mem;
- }, []);
- }
- const result = mapAST([
- {
- dummy: true,
- children: children || []
- }
- ], ast, getAsArray(children || []));
- return getChildren(result[0]);
- }
- function Trans(_ref) {
- let { children , count , parent , i18nKey , context , tOptions ={} , values , defaults , components , ns , i18n: i18nFromProps , t: tFromProps , shouldUnescape } = _ref, additionalProps = _objectWithoutProperties(_ref, [
- "children",
- "count",
- "parent",
- "i18nKey",
- "context",
- "tOptions",
- "values",
- "defaults",
- "components",
- "ns",
- "i18n",
- "t",
- "shouldUnescape"
- ]);
- const i18n = i18nFromProps || getI18n();
- if (!i18n) {
- warnOnce("You will need to pass in an i18next instance by using i18nextReactModule");
- return children;
- }
- const t2 = tFromProps || i18n.t.bind(i18n) || ((k)=>k);
- if (context) tOptions.context = context;
- const reactI18nextOptions = _objectSpread({}, getDefaults(), i18n.options && i18n.options.react);
- let namespaces = ns || t2.ns || i18n.options && i18n.options.defaultNS;
- namespaces = typeof namespaces === "string" ? [
- namespaces
- ] : namespaces || [
- "translation"
- ];
- const nodeAsString = nodesToString(children, reactI18nextOptions);
- const defaultValue = defaults || nodeAsString || reactI18nextOptions.transEmptyNodeValue || i18nKey;
- const { hashTransKey } = reactI18nextOptions;
- const key = i18nKey || (hashTransKey ? hashTransKey(nodeAsString || defaultValue) : nodeAsString || defaultValue);
- const interpolationOverride = values ? tOptions.interpolation : {
- interpolation: _objectSpreadProps(_objectSpread({}, tOptions.interpolation), {
- prefix: "#$?",
- suffix: "?$#"
- })
- };
- const combinedTOpts = _objectSpreadProps(_objectSpread(_objectSpreadProps(_objectSpread({}, tOptions), {
- count
- }), values, interpolationOverride), {
- defaultValue,
- ns: namespaces
- });
- const translation = key ? t2(key, combinedTOpts) : defaultValue;
- const content = renderNodes(components || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape);
- const useAsParent = parent !== void 0 ? parent : reactI18nextOptions.defaultTransParent;
- return useAsParent ? (0, import_react.createElement)(useAsParent, additionalProps, content) : content;
- }
- // node_modules/react-i18next/dist/es/context.js
- var import_react2 = (0,_chunk_P7VEE7PG_js__WEBPACK_IMPORTED_MODULE_1__.__toESM)((0,_chunk_LNJCN3VW_js__WEBPACK_IMPORTED_MODULE_0__.require_react_production_min)(), 1);
- // node_modules/react-i18next/dist/es/initReactI18next.js
- var initReactI18next = {
- type: "3rdParty",
- init (instance) {
- setDefaults(instance.options.react);
- setI18n(instance);
- }
- };
- // node_modules/react-i18next/dist/es/context.js
- var I18nContext = (0, import_react2.createContext)();
- var ReportNamespaces = class {
- addUsedNamespaces(namespaces) {
- namespaces.forEach((ns)=>{
- if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
- });
- }
- getUsedNamespaces() {
- return Object.keys(this.usedNamespaces);
- }
- constructor(){
- this.usedNamespaces = {};
- }
- };
- function composeInitialProps(ForComponent) {
- return (ctx)=>new Promise((resolve)=>{
- const i18nInitialProps = getInitialProps();
- if (ForComponent.getInitialProps) {
- ForComponent.getInitialProps(ctx).then((componentsInitialProps)=>{
- resolve(_objectSpread({}, componentsInitialProps, i18nInitialProps));
- });
- } else {
- resolve(i18nInitialProps);
- }
- });
- }
- function getInitialProps() {
- const i18n = getI18n();
- const namespaces = i18n.reportNamespaces ? i18n.reportNamespaces.getUsedNamespaces() : [];
- const ret = {};
- const initialI18nStore = {};
- i18n.languages.forEach((l)=>{
- initialI18nStore[l] = {};
- namespaces.forEach((ns)=>{
- initialI18nStore[l][ns] = i18n.getResourceBundle(l, ns) || {};
- });
- });
- ret.initialI18nStore = initialI18nStore;
- ret.initialLanguage = i18n.language;
- return ret;
- }
- // node_modules/react-i18next/dist/es/Trans.js
- function Trans2(_ref) {
- let { children , count , parent , i18nKey , context , tOptions ={} , values , defaults , components , ns , i18n: i18nFromProps , t: tFromProps , shouldUnescape } = _ref, additionalProps = _objectWithoutProperties(_ref, [
- "children",
- "count",
- "parent",
- "i18nKey",
- "context",
- "tOptions",
- "values",
- "defaults",
- "components",
- "ns",
- "i18n",
- "t",
- "shouldUnescape"
- ]);
- const { i18n: i18nFromContext , defaultNS: defaultNSFromContext } = (0, import_react3.useContext)(I18nContext) || {};
- const i18n = i18nFromProps || i18nFromContext || getI18n();
- const t2 = tFromProps || i18n && i18n.t.bind(i18n);
- return Trans(_objectSpread({
- children,
- count,
- parent,
- i18nKey,
- context,
- tOptions,
- values,
- defaults,
- components,
- ns: ns || t2 && t2.ns || defaultNSFromContext || i18n && i18n.options && i18n.options.defaultNS,
- i18n,
- t: tFromProps,
- shouldUnescape
- }, additionalProps));
- }
- // node_modules/react-i18next/dist/es/useTranslation.js
- var import_react4 = (0,_chunk_P7VEE7PG_js__WEBPACK_IMPORTED_MODULE_1__.__toESM)((0,_chunk_LNJCN3VW_js__WEBPACK_IMPORTED_MODULE_0__.require_react_production_min)(), 1);
- var usePrevious = (value, ignore)=>{
- const ref = (0, import_react4.useRef)();
- (0, import_react4.useEffect)(()=>{
- ref.current = ignore ? ref.current : value;
- }, [
- value,
- ignore
- ]);
- return ref.current;
- };
- function useTranslation(ns) {
- let props = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
- const { i18n: i18nFromProps } = props;
- const { i18n: i18nFromContext , defaultNS: defaultNSFromContext } = (0, import_react4.useContext)(I18nContext) || {};
- const i18n = i18nFromProps || i18nFromContext || getI18n();
- if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
- if (!i18n) {
- warnOnce("You will need to pass in an i18next instance by using initReactI18next");
- const notReadyT = (k, optsOrDefaultValue)=>{
- if (typeof optsOrDefaultValue === "string") return optsOrDefaultValue;
- if (optsOrDefaultValue && typeof optsOrDefaultValue === "object" && typeof optsOrDefaultValue.defaultValue === "string") return optsOrDefaultValue.defaultValue;
- return Array.isArray(k) ? k[k.length - 1] : k;
- };
- const retNotReady = [
- notReadyT,
- {},
- false
- ];
- retNotReady.t = notReadyT;
- retNotReady.i18n = {};
- retNotReady.ready = false;
- return retNotReady;
- }
- if (i18n.options.react && i18n.options.react.wait !== void 0) warnOnce("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
- const i18nOptions = _objectSpread({}, getDefaults(), i18n.options.react, props);
- const { useSuspense , keyPrefix } = i18nOptions;
- let namespaces = ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
- namespaces = typeof namespaces === "string" ? [
- namespaces
- ] : namespaces || [
- "translation"
- ];
- if (i18n.reportNamespaces.addUsedNamespaces) i18n.reportNamespaces.addUsedNamespaces(namespaces);
- const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n2)=>hasLoadedNamespace(n2, i18n, i18nOptions));
- function getT() {
- return i18n.getFixedT(props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
- }
- const [t2, setT] = (0, import_react4.useState)(getT);
- let joinedNS = namespaces.join();
- if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
- const previousJoinedNS = usePrevious(joinedNS);
- const isMounted = (0, import_react4.useRef)(true);
- (0, import_react4.useEffect)(()=>{
- const { bindI18n , bindI18nStore } = i18nOptions;
- isMounted.current = true;
- if (!ready && !useSuspense) {
- if (props.lng) {
- loadLanguages(i18n, props.lng, namespaces, ()=>{
- if (isMounted.current) setT(getT);
- });
- } else {
- loadNamespaces(i18n, namespaces, ()=>{
- if (isMounted.current) setT(getT);
- });
- }
- }
- if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
- setT(getT);
- }
- function boundReset() {
- if (isMounted.current) setT(getT);
- }
- if (bindI18n && i18n) i18n.on(bindI18n, boundReset);
- if (bindI18nStore && i18n) i18n.store.on(bindI18nStore, boundReset);
- return ()=>{
- isMounted.current = false;
- if (bindI18n && i18n) bindI18n.split(" ").forEach((e2)=>i18n.off(e2, boundReset));
- if (bindI18nStore && i18n) bindI18nStore.split(" ").forEach((e2)=>i18n.store.off(e2, boundReset));
- };
- }, [
- i18n,
- joinedNS
- ]);
- const isInitial = (0, import_react4.useRef)(true);
- (0, import_react4.useEffect)(()=>{
- if (isMounted.current && !isInitial.current) {
- setT(getT);
- }
- isInitial.current = false;
- }, [
- i18n,
- keyPrefix
- ]);
- const ret = [
- t2,
- i18n,
- ready
- ];
- ret.t = t2;
- ret.i18n = i18n;
- ret.ready = ready;
- if (ready) return ret;
- if (!ready && !useSuspense) return ret;
- throw new Promise((resolve)=>{
- if (props.lng) {
- loadLanguages(i18n, props.lng, namespaces, ()=>resolve());
- } else {
- loadNamespaces(i18n, namespaces, ()=>resolve());
- }
- });
- }
- // node_modules/react-i18next/dist/es/withTranslation.js
- var import_react5 = (0,_chunk_P7VEE7PG_js__WEBPACK_IMPORTED_MODULE_1__.__toESM)((0,_chunk_LNJCN3VW_js__WEBPACK_IMPORTED_MODULE_0__.require_react_production_min)(), 1);
- function withTranslation(ns) {
- let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
- return function Extend(WrappedComponent) {
- function I18nextWithTranslation(_ref) {
- let { forwardedRef } = _ref, rest = _objectWithoutProperties(_ref, [
- "forwardedRef"
- ]);
- const [t2, i18n, ready] = useTranslation(ns, _objectSpreadProps(_objectSpread({}, rest), {
- keyPrefix: options.keyPrefix
- }));
- const passDownProps = _objectSpreadProps(_objectSpread({}, rest), {
- t: t2,
- i18n,
- tReady: ready
- });
- if (options.withRef && forwardedRef) {
- passDownProps.ref = forwardedRef;
- } else if (!options.withRef && forwardedRef) {
- passDownProps.forwardedRef = forwardedRef;
- }
- return (0, import_react5.createElement)(WrappedComponent, passDownProps);
- }
- I18nextWithTranslation.displayName = `withI18nextTranslation(${getDisplayName(WrappedComponent)})`;
- I18nextWithTranslation.WrappedComponent = WrappedComponent;
- const forwardRef = (props, ref)=>(0, import_react5.createElement)(I18nextWithTranslation, Object.assign({}, props, {
- forwardedRef: ref
- }));
- return options.withRef ? (0, import_react5.forwardRef)(forwardRef) : I18nextWithTranslation;
- };
- }
- // node_modules/react-i18next/dist/es/Translation.js
- function Translation(props) {
- const { ns , children } = props, options = _objectWithoutProperties(props, [
- "ns",
- "children"
- ]);
- const [t2, i18n, ready] = useTranslation(ns, options);
- return children(t2, {
- i18n,
- lng: i18n.language
- }, ready);
- }
- // node_modules/react-i18next/dist/es/I18nextProvider.js
- var import_react6 = (0,_chunk_P7VEE7PG_js__WEBPACK_IMPORTED_MODULE_1__.__toESM)((0,_chunk_LNJCN3VW_js__WEBPACK_IMPORTED_MODULE_0__.require_react_production_min)(), 1);
- function I18nextProvider(_ref) {
- let { i18n , defaultNS , children } = _ref;
- const value = (0, import_react6.useMemo)(()=>({
- i18n,
- defaultNS
- }), [
- i18n,
- defaultNS
- ]);
- return (0, import_react6.createElement)(I18nContext.Provider, {
- value
- }, children);
- }
- // node_modules/react-i18next/dist/es/withSSR.js
- var import_react8 = (0,_chunk_P7VEE7PG_js__WEBPACK_IMPORTED_MODULE_1__.__toESM)((0,_chunk_LNJCN3VW_js__WEBPACK_IMPORTED_MODULE_0__.require_react_production_min)(), 1);
- // node_modules/react-i18next/dist/es/useSSR.js
- var import_react7 = (0,_chunk_P7VEE7PG_js__WEBPACK_IMPORTED_MODULE_1__.__toESM)((0,_chunk_LNJCN3VW_js__WEBPACK_IMPORTED_MODULE_0__.require_react_production_min)(), 1);
- function useSSR(initialI18nStore, initialLanguage) {
- let props = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
- const { i18n: i18nFromProps } = props;
- const { i18n: i18nFromContext } = (0, import_react7.useContext)(I18nContext) || {};
- const i18n = i18nFromProps || i18nFromContext || getI18n();
- if (i18n.options && i18n.options.isClone) return;
- if (initialI18nStore && !i18n.initializedStoreOnce) {
- i18n.services.resourceStore.data = initialI18nStore;
- i18n.options.ns = Object.values(initialI18nStore).reduce((mem, lngResources)=>{
- Object.keys(lngResources).forEach((ns)=>{
- if (mem.indexOf(ns) < 0) mem.push(ns);
- });
- return mem;
- }, i18n.options.ns);
- i18n.initializedStoreOnce = true;
- i18n.isInitialized = true;
- }
- if (initialLanguage && !i18n.initializedLanguageOnce) {
- i18n.changeLanguage(initialLanguage);
- i18n.initializedLanguageOnce = true;
- }
- }
- // node_modules/react-i18next/dist/es/withSSR.js
- function withSSR() {
- return function Extend(WrappedComponent) {
- function I18nextWithSSR(_ref) {
- let { initialI18nStore , initialLanguage } = _ref, rest = _objectWithoutProperties(_ref, [
- "initialI18nStore",
- "initialLanguage"
- ]);
- useSSR(initialI18nStore, initialLanguage);
- return (0, import_react8.createElement)(WrappedComponent, _objectSpread({}, rest));
- }
- I18nextWithSSR.getInitialProps = composeInitialProps(WrappedComponent);
- I18nextWithSSR.displayName = `withI18nextSSR(${getDisplayName(WrappedComponent)})`;
- I18nextWithSSR.WrappedComponent = WrappedComponent;
- return I18nextWithSSR;
- };
- }
- // node_modules/react-i18next/dist/es/index.js
- var date = ()=>"";
- var time = ()=>"";
- var number = ()=>"";
- var select = ()=>"";
- var plural = ()=>"";
- var selectOrdinal = ()=>"";
- /***/ })
- }]);
|