@warp-ds/elements 2.1.0 → 2.1.1-next.2

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.
@@ -729,9 +729,9 @@ var require_moo = __commonJS({
729
729
  }
730
730
  });
731
731
 
732
- // node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/lexer.js
732
+ // node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js
733
733
  var require_lexer = __commonJS({
734
- "node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/lexer.js"(exports) {
734
+ "node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js"(exports) {
735
735
  "use strict";
736
736
  var __importDefault = exports && exports.__importDefault || function(mod) {
737
737
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -744,7 +744,7 @@ var require_lexer = __commonJS({
744
744
  doubleapos: { match: "''", value: () => "'" },
745
745
  quoted: {
746
746
  lineBreaks: true,
747
- match: /'[{}#](?:[^]*?[^'])?'(?!')/u,
747
+ match: /'[{}#](?:[^']|'')*'(?!')/u,
748
748
  value: (src) => src.slice(1, -1).replace(/''/g, "'")
749
749
  },
750
750
  argument: {
@@ -796,12 +796,13 @@ var require_lexer = __commonJS({
796
796
  }
797
797
  });
798
798
 
799
- // node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/parser.js
799
+ // node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js
800
800
  var require_parser = __commonJS({
801
- "node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/parser.js"(exports) {
801
+ "node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js"(exports) {
802
802
  "use strict";
803
803
  Object.defineProperty(exports, "__esModule", { value: true });
804
- exports.parse = exports.ParseError = void 0;
804
+ exports.ParseError = void 0;
805
+ exports.parse = parse2;
805
806
  var lexer_js_1 = require_lexer();
806
807
  var getContext = (lt) => ({
807
808
  offset: lt.offset,
@@ -867,8 +868,9 @@ var require_parser = __commonJS({
867
868
  }
868
869
  checkSelectKey(lt, type, key) {
869
870
  if (key[0] === "=") {
870
- if (type === "select")
871
+ if (type === "select") {
871
872
  throw new ParseError(lt, `The case ${key} is not valid with select`);
873
+ }
872
874
  } else if (type !== "select") {
873
875
  const keys = type === "plural" ? this.cardinalKeys : this.ordinalKeys;
874
876
  if (this.strictPluralKeys && keys.length > 0 && !keys.includes(key)) {
@@ -886,10 +888,12 @@ var require_parser = __commonJS({
886
888
  for (const lt of this.lexer) {
887
889
  switch (lt.type) {
888
890
  case "offset":
889
- if (type === "select")
891
+ if (type === "select") {
890
892
  throw new ParseError(lt, "Unexpected plural offset for select");
891
- if (sel.cases.length > 0)
893
+ }
894
+ if (sel.cases.length > 0) {
892
895
  throw new ParseError(lt, "Plural offset must be set before cases");
896
+ }
893
897
  sel.pluralOffset = Number(lt.value);
894
898
  ctx.text += lt.text;
895
899
  ctx.lineBreaks += lt.lineBreaks;
@@ -929,11 +933,13 @@ var require_parser = __commonJS({
929
933
  const end = this.lexer.next();
930
934
  if (!end)
931
935
  throw new ParseError(null, "Unexpected message end");
932
- if (end.type !== "end")
936
+ if (end.type !== "end") {
933
937
  throw new ParseError(end, `Unexpected lexer token: ${end.type}`);
938
+ }
934
939
  ctx.text += end.text;
935
- if (isSelectType(argType.value.toLowerCase()))
940
+ if (isSelectType(argType.value.toLowerCase())) {
936
941
  throw new ParseError(argType, `Invalid type identifier: ${argType.value}`);
942
+ }
937
943
  return {
938
944
  type: "function",
939
945
  arg: lt.value,
@@ -947,8 +953,9 @@ var require_parser = __commonJS({
947
953
  throw new ParseError(argType, msg);
948
954
  }
949
955
  let param = this.parseBody(this.strict ? false : inPlural);
950
- if (this.strict && param.length > 0)
956
+ if (this.strict && param.length > 0) {
951
957
  param = strictArgStyleParam(lt, param);
958
+ }
952
959
  return {
953
960
  type: "function",
954
961
  arg: lt.value,
@@ -958,10 +965,11 @@ var require_parser = __commonJS({
958
965
  };
959
966
  }
960
967
  case "select":
961
- if (isSelectType(argType.value))
968
+ if (isSelectType(argType.value)) {
962
969
  return this.parseSelect(lt, inPlural, ctx, argType.value);
963
- else
970
+ } else {
964
971
  throw new ParseError(argType, `Unexpected select type ${argType.value}`);
972
+ }
965
973
  default:
966
974
  throw new ParseError(argType, `Unexpected lexer token: ${argType.type}`);
967
975
  }
@@ -1008,7 +1016,6 @@ var require_parser = __commonJS({
1008
1016
  const parser = new Parser(src, options);
1009
1017
  return parser.parse();
1010
1018
  }
1011
- exports.parse = parse2;
1012
1019
  }
1013
1020
  });
1014
1021
 
@@ -1025,14 +1032,272 @@ var r = function() {
1025
1032
  }, []).join(" ");
1026
1033
  };
1027
1034
 
1028
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1035
+ // node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_typescri_qfhfd5z2jpd4amxt2golzdalsi/node_modules/@lingui/core/dist/index.mjs
1029
1036
  var import_unraw = __toESM(require_dist(), 1);
1030
1037
 
1031
- // node_modules/.pnpm/@lingui+message-utils@4.11.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1038
+ // node_modules/.pnpm/@lingui+message-utils@5.2.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1032
1039
  var import_parser = __toESM(require_parser(), 1);
1040
+ var DateFormatError = class extends Error {
1041
+ /** @internal */
1042
+ constructor(msg, token, type) {
1043
+ super(msg);
1044
+ this.token = token;
1045
+ this.type = type || "error";
1046
+ }
1047
+ };
1048
+ var alpha = (width) => width < 4 ? "short" : width === 4 ? "long" : "narrow";
1049
+ var numeric = (width) => width % 2 === 0 ? "2-digit" : "numeric";
1050
+ function yearOptions(token, onError) {
1051
+ switch (token.char) {
1052
+ case "y":
1053
+ return { year: numeric(token.width) };
1054
+ case "r":
1055
+ return { calendar: "gregory", year: "numeric" };
1056
+ case "u":
1057
+ case "U":
1058
+ case "Y":
1059
+ default:
1060
+ onError(`${token.desc} is not supported; falling back to year:numeric`, DateFormatError.WARNING);
1061
+ return { year: "numeric" };
1062
+ }
1063
+ }
1064
+ function monthStyle(token, onError) {
1065
+ switch (token.width) {
1066
+ case 1:
1067
+ return "numeric";
1068
+ case 2:
1069
+ return "2-digit";
1070
+ case 3:
1071
+ return "short";
1072
+ case 4:
1073
+ return "long";
1074
+ case 5:
1075
+ return "narrow";
1076
+ default:
1077
+ onError(`${token.desc} is not supported with width ${token.width}`);
1078
+ return void 0;
1079
+ }
1080
+ }
1081
+ function dayStyle(token, onError) {
1082
+ const { char, desc, width } = token;
1083
+ if (char === "d") {
1084
+ return numeric(width);
1085
+ } else {
1086
+ onError(`${desc} is not supported`);
1087
+ return void 0;
1088
+ }
1089
+ }
1090
+ function weekdayStyle(token, onError) {
1091
+ const { char, desc, width } = token;
1092
+ if ((char === "c" || char === "e") && width < 3) {
1093
+ const msg = `Numeric value is not supported for ${desc}; falling back to weekday:short`;
1094
+ onError(msg, DateFormatError.WARNING);
1095
+ }
1096
+ return alpha(width);
1097
+ }
1098
+ function hourOptions(token) {
1099
+ const hour = numeric(token.width);
1100
+ let hourCycle;
1101
+ switch (token.char) {
1102
+ case "h":
1103
+ hourCycle = "h12";
1104
+ break;
1105
+ case "H":
1106
+ hourCycle = "h23";
1107
+ break;
1108
+ case "k":
1109
+ hourCycle = "h24";
1110
+ break;
1111
+ case "K":
1112
+ hourCycle = "h11";
1113
+ break;
1114
+ }
1115
+ return hourCycle ? { hour, hourCycle } : { hour };
1116
+ }
1117
+ function timeZoneNameStyle(token, onError) {
1118
+ const { char, desc, width } = token;
1119
+ switch (char) {
1120
+ case "v":
1121
+ case "z":
1122
+ return width === 4 ? "long" : "short";
1123
+ case "V":
1124
+ if (width === 4)
1125
+ return "long";
1126
+ onError(`${desc} is not supported with width ${width}`);
1127
+ return void 0;
1128
+ case "X":
1129
+ onError(`${desc} is not supported`);
1130
+ return void 0;
1131
+ }
1132
+ return "short";
1133
+ }
1134
+ function compileOptions(token, onError) {
1135
+ switch (token.field) {
1136
+ case "era":
1137
+ return { era: alpha(token.width) };
1138
+ case "year":
1139
+ return yearOptions(token, onError);
1140
+ case "month":
1141
+ return { month: monthStyle(token, onError) };
1142
+ case "day":
1143
+ return { day: dayStyle(token, onError) };
1144
+ case "weekday":
1145
+ return { weekday: weekdayStyle(token, onError) };
1146
+ case "period":
1147
+ return void 0;
1148
+ case "hour":
1149
+ return hourOptions(token);
1150
+ case "min":
1151
+ return { minute: numeric(token.width) };
1152
+ case "sec":
1153
+ return { second: numeric(token.width) };
1154
+ case "tz":
1155
+ return { timeZoneName: timeZoneNameStyle(token, onError) };
1156
+ case "quarter":
1157
+ case "week":
1158
+ case "sec-frac":
1159
+ case "ms":
1160
+ onError(`${token.desc} is not supported`);
1161
+ }
1162
+ return void 0;
1163
+ }
1164
+ function getDateFormatOptions(tokens, timeZone, onError = (error) => {
1165
+ throw error;
1166
+ }) {
1167
+ const options = {
1168
+ timeZone
1169
+ };
1170
+ const fields2 = [];
1171
+ for (const token of tokens) {
1172
+ const { error, field, str } = token;
1173
+ if (error) {
1174
+ const dte = new DateFormatError(error.message, token);
1175
+ dte.stack = error.stack;
1176
+ onError(dte);
1177
+ }
1178
+ if (str) {
1179
+ const msg = `Ignoring string part: ${str}`;
1180
+ onError(new DateFormatError(msg, token, DateFormatError.WARNING));
1181
+ }
1182
+ if (field) {
1183
+ if (fields2.indexOf(field) === -1)
1184
+ fields2.push(field);
1185
+ else
1186
+ onError(new DateFormatError(`Duplicate ${field} token`, token));
1187
+ }
1188
+ const opt = compileOptions(token, (msg, isWarning) => onError(new DateFormatError(msg, token, isWarning)));
1189
+ if (opt)
1190
+ Object.assign(options, opt);
1191
+ }
1192
+ return options;
1193
+ }
1194
+ var fields = {
1195
+ G: { field: "era", desc: "Era" },
1196
+ y: { field: "year", desc: "Year" },
1197
+ Y: { field: "year", desc: 'Year of "Week of Year"' },
1198
+ u: { field: "year", desc: "Extended year" },
1199
+ U: { field: "year", desc: "Cyclic year name" },
1200
+ r: { field: "year", desc: "Related Gregorian year" },
1201
+ Q: { field: "quarter", desc: "Quarter" },
1202
+ q: { field: "quarter", desc: "Stand-alone quarter" },
1203
+ M: { field: "month", desc: "Month in year" },
1204
+ L: { field: "month", desc: "Stand-alone month in year" },
1205
+ w: { field: "week", desc: "Week of year" },
1206
+ W: { field: "week", desc: "Week of month" },
1207
+ d: { field: "day", desc: "Day in month" },
1208
+ D: { field: "day", desc: "Day of year" },
1209
+ F: { field: "day", desc: "Day of week in month" },
1210
+ g: { field: "day", desc: "Modified julian day" },
1211
+ E: { field: "weekday", desc: "Day of week" },
1212
+ e: { field: "weekday", desc: "Local day of week" },
1213
+ c: { field: "weekday", desc: "Stand-alone local day of week" },
1214
+ a: { field: "period", desc: "AM/PM marker" },
1215
+ b: { field: "period", desc: "AM/PM/noon/midnight marker" },
1216
+ B: { field: "period", desc: "Flexible day period" },
1217
+ h: { field: "hour", desc: "Hour in AM/PM (1~12)" },
1218
+ H: { field: "hour", desc: "Hour in day (0~23)" },
1219
+ k: { field: "hour", desc: "Hour in day (1~24)" },
1220
+ K: { field: "hour", desc: "Hour in AM/PM (0~11)" },
1221
+ j: { field: "hour", desc: "Hour in preferred cycle" },
1222
+ J: { field: "hour", desc: "Hour in preferred cycle without marker" },
1223
+ C: { field: "hour", desc: "Hour in preferred cycle with flexible marker" },
1224
+ m: { field: "min", desc: "Minute in hour" },
1225
+ s: { field: "sec", desc: "Second in minute" },
1226
+ S: { field: "sec-frac", desc: "Fractional second" },
1227
+ A: { field: "ms", desc: "Milliseconds in day" },
1228
+ z: { field: "tz", desc: "Time Zone: specific non-location" },
1229
+ Z: { field: "tz", desc: "Time Zone" },
1230
+ O: { field: "tz", desc: "Time Zone: localized" },
1231
+ v: { field: "tz", desc: "Time Zone: generic non-location" },
1232
+ V: { field: "tz", desc: "Time Zone: ID" },
1233
+ X: { field: "tz", desc: "Time Zone: ISO8601 with Z" },
1234
+ x: { field: "tz", desc: "Time Zone: ISO8601" }
1235
+ };
1236
+ var isLetter = (char) => char >= "A" && char <= "Z" || char >= "a" && char <= "z";
1237
+ function readFieldToken(src, pos) {
1238
+ const char = src[pos];
1239
+ let width = 1;
1240
+ while (src[++pos] === char)
1241
+ ++width;
1242
+ const field = fields[char];
1243
+ if (!field) {
1244
+ const msg = `The letter ${char} is not a valid field identifier`;
1245
+ return { char, error: new Error(msg), width };
1246
+ }
1247
+ return { char, field: field.field, desc: field.desc, width };
1248
+ }
1249
+ function readQuotedToken(src, pos) {
1250
+ let str = src[++pos];
1251
+ let width = 2;
1252
+ if (str === "'")
1253
+ return { char: "'", str, width };
1254
+ while (true) {
1255
+ const next = src[++pos];
1256
+ ++width;
1257
+ if (next === void 0) {
1258
+ const msg = `Unterminated quoted literal in pattern: ${str || src}`;
1259
+ return { char: "'", error: new Error(msg), str, width };
1260
+ } else if (next === "'") {
1261
+ if (src[++pos] !== "'")
1262
+ return { char: "'", str, width };
1263
+ else
1264
+ ++width;
1265
+ }
1266
+ str += next;
1267
+ }
1268
+ }
1269
+ function readToken(src, pos) {
1270
+ const char = src[pos];
1271
+ if (!char)
1272
+ return null;
1273
+ if (isLetter(char))
1274
+ return readFieldToken(src, pos);
1275
+ if (char === "'")
1276
+ return readQuotedToken(src, pos);
1277
+ let str = char;
1278
+ let width = 1;
1279
+ while (true) {
1280
+ const next = src[++pos];
1281
+ if (!next || isLetter(next) || next === "'")
1282
+ return { char, str, width };
1283
+ str += next;
1284
+ width += 1;
1285
+ }
1286
+ }
1287
+ function parseDateTokens(src) {
1288
+ const tokens = [];
1289
+ let pos = 0;
1290
+ while (true) {
1291
+ const token = readToken(src, pos);
1292
+ if (!token)
1293
+ return tokens;
1294
+ tokens.push(token);
1295
+ pos += token.width;
1296
+ }
1297
+ }
1033
1298
  function processTokens(tokens, mapText) {
1034
1299
  if (!tokens.filter((token) => token.type !== "content").length) {
1035
- return tokens.map((token) => mapText(token.value)).join("");
1300
+ return tokens.map((token) => mapText(token.value));
1036
1301
  }
1037
1302
  return tokens.map((token) => {
1038
1303
  var _a;
@@ -1044,6 +1309,12 @@ function processTokens(tokens, mapText) {
1044
1309
  return [token.arg];
1045
1310
  } else if (token.type === "function") {
1046
1311
  const _param = (_a = token == null ? void 0 : token.param) == null ? void 0 : _a[0];
1312
+ if (token.key === "date" && _param) {
1313
+ const opts = compileDateExpression(_param.value.trim(), (e) => {
1314
+ throw new Error(`Unable to compile date expression: ${e.message}`);
1315
+ });
1316
+ return [token.arg, token.key, opts];
1317
+ }
1047
1318
  if (_param) {
1048
1319
  return [token.arg, token.key, _param.value.trim()];
1049
1320
  } else {
@@ -1065,6 +1336,13 @@ function processTokens(tokens, mapText) {
1065
1336
  ];
1066
1337
  });
1067
1338
  }
1339
+ function compileDateExpression(format, onError) {
1340
+ if (/^::/.test(format)) {
1341
+ const tokens = parseDateTokens(format.substring(2));
1342
+ return getDateFormatOptions(tokens, void 0, onError);
1343
+ }
1344
+ return format;
1345
+ }
1068
1346
  function compileMessage(message, mapText = (v) => v) {
1069
1347
  try {
1070
1348
  return processTokens((0, import_parser.parse)(message), mapText);
@@ -1072,11 +1350,11 @@ function compileMessage(message, mapText = (v) => v) {
1072
1350
  console.error(`${e.message}
1073
1351
 
1074
1352
  Message: ${message}`);
1075
- return message;
1353
+ return [message];
1076
1354
  }
1077
1355
  }
1078
1356
 
1079
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1357
+ // node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_typescri_qfhfd5z2jpd4amxt2golzdalsi/node_modules/@lingui/core/dist/index.mjs
1080
1358
  var isString = (s) => typeof s === "string";
1081
1359
  var isFunction = (f) => typeof f === "function";
1082
1360
  var cache = /* @__PURE__ */ new Map();
@@ -1087,12 +1365,59 @@ function normalizeLocales(locales) {
1087
1365
  }
1088
1366
  function date(locales, value, format) {
1089
1367
  const _locales = normalizeLocales(locales);
1368
+ if (!format) {
1369
+ format = "default";
1370
+ }
1371
+ let o;
1372
+ if (typeof format === "string") {
1373
+ o = {
1374
+ day: "numeric",
1375
+ month: "short",
1376
+ year: "numeric"
1377
+ };
1378
+ switch (format) {
1379
+ case "full":
1380
+ o.weekday = "long";
1381
+ case "long":
1382
+ o.month = "long";
1383
+ break;
1384
+ case "short":
1385
+ o.month = "numeric";
1386
+ break;
1387
+ }
1388
+ } else {
1389
+ o = format;
1390
+ }
1090
1391
  const formatter = getMemoized(
1091
1392
  () => cacheKey("date", _locales, format),
1092
- () => new Intl.DateTimeFormat(_locales, format)
1393
+ () => new Intl.DateTimeFormat(_locales, o)
1093
1394
  );
1094
1395
  return formatter.format(isString(value) ? new Date(value) : value);
1095
1396
  }
1397
+ function time(locales, value, format) {
1398
+ let o;
1399
+ if (!format) {
1400
+ format = "default";
1401
+ }
1402
+ if (typeof format === "string") {
1403
+ o = {
1404
+ second: "numeric",
1405
+ minute: "numeric",
1406
+ hour: "numeric"
1407
+ };
1408
+ switch (format) {
1409
+ case "full":
1410
+ case "long":
1411
+ o.timeZoneName = "short";
1412
+ break;
1413
+ case "short":
1414
+ delete o.second;
1415
+ }
1416
+ } else {
1417
+ o = format;
1418
+ }
1419
+ return date(locales, value, o);
1420
+ }
1096
1421
  function number(locales, value, format) {
1097
1422
  const _locales = normalizeLocales(locales);
1098
1423
  const formatter = getMemoized(
@@ -1127,12 +1452,14 @@ function cacheKey(type, locales, options) {
1127
1452
  const localeKey = locales.join("-");
1128
1453
  return `${type}-${localeKey}-${JSON.stringify(options)}`;
1129
1454
  }
1130
- var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
1455
+ var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/;
1131
1456
  var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
1132
1457
  var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1133
1458
  const locales = passedLocales || locale;
1134
1459
  const style = (format) => {
1135
- return typeof format === "object" ? format : formats[format] || { style: format };
1460
+ if (typeof format === "object")
1461
+ return format;
1462
+ return formats[format];
1136
1463
  };
1137
1464
  const replaceOctothorpe = (value, message) => {
1138
1465
  const numberFormat = Object.keys(formats).length ? style("number") : void 0;
@@ -1151,8 +1478,13 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1151
1478
  return replaceOctothorpe(value - offset, message);
1152
1479
  },
1153
1480
  select: selectFormatter,
1154
- number: (value, format) => number(locales, value, style(format)),
1155
- date: (value, format) => date(locales, value, style(format))
1481
+ number: (value, format) => number(
1482
+ locales,
1483
+ value,
1484
+ style(format) || { style: format }
1485
+ ),
1486
+ date: (value, format) => date(locales, value, style(format) || format),
1487
+ time: (value, format) => time(locales, value, style(format) || format)
1156
1488
  };
1157
1489
  };
1158
1490
  var selectFormatter = (value, rules) => {
@@ -1201,10 +1533,10 @@ function interpolate(translation, locale, locales) {
1201
1533
  };
1202
1534
  const result = formatMessage(translation);
1203
1535
  if (isString(result) && UNICODE_REGEX.test(result)) {
1204
- return (0, import_unraw.unraw)(result.trim());
1536
+ return (0, import_unraw.unraw)(result);
1205
1537
  }
1206
1538
  if (isString(result))
1207
- return result.trim();
1539
+ return result;
1208
1540
  return result ? String(result) : "";
1209
1541
  };
1210
1542
  }
@@ -1259,7 +1591,11 @@ var I18n = class extends EventEmitter {
1259
1591
  __publicField2(this, "_localeData", {});
1260
1592
  __publicField2(this, "_messages", {});
1261
1593
  __publicField2(this, "_missing");
1594
+ __publicField2(this, "_messageCompiler");
1262
1595
  __publicField2(this, "t", this._.bind(this));
1596
+ if (true) {
1597
+ this.setMessagesCompiler(compileMessage);
1598
+ }
1263
1599
  if (params.missing != null)
1264
1600
  this._missing = params.missing;
1265
1601
  if (params.messages != null)
@@ -1295,12 +1631,30 @@ var I18n = class extends EventEmitter {
1295
1631
  Object.assign(maybeLocaleData, localeData);
1296
1632
  }
1297
1633
  }
1634
+ /**
1635
+ * Registers a `MessageCompiler` to enable the use of uncompiled catalogs at runtime.
1636
+ *
1637
+ * In production builds, the `MessageCompiler` is typically excluded to reduce bundle size.
1638
+ * By default, message catalogs should be precompiled during the build process. However,
1639
+ * if you need to compile catalogs at runtime, you can use this method to set a message compiler.
1640
+ *
1641
+ * Example usage:
1642
+ *
1643
+ * ```ts
1644
+ * import { compileMessage } from "@lingui/message-utils/compileMessage";
1645
+ *
1646
+ * i18n.setMessagesCompiler(compileMessage);
1647
+ * ```
1648
+ */
1649
+ setMessagesCompiler(compiler) {
1650
+ this._messageCompiler = compiler;
1651
+ return this;
1652
+ }
1298
1653
  /**
1299
1654
  * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
1300
1655
  */
1301
- // @ts-ignore deprecated, so ignore the reported error
1302
1656
  loadLocaleData(localeOrAllData, localeData) {
1303
- if (localeData != null) {
1657
+ if (typeof localeOrAllData === "string") {
1304
1658
  this._loadLocaleData(localeOrAllData, localeData);
1305
1659
  } else {
1306
1660
  Object.keys(localeOrAllData).forEach(
@@ -1347,6 +1701,11 @@ var I18n = class extends EventEmitter {
1347
1701
  this.emit("change");
1348
1702
  }
1349
1703
  _(id, values, options) {
1704
+ if (!this.locale) {
1705
+ throw new Error(
1706
+ "Lingui: Attempted to call a translation function without setting a locale.\nMake sure to call `i18n.activate(locale)` before using Lingui functions.\nThis issue may also occur due to a race condition in your initialization logic."
1707
+ );
1708
+ }
1350
1709
  let message = options == null ? void 0 : options.message;
1351
1710
  if (!id) {
1352
1711
  id = "";
@@ -1366,8 +1725,20 @@ var I18n = class extends EventEmitter {
1366
1725
  this.emit("missing", { id, locale: this._locale });
1367
1726
  }
1368
1727
  let translation = messageForId || message || id;
1369
- if (true) {
1370
- translation = isString(translation) ? compileMessage(translation) : translation;
1728
+ if (isString(translation)) {
1729
+ if (this._messageCompiler) {
1730
+ translation = this._messageCompiler(translation);
1731
+ } else {
1732
+ console.warn(`Uncompiled message detected! Message:
1733
+
1734
+ > ${translation}
1735
+
1736
+ That means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.
1737
+ ICU features such as interpolation and plurals will not work properly for that message.
1738
+
1739
+ Please compile your catalog first.
1740
+ `);
1741
+ }
1371
1742
  }
1372
1743
  if (isString(translation) && UNICODE_REGEX.test(translation))
1373
1744
  return JSON.parse(`"${translation}"`);
@@ -1391,7 +1762,7 @@ function setupI18n(params = {}) {
1391
1762
  }
1392
1763
  var i18n = setupI18n();
1393
1764
 
1394
- // node_modules/.pnpm/@warp-ds+css@2.0.0_@warp-ds+uno@2.0.0_unocss@0.62.0_postcss@8.4.41_rollup@4.20.0_vite@5.3.3_@_vyiy5vwpqfzwy5hpmfkwp3zmle/node_modules/@warp-ds/css/component-classes/index.js
1765
+ // node_modules/.pnpm/@warp-ds+css@2.1.1_@warp-ds+uno@2.1.0_unocss@0.62.0_postcss@8.5.1_rollup@4.32.1_vite@5.3.3_@t_sgrraibu65gdmqpe655kfrpl6a/node_modules/@warp-ds/css/component-classes/index.js
1395
1766
  var buttonDefaultStyling = "font-bold focusable justify-center transition-colors ease-in-out";
1396
1767
  var buttonColors = {
1397
1768
  primary: "s-text-inverted bg-[--w-color-button-primary-background] hover:bg-[--w-color-button-primary-background-hover] active:bg-[--w-color-button-primary-background-active]",
@@ -1699,28 +2070,28 @@ function kebabCaseAttributes(constructor) {
1699
2070
  }
1700
2071
 
1701
2072
  // packages/select/locales/da/messages.mjs
1702
- var messages = JSON.parse('{"select.label.optional":"(valgfrit)"}');
2073
+ var messages = JSON.parse('{"select.label.optional":["(valgfrit)"]}');
1703
2074
 
1704
2075
  // packages/select/locales/en/messages.mjs
1705
- var messages2 = JSON.parse('{"select.label.optional":"(optional)"}');
2076
+ var messages2 = JSON.parse('{"select.label.optional":["(optional)"]}');
1706
2077
 
1707
2078
  // packages/select/locales/fi/messages.mjs
1708
- var messages3 = JSON.parse('{"select.label.optional":"(vapaaehtoinen)"}');
2079
+ var messages3 = JSON.parse('{"select.label.optional":["(vapaaehtoinen)"]}');
1709
2080
 
1710
2081
  // packages/select/locales/nb/messages.mjs
1711
- var messages4 = JSON.parse('{"select.label.optional":"(valgfritt)"}');
2082
+ var messages4 = JSON.parse('{"select.label.optional":["(valgfritt)"]}');
1712
2083
 
1713
2084
  // packages/select/locales/sv/messages.mjs
1714
- var messages5 = JSON.parse('{"select.label.optional":"(valfritt)"}');
2085
+ var messages5 = JSON.parse('{"select.label.optional":["(valfritt)"]}');
1715
2086
 
1716
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
2087
+ // node_modules/.pnpm/@warp-ds+icons@2.5.0_@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-_hyhbgchrkasknlbocfng7geeci/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
1717
2088
  import { LitElement } from "lit";
1718
2089
  import { unsafeStatic, html } from "lit/static-html.js";
1719
- var messages6 = JSON.parse('{"icon.title.chevron-down":"Nedoverpil"}');
1720
- var messages22 = JSON.parse('{"icon.title.chevron-down":"Downward arrow"}');
1721
- var messages32 = JSON.parse('{"icon.title.chevron-down":"Nuoli alasp\xE4in"}');
1722
- var messages42 = JSON.parse('{"icon.title.chevron-down":"Pil nedad"}');
1723
- var messages52 = JSON.parse('{"icon.title.chevron-down":"Pil ned"}');
2090
+ var messages6 = JSON.parse('{"icon.title.chevron-down":["Nedoverpil"]}');
2091
+ var messages22 = JSON.parse('{"icon.title.chevron-down":["Downward arrow"]}');
2092
+ var messages32 = JSON.parse('{"icon.title.chevron-down":["Nuoli alasp\xE4in"]}');
2093
+ var messages42 = JSON.parse('{"icon.title.chevron-down":["Pil nedad"]}');
2094
+ var messages52 = JSON.parse('{"icon.title.chevron-down":["Pil ned"]}');
1724
2095
  var supportedLocales2 = ["en", "nb", "fi", "da", "sv"];
1725
2096
  var defaultLocale3 = "en";
1726
2097
  var detectByBrand = () => {