: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
return this.value.toString(10);
class FluentDateTime extends FluentType {
constructor(value, opts = {}) {
const dtf = scope.memoizeIntlObject(Intl.DateTimeFormat, this.opts);
return dtf.format(this.value);
return new Date(this.value).toISOString();
;// CONCATENATED MODULE: ./node_modules/@fluent/bundle/esm/resolver.js
const MAX_PLACEABLES = 100;
function match(scope, selector, key) {
if (key instanceof FluentNumber && selector instanceof FluentNumber && key.value === selector.value) {
if (selector instanceof FluentNumber && typeof key === "string") {
let category = scope.memoizeIntlObject(Intl.PluralRules, selector.opts).select(selector.value);
function getDefault(scope, variants, star) {
return resolvePattern(scope, variants[star].value);
scope.reportError(new RangeError("No default"));
function getArguments(scope, args) {
const named = Object.create(null);
for (const arg of args) {
if (arg.type === "narg") {
named[arg.name] = resolveExpression(scope, arg.value);
positional.push(resolveExpression(scope, arg));
function resolveExpression(scope, expr) {
return new FluentNumber(expr.value, {
minimumFractionDigits: expr.precision
return resolveVariableReference(scope, expr);
return resolveMessageReference(scope, expr);
return resolveTermReference(scope, expr);
return resolveFunctionReference(scope, expr);
return resolveSelectExpression(scope, expr);
function resolveVariableReference(scope, {
if (Object.prototype.hasOwnProperty.call(scope.params, name)) {
arg = scope.params[name];
return new FluentNone(`$${name}`);
} else if (scope.args && Object.prototype.hasOwnProperty.call(scope.args, name)) {
scope.reportError(new ReferenceError(`Unknown variable: $${name}`));
return new FluentNone(`$${name}`);
if (arg instanceof FluentType) {
return new FluentNumber(arg);
if (arg instanceof Date) {
return new FluentDateTime(arg.getTime());
scope.reportError(new TypeError(`Variable type not supported: $${name}, ${typeof arg}`));
return new FluentNone(`$${name}`);
function resolveMessageReference(scope, {
const message = scope.bundle._messages.get(name);
scope.reportError(new ReferenceError(`Unknown message: ${name}`));
return new FluentNone(name);
const attribute = message.attributes[attr];
return resolvePattern(scope, attribute);
scope.reportError(new ReferenceError(`Unknown attribute: ${attr}`));
return new FluentNone(`${name}.${attr}`);
return resolvePattern(scope, message.value);
scope.reportError(new ReferenceError(`No value: ${name}`));
return new FluentNone(name);
function resolveTermReference(scope, {
const term = scope.bundle._terms.get(id);
scope.reportError(new ReferenceError(`Unknown term: ${id}`));
return new FluentNone(id);
const attribute = term.attributes[attr];
scope.params = getArguments(scope, args).named;
const resolved = resolvePattern(scope, attribute);
scope.reportError(new ReferenceError(`Unknown attribute: ${attr}`));
return new FluentNone(`${id}.${attr}`);
scope.params = getArguments(scope, args).named;
const resolved = resolvePattern(scope, term.value);
function resolveFunctionReference(scope, {
let func = scope.bundle._functions[name];
scope.reportError(new ReferenceError(`Unknown function: ${name}()`));
return new FluentNone(`${name}()`);
if (typeof func !== "function") {
scope.reportError(new TypeError(`Function ${name}() is not callable`));
return new FluentNone(`${name}()`);
let resolved = getArguments(scope, args);
return func(resolved.positional, resolved.named);
return new FluentNone(`${name}()`);
function resolveSelectExpression(scope, {
let sel = resolveExpression(scope, selector);
if (sel instanceof FluentNone) {
return getDefault(scope, variants, star);
for (const variant of variants) {
const key = resolveExpression(scope, variant.key);
if (match(scope, sel, key)) {
return resolvePattern(scope, variant.value);
return getDefault(scope, variants, star);
function resolveComplexPattern(scope, ptn) {
if (scope.dirty.has(ptn)) {
scope.reportError(new RangeError("Cyclic reference"));
const useIsolating = scope.bundle._useIsolating && ptn.length > 1;
for (const elem of ptn) {
if (typeof elem === "string") {
result.push(scope.bundle._transform(elem));
if (scope.placeables > MAX_PLACEABLES) {
throw new RangeError(`Too many placeables expanded: ${scope.placeables}, ` + `max allowed is ${MAX_PLACEABLES}`);
result.push(resolveExpression(scope, elem).toString(scope));
function resolvePattern(scope, value) {
if (typeof value === "string") {
return scope.bundle._transform(value);
return resolveComplexPattern(scope, value);
;// CONCATENATED MODULE: ./node_modules/@fluent/bundle/esm/scope.js
constructor(bundle, errors, args) {
this.dirty = new WeakSet();
if (!this.errors || !(error instanceof Error)) {
memoizeIntlObject(ctor, opts) {
let cache = this.bundle._intls.get(ctor);
this.bundle._intls.set(ctor, cache);
let id = JSON.stringify(opts);
cache[id] = new ctor(this.bundle.locales, opts);
;// CONCATENATED MODULE: ./node_modules/@fluent/bundle/esm/builtins.js
function values(opts, allowed) {
const unwrapped = Object.create(null);
for (const [name, opt] of Object.entries(opts)) {
if (allowed.includes(name)) {
unwrapped[name] = opt.valueOf();
const NUMBER_ALLOWED = ["unitDisplay", "currencyDisplay", "useGrouping", "minimumIntegerDigits", "minimumFractionDigits", "maximumFractionDigits", "minimumSignificantDigits", "maximumSignificantDigits"];
function NUMBER(args, opts) {
if (arg instanceof FluentNone) {
return new FluentNone(`NUMBER(${arg.valueOf()})`);
if (arg instanceof FluentNumber) {
return new FluentNumber(arg.valueOf(), {
...values(opts, NUMBER_ALLOWED)
if (arg instanceof FluentDateTime) {
return new FluentNumber(arg.valueOf(), {
...values(opts, NUMBER_ALLOWED)
throw new TypeError("Invalid argument to NUMBER");
const DATETIME_ALLOWED = ["dateStyle", "timeStyle", "fractionalSecondDigits", "dayPeriod", "hour12", "weekday", "era", "year", "month", "day", "hour", "minute", "second", "timeZoneName"];
function DATETIME(args, opts) {
if (arg instanceof FluentNone) {
return new FluentNone(`DATETIME(${arg.valueOf()})`);
if (arg instanceof FluentDateTime) {
return new FluentDateTime(arg.valueOf(), {
...values(opts, DATETIME_ALLOWED)
if (arg instanceof FluentNumber) {
return new FluentDateTime(arg.valueOf(), {
...values(opts, DATETIME_ALLOWED)
throw new TypeError("Invalid argument to DATETIME");
;// CONCATENATED MODULE: ./node_modules/@fluent/bundle/esm/memoizer.js
function getMemoizerForLocale(locales) {
const stringLocale = Array.isArray(locales) ? locales.join(" ") : locales;
let memoizer = cache.get(stringLocale);
if (memoizer === undefined) {
cache.set(stringLocale, memoizer);
;// CONCATENATED MODULE: ./node_modules/@fluent/bundle/esm/bundle.js
this._messages = new Map();
this.locales = Array.isArray(locales) ? locales : [locales];
this._useIsolating = useIsolating;
this._transform = transform;
this._intls = getMemoizerForLocale(locales);
return this._messages.has(id);
return this._messages.get(id);
for (let i = 0; i < res.body.length; i++) {
if (entry.id.startsWith("-")) {
if (allowOverrides === false && this._terms.has(entry.id)) {
errors.push(new Error(`Attempt to override an existing term: "${entry.id}"`));
this._terms.set(entry.id, entry);
if (allowOverrides === false && this._messages.has(entry.id)) {
errors.push(new Error(`Attempt to override an existing message: "${entry.id}"`));
this._messages.set(entry.id, entry);
formatPattern(pattern, args = null, errors = null) {
if (typeof pattern === "string") {
return this._transform(pattern);
let scope = new Scope(this, errors, args);
let value = resolveComplexPattern(scope, pattern);
return value.toString(scope);
if (scope.errors && err instanceof Error) {
return new FluentNone().toString(scope);
;// CONCATENATED MODULE: ./node_modules/@fluent/bundle/esm/resource.js
const RE_MESSAGE_START = /^(-?[a-zA-Z][\w-]*) *= */gm;
const RE_ATTRIBUTE_START = /\.([a-zA-Z][\w-]*) *= */y;
const RE_VARIANT_START = /\*?\[/y;
const RE_NUMBER_LITERAL = /(-?[0-9]+(?:\.([0-9]+))?)/y;
const RE_IDENTIFIER = /([a-zA-Z][\w-]*)/y;
const RE_REFERENCE = /([$-])?([a-zA-Z][\w-]*)(?:\.([a-zA-Z][\w-]*))?/y;
const RE_FUNCTION_NAME = /^[A-Z][A-Z0-9_-]*$/;
const RE_TEXT_RUN = /([^{}\n\r]+)/y;
const RE_STRING_RUN = /([^\\"\n\r]*)/y;
const RE_STRING_ESCAPE = /\\([\\"])/y;
const RE_UNICODE_ESCAPE = /\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{6})/y;
const RE_LEADING_NEWLINES = /^\n+/;
const RE_TRAILING_SPACES = / +$/;
const RE_BLANK_LINES = / *\r?\n/g;
const RE_INDENT = /( *)$/;
const TOKEN_BRACE_OPEN = /{\s*/y;
const TOKEN_BRACE_CLOSE = /\s*}/y;
const TOKEN_BRACKET_OPEN = /\[\s*/y;
const TOKEN_BRACKET_CLOSE = /\s*] */y;
const TOKEN_PAREN_OPEN = /\s*\(\s*/y;
const TOKEN_ARROW = /\s*->\s*/y;
const TOKEN_COLON = /\s*:\s*/y;
const TOKEN_COMMA = /\s*,?\s*/y;
const TOKEN_BLANK = /\s+/y;
RE_MESSAGE_START.lastIndex = 0;
let next = RE_MESSAGE_START.exec(source);
cursor = RE_MESSAGE_START.lastIndex;
this.body.push(parseMessage(next[1]));
if (err instanceof SyntaxError) {
function consumeChar(char, errorClass) {
if (source[cursor] === char) {
throw new errorClass(`Expected ${char}`);
function consumeToken(re, errorClass) {
throw new errorClass(`Expected ${re.toString()}`);
let result = re.exec(source);
throw new SyntaxError(`Expected ${re.toString()}`);
function parseMessage(id) {
let value = parsePattern();
let attributes = parseAttributes();
if (value === null && Object.keys(attributes).length === 0) {
throw new SyntaxError("Expected message value or attributes");
function parseAttributes() {
let attrs = Object.create(null);
while (test(RE_ATTRIBUTE_START)) {
let name = match1(RE_ATTRIBUTE_START);
let value = parsePattern();