// Metro module 1279 (f1280). import * as _slicedToArray from "./_slicedToArray"; let c1043_1, compressFormatJsToAst; const hydrateSingle = function hydrateSingle(a0) { if (typeof a0 === "string") { return { type: 0, value: a0 }; } const [type2] = a0; if (c1043_1.Argument === type2) { return { type: type2, value: a0[1] }; } if (c1043_1.Number !== type2 && c1043_1.Date !== type2 && c1043_1.Time !== type2) { if (c1043_1.Select !== type2 && c1043_1.Plural !== type2) { if (c1043_1.Pound === type2) { return exports.FORMAT_JS_POUND; } if (c1043_1.Tag === type2) { const [type, value, children, control] = a0; const r7 = 0 < children.length; let r45 = 0; if (r7) { do { children[r45] = hydrateSingle(children[r45]); r45 = r45 + 1; } while (r45 < children.length); } if (control != null) { const r51 = 0 < control.length; let r52 = 0; if (r51) { do { control[r52] = hydrateSingle(control[r52]); r52 = r52 + 1; } while (r52 < control.length); } } return { type, value, children, control }; } throw new Error(`FormatJS keyless JSON encountered an unknown type: ${type2}`); } const [type3, value2, options, offset, pluralType] = a0; for (const key in options) { const r21 = options[key]; const r71 = 0 < r21.length; let r0 = 0; if (r71) { do { r21[r0] = hydrateSingle(r21[r0]); r0 = r0 + 1; } while (r0 < r21.length); } options[key] = { value: options[key] }; } return type3 === c1043_1.Plural ? { type: type3, value: value2, options, offset, pluralType } : { type: type3, value: value2, options, offset }; } return { type: type2, value: a0[1], style: a0[2] }; }; export function hydrateFormatJsAst(a0) { if (typeof a0 === "string") { return hydrateSingle(a0); } if (typeof a0[0] === "string") { const r23 = 0 < a0.length; let r25 = 0; if (r23) { do { a0[r25] = hydrateSingle(a0[r25]); r25 = r25 + 1; } while (r25 < a0.length); } return a0; } if (a0.length === 0) { return a0; } if (Array.isArray(a0[0])) { const r4 = 0 < a0.length; let r0 = 0; if (r4) { do { a0[r0] = hydrateSingle(a0[r0]); r0 = r0 + 1; } while (r0 < a0.length); } return a0; } return hydrateSingle(a0); } compressFormatJsToAst = function compressFormatJsToAst(a0) { if (Array.isArray(a0)) { return a0.map((item) => compressFormatJsToAst(item)); } const type = a0.type; if (c1043_1.Literal === type) { return a0.value; } if (c1043_1.Argument === type) { return [a0.type, a0.value]; } if (c1043_1.Number !== type && c1043_1.Date !== type && c1043_1.Time !== type) { if (c1043_1.Select === type) { const r68 = {}; for (const item2 of Object.entries(a0.options)) { const r82 = _slicedToArray(item2, 2); r68[r82[0]] = compressFormatJsToAst(r82[1].value); } return [a0.type, a0.value, r68]; } if (c1043_1.Plural !== type) { if (c1043_1.Pound === type) { return [a0.type]; } if (c1043_1.Tag === type) { return [a0.type, a0.value, compressFormatJsToAst(a0.children), compressFormatJsToAst(a0.control)]; } return void 0; } const r46 = {}; for (const item of Object.entries(a0.options)) { const r57 = _slicedToArray(item, 2); r46[r57[0]] = compressFormatJsToAst(r57[1].value); } return [a0.type, a0.value, r46, a0.offset, a0.pluralType]; } return [a0.type, a0.value, a0.style]; }; export { compressFormatJsToAst }; export function isCompressedAst(a0) { return typeof a0 !== "string" ? !!Array.isArray(a0) && (Array.isArray(a0[0]) || typeof a0[0] === "string") : typeof a0 === "string"; } c1043_1 = {}; export { c1043_1 as FormatJsNodeType }; c1043_1.Literal = 0; c1043_1[0] = "Literal"; c1043_1.Argument = 1; c1043_1[1] = "Argument"; c1043_1.Number = 2; c1043_1[2] = "Number"; c1043_1.Date = 3; c1043_1[3] = "Date"; c1043_1.Time = 4; c1043_1[4] = "Time"; c1043_1.Select = 5; c1043_1[5] = "Select"; c1043_1.Plural = 6; c1043_1[6] = "Plural"; c1043_1.Pound = 7; c1043_1[7] = "Pound"; c1043_1.Tag = 8; c1043_1[8] = "Tag"; export const FORMAT_JS_POUND = Object.freeze({ type: 7 });