: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
this.parts.push(literal.number);
visitBinaryOperation(operation) {
operation.arg1.visit(this);
this.parts.push(" ", operation.op, " ");
operation.arg2.visit(this);
visitVariableDefinition(definition) {
definition.variable.visit(this);
definition.arg.visit(this);
this.parts.push("Math.min(");
this.parts.push(", ", max.max, ")");
return this.parts.join("");
function buildAddOperation(num1, num2) {
if (num2.type === "literal" && num2.number === 0) {
if (num1.type === "literal" && num1.number === 0) {
if (num2.type === "literal" && num1.type === "literal") {
return new AstLiteral(num1.number + num2.number);
return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
function buildMulOperation(num1, num2) {
if (num2.type === "literal") {
return new AstLiteral(0);
} else if (num2.number === 1) {
} else if (num1.type === "literal") {
return new AstLiteral(num1.number * num2.number);
if (num1.type === "literal") {
return new AstLiteral(0);
} else if (num1.number === 1) {
const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
return new AstBinaryOperation("*", num1, num2, min, max);
function buildSubOperation(num1, num2) {
if (num2.type === "literal") {
} else if (num1.type === "literal") {
return new AstLiteral(num1.number - num2.number);
if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
function buildMinOperation(num1, max) {
return new AstLiteral(max);
} else if (num1.max <= max) {
return new AstMin(num1, max);
class PostScriptCompiler {
compile(code, domain, range) {
const inputSize = domain.length >> 1,
outputSize = range.length >> 1;
let num1, num2, ast1, ast2, tmpVar, item;
for (let i = 0; i < inputSize; i++) {
stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
for (let i = 0, ii = code.length; i < ii; i++) {
if (typeof item === "number") {
stack.push(new AstLiteral(item));
stack.push(buildAddOperation(num1, num2));
stack.push(buildMulOperation(num1, num2));
stack.push(buildSubOperation(num1, num2));
if (num1.type !== "literal") {
if (n < 0 || !Number.isInteger(n) || stack.length < n) {
ast1 = stack[stack.length - n - 1];
if (ast1.type === "literal" || ast1.type === "var") {
tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
stack[stack.length - n - 1] = tmpVar;
instructions.push(new AstVariableDefinition(tmpVar, ast1));
if (typeof code[i + 1] === "number" && code[i + 2] === "gt" && code[i + 3] === i + 7 && code[i + 4] === "jz" && code[i + 5] === "pop" && code[i + 6] === code[i + 1]) {
stack.push(buildMinOperation(num1, code[i + 1]));
if (ast1.type === "literal" || ast1.type === "var") {
tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
stack[stack.length - 1] = tmpVar;
instructions.push(new AstVariableDefinition(tmpVar, ast1));
if (num2.type !== "literal" || num1.type !== "literal") {
if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
stack.push(...stack.splice(stack.length - n, n - j));
if (stack.length !== outputSize) {
for (const instruction of instructions) {
const statementBuilder = new ExpressionBuilderVisitor();
instruction.visit(statementBuilder);
result.push(statementBuilder.toString());
for (let i = 0, ii = stack.length; i < ii; i++) {
statementBuilder = new ExpressionBuilderVisitor();
expr.visit(statementBuilder);
const min = range[i * 2],
const out = [statementBuilder.toString()];
out.unshift("Math.max(", min, ", ");
out.unshift("Math.min(", max, ", ");
out.unshift("dest[destOffset + ", i, "] = ");
result.push(out.join(""));
return result.join("\n");
;// CONCATENATED MODULE: ./src/core/bidi.js
const baseTypes = ["BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "S", "B", "S", "WS", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "B", "B", "B", "S", "WS", "ON", "ON", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "ON", "ES", "CS", "ES", "CS", "CS", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "CS", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "BN", "BN", "BN", "BN", "BN", "BN", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "CS", "ON", "ET", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "L", "ON", "ON", "BN", "ON", "ON", "ET", "ET", "EN", "EN", "ON", "L", "ON", "ON", "ON", "EN", "L", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L"];
const arabicTypes = ["AN", "AN", "AN", "AN", "AN", "AN", "ON", "ON", "AL", "ET", "ET", "AL", "CS", "AL", "ON", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "ET", "AN", "AN", "AL", "AL", "AL", "NSM", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "NSM", "NSM", "ON", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "AL", "AL", "AL", "AL", "AL", "AL"];
function findUnequal(arr, start, value) {
for (j = start, jj = arr.length; j < jj; ++j) {
function setValues(arr, start, end, value) {
for (let j = start; j < end; ++j) {
function reverseValues(arr, start, end) {
for (let i = start, j = end - 1; i < j; ++i, --j) {
function createBidiText(str, isLTR, vertical = false) {
function bidi(str, startLevel = -1, vertical = false) {
const strLength = str.length;
if (strLength === 0 || vertical) {
return createBidiText(str, isLTR, vertical);
chars.length = strLength;
types.length = strLength;
for (i = 0; i < strLength; ++i) {
chars[i] = str.charAt(i);
const charCode = str.charCodeAt(i);
if (charCode <= 0x00ff) {
charType = baseTypes[charCode];
} else if (0x0590 <= charCode && charCode <= 0x05f4) {
} else if (0x0600 <= charCode && charCode <= 0x06ff) {
charType = arabicTypes[charCode & 0xff];
warn("Bidi: invalid Unicode character " + charCode.toString(16));
} else if (0x0700 <= charCode && charCode <= 0x08ac || 0xfb50 <= charCode && charCode <= 0xfdff || 0xfe70 <= charCode && charCode <= 0xfeff) {
if (charType === "R" || charType === "AL" || charType === "AN") {
return createBidiText(str, isLTR);
if (numBidi / strLength < 0.3 && strLength > 4) {
for (i = 0; i < strLength; ++i) {
const e = isOdd(startLevel) ? "R" : "L";
for (i = 0; i < strLength; ++i) {
if (types[i] === "NSM") {
for (i = 0; i < strLength; ++i) {
types[i] = lastType === "AL" ? "AN" : "EN";
} else if (t === "R" || t === "L" || t === "AL") {
for (i = 0; i < strLength; ++i) {
for (i = 1; i < strLength - 1; ++i) {
if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
for (i = 0; i < strLength; ++i) {
for (let j = i - 1; j >= 0; --j) {
for (let j = i + 1; j < strLength; ++j) {
for (i = 0; i < strLength; ++i) {
if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
for (i = 0; i < strLength; ++i) {
types[i] = lastType === "L" ? "L" : "EN";
} else if (t === "R" || t === "L") {
for (i = 0; i < strLength; ++i) {
const end = findUnequal(types, i + 1, "ON");
if (end + 1 < strLength) {
setValues(types, i, end, before);
for (i = 0; i < strLength; ++i) {
for (i = 0; i < strLength; ++i) {
} else if (t === "AN" || t === "EN") {
} else if (t === "L" || t === "AN" || t === "EN") {
for (i = 0, ii = levels.length; i < ii; ++i) {
if (highestLevel < level) {
if (lowestOddLevel > level && isOdd(level)) {
for (level = highestLevel; level >= lowestOddLevel; --level) {
for (i = 0, ii = levels.length; i < ii; ++i) {
reverseValues(chars, start, i);
reverseValues(chars, start, levels.length);
for (i = 0, ii = chars.length; i < ii; ++i) {
if (ch === "<" || ch === ">") {
return createBidiText(chars.join(""), isLTR);
;// CONCATENATED MODULE: ./src/core/font_substitutions.js