@wix/cli
Version:
CLI tool for building Wix sites and applications
1,540 lines (1,499 loc) • 201 kB
JavaScript
import { createRequire as _createRequire } from 'node:module';
const require = _createRequire(import.meta.url);
import {
__assign,
__extends,
__rest,
__spreadArray,
init_tslib_es6
} from "./chunk-KJ37XZQA.js";
import {
Text
} from "./chunk-OAVLQEAG.js";
import {
require_react
} from "./chunk-5A5B2WR4.js";
import {
__commonJS,
__toESM,
init_esm_shims
} from "./chunk-4EFJZ3GQ.js";
// ../../node_modules/void-elements/index.js
var require_void_elements = __commonJS({
"../../node_modules/void-elements/index.js"(exports, module) {
"use strict";
init_esm_shims();
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
init_esm_shims();
var import_react3 = __toESM(require_react(), 1);
// ../../node_modules/react-i18next/dist/es/TransWithoutContext.js
init_esm_shims();
var import_react = __toESM(require_react(), 1);
// ../../node_modules/html-parse-stringify/dist/html-parse-stringify.module.js
init_esm_shims();
var import_void_elements = __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, t3) {
switch (t3.type) {
case "text":
return e2 + t3.content;
case "tag":
return e2 += "<" + t3.name + (t3.attrs ? function(e3) {
var t4 = [];
for (var n2 in e3) t4.push(n2 + '="' + e3[n2] + '"');
return t4.length ? " " + t4.join(" ") : "";
}(t3.attrs) : "") + (t3.voidElement ? "/>" : ">"), t3.voidElement ? e2 : e2 + t3.children.reduce(a, "") + "</" + t3.name + ">";
case "comment":
return e2 + "<!--" + t3.comment + "-->";
}
}
var c = { parse: function(e2, t3) {
t3 || (t3 = {}), t3.components || (t3.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 && t3.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, t3) {
return e3 + a("", t3);
}, "");
} };
var html_parse_stringify_module_default = c;
// ../../node_modules/react-i18next/dist/es/utils.js
init_esm_shims();
var warn = (i18n, code, msg, rest) => {
const args = [msg, {
code,
...rest || {}
}];
if (i18n?.services?.logger?.forward) {
return i18n.services.logger.forward(args, "warn", "react-i18next::", true);
}
if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`;
if (i18n?.services?.logger?.warn) {
i18n.services.logger.warn(...args);
} else if (console?.warn) {
console.warn(...args);
}
};
var alreadyWarned = {};
var warnOnce = (i18n, code, msg, rest) => {
if (isString(msg) && alreadyWarned[msg]) return;
if (isString(msg)) alreadyWarned[msg] = /* @__PURE__ */ new Date();
warn(i18n, code, msg, rest);
};
var loadedClb = (i18n, cb) => () => {
if (i18n.isInitialized) {
cb();
} else {
const initialized = () => {
setTimeout(() => {
i18n.off("initialized", initialized);
}, 0);
cb();
};
i18n.on("initialized", initialized);
}
};
var loadNamespaces = (i18n, ns, cb) => {
i18n.loadNamespaces(ns, loadedClb(i18n, cb));
};
var loadLanguages = (i18n, lng, ns, cb) => {
if (isString(ns)) ns = [ns];
if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb);
ns.forEach((n2) => {
if (i18n.options.ns.indexOf(n2) < 0) i18n.options.ns.push(n2);
});
i18n.loadLanguages(lng, loadedClb(i18n, cb));
};
var hasLoadedNamespace = (ns, i18n, options = {}) => {
if (!i18n.languages || !i18n.languages.length) {
warnOnce(i18n, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
languages: i18n.languages
});
return true;
}
return i18n.hasLoadedNamespace(ns, {
lng: options.lng,
precheck: (i18nInstance2, loadNotPending) => {
if (options.bindI18n?.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns)) return false;
}
});
};
var isString = (obj) => typeof obj === "string";
var isObject = (obj) => typeof obj === "object" && obj !== null;
// ../../node_modules/react-i18next/dist/es/defaults.js
init_esm_shims();
// ../../node_modules/react-i18next/dist/es/unescape.js
init_esm_shims();
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
};
var setDefaults = (options = {}) => {
defaultOptions = {
...defaultOptions,
...options
};
};
var getDefaults = () => defaultOptions;
// ../../node_modules/react-i18next/dist/es/i18nInstance.js
init_esm_shims();
var i18nInstance;
var setI18n = (instance2) => {
i18nInstance = instance2;
};
var getI18n = () => i18nInstance;
// ../../node_modules/react-i18next/dist/es/TransWithoutContext.js
var hasChildren = (node, checkLength) => {
if (!node) return false;
const base = node.props?.children ?? node.children;
if (checkLength) return base.length > 0;
return !!base;
};
var getChildren = (node) => {
if (!node) return [];
const children = node.props?.children ?? node.children;
return node.props?.i18nIsDynamicList ? getAsArray(children) : children;
};
var hasValidReactChildren = (children) => Array.isArray(children) && children.every(import_react.isValidElement);
var getAsArray = (data) => Array.isArray(data) ? data : [data];
var mergeProps = (source, target) => {
const newTarget = {
...target
};
newTarget.props = Object.assign(source.props, target.props);
return newTarget;
};
var nodesToString = (children, i18nOptions, i18n, i18nKey) => {
if (!children) return "";
let stringNode = "";
const childrenArray = getAsArray(children);
const keepArray = i18nOptions?.transSupportBasicHtmlNodes ? i18nOptions.transKeepBasicHtmlNodesFor ?? [] : [];
childrenArray.forEach((child, childIndex) => {
if (isString(child)) {
stringNode += `${child}`;
return;
}
if ((0, import_react.isValidElement)(child)) {
const {
props,
type
} = child;
const childPropsCount = Object.keys(props).length;
const shouldKeepChild = keepArray.indexOf(type) > -1;
const childChildren = props.children;
if (!childChildren && shouldKeepChild && !childPropsCount) {
stringNode += `<${type}/>`;
return;
}
if (!childChildren && (!shouldKeepChild || childPropsCount) || props.i18nIsDynamicList) {
stringNode += `<${childIndex}></${childIndex}>`;
return;
}
if (shouldKeepChild && childPropsCount === 1 && isString(childChildren)) {
stringNode += `<${type}>${childChildren}</${type}>`;
return;
}
const content = nodesToString(childChildren, i18nOptions, i18n, i18nKey);
stringNode += `<${childIndex}>${content}</${childIndex}>`;
return;
}
if (child === null) {
warn(i18n, "TRANS_NULL_VALUE", `Passed in a null value as child`, {
i18nKey
});
return;
}
if (isObject(child)) {
const {
format,
...clone
} = child;
const keys = Object.keys(clone);
if (keys.length === 1) {
const value = format ? `${keys[0]}, ${format}` : keys[0];
stringNode += `{{${value}}}`;
return;
}
warn(i18n, "TRANS_INVALID_OBJ", `Invalid child - Object should only have keys {{ value, format }} (format is optional).`, {
i18nKey,
child
});
return;
}
warn(i18n, "TRANS_INVALID_VAR", `Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`, {
i18nKey,
child
});
});
return stringNode;
};
var 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 = {};
const getData = (childs) => {
const childrenArray = getAsArray(childs);
childrenArray.forEach((child) => {
if (isString(child)) return;
if (hasChildren(child)) getData(getChildren(child));
else if (isObject(child) && !(0, import_react.isValidElement)(child)) Object.assign(data, child);
});
};
getData(children);
const ast = html_parse_stringify_module_default.parse(`<0>${targetString}</0>`);
const opts = {
...data,
...combinedTOpts
};
const renderInner = (child, node, rootReactNode) => {
const childs = getChildren(child);
const mappedChildren = mapAST(childs, node.children, rootReactNode);
return hasValidReactChildren(childs) && mappedChildren.length === 0 || child.props?.i18nIsDynamicList ? childs : mappedChildren;
};
const 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 = {
...c2.props
};
delete props.i18nIsDynamicList;
return (0, import_react.createElement)(c2.type, {
...props,
key: i2,
ref: c2.ref
}, isVoid ? null : inner);
}));
}
};
const mapAST = (reactNode, astNode, rootReactNode) => {
const reactNodes = getAsArray(reactNode);
const astNodes = getAsArray(astNode);
return astNodes.reduce((mem, node, i2) => {
const translationContent = 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 && isObject(child) && child.dummy && !isElement;
const isKnownComponent = isObject(children) && Object.hasOwnProperty.call(children, node.name);
if (isString(child)) {
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 inner = mapAST(reactNodes, node.children, rootReactNode);
pushTranslatedJSX(child, inner, mem, i2);
} else if (Number.isNaN(parseFloat(node.name))) {
if (isKnownComponent) {
const inner = renderInner(child, node, rootReactNode);
pushTranslatedJSX(child, inner, 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 inner = mapAST(reactNodes, node.children, rootReactNode);
mem.push((0, import_react.createElement)(node.name, {
key: `${node.name}-${i2}`
}, inner));
}
} else if (node.voidElement) {
mem.push(`<${node.name} />`);
} else {
const inner = mapAST(reactNodes, node.children, rootReactNode);
mem.push(`<${node.name}>${inner}</${node.name}>`);
}
} else if (isObject(child) && !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 content = 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}`
}, content));
} else {
mem.push(content);
}
}
return mem;
}, []);
};
const result = mapAST([{
dummy: true,
children: children || []
}], ast, getAsArray(children || []));
return getChildren(result[0]);
};
var fixComponentProps = (component, index, translation) => {
const componentKey = component.key || index;
const comp = (0, import_react.cloneElement)(component, {
key: componentKey
});
if (!comp.props || !comp.props.children || translation.indexOf(`${index}/>`) < 0 && translation.indexOf(`${index} />`) < 0) {
return comp;
}
function Componentized() {
return (0, import_react.createElement)(import_react.Fragment, null, comp);
}
return (0, import_react.createElement)(Componentized, {
key: componentKey
});
};
var generateArrayComponents = (components, translation) => components.map((c2, index) => fixComponentProps(c2, index, translation));
var generateObjectComponents = (components, translation) => {
const componentMap = {};
Object.keys(components).forEach((c2) => {
Object.assign(componentMap, {
[c2]: fixComponentProps(components[c2], c2, translation)
});
});
return componentMap;
};
var generateComponents = (components, translation, i18n, i18nKey) => {
if (!components) return null;
if (Array.isArray(components)) {
return generateArrayComponents(components, translation);
}
if (isObject(components)) {
return generateObjectComponents(components, translation);
}
warnOnce(i18n, "TRANS_INVALID_COMPONENTS", `<Trans /> "components" prop expects an object or array`, {
i18nKey
});
return null;
};
function Trans({
children,
count,
parent,
i18nKey,
context,
tOptions = {},
values,
defaults: defaults2,
components,
ns,
i18n: i18nFromProps,
t: tFromProps,
shouldUnescape,
...additionalProps
}) {
const i18n = i18nFromProps || getI18n();
if (!i18n) {
warnOnce(i18n, "NO_I18NEXT_INSTANCE", `Trans: You need to pass in an i18next instance using i18nextReactModule`, {
i18nKey
});
return children;
}
const t3 = tFromProps || i18n.t.bind(i18n) || ((k) => k);
const reactI18nextOptions = {
...getDefaults(),
...i18n.options?.react
};
let namespaces = ns || t3.ns || i18n.options?.defaultNS;
namespaces = isString(namespaces) ? [namespaces] : namespaces || ["translation"];
const nodeAsString = nodesToString(children, reactI18nextOptions, i18n, i18nKey);
const defaultValue = defaults2 || nodeAsString || reactI18nextOptions.transEmptyNodeValue || i18nKey;
const {
hashTransKey
} = reactI18nextOptions;
const key = i18nKey || (hashTransKey ? hashTransKey(nodeAsString || defaultValue) : nodeAsString || defaultValue);
if (i18n.options?.interpolation?.defaultVariables) {
values = values && Object.keys(values).length > 0 ? {
...values,
...i18n.options.interpolation.defaultVariables
} : {
...i18n.options.interpolation.defaultVariables
};
}
const interpolationOverride = values || count !== void 0 && !i18n.options?.interpolation?.alwaysFormat || !children ? tOptions.interpolation : {
interpolation: {
...tOptions.interpolation,
prefix: "#$?",
suffix: "?$#"
}
};
const combinedTOpts = {
...tOptions,
context: context || tOptions.context,
count,
...values,
...interpolationOverride,
defaultValue,
ns: namespaces
};
const translation = key ? t3(key, combinedTOpts) : defaultValue;
const generatedComponents = generateComponents(components, translation, i18n, i18nKey);
const content = renderNodes(generatedComponents || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape);
const useAsParent = parent ?? reactI18nextOptions.defaultTransParent;
return useAsParent ? (0, import_react.createElement)(useAsParent, additionalProps, content) : content;
}
// ../../node_modules/react-i18next/dist/es/context.js
init_esm_shims();
var import_react2 = __toESM(require_react(), 1);
// ../../node_modules/react-i18next/dist/es/initReactI18next.js
init_esm_shims();
var initReactI18next = {
type: "3rdParty",
init(instance2) {
setDefaults(instance2.options.react);
setI18n(instance2);
}
};
// ../../node_modules/react-i18next/dist/es/context.js
var I18nContext = (0, import_react2.createContext)();
var ReportNamespaces = class {
constructor() {
this.usedNamespaces = {};
}
addUsedNamespaces(namespaces) {
namespaces.forEach((ns) => {
if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
});
}
getUsedNamespaces() {
return Object.keys(this.usedNamespaces);
}
};
// ../../node_modules/react-i18next/dist/es/Trans.js
function Trans2({
children,
count,
parent,
i18nKey,
context,
tOptions = {},
values,
defaults: defaults2,
components,
ns,
i18n: i18nFromProps,
t: tFromProps,
shouldUnescape,
...additionalProps
}) {
const {
i18n: i18nFromContext,
defaultNS: defaultNSFromContext
} = (0, import_react3.useContext)(I18nContext) || {};
const i18n = i18nFromProps || i18nFromContext || getI18n();
const t3 = tFromProps || i18n?.t.bind(i18n);
return Trans({
children,
count,
parent,
i18nKey,
context,
tOptions,
values,
defaults: defaults2,
components,
ns: ns || t3?.ns || defaultNSFromContext || i18n?.options?.defaultNS,
i18n,
t: tFromProps,
shouldUnescape,
...additionalProps
});
}
// ../../node_modules/react-i18next/dist/es/useTranslation.js
init_esm_shims();
var import_react4 = __toESM(require_react(), 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;
};
var alwaysNewT = (i18n, language, namespace, keyPrefix) => i18n.getFixedT(language, namespace, keyPrefix);
var useMemoizedT = (i18n, language, namespace, keyPrefix) => (0, import_react4.useCallback)(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
var useTranslation = (ns, props = {}) => {
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(i18n, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
const notReadyT = (k, optsOrDefaultValue) => {
if (isString(optsOrDefaultValue)) return optsOrDefaultValue;
if (isObject(optsOrDefaultValue) && isString(optsOrDefaultValue.defaultValue)) 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?.wait) warnOnce(i18n, "DEPRECATED_OPTION", "useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
const i18nOptions = {
...getDefaults(),
...i18n.options.react,
...props
};
const {
useSuspense,
keyPrefix
} = i18nOptions;
let namespaces = ns || defaultNSFromContext || i18n.options?.defaultNS;
namespaces = isString(namespaces) ? [namespaces] : namespaces || ["translation"];
i18n.reportNamespaces.addUsedNamespaces?.(namespaces);
const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n2) => hasLoadedNamespace(n2, i18n, i18nOptions));
const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
const getT = () => memoGetT;
const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
const [t3, 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(getNewT);
});
} else {
loadNamespaces(i18n, namespaces, () => {
if (isMounted.current) setT(getNewT);
});
}
}
if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
setT(getNewT);
}
const boundReset = () => {
if (isMounted.current) setT(getNewT);
};
if (bindI18n) i18n?.on(bindI18n, boundReset);
if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset);
return () => {
isMounted.current = false;
if (i18n) bindI18n?.split(" ").forEach((e2) => i18n.off(e2, boundReset));
if (bindI18nStore && i18n) bindI18nStore.split(" ").forEach((e2) => i18n.store.off(e2, boundReset));
};
}, [i18n, joinedNS]);
(0, import_react4.useEffect)(() => {
if (isMounted.current && ready) {
setT(getT);
}
}, [i18n, keyPrefix, ready]);
const ret = [t3, i18n, ready];
ret.t = t3;
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/index.js
init_esm_shims();
// ../../node_modules/react-i18next/dist/es/withTranslation.js
init_esm_shims();
var import_react5 = __toESM(require_react(), 1);
// ../../node_modules/react-i18next/dist/es/Translation.js
init_esm_shims();
// ../../node_modules/react-i18next/dist/es/I18nextProvider.js
init_esm_shims();
var import_react6 = __toESM(require_react(), 1);
function I18nextProvider({
i18n,
defaultNS,
children
}) {
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
init_esm_shims();
var import_react8 = __toESM(require_react(), 1);
// ../../node_modules/react-i18next/dist/es/useSSR.js
init_esm_shims();
var import_react7 = __toESM(require_react(), 1);
// ../cli-i18n/src/I18nProvider.tsx
init_esm_shims();
var import_react9 = __toESM(require_react(), 1);
// ../cli-i18n/src/create-i18n.ts
init_esm_shims();
// ../../node_modules/i18next-icu/dist/es/index.js
init_esm_shims();
// ../../node_modules/i18next-icu/dist/es/utils.js
init_esm_shims();
function getLastOfPath(object, path, Empty) {
function cleanKey2(key2) {
return key2 && key2.indexOf("###") > -1 ? key2.replace(/###/g, ".") : key2;
}
function canNotTraverseDeeper2() {
return !object || typeof object === "string";
}
var stack = typeof path !== "string" ? [].concat(path) : path.split(".");
while (stack.length > 1) {
if (canNotTraverseDeeper2()) return {};
var key = cleanKey2(stack.shift());
if (!object[key] && Empty) object[key] = new Empty();
object = object[key];
}
if (canNotTraverseDeeper2()) return {};
return {
obj: object,
k: cleanKey2(stack.shift())
};
}
function setPath(object, path, newValue) {
var _getLastOfPath = getLastOfPath(object, path, Object), obj = _getLastOfPath.obj, k = _getLastOfPath.k;
obj[k] = newValue;
}
function getPath(object, path) {
var _getLastOfPath3 = getLastOfPath(object, path), obj = _getLastOfPath3.obj, k = _getLastOfPath3.k;
if (!obj) return void 0;
return obj[k];
}
var arr = [];
var each = arr.forEach;
var slice = arr.slice;
function defaults(obj) {
each.call(slice.call(arguments, 1), function(source) {
if (source) {
for (var prop in source) {
if (obj[prop] === void 0) obj[prop] = source[prop];
}
}
});
return obj;
}
// ../../node_modules/intl-messageformat/lib/index.js
init_esm_shims();
// ../../node_modules/intl-messageformat/lib/src/core.js
init_esm_shims();
init_tslib_es6();
// ../../node_modules/@formatjs/fast-memoize/lib/index.js
init_esm_shims();
function memoize(fn, options) {
var cache = options && options.cache ? options.cache : cacheDefault;
var serializer = options && options.serializer ? options.serializer : serializerDefault;
var strategy = options && options.strategy ? options.strategy : strategyDefault;
return strategy(fn, {
cache,
serializer
});
}
function isPrimitive(value) {
return value == null || typeof value === "number" || typeof value === "boolean";
}
function monadic(fn, cache, serializer, arg) {
var cacheKey = isPrimitive(arg) ? arg : serializer(arg);
var computedValue = cache.get(cacheKey);
if (typeof computedValue === "undefined") {
computedValue = fn.call(this, arg);
cache.set(cacheKey, computedValue);
}
return computedValue;
}
function variadic(fn, cache, serializer) {
var args = Array.prototype.slice.call(arguments, 3);
var cacheKey = serializer(args);
var computedValue = cache.get(cacheKey);
if (typeof computedValue === "undefined") {
computedValue = fn.apply(this, args);
cache.set(cacheKey, computedValue);
}
return computedValue;
}
function assemble(fn, context, strategy, cache, serialize) {
return strategy.bind(context, fn, cache, serialize);
}
function strategyDefault(fn, options) {
var strategy = fn.length === 1 ? monadic : variadic;
return assemble(fn, this, strategy, options.cache.create(), options.serializer);
}
function strategyVariadic(fn, options) {
return assemble(fn, this, variadic, options.cache.create(), options.serializer);
}
function strategyMonadic(fn, options) {
return assemble(fn, this, monadic, options.cache.create(), options.serializer);
}
var serializerDefault = function() {
return JSON.stringify(arguments);
};
var ObjectWithoutPrototypeCache = (
/** @class */
function() {
function ObjectWithoutPrototypeCache2() {
this.cache = /* @__PURE__ */ Object.create(null);
}
ObjectWithoutPrototypeCache2.prototype.get = function(key) {
return this.cache[key];
};
ObjectWithoutPrototypeCache2.prototype.set = function(key, value) {
this.cache[key] = value;
};
return ObjectWithoutPrototypeCache2;
}()
);
var cacheDefault = {
create: function create() {
return new ObjectWithoutPrototypeCache();
}
};
var strategies = {
variadic: strategyVariadic,
monadic: strategyMonadic
};
// ../../node_modules/@formatjs/icu-messageformat-parser/lib/index.js
init_esm_shims();
init_tslib_es6();
// ../../node_modules/@formatjs/icu-messageformat-parser/lib/error.js
init_esm_shims();
var ErrorKind;
(function(ErrorKind2) {
ErrorKind2[ErrorKind2["EXPECT_ARGUMENT_CLOSING_BRACE"] = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE";
ErrorKind2[ErrorKind2["EMPTY_ARGUMENT"] = 2] = "EMPTY_ARGUMENT";
ErrorKind2[ErrorKind2["MALFORMED_ARGUMENT"] = 3] = "MALFORMED_ARGUMENT";
ErrorKind2[ErrorKind2["EXPECT_ARGUMENT_TYPE"] = 4] = "EXPECT_ARGUMENT_TYPE";
ErrorKind2[ErrorKind2["INVALID_ARGUMENT_TYPE"] = 5] = "INVALID_ARGUMENT_TYPE";
ErrorKind2[ErrorKind2["EXPECT_ARGUMENT_STYLE"] = 6] = "EXPECT_ARGUMENT_STYLE";
ErrorKind2[ErrorKind2["INVALID_NUMBER_SKELETON"] = 7] = "INVALID_NUMBER_SKELETON";
ErrorKind2[ErrorKind2["INVALID_DATE_TIME_SKELETON"] = 8] = "INVALID_DATE_TIME_SKELETON";
ErrorKind2[ErrorKind2["EXPECT_NUMBER_SKELETON"] = 9] = "EXPECT_NUMBER_SKELETON";
ErrorKind2[ErrorKind2["EXPECT_DATE_TIME_SKELETON"] = 10] = "EXPECT_DATE_TIME_SKELETON";
ErrorKind2[ErrorKind2["UNCLOSED_QUOTE_IN_ARGUMENT_STYLE"] = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE";
ErrorKind2[ErrorKind2["EXPECT_SELECT_ARGUMENT_OPTIONS"] = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS";
ErrorKind2[ErrorKind2["EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE"] = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE";
ErrorKind2[ErrorKind2["INVALID_PLURAL_ARGUMENT_OFFSET_VALUE"] = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE";
ErrorKind2[ErrorKind2["EXPECT_SELECT_ARGUMENT_SELECTOR"] = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR";
ErrorKind2[ErrorKind2["EXPECT_PLURAL_ARGUMENT_SELECTOR"] = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR";
ErrorKind2[ErrorKind2["EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT"] = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT";
ErrorKind2[ErrorKind2["EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT"] = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT";
ErrorKind2[ErrorKind2["INVALID_PLURAL_ARGUMENT_SELECTOR"] = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR";
ErrorKind2[ErrorKind2["DUPLICATE_PLURAL_ARGUMENT_SELECTOR"] = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR";
ErrorKind2[ErrorKind2["DUPLICATE_SELECT_ARGUMENT_SELECTOR"] = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR";
ErrorKind2[ErrorKind2["MISSING_OTHER_CLAUSE"] = 22] = "MISSING_OTHER_CLAUSE";
ErrorKind2[ErrorKind2["INVALID_TAG"] = 23] = "INVALID_TAG";
ErrorKind2[ErrorKind2["INVALID_TAG_NAME"] = 25] = "INVALID_TAG_NAME";
ErrorKind2[ErrorKind2["UNMATCHED_CLOSING_TAG"] = 26] = "UNMATCHED_CLOSING_TAG";
ErrorKind2[ErrorKind2["UNCLOSED_TAG"] = 27] = "UNCLOSED_TAG";
})(ErrorKind || (ErrorKind = {}));
// ../../node_modules/@formatjs/icu-messageformat-parser/lib/parser.js
init_esm_shims();
init_tslib_es6();
// ../../node_modules/@formatjs/icu-messageformat-parser/lib/types.js
init_esm_shims();
var TYPE;
(function(TYPE2) {
TYPE2[TYPE2["literal"] = 0] = "literal";
TYPE2[TYPE2["argument"] = 1] = "argument";
TYPE2[TYPE2["number"] = 2] = "number";
TYPE2[TYPE2["date"] = 3] = "date";
TYPE2[TYPE2["time"] = 4] = "time";
TYPE2[TYPE2["select"] = 5] = "select";
TYPE2[TYPE2["plural"] = 6] = "plural";
TYPE2[TYPE2["pound"] = 7] = "pound";
TYPE2[TYPE2["tag"] = 8] = "tag";
})(TYPE || (TYPE = {}));
var SKELETON_TYPE;
(function(SKELETON_TYPE2) {
SKELETON_TYPE2[SKELETON_TYPE2["number"] = 0] = "number";
SKELETON_TYPE2[SKELETON_TYPE2["dateTime"] = 1] = "dateTime";
})(SKELETON_TYPE || (SKELETON_TYPE = {}));
function isLiteralElement(el) {
return el.type === TYPE.literal;
}
function isArgumentElement(el) {
return el.type === TYPE.argument;
}
function isNumberElement(el) {
return el.type === TYPE.number;
}
function isDateElement(el) {
return el.type === TYPE.date;
}
function isTimeElement(el) {
return el.type === TYPE.time;
}
function isSelectElement(el) {
return el.type === TYPE.select;
}
function isPluralElement(el) {
return el.type === TYPE.plural;
}
function isPoundElement(el) {
return el.type === TYPE.pound;
}
function isTagElement(el) {
return el.type === TYPE.tag;
}
function isNumberSkeleton(el) {
return !!(el && typeof el === "object" && el.type === SKELETON_TYPE.number);
}
function isDateTimeSkeleton(el) {
return !!(el && typeof el === "object" && el.type === SKELETON_TYPE.dateTime);
}
// ../../node_modules/@formatjs/icu-messageformat-parser/lib/regex.generated.js
init_esm_shims();
var SPACE_SEPARATOR_REGEX = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/;
// ../../node_modules/@formatjs/icu-skeleton-parser/lib/index.js
init_esm_shims();
// ../../node_modules/@formatjs/icu-skeleton-parser/lib/date-time.js
init_esm_shims();
var DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
function parseDateTimeSkeleton(skeleton) {
var result = {};
skeleton.replace(DATE_TIME_REGEX, function(match) {
var len = match.length;
switch (match[0]) {
// Era
case "G":
result.era = len === 4 ? "long" : len === 5 ? "narrow" : "short";
break;
// Year
case "y":
result.year = len === 2 ? "2-digit" : "numeric";
break;
case "Y":
case "u":
case "U":
case "r":
throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");
// Quarter
case "q":
case "Q":
throw new RangeError("`q/Q` (quarter) patterns are not supported");
// Month
case "M":
case "L":
result.month = ["numeric", "2-digit", "short", "long", "narrow"][len - 1];
break;
// Week
case "w":
case "W":
throw new RangeError("`w/W` (week) patterns are not supported");
case "d":
result.day = ["numeric", "2-digit"][len - 1];
break;
case "D":
case "F":
case "g":
throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");
// Weekday
case "E":
result.weekday = len === 4 ? "long" : len === 5 ? "narrow" : "short";
break;
case "e":
if (len < 4) {
throw new RangeError("`e..eee` (weekday) patterns are not supported");
}
result.weekday = ["short", "long", "narrow", "short"][len - 4];
break;
case "c":
if (len < 4) {
throw new RangeError("`c..ccc` (weekday) patterns are not supported");
}
result.weekday = ["short", "long", "narrow", "short"][len - 4];
break;
// Period
case "a":
result.hour12 = true;
break;
case "b":
// am, pm, noon, midnight
case "B":
throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");
// Hour
case "h":
result.hourCycle = "h12";
result.hour = ["numeric", "2-digit"][len - 1];
break;
case "H":
result.hourCycle = "h23";
result.hour = ["numeric", "2-digit"][len - 1];
break;
case "K":
result.hourCycle = "h11";
result.hour = ["numeric", "2-digit"][len - 1];
break;
case "k":
result.hourCycle = "h24";
result.hour = ["numeric", "2-digit"][len - 1];
break;
case "j":
case "J":
case "C":
throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");
// Minute
case "m":
result.minute = ["numeric", "2-digit"][len - 1];
break;
// Second
case "s":
result.second = ["numeric", "2-digit"][len - 1];
break;
case "S":
case "A":
throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");
// Zone
case "z":
result.timeZoneName = len < 4 ? "short" : "long";
break;
case "Z":
// 1..3, 4, 5: The ISO8601 varios formats
case "O":
// 1, 4: milliseconds in day short, long
case "v":
// 1, 4: generic non-location format
case "V":
// 1, 2, 3, 4: time zone ID or city
case "X":
// 1, 2, 3, 4: The ISO8601 varios formats
case "x":
throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead");
}
return "";
});
return result;
}
// ../../node_modules/@formatjs/icu-skeleton-parser/lib/number.js
init_esm_shims();
init_tslib_es6();
// ../../node_modules/@formatjs/icu-skeleton-parser/lib/regex.generated.js
init_esm_shims();
var WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
// ../../node_modules/@formatjs/icu-skeleton-parser/lib/number.js
function parseNumberSkeletonFromString(skeleton) {
if (skeleton.length === 0) {
throw new Error("Number skeleton cannot be empty");
}
var stringTokens = skeleton.split(WHITE_SPACE_REGEX).filter(function(x) {
return x.length > 0;
});
var tokens = [];
for (var _i = 0, stringTokens_1 = stringTokens; _i < stringTokens_1.length; _i++) {
var stringToken = stringTokens_1[_i];
var stemAndOptions = stringToken.split("/");
if (stemAndOptions.length === 0) {
throw new Error("Invalid number skeleton");
}
var stem = stemAndOptions[0], options = stemAndOptions.slice(1);
for (var _a2 = 0, options_1 = options; _a2 < options_1.length; _a2++) {
var option = options_1[_a2];
if (option.length === 0) {
throw new Error("Invalid number skeleton");
}
}
tokens.push({ stem, options });
}
return tokens;
}
function icuUnitToEcma(unit) {
return unit.replace(/^(.*?)-/, "");
}
var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g;
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g;
var INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g;
var CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;
function parseSignificantPrecision(str) {
var result = {};
if (str[str.length - 1] === "r") {
result.roundingPriority = "morePrecision";
} else if (str[str.length - 1] === "s") {
result.roundingPriority = "lessPrecision";
}
str.replace(SIGNIFICANT_PRECISION_REGEX, function(_, g1, g2) {
if (typeof g2 !== "string") {
result.minimumSignificantDigits = g1.length;
result.maximumSignificantDigits = g1.length;
} else if (g2 === "+") {
result.minimumSignificantDigits = g1.length;
} else if (g1[0] === "#") {
result.maximumSignificantDigits = g1.length;
} else {
result.minimumSignificantDigits = g1.length;
result.maximumSignificantDigits = g1.length + (typeof g2 === "string" ? g2.length : 0);
}
return "";
});
return result;
}
function parseSign(str) {
switch (str) {
case "sign-auto":
return {
signDisplay: "auto"
};
case "sign-accounting":
case "()":
return {
currencySign: "accounting"
};
case "sign-always":
case "+!":
return {
signDisplay: "always"
};
case "sign-accounting-always":
case "()!":
return {
signDisplay: "always",
currencySign: "accounting"
};
case "sign-except-zero":
case "+?":
return {
signDisplay: "exceptZero"
};
case "sign-accounting-except-zero":
case "()?":
return {
signDisplay: "exceptZero",
currencySign: "accounting"
};
case "sign-never":
case "+_":
return {
signDisplay: "never"
};
}
}
function parseConciseScientificAndEngineeringStem(stem) {
var result;
if (stem[0] === "E" && stem[1] === "E") {
result = {
notation: "engineering"
};
stem = stem.slice(2);
} else if (stem[0] === "E") {
result = {
notation: "scientific"
};
stem = stem.slice(1);
}
if (result) {
var signDisplay = stem.slice(0, 2);
if (signDisplay === "+!") {
result.signDisplay = "always";
stem = stem.slice(2);
} else if (signDisplay === "+?") {
result.signDisplay = "exceptZero";
stem = stem.slice(2);
}
if (!CONCISE_INTEGER_WIDTH_REGEX.test(stem)) {
throw new Error("Malformed concise eng/scientific notation");
}
result.minimumIntegerDigits = stem.length;
}
return result;
}
function parseNotationOptions(opt) {
var result = {};
var signOpts = parseSign(opt);
if (signOpts) {
return signOpts;
}
return result;
}
function parseNumberSkeleton(tokens) {
var result = {};
for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
var token = tokens_1[_i];
switch (token.stem) {
case "percent":
case "%":
result.style = "percent";
continue;
case "%x100":
result.style = "percent";
result.scale = 100;
continue;
case "currency":
result.style = "currency";
result.currency = token.options[0];
continue;
case "group-off":
case ",_":
result.useGrouping = false;
continue;
case "precision-integer":
case ".":
result.maximumFractionDigits = 0;
continue;
case "measure-unit":
case "unit":
result.style = "unit";
result.unit = icuUnitToEcma(token.options[0]);
continue;
case "compact-short":
case "K":
result.notation = "compact";
result.compactDisplay = "short";
continue;
case "compact-long":
case "KK":
result.notation = "compact";
result.compactDisplay = "long";
continue;
case "scientific":
result = __assign(__assign(__assign({}, result), { notation: "scientific" }), token.options.reduce(function(all, opt2) {
return __assign(__assign({}, all), parseNotationOptions(opt2));
}, {}));
continue;
case "engineering":
result = __assign(__assign(__assign({}, result), { notation: "engineering" }), token.options.reduce(function(all, opt2) {
return __assign(__assign({}, all), parseNotationOptions(opt2));
}, {}));
continue;
case "notation-simple":
result.notation = "standard";
continue;
// https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/unicode/unumberformatter.h
case "unit-width-narrow":
result.currencyDisplay = "narrowSymbol";
result.unitDisplay = "narrow";
continue;
case "unit-width-short":
result.currencyDisplay = "code";
result.unitDisplay = "short";
continue;
case "unit-width-full-name":
result.currencyDisplay = "name";
result.unitDisplay = "long";
continue;
case "unit-width-iso-code":
result.currencyDisplay = "symbol";
continue;
case "scale":
result.scale = parseFloat(token.options[0]);
continue;
case "rounding-mode-floor":
result.roundingMode = "floor";
continue;
case "rounding-mode-ceiling":
result.roundingMode = "ceil";
continue;
case "rounding-mode-down":
result.roundingMode = "trunc";
continue;
case "rounding-mode-up":
result.roundingMode = "expand";
continue;
case "rounding-mode-half-even":
result.roundingMode = "halfEven";
continue;
case "rounding-mode-half-down":
result.roundingMode = "halfTrunc";
continue;
case "rounding-mode-half-up":
result.roundingMode = "halfExpand";
continue;
// https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width
case "integer-width":
if (token.options.length > 1) {
throw new RangeError("integer-width stems only accept a single optional option");
}
token.options[0].replace(INTEGER_WIDTH_REGEX, function(_, g1, g2, g3, g4, g5) {
if (g1) {
result.minimumIntegerDigits = g2.length;
} else if (g3 && g4) {
throw new Error("We currently do not support maximum integer digits");
} else if (g5) {
throw new Error("We currently do not support exact integer digits");
}
return "";
});
continue;
}
if (CONCISE_INTEGER_WIDTH_REGEX.test(token.stem)) {
result.minimumIntegerDigits = token.stem.length;
continue;
}
if (FRACTION_PRECISION_REGEX.test(token.stem)) {
if (token.options.length > 1) {
throw new RangeError("Fraction-precision stems only accept a single optional option");
}
token.stem.replace(FRACTION_PRECISION_REGEX, function(_, g1, g2, g3, g4, g5) {
if (g2 === "*") {
result.minimumFractionDigits = g1.length;
} else if (g3 && g3[0] === "#") {
result.maximumFractionDigits = g3.length;
} else if (g4 && g5) {
result.minimumFractionDigits = g4.length;
result.maximumFractionDigits = g4.length + g5.length;
} else {
result.minimumFractionDigits = g1.length;
result.maximumFractionDigits = g1.length;
}
return "";
});
var opt = token.options[0];
if (opt === "w") {
result = __assign(__assign({}, result), { trailingZeroDisplay: "stripIfInteger" });
} else if (opt) {
result = __assign(__assign({}, result), parseSignificantPrecision(opt));
}
continue;
}
if (SIGNIFICANT_PRECISION_REGEX.test(token.stem)) {
result = __assign(__assign({}, result), parseSignificantPrecision(token.stem));
continue;
}
var signOpts = parseSign(token.stem);
if (signOpts) {
result = __assign(__assign({}, result), signOpts);
}
var conciseScientificAndEngineeringOpts = parseConciseScientificAndEngineeringStem(token.stem);
if (conciseScientificAndEngineeringOpts) {
result = __assign(__assign({}, result), conciseScientificAndEngineeringOpts);
}
}
return result;
}
// ../../node_modules/@formatjs/icu-messageformat-parser/lib/date-time-pattern-generator.js
init_esm_shims();
// ../../node_modules/@formatjs/icu-messageformat-parser/lib/time-data.generated.js
init_esm_shims();
var timeData = {
"001": [
"H",
"h"
],
"419": [
"h",
"H",
"hB",
"hb"
],
"AC": [
"H",
"h",
"hb",
"hB"
],
"AD": [
"H",
"hB"
],
"AE": [
"h",
"hB",
"hb",
"H"
],
"AF": [
"H",
"hb",
"hB",
"h"
],
"AG": [
"h",
"hb",
"H",
"hB"
],
"AI": [
"H",
"h",
"hb",
"hB"
],
"AL": [
"h",
"H",
"hB"
],
"AM": [
"H",
"hB"
],
"AO": [
"H",
"hB"
],
"AR": [
"h",
"H",
"hB",
"hb"
],
"AS": [
"h",
"H"
],
"AT": [
"H",
"hB"
],
"AU": [
"h",
"hb",
"H",
"hB"
],
"AW": [
"H",
"hB"
],
"AX": [
"H"
],
"AZ": [
"H",
"hB",
"h"
],
"BA": [
"H",
"hB",
"h"
],
"BB": [
"h",
"hb",
"H",
"hB"
],
"BD": [
"h",
"hB",
"H"
],
"BE": [
"H",
"hB"
],
"BF": [
"H",
"hB"
],
"BG": [
"H",
"hB",
"h"
],
"BH": [
"h",
"hB",
"hb",