@shotstack/shotstack-canvas 2.0.13 → 2.0.15
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.
- package/dist/entry.node.cjs +310 -70
- package/dist/entry.node.d.cts +12 -1
- package/dist/entry.node.d.ts +12 -1
- package/dist/entry.node.js +304 -70
- package/dist/entry.web.d.ts +12 -1
- package/dist/entry.web.js +1071 -70
- package/package.json +66 -65
package/dist/entry.web.js
CHANGED
|
@@ -32091,7 +32091,10 @@ var _FontRegistry = class _FontRegistry {
|
|
|
32091
32091
|
return;
|
|
32092
32092
|
}
|
|
32093
32093
|
try {
|
|
32094
|
-
const canvasMod =
|
|
32094
|
+
const canvasMod = await import(
|
|
32095
|
+
/* @vite-ignore */
|
|
32096
|
+
"canvas"
|
|
32097
|
+
);
|
|
32095
32098
|
const GlobalFonts = canvasMod.GlobalFonts;
|
|
32096
32099
|
if (GlobalFonts && typeof GlobalFonts.register === "function") {
|
|
32097
32100
|
const buffer = Buffer.from(bytes);
|
|
@@ -32153,18 +32156,901 @@ __publicField(_FontRegistry, "sharedInitPromise", null);
|
|
|
32153
32156
|
__publicField(_FontRegistry, "fallbackLoader");
|
|
32154
32157
|
var FontRegistry = _FontRegistry;
|
|
32155
32158
|
|
|
32159
|
+
// node_modules/.pnpm/bidi-js@1.0.3/node_modules/bidi-js/dist/bidi.mjs
|
|
32160
|
+
function bidiFactory() {
|
|
32161
|
+
var bidi = (function(exports) {
|
|
32162
|
+
var DATA = {
|
|
32163
|
+
"R": "13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",
|
|
32164
|
+
"EN": "1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",
|
|
32165
|
+
"ES": "17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",
|
|
32166
|
+
"ET": "z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",
|
|
32167
|
+
"AN": "16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",
|
|
32168
|
+
"CS": "18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",
|
|
32169
|
+
"B": "a,3,f+2,2v,690",
|
|
32170
|
+
"S": "9,2,k",
|
|
32171
|
+
"WS": "c,k,4f4,1vk+a,u,1j,335",
|
|
32172
|
+
"ON": "x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",
|
|
32173
|
+
"BN": "0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",
|
|
32174
|
+
"NSM": "lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",
|
|
32175
|
+
"AL": "16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",
|
|
32176
|
+
"LRO": "6ct",
|
|
32177
|
+
"RLO": "6cu",
|
|
32178
|
+
"LRE": "6cq",
|
|
32179
|
+
"RLE": "6cr",
|
|
32180
|
+
"PDF": "6cs",
|
|
32181
|
+
"LRI": "6ee",
|
|
32182
|
+
"RLI": "6ef",
|
|
32183
|
+
"FSI": "6eg",
|
|
32184
|
+
"PDI": "6eh"
|
|
32185
|
+
};
|
|
32186
|
+
var TYPES = {};
|
|
32187
|
+
var TYPES_TO_NAMES = {};
|
|
32188
|
+
TYPES.L = 1;
|
|
32189
|
+
TYPES_TO_NAMES[1] = "L";
|
|
32190
|
+
Object.keys(DATA).forEach(function(type, i) {
|
|
32191
|
+
TYPES[type] = 1 << i + 1;
|
|
32192
|
+
TYPES_TO_NAMES[TYPES[type]] = type;
|
|
32193
|
+
});
|
|
32194
|
+
Object.freeze(TYPES);
|
|
32195
|
+
var ISOLATE_INIT_TYPES = TYPES.LRI | TYPES.RLI | TYPES.FSI;
|
|
32196
|
+
var STRONG_TYPES = TYPES.L | TYPES.R | TYPES.AL;
|
|
32197
|
+
var NEUTRAL_ISOLATE_TYPES = TYPES.B | TYPES.S | TYPES.WS | TYPES.ON | TYPES.FSI | TYPES.LRI | TYPES.RLI | TYPES.PDI;
|
|
32198
|
+
var BN_LIKE_TYPES = TYPES.BN | TYPES.RLE | TYPES.LRE | TYPES.RLO | TYPES.LRO | TYPES.PDF;
|
|
32199
|
+
var TRAILING_TYPES = TYPES.S | TYPES.WS | TYPES.B | ISOLATE_INIT_TYPES | TYPES.PDI | BN_LIKE_TYPES;
|
|
32200
|
+
var map2 = null;
|
|
32201
|
+
function parseData() {
|
|
32202
|
+
if (!map2) {
|
|
32203
|
+
map2 = /* @__PURE__ */ new Map();
|
|
32204
|
+
var loop = function(type2) {
|
|
32205
|
+
if (DATA.hasOwnProperty(type2)) {
|
|
32206
|
+
var lastCode = 0;
|
|
32207
|
+
DATA[type2].split(",").forEach(function(range) {
|
|
32208
|
+
var ref = range.split("+");
|
|
32209
|
+
var skip = ref[0];
|
|
32210
|
+
var step = ref[1];
|
|
32211
|
+
skip = parseInt(skip, 36);
|
|
32212
|
+
step = step ? parseInt(step, 36) : 0;
|
|
32213
|
+
map2.set(lastCode += skip, TYPES[type2]);
|
|
32214
|
+
for (var i = 0; i < step; i++) {
|
|
32215
|
+
map2.set(++lastCode, TYPES[type2]);
|
|
32216
|
+
}
|
|
32217
|
+
});
|
|
32218
|
+
}
|
|
32219
|
+
};
|
|
32220
|
+
for (var type in DATA) loop(type);
|
|
32221
|
+
}
|
|
32222
|
+
}
|
|
32223
|
+
function getBidiCharType(char) {
|
|
32224
|
+
parseData();
|
|
32225
|
+
return map2.get(char.codePointAt(0)) || TYPES.L;
|
|
32226
|
+
}
|
|
32227
|
+
function getBidiCharTypeName(char) {
|
|
32228
|
+
return TYPES_TO_NAMES[getBidiCharType(char)];
|
|
32229
|
+
}
|
|
32230
|
+
var data$1 = {
|
|
32231
|
+
"pairs": "14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",
|
|
32232
|
+
"canonical": "6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"
|
|
32233
|
+
};
|
|
32234
|
+
function parseCharacterMap(encodedString, includeReverse) {
|
|
32235
|
+
var radix = 36;
|
|
32236
|
+
var lastCode = 0;
|
|
32237
|
+
var map3 = /* @__PURE__ */ new Map();
|
|
32238
|
+
var reverseMap = includeReverse && /* @__PURE__ */ new Map();
|
|
32239
|
+
var prevPair;
|
|
32240
|
+
encodedString.split(",").forEach(function visit(entry) {
|
|
32241
|
+
if (entry.indexOf("+") !== -1) {
|
|
32242
|
+
for (var i = +entry; i--; ) {
|
|
32243
|
+
visit(prevPair);
|
|
32244
|
+
}
|
|
32245
|
+
} else {
|
|
32246
|
+
prevPair = entry;
|
|
32247
|
+
var ref = entry.split(">");
|
|
32248
|
+
var a = ref[0];
|
|
32249
|
+
var b = ref[1];
|
|
32250
|
+
a = String.fromCodePoint(lastCode += parseInt(a, radix));
|
|
32251
|
+
b = String.fromCodePoint(lastCode += parseInt(b, radix));
|
|
32252
|
+
map3.set(a, b);
|
|
32253
|
+
includeReverse && reverseMap.set(b, a);
|
|
32254
|
+
}
|
|
32255
|
+
});
|
|
32256
|
+
return { map: map3, reverseMap };
|
|
32257
|
+
}
|
|
32258
|
+
var openToClose, closeToOpen, canonical;
|
|
32259
|
+
function parse$1() {
|
|
32260
|
+
if (!openToClose) {
|
|
32261
|
+
var ref = parseCharacterMap(data$1.pairs, true);
|
|
32262
|
+
var map3 = ref.map;
|
|
32263
|
+
var reverseMap = ref.reverseMap;
|
|
32264
|
+
openToClose = map3;
|
|
32265
|
+
closeToOpen = reverseMap;
|
|
32266
|
+
canonical = parseCharacterMap(data$1.canonical, false).map;
|
|
32267
|
+
}
|
|
32268
|
+
}
|
|
32269
|
+
function openingToClosingBracket(char) {
|
|
32270
|
+
parse$1();
|
|
32271
|
+
return openToClose.get(char) || null;
|
|
32272
|
+
}
|
|
32273
|
+
function closingToOpeningBracket(char) {
|
|
32274
|
+
parse$1();
|
|
32275
|
+
return closeToOpen.get(char) || null;
|
|
32276
|
+
}
|
|
32277
|
+
function getCanonicalBracket(char) {
|
|
32278
|
+
parse$1();
|
|
32279
|
+
return canonical.get(char) || null;
|
|
32280
|
+
}
|
|
32281
|
+
var TYPE_L = TYPES.L;
|
|
32282
|
+
var TYPE_R = TYPES.R;
|
|
32283
|
+
var TYPE_EN = TYPES.EN;
|
|
32284
|
+
var TYPE_ES = TYPES.ES;
|
|
32285
|
+
var TYPE_ET = TYPES.ET;
|
|
32286
|
+
var TYPE_AN = TYPES.AN;
|
|
32287
|
+
var TYPE_CS = TYPES.CS;
|
|
32288
|
+
var TYPE_B = TYPES.B;
|
|
32289
|
+
var TYPE_S = TYPES.S;
|
|
32290
|
+
var TYPE_ON = TYPES.ON;
|
|
32291
|
+
var TYPE_BN = TYPES.BN;
|
|
32292
|
+
var TYPE_NSM = TYPES.NSM;
|
|
32293
|
+
var TYPE_AL = TYPES.AL;
|
|
32294
|
+
var TYPE_LRO = TYPES.LRO;
|
|
32295
|
+
var TYPE_RLO = TYPES.RLO;
|
|
32296
|
+
var TYPE_LRE = TYPES.LRE;
|
|
32297
|
+
var TYPE_RLE = TYPES.RLE;
|
|
32298
|
+
var TYPE_PDF = TYPES.PDF;
|
|
32299
|
+
var TYPE_LRI = TYPES.LRI;
|
|
32300
|
+
var TYPE_RLI = TYPES.RLI;
|
|
32301
|
+
var TYPE_FSI = TYPES.FSI;
|
|
32302
|
+
var TYPE_PDI = TYPES.PDI;
|
|
32303
|
+
function getEmbeddingLevels(string4, baseDirection) {
|
|
32304
|
+
var MAX_DEPTH = 125;
|
|
32305
|
+
var charTypes = new Uint32Array(string4.length);
|
|
32306
|
+
for (var i = 0; i < string4.length; i++) {
|
|
32307
|
+
charTypes[i] = getBidiCharType(string4[i]);
|
|
32308
|
+
}
|
|
32309
|
+
var charTypeCounts = /* @__PURE__ */ new Map();
|
|
32310
|
+
function changeCharType(i2, type2) {
|
|
32311
|
+
var oldType = charTypes[i2];
|
|
32312
|
+
charTypes[i2] = type2;
|
|
32313
|
+
charTypeCounts.set(oldType, charTypeCounts.get(oldType) - 1);
|
|
32314
|
+
if (oldType & NEUTRAL_ISOLATE_TYPES) {
|
|
32315
|
+
charTypeCounts.set(NEUTRAL_ISOLATE_TYPES, charTypeCounts.get(NEUTRAL_ISOLATE_TYPES) - 1);
|
|
32316
|
+
}
|
|
32317
|
+
charTypeCounts.set(type2, (charTypeCounts.get(type2) || 0) + 1);
|
|
32318
|
+
if (type2 & NEUTRAL_ISOLATE_TYPES) {
|
|
32319
|
+
charTypeCounts.set(NEUTRAL_ISOLATE_TYPES, (charTypeCounts.get(NEUTRAL_ISOLATE_TYPES) || 0) + 1);
|
|
32320
|
+
}
|
|
32321
|
+
}
|
|
32322
|
+
var embedLevels = new Uint8Array(string4.length);
|
|
32323
|
+
var isolationPairs = /* @__PURE__ */ new Map();
|
|
32324
|
+
var paragraphs = [];
|
|
32325
|
+
var paragraph = null;
|
|
32326
|
+
for (var i$1 = 0; i$1 < string4.length; i$1++) {
|
|
32327
|
+
if (!paragraph) {
|
|
32328
|
+
paragraphs.push(paragraph = {
|
|
32329
|
+
start: i$1,
|
|
32330
|
+
end: string4.length - 1,
|
|
32331
|
+
// 3.3.1 P2-P3: Determine the paragraph level
|
|
32332
|
+
level: baseDirection === "rtl" ? 1 : baseDirection === "ltr" ? 0 : determineAutoEmbedLevel(i$1, false)
|
|
32333
|
+
});
|
|
32334
|
+
}
|
|
32335
|
+
if (charTypes[i$1] & TYPE_B) {
|
|
32336
|
+
paragraph.end = i$1;
|
|
32337
|
+
paragraph = null;
|
|
32338
|
+
}
|
|
32339
|
+
}
|
|
32340
|
+
var FORMATTING_TYPES = TYPE_RLE | TYPE_LRE | TYPE_RLO | TYPE_LRO | ISOLATE_INIT_TYPES | TYPE_PDI | TYPE_PDF | TYPE_B;
|
|
32341
|
+
var nextEven = function(n) {
|
|
32342
|
+
return n + (n & 1 ? 1 : 2);
|
|
32343
|
+
};
|
|
32344
|
+
var nextOdd = function(n) {
|
|
32345
|
+
return n + (n & 1 ? 2 : 1);
|
|
32346
|
+
};
|
|
32347
|
+
for (var paraIdx = 0; paraIdx < paragraphs.length; paraIdx++) {
|
|
32348
|
+
paragraph = paragraphs[paraIdx];
|
|
32349
|
+
var statusStack = [{
|
|
32350
|
+
_level: paragraph.level,
|
|
32351
|
+
_override: 0,
|
|
32352
|
+
//0=neutral, 1=L, 2=R
|
|
32353
|
+
_isolate: 0
|
|
32354
|
+
//bool
|
|
32355
|
+
}];
|
|
32356
|
+
var stackTop = void 0;
|
|
32357
|
+
var overflowIsolateCount = 0;
|
|
32358
|
+
var overflowEmbeddingCount = 0;
|
|
32359
|
+
var validIsolateCount = 0;
|
|
32360
|
+
charTypeCounts.clear();
|
|
32361
|
+
for (var i$2 = paragraph.start; i$2 <= paragraph.end; i$2++) {
|
|
32362
|
+
var charType = charTypes[i$2];
|
|
32363
|
+
stackTop = statusStack[statusStack.length - 1];
|
|
32364
|
+
charTypeCounts.set(charType, (charTypeCounts.get(charType) || 0) + 1);
|
|
32365
|
+
if (charType & NEUTRAL_ISOLATE_TYPES) {
|
|
32366
|
+
charTypeCounts.set(NEUTRAL_ISOLATE_TYPES, (charTypeCounts.get(NEUTRAL_ISOLATE_TYPES) || 0) + 1);
|
|
32367
|
+
}
|
|
32368
|
+
if (charType & FORMATTING_TYPES) {
|
|
32369
|
+
if (charType & (TYPE_RLE | TYPE_LRE)) {
|
|
32370
|
+
embedLevels[i$2] = stackTop._level;
|
|
32371
|
+
var level = (charType === TYPE_RLE ? nextOdd : nextEven)(stackTop._level);
|
|
32372
|
+
if (level <= MAX_DEPTH && !overflowIsolateCount && !overflowEmbeddingCount) {
|
|
32373
|
+
statusStack.push({
|
|
32374
|
+
_level: level,
|
|
32375
|
+
_override: 0,
|
|
32376
|
+
_isolate: 0
|
|
32377
|
+
});
|
|
32378
|
+
} else if (!overflowIsolateCount) {
|
|
32379
|
+
overflowEmbeddingCount++;
|
|
32380
|
+
}
|
|
32381
|
+
} else if (charType & (TYPE_RLO | TYPE_LRO)) {
|
|
32382
|
+
embedLevels[i$2] = stackTop._level;
|
|
32383
|
+
var level$1 = (charType === TYPE_RLO ? nextOdd : nextEven)(stackTop._level);
|
|
32384
|
+
if (level$1 <= MAX_DEPTH && !overflowIsolateCount && !overflowEmbeddingCount) {
|
|
32385
|
+
statusStack.push({
|
|
32386
|
+
_level: level$1,
|
|
32387
|
+
_override: charType & TYPE_RLO ? TYPE_R : TYPE_L,
|
|
32388
|
+
_isolate: 0
|
|
32389
|
+
});
|
|
32390
|
+
} else if (!overflowIsolateCount) {
|
|
32391
|
+
overflowEmbeddingCount++;
|
|
32392
|
+
}
|
|
32393
|
+
} else if (charType & ISOLATE_INIT_TYPES) {
|
|
32394
|
+
if (charType & TYPE_FSI) {
|
|
32395
|
+
charType = determineAutoEmbedLevel(i$2 + 1, true) === 1 ? TYPE_RLI : TYPE_LRI;
|
|
32396
|
+
}
|
|
32397
|
+
embedLevels[i$2] = stackTop._level;
|
|
32398
|
+
if (stackTop._override) {
|
|
32399
|
+
changeCharType(i$2, stackTop._override);
|
|
32400
|
+
}
|
|
32401
|
+
var level$2 = (charType === TYPE_RLI ? nextOdd : nextEven)(stackTop._level);
|
|
32402
|
+
if (level$2 <= MAX_DEPTH && overflowIsolateCount === 0 && overflowEmbeddingCount === 0) {
|
|
32403
|
+
validIsolateCount++;
|
|
32404
|
+
statusStack.push({
|
|
32405
|
+
_level: level$2,
|
|
32406
|
+
_override: 0,
|
|
32407
|
+
_isolate: 1,
|
|
32408
|
+
_isolInitIndex: i$2
|
|
32409
|
+
});
|
|
32410
|
+
} else {
|
|
32411
|
+
overflowIsolateCount++;
|
|
32412
|
+
}
|
|
32413
|
+
} else if (charType & TYPE_PDI) {
|
|
32414
|
+
if (overflowIsolateCount > 0) {
|
|
32415
|
+
overflowIsolateCount--;
|
|
32416
|
+
} else if (validIsolateCount > 0) {
|
|
32417
|
+
overflowEmbeddingCount = 0;
|
|
32418
|
+
while (!statusStack[statusStack.length - 1]._isolate) {
|
|
32419
|
+
statusStack.pop();
|
|
32420
|
+
}
|
|
32421
|
+
var isolInitIndex = statusStack[statusStack.length - 1]._isolInitIndex;
|
|
32422
|
+
if (isolInitIndex != null) {
|
|
32423
|
+
isolationPairs.set(isolInitIndex, i$2);
|
|
32424
|
+
isolationPairs.set(i$2, isolInitIndex);
|
|
32425
|
+
}
|
|
32426
|
+
statusStack.pop();
|
|
32427
|
+
validIsolateCount--;
|
|
32428
|
+
}
|
|
32429
|
+
stackTop = statusStack[statusStack.length - 1];
|
|
32430
|
+
embedLevels[i$2] = stackTop._level;
|
|
32431
|
+
if (stackTop._override) {
|
|
32432
|
+
changeCharType(i$2, stackTop._override);
|
|
32433
|
+
}
|
|
32434
|
+
} else if (charType & TYPE_PDF) {
|
|
32435
|
+
if (overflowIsolateCount === 0) {
|
|
32436
|
+
if (overflowEmbeddingCount > 0) {
|
|
32437
|
+
overflowEmbeddingCount--;
|
|
32438
|
+
} else if (!stackTop._isolate && statusStack.length > 1) {
|
|
32439
|
+
statusStack.pop();
|
|
32440
|
+
stackTop = statusStack[statusStack.length - 1];
|
|
32441
|
+
}
|
|
32442
|
+
}
|
|
32443
|
+
embedLevels[i$2] = stackTop._level;
|
|
32444
|
+
} else if (charType & TYPE_B) {
|
|
32445
|
+
embedLevels[i$2] = paragraph.level;
|
|
32446
|
+
}
|
|
32447
|
+
} else {
|
|
32448
|
+
embedLevels[i$2] = stackTop._level;
|
|
32449
|
+
if (stackTop._override && charType !== TYPE_BN) {
|
|
32450
|
+
changeCharType(i$2, stackTop._override);
|
|
32451
|
+
}
|
|
32452
|
+
}
|
|
32453
|
+
}
|
|
32454
|
+
var levelRuns = [];
|
|
32455
|
+
var currentRun = null;
|
|
32456
|
+
for (var i$3 = paragraph.start; i$3 <= paragraph.end; i$3++) {
|
|
32457
|
+
var charType$1 = charTypes[i$3];
|
|
32458
|
+
if (!(charType$1 & BN_LIKE_TYPES)) {
|
|
32459
|
+
var lvl = embedLevels[i$3];
|
|
32460
|
+
var isIsolInit = charType$1 & ISOLATE_INIT_TYPES;
|
|
32461
|
+
var isPDI = charType$1 === TYPE_PDI;
|
|
32462
|
+
if (currentRun && lvl === currentRun._level) {
|
|
32463
|
+
currentRun._end = i$3;
|
|
32464
|
+
currentRun._endsWithIsolInit = isIsolInit;
|
|
32465
|
+
} else {
|
|
32466
|
+
levelRuns.push(currentRun = {
|
|
32467
|
+
_start: i$3,
|
|
32468
|
+
_end: i$3,
|
|
32469
|
+
_level: lvl,
|
|
32470
|
+
_startsWithPDI: isPDI,
|
|
32471
|
+
_endsWithIsolInit: isIsolInit
|
|
32472
|
+
});
|
|
32473
|
+
}
|
|
32474
|
+
}
|
|
32475
|
+
}
|
|
32476
|
+
var isolatingRunSeqs = [];
|
|
32477
|
+
for (var runIdx = 0; runIdx < levelRuns.length; runIdx++) {
|
|
32478
|
+
var run = levelRuns[runIdx];
|
|
32479
|
+
if (!run._startsWithPDI || run._startsWithPDI && !isolationPairs.has(run._start)) {
|
|
32480
|
+
var seqRuns = [currentRun = run];
|
|
32481
|
+
for (var pdiIndex = void 0; currentRun && currentRun._endsWithIsolInit && (pdiIndex = isolationPairs.get(currentRun._end)) != null; ) {
|
|
32482
|
+
for (var i$4 = runIdx + 1; i$4 < levelRuns.length; i$4++) {
|
|
32483
|
+
if (levelRuns[i$4]._start === pdiIndex) {
|
|
32484
|
+
seqRuns.push(currentRun = levelRuns[i$4]);
|
|
32485
|
+
break;
|
|
32486
|
+
}
|
|
32487
|
+
}
|
|
32488
|
+
}
|
|
32489
|
+
var seqIndices = [];
|
|
32490
|
+
for (var i$5 = 0; i$5 < seqRuns.length; i$5++) {
|
|
32491
|
+
var run$1 = seqRuns[i$5];
|
|
32492
|
+
for (var j = run$1._start; j <= run$1._end; j++) {
|
|
32493
|
+
seqIndices.push(j);
|
|
32494
|
+
}
|
|
32495
|
+
}
|
|
32496
|
+
var firstLevel = embedLevels[seqIndices[0]];
|
|
32497
|
+
var prevLevel = paragraph.level;
|
|
32498
|
+
for (var i$6 = seqIndices[0] - 1; i$6 >= 0; i$6--) {
|
|
32499
|
+
if (!(charTypes[i$6] & BN_LIKE_TYPES)) {
|
|
32500
|
+
prevLevel = embedLevels[i$6];
|
|
32501
|
+
break;
|
|
32502
|
+
}
|
|
32503
|
+
}
|
|
32504
|
+
var lastIndex = seqIndices[seqIndices.length - 1];
|
|
32505
|
+
var lastLevel = embedLevels[lastIndex];
|
|
32506
|
+
var nextLevel = paragraph.level;
|
|
32507
|
+
if (!(charTypes[lastIndex] & ISOLATE_INIT_TYPES)) {
|
|
32508
|
+
for (var i$7 = lastIndex + 1; i$7 <= paragraph.end; i$7++) {
|
|
32509
|
+
if (!(charTypes[i$7] & BN_LIKE_TYPES)) {
|
|
32510
|
+
nextLevel = embedLevels[i$7];
|
|
32511
|
+
break;
|
|
32512
|
+
}
|
|
32513
|
+
}
|
|
32514
|
+
}
|
|
32515
|
+
isolatingRunSeqs.push({
|
|
32516
|
+
_seqIndices: seqIndices,
|
|
32517
|
+
_sosType: Math.max(prevLevel, firstLevel) % 2 ? TYPE_R : TYPE_L,
|
|
32518
|
+
_eosType: Math.max(nextLevel, lastLevel) % 2 ? TYPE_R : TYPE_L
|
|
32519
|
+
});
|
|
32520
|
+
}
|
|
32521
|
+
}
|
|
32522
|
+
for (var seqIdx = 0; seqIdx < isolatingRunSeqs.length; seqIdx++) {
|
|
32523
|
+
var ref = isolatingRunSeqs[seqIdx];
|
|
32524
|
+
var seqIndices$1 = ref._seqIndices;
|
|
32525
|
+
var sosType = ref._sosType;
|
|
32526
|
+
var eosType = ref._eosType;
|
|
32527
|
+
var embedDirection = embedLevels[seqIndices$1[0]] & 1 ? TYPE_R : TYPE_L;
|
|
32528
|
+
if (charTypeCounts.get(TYPE_NSM)) {
|
|
32529
|
+
for (var si = 0; si < seqIndices$1.length; si++) {
|
|
32530
|
+
var i$8 = seqIndices$1[si];
|
|
32531
|
+
if (charTypes[i$8] & TYPE_NSM) {
|
|
32532
|
+
var prevType = sosType;
|
|
32533
|
+
for (var sj = si - 1; sj >= 0; sj--) {
|
|
32534
|
+
if (!(charTypes[seqIndices$1[sj]] & BN_LIKE_TYPES)) {
|
|
32535
|
+
prevType = charTypes[seqIndices$1[sj]];
|
|
32536
|
+
break;
|
|
32537
|
+
}
|
|
32538
|
+
}
|
|
32539
|
+
changeCharType(i$8, prevType & (ISOLATE_INIT_TYPES | TYPE_PDI) ? TYPE_ON : prevType);
|
|
32540
|
+
}
|
|
32541
|
+
}
|
|
32542
|
+
}
|
|
32543
|
+
if (charTypeCounts.get(TYPE_EN)) {
|
|
32544
|
+
for (var si$1 = 0; si$1 < seqIndices$1.length; si$1++) {
|
|
32545
|
+
var i$9 = seqIndices$1[si$1];
|
|
32546
|
+
if (charTypes[i$9] & TYPE_EN) {
|
|
32547
|
+
for (var sj$1 = si$1 - 1; sj$1 >= -1; sj$1--) {
|
|
32548
|
+
var prevCharType = sj$1 === -1 ? sosType : charTypes[seqIndices$1[sj$1]];
|
|
32549
|
+
if (prevCharType & STRONG_TYPES) {
|
|
32550
|
+
if (prevCharType === TYPE_AL) {
|
|
32551
|
+
changeCharType(i$9, TYPE_AN);
|
|
32552
|
+
}
|
|
32553
|
+
break;
|
|
32554
|
+
}
|
|
32555
|
+
}
|
|
32556
|
+
}
|
|
32557
|
+
}
|
|
32558
|
+
}
|
|
32559
|
+
if (charTypeCounts.get(TYPE_AL)) {
|
|
32560
|
+
for (var si$2 = 0; si$2 < seqIndices$1.length; si$2++) {
|
|
32561
|
+
var i$10 = seqIndices$1[si$2];
|
|
32562
|
+
if (charTypes[i$10] & TYPE_AL) {
|
|
32563
|
+
changeCharType(i$10, TYPE_R);
|
|
32564
|
+
}
|
|
32565
|
+
}
|
|
32566
|
+
}
|
|
32567
|
+
if (charTypeCounts.get(TYPE_ES) || charTypeCounts.get(TYPE_CS)) {
|
|
32568
|
+
for (var si$3 = 1; si$3 < seqIndices$1.length - 1; si$3++) {
|
|
32569
|
+
var i$11 = seqIndices$1[si$3];
|
|
32570
|
+
if (charTypes[i$11] & (TYPE_ES | TYPE_CS)) {
|
|
32571
|
+
var prevType$1 = 0, nextType = 0;
|
|
32572
|
+
for (var sj$2 = si$3 - 1; sj$2 >= 0; sj$2--) {
|
|
32573
|
+
prevType$1 = charTypes[seqIndices$1[sj$2]];
|
|
32574
|
+
if (!(prevType$1 & BN_LIKE_TYPES)) {
|
|
32575
|
+
break;
|
|
32576
|
+
}
|
|
32577
|
+
}
|
|
32578
|
+
for (var sj$3 = si$3 + 1; sj$3 < seqIndices$1.length; sj$3++) {
|
|
32579
|
+
nextType = charTypes[seqIndices$1[sj$3]];
|
|
32580
|
+
if (!(nextType & BN_LIKE_TYPES)) {
|
|
32581
|
+
break;
|
|
32582
|
+
}
|
|
32583
|
+
}
|
|
32584
|
+
if (prevType$1 === nextType && (charTypes[i$11] === TYPE_ES ? prevType$1 === TYPE_EN : prevType$1 & (TYPE_EN | TYPE_AN))) {
|
|
32585
|
+
changeCharType(i$11, prevType$1);
|
|
32586
|
+
}
|
|
32587
|
+
}
|
|
32588
|
+
}
|
|
32589
|
+
}
|
|
32590
|
+
if (charTypeCounts.get(TYPE_EN)) {
|
|
32591
|
+
for (var si$4 = 0; si$4 < seqIndices$1.length; si$4++) {
|
|
32592
|
+
var i$12 = seqIndices$1[si$4];
|
|
32593
|
+
if (charTypes[i$12] & TYPE_EN) {
|
|
32594
|
+
for (var sj$4 = si$4 - 1; sj$4 >= 0 && charTypes[seqIndices$1[sj$4]] & (TYPE_ET | BN_LIKE_TYPES); sj$4--) {
|
|
32595
|
+
changeCharType(seqIndices$1[sj$4], TYPE_EN);
|
|
32596
|
+
}
|
|
32597
|
+
for (si$4++; si$4 < seqIndices$1.length && charTypes[seqIndices$1[si$4]] & (TYPE_ET | BN_LIKE_TYPES | TYPE_EN); si$4++) {
|
|
32598
|
+
if (charTypes[seqIndices$1[si$4]] !== TYPE_EN) {
|
|
32599
|
+
changeCharType(seqIndices$1[si$4], TYPE_EN);
|
|
32600
|
+
}
|
|
32601
|
+
}
|
|
32602
|
+
}
|
|
32603
|
+
}
|
|
32604
|
+
}
|
|
32605
|
+
if (charTypeCounts.get(TYPE_ET) || charTypeCounts.get(TYPE_ES) || charTypeCounts.get(TYPE_CS)) {
|
|
32606
|
+
for (var si$5 = 0; si$5 < seqIndices$1.length; si$5++) {
|
|
32607
|
+
var i$13 = seqIndices$1[si$5];
|
|
32608
|
+
if (charTypes[i$13] & (TYPE_ET | TYPE_ES | TYPE_CS)) {
|
|
32609
|
+
changeCharType(i$13, TYPE_ON);
|
|
32610
|
+
for (var sj$5 = si$5 - 1; sj$5 >= 0 && charTypes[seqIndices$1[sj$5]] & BN_LIKE_TYPES; sj$5--) {
|
|
32611
|
+
changeCharType(seqIndices$1[sj$5], TYPE_ON);
|
|
32612
|
+
}
|
|
32613
|
+
for (var sj$6 = si$5 + 1; sj$6 < seqIndices$1.length && charTypes[seqIndices$1[sj$6]] & BN_LIKE_TYPES; sj$6++) {
|
|
32614
|
+
changeCharType(seqIndices$1[sj$6], TYPE_ON);
|
|
32615
|
+
}
|
|
32616
|
+
}
|
|
32617
|
+
}
|
|
32618
|
+
}
|
|
32619
|
+
if (charTypeCounts.get(TYPE_EN)) {
|
|
32620
|
+
for (var si$6 = 0, prevStrongType = sosType; si$6 < seqIndices$1.length; si$6++) {
|
|
32621
|
+
var i$14 = seqIndices$1[si$6];
|
|
32622
|
+
var type = charTypes[i$14];
|
|
32623
|
+
if (type & TYPE_EN) {
|
|
32624
|
+
if (prevStrongType === TYPE_L) {
|
|
32625
|
+
changeCharType(i$14, TYPE_L);
|
|
32626
|
+
}
|
|
32627
|
+
} else if (type & STRONG_TYPES) {
|
|
32628
|
+
prevStrongType = type;
|
|
32629
|
+
}
|
|
32630
|
+
}
|
|
32631
|
+
}
|
|
32632
|
+
if (charTypeCounts.get(NEUTRAL_ISOLATE_TYPES)) {
|
|
32633
|
+
var R_TYPES_FOR_N_STEPS = TYPE_R | TYPE_EN | TYPE_AN;
|
|
32634
|
+
var STRONG_TYPES_FOR_N_STEPS = R_TYPES_FOR_N_STEPS | TYPE_L;
|
|
32635
|
+
var bracketPairs = [];
|
|
32636
|
+
{
|
|
32637
|
+
var openerStack = [];
|
|
32638
|
+
for (var si$7 = 0; si$7 < seqIndices$1.length; si$7++) {
|
|
32639
|
+
if (charTypes[seqIndices$1[si$7]] & NEUTRAL_ISOLATE_TYPES) {
|
|
32640
|
+
var char = string4[seqIndices$1[si$7]];
|
|
32641
|
+
var oppositeBracket = void 0;
|
|
32642
|
+
if (openingToClosingBracket(char) !== null) {
|
|
32643
|
+
if (openerStack.length < 63) {
|
|
32644
|
+
openerStack.push({ char, seqIndex: si$7 });
|
|
32645
|
+
} else {
|
|
32646
|
+
break;
|
|
32647
|
+
}
|
|
32648
|
+
} else if ((oppositeBracket = closingToOpeningBracket(char)) !== null) {
|
|
32649
|
+
for (var stackIdx = openerStack.length - 1; stackIdx >= 0; stackIdx--) {
|
|
32650
|
+
var stackChar = openerStack[stackIdx].char;
|
|
32651
|
+
if (stackChar === oppositeBracket || stackChar === closingToOpeningBracket(getCanonicalBracket(char)) || openingToClosingBracket(getCanonicalBracket(stackChar)) === char) {
|
|
32652
|
+
bracketPairs.push([openerStack[stackIdx].seqIndex, si$7]);
|
|
32653
|
+
openerStack.length = stackIdx;
|
|
32654
|
+
break;
|
|
32655
|
+
}
|
|
32656
|
+
}
|
|
32657
|
+
}
|
|
32658
|
+
}
|
|
32659
|
+
}
|
|
32660
|
+
bracketPairs.sort(function(a, b) {
|
|
32661
|
+
return a[0] - b[0];
|
|
32662
|
+
});
|
|
32663
|
+
}
|
|
32664
|
+
for (var pairIdx = 0; pairIdx < bracketPairs.length; pairIdx++) {
|
|
32665
|
+
var ref$1 = bracketPairs[pairIdx];
|
|
32666
|
+
var openSeqIdx = ref$1[0];
|
|
32667
|
+
var closeSeqIdx = ref$1[1];
|
|
32668
|
+
var foundStrongType = false;
|
|
32669
|
+
var useStrongType = 0;
|
|
32670
|
+
for (var si$8 = openSeqIdx + 1; si$8 < closeSeqIdx; si$8++) {
|
|
32671
|
+
var i$15 = seqIndices$1[si$8];
|
|
32672
|
+
if (charTypes[i$15] & STRONG_TYPES_FOR_N_STEPS) {
|
|
32673
|
+
foundStrongType = true;
|
|
32674
|
+
var lr = charTypes[i$15] & R_TYPES_FOR_N_STEPS ? TYPE_R : TYPE_L;
|
|
32675
|
+
if (lr === embedDirection) {
|
|
32676
|
+
useStrongType = lr;
|
|
32677
|
+
break;
|
|
32678
|
+
}
|
|
32679
|
+
}
|
|
32680
|
+
}
|
|
32681
|
+
if (foundStrongType && !useStrongType) {
|
|
32682
|
+
useStrongType = sosType;
|
|
32683
|
+
for (var si$9 = openSeqIdx - 1; si$9 >= 0; si$9--) {
|
|
32684
|
+
var i$16 = seqIndices$1[si$9];
|
|
32685
|
+
if (charTypes[i$16] & STRONG_TYPES_FOR_N_STEPS) {
|
|
32686
|
+
var lr$1 = charTypes[i$16] & R_TYPES_FOR_N_STEPS ? TYPE_R : TYPE_L;
|
|
32687
|
+
if (lr$1 !== embedDirection) {
|
|
32688
|
+
useStrongType = lr$1;
|
|
32689
|
+
} else {
|
|
32690
|
+
useStrongType = embedDirection;
|
|
32691
|
+
}
|
|
32692
|
+
break;
|
|
32693
|
+
}
|
|
32694
|
+
}
|
|
32695
|
+
}
|
|
32696
|
+
if (useStrongType) {
|
|
32697
|
+
charTypes[seqIndices$1[openSeqIdx]] = charTypes[seqIndices$1[closeSeqIdx]] = useStrongType;
|
|
32698
|
+
if (useStrongType !== embedDirection) {
|
|
32699
|
+
for (var si$10 = openSeqIdx + 1; si$10 < seqIndices$1.length; si$10++) {
|
|
32700
|
+
if (!(charTypes[seqIndices$1[si$10]] & BN_LIKE_TYPES)) {
|
|
32701
|
+
if (getBidiCharType(string4[seqIndices$1[si$10]]) & TYPE_NSM) {
|
|
32702
|
+
charTypes[seqIndices$1[si$10]] = useStrongType;
|
|
32703
|
+
}
|
|
32704
|
+
break;
|
|
32705
|
+
}
|
|
32706
|
+
}
|
|
32707
|
+
}
|
|
32708
|
+
if (useStrongType !== embedDirection) {
|
|
32709
|
+
for (var si$11 = closeSeqIdx + 1; si$11 < seqIndices$1.length; si$11++) {
|
|
32710
|
+
if (!(charTypes[seqIndices$1[si$11]] & BN_LIKE_TYPES)) {
|
|
32711
|
+
if (getBidiCharType(string4[seqIndices$1[si$11]]) & TYPE_NSM) {
|
|
32712
|
+
charTypes[seqIndices$1[si$11]] = useStrongType;
|
|
32713
|
+
}
|
|
32714
|
+
break;
|
|
32715
|
+
}
|
|
32716
|
+
}
|
|
32717
|
+
}
|
|
32718
|
+
}
|
|
32719
|
+
}
|
|
32720
|
+
for (var si$12 = 0; si$12 < seqIndices$1.length; si$12++) {
|
|
32721
|
+
if (charTypes[seqIndices$1[si$12]] & NEUTRAL_ISOLATE_TYPES) {
|
|
32722
|
+
var niRunStart = si$12, niRunEnd = si$12;
|
|
32723
|
+
var prevType$2 = sosType;
|
|
32724
|
+
for (var si2 = si$12 - 1; si2 >= 0; si2--) {
|
|
32725
|
+
if (charTypes[seqIndices$1[si2]] & BN_LIKE_TYPES) {
|
|
32726
|
+
niRunStart = si2;
|
|
32727
|
+
} else {
|
|
32728
|
+
prevType$2 = charTypes[seqIndices$1[si2]] & R_TYPES_FOR_N_STEPS ? TYPE_R : TYPE_L;
|
|
32729
|
+
break;
|
|
32730
|
+
}
|
|
32731
|
+
}
|
|
32732
|
+
var nextType$1 = eosType;
|
|
32733
|
+
for (var si2$1 = si$12 + 1; si2$1 < seqIndices$1.length; si2$1++) {
|
|
32734
|
+
if (charTypes[seqIndices$1[si2$1]] & (NEUTRAL_ISOLATE_TYPES | BN_LIKE_TYPES)) {
|
|
32735
|
+
niRunEnd = si2$1;
|
|
32736
|
+
} else {
|
|
32737
|
+
nextType$1 = charTypes[seqIndices$1[si2$1]] & R_TYPES_FOR_N_STEPS ? TYPE_R : TYPE_L;
|
|
32738
|
+
break;
|
|
32739
|
+
}
|
|
32740
|
+
}
|
|
32741
|
+
for (var sj$7 = niRunStart; sj$7 <= niRunEnd; sj$7++) {
|
|
32742
|
+
charTypes[seqIndices$1[sj$7]] = prevType$2 === nextType$1 ? prevType$2 : embedDirection;
|
|
32743
|
+
}
|
|
32744
|
+
si$12 = niRunEnd;
|
|
32745
|
+
}
|
|
32746
|
+
}
|
|
32747
|
+
}
|
|
32748
|
+
}
|
|
32749
|
+
for (var i$17 = paragraph.start; i$17 <= paragraph.end; i$17++) {
|
|
32750
|
+
var level$3 = embedLevels[i$17];
|
|
32751
|
+
var type$1 = charTypes[i$17];
|
|
32752
|
+
if (level$3 & 1) {
|
|
32753
|
+
if (type$1 & (TYPE_L | TYPE_EN | TYPE_AN)) {
|
|
32754
|
+
embedLevels[i$17]++;
|
|
32755
|
+
}
|
|
32756
|
+
} else {
|
|
32757
|
+
if (type$1 & TYPE_R) {
|
|
32758
|
+
embedLevels[i$17]++;
|
|
32759
|
+
} else if (type$1 & (TYPE_AN | TYPE_EN)) {
|
|
32760
|
+
embedLevels[i$17] += 2;
|
|
32761
|
+
}
|
|
32762
|
+
}
|
|
32763
|
+
if (type$1 & BN_LIKE_TYPES) {
|
|
32764
|
+
embedLevels[i$17] = i$17 === 0 ? paragraph.level : embedLevels[i$17 - 1];
|
|
32765
|
+
}
|
|
32766
|
+
if (i$17 === paragraph.end || getBidiCharType(string4[i$17]) & (TYPE_S | TYPE_B)) {
|
|
32767
|
+
for (var j$1 = i$17; j$1 >= 0 && getBidiCharType(string4[j$1]) & TRAILING_TYPES; j$1--) {
|
|
32768
|
+
embedLevels[j$1] = paragraph.level;
|
|
32769
|
+
}
|
|
32770
|
+
}
|
|
32771
|
+
}
|
|
32772
|
+
}
|
|
32773
|
+
return {
|
|
32774
|
+
levels: embedLevels,
|
|
32775
|
+
paragraphs
|
|
32776
|
+
};
|
|
32777
|
+
function determineAutoEmbedLevel(start, isFSI) {
|
|
32778
|
+
for (var i2 = start; i2 < string4.length; i2++) {
|
|
32779
|
+
var charType2 = charTypes[i2];
|
|
32780
|
+
if (charType2 & (TYPE_R | TYPE_AL)) {
|
|
32781
|
+
return 1;
|
|
32782
|
+
}
|
|
32783
|
+
if (charType2 & (TYPE_B | TYPE_L) || isFSI && charType2 === TYPE_PDI) {
|
|
32784
|
+
return 0;
|
|
32785
|
+
}
|
|
32786
|
+
if (charType2 & ISOLATE_INIT_TYPES) {
|
|
32787
|
+
var pdi = indexOfMatchingPDI(i2);
|
|
32788
|
+
i2 = pdi === -1 ? string4.length : pdi;
|
|
32789
|
+
}
|
|
32790
|
+
}
|
|
32791
|
+
return 0;
|
|
32792
|
+
}
|
|
32793
|
+
function indexOfMatchingPDI(isolateStart) {
|
|
32794
|
+
var isolationLevel = 1;
|
|
32795
|
+
for (var i2 = isolateStart + 1; i2 < string4.length; i2++) {
|
|
32796
|
+
var charType2 = charTypes[i2];
|
|
32797
|
+
if (charType2 & TYPE_B) {
|
|
32798
|
+
break;
|
|
32799
|
+
}
|
|
32800
|
+
if (charType2 & TYPE_PDI) {
|
|
32801
|
+
if (--isolationLevel === 0) {
|
|
32802
|
+
return i2;
|
|
32803
|
+
}
|
|
32804
|
+
} else if (charType2 & ISOLATE_INIT_TYPES) {
|
|
32805
|
+
isolationLevel++;
|
|
32806
|
+
}
|
|
32807
|
+
}
|
|
32808
|
+
return -1;
|
|
32809
|
+
}
|
|
32810
|
+
}
|
|
32811
|
+
var data = "14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1";
|
|
32812
|
+
var mirrorMap;
|
|
32813
|
+
function parse3() {
|
|
32814
|
+
if (!mirrorMap) {
|
|
32815
|
+
var ref = parseCharacterMap(data, true);
|
|
32816
|
+
var map3 = ref.map;
|
|
32817
|
+
var reverseMap = ref.reverseMap;
|
|
32818
|
+
reverseMap.forEach(function(value, key) {
|
|
32819
|
+
map3.set(key, value);
|
|
32820
|
+
});
|
|
32821
|
+
mirrorMap = map3;
|
|
32822
|
+
}
|
|
32823
|
+
}
|
|
32824
|
+
function getMirroredCharacter(char) {
|
|
32825
|
+
parse3();
|
|
32826
|
+
return mirrorMap.get(char) || null;
|
|
32827
|
+
}
|
|
32828
|
+
function getMirroredCharactersMap(string4, embeddingLevels, start, end) {
|
|
32829
|
+
var strLen = string4.length;
|
|
32830
|
+
start = Math.max(0, start == null ? 0 : +start);
|
|
32831
|
+
end = Math.min(strLen - 1, end == null ? strLen - 1 : +end);
|
|
32832
|
+
var map3 = /* @__PURE__ */ new Map();
|
|
32833
|
+
for (var i = start; i <= end; i++) {
|
|
32834
|
+
if (embeddingLevels[i] & 1) {
|
|
32835
|
+
var mirror = getMirroredCharacter(string4[i]);
|
|
32836
|
+
if (mirror !== null) {
|
|
32837
|
+
map3.set(i, mirror);
|
|
32838
|
+
}
|
|
32839
|
+
}
|
|
32840
|
+
}
|
|
32841
|
+
return map3;
|
|
32842
|
+
}
|
|
32843
|
+
function getReorderSegments(string4, embeddingLevelsResult, start, end) {
|
|
32844
|
+
var strLen = string4.length;
|
|
32845
|
+
start = Math.max(0, start == null ? 0 : +start);
|
|
32846
|
+
end = Math.min(strLen - 1, end == null ? strLen - 1 : +end);
|
|
32847
|
+
var segments = [];
|
|
32848
|
+
embeddingLevelsResult.paragraphs.forEach(function(paragraph) {
|
|
32849
|
+
var lineStart = Math.max(start, paragraph.start);
|
|
32850
|
+
var lineEnd = Math.min(end, paragraph.end);
|
|
32851
|
+
if (lineStart < lineEnd) {
|
|
32852
|
+
var lineLevels = embeddingLevelsResult.levels.slice(lineStart, lineEnd + 1);
|
|
32853
|
+
for (var i = lineEnd; i >= lineStart && getBidiCharType(string4[i]) & TRAILING_TYPES; i--) {
|
|
32854
|
+
lineLevels[i] = paragraph.level;
|
|
32855
|
+
}
|
|
32856
|
+
var maxLevel = paragraph.level;
|
|
32857
|
+
var minOddLevel = Infinity;
|
|
32858
|
+
for (var i$1 = 0; i$1 < lineLevels.length; i$1++) {
|
|
32859
|
+
var level = lineLevels[i$1];
|
|
32860
|
+
if (level > maxLevel) {
|
|
32861
|
+
maxLevel = level;
|
|
32862
|
+
}
|
|
32863
|
+
if (level < minOddLevel) {
|
|
32864
|
+
minOddLevel = level | 1;
|
|
32865
|
+
}
|
|
32866
|
+
}
|
|
32867
|
+
for (var lvl = maxLevel; lvl >= minOddLevel; lvl--) {
|
|
32868
|
+
for (var i$2 = 0; i$2 < lineLevels.length; i$2++) {
|
|
32869
|
+
if (lineLevels[i$2] >= lvl) {
|
|
32870
|
+
var segStart = i$2;
|
|
32871
|
+
while (i$2 + 1 < lineLevels.length && lineLevels[i$2 + 1] >= lvl) {
|
|
32872
|
+
i$2++;
|
|
32873
|
+
}
|
|
32874
|
+
if (i$2 > segStart) {
|
|
32875
|
+
segments.push([segStart + lineStart, i$2 + lineStart]);
|
|
32876
|
+
}
|
|
32877
|
+
}
|
|
32878
|
+
}
|
|
32879
|
+
}
|
|
32880
|
+
}
|
|
32881
|
+
});
|
|
32882
|
+
return segments;
|
|
32883
|
+
}
|
|
32884
|
+
function getReorderedString(string4, embedLevelsResult, start, end) {
|
|
32885
|
+
var indices = getReorderedIndices(string4, embedLevelsResult, start, end);
|
|
32886
|
+
var chars = [].concat(string4);
|
|
32887
|
+
indices.forEach(function(charIndex, i) {
|
|
32888
|
+
chars[i] = (embedLevelsResult.levels[charIndex] & 1 ? getMirroredCharacter(string4[charIndex]) : null) || string4[charIndex];
|
|
32889
|
+
});
|
|
32890
|
+
return chars.join("");
|
|
32891
|
+
}
|
|
32892
|
+
function getReorderedIndices(string4, embedLevelsResult, start, end) {
|
|
32893
|
+
var segments = getReorderSegments(string4, embedLevelsResult, start, end);
|
|
32894
|
+
var indices = [];
|
|
32895
|
+
for (var i = 0; i < string4.length; i++) {
|
|
32896
|
+
indices[i] = i;
|
|
32897
|
+
}
|
|
32898
|
+
segments.forEach(function(ref) {
|
|
32899
|
+
var start2 = ref[0];
|
|
32900
|
+
var end2 = ref[1];
|
|
32901
|
+
var slice = indices.slice(start2, end2 + 1);
|
|
32902
|
+
for (var i2 = slice.length; i2--; ) {
|
|
32903
|
+
indices[end2 - i2] = slice[i2];
|
|
32904
|
+
}
|
|
32905
|
+
});
|
|
32906
|
+
return indices;
|
|
32907
|
+
}
|
|
32908
|
+
exports.closingToOpeningBracket = closingToOpeningBracket;
|
|
32909
|
+
exports.getBidiCharType = getBidiCharType;
|
|
32910
|
+
exports.getBidiCharTypeName = getBidiCharTypeName;
|
|
32911
|
+
exports.getCanonicalBracket = getCanonicalBracket;
|
|
32912
|
+
exports.getEmbeddingLevels = getEmbeddingLevels;
|
|
32913
|
+
exports.getMirroredCharacter = getMirroredCharacter;
|
|
32914
|
+
exports.getMirroredCharactersMap = getMirroredCharactersMap;
|
|
32915
|
+
exports.getReorderSegments = getReorderSegments;
|
|
32916
|
+
exports.getReorderedIndices = getReorderedIndices;
|
|
32917
|
+
exports.getReorderedString = getReorderedString;
|
|
32918
|
+
exports.openingToClosingBracket = openingToClosingBracket;
|
|
32919
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32920
|
+
return exports;
|
|
32921
|
+
})({});
|
|
32922
|
+
return bidi;
|
|
32923
|
+
}
|
|
32924
|
+
var bidi_default = bidiFactory;
|
|
32925
|
+
|
|
32926
|
+
// src/core/bidi.ts
|
|
32927
|
+
var bidiInstance = null;
|
|
32928
|
+
function getBidi() {
|
|
32929
|
+
if (!bidiInstance) {
|
|
32930
|
+
bidiInstance = bidi_default();
|
|
32931
|
+
}
|
|
32932
|
+
return bidiInstance;
|
|
32933
|
+
}
|
|
32934
|
+
var RTL_SCRIPT_REGEX = /[--ۿ܀-ݏݐ-ݿހ-߀-߿ࠀ-ࡀ-ࡠ-ࢠ-ࣿיִ-ﭏﭐ-﷿ﹰ-𐴀-𐹠-𞠀-𞤀-𞥟--𞸀-]/u;
|
|
32935
|
+
function containsRTLCharacters(text) {
|
|
32936
|
+
return RTL_SCRIPT_REGEX.test(text);
|
|
32937
|
+
}
|
|
32938
|
+
function detectParagraphDirection(text) {
|
|
32939
|
+
const bidi = getBidi();
|
|
32940
|
+
const { paragraphs } = bidi.getEmbeddingLevels(text);
|
|
32941
|
+
if (paragraphs.length === 0) {
|
|
32942
|
+
return "ltr";
|
|
32943
|
+
}
|
|
32944
|
+
return paragraphs[0].level % 2 === 1 ? "rtl" : "ltr";
|
|
32945
|
+
}
|
|
32946
|
+
function detectParagraphDirectionFromWords(words) {
|
|
32947
|
+
const combined = words.join(" ");
|
|
32948
|
+
return detectParagraphDirection(combined);
|
|
32949
|
+
}
|
|
32950
|
+
function reorderWordsForLine(wordTexts, paragraphDirection) {
|
|
32951
|
+
if (wordTexts.length <= 1) {
|
|
32952
|
+
return wordTexts.map((_, i) => i);
|
|
32953
|
+
}
|
|
32954
|
+
const lineText = wordTexts.join(" ");
|
|
32955
|
+
const bidi = getBidi();
|
|
32956
|
+
const { levels } = bidi.getEmbeddingLevels(lineText, paragraphDirection);
|
|
32957
|
+
const wordLevels = [];
|
|
32958
|
+
let charIndex = 0;
|
|
32959
|
+
for (let i = 0; i < wordTexts.length; i++) {
|
|
32960
|
+
const wordLevel = levels[charIndex];
|
|
32961
|
+
wordLevels.push(wordLevel);
|
|
32962
|
+
charIndex += wordTexts[i].length;
|
|
32963
|
+
if (i < wordTexts.length - 1) {
|
|
32964
|
+
charIndex += 1;
|
|
32965
|
+
}
|
|
32966
|
+
}
|
|
32967
|
+
const indices = wordTexts.map((_, i) => i);
|
|
32968
|
+
const maxLevel = Math.max(...wordLevels);
|
|
32969
|
+
const minOddLevel = paragraphDirection === "rtl" ? 1 : Math.min(...wordLevels.filter((l) => l % 2 === 1), maxLevel + 1);
|
|
32970
|
+
for (let level = maxLevel; level >= minOddLevel; level--) {
|
|
32971
|
+
let start = 0;
|
|
32972
|
+
while (start < indices.length) {
|
|
32973
|
+
if (wordLevels[indices[start]] >= level) {
|
|
32974
|
+
let end = start;
|
|
32975
|
+
while (end + 1 < indices.length && wordLevels[indices[end + 1]] >= level) {
|
|
32976
|
+
end++;
|
|
32977
|
+
}
|
|
32978
|
+
if (start < end) {
|
|
32979
|
+
let left = start;
|
|
32980
|
+
let right = end;
|
|
32981
|
+
while (left < right) {
|
|
32982
|
+
const tmp = indices[left];
|
|
32983
|
+
indices[left] = indices[right];
|
|
32984
|
+
indices[right] = tmp;
|
|
32985
|
+
left++;
|
|
32986
|
+
right--;
|
|
32987
|
+
}
|
|
32988
|
+
}
|
|
32989
|
+
start = end + 1;
|
|
32990
|
+
} else {
|
|
32991
|
+
start++;
|
|
32992
|
+
}
|
|
32993
|
+
}
|
|
32994
|
+
}
|
|
32995
|
+
return indices;
|
|
32996
|
+
}
|
|
32997
|
+
function getVisibleText(text, visibleCharacters, isRTL) {
|
|
32998
|
+
if (visibleCharacters < 0 || visibleCharacters >= text.length) {
|
|
32999
|
+
return text;
|
|
33000
|
+
}
|
|
33001
|
+
if (visibleCharacters === 0) {
|
|
33002
|
+
return "";
|
|
33003
|
+
}
|
|
33004
|
+
return text.slice(0, visibleCharacters);
|
|
33005
|
+
}
|
|
33006
|
+
function mirrorAnimationDirection(direction, isRTL) {
|
|
33007
|
+
if (!isRTL) {
|
|
33008
|
+
return direction;
|
|
33009
|
+
}
|
|
33010
|
+
if (direction === "left") return "right";
|
|
33011
|
+
if (direction === "right") return "left";
|
|
33012
|
+
return direction;
|
|
33013
|
+
}
|
|
33014
|
+
|
|
32156
33015
|
// src/core/layout.ts
|
|
32157
33016
|
function isEmoji(char) {
|
|
32158
33017
|
const code = char.codePointAt(0);
|
|
32159
33018
|
if (!code) return false;
|
|
32160
|
-
return code >= 127744 && code <= 129535 ||
|
|
32161
|
-
|
|
32162
|
-
|
|
32163
|
-
|
|
32164
|
-
|
|
32165
|
-
|
|
32166
|
-
|
|
32167
|
-
|
|
33019
|
+
return code >= 127744 && code <= 129535 || code >= 9728 && code <= 9983 || code >= 9984 && code <= 10175 || code >= 65024 && code <= 65039 || code >= 128512 && code <= 128591 || code >= 128640 && code <= 128767 || code >= 129280 && code <= 129535 || code >= 129648 && code <= 129791;
|
|
33020
|
+
}
|
|
33021
|
+
function reorderRunsVisually(runs) {
|
|
33022
|
+
if (runs.length <= 1) return runs;
|
|
33023
|
+
const result = runs.slice();
|
|
33024
|
+
const runLevels = result.map((r) => r.level);
|
|
33025
|
+
const maxLevel = Math.max(...runLevels);
|
|
33026
|
+
const minLevel = Math.min(...runLevels);
|
|
33027
|
+
const minOddLevel = minLevel % 2 === 1 ? minLevel : minLevel + 1;
|
|
33028
|
+
for (let level = maxLevel; level >= minOddLevel; level--) {
|
|
33029
|
+
let start = 0;
|
|
33030
|
+
while (start < result.length) {
|
|
33031
|
+
if (runLevels[result.indexOf(result[start])] >= level) {
|
|
33032
|
+
let end = start;
|
|
33033
|
+
while (end + 1 < result.length && result[end + 1].level >= level) {
|
|
33034
|
+
end++;
|
|
33035
|
+
}
|
|
33036
|
+
if (start < end) {
|
|
33037
|
+
let left = start;
|
|
33038
|
+
let right = end;
|
|
33039
|
+
while (left < right) {
|
|
33040
|
+
const tmp = result[left];
|
|
33041
|
+
result[left] = result[right];
|
|
33042
|
+
result[right] = tmp;
|
|
33043
|
+
left++;
|
|
33044
|
+
right--;
|
|
33045
|
+
}
|
|
33046
|
+
}
|
|
33047
|
+
start = end + 1;
|
|
33048
|
+
} else {
|
|
33049
|
+
start++;
|
|
33050
|
+
}
|
|
33051
|
+
}
|
|
33052
|
+
}
|
|
33053
|
+
return result;
|
|
32168
33054
|
}
|
|
32169
33055
|
var LayoutEngine = class {
|
|
32170
33056
|
constructor(fonts) {
|
|
@@ -32182,13 +33068,16 @@ var LayoutEngine = class {
|
|
|
32182
33068
|
return t;
|
|
32183
33069
|
}
|
|
32184
33070
|
}
|
|
32185
|
-
async shapeFull(text, desc) {
|
|
33071
|
+
async shapeFull(text, desc, direction) {
|
|
32186
33072
|
try {
|
|
32187
33073
|
const hb = await this.fonts.getHB();
|
|
32188
33074
|
const buffer = hb.createBuffer();
|
|
32189
33075
|
try {
|
|
32190
33076
|
buffer.addText(text);
|
|
32191
33077
|
buffer.guessSegmentProperties();
|
|
33078
|
+
if (direction) {
|
|
33079
|
+
buffer.setDirection(direction);
|
|
33080
|
+
}
|
|
32192
33081
|
const font = await this.fonts.getFont(desc);
|
|
32193
33082
|
const face = await this.fonts.getFace(desc);
|
|
32194
33083
|
const upem = face?.upem || 1e3;
|
|
@@ -32211,6 +33100,64 @@ var LayoutEngine = class {
|
|
|
32211
33100
|
);
|
|
32212
33101
|
}
|
|
32213
33102
|
}
|
|
33103
|
+
splitIntoBidiRuns(input, levels, desc, emojiFallback) {
|
|
33104
|
+
const runs = [];
|
|
33105
|
+
if (input.length === 0) return runs;
|
|
33106
|
+
let runStart = 0;
|
|
33107
|
+
let runLevel = levels[0];
|
|
33108
|
+
let runIsEmoji = emojiFallback ? isEmoji(input[0]) : false;
|
|
33109
|
+
for (let i = 1; i <= input.length; i++) {
|
|
33110
|
+
const atEnd = i === input.length;
|
|
33111
|
+
const charLevel = atEnd ? -1 : levels[i];
|
|
33112
|
+
const charIsEmoji = !atEnd && emojiFallback ? isEmoji(String.fromCodePoint(input.codePointAt(i) ?? 0)) : false;
|
|
33113
|
+
if (atEnd || charLevel !== runLevel || emojiFallback && charIsEmoji !== runIsEmoji) {
|
|
33114
|
+
const text = input.slice(runStart, i);
|
|
33115
|
+
const font = runIsEmoji && emojiFallback ? emojiFallback : desc;
|
|
33116
|
+
runs.push({ text, startIndex: runStart, endIndex: i, level: runLevel, font });
|
|
33117
|
+
if (!atEnd) {
|
|
33118
|
+
runStart = i;
|
|
33119
|
+
runLevel = charLevel;
|
|
33120
|
+
runIsEmoji = charIsEmoji;
|
|
33121
|
+
}
|
|
33122
|
+
}
|
|
33123
|
+
}
|
|
33124
|
+
return runs;
|
|
33125
|
+
}
|
|
33126
|
+
async shapeWithBidi(input, desc, emojiFallback) {
|
|
33127
|
+
const hasRTL = containsRTLCharacters(input);
|
|
33128
|
+
const hasLTR = /[a-zA-Z0-9]/.test(input);
|
|
33129
|
+
const hasMixedDirection = hasRTL && hasLTR;
|
|
33130
|
+
if (!hasMixedDirection && !emojiFallback) {
|
|
33131
|
+
const textDirection = hasRTL ? "rtl" : void 0;
|
|
33132
|
+
return this.shapeFull(input, desc, textDirection);
|
|
33133
|
+
}
|
|
33134
|
+
const bidi = bidi_default();
|
|
33135
|
+
const { levels } = bidi.getEmbeddingLevels(input);
|
|
33136
|
+
const bidiRuns = this.splitIntoBidiRuns(input, levels, desc, emojiFallback);
|
|
33137
|
+
const shapedRuns = [];
|
|
33138
|
+
for (const run of bidiRuns) {
|
|
33139
|
+
const runDirection = run.level % 2 === 1 ? "rtl" : "ltr";
|
|
33140
|
+
const runShaped = await this.shapeFull(run.text, run.font, runDirection);
|
|
33141
|
+
for (const glyph of runShaped) {
|
|
33142
|
+
glyph.cl += run.startIndex;
|
|
33143
|
+
if (run.font !== desc) {
|
|
33144
|
+
glyph.fontDesc = run.font;
|
|
33145
|
+
}
|
|
33146
|
+
}
|
|
33147
|
+
shapedRuns.push({
|
|
33148
|
+
glyphs: runShaped,
|
|
33149
|
+
startIndex: run.startIndex,
|
|
33150
|
+
endIndex: run.endIndex,
|
|
33151
|
+
level: run.level
|
|
33152
|
+
});
|
|
33153
|
+
}
|
|
33154
|
+
const visualRuns = reorderRunsVisually(shapedRuns);
|
|
33155
|
+
const visualGlyphs = [];
|
|
33156
|
+
for (const run of visualRuns) {
|
|
33157
|
+
visualGlyphs.push(...run.glyphs);
|
|
33158
|
+
}
|
|
33159
|
+
return visualGlyphs;
|
|
33160
|
+
}
|
|
32214
33161
|
async layout(params) {
|
|
32215
33162
|
try {
|
|
32216
33163
|
const { textTransform, desc, fontSize, letterSpacing, width, emojiFallback } = params;
|
|
@@ -32220,36 +33167,7 @@ var LayoutEngine = class {
|
|
|
32220
33167
|
}
|
|
32221
33168
|
let shaped;
|
|
32222
33169
|
try {
|
|
32223
|
-
|
|
32224
|
-
shaped = await this.shapeFull(input, desc);
|
|
32225
|
-
} else {
|
|
32226
|
-
const chars = Array.from(input);
|
|
32227
|
-
const runs = [];
|
|
32228
|
-
let currentRun = { text: "", startIndex: 0, isEmoji: false };
|
|
32229
|
-
for (let i = 0; i < chars.length; i++) {
|
|
32230
|
-
const char = chars[i];
|
|
32231
|
-
const charIsEmoji = isEmoji(char);
|
|
32232
|
-
if (i === 0) {
|
|
32233
|
-
currentRun = { text: char, startIndex: 0, isEmoji: charIsEmoji };
|
|
32234
|
-
} else if (currentRun.isEmoji === charIsEmoji) {
|
|
32235
|
-
currentRun.text += char;
|
|
32236
|
-
} else {
|
|
32237
|
-
runs.push(currentRun);
|
|
32238
|
-
currentRun = { text: char, startIndex: currentRun.startIndex + currentRun.text.length, isEmoji: charIsEmoji };
|
|
32239
|
-
}
|
|
32240
|
-
}
|
|
32241
|
-
if (currentRun.text) runs.push(currentRun);
|
|
32242
|
-
shaped = [];
|
|
32243
|
-
for (const run of runs) {
|
|
32244
|
-
const runFont = run.isEmoji ? emojiFallback : desc;
|
|
32245
|
-
const runShaped = await this.shapeFull(run.text, runFont);
|
|
32246
|
-
for (const glyph of runShaped) {
|
|
32247
|
-
glyph.cl += run.startIndex;
|
|
32248
|
-
glyph.fontDesc = runFont;
|
|
32249
|
-
}
|
|
32250
|
-
shaped.push(...runShaped);
|
|
32251
|
-
}
|
|
32252
|
-
}
|
|
33170
|
+
shaped = await this.shapeWithBidi(input, desc, emojiFallback);
|
|
32253
33171
|
} catch (err) {
|
|
32254
33172
|
throw new Error(`Text shaping failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
32255
33173
|
}
|
|
@@ -32280,7 +33198,6 @@ var LayoutEngine = class {
|
|
|
32280
33198
|
cluster: g.cl,
|
|
32281
33199
|
char,
|
|
32282
33200
|
fontDesc: g.fontDesc
|
|
32283
|
-
// Preserve font descriptor
|
|
32284
33201
|
};
|
|
32285
33202
|
});
|
|
32286
33203
|
const lines = [];
|
|
@@ -32343,9 +33260,11 @@ var LayoutEngine = class {
|
|
|
32343
33260
|
y: 0
|
|
32344
33261
|
});
|
|
32345
33262
|
}
|
|
33263
|
+
const textIsRTL = containsRTLCharacters(input);
|
|
32346
33264
|
const lineHeight = params.lineHeight * fontSize;
|
|
32347
33265
|
for (let i = 0; i < lines.length; i++) {
|
|
32348
33266
|
lines[i].y = (i + 1) * lineHeight;
|
|
33267
|
+
lines[i].isRTL = textIsRTL;
|
|
32349
33268
|
}
|
|
32350
33269
|
return lines;
|
|
32351
33270
|
} catch (err) {
|
|
@@ -32384,6 +33303,14 @@ function normalizePadding(padding) {
|
|
|
32384
33303
|
}
|
|
32385
33304
|
return padding;
|
|
32386
33305
|
}
|
|
33306
|
+
function resolveHorizontalAlign(align, isRTL) {
|
|
33307
|
+
if (!isRTL || align === "center") {
|
|
33308
|
+
return align;
|
|
33309
|
+
}
|
|
33310
|
+
if (align === "left") return "right";
|
|
33311
|
+
if (align === "right") return "left";
|
|
33312
|
+
return align;
|
|
33313
|
+
}
|
|
32387
33314
|
async function buildDrawOps(p) {
|
|
32388
33315
|
const ops = [];
|
|
32389
33316
|
const padding = normalizePadding(p.padding);
|
|
@@ -32424,7 +33351,8 @@ async function buildDrawOps(p) {
|
|
|
32424
33351
|
let gMinX = Infinity, gMinY = Infinity, gMaxX = -Infinity, gMaxY = -Infinity;
|
|
32425
33352
|
for (const line of p.lines) {
|
|
32426
33353
|
let lineX;
|
|
32427
|
-
|
|
33354
|
+
const effectiveAlign = resolveHorizontalAlign(p.align.horizontal, line.isRTL);
|
|
33355
|
+
switch (effectiveAlign) {
|
|
32428
33356
|
case "left":
|
|
32429
33357
|
lineX = 0;
|
|
32430
33358
|
break;
|
|
@@ -32552,7 +33480,7 @@ async function buildDrawOps(p) {
|
|
|
32552
33480
|
const contentWidth = p.contentRect?.width ?? p.canvas.width;
|
|
32553
33481
|
const contentHeight = p.contentRect?.height ?? p.canvas.height;
|
|
32554
33482
|
const borderWidth2 = p.border?.width ?? 0;
|
|
32555
|
-
const borderRadius = p.border?.radius ?? 0;
|
|
33483
|
+
const borderRadius = p.border?.radius ?? p.background?.borderRadius ?? 0;
|
|
32556
33484
|
const halfBorder = borderWidth2 / 2;
|
|
32557
33485
|
const canvasCenterX = p.canvas.width / 2;
|
|
32558
33486
|
const canvasCenterY = p.canvas.height / 2;
|
|
@@ -32670,7 +33598,15 @@ function applyAnimation(ops, lines, p) {
|
|
|
32670
33598
|
case "fadeIn":
|
|
32671
33599
|
return applyFadeInAnimation(ops, lines, progress, p.anim.style, p.fontSize, duration3);
|
|
32672
33600
|
case "slideIn":
|
|
32673
|
-
return applySlideInAnimation(
|
|
33601
|
+
return applySlideInAnimation(
|
|
33602
|
+
ops,
|
|
33603
|
+
lines,
|
|
33604
|
+
progress,
|
|
33605
|
+
p.anim.direction ?? "left",
|
|
33606
|
+
p.fontSize,
|
|
33607
|
+
p.anim.style,
|
|
33608
|
+
duration3
|
|
33609
|
+
);
|
|
32674
33610
|
case "shift":
|
|
32675
33611
|
return applyShiftAnimation(
|
|
32676
33612
|
ops,
|
|
@@ -32698,6 +33634,9 @@ function applyAnimation(ops, lines, p) {
|
|
|
32698
33634
|
}
|
|
32699
33635
|
var isShadowFill = (op) => op.op === "FillPath" && op.isShadow === true;
|
|
32700
33636
|
var isGlyphFill = (op) => op.op === "FillPath" && !op.isShadow === true;
|
|
33637
|
+
function isRTLLines(lines) {
|
|
33638
|
+
return lines.length > 0 && lines[0].isRTL === true;
|
|
33639
|
+
}
|
|
32701
33640
|
function getTextColorFromOps(ops) {
|
|
32702
33641
|
for (const op of ops) {
|
|
32703
33642
|
if (op.op === "FillPath") {
|
|
@@ -32717,28 +33656,32 @@ function applyTypewriterAnimation(ops, lines, progress, style, fontSize, time3,
|
|
|
32717
33656
|
const totalWords = wordSegments.length;
|
|
32718
33657
|
const visibleWords = Math.floor(progress * totalWords);
|
|
32719
33658
|
if (visibleWords === 0) {
|
|
32720
|
-
return ops.filter(
|
|
33659
|
+
return ops.filter(
|
|
33660
|
+
(x2) => x2.op === "BeginFrame" || x2.op === "Rectangle" || x2.op === "RectangleStroke"
|
|
33661
|
+
);
|
|
32721
33662
|
}
|
|
32722
33663
|
let totalVisibleGlyphs = 0;
|
|
32723
33664
|
for (let i = 0; i < Math.min(visibleWords, wordSegments.length); i++) {
|
|
32724
33665
|
totalVisibleGlyphs += wordSegments[i].glyphCount;
|
|
32725
33666
|
}
|
|
32726
|
-
const visibleOpsRaw = sliceGlyphOps(ops, totalVisibleGlyphs);
|
|
33667
|
+
const visibleOpsRaw = isRTLLines(lines) ? sliceGlyphOpsFromEnd(ops, totalVisibleGlyphs) : sliceGlyphOps(ops, totalVisibleGlyphs);
|
|
32727
33668
|
const visibleOps = progress >= DECORATION_DONE_THRESHOLD ? visibleOpsRaw : visibleOpsRaw.filter((o) => o.op !== "DecorationLine");
|
|
32728
33669
|
if (progress < 1 && totalVisibleGlyphs > 0) {
|
|
32729
|
-
return addTypewriterCursor(visibleOps, totalVisibleGlyphs, fontSize, time3);
|
|
33670
|
+
return addTypewriterCursor(visibleOps, totalVisibleGlyphs, fontSize, time3, isRTLLines(lines));
|
|
32730
33671
|
}
|
|
32731
33672
|
return visibleOps;
|
|
32732
33673
|
} else {
|
|
32733
33674
|
const totalGlyphs = lines.reduce((s, l) => s + l.glyphs.length, 0);
|
|
32734
33675
|
const visibleGlyphs = Math.floor(progress * totalGlyphs);
|
|
32735
33676
|
if (visibleGlyphs === 0) {
|
|
32736
|
-
return ops.filter(
|
|
33677
|
+
return ops.filter(
|
|
33678
|
+
(x2) => x2.op === "BeginFrame" || x2.op === "Rectangle" || x2.op === "RectangleStroke"
|
|
33679
|
+
);
|
|
32737
33680
|
}
|
|
32738
|
-
const visibleOpsRaw = sliceGlyphOps(ops, visibleGlyphs);
|
|
33681
|
+
const visibleOpsRaw = isRTLLines(lines) ? sliceGlyphOpsFromEnd(ops, visibleGlyphs) : sliceGlyphOps(ops, visibleGlyphs);
|
|
32739
33682
|
const visibleOps = progress >= DECORATION_DONE_THRESHOLD ? visibleOpsRaw : visibleOpsRaw.filter((o) => o.op !== "DecorationLine");
|
|
32740
33683
|
if (progress < 1 && visibleGlyphs > 0) {
|
|
32741
|
-
return addTypewriterCursor(visibleOps, visibleGlyphs, fontSize, time3);
|
|
33684
|
+
return addTypewriterCursor(visibleOps, visibleGlyphs, fontSize, time3, isRTLLines(lines));
|
|
32742
33685
|
}
|
|
32743
33686
|
return visibleOps;
|
|
32744
33687
|
}
|
|
@@ -32769,7 +33712,8 @@ function applyAscendAnimation(ops, lines, progress, direction, fontSize, duratio
|
|
|
32769
33712
|
acc += gcount;
|
|
32770
33713
|
}
|
|
32771
33714
|
if (wordIndex >= 0) {
|
|
32772
|
-
const
|
|
33715
|
+
const effectiveWordIndex = isRTLLines(lines) ? Math.max(0, totalWords - 1 - wordIndex) : wordIndex;
|
|
33716
|
+
const startF = effectiveWordIndex / Math.max(1, totalWords) * (duration3 / duration3);
|
|
32773
33717
|
const endF = Math.min(1, startF + 0.3);
|
|
32774
33718
|
if (progress >= endF) {
|
|
32775
33719
|
result.push(op);
|
|
@@ -32849,7 +33793,8 @@ function applyShiftAnimation(ops, lines, progress, direction, fontSize, style, d
|
|
|
32849
33793
|
}
|
|
32850
33794
|
unitIndex = Math.max(0, wordIndex);
|
|
32851
33795
|
}
|
|
32852
|
-
const
|
|
33796
|
+
const effectiveUnit = isRTLLines(lines) ? Math.max(0, totalUnits - 1 - unitIndex) : unitIndex;
|
|
33797
|
+
const { startF, endF } = windowFor(effectiveUnit);
|
|
32853
33798
|
if (progress <= startF) {
|
|
32854
33799
|
const animated = { ...op, x: op.x + offset.x, y: op.y + offset.y };
|
|
32855
33800
|
if (op.op === "FillPath") {
|
|
@@ -32930,7 +33875,8 @@ function applyFadeInAnimation(ops, lines, progress, style, fontSize, duration3)
|
|
|
32930
33875
|
}
|
|
32931
33876
|
unitIndex = Math.max(0, wordIndex);
|
|
32932
33877
|
}
|
|
32933
|
-
const
|
|
33878
|
+
const effectiveUnit = isRTLLines(lines) ? Math.max(0, totalUnits - 1 - unitIndex) : unitIndex;
|
|
33879
|
+
const { startF, endF } = windowFor(effectiveUnit);
|
|
32934
33880
|
if (progress <= startF) {
|
|
32935
33881
|
const animated = { ...op };
|
|
32936
33882
|
if (op.op === "FillPath") {
|
|
@@ -33017,7 +33963,8 @@ function applySlideInAnimation(ops, lines, progress, direction, fontSize, style,
|
|
|
33017
33963
|
}
|
|
33018
33964
|
unitIndex = Math.max(0, wordIndex);
|
|
33019
33965
|
}
|
|
33020
|
-
const
|
|
33966
|
+
const effectiveUnit = isRTLLines(lines) ? Math.max(0, totalUnits - 1 - unitIndex) : unitIndex;
|
|
33967
|
+
const { startF, endF } = windowFor(effectiveUnit);
|
|
33021
33968
|
if (progress <= startF) {
|
|
33022
33969
|
const animated = { ...op, x: op.x + offset.x, y: op.y + offset.y };
|
|
33023
33970
|
if (op.op === "FillPath") {
|
|
@@ -33084,6 +34031,43 @@ function segmentLineBySpaces(line) {
|
|
|
33084
34031
|
if (current.length) words.push(current);
|
|
33085
34032
|
return words;
|
|
33086
34033
|
}
|
|
34034
|
+
function sliceGlyphOpsFromEnd(ops, maxGlyphs) {
|
|
34035
|
+
let totalGlyphs = 0;
|
|
34036
|
+
for (const op of ops) {
|
|
34037
|
+
if (op.op === "FillPath" && !isShadowFill(op)) totalGlyphs++;
|
|
34038
|
+
}
|
|
34039
|
+
const skipCount = Math.max(0, totalGlyphs - maxGlyphs);
|
|
34040
|
+
const result = [];
|
|
34041
|
+
let glyphCount = 0;
|
|
34042
|
+
let foundGlyphs = false;
|
|
34043
|
+
for (const op of ops) {
|
|
34044
|
+
if (op.op === "BeginFrame" || op.op === "Rectangle" || op.op === "RectangleStroke") {
|
|
34045
|
+
result.push(op);
|
|
34046
|
+
continue;
|
|
34047
|
+
}
|
|
34048
|
+
if (op.op === "FillPath" && !isShadowFill(op)) {
|
|
34049
|
+
if (glyphCount >= skipCount) {
|
|
34050
|
+
result.push(op);
|
|
34051
|
+
foundGlyphs = true;
|
|
34052
|
+
}
|
|
34053
|
+
glyphCount++;
|
|
34054
|
+
continue;
|
|
34055
|
+
}
|
|
34056
|
+
if (op.op === "StrokePath") {
|
|
34057
|
+
if (glyphCount >= skipCount) result.push(op);
|
|
34058
|
+
continue;
|
|
34059
|
+
}
|
|
34060
|
+
if (op.op === "FillPath" && isShadowFill(op)) {
|
|
34061
|
+
if (glyphCount >= skipCount) result.push(op);
|
|
34062
|
+
continue;
|
|
34063
|
+
}
|
|
34064
|
+
if (op.op === "DecorationLine" && foundGlyphs) {
|
|
34065
|
+
result.push(op);
|
|
34066
|
+
continue;
|
|
34067
|
+
}
|
|
34068
|
+
}
|
|
34069
|
+
return result;
|
|
34070
|
+
}
|
|
33087
34071
|
function sliceGlyphOps(ops, maxGlyphs) {
|
|
33088
34072
|
const result = [];
|
|
33089
34073
|
let glyphCount = 0;
|
|
@@ -33116,27 +34100,30 @@ function sliceGlyphOps(ops, maxGlyphs) {
|
|
|
33116
34100
|
}
|
|
33117
34101
|
return result;
|
|
33118
34102
|
}
|
|
33119
|
-
function addTypewriterCursor(ops, glyphCount, fontSize, time3) {
|
|
34103
|
+
function addTypewriterCursor(ops, glyphCount, fontSize, time3, isRTL = false) {
|
|
33120
34104
|
if (glyphCount === 0) return ops;
|
|
33121
34105
|
const blinkRate = 1;
|
|
33122
34106
|
const cursorVisible = Math.floor(time3 * blinkRate * 2) % 2 === 0;
|
|
33123
34107
|
const alwaysShowCursor = true;
|
|
33124
34108
|
if (!alwaysShowCursor && !cursorVisible) return ops;
|
|
33125
34109
|
let last = null;
|
|
34110
|
+
let first = null;
|
|
33126
34111
|
let count = 0;
|
|
33127
34112
|
for (const op of ops) {
|
|
33128
34113
|
if (op.op === "FillPath" && !isShadowFill(op)) {
|
|
33129
34114
|
count++;
|
|
34115
|
+
if (count === 1) first = op;
|
|
33130
34116
|
if (count === glyphCount) {
|
|
33131
34117
|
last = op;
|
|
33132
34118
|
break;
|
|
33133
34119
|
}
|
|
33134
34120
|
}
|
|
33135
34121
|
}
|
|
33136
|
-
|
|
34122
|
+
const cursorAnchor = isRTL && first ? first : last;
|
|
34123
|
+
if (cursorAnchor && cursorAnchor.op === "FillPath") {
|
|
33137
34124
|
const color = getTextColorFromOps(ops);
|
|
33138
|
-
const cursorX =
|
|
33139
|
-
const cursorY =
|
|
34125
|
+
const cursorX = isRTL && first ? first.x - fontSize * 0.15 : cursorAnchor.x + fontSize * 0.5;
|
|
34126
|
+
const cursorY = cursorAnchor.y;
|
|
33140
34127
|
const cursorWidth = Math.max(3, fontSize / 15);
|
|
33141
34128
|
const cursorOp = {
|
|
33142
34129
|
op: "DecorationLine",
|
|
@@ -33496,7 +34483,7 @@ function calculateNoneState(ctx) {
|
|
|
33496
34483
|
isActive: isWordActive(ctx)
|
|
33497
34484
|
};
|
|
33498
34485
|
}
|
|
33499
|
-
function calculateWordAnimationState(wordStart, wordEnd, currentTime, config2, activeScale = 1, charCount = 0, fontSize = 48) {
|
|
34486
|
+
function calculateWordAnimationState(wordStart, wordEnd, currentTime, config2, activeScale = 1, charCount = 0, fontSize = 48, isRTL = false) {
|
|
33500
34487
|
const safeSpeed = config2.speed > 0 ? config2.speed : 1;
|
|
33501
34488
|
const ctx = {
|
|
33502
34489
|
wordStart,
|
|
@@ -33519,9 +34506,11 @@ function calculateWordAnimationState(wordStart, wordEnd, currentTime, config2, a
|
|
|
33519
34506
|
case "fade":
|
|
33520
34507
|
partialState = calculateFadeState(ctx, safeSpeed);
|
|
33521
34508
|
break;
|
|
33522
|
-
case "slide":
|
|
33523
|
-
|
|
34509
|
+
case "slide": {
|
|
34510
|
+
const slideDir = mirrorAnimationDirection(config2.direction, isRTL);
|
|
34511
|
+
partialState = calculateSlideState(ctx, slideDir, config2.speed, fontSize);
|
|
33524
34512
|
break;
|
|
34513
|
+
}
|
|
33525
34514
|
case "bounce":
|
|
33526
34515
|
partialState = calculateBounceState(ctx, safeSpeed, fontSize);
|
|
33527
34516
|
break;
|
|
@@ -33549,7 +34538,8 @@ function calculateAnimationStatesForGroup(words, currentTime, config2, activeSca
|
|
|
33549
34538
|
config2,
|
|
33550
34539
|
activeScale,
|
|
33551
34540
|
word.text.length,
|
|
33552
|
-
fontSize
|
|
34541
|
+
fontSize,
|
|
34542
|
+
word.isRTL
|
|
33553
34543
|
);
|
|
33554
34544
|
states.set(word.wordIndex, state);
|
|
33555
34545
|
}
|
|
@@ -33693,7 +34683,7 @@ function extractActiveScale(asset) {
|
|
|
33693
34683
|
}
|
|
33694
34684
|
function createDrawCaptionWordOp(word, animState, asset, fontConfig) {
|
|
33695
34685
|
const isActive = animState.isActive;
|
|
33696
|
-
const displayText =
|
|
34686
|
+
const displayText = getVisibleText(word.text, animState.visibleCharacters, word.isRTL);
|
|
33697
34687
|
return {
|
|
33698
34688
|
op: "DrawCaptionWord",
|
|
33699
34689
|
text: displayText,
|
|
@@ -34081,7 +35071,7 @@ function createWebPainter(canvas) {
|
|
|
34081
35071
|
}
|
|
34082
35072
|
for (const wordOp of captionWordOps) {
|
|
34083
35073
|
if (!wordOp.background) continue;
|
|
34084
|
-
const wordDisplayText = wordOp.
|
|
35074
|
+
const wordDisplayText = getVisibleText(wordOp.text, wordOp.visibleCharacters, wordOp.isRTL);
|
|
34085
35075
|
if (wordDisplayText.length === 0) continue;
|
|
34086
35076
|
ctx.save();
|
|
34087
35077
|
const bgTx = Math.round(wordOp.x + wordOp.transform.translateX);
|
|
@@ -34113,7 +35103,7 @@ function createWebPainter(canvas) {
|
|
|
34113
35103
|
ctx.restore();
|
|
34114
35104
|
}
|
|
34115
35105
|
for (const wordOp of captionWordOps) {
|
|
34116
|
-
const displayText = wordOp.
|
|
35106
|
+
const displayText = getVisibleText(wordOp.text, wordOp.visibleCharacters, wordOp.isRTL);
|
|
34117
35107
|
if (displayText.length === 0) continue;
|
|
34118
35108
|
ctx.save();
|
|
34119
35109
|
const tx = Math.round(wordOp.x + wordOp.transform.translateX);
|
|
@@ -35985,9 +36975,8 @@ var L = (_c = class {
|
|
|
35985
36975
|
}, _c);
|
|
35986
36976
|
|
|
35987
36977
|
// src/core/rich-caption-layout.ts
|
|
35988
|
-
var RTL_RANGES = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/;
|
|
35989
36978
|
function isRTLText(text) {
|
|
35990
|
-
return
|
|
36979
|
+
return containsRTLCharacters(text);
|
|
35991
36980
|
}
|
|
35992
36981
|
var WordTimingStore = class {
|
|
35993
36982
|
constructor(words) {
|
|
@@ -36246,6 +37235,8 @@ var CaptionLayoutEngine = class {
|
|
|
36246
37235
|
return (config2.frameHeight - totalHeight) / 2 + config2.fontSize;
|
|
36247
37236
|
}
|
|
36248
37237
|
};
|
|
37238
|
+
const allWordTexts = store.words.slice(0, store.length);
|
|
37239
|
+
const paragraphDirection = detectParagraphDirectionFromWords(allWordTexts);
|
|
36249
37240
|
const calculateLineX = (lineWidth) => {
|
|
36250
37241
|
switch (config2.horizontalAlign) {
|
|
36251
37242
|
case "left":
|
|
@@ -36263,8 +37254,11 @@ var CaptionLayoutEngine = class {
|
|
|
36263
37254
|
const line = group.lines[lineIdx];
|
|
36264
37255
|
line.x = calculateLineX(line.width);
|
|
36265
37256
|
line.y = baseY + lineIdx * config2.fontSize * config2.lineHeight;
|
|
37257
|
+
const lineWordTexts = line.wordIndices.map((idx) => store.words[idx]);
|
|
37258
|
+
const visualOrder = reorderWordsForLine(lineWordTexts, paragraphDirection);
|
|
36266
37259
|
let xCursor = line.x;
|
|
36267
|
-
for (const
|
|
37260
|
+
for (const visualIdx of visualOrder) {
|
|
37261
|
+
const wordIdx = line.wordIndices[visualIdx];
|
|
36268
37262
|
store.xPositions[wordIdx] = xCursor;
|
|
36269
37263
|
store.yPositions[wordIdx] = line.y;
|
|
36270
37264
|
xCursor += store.widths[wordIdx] + spaceWidth;
|
|
@@ -36274,7 +37268,8 @@ var CaptionLayoutEngine = class {
|
|
|
36274
37268
|
return {
|
|
36275
37269
|
store,
|
|
36276
37270
|
groups,
|
|
36277
|
-
shapedWords
|
|
37271
|
+
shapedWords,
|
|
37272
|
+
paragraphDirection
|
|
36278
37273
|
};
|
|
36279
37274
|
}
|
|
36280
37275
|
getVisibleWordsAtTime(layout, timeMs) {
|
|
@@ -37106,7 +38101,7 @@ async function createTextEngine(opts = {}) {
|
|
|
37106
38101
|
horizontal: asset.align?.horizontal ?? "center",
|
|
37107
38102
|
vertical: asset.align?.vertical ?? "middle"
|
|
37108
38103
|
},
|
|
37109
|
-
background: asset.background,
|
|
38104
|
+
background: asset.background ? { color: asset.background.color, opacity: asset.background.opacity, borderRadius: typeof asset.background.borderRadius === "number" ? asset.background.borderRadius : Number(asset.background.borderRadius) || 0 } : void 0,
|
|
37110
38105
|
border: asset.border,
|
|
37111
38106
|
padding: asset.padding,
|
|
37112
38107
|
glyphPathProvider: (gid, fontDesc) => fonts.glyphPath(fontDesc || desc, gid),
|
|
@@ -37181,6 +38176,7 @@ export {
|
|
|
37181
38176
|
calculateAnimationStatesForGroup,
|
|
37182
38177
|
commandsToPathString,
|
|
37183
38178
|
computeSimplePathBounds,
|
|
38179
|
+
containsRTLCharacters,
|
|
37184
38180
|
createDefaultGeneratorConfig,
|
|
37185
38181
|
createFrameSchedule,
|
|
37186
38182
|
createMediaRecorderFallback,
|
|
@@ -37188,6 +38184,8 @@ export {
|
|
|
37188
38184
|
createVideoEncoder,
|
|
37189
38185
|
createWebCodecsEncoder,
|
|
37190
38186
|
createWebPainter,
|
|
38187
|
+
detectParagraphDirection,
|
|
38188
|
+
detectParagraphDirectionFromWords,
|
|
37191
38189
|
detectPlatform,
|
|
37192
38190
|
detectSubtitleFormat,
|
|
37193
38191
|
extractCaptionPadding,
|
|
@@ -37199,12 +38197,14 @@ export {
|
|
|
37199
38197
|
getDrawCaptionWordOps,
|
|
37200
38198
|
getEncoderCapabilities,
|
|
37201
38199
|
getEncoderWarning,
|
|
38200
|
+
getVisibleText,
|
|
37202
38201
|
groupWordsByPause,
|
|
37203
38202
|
initResvg,
|
|
37204
38203
|
isDrawCaptionWordOp,
|
|
37205
38204
|
isMediaRecorderSupported,
|
|
37206
38205
|
isRTLText,
|
|
37207
38206
|
isWebCodecsH264Supported,
|
|
38207
|
+
mirrorAnimationDirection,
|
|
37208
38208
|
normalizePath,
|
|
37209
38209
|
normalizePathString,
|
|
37210
38210
|
parseSubtitleToWords,
|
|
@@ -37212,6 +38212,7 @@ export {
|
|
|
37212
38212
|
quadraticToCubic,
|
|
37213
38213
|
renderSvgAssetToPng,
|
|
37214
38214
|
renderSvgToPng,
|
|
38215
|
+
reorderWordsForLine,
|
|
37215
38216
|
richCaptionAssetSchema,
|
|
37216
38217
|
shapeToSvgString,
|
|
37217
38218
|
svgAssetSchema,
|