hyperframes 0.4.12 → 0.4.13-alpha.1
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/cli.js +4259 -24
- package/dist/hyperframe-runtime.js +3 -3
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +3 -3
- package/dist/studio/assets/hyperframes-player-BOs_kypk.js +198 -0
- package/dist/studio/assets/index-BKkR67xb.css +1 -0
- package/dist/studio/assets/index-rN5doSq1.js +93 -0
- package/dist/studio/index.html +2 -2
- package/package.json +1 -1
- package/dist/studio/assets/hyperframes-player-5iD9BZnx.js +0 -198
- package/dist/studio/assets/index-CVDXfFQ6.js +0 -93
- package/dist/studio/assets/index-jmDaI2F7.css +0 -1
package/dist/cli.js
CHANGED
|
@@ -54,7 +54,7 @@ var VERSION;
|
|
|
54
54
|
var init_version = __esm({
|
|
55
55
|
"src/version.ts"() {
|
|
56
56
|
"use strict";
|
|
57
|
-
VERSION = true ? "0.4.
|
|
57
|
+
VERSION = true ? "0.4.13-alpha.1" : "0.0.0-dev";
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
|
|
@@ -2291,13 +2291,82 @@ var init_banner = __esm({
|
|
|
2291
2291
|
});
|
|
2292
2292
|
|
|
2293
2293
|
// ../core/src/core.types.ts
|
|
2294
|
+
function isStringVariable(v) {
|
|
2295
|
+
return v.type === "string";
|
|
2296
|
+
}
|
|
2297
|
+
function isNumberVariable(v) {
|
|
2298
|
+
return v.type === "number";
|
|
2299
|
+
}
|
|
2300
|
+
function isColorVariable(v) {
|
|
2301
|
+
return v.type === "color";
|
|
2302
|
+
}
|
|
2303
|
+
function isBooleanVariable(v) {
|
|
2304
|
+
return v.type === "boolean";
|
|
2305
|
+
}
|
|
2306
|
+
function isEnumVariable(v) {
|
|
2307
|
+
return v.type === "enum";
|
|
2308
|
+
}
|
|
2309
|
+
function isTextElement(el) {
|
|
2310
|
+
return el.type === "text";
|
|
2311
|
+
}
|
|
2312
|
+
function isMediaElement(el) {
|
|
2313
|
+
return el.type === "video" || el.type === "image" || el.type === "audio";
|
|
2314
|
+
}
|
|
2315
|
+
function isCompositionElement(el) {
|
|
2316
|
+
return el.type === "composition";
|
|
2317
|
+
}
|
|
2318
|
+
function getDefaultStageZoom(resolution) {
|
|
2319
|
+
const { width, height } = CANVAS_DIMENSIONS[resolution];
|
|
2320
|
+
return {
|
|
2321
|
+
scale: 1,
|
|
2322
|
+
focusX: width / 2,
|
|
2323
|
+
focusY: height / 2
|
|
2324
|
+
};
|
|
2325
|
+
}
|
|
2326
|
+
var CANVAS_DIMENSIONS, TIMELINE_COLORS, DEFAULT_DURATIONS;
|
|
2294
2327
|
var init_core_types = __esm({
|
|
2295
2328
|
"../core/src/core.types.ts"() {
|
|
2296
2329
|
"use strict";
|
|
2330
|
+
CANVAS_DIMENSIONS = {
|
|
2331
|
+
landscape: { width: 1920, height: 1080 },
|
|
2332
|
+
portrait: { width: 1080, height: 1920 }
|
|
2333
|
+
};
|
|
2334
|
+
TIMELINE_COLORS = {
|
|
2335
|
+
video: "#ec4899",
|
|
2336
|
+
image: "#3b82f6",
|
|
2337
|
+
text: "#06b6d4",
|
|
2338
|
+
audio: "#10b981",
|
|
2339
|
+
composition: "#f97316"
|
|
2340
|
+
};
|
|
2341
|
+
DEFAULT_DURATIONS = {
|
|
2342
|
+
video: 5,
|
|
2343
|
+
image: 5,
|
|
2344
|
+
text: 2,
|
|
2345
|
+
audio: 5,
|
|
2346
|
+
composition: 5
|
|
2347
|
+
};
|
|
2297
2348
|
}
|
|
2298
2349
|
});
|
|
2299
2350
|
|
|
2300
2351
|
// ../core/src/templates/base.ts
|
|
2352
|
+
function generateBaseHtml(resolution = "portrait") {
|
|
2353
|
+
return `<!DOCTYPE html>
|
|
2354
|
+
<html data-resolution="${resolution}">
|
|
2355
|
+
<head>
|
|
2356
|
+
<meta charset="UTF-8">
|
|
2357
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
2358
|
+
</head>
|
|
2359
|
+
<body>
|
|
2360
|
+
<div id="stage">
|
|
2361
|
+
<div id="stage-zoom-container"></div>
|
|
2362
|
+
</div>
|
|
2363
|
+
</body>
|
|
2364
|
+
</html>`;
|
|
2365
|
+
}
|
|
2366
|
+
function getStageStyles(resolution = "portrait") {
|
|
2367
|
+
const { width, height } = CANVAS_DIMENSIONS[resolution];
|
|
2368
|
+
return `position: relative; width: ${width}px; height: ${height}px; overflow: hidden; background: #000;`;
|
|
2369
|
+
}
|
|
2301
2370
|
var init_base = __esm({
|
|
2302
2371
|
"../core/src/templates/base.ts"() {
|
|
2303
2372
|
"use strict";
|
|
@@ -2306,9 +2375,17 @@ var init_base = __esm({
|
|
|
2306
2375
|
});
|
|
2307
2376
|
|
|
2308
2377
|
// ../core/src/templates/constants.ts
|
|
2378
|
+
var GSAP_CDN, BASE_STYLES, ELEMENT_BASE_STYLES, MEDIA_STYLES, TEXT_STYLES, ZOOM_CONTAINER_STYLES;
|
|
2309
2379
|
var init_constants = __esm({
|
|
2310
2380
|
"../core/src/templates/constants.ts"() {
|
|
2311
2381
|
"use strict";
|
|
2382
|
+
GSAP_CDN = "https://cdn.jsdelivr.net/npm/gsap@3.12.5/dist/gsap.min.js";
|
|
2383
|
+
BASE_STYLES = `* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
2384
|
+
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; display: flex; align-items: center; justify-content: center; }`;
|
|
2385
|
+
ELEMENT_BASE_STYLES = `position: absolute; visibility: hidden;`;
|
|
2386
|
+
MEDIA_STYLES = `width: 100%; height: 100%; object-fit: contain;`;
|
|
2387
|
+
TEXT_STYLES = `display: flex; align-items: center; justify-content: center; font-family: system-ui, -apple-system, sans-serif; font-size: 48px; font-weight: bold; color: white; text-shadow: 2px 2px 4px rgba(0,0,0,0.8); width: 100%; height: 100%;`;
|
|
2388
|
+
ZOOM_CONTAINER_STYLES = `position: absolute; inset: 0; transform-origin: 0 0;`;
|
|
2312
2389
|
}
|
|
2313
2390
|
});
|
|
2314
2391
|
|
|
@@ -2440,10 +2517,145 @@ function parseGsapCall(method, argsStr, idNum) {
|
|
|
2440
2517
|
ease
|
|
2441
2518
|
};
|
|
2442
2519
|
}
|
|
2520
|
+
function serializeGsapAnimations(animations, timelineVar = "tl", options) {
|
|
2521
|
+
const sorted = [...animations].sort((a, b) => a.position - b.position);
|
|
2522
|
+
const lines = sorted.map((anim) => {
|
|
2523
|
+
const selector = `"${anim.targetSelector}"`;
|
|
2524
|
+
const props = { ...anim.properties };
|
|
2525
|
+
if (anim.duration !== void 0) props.duration = anim.duration;
|
|
2526
|
+
if (anim.ease) props.ease = anim.ease;
|
|
2527
|
+
const propsStr = serializeObject(props);
|
|
2528
|
+
switch (anim.method) {
|
|
2529
|
+
case "set":
|
|
2530
|
+
return ` ${timelineVar}.set(${selector}, ${propsStr}, ${anim.position});`;
|
|
2531
|
+
case "to":
|
|
2532
|
+
return ` ${timelineVar}.to(${selector}, ${propsStr}, ${anim.position});`;
|
|
2533
|
+
case "from":
|
|
2534
|
+
return ` ${timelineVar}.from(${selector}, ${propsStr}, ${anim.position});`;
|
|
2535
|
+
case "fromTo": {
|
|
2536
|
+
const fromStr = serializeObject(anim.fromProperties || {});
|
|
2537
|
+
return ` ${timelineVar}.fromTo(${selector}, ${fromStr}, ${propsStr}, ${anim.position});`;
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
});
|
|
2541
|
+
let mediaSync = "";
|
|
2542
|
+
if (options?.includeMediaSync) {
|
|
2543
|
+
mediaSync = `
|
|
2544
|
+
// Sync media playback
|
|
2545
|
+
${timelineVar}.eventCallback("onUpdate", function() {
|
|
2546
|
+
const time = ${timelineVar}.time();
|
|
2547
|
+
document.querySelectorAll("video[data-start], audio[data-start]").forEach(function(media) {
|
|
2548
|
+
const start = parseFloat(media.dataset.start);
|
|
2549
|
+
const end = parseFloat(media.dataset.end) || Infinity;
|
|
2550
|
+
const mediaTime = time - start;
|
|
2551
|
+
if (time >= start && time < end) {
|
|
2552
|
+
if (Math.abs(media.currentTime - mediaTime) > 0.1) {
|
|
2553
|
+
media.currentTime = mediaTime;
|
|
2554
|
+
}
|
|
2555
|
+
if (media.paused && !${timelineVar}.paused()) {
|
|
2556
|
+
media.play().catch(function() {});
|
|
2557
|
+
}
|
|
2558
|
+
} else if (!media.paused) {
|
|
2559
|
+
media.pause();
|
|
2560
|
+
}
|
|
2561
|
+
});
|
|
2562
|
+
});`;
|
|
2563
|
+
}
|
|
2564
|
+
return `
|
|
2565
|
+
const ${timelineVar} = gsap.timeline({ paused: true });
|
|
2566
|
+
${lines.join("\n")}${mediaSync}
|
|
2567
|
+
`;
|
|
2568
|
+
}
|
|
2569
|
+
function serializeObject(obj) {
|
|
2570
|
+
const entries2 = Object.entries(obj).map(([key2, value]) => {
|
|
2571
|
+
if (typeof value === "string") {
|
|
2572
|
+
return `${key2}: "${value}"`;
|
|
2573
|
+
}
|
|
2574
|
+
return `${key2}: ${value}`;
|
|
2575
|
+
});
|
|
2576
|
+
return `{ ${entries2.join(", ")} }`;
|
|
2577
|
+
}
|
|
2578
|
+
function updateAnimationInScript(script, animationId, updates) {
|
|
2579
|
+
const parsed = parseGsapScript(script);
|
|
2580
|
+
const updated = parsed.animations.map((anim) => {
|
|
2581
|
+
if (anim.id === animationId) {
|
|
2582
|
+
return { ...anim, ...updates };
|
|
2583
|
+
}
|
|
2584
|
+
return anim;
|
|
2585
|
+
});
|
|
2586
|
+
return serializeGsapAnimations(updated, parsed.timelineVar);
|
|
2587
|
+
}
|
|
2588
|
+
function addAnimationToScript(script, animation) {
|
|
2589
|
+
const parsed = parseGsapScript(script);
|
|
2590
|
+
const id = `anim-${Date.now()}`;
|
|
2591
|
+
const newAnim = { ...animation, id };
|
|
2592
|
+
parsed.animations.push(newAnim);
|
|
2593
|
+
return {
|
|
2594
|
+
script: serializeGsapAnimations(parsed.animations, parsed.timelineVar),
|
|
2595
|
+
id
|
|
2596
|
+
};
|
|
2597
|
+
}
|
|
2598
|
+
function removeAnimationFromScript(script, animationId) {
|
|
2599
|
+
const parsed = parseGsapScript(script);
|
|
2600
|
+
const filtered = parsed.animations.filter((a) => a.id !== animationId);
|
|
2601
|
+
return serializeGsapAnimations(filtered, parsed.timelineVar);
|
|
2602
|
+
}
|
|
2443
2603
|
function getAnimationsForElement(animations, elementId) {
|
|
2444
2604
|
const selector = `#${elementId}`;
|
|
2445
2605
|
return animations.filter((a) => a.targetSelector === selector);
|
|
2446
2606
|
}
|
|
2607
|
+
function validateCompositionGsap(script) {
|
|
2608
|
+
const errors = [];
|
|
2609
|
+
const warnings = [];
|
|
2610
|
+
for (const { pattern, message } of FORBIDDEN_GSAP_PATTERNS) {
|
|
2611
|
+
if (pattern.test(script)) {
|
|
2612
|
+
errors.push(message);
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
if (/yoyo\s*:\s*true/.test(script)) {
|
|
2616
|
+
warnings.push("yoyo animations may behave unexpectedly when scrubbing");
|
|
2617
|
+
}
|
|
2618
|
+
if (/stagger\s*:/.test(script)) {
|
|
2619
|
+
warnings.push("stagger animations may not serialize correctly");
|
|
2620
|
+
}
|
|
2621
|
+
return {
|
|
2622
|
+
valid: errors.length === 0,
|
|
2623
|
+
errors,
|
|
2624
|
+
warnings
|
|
2625
|
+
};
|
|
2626
|
+
}
|
|
2627
|
+
function keyframesToGsapAnimations(elementId, keyframes, elementStartTime, base) {
|
|
2628
|
+
const sorted = [...keyframes].sort((a, b) => a.time - b.time);
|
|
2629
|
+
const animations = [];
|
|
2630
|
+
const baseX = base?.x ?? 0;
|
|
2631
|
+
const baseY = base?.y ?? 0;
|
|
2632
|
+
const baseScale = base?.scale ?? 1;
|
|
2633
|
+
sorted.forEach((kf, i2) => {
|
|
2634
|
+
const absoluteTime = elementStartTime + kf.time;
|
|
2635
|
+
const isFirst = i2 === 0;
|
|
2636
|
+
const prevKf = i2 > 0 ? sorted[i2 - 1] : null;
|
|
2637
|
+
const duration = prevKf ? kf.time - prevKf.time : void 0;
|
|
2638
|
+
const position = prevKf ? elementStartTime + prevKf.time : absoluteTime;
|
|
2639
|
+
const properties = {};
|
|
2640
|
+
for (const [key2, value] of Object.entries(kf.properties)) {
|
|
2641
|
+
if (typeof value !== "number") continue;
|
|
2642
|
+
if (key2 === "x") properties.x = baseX + value;
|
|
2643
|
+
else if (key2 === "y") properties.y = baseY + value;
|
|
2644
|
+
else if (key2 === "scale") properties.scale = baseScale * value;
|
|
2645
|
+
else properties[key2] = value;
|
|
2646
|
+
}
|
|
2647
|
+
animations.push({
|
|
2648
|
+
id: `${elementId}-kf-${kf.id}`,
|
|
2649
|
+
targetSelector: `#${elementId}`,
|
|
2650
|
+
method: isFirst ? "set" : "to",
|
|
2651
|
+
position,
|
|
2652
|
+
properties,
|
|
2653
|
+
duration: isFirst ? void 0 : duration,
|
|
2654
|
+
ease: kf.ease
|
|
2655
|
+
});
|
|
2656
|
+
});
|
|
2657
|
+
return animations;
|
|
2658
|
+
}
|
|
2447
2659
|
function gsapAnimationsToKeyframes(animations, elementStartTime, options) {
|
|
2448
2660
|
const validMethods = ["set", "to", "from", "fromTo"];
|
|
2449
2661
|
const baseX = options?.baseX ?? 0;
|
|
@@ -2485,7 +2697,7 @@ function gsapAnimationsToKeyframes(animations, elementStartTime, options) {
|
|
|
2485
2697
|
return kf;
|
|
2486
2698
|
}).filter((kf) => kf !== null).sort((a, b) => a.time - b.time);
|
|
2487
2699
|
}
|
|
2488
|
-
var GSAP_METHODS, SUPPORTED_PROPS;
|
|
2700
|
+
var GSAP_METHODS, SUPPORTED_PROPS, SUPPORTED_EASES, FORBIDDEN_GSAP_PATTERNS;
|
|
2489
2701
|
var init_gsapParser = __esm({
|
|
2490
2702
|
"../core/src/parsers/gsapParser.ts"() {
|
|
2491
2703
|
"use strict";
|
|
@@ -2503,6 +2715,74 @@ var init_gsapParser = __esm({
|
|
|
2503
2715
|
"width",
|
|
2504
2716
|
"height"
|
|
2505
2717
|
];
|
|
2718
|
+
SUPPORTED_EASES = [
|
|
2719
|
+
"none",
|
|
2720
|
+
"power1.in",
|
|
2721
|
+
"power1.out",
|
|
2722
|
+
"power1.inOut",
|
|
2723
|
+
"power2.in",
|
|
2724
|
+
"power2.out",
|
|
2725
|
+
"power2.inOut",
|
|
2726
|
+
"power3.in",
|
|
2727
|
+
"power3.out",
|
|
2728
|
+
"power3.inOut",
|
|
2729
|
+
"power4.in",
|
|
2730
|
+
"power4.out",
|
|
2731
|
+
"power4.inOut",
|
|
2732
|
+
"back.in",
|
|
2733
|
+
"back.out",
|
|
2734
|
+
"back.inOut",
|
|
2735
|
+
"elastic.in",
|
|
2736
|
+
"elastic.out",
|
|
2737
|
+
"elastic.inOut",
|
|
2738
|
+
"bounce.in",
|
|
2739
|
+
"bounce.out",
|
|
2740
|
+
"bounce.inOut",
|
|
2741
|
+
"expo.in",
|
|
2742
|
+
"expo.out",
|
|
2743
|
+
"expo.inOut"
|
|
2744
|
+
];
|
|
2745
|
+
FORBIDDEN_GSAP_PATTERNS = [
|
|
2746
|
+
{ pattern: /\.call\s*\(/, message: "call() method not allowed" },
|
|
2747
|
+
{
|
|
2748
|
+
pattern: /\.add\s*\(\s*function/,
|
|
2749
|
+
message: "add(function) not allowed"
|
|
2750
|
+
},
|
|
2751
|
+
{
|
|
2752
|
+
pattern: /\.add\s*\(\s*\(/,
|
|
2753
|
+
message: "add() with arrow function not allowed"
|
|
2754
|
+
},
|
|
2755
|
+
{ pattern: /onComplete\s*:/, message: "onComplete callback not allowed" },
|
|
2756
|
+
{ pattern: /onStart\s*:/, message: "onStart callback not allowed" },
|
|
2757
|
+
{ pattern: /onUpdate\s*:/, message: "onUpdate callback not allowed" },
|
|
2758
|
+
{
|
|
2759
|
+
pattern: /onRepeat\s*:/,
|
|
2760
|
+
message: "onRepeat callback not allowed"
|
|
2761
|
+
},
|
|
2762
|
+
{
|
|
2763
|
+
pattern: /onReverseComplete\s*:/,
|
|
2764
|
+
message: "onReverseComplete callback not allowed"
|
|
2765
|
+
},
|
|
2766
|
+
{
|
|
2767
|
+
pattern: /repeat\s*:\s*-1/,
|
|
2768
|
+
message: "Infinite repeat (repeat: -1) not allowed"
|
|
2769
|
+
},
|
|
2770
|
+
{
|
|
2771
|
+
pattern: /Math\.random\s*\(/,
|
|
2772
|
+
message: "Random values (Math.random) not allowed"
|
|
2773
|
+
},
|
|
2774
|
+
{
|
|
2775
|
+
pattern: /Date\.now\s*\(/,
|
|
2776
|
+
message: "Date-dependent values (Date.now) not allowed"
|
|
2777
|
+
},
|
|
2778
|
+
{ pattern: /new\s+Date\s*\(/, message: "Date constructor not allowed" },
|
|
2779
|
+
{ pattern: /setTimeout\s*\(/, message: "setTimeout not allowed" },
|
|
2780
|
+
{ pattern: /setInterval\s*\(/, message: "setInterval not allowed" },
|
|
2781
|
+
{
|
|
2782
|
+
pattern: /requestAnimationFrame\s*\(/,
|
|
2783
|
+
message: "requestAnimationFrame not allowed"
|
|
2784
|
+
}
|
|
2785
|
+
];
|
|
2506
2786
|
}
|
|
2507
2787
|
});
|
|
2508
2788
|
|
|
@@ -2908,6 +3188,241 @@ function normalizeKeyframes(keyframes, baseX, baseY, baseScale) {
|
|
|
2908
3188
|
};
|
|
2909
3189
|
});
|
|
2910
3190
|
}
|
|
3191
|
+
function updateElementInHtml(html, elementId, updates) {
|
|
3192
|
+
const parser = new DOMParser();
|
|
3193
|
+
const doc = parser.parseFromString(html, "text/html");
|
|
3194
|
+
const el = doc.getElementById(elementId) || doc.querySelector(`[data-name="${elementId}"]`);
|
|
3195
|
+
if (!el) return html;
|
|
3196
|
+
if (updates.startTime !== void 0) {
|
|
3197
|
+
el.setAttribute("data-start", String(updates.startTime));
|
|
3198
|
+
if (el.hasAttribute("data-end") && updates.duration !== void 0) {
|
|
3199
|
+
el.setAttribute("data-end", String(updates.startTime + updates.duration));
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
if (updates.duration !== void 0) {
|
|
3203
|
+
const start = parseFloat(el.getAttribute("data-start") || "0");
|
|
3204
|
+
el.setAttribute("data-end", String(start + updates.duration));
|
|
3205
|
+
el.removeAttribute("data-duration");
|
|
3206
|
+
}
|
|
3207
|
+
if (updates.name !== void 0) {
|
|
3208
|
+
el.setAttribute("data-name", updates.name);
|
|
3209
|
+
}
|
|
3210
|
+
if (updates.zIndex !== void 0) {
|
|
3211
|
+
el.setAttribute("data-layer", String(updates.zIndex));
|
|
3212
|
+
}
|
|
3213
|
+
if ("src" in updates && updates.src !== void 0) {
|
|
3214
|
+
el.setAttribute("src", updates.src);
|
|
3215
|
+
}
|
|
3216
|
+
if ("content" in updates && updates.content !== void 0) {
|
|
3217
|
+
const textEl = el.firstElementChild;
|
|
3218
|
+
if (textEl) {
|
|
3219
|
+
textEl.textContent = updates.content;
|
|
3220
|
+
}
|
|
3221
|
+
}
|
|
3222
|
+
if ("color" in updates && updates.color !== void 0) {
|
|
3223
|
+
el.setAttribute("data-color", updates.color);
|
|
3224
|
+
}
|
|
3225
|
+
if ("fontSize" in updates && updates.fontSize !== void 0) {
|
|
3226
|
+
el.setAttribute("data-font-size", String(updates.fontSize));
|
|
3227
|
+
}
|
|
3228
|
+
if ("textShadow" in updates) {
|
|
3229
|
+
if (updates.textShadow === false) {
|
|
3230
|
+
el.setAttribute("data-text-shadow", "false");
|
|
3231
|
+
} else {
|
|
3232
|
+
el.removeAttribute("data-text-shadow");
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
if ("volume" in updates) {
|
|
3236
|
+
if (updates.volume !== void 0 && updates.volume !== 1) {
|
|
3237
|
+
el.setAttribute("data-volume", String(updates.volume));
|
|
3238
|
+
} else {
|
|
3239
|
+
el.removeAttribute("data-volume");
|
|
3240
|
+
}
|
|
3241
|
+
}
|
|
3242
|
+
if ("hasAudio" in updates) {
|
|
3243
|
+
if (updates.hasAudio === true) {
|
|
3244
|
+
el.setAttribute("data-has-audio", "true");
|
|
3245
|
+
} else {
|
|
3246
|
+
el.removeAttribute("data-has-audio");
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
return "<!DOCTYPE html>\n" + doc.documentElement.outerHTML;
|
|
3250
|
+
}
|
|
3251
|
+
function addElementToHtml(html, element) {
|
|
3252
|
+
const parser = new DOMParser();
|
|
3253
|
+
const doc = parser.parseFromString(html, "text/html");
|
|
3254
|
+
const container = doc.querySelector("#stage-zoom-container") || doc.querySelector(".container") || doc.querySelector("#stage") || doc.body;
|
|
3255
|
+
const id = element.id || `element-${Date.now()}`;
|
|
3256
|
+
let newEl;
|
|
3257
|
+
switch (element.type) {
|
|
3258
|
+
case "video": {
|
|
3259
|
+
const mediaEl = element;
|
|
3260
|
+
newEl = doc.createElement("video");
|
|
3261
|
+
newEl.setAttribute("muted", "");
|
|
3262
|
+
newEl.setAttribute("playsinline", "");
|
|
3263
|
+
if (mediaEl.src) newEl.setAttribute("src", mediaEl.src);
|
|
3264
|
+
if (mediaEl.volume !== void 0 && mediaEl.volume !== 1) {
|
|
3265
|
+
newEl.setAttribute("data-volume", String(mediaEl.volume));
|
|
3266
|
+
}
|
|
3267
|
+
if (mediaEl.hasAudio) {
|
|
3268
|
+
newEl.setAttribute("data-has-audio", "true");
|
|
3269
|
+
}
|
|
3270
|
+
break;
|
|
3271
|
+
}
|
|
3272
|
+
case "image": {
|
|
3273
|
+
const mediaEl = element;
|
|
3274
|
+
newEl = doc.createElement("img");
|
|
3275
|
+
if (mediaEl.src) newEl.setAttribute("src", mediaEl.src);
|
|
3276
|
+
newEl.setAttribute("alt", element.name);
|
|
3277
|
+
break;
|
|
3278
|
+
}
|
|
3279
|
+
case "audio": {
|
|
3280
|
+
const mediaEl = element;
|
|
3281
|
+
newEl = doc.createElement("audio");
|
|
3282
|
+
if (mediaEl.src) newEl.setAttribute("src", mediaEl.src);
|
|
3283
|
+
if (mediaEl.volume !== void 0 && mediaEl.volume !== 1) {
|
|
3284
|
+
newEl.setAttribute("data-volume", String(mediaEl.volume));
|
|
3285
|
+
}
|
|
3286
|
+
break;
|
|
3287
|
+
}
|
|
3288
|
+
case "text":
|
|
3289
|
+
default: {
|
|
3290
|
+
const textEl = element;
|
|
3291
|
+
newEl = doc.createElement("div");
|
|
3292
|
+
const textContent2 = doc.createElement("div");
|
|
3293
|
+
textContent2.textContent = textEl.content || element.name;
|
|
3294
|
+
newEl.appendChild(textContent2);
|
|
3295
|
+
if (textEl.color) {
|
|
3296
|
+
newEl.setAttribute("data-color", textEl.color);
|
|
3297
|
+
}
|
|
3298
|
+
if (textEl.fontSize) {
|
|
3299
|
+
newEl.setAttribute("data-font-size", String(textEl.fontSize));
|
|
3300
|
+
}
|
|
3301
|
+
break;
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3304
|
+
newEl.id = id;
|
|
3305
|
+
newEl.setAttribute("data-start", String(element.startTime));
|
|
3306
|
+
newEl.setAttribute("data-end", String(element.startTime + element.duration));
|
|
3307
|
+
newEl.setAttribute("data-layer", String(element.zIndex));
|
|
3308
|
+
newEl.setAttribute("data-name", element.name);
|
|
3309
|
+
container.appendChild(newEl);
|
|
3310
|
+
return {
|
|
3311
|
+
html: "<!DOCTYPE html>\n" + doc.documentElement.outerHTML,
|
|
3312
|
+
id
|
|
3313
|
+
};
|
|
3314
|
+
}
|
|
3315
|
+
function removeElementFromHtml(html, elementId) {
|
|
3316
|
+
const parser = new DOMParser();
|
|
3317
|
+
const doc = parser.parseFromString(html, "text/html");
|
|
3318
|
+
const el = doc.getElementById(elementId);
|
|
3319
|
+
if (el) {
|
|
3320
|
+
el.remove();
|
|
3321
|
+
}
|
|
3322
|
+
return "<!DOCTYPE html>\n" + doc.documentElement.outerHTML;
|
|
3323
|
+
}
|
|
3324
|
+
function extractCompositionMetadata(html) {
|
|
3325
|
+
const parser = new DOMParser();
|
|
3326
|
+
const doc = parser.parseFromString(html, "text/html");
|
|
3327
|
+
const htmlEl = doc.documentElement;
|
|
3328
|
+
const compositionId = htmlEl.getAttribute("data-composition-id");
|
|
3329
|
+
const durationStr = htmlEl.getAttribute("data-composition-duration");
|
|
3330
|
+
const compositionDuration = durationStr ? parseFloat(durationStr) : null;
|
|
3331
|
+
const variables = parseCompositionVariables(htmlEl);
|
|
3332
|
+
return {
|
|
3333
|
+
compositionId,
|
|
3334
|
+
compositionDuration: compositionDuration && isFinite(compositionDuration) ? compositionDuration : null,
|
|
3335
|
+
variables
|
|
3336
|
+
};
|
|
3337
|
+
}
|
|
3338
|
+
function parseCompositionVariables(htmlEl) {
|
|
3339
|
+
const variablesAttr = htmlEl.getAttribute("data-composition-variables");
|
|
3340
|
+
if (!variablesAttr) {
|
|
3341
|
+
return [];
|
|
3342
|
+
}
|
|
3343
|
+
try {
|
|
3344
|
+
const parsed = JSON.parse(variablesAttr);
|
|
3345
|
+
if (!Array.isArray(parsed)) {
|
|
3346
|
+
return [];
|
|
3347
|
+
}
|
|
3348
|
+
return parsed.filter((v) => {
|
|
3349
|
+
if (typeof v !== "object" || v === null) return false;
|
|
3350
|
+
if (typeof v.id !== "string" || typeof v.label !== "string") return false;
|
|
3351
|
+
if (!["string", "number", "color", "boolean", "enum"].includes(v.type)) return false;
|
|
3352
|
+
switch (v.type) {
|
|
3353
|
+
case "string":
|
|
3354
|
+
return typeof v.default === "string";
|
|
3355
|
+
case "number":
|
|
3356
|
+
return typeof v.default === "number";
|
|
3357
|
+
case "color":
|
|
3358
|
+
return typeof v.default === "string";
|
|
3359
|
+
case "boolean":
|
|
3360
|
+
return typeof v.default === "boolean";
|
|
3361
|
+
case "enum":
|
|
3362
|
+
return typeof v.default === "string" && Array.isArray(v.options);
|
|
3363
|
+
default:
|
|
3364
|
+
return false;
|
|
3365
|
+
}
|
|
3366
|
+
});
|
|
3367
|
+
} catch {
|
|
3368
|
+
return [];
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
function validateCompositionHtml(html) {
|
|
3372
|
+
const errors = [];
|
|
3373
|
+
const warnings = [];
|
|
3374
|
+
const parser = new DOMParser();
|
|
3375
|
+
const doc = parser.parseFromString(html, "text/html");
|
|
3376
|
+
const htmlEl = doc.documentElement;
|
|
3377
|
+
const compositionId = htmlEl.getAttribute("data-composition-id");
|
|
3378
|
+
if (!compositionId) {
|
|
3379
|
+
errors.push("Missing data-composition-id attribute on <html> element");
|
|
3380
|
+
}
|
|
3381
|
+
const durationStr = htmlEl.getAttribute("data-composition-duration");
|
|
3382
|
+
if (!durationStr) {
|
|
3383
|
+
errors.push("Missing data-composition-duration attribute on <html> element");
|
|
3384
|
+
} else {
|
|
3385
|
+
const duration = parseFloat(durationStr);
|
|
3386
|
+
if (!isFinite(duration) || duration <= 0) {
|
|
3387
|
+
errors.push("data-composition-duration must be a positive finite number");
|
|
3388
|
+
}
|
|
3389
|
+
}
|
|
3390
|
+
const stage = doc.getElementById("stage");
|
|
3391
|
+
if (!stage) {
|
|
3392
|
+
errors.push("Missing #stage element");
|
|
3393
|
+
}
|
|
3394
|
+
if (/\son\w+\s*=/i.test(html)) {
|
|
3395
|
+
errors.push("Inline event handlers (onclick, onload, etc.) not allowed");
|
|
3396
|
+
}
|
|
3397
|
+
if (/javascript\s*:/i.test(html)) {
|
|
3398
|
+
errors.push("javascript: URLs not allowed");
|
|
3399
|
+
}
|
|
3400
|
+
const scripts = doc.querySelectorAll("script");
|
|
3401
|
+
if (scripts.length > 2) {
|
|
3402
|
+
warnings.push("Multiple script tags detected - only GSAP CDN and main script expected");
|
|
3403
|
+
}
|
|
3404
|
+
const gsapScript = extractGsapScript(doc);
|
|
3405
|
+
if (gsapScript) {
|
|
3406
|
+
const gsapValidation = validateCompositionGsap(gsapScript);
|
|
3407
|
+
errors.push(...gsapValidation.errors);
|
|
3408
|
+
warnings.push(...gsapValidation.warnings);
|
|
3409
|
+
}
|
|
3410
|
+
return {
|
|
3411
|
+
valid: errors.length === 0,
|
|
3412
|
+
errors,
|
|
3413
|
+
warnings
|
|
3414
|
+
};
|
|
3415
|
+
}
|
|
3416
|
+
function extractGsapScript(doc) {
|
|
3417
|
+
const scripts = doc.querySelectorAll("script");
|
|
3418
|
+
for (const script of scripts) {
|
|
3419
|
+
const content = script.textContent || "";
|
|
3420
|
+
if (content.includes("gsap.timeline") || content.includes(".set(") || content.includes(".to(")) {
|
|
3421
|
+
return content;
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
return null;
|
|
3425
|
+
}
|
|
2911
3426
|
var MEDIA_TYPES;
|
|
2912
3427
|
var init_htmlParser = __esm({
|
|
2913
3428
|
"../core/src/parsers/htmlParser.ts"() {
|
|
@@ -2919,12 +3434,519 @@ var init_htmlParser = __esm({
|
|
|
2919
3434
|
});
|
|
2920
3435
|
|
|
2921
3436
|
// ../core/src/generators/hyperframes.ts
|
|
3437
|
+
function generateGoogleFontsUrl(fontFamilies) {
|
|
3438
|
+
if (fontFamilies.length === 0) return null;
|
|
3439
|
+
const families = fontFamilies.filter((f3) => f3 in FONT_WEIGHTS).map((f3) => {
|
|
3440
|
+
const weights = FONT_WEIGHTS[f3];
|
|
3441
|
+
const encodedName = f3.replace(/ /g, "+");
|
|
3442
|
+
return `family=${encodedName}:wght@${weights}`;
|
|
3443
|
+
});
|
|
3444
|
+
if (families.length === 0) return null;
|
|
3445
|
+
return `${GOOGLE_FONTS_BASE}?${families.join("&")}&display=swap`;
|
|
3446
|
+
}
|
|
3447
|
+
function sortElements(elements) {
|
|
3448
|
+
return [...elements].sort((a, b) => {
|
|
3449
|
+
if (a.zIndex !== b.zIndex) {
|
|
3450
|
+
return (a.zIndex ?? 0) - (b.zIndex ?? 0);
|
|
3451
|
+
}
|
|
3452
|
+
return a.startTime - b.startTime;
|
|
3453
|
+
});
|
|
3454
|
+
}
|
|
3455
|
+
function generateHyperframesStyles(elements, resolution, customStyles) {
|
|
3456
|
+
const { width, height } = CANVAS_DIMENSIONS[resolution];
|
|
3457
|
+
const sortedElements = sortElements(elements);
|
|
3458
|
+
const elementStyles = sortedElements.map((el) => generateElementStyles(el)).join("\n");
|
|
3459
|
+
const usedFonts = /* @__PURE__ */ new Set();
|
|
3460
|
+
for (const el of sortedElements) {
|
|
3461
|
+
if (isTextElement(el) && el.fontFamily) {
|
|
3462
|
+
usedFonts.add(el.fontFamily);
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
usedFonts.add("Inter");
|
|
3466
|
+
const googleFontsUrl = generateGoogleFontsUrl([...usedFonts]);
|
|
3467
|
+
const googleFontsLink = googleFontsUrl ? `<link data-hf-fonts="true" rel="preconnect" href="https://fonts.googleapis.com">
|
|
3468
|
+
<link data-hf-fonts="true" rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
3469
|
+
<link data-hf-fonts="true" href="${googleFontsUrl}" rel="stylesheet">` : "";
|
|
3470
|
+
const coreCss = `${BASE_STYLES}
|
|
3471
|
+
#stage { position: relative; width: ${width}px; height: ${height}px; overflow: hidden; background: #fff; }
|
|
3472
|
+
#stage-zoom-container { ${ZOOM_CONTAINER_STYLES} }
|
|
3473
|
+
${elementStyles}`.trim();
|
|
3474
|
+
const customCss = customStyles?.trim() ? customStyles.trim() : "";
|
|
3475
|
+
return { coreCss, customCss, googleFontsLink };
|
|
3476
|
+
}
|
|
3477
|
+
function generateElementStyles(element) {
|
|
3478
|
+
const baseStyles = "position: absolute;";
|
|
3479
|
+
if (isTextElement(element)) {
|
|
3480
|
+
const fontSize = element.fontSize ?? 48;
|
|
3481
|
+
const fontWeight = element.fontWeight ?? 700;
|
|
3482
|
+
const fontFamily = element.fontFamily ?? "Inter";
|
|
3483
|
+
const color = element.color ?? "white";
|
|
3484
|
+
const textShadow = element.textShadow !== false ? "text-shadow: 2px 2px 4px rgba(0,0,0,0.8);" : "";
|
|
3485
|
+
const textOutline = element.textOutline ? `-webkit-text-stroke: ${element.textOutlineWidth ?? 2}px ${element.textOutlineColor ?? "#000000"}; paint-order: stroke fill;` : "";
|
|
3486
|
+
const textHighlight = element.textHighlight ? `background-color: ${element.textHighlightColor ?? "yellow"}; padding: ${element.textHighlightPadding ?? 4}px ${(element.textHighlightPadding ?? 4) * 1.5}px; border-radius: ${element.textHighlightRadius ?? 4}px; box-decoration-break: clone; -webkit-box-decoration-break: clone;` : "";
|
|
3487
|
+
return ` #${element.id} { ${baseStyles} width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; pointer-events: none; }
|
|
3488
|
+
#${element.id} > div { font-family: '${fontFamily}', sans-serif; font-size: ${fontSize}px; font-weight: ${fontWeight}; color: ${color}; ${textShadow} ${textOutline} ${textHighlight} pointer-events: auto; cursor: grab; white-space: pre-wrap; text-align: center; }`;
|
|
3489
|
+
}
|
|
3490
|
+
switch (element.type) {
|
|
3491
|
+
case "video":
|
|
3492
|
+
return ` #${element.id} { ${baseStyles} width: 100%; height: 100%; object-fit: contain; transform-origin: center center; }`;
|
|
3493
|
+
case "image":
|
|
3494
|
+
return ` #${element.id} { ${baseStyles} max-width: 100%; max-height: 100%; transform-origin: center center; }`;
|
|
3495
|
+
case "audio":
|
|
3496
|
+
return ` #${element.id} { ${baseStyles} }`;
|
|
3497
|
+
case "composition":
|
|
3498
|
+
return ` #${element.id} { ${baseStyles} width: 100%; height: 100%; position: absolute; }`;
|
|
3499
|
+
}
|
|
3500
|
+
}
|
|
3501
|
+
function generateGsapTimelineScript(elements, totalDuration, options = {}) {
|
|
3502
|
+
const {
|
|
3503
|
+
animations,
|
|
3504
|
+
generateDefaultAnimations = true,
|
|
3505
|
+
resolution = "landscape",
|
|
3506
|
+
keyframes,
|
|
3507
|
+
stageZoomKeyframes
|
|
3508
|
+
} = options;
|
|
3509
|
+
const { width, height } = CANVAS_DIMENSIONS[resolution];
|
|
3510
|
+
const sortedElements = sortElements(elements);
|
|
3511
|
+
const hasMedia = sortedElements.some((el) => el.type === "video" || el.type === "audio");
|
|
3512
|
+
let keyframeAnimations = [];
|
|
3513
|
+
if (keyframes) {
|
|
3514
|
+
for (const element of sortedElements) {
|
|
3515
|
+
const elementKeyframes = keyframes[element.id];
|
|
3516
|
+
if (elementKeyframes && elementKeyframes.length > 0) {
|
|
3517
|
+
const baseScale = isMediaElement(element) || isCompositionElement(element) ? element.scale ?? 1 : 1;
|
|
3518
|
+
const converted = keyframesToGsapAnimations(
|
|
3519
|
+
element.id,
|
|
3520
|
+
elementKeyframes,
|
|
3521
|
+
element.startTime,
|
|
3522
|
+
{
|
|
3523
|
+
x: element.x ?? 0,
|
|
3524
|
+
y: element.y ?? 0,
|
|
3525
|
+
scale: baseScale
|
|
3526
|
+
}
|
|
3527
|
+
);
|
|
3528
|
+
keyframeAnimations = keyframeAnimations.concat(converted);
|
|
3529
|
+
}
|
|
3530
|
+
}
|
|
3531
|
+
}
|
|
3532
|
+
const zoomAnimations = generateZoomGsapAnimations(stageZoomKeyframes || [], width, height);
|
|
3533
|
+
const initialPositionSets = generateInitialPositionSets(sortedElements, keyframes);
|
|
3534
|
+
const visibilityAnimations = generateVisibilityForElementsWithoutKeyframes(
|
|
3535
|
+
sortedElements,
|
|
3536
|
+
keyframes
|
|
3537
|
+
);
|
|
3538
|
+
let gsapScript;
|
|
3539
|
+
if (animations && animations.length > 0) {
|
|
3540
|
+
const allAnimations = [...animations, ...keyframeAnimations];
|
|
3541
|
+
gsapScript = serializeGsapAnimations(allAnimations, "tl", {
|
|
3542
|
+
includeMediaSync: hasMedia
|
|
3543
|
+
});
|
|
3544
|
+
const prependAnimations = [initialPositionSets, visibilityAnimations].filter(Boolean).join("\n");
|
|
3545
|
+
if (prependAnimations) {
|
|
3546
|
+
gsapScript = gsapScript.replace(
|
|
3547
|
+
"const tl = gsap.timeline({ paused: true });",
|
|
3548
|
+
`const tl = gsap.timeline({ paused: true });
|
|
3549
|
+
${prependAnimations}`
|
|
3550
|
+
);
|
|
3551
|
+
}
|
|
3552
|
+
if (zoomAnimations) {
|
|
3553
|
+
gsapScript += "\n" + zoomAnimations;
|
|
3554
|
+
}
|
|
3555
|
+
} else if (keyframeAnimations.length > 0) {
|
|
3556
|
+
gsapScript = serializeGsapAnimations(keyframeAnimations, "tl", {
|
|
3557
|
+
includeMediaSync: hasMedia
|
|
3558
|
+
});
|
|
3559
|
+
const prependAnimations = [initialPositionSets, visibilityAnimations].filter(Boolean).join("\n");
|
|
3560
|
+
if (prependAnimations) {
|
|
3561
|
+
gsapScript = gsapScript.replace(
|
|
3562
|
+
"const tl = gsap.timeline({ paused: true });",
|
|
3563
|
+
`const tl = gsap.timeline({ paused: true });
|
|
3564
|
+
${prependAnimations}`
|
|
3565
|
+
);
|
|
3566
|
+
}
|
|
3567
|
+
if (zoomAnimations) {
|
|
3568
|
+
gsapScript += "\n" + zoomAnimations;
|
|
3569
|
+
}
|
|
3570
|
+
} else if (generateDefaultAnimations) {
|
|
3571
|
+
gsapScript = generateDefaultGsapAnimations(
|
|
3572
|
+
sortedElements,
|
|
3573
|
+
totalDuration,
|
|
3574
|
+
stageZoomKeyframes,
|
|
3575
|
+
width,
|
|
3576
|
+
height
|
|
3577
|
+
);
|
|
3578
|
+
} else {
|
|
3579
|
+
gsapScript = `
|
|
3580
|
+
const tl = gsap.timeline({ paused: true });
|
|
3581
|
+
${initialPositionSets ? initialPositionSets + "\n" : ""} tl.to({}, { duration: ${totalDuration || 1} });
|
|
3582
|
+
`;
|
|
3583
|
+
if (zoomAnimations) {
|
|
3584
|
+
gsapScript += "\n" + zoomAnimations;
|
|
3585
|
+
}
|
|
3586
|
+
}
|
|
3587
|
+
return gsapScript;
|
|
3588
|
+
}
|
|
3589
|
+
function generateHyperframesHtml(elements, totalDuration, options = {}) {
|
|
3590
|
+
const {
|
|
3591
|
+
animations,
|
|
3592
|
+
styles,
|
|
3593
|
+
generateDefaultAnimations = true,
|
|
3594
|
+
resolution = "landscape",
|
|
3595
|
+
compositionId = `comp-${Date.now()}`,
|
|
3596
|
+
keyframes,
|
|
3597
|
+
stageZoomKeyframes,
|
|
3598
|
+
includeScripts = false,
|
|
3599
|
+
includeStyles = false
|
|
3600
|
+
} = options;
|
|
3601
|
+
const maxZoomTime = stageZoomKeyframes && stageZoomKeyframes.length > 0 ? Math.max(...stageZoomKeyframes.map((kf) => kf.time)) : 0;
|
|
3602
|
+
const calculatedDuration = elements.length > 0 ? Math.max(...elements.map((el) => el.startTime + el.duration), totalDuration, maxZoomTime) : Math.max(totalDuration, maxZoomTime);
|
|
3603
|
+
const sortedElements = sortElements(elements);
|
|
3604
|
+
const elementsHtml = sortedElements.map((el) => generateElementHtml(el, keyframes?.[el.id])).join("\n ");
|
|
3605
|
+
const customStyles = styles || "";
|
|
3606
|
+
const zoomKeyframesAttr = stageZoomKeyframes && stageZoomKeyframes.length > 0 ? ` data-zoom-keyframes='${JSON.stringify(stageZoomKeyframes).replace(/'/g, "'")}'` : "";
|
|
3607
|
+
const { coreCss, customCss, googleFontsLink } = generateHyperframesStyles(
|
|
3608
|
+
sortedElements,
|
|
3609
|
+
resolution,
|
|
3610
|
+
customStyles
|
|
3611
|
+
);
|
|
3612
|
+
const gsapScript = includeScripts ? generateGsapTimelineScript(sortedElements, totalDuration, {
|
|
3613
|
+
animations,
|
|
3614
|
+
generateDefaultAnimations,
|
|
3615
|
+
resolution,
|
|
3616
|
+
keyframes,
|
|
3617
|
+
stageZoomKeyframes
|
|
3618
|
+
}) : "";
|
|
3619
|
+
const gsapCdnTag = includeScripts ? ` <script src="${GSAP_CDN}"></script>` : "";
|
|
3620
|
+
const gsapScriptTag = includeScripts ? ` <script>
|
|
3621
|
+
${gsapScript}
|
|
3622
|
+
</script>` : "";
|
|
3623
|
+
const styleTags = includeStyles ? [
|
|
3624
|
+
coreCss ? ` <style data-hf-core="true">
|
|
3625
|
+
${coreCss.split("\n").join("\n ")}
|
|
3626
|
+
</style>` : "",
|
|
3627
|
+
customCss ? ` <style data-hf-custom="true">
|
|
3628
|
+
${customCss.split("\n").join("\n ")}
|
|
3629
|
+
</style>` : ""
|
|
3630
|
+
].filter(Boolean).join("\n") : "";
|
|
3631
|
+
const customStylesAttr = customStyles ? ` data-custom-styles='${JSON.stringify(customStyles).replace(/'/g, "'")}'` : "";
|
|
3632
|
+
const resolutionAttr = ` data-resolution="${resolution}"`;
|
|
3633
|
+
return `<!DOCTYPE html>
|
|
3634
|
+
<html data-composition-id="${compositionId}" data-composition-duration="${calculatedDuration}"${resolutionAttr}${customStylesAttr}>
|
|
3635
|
+
<head>
|
|
3636
|
+
<meta charset="UTF-8">
|
|
3637
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3638
|
+
${includeStyles ? googleFontsLink : ""}
|
|
3639
|
+
${gsapCdnTag}
|
|
3640
|
+
${styleTags ? ` ${styleTags}` : ""}
|
|
3641
|
+
</head>
|
|
3642
|
+
<body>
|
|
3643
|
+
<div id="stage">
|
|
3644
|
+
<div id="stage-zoom-container"${zoomKeyframesAttr}>
|
|
3645
|
+
${elementsHtml}
|
|
3646
|
+
</div>
|
|
3647
|
+
</div>
|
|
3648
|
+
${gsapScriptTag}
|
|
3649
|
+
</body>
|
|
3650
|
+
</html>`;
|
|
3651
|
+
}
|
|
3652
|
+
function calculateZoomTransform(scale, focusX, focusY, canvasWidth, canvasHeight) {
|
|
3653
|
+
const centerX = canvasWidth / 2;
|
|
3654
|
+
const centerY = canvasHeight / 2;
|
|
3655
|
+
const x4 = centerX - focusX * scale;
|
|
3656
|
+
const y2 = centerY - focusY * scale;
|
|
3657
|
+
return { x: x4, y: y2 };
|
|
3658
|
+
}
|
|
3659
|
+
function generateZoomGsapAnimations(zoomKeyframes, canvasWidth, canvasHeight) {
|
|
3660
|
+
if (!zoomKeyframes || zoomKeyframes.length === 0) {
|
|
3661
|
+
return "";
|
|
3662
|
+
}
|
|
3663
|
+
const sortedKeyframes = [...zoomKeyframes].sort((a, b) => a.time - b.time);
|
|
3664
|
+
const animations = [];
|
|
3665
|
+
animations.push(" // Stage zoom animations");
|
|
3666
|
+
for (let i2 = 0; i2 < sortedKeyframes.length; i2++) {
|
|
3667
|
+
const kf = sortedKeyframes[i2];
|
|
3668
|
+
if (!kf) continue;
|
|
3669
|
+
const { x: x4, y: y2 } = calculateZoomTransform(
|
|
3670
|
+
kf.zoom.scale,
|
|
3671
|
+
kf.zoom.focusX,
|
|
3672
|
+
kf.zoom.focusY,
|
|
3673
|
+
canvasWidth,
|
|
3674
|
+
canvasHeight
|
|
3675
|
+
);
|
|
3676
|
+
if (i2 === 0) {
|
|
3677
|
+
animations.push(
|
|
3678
|
+
` tl.set("#stage-zoom-container", { scale: ${kf.zoom.scale}, x: ${x4}, y: ${y2} }, ${kf.time});`
|
|
3679
|
+
);
|
|
3680
|
+
} else {
|
|
3681
|
+
const prevKf = sortedKeyframes[i2 - 1];
|
|
3682
|
+
if (!prevKf) continue;
|
|
3683
|
+
const duration = kf.time - prevKf.time;
|
|
3684
|
+
const ease = kf.ease ? `, ease: "${kf.ease}"` : "";
|
|
3685
|
+
animations.push(
|
|
3686
|
+
` tl.to("#stage-zoom-container", { scale: ${kf.zoom.scale}, x: ${x4}, y: ${y2}, duration: ${duration}${ease} }, ${prevKf.time});`
|
|
3687
|
+
);
|
|
3688
|
+
}
|
|
3689
|
+
}
|
|
3690
|
+
return animations.join("\n");
|
|
3691
|
+
}
|
|
3692
|
+
function generateElementHtml(element, keyframes) {
|
|
3693
|
+
const baseAttrs = [
|
|
3694
|
+
`id="${element.id}"`,
|
|
3695
|
+
`data-start="${element.startTime}"`,
|
|
3696
|
+
`data-end="${element.startTime + element.duration}"`,
|
|
3697
|
+
`data-layer="${element.zIndex}"`,
|
|
3698
|
+
`data-name="${element.name}"`
|
|
3699
|
+
];
|
|
3700
|
+
if (element.x !== void 0 && element.x !== 0) {
|
|
3701
|
+
baseAttrs.push(`data-x="${element.x}"`);
|
|
3702
|
+
}
|
|
3703
|
+
if (element.y !== void 0 && element.y !== 0) {
|
|
3704
|
+
baseAttrs.push(`data-y="${element.y}"`);
|
|
3705
|
+
}
|
|
3706
|
+
if (element.scale !== void 0 && element.scale !== 1) {
|
|
3707
|
+
baseAttrs.push(`data-scale="${element.scale}"`);
|
|
3708
|
+
}
|
|
3709
|
+
if (element.opacity !== void 0 && element.opacity !== 1) {
|
|
3710
|
+
baseAttrs.push(`data-opacity="${element.opacity}"`);
|
|
3711
|
+
}
|
|
3712
|
+
if (keyframes && keyframes.length > 0) {
|
|
3713
|
+
const kfJson = JSON.stringify(keyframes);
|
|
3714
|
+
baseAttrs.push(`data-keyframes='${kfJson.replace(/'/g, "'")}'`);
|
|
3715
|
+
}
|
|
3716
|
+
if (isTextElement(element)) {
|
|
3717
|
+
const textAttrs = [...baseAttrs, `data-type="text"`];
|
|
3718
|
+
if (element.color) {
|
|
3719
|
+
textAttrs.push(`data-color="${element.color}"`);
|
|
3720
|
+
}
|
|
3721
|
+
if (element.fontSize) {
|
|
3722
|
+
textAttrs.push(`data-font-size="${element.fontSize}"`);
|
|
3723
|
+
}
|
|
3724
|
+
if (element.fontWeight) {
|
|
3725
|
+
textAttrs.push(`data-font-weight="${element.fontWeight}"`);
|
|
3726
|
+
}
|
|
3727
|
+
if (element.fontFamily) {
|
|
3728
|
+
textAttrs.push(`data-font-family="${element.fontFamily}"`);
|
|
3729
|
+
}
|
|
3730
|
+
if (element.textShadow === false) {
|
|
3731
|
+
textAttrs.push(`data-text-shadow="false"`);
|
|
3732
|
+
}
|
|
3733
|
+
if (element.textOutline) {
|
|
3734
|
+
textAttrs.push(`data-text-outline="true"`);
|
|
3735
|
+
if (element.textOutlineColor) {
|
|
3736
|
+
textAttrs.push(`data-text-outline-color="${element.textOutlineColor}"`);
|
|
3737
|
+
}
|
|
3738
|
+
if (element.textOutlineWidth) {
|
|
3739
|
+
textAttrs.push(`data-text-outline-width="${element.textOutlineWidth}"`);
|
|
3740
|
+
}
|
|
3741
|
+
}
|
|
3742
|
+
if (element.textHighlight) {
|
|
3743
|
+
textAttrs.push(`data-text-highlight="true"`);
|
|
3744
|
+
if (element.textHighlightColor) {
|
|
3745
|
+
textAttrs.push(`data-text-highlight-color="${element.textHighlightColor}"`);
|
|
3746
|
+
}
|
|
3747
|
+
if (element.textHighlightPadding) {
|
|
3748
|
+
textAttrs.push(`data-text-highlight-padding="${element.textHighlightPadding}"`);
|
|
3749
|
+
}
|
|
3750
|
+
if (element.textHighlightRadius) {
|
|
3751
|
+
textAttrs.push(`data-text-highlight-radius="${element.textHighlightRadius}"`);
|
|
3752
|
+
}
|
|
3753
|
+
}
|
|
3754
|
+
const content = element.content || element.name;
|
|
3755
|
+
return `<div ${textAttrs.join(" ")}><div>${content}</div></div>`;
|
|
3756
|
+
}
|
|
3757
|
+
if (isCompositionElement(element)) {
|
|
3758
|
+
const compositionAttrs = [
|
|
3759
|
+
...baseAttrs,
|
|
3760
|
+
`data-type="composition"`,
|
|
3761
|
+
`data-composition-id="${element.compositionId}"`
|
|
3762
|
+
];
|
|
3763
|
+
if (element.sourceDuration) {
|
|
3764
|
+
compositionAttrs.push(`data-source-duration="${element.sourceDuration}"`);
|
|
3765
|
+
}
|
|
3766
|
+
if (element.sourceWidth) {
|
|
3767
|
+
compositionAttrs.push(`data-source-width="${element.sourceWidth}"`);
|
|
3768
|
+
}
|
|
3769
|
+
if (element.sourceHeight) {
|
|
3770
|
+
compositionAttrs.push(`data-source-height="${element.sourceHeight}"`);
|
|
3771
|
+
}
|
|
3772
|
+
if (element.variableValues && Object.keys(element.variableValues).length > 0) {
|
|
3773
|
+
const varJson = JSON.stringify(element.variableValues);
|
|
3774
|
+
compositionAttrs.push(`data-variable-values='${varJson.replace(/'/g, "'")}'`);
|
|
3775
|
+
}
|
|
3776
|
+
const attrs2 = compositionAttrs.join(" ");
|
|
3777
|
+
let iframeSrc = element.src.split("?")[0];
|
|
3778
|
+
if (element.variableValues && Object.keys(element.variableValues).length > 0) {
|
|
3779
|
+
const params = new URLSearchParams();
|
|
3780
|
+
for (const [key2, value] of Object.entries(element.variableValues)) {
|
|
3781
|
+
params.set(key2, String(value));
|
|
3782
|
+
}
|
|
3783
|
+
iframeSrc = `${iframeSrc}?${params.toString()}`;
|
|
3784
|
+
}
|
|
3785
|
+
return `<div ${attrs2} style="width: 100%; height: 100%;">
|
|
3786
|
+
<iframe src="${iframeSrc}" sandbox="allow-scripts allow-same-origin" style="width: 100%; height: 100%; border: none; pointer-events: none;"></iframe>
|
|
3787
|
+
<div class="composition-click-overlay" style="position: absolute; inset: 0; cursor: pointer;"></div>
|
|
3788
|
+
</div>`;
|
|
3789
|
+
}
|
|
3790
|
+
if (isMediaElement(element)) {
|
|
3791
|
+
if (element.mediaStartTime) {
|
|
3792
|
+
baseAttrs.push(`data-media-start="${element.mediaStartTime}"`);
|
|
3793
|
+
}
|
|
3794
|
+
if (element.sourceDuration) {
|
|
3795
|
+
baseAttrs.push(`data-source-duration="${element.sourceDuration}"`);
|
|
3796
|
+
}
|
|
3797
|
+
if (element.isAroll) {
|
|
3798
|
+
baseAttrs.push(`data-aroll="true"`);
|
|
3799
|
+
}
|
|
3800
|
+
if (element.volume !== void 0 && element.volume !== 1) {
|
|
3801
|
+
baseAttrs.push(`data-volume="${element.volume}"`);
|
|
3802
|
+
}
|
|
3803
|
+
if (element.type === "video" && element.hasAudio) {
|
|
3804
|
+
baseAttrs.push(`data-has-audio="true"`);
|
|
3805
|
+
}
|
|
3806
|
+
}
|
|
3807
|
+
const attrs = baseAttrs.join(" ");
|
|
3808
|
+
switch (element.type) {
|
|
3809
|
+
case "video":
|
|
3810
|
+
return `<video ${attrs} src="${element.src}" playsinline></video>`;
|
|
3811
|
+
case "image":
|
|
3812
|
+
return `<img ${attrs} src="${element.src}" alt="${element.name}" />`;
|
|
3813
|
+
case "audio":
|
|
3814
|
+
return `<audio ${attrs} src="${element.src}"></audio>`;
|
|
3815
|
+
default:
|
|
3816
|
+
return "";
|
|
3817
|
+
}
|
|
3818
|
+
}
|
|
3819
|
+
function generateInitialPositionSets(elements, keyframes) {
|
|
3820
|
+
const sets = [];
|
|
3821
|
+
const timeEpsilon = 1e-3;
|
|
3822
|
+
for (const el of elements) {
|
|
3823
|
+
const elementKeyframes = keyframes?.[el.id];
|
|
3824
|
+
const hasBaseKeyframe = elementKeyframes?.some(
|
|
3825
|
+
(kf) => Math.abs(kf.time) <= timeEpsilon && (kf.properties.x !== void 0 || kf.properties.y !== void 0 || kf.properties.scale !== void 0)
|
|
3826
|
+
);
|
|
3827
|
+
const xVal = el.x ?? 0;
|
|
3828
|
+
const yVal = el.y ?? 0;
|
|
3829
|
+
const scaleVal = isMediaElement(el) ? el.scale ?? 1 : 1;
|
|
3830
|
+
if (el.type === "audio") continue;
|
|
3831
|
+
if (isCompositionElement(el)) continue;
|
|
3832
|
+
if (hasBaseKeyframe) {
|
|
3833
|
+
continue;
|
|
3834
|
+
}
|
|
3835
|
+
if (scaleVal !== 1) {
|
|
3836
|
+
sets.push(` tl.set("#${el.id}", { x: ${xVal}, y: ${yVal}, scale: ${scaleVal} }, 0);`);
|
|
3837
|
+
} else if (xVal !== 0 || yVal !== 0) {
|
|
3838
|
+
sets.push(` tl.set("#${el.id}", { x: ${xVal}, y: ${yVal} }, 0);`);
|
|
3839
|
+
}
|
|
3840
|
+
}
|
|
3841
|
+
return sets.length > 0 ? sets.join("\n") : "";
|
|
3842
|
+
}
|
|
3843
|
+
function generateVisibilityForElementsWithoutKeyframes(elements, keyframes) {
|
|
3844
|
+
const animations = [];
|
|
3845
|
+
for (const el of elements) {
|
|
3846
|
+
const elementKeyframes = keyframes?.[el.id];
|
|
3847
|
+
const opacityKeyframes = elementKeyframes?.filter((kf) => kf.properties.opacity !== void 0) || [];
|
|
3848
|
+
const start = el.startTime;
|
|
3849
|
+
const end = el.startTime + el.duration;
|
|
3850
|
+
const safeName = el.name.replace(/[\r\n]+/g, " ");
|
|
3851
|
+
animations.push(` // ${safeName} (visibility)`);
|
|
3852
|
+
animations.push(` tl.set("#${el.id}", { visibility: "hidden" }, 0);`);
|
|
3853
|
+
let elementOpacity = el.opacity ?? 1;
|
|
3854
|
+
if (opacityKeyframes.length > 0) {
|
|
3855
|
+
const firstOpacityKeyframe = [...opacityKeyframes].sort((a, b) => a.time - b.time)[0];
|
|
3856
|
+
if (firstOpacityKeyframe?.properties.opacity !== void 0) {
|
|
3857
|
+
elementOpacity = firstOpacityKeyframe.properties.opacity;
|
|
3858
|
+
}
|
|
3859
|
+
}
|
|
3860
|
+
const needsOpacity = elementOpacity !== 1 || opacityKeyframes.length > 0;
|
|
3861
|
+
if (needsOpacity) {
|
|
3862
|
+
animations.push(
|
|
3863
|
+
` tl.set("#${el.id}", { visibility: "visible", opacity: ${elementOpacity} }, ${start});`
|
|
3864
|
+
);
|
|
3865
|
+
} else {
|
|
3866
|
+
animations.push(` tl.set("#${el.id}", { visibility: "visible" }, ${start});`);
|
|
3867
|
+
}
|
|
3868
|
+
animations.push(` tl.set("#${el.id}", { visibility: "hidden" }, ${end});`);
|
|
3869
|
+
}
|
|
3870
|
+
return animations.length > 0 ? animations.join("\n") : "";
|
|
3871
|
+
}
|
|
3872
|
+
function generateDefaultGsapAnimations(elements, totalDuration, stageZoomKeyframes, canvasWidth, canvasHeight) {
|
|
3873
|
+
if (elements.length === 0 && (!stageZoomKeyframes || stageZoomKeyframes.length === 0)) {
|
|
3874
|
+
return `
|
|
3875
|
+
const tl = gsap.timeline({ paused: true });
|
|
3876
|
+
tl.to({}, { duration: ${totalDuration || 1} });
|
|
3877
|
+
`;
|
|
3878
|
+
}
|
|
3879
|
+
const animations = [];
|
|
3880
|
+
const initialPositionSets = generateInitialPositionSets(elements);
|
|
3881
|
+
if (initialPositionSets) {
|
|
3882
|
+
animations.push(initialPositionSets);
|
|
3883
|
+
}
|
|
3884
|
+
for (const el of elements) {
|
|
3885
|
+
const start = el.startTime;
|
|
3886
|
+
const end = el.startTime + el.duration;
|
|
3887
|
+
const safeName = el.name.replace(/[\r\n]+/g, " ");
|
|
3888
|
+
const elementOpacity = el.opacity ?? 1;
|
|
3889
|
+
animations.push(` // ${safeName}`);
|
|
3890
|
+
animations.push(` tl.set("#${el.id}", { visibility: "hidden" }, 0);`);
|
|
3891
|
+
if (elementOpacity !== 1) {
|
|
3892
|
+
animations.push(
|
|
3893
|
+
` tl.set("#${el.id}", { visibility: "visible", opacity: ${elementOpacity} }, ${start});`
|
|
3894
|
+
);
|
|
3895
|
+
} else {
|
|
3896
|
+
animations.push(` tl.set("#${el.id}", { visibility: "visible" }, ${start});`);
|
|
3897
|
+
}
|
|
3898
|
+
animations.push(` tl.set("#${el.id}", { visibility: "hidden" }, ${end});`);
|
|
3899
|
+
}
|
|
3900
|
+
const mediaElements = elements.filter((el) => el.type === "video" || el.type === "audio");
|
|
3901
|
+
const mediaSync = mediaElements.length > 0 ? `
|
|
3902
|
+
// Sync media playback
|
|
3903
|
+
tl.eventCallback("onUpdate", function() {
|
|
3904
|
+
const time = tl.time();
|
|
3905
|
+
document.querySelectorAll("video[data-start], audio[data-start]").forEach(function(media) {
|
|
3906
|
+
const start = parseFloat(media.dataset.start);
|
|
3907
|
+
const end = parseFloat(media.dataset.end) || Infinity;
|
|
3908
|
+
const mediaTime = time - start;
|
|
3909
|
+
if (time >= start && time < end) {
|
|
3910
|
+
if (Math.abs(media.currentTime - mediaTime) > 0.1) {
|
|
3911
|
+
media.currentTime = mediaTime;
|
|
3912
|
+
}
|
|
3913
|
+
if (media.paused && !tl.paused()) {
|
|
3914
|
+
media.play().catch(function() {});
|
|
3915
|
+
}
|
|
3916
|
+
} else if (!media.paused) {
|
|
3917
|
+
media.pause();
|
|
3918
|
+
}
|
|
3919
|
+
});
|
|
3920
|
+
});` : "";
|
|
3921
|
+
const zoomAnimations = stageZoomKeyframes && stageZoomKeyframes.length > 0 && canvasWidth && canvasHeight ? "\n" + generateZoomGsapAnimations(stageZoomKeyframes, canvasWidth, canvasHeight) : "";
|
|
3922
|
+
return `
|
|
3923
|
+
const tl = gsap.timeline({ paused: true });
|
|
3924
|
+
${animations.join("\n")}
|
|
3925
|
+
${mediaSync}${zoomAnimations}
|
|
3926
|
+
`;
|
|
3927
|
+
}
|
|
3928
|
+
var GOOGLE_FONTS_BASE, FONT_WEIGHTS;
|
|
2922
3929
|
var init_hyperframes = __esm({
|
|
2923
3930
|
"../core/src/generators/hyperframes.ts"() {
|
|
2924
3931
|
"use strict";
|
|
2925
3932
|
init_core_types();
|
|
2926
3933
|
init_gsapParser();
|
|
2927
3934
|
init_constants();
|
|
3935
|
+
GOOGLE_FONTS_BASE = "https://fonts.googleapis.com/css2";
|
|
3936
|
+
FONT_WEIGHTS = {
|
|
3937
|
+
Inter: "400;500;600;700;800;900",
|
|
3938
|
+
Roboto: "400;500;700;900",
|
|
3939
|
+
Montserrat: "400;500;600;700;800;900",
|
|
3940
|
+
Poppins: "400;500;600;700;800;900",
|
|
3941
|
+
"Bebas Neue": "400",
|
|
3942
|
+
Oswald: "400;500;600;700",
|
|
3943
|
+
Anton: "400",
|
|
3944
|
+
"Playfair Display": "400;500;600;700;800;900",
|
|
3945
|
+
Lora: "400;500;600;700",
|
|
3946
|
+
Pacifico: "400",
|
|
3947
|
+
"Permanent Marker": "400",
|
|
3948
|
+
"Fira Code": "400;500;600;700"
|
|
3949
|
+
};
|
|
2928
3950
|
}
|
|
2929
3951
|
});
|
|
2930
3952
|
|
|
@@ -4769,6 +5791,36 @@ var init_rewriteSubCompPaths = __esm({
|
|
|
4769
5791
|
import { buildSync } from "esbuild";
|
|
4770
5792
|
import { dirname as dirname2, resolve as resolve2 } from "path";
|
|
4771
5793
|
import { fileURLToPath } from "url";
|
|
5794
|
+
function applyDefaultParityMode(script, enabled) {
|
|
5795
|
+
const parityFlagPattern = /var\s+_parityModeEnabled\s*=\s*(?:true|false)\s*;/;
|
|
5796
|
+
if (!parityFlagPattern.test(script)) return script;
|
|
5797
|
+
return script.replace(
|
|
5798
|
+
parityFlagPattern,
|
|
5799
|
+
`var _parityModeEnabled = ${enabled ? "true" : "false"};`
|
|
5800
|
+
);
|
|
5801
|
+
}
|
|
5802
|
+
function buildHyperframesRuntimeScript(options = {}) {
|
|
5803
|
+
const entryPath = resolve2(dirname2(fileURLToPath(import.meta.url)), "../runtime/entry.ts");
|
|
5804
|
+
const result = buildSync({
|
|
5805
|
+
entryPoints: [entryPath],
|
|
5806
|
+
bundle: true,
|
|
5807
|
+
write: false,
|
|
5808
|
+
platform: "browser",
|
|
5809
|
+
format: "iife",
|
|
5810
|
+
target: ["es2020"],
|
|
5811
|
+
minify: options.minify ?? true,
|
|
5812
|
+
legalComments: "none"
|
|
5813
|
+
});
|
|
5814
|
+
let script = result.outputFiles[0]?.text ?? "";
|
|
5815
|
+
if (typeof options.defaultParityMode === "boolean") {
|
|
5816
|
+
script = applyDefaultParityMode(script, options.defaultParityMode);
|
|
5817
|
+
}
|
|
5818
|
+
if (options.sourceUrl && options.sourceUrl.trim()) {
|
|
5819
|
+
script = `${script}
|
|
5820
|
+
//# sourceURL=${options.sourceUrl.trim()}`;
|
|
5821
|
+
}
|
|
5822
|
+
return script;
|
|
5823
|
+
}
|
|
4772
5824
|
var init_hyperframesRuntime_engine = __esm({
|
|
4773
5825
|
"../core/src/inline-scripts/hyperframesRuntime.engine.ts"() {
|
|
4774
5826
|
"use strict";
|
|
@@ -4776,18 +5828,52 @@ var init_hyperframesRuntime_engine = __esm({
|
|
|
4776
5828
|
});
|
|
4777
5829
|
|
|
4778
5830
|
// ../core/src/inline-scripts/runtimeContract.ts
|
|
5831
|
+
var HYPERFRAME_RUNTIME_GLOBALS, HYPERFRAME_BRIDGE_SOURCES, HYPERFRAME_CONTROL_ACTIONS;
|
|
4779
5832
|
var init_runtimeContract = __esm({
|
|
4780
5833
|
"../core/src/inline-scripts/runtimeContract.ts"() {
|
|
4781
5834
|
"use strict";
|
|
5835
|
+
HYPERFRAME_RUNTIME_GLOBALS = {
|
|
5836
|
+
player: "__player",
|
|
5837
|
+
playerReady: "__playerReady",
|
|
5838
|
+
renderReady: "__renderReady",
|
|
5839
|
+
timelines: "__timelines",
|
|
5840
|
+
clipManifest: "__clipManifest"
|
|
5841
|
+
};
|
|
5842
|
+
HYPERFRAME_BRIDGE_SOURCES = {
|
|
5843
|
+
parent: "hf-parent",
|
|
5844
|
+
preview: "hf-preview"
|
|
5845
|
+
};
|
|
5846
|
+
HYPERFRAME_CONTROL_ACTIONS = [
|
|
5847
|
+
"play",
|
|
5848
|
+
"pause",
|
|
5849
|
+
"seek",
|
|
5850
|
+
"set-muted",
|
|
5851
|
+
"set-playback-rate",
|
|
5852
|
+
"enable-pick-mode",
|
|
5853
|
+
"disable-pick-mode"
|
|
5854
|
+
];
|
|
4782
5855
|
}
|
|
4783
5856
|
});
|
|
4784
5857
|
|
|
4785
5858
|
// ../core/src/inline-scripts/hyperframe.ts
|
|
5859
|
+
function loadHyperframeRuntimeSource() {
|
|
5860
|
+
return buildHyperframesRuntimeScript();
|
|
5861
|
+
}
|
|
5862
|
+
var HYPERFRAME_RUNTIME_ARTIFACTS, HYPERFRAME_RUNTIME_CONTRACT;
|
|
4786
5863
|
var init_hyperframe = __esm({
|
|
4787
5864
|
"../core/src/inline-scripts/hyperframe.ts"() {
|
|
4788
5865
|
"use strict";
|
|
4789
5866
|
init_hyperframesRuntime_engine();
|
|
4790
5867
|
init_runtimeContract();
|
|
5868
|
+
HYPERFRAME_RUNTIME_ARTIFACTS = {
|
|
5869
|
+
iife: "hyperframe.runtime.iife.js",
|
|
5870
|
+
esm: "hyperframe.runtime.mjs",
|
|
5871
|
+
manifest: "hyperframe.manifest.json"
|
|
5872
|
+
};
|
|
5873
|
+
HYPERFRAME_RUNTIME_CONTRACT = {
|
|
5874
|
+
globals: HYPERFRAME_RUNTIME_GLOBALS,
|
|
5875
|
+
messageSources: HYPERFRAME_BRIDGE_SOURCES
|
|
5876
|
+
};
|
|
4791
5877
|
}
|
|
4792
5878
|
});
|
|
4793
5879
|
|
|
@@ -4798,6 +5884,14 @@ function quantizeTimeToFrame(timeSeconds, fps) {
|
|
|
4798
5884
|
const frameIndex = Math.floor(safeTime * safeFps + 1e-9);
|
|
4799
5885
|
return frameIndex / safeFps;
|
|
4800
5886
|
}
|
|
5887
|
+
function copyMediaVisualStyles(targetStyle, sourceStyle, properties = MEDIA_VISUAL_STYLE_PROPERTIES) {
|
|
5888
|
+
for (const property of properties) {
|
|
5889
|
+
const value = sourceStyle.getPropertyValue(property);
|
|
5890
|
+
if (value) {
|
|
5891
|
+
targetStyle.setProperty(property, value);
|
|
5892
|
+
}
|
|
5893
|
+
}
|
|
5894
|
+
}
|
|
4801
5895
|
var MEDIA_VISUAL_STYLE_PROPERTIES;
|
|
4802
5896
|
var init_parityContract = __esm({
|
|
4803
5897
|
"../core/src/inline-scripts/parityContract.ts"() {
|
|
@@ -4834,6 +5928,30 @@ var init_parityContract = __esm({
|
|
|
4834
5928
|
});
|
|
4835
5929
|
|
|
4836
5930
|
// ../core/src/adapters/gsap.ts
|
|
5931
|
+
function createGSAPFrameAdapter(options) {
|
|
5932
|
+
const { fps, timeline } = options;
|
|
5933
|
+
const adapterId = options.id ?? "gsap";
|
|
5934
|
+
const getDurationSeconds = () => {
|
|
5935
|
+
const totalDuration = typeof timeline.totalDuration === "function" ? timeline.totalDuration() : timeline.duration();
|
|
5936
|
+
return Number.isFinite(totalDuration) && totalDuration > 0 ? totalDuration : 0;
|
|
5937
|
+
};
|
|
5938
|
+
return {
|
|
5939
|
+
id: adapterId,
|
|
5940
|
+
init: () => {
|
|
5941
|
+
timeline.pause?.();
|
|
5942
|
+
},
|
|
5943
|
+
getDurationFrames: () => {
|
|
5944
|
+
const durationSeconds = getDurationSeconds();
|
|
5945
|
+
return Math.max(0, Math.ceil(durationSeconds * fps));
|
|
5946
|
+
},
|
|
5947
|
+
seekFrame: (frame) => {
|
|
5948
|
+
const clampedFrame = Number.isFinite(frame) ? Math.max(0, frame) : 0;
|
|
5949
|
+
const targetSeconds = clampedFrame / fps;
|
|
5950
|
+
timeline.pause?.();
|
|
5951
|
+
timeline.seek(targetSeconds, false);
|
|
5952
|
+
}
|
|
5953
|
+
};
|
|
5954
|
+
}
|
|
4837
5955
|
var init_gsap2 = __esm({
|
|
4838
5956
|
"../core/src/adapters/gsap.ts"() {
|
|
4839
5957
|
"use strict";
|
|
@@ -4841,13 +5959,1144 @@ var init_gsap2 = __esm({
|
|
|
4841
5959
|
});
|
|
4842
5960
|
|
|
4843
5961
|
// ../../node_modules/.bun/@chenglou+pretext@0.0.5/node_modules/@chenglou/pretext/dist/generated/bidi-data.js
|
|
5962
|
+
var latin1BidiTypes, nonLatin1BidiRanges;
|
|
4844
5963
|
var init_bidi_data = __esm({
|
|
4845
5964
|
"../../node_modules/.bun/@chenglou+pretext@0.0.5/node_modules/@chenglou/pretext/dist/generated/bidi-data.js"() {
|
|
4846
5965
|
"use strict";
|
|
5966
|
+
latin1BidiTypes = [
|
|
5967
|
+
"BN",
|
|
5968
|
+
"BN",
|
|
5969
|
+
"BN",
|
|
5970
|
+
"BN",
|
|
5971
|
+
"BN",
|
|
5972
|
+
"BN",
|
|
5973
|
+
"BN",
|
|
5974
|
+
"BN",
|
|
5975
|
+
"BN",
|
|
5976
|
+
"S",
|
|
5977
|
+
"B",
|
|
5978
|
+
"S",
|
|
5979
|
+
"WS",
|
|
5980
|
+
"B",
|
|
5981
|
+
"BN",
|
|
5982
|
+
"BN",
|
|
5983
|
+
"BN",
|
|
5984
|
+
"BN",
|
|
5985
|
+
"BN",
|
|
5986
|
+
"BN",
|
|
5987
|
+
"BN",
|
|
5988
|
+
"BN",
|
|
5989
|
+
"BN",
|
|
5990
|
+
"BN",
|
|
5991
|
+
"BN",
|
|
5992
|
+
"BN",
|
|
5993
|
+
"BN",
|
|
5994
|
+
"BN",
|
|
5995
|
+
"B",
|
|
5996
|
+
"B",
|
|
5997
|
+
"B",
|
|
5998
|
+
"S",
|
|
5999
|
+
"WS",
|
|
6000
|
+
"ON",
|
|
6001
|
+
"ON",
|
|
6002
|
+
"ET",
|
|
6003
|
+
"ET",
|
|
6004
|
+
"ET",
|
|
6005
|
+
"ON",
|
|
6006
|
+
"ON",
|
|
6007
|
+
"ON",
|
|
6008
|
+
"ON",
|
|
6009
|
+
"ON",
|
|
6010
|
+
"ES",
|
|
6011
|
+
"CS",
|
|
6012
|
+
"ES",
|
|
6013
|
+
"CS",
|
|
6014
|
+
"CS",
|
|
6015
|
+
"EN",
|
|
6016
|
+
"EN",
|
|
6017
|
+
"EN",
|
|
6018
|
+
"EN",
|
|
6019
|
+
"EN",
|
|
6020
|
+
"EN",
|
|
6021
|
+
"EN",
|
|
6022
|
+
"EN",
|
|
6023
|
+
"EN",
|
|
6024
|
+
"EN",
|
|
6025
|
+
"CS",
|
|
6026
|
+
"ON",
|
|
6027
|
+
"ON",
|
|
6028
|
+
"ON",
|
|
6029
|
+
"ON",
|
|
6030
|
+
"ON",
|
|
6031
|
+
"ON",
|
|
6032
|
+
"L",
|
|
6033
|
+
"L",
|
|
6034
|
+
"L",
|
|
6035
|
+
"L",
|
|
6036
|
+
"L",
|
|
6037
|
+
"L",
|
|
6038
|
+
"L",
|
|
6039
|
+
"L",
|
|
6040
|
+
"L",
|
|
6041
|
+
"L",
|
|
6042
|
+
"L",
|
|
6043
|
+
"L",
|
|
6044
|
+
"L",
|
|
6045
|
+
"L",
|
|
6046
|
+
"L",
|
|
6047
|
+
"L",
|
|
6048
|
+
"L",
|
|
6049
|
+
"L",
|
|
6050
|
+
"L",
|
|
6051
|
+
"L",
|
|
6052
|
+
"L",
|
|
6053
|
+
"L",
|
|
6054
|
+
"L",
|
|
6055
|
+
"L",
|
|
6056
|
+
"L",
|
|
6057
|
+
"L",
|
|
6058
|
+
"ON",
|
|
6059
|
+
"ON",
|
|
6060
|
+
"ON",
|
|
6061
|
+
"ON",
|
|
6062
|
+
"ON",
|
|
6063
|
+
"ON",
|
|
6064
|
+
"L",
|
|
6065
|
+
"L",
|
|
6066
|
+
"L",
|
|
6067
|
+
"L",
|
|
6068
|
+
"L",
|
|
6069
|
+
"L",
|
|
6070
|
+
"L",
|
|
6071
|
+
"L",
|
|
6072
|
+
"L",
|
|
6073
|
+
"L",
|
|
6074
|
+
"L",
|
|
6075
|
+
"L",
|
|
6076
|
+
"L",
|
|
6077
|
+
"L",
|
|
6078
|
+
"L",
|
|
6079
|
+
"L",
|
|
6080
|
+
"L",
|
|
6081
|
+
"L",
|
|
6082
|
+
"L",
|
|
6083
|
+
"L",
|
|
6084
|
+
"L",
|
|
6085
|
+
"L",
|
|
6086
|
+
"L",
|
|
6087
|
+
"L",
|
|
6088
|
+
"L",
|
|
6089
|
+
"L",
|
|
6090
|
+
"ON",
|
|
6091
|
+
"ON",
|
|
6092
|
+
"ON",
|
|
6093
|
+
"ON",
|
|
6094
|
+
"BN",
|
|
6095
|
+
"BN",
|
|
6096
|
+
"BN",
|
|
6097
|
+
"BN",
|
|
6098
|
+
"BN",
|
|
6099
|
+
"BN",
|
|
6100
|
+
"B",
|
|
6101
|
+
"BN",
|
|
6102
|
+
"BN",
|
|
6103
|
+
"BN",
|
|
6104
|
+
"BN",
|
|
6105
|
+
"BN",
|
|
6106
|
+
"BN",
|
|
6107
|
+
"BN",
|
|
6108
|
+
"BN",
|
|
6109
|
+
"BN",
|
|
6110
|
+
"BN",
|
|
6111
|
+
"BN",
|
|
6112
|
+
"BN",
|
|
6113
|
+
"BN",
|
|
6114
|
+
"BN",
|
|
6115
|
+
"BN",
|
|
6116
|
+
"BN",
|
|
6117
|
+
"BN",
|
|
6118
|
+
"BN",
|
|
6119
|
+
"BN",
|
|
6120
|
+
"BN",
|
|
6121
|
+
"BN",
|
|
6122
|
+
"BN",
|
|
6123
|
+
"BN",
|
|
6124
|
+
"BN",
|
|
6125
|
+
"BN",
|
|
6126
|
+
"BN",
|
|
6127
|
+
"CS",
|
|
6128
|
+
"ON",
|
|
6129
|
+
"ET",
|
|
6130
|
+
"ET",
|
|
6131
|
+
"ET",
|
|
6132
|
+
"ET",
|
|
6133
|
+
"ON",
|
|
6134
|
+
"ON",
|
|
6135
|
+
"ON",
|
|
6136
|
+
"ON",
|
|
6137
|
+
"L",
|
|
6138
|
+
"ON",
|
|
6139
|
+
"ON",
|
|
6140
|
+
"BN",
|
|
6141
|
+
"ON",
|
|
6142
|
+
"ON",
|
|
6143
|
+
"ET",
|
|
6144
|
+
"ET",
|
|
6145
|
+
"EN",
|
|
6146
|
+
"EN",
|
|
6147
|
+
"ON",
|
|
6148
|
+
"L",
|
|
6149
|
+
"ON",
|
|
6150
|
+
"ON",
|
|
6151
|
+
"ON",
|
|
6152
|
+
"EN",
|
|
6153
|
+
"L",
|
|
6154
|
+
"ON",
|
|
6155
|
+
"ON",
|
|
6156
|
+
"ON",
|
|
6157
|
+
"ON",
|
|
6158
|
+
"ON",
|
|
6159
|
+
"L",
|
|
6160
|
+
"L",
|
|
6161
|
+
"L",
|
|
6162
|
+
"L",
|
|
6163
|
+
"L",
|
|
6164
|
+
"L",
|
|
6165
|
+
"L",
|
|
6166
|
+
"L",
|
|
6167
|
+
"L",
|
|
6168
|
+
"L",
|
|
6169
|
+
"L",
|
|
6170
|
+
"L",
|
|
6171
|
+
"L",
|
|
6172
|
+
"L",
|
|
6173
|
+
"L",
|
|
6174
|
+
"L",
|
|
6175
|
+
"L",
|
|
6176
|
+
"L",
|
|
6177
|
+
"L",
|
|
6178
|
+
"L",
|
|
6179
|
+
"L",
|
|
6180
|
+
"L",
|
|
6181
|
+
"L",
|
|
6182
|
+
"ON",
|
|
6183
|
+
"L",
|
|
6184
|
+
"L",
|
|
6185
|
+
"L",
|
|
6186
|
+
"L",
|
|
6187
|
+
"L",
|
|
6188
|
+
"L",
|
|
6189
|
+
"L",
|
|
6190
|
+
"L",
|
|
6191
|
+
"L",
|
|
6192
|
+
"L",
|
|
6193
|
+
"L",
|
|
6194
|
+
"L",
|
|
6195
|
+
"L",
|
|
6196
|
+
"L",
|
|
6197
|
+
"L",
|
|
6198
|
+
"L",
|
|
6199
|
+
"L",
|
|
6200
|
+
"L",
|
|
6201
|
+
"L",
|
|
6202
|
+
"L",
|
|
6203
|
+
"L",
|
|
6204
|
+
"L",
|
|
6205
|
+
"L",
|
|
6206
|
+
"L",
|
|
6207
|
+
"L",
|
|
6208
|
+
"L",
|
|
6209
|
+
"L",
|
|
6210
|
+
"L",
|
|
6211
|
+
"L",
|
|
6212
|
+
"L",
|
|
6213
|
+
"L",
|
|
6214
|
+
"ON",
|
|
6215
|
+
"L",
|
|
6216
|
+
"L",
|
|
6217
|
+
"L",
|
|
6218
|
+
"L",
|
|
6219
|
+
"L",
|
|
6220
|
+
"L",
|
|
6221
|
+
"L",
|
|
6222
|
+
"L"
|
|
6223
|
+
];
|
|
6224
|
+
nonLatin1BidiRanges = [
|
|
6225
|
+
[697, 698, "ON"],
|
|
6226
|
+
[706, 719, "ON"],
|
|
6227
|
+
[722, 735, "ON"],
|
|
6228
|
+
[741, 749, "ON"],
|
|
6229
|
+
[751, 767, "ON"],
|
|
6230
|
+
[768, 879, "NSM"],
|
|
6231
|
+
[884, 885, "ON"],
|
|
6232
|
+
[894, 894, "ON"],
|
|
6233
|
+
[900, 901, "ON"],
|
|
6234
|
+
[903, 903, "ON"],
|
|
6235
|
+
[1014, 1014, "ON"],
|
|
6236
|
+
[1155, 1161, "NSM"],
|
|
6237
|
+
[1418, 1418, "ON"],
|
|
6238
|
+
[1421, 1422, "ON"],
|
|
6239
|
+
[1423, 1423, "ET"],
|
|
6240
|
+
[1424, 1424, "R"],
|
|
6241
|
+
[1425, 1469, "NSM"],
|
|
6242
|
+
[1470, 1470, "R"],
|
|
6243
|
+
[1471, 1471, "NSM"],
|
|
6244
|
+
[1472, 1472, "R"],
|
|
6245
|
+
[1473, 1474, "NSM"],
|
|
6246
|
+
[1475, 1475, "R"],
|
|
6247
|
+
[1476, 1477, "NSM"],
|
|
6248
|
+
[1478, 1478, "R"],
|
|
6249
|
+
[1479, 1479, "NSM"],
|
|
6250
|
+
[1480, 1535, "R"],
|
|
6251
|
+
[1536, 1541, "AN"],
|
|
6252
|
+
[1542, 1543, "ON"],
|
|
6253
|
+
[1544, 1544, "AL"],
|
|
6254
|
+
[1545, 1546, "ET"],
|
|
6255
|
+
[1547, 1547, "AL"],
|
|
6256
|
+
[1548, 1548, "CS"],
|
|
6257
|
+
[1549, 1549, "AL"],
|
|
6258
|
+
[1550, 1551, "ON"],
|
|
6259
|
+
[1552, 1562, "NSM"],
|
|
6260
|
+
[1563, 1610, "AL"],
|
|
6261
|
+
[1611, 1631, "NSM"],
|
|
6262
|
+
[1632, 1641, "AN"],
|
|
6263
|
+
[1642, 1642, "ET"],
|
|
6264
|
+
[1643, 1644, "AN"],
|
|
6265
|
+
[1645, 1647, "AL"],
|
|
6266
|
+
[1648, 1648, "NSM"],
|
|
6267
|
+
[1649, 1749, "AL"],
|
|
6268
|
+
[1750, 1756, "NSM"],
|
|
6269
|
+
[1757, 1757, "AN"],
|
|
6270
|
+
[1758, 1758, "ON"],
|
|
6271
|
+
[1759, 1764, "NSM"],
|
|
6272
|
+
[1765, 1766, "AL"],
|
|
6273
|
+
[1767, 1768, "NSM"],
|
|
6274
|
+
[1769, 1769, "ON"],
|
|
6275
|
+
[1770, 1773, "NSM"],
|
|
6276
|
+
[1774, 1775, "AL"],
|
|
6277
|
+
[1776, 1785, "EN"],
|
|
6278
|
+
[1786, 1808, "AL"],
|
|
6279
|
+
[1809, 1809, "NSM"],
|
|
6280
|
+
[1810, 1839, "AL"],
|
|
6281
|
+
[1840, 1866, "NSM"],
|
|
6282
|
+
[1867, 1957, "AL"],
|
|
6283
|
+
[1958, 1968, "NSM"],
|
|
6284
|
+
[1969, 1983, "AL"],
|
|
6285
|
+
[1984, 2026, "R"],
|
|
6286
|
+
[2027, 2035, "NSM"],
|
|
6287
|
+
[2036, 2037, "R"],
|
|
6288
|
+
[2038, 2041, "ON"],
|
|
6289
|
+
[2042, 2044, "R"],
|
|
6290
|
+
[2045, 2045, "NSM"],
|
|
6291
|
+
[2046, 2069, "R"],
|
|
6292
|
+
[2070, 2073, "NSM"],
|
|
6293
|
+
[2074, 2074, "R"],
|
|
6294
|
+
[2075, 2083, "NSM"],
|
|
6295
|
+
[2084, 2084, "R"],
|
|
6296
|
+
[2085, 2087, "NSM"],
|
|
6297
|
+
[2088, 2088, "R"],
|
|
6298
|
+
[2089, 2093, "NSM"],
|
|
6299
|
+
[2094, 2136, "R"],
|
|
6300
|
+
[2137, 2139, "NSM"],
|
|
6301
|
+
[2140, 2143, "R"],
|
|
6302
|
+
[2144, 2191, "AL"],
|
|
6303
|
+
[2192, 2193, "AN"],
|
|
6304
|
+
[2194, 2198, "AL"],
|
|
6305
|
+
[2199, 2207, "NSM"],
|
|
6306
|
+
[2208, 2249, "AL"],
|
|
6307
|
+
[2250, 2273, "NSM"],
|
|
6308
|
+
[2274, 2274, "AN"],
|
|
6309
|
+
[2275, 2306, "NSM"],
|
|
6310
|
+
[2362, 2362, "NSM"],
|
|
6311
|
+
[2364, 2364, "NSM"],
|
|
6312
|
+
[2369, 2376, "NSM"],
|
|
6313
|
+
[2381, 2381, "NSM"],
|
|
6314
|
+
[2385, 2391, "NSM"],
|
|
6315
|
+
[2402, 2403, "NSM"],
|
|
6316
|
+
[2433, 2433, "NSM"],
|
|
6317
|
+
[2492, 2492, "NSM"],
|
|
6318
|
+
[2497, 2500, "NSM"],
|
|
6319
|
+
[2509, 2509, "NSM"],
|
|
6320
|
+
[2530, 2531, "NSM"],
|
|
6321
|
+
[2546, 2547, "ET"],
|
|
6322
|
+
[2555, 2555, "ET"],
|
|
6323
|
+
[2558, 2558, "NSM"],
|
|
6324
|
+
[2561, 2562, "NSM"],
|
|
6325
|
+
[2620, 2620, "NSM"],
|
|
6326
|
+
[2625, 2626, "NSM"],
|
|
6327
|
+
[2631, 2632, "NSM"],
|
|
6328
|
+
[2635, 2637, "NSM"],
|
|
6329
|
+
[2641, 2641, "NSM"],
|
|
6330
|
+
[2672, 2673, "NSM"],
|
|
6331
|
+
[2677, 2677, "NSM"],
|
|
6332
|
+
[2689, 2690, "NSM"],
|
|
6333
|
+
[2748, 2748, "NSM"],
|
|
6334
|
+
[2753, 2757, "NSM"],
|
|
6335
|
+
[2759, 2760, "NSM"],
|
|
6336
|
+
[2765, 2765, "NSM"],
|
|
6337
|
+
[2786, 2787, "NSM"],
|
|
6338
|
+
[2801, 2801, "ET"],
|
|
6339
|
+
[2810, 2815, "NSM"],
|
|
6340
|
+
[2817, 2817, "NSM"],
|
|
6341
|
+
[2876, 2876, "NSM"],
|
|
6342
|
+
[2879, 2879, "NSM"],
|
|
6343
|
+
[2881, 2884, "NSM"],
|
|
6344
|
+
[2893, 2893, "NSM"],
|
|
6345
|
+
[2901, 2902, "NSM"],
|
|
6346
|
+
[2914, 2915, "NSM"],
|
|
6347
|
+
[2946, 2946, "NSM"],
|
|
6348
|
+
[3008, 3008, "NSM"],
|
|
6349
|
+
[3021, 3021, "NSM"],
|
|
6350
|
+
[3059, 3064, "ON"],
|
|
6351
|
+
[3065, 3065, "ET"],
|
|
6352
|
+
[3066, 3066, "ON"],
|
|
6353
|
+
[3072, 3072, "NSM"],
|
|
6354
|
+
[3076, 3076, "NSM"],
|
|
6355
|
+
[3132, 3132, "NSM"],
|
|
6356
|
+
[3134, 3136, "NSM"],
|
|
6357
|
+
[3142, 3144, "NSM"],
|
|
6358
|
+
[3146, 3149, "NSM"],
|
|
6359
|
+
[3157, 3158, "NSM"],
|
|
6360
|
+
[3170, 3171, "NSM"],
|
|
6361
|
+
[3192, 3198, "ON"],
|
|
6362
|
+
[3201, 3201, "NSM"],
|
|
6363
|
+
[3260, 3260, "NSM"],
|
|
6364
|
+
[3276, 3277, "NSM"],
|
|
6365
|
+
[3298, 3299, "NSM"],
|
|
6366
|
+
[3328, 3329, "NSM"],
|
|
6367
|
+
[3387, 3388, "NSM"],
|
|
6368
|
+
[3393, 3396, "NSM"],
|
|
6369
|
+
[3405, 3405, "NSM"],
|
|
6370
|
+
[3426, 3427, "NSM"],
|
|
6371
|
+
[3457, 3457, "NSM"],
|
|
6372
|
+
[3530, 3530, "NSM"],
|
|
6373
|
+
[3538, 3540, "NSM"],
|
|
6374
|
+
[3542, 3542, "NSM"],
|
|
6375
|
+
[3633, 3633, "NSM"],
|
|
6376
|
+
[3636, 3642, "NSM"],
|
|
6377
|
+
[3647, 3647, "ET"],
|
|
6378
|
+
[3655, 3662, "NSM"],
|
|
6379
|
+
[3761, 3761, "NSM"],
|
|
6380
|
+
[3764, 3772, "NSM"],
|
|
6381
|
+
[3784, 3790, "NSM"],
|
|
6382
|
+
[3864, 3865, "NSM"],
|
|
6383
|
+
[3893, 3893, "NSM"],
|
|
6384
|
+
[3895, 3895, "NSM"],
|
|
6385
|
+
[3897, 3897, "NSM"],
|
|
6386
|
+
[3898, 3901, "ON"],
|
|
6387
|
+
[3953, 3966, "NSM"],
|
|
6388
|
+
[3968, 3972, "NSM"],
|
|
6389
|
+
[3974, 3975, "NSM"],
|
|
6390
|
+
[3981, 3991, "NSM"],
|
|
6391
|
+
[3993, 4028, "NSM"],
|
|
6392
|
+
[4038, 4038, "NSM"],
|
|
6393
|
+
[4141, 4144, "NSM"],
|
|
6394
|
+
[4146, 4151, "NSM"],
|
|
6395
|
+
[4153, 4154, "NSM"],
|
|
6396
|
+
[4157, 4158, "NSM"],
|
|
6397
|
+
[4184, 4185, "NSM"],
|
|
6398
|
+
[4190, 4192, "NSM"],
|
|
6399
|
+
[4209, 4212, "NSM"],
|
|
6400
|
+
[4226, 4226, "NSM"],
|
|
6401
|
+
[4229, 4230, "NSM"],
|
|
6402
|
+
[4237, 4237, "NSM"],
|
|
6403
|
+
[4253, 4253, "NSM"],
|
|
6404
|
+
[4957, 4959, "NSM"],
|
|
6405
|
+
[5008, 5017, "ON"],
|
|
6406
|
+
[5120, 5120, "ON"],
|
|
6407
|
+
[5760, 5760, "WS"],
|
|
6408
|
+
[5787, 5788, "ON"],
|
|
6409
|
+
[5906, 5908, "NSM"],
|
|
6410
|
+
[5938, 5939, "NSM"],
|
|
6411
|
+
[5970, 5971, "NSM"],
|
|
6412
|
+
[6002, 6003, "NSM"],
|
|
6413
|
+
[6068, 6069, "NSM"],
|
|
6414
|
+
[6071, 6077, "NSM"],
|
|
6415
|
+
[6086, 6086, "NSM"],
|
|
6416
|
+
[6089, 6099, "NSM"],
|
|
6417
|
+
[6107, 6107, "ET"],
|
|
6418
|
+
[6109, 6109, "NSM"],
|
|
6419
|
+
[6128, 6137, "ON"],
|
|
6420
|
+
[6144, 6154, "ON"],
|
|
6421
|
+
[6155, 6157, "NSM"],
|
|
6422
|
+
[6158, 6158, "BN"],
|
|
6423
|
+
[6159, 6159, "NSM"],
|
|
6424
|
+
[6277, 6278, "NSM"],
|
|
6425
|
+
[6313, 6313, "NSM"],
|
|
6426
|
+
[6432, 6434, "NSM"],
|
|
6427
|
+
[6439, 6440, "NSM"],
|
|
6428
|
+
[6450, 6450, "NSM"],
|
|
6429
|
+
[6457, 6459, "NSM"],
|
|
6430
|
+
[6464, 6464, "ON"],
|
|
6431
|
+
[6468, 6469, "ON"],
|
|
6432
|
+
[6622, 6655, "ON"],
|
|
6433
|
+
[6679, 6680, "NSM"],
|
|
6434
|
+
[6683, 6683, "NSM"],
|
|
6435
|
+
[6742, 6742, "NSM"],
|
|
6436
|
+
[6744, 6750, "NSM"],
|
|
6437
|
+
[6752, 6752, "NSM"],
|
|
6438
|
+
[6754, 6754, "NSM"],
|
|
6439
|
+
[6757, 6764, "NSM"],
|
|
6440
|
+
[6771, 6780, "NSM"],
|
|
6441
|
+
[6783, 6783, "NSM"],
|
|
6442
|
+
[6832, 6877, "NSM"],
|
|
6443
|
+
[6880, 6891, "NSM"],
|
|
6444
|
+
[6912, 6915, "NSM"],
|
|
6445
|
+
[6964, 6964, "NSM"],
|
|
6446
|
+
[6966, 6970, "NSM"],
|
|
6447
|
+
[6972, 6972, "NSM"],
|
|
6448
|
+
[6978, 6978, "NSM"],
|
|
6449
|
+
[7019, 7027, "NSM"],
|
|
6450
|
+
[7040, 7041, "NSM"],
|
|
6451
|
+
[7074, 7077, "NSM"],
|
|
6452
|
+
[7080, 7081, "NSM"],
|
|
6453
|
+
[7083, 7085, "NSM"],
|
|
6454
|
+
[7142, 7142, "NSM"],
|
|
6455
|
+
[7144, 7145, "NSM"],
|
|
6456
|
+
[7149, 7149, "NSM"],
|
|
6457
|
+
[7151, 7153, "NSM"],
|
|
6458
|
+
[7212, 7219, "NSM"],
|
|
6459
|
+
[7222, 7223, "NSM"],
|
|
6460
|
+
[7376, 7378, "NSM"],
|
|
6461
|
+
[7380, 7392, "NSM"],
|
|
6462
|
+
[7394, 7400, "NSM"],
|
|
6463
|
+
[7405, 7405, "NSM"],
|
|
6464
|
+
[7412, 7412, "NSM"],
|
|
6465
|
+
[7416, 7417, "NSM"],
|
|
6466
|
+
[7616, 7679, "NSM"],
|
|
6467
|
+
[8125, 8125, "ON"],
|
|
6468
|
+
[8127, 8129, "ON"],
|
|
6469
|
+
[8141, 8143, "ON"],
|
|
6470
|
+
[8157, 8159, "ON"],
|
|
6471
|
+
[8173, 8175, "ON"],
|
|
6472
|
+
[8189, 8190, "ON"],
|
|
6473
|
+
[8192, 8202, "WS"],
|
|
6474
|
+
[8203, 8205, "BN"],
|
|
6475
|
+
[8207, 8207, "R"],
|
|
6476
|
+
[8208, 8231, "ON"],
|
|
6477
|
+
[8232, 8232, "WS"],
|
|
6478
|
+
[8233, 8233, "B"],
|
|
6479
|
+
[8234, 8238, "BN"],
|
|
6480
|
+
[8239, 8239, "CS"],
|
|
6481
|
+
[8240, 8244, "ET"],
|
|
6482
|
+
[8245, 8259, "ON"],
|
|
6483
|
+
[8260, 8260, "CS"],
|
|
6484
|
+
[8261, 8286, "ON"],
|
|
6485
|
+
[8287, 8287, "WS"],
|
|
6486
|
+
[8288, 8303, "BN"],
|
|
6487
|
+
[8304, 8304, "EN"],
|
|
6488
|
+
[8308, 8313, "EN"],
|
|
6489
|
+
[8314, 8315, "ES"],
|
|
6490
|
+
[8316, 8318, "ON"],
|
|
6491
|
+
[8320, 8329, "EN"],
|
|
6492
|
+
[8330, 8331, "ES"],
|
|
6493
|
+
[8332, 8334, "ON"],
|
|
6494
|
+
[8352, 8399, "ET"],
|
|
6495
|
+
[8400, 8432, "NSM"],
|
|
6496
|
+
[8448, 8449, "ON"],
|
|
6497
|
+
[8451, 8454, "ON"],
|
|
6498
|
+
[8456, 8457, "ON"],
|
|
6499
|
+
[8468, 8468, "ON"],
|
|
6500
|
+
[8470, 8472, "ON"],
|
|
6501
|
+
[8478, 8483, "ON"],
|
|
6502
|
+
[8485, 8485, "ON"],
|
|
6503
|
+
[8487, 8487, "ON"],
|
|
6504
|
+
[8489, 8489, "ON"],
|
|
6505
|
+
[8494, 8494, "ET"],
|
|
6506
|
+
[8506, 8507, "ON"],
|
|
6507
|
+
[8512, 8516, "ON"],
|
|
6508
|
+
[8522, 8525, "ON"],
|
|
6509
|
+
[8528, 8543, "ON"],
|
|
6510
|
+
[8585, 8587, "ON"],
|
|
6511
|
+
[8592, 8721, "ON"],
|
|
6512
|
+
[8722, 8722, "ES"],
|
|
6513
|
+
[8723, 8723, "ET"],
|
|
6514
|
+
[8724, 9013, "ON"],
|
|
6515
|
+
[9083, 9108, "ON"],
|
|
6516
|
+
[9110, 9257, "ON"],
|
|
6517
|
+
[9280, 9290, "ON"],
|
|
6518
|
+
[9312, 9351, "ON"],
|
|
6519
|
+
[9352, 9371, "EN"],
|
|
6520
|
+
[9450, 9899, "ON"],
|
|
6521
|
+
[9901, 10239, "ON"],
|
|
6522
|
+
[10496, 11123, "ON"],
|
|
6523
|
+
[11126, 11263, "ON"],
|
|
6524
|
+
[11493, 11498, "ON"],
|
|
6525
|
+
[11503, 11505, "NSM"],
|
|
6526
|
+
[11513, 11519, "ON"],
|
|
6527
|
+
[11647, 11647, "NSM"],
|
|
6528
|
+
[11744, 11775, "NSM"],
|
|
6529
|
+
[11776, 11869, "ON"],
|
|
6530
|
+
[11904, 11929, "ON"],
|
|
6531
|
+
[11931, 12019, "ON"],
|
|
6532
|
+
[12032, 12245, "ON"],
|
|
6533
|
+
[12272, 12287, "ON"],
|
|
6534
|
+
[12288, 12288, "WS"],
|
|
6535
|
+
[12289, 12292, "ON"],
|
|
6536
|
+
[12296, 12320, "ON"],
|
|
6537
|
+
[12330, 12333, "NSM"],
|
|
6538
|
+
[12336, 12336, "ON"],
|
|
6539
|
+
[12342, 12343, "ON"],
|
|
6540
|
+
[12349, 12351, "ON"],
|
|
6541
|
+
[12441, 12442, "NSM"],
|
|
6542
|
+
[12443, 12444, "ON"],
|
|
6543
|
+
[12448, 12448, "ON"],
|
|
6544
|
+
[12539, 12539, "ON"],
|
|
6545
|
+
[12736, 12773, "ON"],
|
|
6546
|
+
[12783, 12783, "ON"],
|
|
6547
|
+
[12829, 12830, "ON"],
|
|
6548
|
+
[12880, 12895, "ON"],
|
|
6549
|
+
[12924, 12926, "ON"],
|
|
6550
|
+
[12977, 12991, "ON"],
|
|
6551
|
+
[13004, 13007, "ON"],
|
|
6552
|
+
[13175, 13178, "ON"],
|
|
6553
|
+
[13278, 13279, "ON"],
|
|
6554
|
+
[13311, 13311, "ON"],
|
|
6555
|
+
[19904, 19967, "ON"],
|
|
6556
|
+
[42128, 42182, "ON"],
|
|
6557
|
+
[42509, 42511, "ON"],
|
|
6558
|
+
[42607, 42610, "NSM"],
|
|
6559
|
+
[42611, 42611, "ON"],
|
|
6560
|
+
[42612, 42621, "NSM"],
|
|
6561
|
+
[42622, 42623, "ON"],
|
|
6562
|
+
[42654, 42655, "NSM"],
|
|
6563
|
+
[42736, 42737, "NSM"],
|
|
6564
|
+
[42752, 42785, "ON"],
|
|
6565
|
+
[42888, 42888, "ON"],
|
|
6566
|
+
[43010, 43010, "NSM"],
|
|
6567
|
+
[43014, 43014, "NSM"],
|
|
6568
|
+
[43019, 43019, "NSM"],
|
|
6569
|
+
[43045, 43046, "NSM"],
|
|
6570
|
+
[43048, 43051, "ON"],
|
|
6571
|
+
[43052, 43052, "NSM"],
|
|
6572
|
+
[43064, 43065, "ET"],
|
|
6573
|
+
[43124, 43127, "ON"],
|
|
6574
|
+
[43204, 43205, "NSM"],
|
|
6575
|
+
[43232, 43249, "NSM"],
|
|
6576
|
+
[43263, 43263, "NSM"],
|
|
6577
|
+
[43302, 43309, "NSM"],
|
|
6578
|
+
[43335, 43345, "NSM"],
|
|
6579
|
+
[43392, 43394, "NSM"],
|
|
6580
|
+
[43443, 43443, "NSM"],
|
|
6581
|
+
[43446, 43449, "NSM"],
|
|
6582
|
+
[43452, 43453, "NSM"],
|
|
6583
|
+
[43493, 43493, "NSM"],
|
|
6584
|
+
[43561, 43566, "NSM"],
|
|
6585
|
+
[43569, 43570, "NSM"],
|
|
6586
|
+
[43573, 43574, "NSM"],
|
|
6587
|
+
[43587, 43587, "NSM"],
|
|
6588
|
+
[43596, 43596, "NSM"],
|
|
6589
|
+
[43644, 43644, "NSM"],
|
|
6590
|
+
[43696, 43696, "NSM"],
|
|
6591
|
+
[43698, 43700, "NSM"],
|
|
6592
|
+
[43703, 43704, "NSM"],
|
|
6593
|
+
[43710, 43711, "NSM"],
|
|
6594
|
+
[43713, 43713, "NSM"],
|
|
6595
|
+
[43756, 43757, "NSM"],
|
|
6596
|
+
[43766, 43766, "NSM"],
|
|
6597
|
+
[43882, 43883, "ON"],
|
|
6598
|
+
[44005, 44005, "NSM"],
|
|
6599
|
+
[44008, 44008, "NSM"],
|
|
6600
|
+
[44013, 44013, "NSM"],
|
|
6601
|
+
[64285, 64285, "R"],
|
|
6602
|
+
[64286, 64286, "NSM"],
|
|
6603
|
+
[64287, 64296, "R"],
|
|
6604
|
+
[64297, 64297, "ES"],
|
|
6605
|
+
[64298, 64335, "R"],
|
|
6606
|
+
[64336, 64450, "AL"],
|
|
6607
|
+
[64451, 64466, "ON"],
|
|
6608
|
+
[64467, 64829, "AL"],
|
|
6609
|
+
[64830, 64847, "ON"],
|
|
6610
|
+
[64848, 64911, "AL"],
|
|
6611
|
+
[64912, 64913, "ON"],
|
|
6612
|
+
[64914, 64967, "AL"],
|
|
6613
|
+
[64968, 64975, "ON"],
|
|
6614
|
+
[64976, 65007, "BN"],
|
|
6615
|
+
[65008, 65020, "AL"],
|
|
6616
|
+
[65021, 65023, "ON"],
|
|
6617
|
+
[65024, 65039, "NSM"],
|
|
6618
|
+
[65040, 65049, "ON"],
|
|
6619
|
+
[65056, 65071, "NSM"],
|
|
6620
|
+
[65072, 65103, "ON"],
|
|
6621
|
+
[65104, 65104, "CS"],
|
|
6622
|
+
[65105, 65105, "ON"],
|
|
6623
|
+
[65106, 65106, "CS"],
|
|
6624
|
+
[65108, 65108, "ON"],
|
|
6625
|
+
[65109, 65109, "CS"],
|
|
6626
|
+
[65110, 65118, "ON"],
|
|
6627
|
+
[65119, 65119, "ET"],
|
|
6628
|
+
[65120, 65121, "ON"],
|
|
6629
|
+
[65122, 65123, "ES"],
|
|
6630
|
+
[65124, 65126, "ON"],
|
|
6631
|
+
[65128, 65128, "ON"],
|
|
6632
|
+
[65129, 65130, "ET"],
|
|
6633
|
+
[65131, 65131, "ON"],
|
|
6634
|
+
[65136, 65278, "AL"],
|
|
6635
|
+
[65279, 65279, "BN"],
|
|
6636
|
+
[65281, 65282, "ON"],
|
|
6637
|
+
[65283, 65285, "ET"],
|
|
6638
|
+
[65286, 65290, "ON"],
|
|
6639
|
+
[65291, 65291, "ES"],
|
|
6640
|
+
[65292, 65292, "CS"],
|
|
6641
|
+
[65293, 65293, "ES"],
|
|
6642
|
+
[65294, 65295, "CS"],
|
|
6643
|
+
[65296, 65305, "EN"],
|
|
6644
|
+
[65306, 65306, "CS"],
|
|
6645
|
+
[65307, 65312, "ON"],
|
|
6646
|
+
[65339, 65344, "ON"],
|
|
6647
|
+
[65371, 65381, "ON"],
|
|
6648
|
+
[65504, 65505, "ET"],
|
|
6649
|
+
[65506, 65508, "ON"],
|
|
6650
|
+
[65509, 65510, "ET"],
|
|
6651
|
+
[65512, 65518, "ON"],
|
|
6652
|
+
[65520, 65528, "BN"],
|
|
6653
|
+
[65529, 65533, "ON"],
|
|
6654
|
+
[65534, 65535, "BN"],
|
|
6655
|
+
[65793, 65793, "ON"],
|
|
6656
|
+
[65856, 65932, "ON"],
|
|
6657
|
+
[65936, 65948, "ON"],
|
|
6658
|
+
[65952, 65952, "ON"],
|
|
6659
|
+
[66045, 66045, "NSM"],
|
|
6660
|
+
[66272, 66272, "NSM"],
|
|
6661
|
+
[66273, 66299, "EN"],
|
|
6662
|
+
[66422, 66426, "NSM"],
|
|
6663
|
+
[67584, 67870, "R"],
|
|
6664
|
+
[67871, 67871, "ON"],
|
|
6665
|
+
[67872, 68096, "R"],
|
|
6666
|
+
[68097, 68099, "NSM"],
|
|
6667
|
+
[68100, 68100, "R"],
|
|
6668
|
+
[68101, 68102, "NSM"],
|
|
6669
|
+
[68103, 68107, "R"],
|
|
6670
|
+
[68108, 68111, "NSM"],
|
|
6671
|
+
[68112, 68151, "R"],
|
|
6672
|
+
[68152, 68154, "NSM"],
|
|
6673
|
+
[68155, 68158, "R"],
|
|
6674
|
+
[68159, 68159, "NSM"],
|
|
6675
|
+
[68160, 68324, "R"],
|
|
6676
|
+
[68325, 68326, "NSM"],
|
|
6677
|
+
[68327, 68408, "R"],
|
|
6678
|
+
[68409, 68415, "ON"],
|
|
6679
|
+
[68416, 68863, "R"],
|
|
6680
|
+
[68864, 68899, "AL"],
|
|
6681
|
+
[68900, 68903, "NSM"],
|
|
6682
|
+
[68904, 68911, "AL"],
|
|
6683
|
+
[68912, 68921, "AN"],
|
|
6684
|
+
[68922, 68927, "AL"],
|
|
6685
|
+
[68928, 68937, "AN"],
|
|
6686
|
+
[68938, 68968, "R"],
|
|
6687
|
+
[68969, 68973, "NSM"],
|
|
6688
|
+
[68974, 68974, "ON"],
|
|
6689
|
+
[68975, 69215, "R"],
|
|
6690
|
+
[69216, 69246, "AN"],
|
|
6691
|
+
[69247, 69290, "R"],
|
|
6692
|
+
[69291, 69292, "NSM"],
|
|
6693
|
+
[69293, 69311, "R"],
|
|
6694
|
+
[69312, 69327, "AL"],
|
|
6695
|
+
[69328, 69336, "ON"],
|
|
6696
|
+
[69337, 69369, "AL"],
|
|
6697
|
+
[69370, 69375, "NSM"],
|
|
6698
|
+
[69376, 69423, "R"],
|
|
6699
|
+
[69424, 69445, "AL"],
|
|
6700
|
+
[69446, 69456, "NSM"],
|
|
6701
|
+
[69457, 69487, "AL"],
|
|
6702
|
+
[69488, 69505, "R"],
|
|
6703
|
+
[69506, 69509, "NSM"],
|
|
6704
|
+
[69510, 69631, "R"],
|
|
6705
|
+
[69633, 69633, "NSM"],
|
|
6706
|
+
[69688, 69702, "NSM"],
|
|
6707
|
+
[69714, 69733, "ON"],
|
|
6708
|
+
[69744, 69744, "NSM"],
|
|
6709
|
+
[69747, 69748, "NSM"],
|
|
6710
|
+
[69759, 69761, "NSM"],
|
|
6711
|
+
[69811, 69814, "NSM"],
|
|
6712
|
+
[69817, 69818, "NSM"],
|
|
6713
|
+
[69826, 69826, "NSM"],
|
|
6714
|
+
[69888, 69890, "NSM"],
|
|
6715
|
+
[69927, 69931, "NSM"],
|
|
6716
|
+
[69933, 69940, "NSM"],
|
|
6717
|
+
[70003, 70003, "NSM"],
|
|
6718
|
+
[70016, 70017, "NSM"],
|
|
6719
|
+
[70070, 70078, "NSM"],
|
|
6720
|
+
[70089, 70092, "NSM"],
|
|
6721
|
+
[70095, 70095, "NSM"],
|
|
6722
|
+
[70191, 70193, "NSM"],
|
|
6723
|
+
[70196, 70196, "NSM"],
|
|
6724
|
+
[70198, 70199, "NSM"],
|
|
6725
|
+
[70206, 70206, "NSM"],
|
|
6726
|
+
[70209, 70209, "NSM"],
|
|
6727
|
+
[70367, 70367, "NSM"],
|
|
6728
|
+
[70371, 70378, "NSM"],
|
|
6729
|
+
[70400, 70401, "NSM"],
|
|
6730
|
+
[70459, 70460, "NSM"],
|
|
6731
|
+
[70464, 70464, "NSM"],
|
|
6732
|
+
[70502, 70508, "NSM"],
|
|
6733
|
+
[70512, 70516, "NSM"],
|
|
6734
|
+
[70587, 70592, "NSM"],
|
|
6735
|
+
[70606, 70606, "NSM"],
|
|
6736
|
+
[70608, 70608, "NSM"],
|
|
6737
|
+
[70610, 70610, "NSM"],
|
|
6738
|
+
[70625, 70626, "NSM"],
|
|
6739
|
+
[70712, 70719, "NSM"],
|
|
6740
|
+
[70722, 70724, "NSM"],
|
|
6741
|
+
[70726, 70726, "NSM"],
|
|
6742
|
+
[70750, 70750, "NSM"],
|
|
6743
|
+
[70835, 70840, "NSM"],
|
|
6744
|
+
[70842, 70842, "NSM"],
|
|
6745
|
+
[70847, 70848, "NSM"],
|
|
6746
|
+
[70850, 70851, "NSM"],
|
|
6747
|
+
[71090, 71093, "NSM"],
|
|
6748
|
+
[71100, 71101, "NSM"],
|
|
6749
|
+
[71103, 71104, "NSM"],
|
|
6750
|
+
[71132, 71133, "NSM"],
|
|
6751
|
+
[71219, 71226, "NSM"],
|
|
6752
|
+
[71229, 71229, "NSM"],
|
|
6753
|
+
[71231, 71232, "NSM"],
|
|
6754
|
+
[71264, 71276, "ON"],
|
|
6755
|
+
[71339, 71339, "NSM"],
|
|
6756
|
+
[71341, 71341, "NSM"],
|
|
6757
|
+
[71344, 71349, "NSM"],
|
|
6758
|
+
[71351, 71351, "NSM"],
|
|
6759
|
+
[71453, 71453, "NSM"],
|
|
6760
|
+
[71455, 71455, "NSM"],
|
|
6761
|
+
[71458, 71461, "NSM"],
|
|
6762
|
+
[71463, 71467, "NSM"],
|
|
6763
|
+
[71727, 71735, "NSM"],
|
|
6764
|
+
[71737, 71738, "NSM"],
|
|
6765
|
+
[71995, 71996, "NSM"],
|
|
6766
|
+
[71998, 71998, "NSM"],
|
|
6767
|
+
[72003, 72003, "NSM"],
|
|
6768
|
+
[72148, 72151, "NSM"],
|
|
6769
|
+
[72154, 72155, "NSM"],
|
|
6770
|
+
[72160, 72160, "NSM"],
|
|
6771
|
+
[72193, 72198, "NSM"],
|
|
6772
|
+
[72201, 72202, "NSM"],
|
|
6773
|
+
[72243, 72248, "NSM"],
|
|
6774
|
+
[72251, 72254, "NSM"],
|
|
6775
|
+
[72263, 72263, "NSM"],
|
|
6776
|
+
[72273, 72278, "NSM"],
|
|
6777
|
+
[72281, 72283, "NSM"],
|
|
6778
|
+
[72330, 72342, "NSM"],
|
|
6779
|
+
[72344, 72345, "NSM"],
|
|
6780
|
+
[72544, 72544, "NSM"],
|
|
6781
|
+
[72546, 72548, "NSM"],
|
|
6782
|
+
[72550, 72550, "NSM"],
|
|
6783
|
+
[72752, 72758, "NSM"],
|
|
6784
|
+
[72760, 72765, "NSM"],
|
|
6785
|
+
[72850, 72871, "NSM"],
|
|
6786
|
+
[72874, 72880, "NSM"],
|
|
6787
|
+
[72882, 72883, "NSM"],
|
|
6788
|
+
[72885, 72886, "NSM"],
|
|
6789
|
+
[73009, 73014, "NSM"],
|
|
6790
|
+
[73018, 73018, "NSM"],
|
|
6791
|
+
[73020, 73021, "NSM"],
|
|
6792
|
+
[73023, 73029, "NSM"],
|
|
6793
|
+
[73031, 73031, "NSM"],
|
|
6794
|
+
[73104, 73105, "NSM"],
|
|
6795
|
+
[73109, 73109, "NSM"],
|
|
6796
|
+
[73111, 73111, "NSM"],
|
|
6797
|
+
[73459, 73460, "NSM"],
|
|
6798
|
+
[73472, 73473, "NSM"],
|
|
6799
|
+
[73526, 73530, "NSM"],
|
|
6800
|
+
[73536, 73536, "NSM"],
|
|
6801
|
+
[73538, 73538, "NSM"],
|
|
6802
|
+
[73562, 73562, "NSM"],
|
|
6803
|
+
[73685, 73692, "ON"],
|
|
6804
|
+
[73693, 73696, "ET"],
|
|
6805
|
+
[73697, 73713, "ON"],
|
|
6806
|
+
[78912, 78912, "NSM"],
|
|
6807
|
+
[78919, 78933, "NSM"],
|
|
6808
|
+
[90398, 90409, "NSM"],
|
|
6809
|
+
[90413, 90415, "NSM"],
|
|
6810
|
+
[92912, 92916, "NSM"],
|
|
6811
|
+
[92976, 92982, "NSM"],
|
|
6812
|
+
[94031, 94031, "NSM"],
|
|
6813
|
+
[94095, 94098, "NSM"],
|
|
6814
|
+
[94178, 94178, "ON"],
|
|
6815
|
+
[94180, 94180, "NSM"],
|
|
6816
|
+
[113821, 113822, "NSM"],
|
|
6817
|
+
[113824, 113827, "BN"],
|
|
6818
|
+
[117760, 117973, "ON"],
|
|
6819
|
+
[118e3, 118009, "EN"],
|
|
6820
|
+
[118010, 118012, "ON"],
|
|
6821
|
+
[118016, 118451, "ON"],
|
|
6822
|
+
[118458, 118480, "ON"],
|
|
6823
|
+
[118496, 118512, "ON"],
|
|
6824
|
+
[118528, 118573, "NSM"],
|
|
6825
|
+
[118576, 118598, "NSM"],
|
|
6826
|
+
[119143, 119145, "NSM"],
|
|
6827
|
+
[119155, 119162, "BN"],
|
|
6828
|
+
[119163, 119170, "NSM"],
|
|
6829
|
+
[119173, 119179, "NSM"],
|
|
6830
|
+
[119210, 119213, "NSM"],
|
|
6831
|
+
[119273, 119274, "ON"],
|
|
6832
|
+
[119296, 119361, "ON"],
|
|
6833
|
+
[119362, 119364, "NSM"],
|
|
6834
|
+
[119365, 119365, "ON"],
|
|
6835
|
+
[119552, 119638, "ON"],
|
|
6836
|
+
[120513, 120513, "ON"],
|
|
6837
|
+
[120539, 120539, "ON"],
|
|
6838
|
+
[120571, 120571, "ON"],
|
|
6839
|
+
[120597, 120597, "ON"],
|
|
6840
|
+
[120629, 120629, "ON"],
|
|
6841
|
+
[120655, 120655, "ON"],
|
|
6842
|
+
[120687, 120687, "ON"],
|
|
6843
|
+
[120713, 120713, "ON"],
|
|
6844
|
+
[120745, 120745, "ON"],
|
|
6845
|
+
[120771, 120771, "ON"],
|
|
6846
|
+
[120782, 120831, "EN"],
|
|
6847
|
+
[121344, 121398, "NSM"],
|
|
6848
|
+
[121403, 121452, "NSM"],
|
|
6849
|
+
[121461, 121461, "NSM"],
|
|
6850
|
+
[121476, 121476, "NSM"],
|
|
6851
|
+
[121499, 121503, "NSM"],
|
|
6852
|
+
[121505, 121519, "NSM"],
|
|
6853
|
+
[122880, 122886, "NSM"],
|
|
6854
|
+
[122888, 122904, "NSM"],
|
|
6855
|
+
[122907, 122913, "NSM"],
|
|
6856
|
+
[122915, 122916, "NSM"],
|
|
6857
|
+
[122918, 122922, "NSM"],
|
|
6858
|
+
[123023, 123023, "NSM"],
|
|
6859
|
+
[123184, 123190, "NSM"],
|
|
6860
|
+
[123566, 123566, "NSM"],
|
|
6861
|
+
[123628, 123631, "NSM"],
|
|
6862
|
+
[123647, 123647, "ET"],
|
|
6863
|
+
[124140, 124143, "NSM"],
|
|
6864
|
+
[124398, 124399, "NSM"],
|
|
6865
|
+
[124643, 124643, "NSM"],
|
|
6866
|
+
[124646, 124646, "NSM"],
|
|
6867
|
+
[124654, 124655, "NSM"],
|
|
6868
|
+
[124661, 124661, "NSM"],
|
|
6869
|
+
[124928, 125135, "R"],
|
|
6870
|
+
[125136, 125142, "NSM"],
|
|
6871
|
+
[125143, 125251, "R"],
|
|
6872
|
+
[125252, 125258, "NSM"],
|
|
6873
|
+
[125259, 126063, "R"],
|
|
6874
|
+
[126064, 126143, "AL"],
|
|
6875
|
+
[126144, 126207, "R"],
|
|
6876
|
+
[126208, 126287, "AL"],
|
|
6877
|
+
[126288, 126463, "R"],
|
|
6878
|
+
[126464, 126703, "AL"],
|
|
6879
|
+
[126704, 126705, "ON"],
|
|
6880
|
+
[126706, 126719, "AL"],
|
|
6881
|
+
[126720, 126975, "R"],
|
|
6882
|
+
[126976, 127019, "ON"],
|
|
6883
|
+
[127024, 127123, "ON"],
|
|
6884
|
+
[127136, 127150, "ON"],
|
|
6885
|
+
[127153, 127167, "ON"],
|
|
6886
|
+
[127169, 127183, "ON"],
|
|
6887
|
+
[127185, 127221, "ON"],
|
|
6888
|
+
[127232, 127242, "EN"],
|
|
6889
|
+
[127243, 127247, "ON"],
|
|
6890
|
+
[127279, 127279, "ON"],
|
|
6891
|
+
[127338, 127343, "ON"],
|
|
6892
|
+
[127405, 127405, "ON"],
|
|
6893
|
+
[127584, 127589, "ON"],
|
|
6894
|
+
[127744, 128728, "ON"],
|
|
6895
|
+
[128732, 128748, "ON"],
|
|
6896
|
+
[128752, 128764, "ON"],
|
|
6897
|
+
[128768, 128985, "ON"],
|
|
6898
|
+
[128992, 129003, "ON"],
|
|
6899
|
+
[129008, 129008, "ON"],
|
|
6900
|
+
[129024, 129035, "ON"],
|
|
6901
|
+
[129040, 129095, "ON"],
|
|
6902
|
+
[129104, 129113, "ON"],
|
|
6903
|
+
[129120, 129159, "ON"],
|
|
6904
|
+
[129168, 129197, "ON"],
|
|
6905
|
+
[129200, 129211, "ON"],
|
|
6906
|
+
[129216, 129217, "ON"],
|
|
6907
|
+
[129232, 129240, "ON"],
|
|
6908
|
+
[129280, 129623, "ON"],
|
|
6909
|
+
[129632, 129645, "ON"],
|
|
6910
|
+
[129648, 129660, "ON"],
|
|
6911
|
+
[129664, 129674, "ON"],
|
|
6912
|
+
[129678, 129734, "ON"],
|
|
6913
|
+
[129736, 129736, "ON"],
|
|
6914
|
+
[129741, 129756, "ON"],
|
|
6915
|
+
[129759, 129770, "ON"],
|
|
6916
|
+
[129775, 129784, "ON"],
|
|
6917
|
+
[129792, 129938, "ON"],
|
|
6918
|
+
[129940, 130031, "ON"],
|
|
6919
|
+
[130032, 130041, "EN"],
|
|
6920
|
+
[130042, 130042, "ON"],
|
|
6921
|
+
[131070, 131071, "BN"],
|
|
6922
|
+
[196606, 196607, "BN"],
|
|
6923
|
+
[262142, 262143, "BN"],
|
|
6924
|
+
[327678, 327679, "BN"],
|
|
6925
|
+
[393214, 393215, "BN"],
|
|
6926
|
+
[458750, 458751, "BN"],
|
|
6927
|
+
[524286, 524287, "BN"],
|
|
6928
|
+
[589822, 589823, "BN"],
|
|
6929
|
+
[655358, 655359, "BN"],
|
|
6930
|
+
[720894, 720895, "BN"],
|
|
6931
|
+
[786430, 786431, "BN"],
|
|
6932
|
+
[851966, 851967, "BN"],
|
|
6933
|
+
[917502, 917759, "BN"],
|
|
6934
|
+
[917760, 917999, "NSM"],
|
|
6935
|
+
[918e3, 921599, "BN"],
|
|
6936
|
+
[983038, 983039, "BN"],
|
|
6937
|
+
[1048574, 1048575, "BN"],
|
|
6938
|
+
[1114110, 1114111, "BN"]
|
|
6939
|
+
];
|
|
4847
6940
|
}
|
|
4848
6941
|
});
|
|
4849
6942
|
|
|
4850
6943
|
// ../../node_modules/.bun/@chenglou+pretext@0.0.5/node_modules/@chenglou/pretext/dist/bidi.js
|
|
6944
|
+
function classifyCodePoint(codePoint) {
|
|
6945
|
+
if (codePoint <= 255)
|
|
6946
|
+
return latin1BidiTypes[codePoint];
|
|
6947
|
+
let lo = 0;
|
|
6948
|
+
let hi = nonLatin1BidiRanges.length - 1;
|
|
6949
|
+
while (lo <= hi) {
|
|
6950
|
+
const mid = lo + hi >> 1;
|
|
6951
|
+
const range = nonLatin1BidiRanges[mid];
|
|
6952
|
+
if (codePoint < range[0]) {
|
|
6953
|
+
hi = mid - 1;
|
|
6954
|
+
continue;
|
|
6955
|
+
}
|
|
6956
|
+
if (codePoint > range[1]) {
|
|
6957
|
+
lo = mid + 1;
|
|
6958
|
+
continue;
|
|
6959
|
+
}
|
|
6960
|
+
return range[2];
|
|
6961
|
+
}
|
|
6962
|
+
return "L";
|
|
6963
|
+
}
|
|
6964
|
+
function computeBidiLevels(str) {
|
|
6965
|
+
const len = str.length;
|
|
6966
|
+
if (len === 0)
|
|
6967
|
+
return null;
|
|
6968
|
+
const types3 = new Array(len);
|
|
6969
|
+
let sawBidi = false;
|
|
6970
|
+
for (let i2 = 0; i2 < len; ) {
|
|
6971
|
+
const first = str.charCodeAt(i2);
|
|
6972
|
+
let codePoint = first;
|
|
6973
|
+
let codeUnitLength = 1;
|
|
6974
|
+
if (first >= 55296 && first <= 56319 && i2 + 1 < len) {
|
|
6975
|
+
const second = str.charCodeAt(i2 + 1);
|
|
6976
|
+
if (second >= 56320 && second <= 57343) {
|
|
6977
|
+
codePoint = (first - 55296 << 10) + (second - 56320) + 65536;
|
|
6978
|
+
codeUnitLength = 2;
|
|
6979
|
+
}
|
|
6980
|
+
}
|
|
6981
|
+
const t3 = classifyCodePoint(codePoint);
|
|
6982
|
+
if (t3 === "R" || t3 === "AL" || t3 === "AN")
|
|
6983
|
+
sawBidi = true;
|
|
6984
|
+
for (let j2 = 0; j2 < codeUnitLength; j2++) {
|
|
6985
|
+
types3[i2 + j2] = t3;
|
|
6986
|
+
}
|
|
6987
|
+
i2 += codeUnitLength;
|
|
6988
|
+
}
|
|
6989
|
+
if (!sawBidi)
|
|
6990
|
+
return null;
|
|
6991
|
+
let startLevel = 0;
|
|
6992
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
6993
|
+
const t3 = types3[i2];
|
|
6994
|
+
if (t3 === "L") {
|
|
6995
|
+
startLevel = 0;
|
|
6996
|
+
break;
|
|
6997
|
+
}
|
|
6998
|
+
if (t3 === "R" || t3 === "AL") {
|
|
6999
|
+
startLevel = 1;
|
|
7000
|
+
break;
|
|
7001
|
+
}
|
|
7002
|
+
}
|
|
7003
|
+
const levels = new Int8Array(len);
|
|
7004
|
+
for (let i2 = 0; i2 < len; i2++)
|
|
7005
|
+
levels[i2] = startLevel;
|
|
7006
|
+
const e2 = startLevel & 1 ? "R" : "L";
|
|
7007
|
+
const sor = e2;
|
|
7008
|
+
let lastType = sor;
|
|
7009
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
7010
|
+
if (types3[i2] === "NSM")
|
|
7011
|
+
types3[i2] = lastType;
|
|
7012
|
+
else
|
|
7013
|
+
lastType = types3[i2];
|
|
7014
|
+
}
|
|
7015
|
+
lastType = sor;
|
|
7016
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
7017
|
+
const t3 = types3[i2];
|
|
7018
|
+
if (t3 === "EN")
|
|
7019
|
+
types3[i2] = lastType === "AL" ? "AN" : "EN";
|
|
7020
|
+
else if (t3 === "R" || t3 === "L" || t3 === "AL")
|
|
7021
|
+
lastType = t3;
|
|
7022
|
+
}
|
|
7023
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
7024
|
+
if (types3[i2] === "AL")
|
|
7025
|
+
types3[i2] = "R";
|
|
7026
|
+
}
|
|
7027
|
+
for (let i2 = 1; i2 < len - 1; i2++) {
|
|
7028
|
+
if (types3[i2] === "ES" && types3[i2 - 1] === "EN" && types3[i2 + 1] === "EN") {
|
|
7029
|
+
types3[i2] = "EN";
|
|
7030
|
+
}
|
|
7031
|
+
if (types3[i2] === "CS" && (types3[i2 - 1] === "EN" || types3[i2 - 1] === "AN") && types3[i2 + 1] === types3[i2 - 1]) {
|
|
7032
|
+
types3[i2] = types3[i2 - 1];
|
|
7033
|
+
}
|
|
7034
|
+
}
|
|
7035
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
7036
|
+
if (types3[i2] !== "EN")
|
|
7037
|
+
continue;
|
|
7038
|
+
let j2;
|
|
7039
|
+
for (j2 = i2 - 1; j2 >= 0 && types3[j2] === "ET"; j2--)
|
|
7040
|
+
types3[j2] = "EN";
|
|
7041
|
+
for (j2 = i2 + 1; j2 < len && types3[j2] === "ET"; j2++)
|
|
7042
|
+
types3[j2] = "EN";
|
|
7043
|
+
}
|
|
7044
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
7045
|
+
const t3 = types3[i2];
|
|
7046
|
+
if (t3 === "WS" || t3 === "ES" || t3 === "ET" || t3 === "CS")
|
|
7047
|
+
types3[i2] = "ON";
|
|
7048
|
+
}
|
|
7049
|
+
lastType = sor;
|
|
7050
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
7051
|
+
const t3 = types3[i2];
|
|
7052
|
+
if (t3 === "EN")
|
|
7053
|
+
types3[i2] = lastType === "L" ? "L" : "EN";
|
|
7054
|
+
else if (t3 === "R" || t3 === "L")
|
|
7055
|
+
lastType = t3;
|
|
7056
|
+
}
|
|
7057
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
7058
|
+
if (types3[i2] !== "ON")
|
|
7059
|
+
continue;
|
|
7060
|
+
let end = i2 + 1;
|
|
7061
|
+
while (end < len && types3[end] === "ON")
|
|
7062
|
+
end++;
|
|
7063
|
+
const before2 = i2 > 0 ? types3[i2 - 1] : sor;
|
|
7064
|
+
const after2 = end < len ? types3[end] : sor;
|
|
7065
|
+
const bDir = before2 !== "L" ? "R" : "L";
|
|
7066
|
+
const aDir = after2 !== "L" ? "R" : "L";
|
|
7067
|
+
if (bDir === aDir) {
|
|
7068
|
+
for (let j2 = i2; j2 < end; j2++)
|
|
7069
|
+
types3[j2] = bDir;
|
|
7070
|
+
}
|
|
7071
|
+
i2 = end - 1;
|
|
7072
|
+
}
|
|
7073
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
7074
|
+
if (types3[i2] === "ON")
|
|
7075
|
+
types3[i2] = e2;
|
|
7076
|
+
}
|
|
7077
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
7078
|
+
const t3 = types3[i2];
|
|
7079
|
+
if ((levels[i2] & 1) === 0) {
|
|
7080
|
+
if (t3 === "R")
|
|
7081
|
+
levels[i2]++;
|
|
7082
|
+
else if (t3 === "AN" || t3 === "EN")
|
|
7083
|
+
levels[i2] += 2;
|
|
7084
|
+
} else if (t3 === "L" || t3 === "AN" || t3 === "EN") {
|
|
7085
|
+
levels[i2]++;
|
|
7086
|
+
}
|
|
7087
|
+
}
|
|
7088
|
+
return levels;
|
|
7089
|
+
}
|
|
7090
|
+
function computeSegmentLevels(normalized, segStarts) {
|
|
7091
|
+
const bidiLevels = computeBidiLevels(normalized);
|
|
7092
|
+
if (bidiLevels === null)
|
|
7093
|
+
return null;
|
|
7094
|
+
const segLevels = new Int8Array(segStarts.length);
|
|
7095
|
+
for (let i2 = 0; i2 < segStarts.length; i2++) {
|
|
7096
|
+
segLevels[i2] = bidiLevels[segStarts[i2]];
|
|
7097
|
+
}
|
|
7098
|
+
return segLevels;
|
|
7099
|
+
}
|
|
4851
7100
|
var init_bidi = __esm({
|
|
4852
7101
|
"../../node_modules/.bun/@chenglou+pretext@0.0.5/node_modules/@chenglou/pretext/dist/bidi.js"() {
|
|
4853
7102
|
"use strict";
|
|
@@ -4856,27 +7105,1583 @@ var init_bidi = __esm({
|
|
|
4856
7105
|
});
|
|
4857
7106
|
|
|
4858
7107
|
// ../../node_modules/.bun/@chenglou+pretext@0.0.5/node_modules/@chenglou/pretext/dist/analysis.js
|
|
4859
|
-
|
|
7108
|
+
function getWhiteSpaceProfile(whiteSpace) {
|
|
7109
|
+
const mode = whiteSpace ?? "normal";
|
|
7110
|
+
return mode === "pre-wrap" ? { mode, preserveOrdinarySpaces: true, preserveHardBreaks: true } : { mode, preserveOrdinarySpaces: false, preserveHardBreaks: false };
|
|
7111
|
+
}
|
|
7112
|
+
function normalizeWhitespaceNormal(text) {
|
|
7113
|
+
if (!needsWhitespaceNormalizationRe.test(text))
|
|
7114
|
+
return text;
|
|
7115
|
+
let normalized = text.replace(collapsibleWhitespaceRunRe, " ");
|
|
7116
|
+
if (normalized.charCodeAt(0) === 32) {
|
|
7117
|
+
normalized = normalized.slice(1);
|
|
7118
|
+
}
|
|
7119
|
+
if (normalized.length > 0 && normalized.charCodeAt(normalized.length - 1) === 32) {
|
|
7120
|
+
normalized = normalized.slice(0, -1);
|
|
7121
|
+
}
|
|
7122
|
+
return normalized;
|
|
7123
|
+
}
|
|
7124
|
+
function normalizeWhitespacePreWrap(text) {
|
|
7125
|
+
if (!/[\r\f]/.test(text))
|
|
7126
|
+
return text.replace(/\r\n/g, "\n");
|
|
7127
|
+
return text.replace(/\r\n/g, "\n").replace(/[\r\f]/g, "\n");
|
|
7128
|
+
}
|
|
7129
|
+
function getSharedWordSegmenter() {
|
|
7130
|
+
if (sharedWordSegmenter === null) {
|
|
7131
|
+
sharedWordSegmenter = new Intl.Segmenter(segmenterLocale, { granularity: "word" });
|
|
7132
|
+
}
|
|
7133
|
+
return sharedWordSegmenter;
|
|
7134
|
+
}
|
|
7135
|
+
function containsArabicScript(text) {
|
|
7136
|
+
return arabicScriptRe.test(text);
|
|
7137
|
+
}
|
|
7138
|
+
function isCJKCodePoint(codePoint) {
|
|
7139
|
+
return codePoint >= 19968 && codePoint <= 40959 || codePoint >= 13312 && codePoint <= 19903 || codePoint >= 131072 && codePoint <= 173791 || codePoint >= 173824 && codePoint <= 177983 || codePoint >= 177984 && codePoint <= 178207 || codePoint >= 178208 && codePoint <= 183983 || codePoint >= 183984 && codePoint <= 191471 || codePoint >= 191472 && codePoint <= 192093 || codePoint >= 194560 && codePoint <= 195103 || codePoint >= 196608 && codePoint <= 201551 || codePoint >= 201552 && codePoint <= 205743 || codePoint >= 205744 && codePoint <= 210041 || codePoint >= 63744 && codePoint <= 64255 || codePoint >= 12288 && codePoint <= 12351 || codePoint >= 12352 && codePoint <= 12447 || codePoint >= 12448 && codePoint <= 12543 || codePoint >= 44032 && codePoint <= 55215 || codePoint >= 65280 && codePoint <= 65519;
|
|
7140
|
+
}
|
|
7141
|
+
function isCJK(s2) {
|
|
7142
|
+
for (let i2 = 0; i2 < s2.length; i2++) {
|
|
7143
|
+
const first = s2.charCodeAt(i2);
|
|
7144
|
+
if (first < 12288)
|
|
7145
|
+
continue;
|
|
7146
|
+
if (first >= 55296 && first <= 56319 && i2 + 1 < s2.length) {
|
|
7147
|
+
const second = s2.charCodeAt(i2 + 1);
|
|
7148
|
+
if (second >= 56320 && second <= 57343) {
|
|
7149
|
+
const codePoint = (first - 55296 << 10) + (second - 56320) + 65536;
|
|
7150
|
+
if (isCJKCodePoint(codePoint))
|
|
7151
|
+
return true;
|
|
7152
|
+
i2++;
|
|
7153
|
+
continue;
|
|
7154
|
+
}
|
|
7155
|
+
}
|
|
7156
|
+
if (isCJKCodePoint(first))
|
|
7157
|
+
return true;
|
|
7158
|
+
}
|
|
7159
|
+
return false;
|
|
7160
|
+
}
|
|
7161
|
+
function endsWithLineStartProhibitedText(text) {
|
|
7162
|
+
const last = getLastCodePoint(text);
|
|
7163
|
+
return last !== null && (kinsokuStart.has(last) || leftStickyPunctuation.has(last));
|
|
7164
|
+
}
|
|
7165
|
+
function containsCJKText(text) {
|
|
7166
|
+
return isCJK(text);
|
|
7167
|
+
}
|
|
7168
|
+
function endsWithKeepAllGlueText(text) {
|
|
7169
|
+
const last = getLastCodePoint(text);
|
|
7170
|
+
return last !== null && keepAllGlueChars.has(last);
|
|
7171
|
+
}
|
|
7172
|
+
function canContinueKeepAllTextRun(previousText) {
|
|
7173
|
+
return !endsWithLineStartProhibitedText(previousText) && !endsWithKeepAllGlueText(previousText);
|
|
7174
|
+
}
|
|
7175
|
+
function isLeftStickyPunctuationSegment(segment) {
|
|
7176
|
+
if (isEscapedQuoteClusterSegment(segment))
|
|
7177
|
+
return true;
|
|
7178
|
+
let sawPunctuation = false;
|
|
7179
|
+
for (const ch of segment) {
|
|
7180
|
+
if (leftStickyPunctuation.has(ch)) {
|
|
7181
|
+
sawPunctuation = true;
|
|
7182
|
+
continue;
|
|
7183
|
+
}
|
|
7184
|
+
if (sawPunctuation && combiningMarkRe.test(ch))
|
|
7185
|
+
continue;
|
|
7186
|
+
return false;
|
|
7187
|
+
}
|
|
7188
|
+
return sawPunctuation;
|
|
7189
|
+
}
|
|
7190
|
+
function isCJKLineStartProhibitedSegment(segment) {
|
|
7191
|
+
for (const ch of segment) {
|
|
7192
|
+
if (!kinsokuStart.has(ch) && !leftStickyPunctuation.has(ch))
|
|
7193
|
+
return false;
|
|
7194
|
+
}
|
|
7195
|
+
return segment.length > 0;
|
|
7196
|
+
}
|
|
7197
|
+
function isForwardStickyClusterSegment(segment) {
|
|
7198
|
+
if (isEscapedQuoteClusterSegment(segment))
|
|
7199
|
+
return true;
|
|
7200
|
+
for (const ch of segment) {
|
|
7201
|
+
if (!kinsokuEnd.has(ch) && !forwardStickyGlue.has(ch) && !combiningMarkRe.test(ch))
|
|
7202
|
+
return false;
|
|
7203
|
+
}
|
|
7204
|
+
return segment.length > 0;
|
|
7205
|
+
}
|
|
7206
|
+
function isEscapedQuoteClusterSegment(segment) {
|
|
7207
|
+
let sawQuote = false;
|
|
7208
|
+
for (const ch of segment) {
|
|
7209
|
+
if (ch === "\\" || combiningMarkRe.test(ch))
|
|
7210
|
+
continue;
|
|
7211
|
+
if (kinsokuEnd.has(ch) || leftStickyPunctuation.has(ch) || forwardStickyGlue.has(ch)) {
|
|
7212
|
+
sawQuote = true;
|
|
7213
|
+
continue;
|
|
7214
|
+
}
|
|
7215
|
+
return false;
|
|
7216
|
+
}
|
|
7217
|
+
return sawQuote;
|
|
7218
|
+
}
|
|
7219
|
+
function previousCodePointStart(text, end) {
|
|
7220
|
+
const last = end - 1;
|
|
7221
|
+
if (last <= 0)
|
|
7222
|
+
return Math.max(last, 0);
|
|
7223
|
+
const lastCodeUnit = text.charCodeAt(last);
|
|
7224
|
+
if (lastCodeUnit < 56320 || lastCodeUnit > 57343)
|
|
7225
|
+
return last;
|
|
7226
|
+
const maybeHigh = last - 1;
|
|
7227
|
+
if (maybeHigh < 0)
|
|
7228
|
+
return last;
|
|
7229
|
+
const highCodeUnit = text.charCodeAt(maybeHigh);
|
|
7230
|
+
return highCodeUnit >= 55296 && highCodeUnit <= 56319 ? maybeHigh : last;
|
|
7231
|
+
}
|
|
7232
|
+
function getLastCodePoint(text) {
|
|
7233
|
+
if (text.length === 0)
|
|
7234
|
+
return null;
|
|
7235
|
+
const start = previousCodePointStart(text, text.length);
|
|
7236
|
+
return text.slice(start);
|
|
7237
|
+
}
|
|
7238
|
+
function splitTrailingForwardStickyCluster(text) {
|
|
7239
|
+
const chars = Array.from(text);
|
|
7240
|
+
let splitIndex = chars.length;
|
|
7241
|
+
while (splitIndex > 0) {
|
|
7242
|
+
const ch = chars[splitIndex - 1];
|
|
7243
|
+
if (combiningMarkRe.test(ch)) {
|
|
7244
|
+
splitIndex--;
|
|
7245
|
+
continue;
|
|
7246
|
+
}
|
|
7247
|
+
if (kinsokuEnd.has(ch) || forwardStickyGlue.has(ch)) {
|
|
7248
|
+
splitIndex--;
|
|
7249
|
+
continue;
|
|
7250
|
+
}
|
|
7251
|
+
break;
|
|
7252
|
+
}
|
|
7253
|
+
if (splitIndex <= 0 || splitIndex === chars.length)
|
|
7254
|
+
return null;
|
|
7255
|
+
return {
|
|
7256
|
+
head: chars.slice(0, splitIndex).join(""),
|
|
7257
|
+
tail: chars.slice(splitIndex).join("")
|
|
7258
|
+
};
|
|
7259
|
+
}
|
|
7260
|
+
function getRepeatableSingleCharRunChar(text, isWordLike, kind) {
|
|
7261
|
+
return kind === "text" && !isWordLike && text.length === 1 && text !== "-" && text !== "\u2014" ? text : null;
|
|
7262
|
+
}
|
|
7263
|
+
function materializeDeferredSingleCharRun(texts, chars, lengths, index) {
|
|
7264
|
+
const ch = chars[index];
|
|
7265
|
+
const text = texts[index];
|
|
7266
|
+
if (ch == null)
|
|
7267
|
+
return text;
|
|
7268
|
+
const length = lengths[index];
|
|
7269
|
+
if (text.length === length)
|
|
7270
|
+
return text;
|
|
7271
|
+
const materialized = ch.repeat(length);
|
|
7272
|
+
texts[index] = materialized;
|
|
7273
|
+
return materialized;
|
|
7274
|
+
}
|
|
7275
|
+
function hasArabicNoSpacePunctuation(containsArabic, lastCodePoint) {
|
|
7276
|
+
return containsArabic && lastCodePoint !== null && arabicNoSpaceTrailingPunctuation.has(lastCodePoint);
|
|
7277
|
+
}
|
|
7278
|
+
function endsWithMyanmarMedialGlue(segment) {
|
|
7279
|
+
const lastCodePoint = getLastCodePoint(segment);
|
|
7280
|
+
return lastCodePoint !== null && myanmarMedialGlue.has(lastCodePoint);
|
|
7281
|
+
}
|
|
7282
|
+
function splitLeadingSpaceAndMarks(segment) {
|
|
7283
|
+
if (segment.length < 2 || segment[0] !== " ")
|
|
7284
|
+
return null;
|
|
7285
|
+
const marks = segment.slice(1);
|
|
7286
|
+
if (new RegExp("^\\p{M}+$", "u").test(marks)) {
|
|
7287
|
+
return { space: " ", marks };
|
|
7288
|
+
}
|
|
7289
|
+
return null;
|
|
7290
|
+
}
|
|
7291
|
+
function endsWithClosingQuote(text) {
|
|
7292
|
+
let end = text.length;
|
|
7293
|
+
while (end > 0) {
|
|
7294
|
+
const start = previousCodePointStart(text, end);
|
|
7295
|
+
const ch = text.slice(start, end);
|
|
7296
|
+
if (closingQuoteChars.has(ch))
|
|
7297
|
+
return true;
|
|
7298
|
+
if (!leftStickyPunctuation.has(ch))
|
|
7299
|
+
return false;
|
|
7300
|
+
end = start;
|
|
7301
|
+
}
|
|
7302
|
+
return false;
|
|
7303
|
+
}
|
|
7304
|
+
function classifySegmentBreakChar(ch, whiteSpaceProfile) {
|
|
7305
|
+
if (whiteSpaceProfile.preserveOrdinarySpaces || whiteSpaceProfile.preserveHardBreaks) {
|
|
7306
|
+
if (ch === " ")
|
|
7307
|
+
return "preserved-space";
|
|
7308
|
+
if (ch === " ")
|
|
7309
|
+
return "tab";
|
|
7310
|
+
if (whiteSpaceProfile.preserveHardBreaks && ch === "\n")
|
|
7311
|
+
return "hard-break";
|
|
7312
|
+
}
|
|
7313
|
+
if (ch === " ")
|
|
7314
|
+
return "space";
|
|
7315
|
+
if (ch === "\xA0" || ch === "\u202F" || ch === "\u2060" || ch === "\uFEFF") {
|
|
7316
|
+
return "glue";
|
|
7317
|
+
}
|
|
7318
|
+
if (ch === "\u200B")
|
|
7319
|
+
return "zero-width-break";
|
|
7320
|
+
if (ch === "\xAD")
|
|
7321
|
+
return "soft-hyphen";
|
|
7322
|
+
return "text";
|
|
7323
|
+
}
|
|
7324
|
+
function joinTextParts(parts) {
|
|
7325
|
+
return parts.length === 1 ? parts[0] : parts.join("");
|
|
7326
|
+
}
|
|
7327
|
+
function joinReversedPrefixParts(prefixParts, tail) {
|
|
7328
|
+
const parts = [];
|
|
7329
|
+
for (let i2 = prefixParts.length - 1; i2 >= 0; i2--) {
|
|
7330
|
+
parts.push(prefixParts[i2]);
|
|
7331
|
+
}
|
|
7332
|
+
parts.push(tail);
|
|
7333
|
+
return joinTextParts(parts);
|
|
7334
|
+
}
|
|
7335
|
+
function splitSegmentByBreakKind(segment, isWordLike, start, whiteSpaceProfile) {
|
|
7336
|
+
if (!breakCharRe.test(segment)) {
|
|
7337
|
+
return [{ text: segment, isWordLike, kind: "text", start }];
|
|
7338
|
+
}
|
|
7339
|
+
const pieces = [];
|
|
7340
|
+
let currentKind = null;
|
|
7341
|
+
let currentTextParts = [];
|
|
7342
|
+
let currentStart = start;
|
|
7343
|
+
let currentWordLike = false;
|
|
7344
|
+
let offset = 0;
|
|
7345
|
+
for (const ch of segment) {
|
|
7346
|
+
const kind = classifySegmentBreakChar(ch, whiteSpaceProfile);
|
|
7347
|
+
const wordLike = kind === "text" && isWordLike;
|
|
7348
|
+
if (currentKind !== null && kind === currentKind && wordLike === currentWordLike) {
|
|
7349
|
+
currentTextParts.push(ch);
|
|
7350
|
+
offset += ch.length;
|
|
7351
|
+
continue;
|
|
7352
|
+
}
|
|
7353
|
+
if (currentKind !== null) {
|
|
7354
|
+
pieces.push({
|
|
7355
|
+
text: joinTextParts(currentTextParts),
|
|
7356
|
+
isWordLike: currentWordLike,
|
|
7357
|
+
kind: currentKind,
|
|
7358
|
+
start: currentStart
|
|
7359
|
+
});
|
|
7360
|
+
}
|
|
7361
|
+
currentKind = kind;
|
|
7362
|
+
currentTextParts = [ch];
|
|
7363
|
+
currentStart = start + offset;
|
|
7364
|
+
currentWordLike = wordLike;
|
|
7365
|
+
offset += ch.length;
|
|
7366
|
+
}
|
|
7367
|
+
if (currentKind !== null) {
|
|
7368
|
+
pieces.push({
|
|
7369
|
+
text: joinTextParts(currentTextParts),
|
|
7370
|
+
isWordLike: currentWordLike,
|
|
7371
|
+
kind: currentKind,
|
|
7372
|
+
start: currentStart
|
|
7373
|
+
});
|
|
7374
|
+
}
|
|
7375
|
+
return pieces;
|
|
7376
|
+
}
|
|
7377
|
+
function isTextRunBoundary(kind) {
|
|
7378
|
+
return kind === "space" || kind === "preserved-space" || kind === "zero-width-break" || kind === "hard-break";
|
|
7379
|
+
}
|
|
7380
|
+
function isUrlLikeRunStart(segmentation, index) {
|
|
7381
|
+
const text = segmentation.texts[index];
|
|
7382
|
+
if (text.startsWith("www."))
|
|
7383
|
+
return true;
|
|
7384
|
+
return urlSchemeSegmentRe.test(text) && index + 1 < segmentation.len && segmentation.kinds[index + 1] === "text" && segmentation.texts[index + 1] === "//";
|
|
7385
|
+
}
|
|
7386
|
+
function isUrlQueryBoundarySegment(text) {
|
|
7387
|
+
return text.includes("?") && (text.includes("://") || text.startsWith("www."));
|
|
7388
|
+
}
|
|
7389
|
+
function mergeUrlLikeRuns(segmentation) {
|
|
7390
|
+
const texts = segmentation.texts.slice();
|
|
7391
|
+
const isWordLike = segmentation.isWordLike.slice();
|
|
7392
|
+
const kinds = segmentation.kinds.slice();
|
|
7393
|
+
const starts = segmentation.starts.slice();
|
|
7394
|
+
for (let i2 = 0; i2 < segmentation.len; i2++) {
|
|
7395
|
+
if (kinds[i2] !== "text" || !isUrlLikeRunStart(segmentation, i2))
|
|
7396
|
+
continue;
|
|
7397
|
+
const mergedParts = [texts[i2]];
|
|
7398
|
+
let j2 = i2 + 1;
|
|
7399
|
+
while (j2 < segmentation.len && !isTextRunBoundary(kinds[j2])) {
|
|
7400
|
+
mergedParts.push(texts[j2]);
|
|
7401
|
+
isWordLike[i2] = true;
|
|
7402
|
+
const endsQueryPrefix = texts[j2].includes("?");
|
|
7403
|
+
kinds[j2] = "text";
|
|
7404
|
+
texts[j2] = "";
|
|
7405
|
+
j2++;
|
|
7406
|
+
if (endsQueryPrefix)
|
|
7407
|
+
break;
|
|
7408
|
+
}
|
|
7409
|
+
texts[i2] = joinTextParts(mergedParts);
|
|
7410
|
+
}
|
|
7411
|
+
let compactLen = 0;
|
|
7412
|
+
for (let read = 0; read < texts.length; read++) {
|
|
7413
|
+
const text = texts[read];
|
|
7414
|
+
if (text.length === 0)
|
|
7415
|
+
continue;
|
|
7416
|
+
if (compactLen !== read) {
|
|
7417
|
+
texts[compactLen] = text;
|
|
7418
|
+
isWordLike[compactLen] = isWordLike[read];
|
|
7419
|
+
kinds[compactLen] = kinds[read];
|
|
7420
|
+
starts[compactLen] = starts[read];
|
|
7421
|
+
}
|
|
7422
|
+
compactLen++;
|
|
7423
|
+
}
|
|
7424
|
+
texts.length = compactLen;
|
|
7425
|
+
isWordLike.length = compactLen;
|
|
7426
|
+
kinds.length = compactLen;
|
|
7427
|
+
starts.length = compactLen;
|
|
7428
|
+
return {
|
|
7429
|
+
len: compactLen,
|
|
7430
|
+
texts,
|
|
7431
|
+
isWordLike,
|
|
7432
|
+
kinds,
|
|
7433
|
+
starts
|
|
7434
|
+
};
|
|
7435
|
+
}
|
|
7436
|
+
function mergeUrlQueryRuns(segmentation) {
|
|
7437
|
+
const texts = [];
|
|
7438
|
+
const isWordLike = [];
|
|
7439
|
+
const kinds = [];
|
|
7440
|
+
const starts = [];
|
|
7441
|
+
for (let i2 = 0; i2 < segmentation.len; i2++) {
|
|
7442
|
+
const text = segmentation.texts[i2];
|
|
7443
|
+
texts.push(text);
|
|
7444
|
+
isWordLike.push(segmentation.isWordLike[i2]);
|
|
7445
|
+
kinds.push(segmentation.kinds[i2]);
|
|
7446
|
+
starts.push(segmentation.starts[i2]);
|
|
7447
|
+
if (!isUrlQueryBoundarySegment(text))
|
|
7448
|
+
continue;
|
|
7449
|
+
const nextIndex = i2 + 1;
|
|
7450
|
+
if (nextIndex >= segmentation.len || isTextRunBoundary(segmentation.kinds[nextIndex])) {
|
|
7451
|
+
continue;
|
|
7452
|
+
}
|
|
7453
|
+
const queryParts = [];
|
|
7454
|
+
const queryStart = segmentation.starts[nextIndex];
|
|
7455
|
+
let j2 = nextIndex;
|
|
7456
|
+
while (j2 < segmentation.len && !isTextRunBoundary(segmentation.kinds[j2])) {
|
|
7457
|
+
queryParts.push(segmentation.texts[j2]);
|
|
7458
|
+
j2++;
|
|
7459
|
+
}
|
|
7460
|
+
if (queryParts.length > 0) {
|
|
7461
|
+
texts.push(joinTextParts(queryParts));
|
|
7462
|
+
isWordLike.push(true);
|
|
7463
|
+
kinds.push("text");
|
|
7464
|
+
starts.push(queryStart);
|
|
7465
|
+
i2 = j2 - 1;
|
|
7466
|
+
}
|
|
7467
|
+
}
|
|
7468
|
+
return {
|
|
7469
|
+
len: texts.length,
|
|
7470
|
+
texts,
|
|
7471
|
+
isWordLike,
|
|
7472
|
+
kinds,
|
|
7473
|
+
starts
|
|
7474
|
+
};
|
|
7475
|
+
}
|
|
7476
|
+
function segmentContainsDecimalDigit(text) {
|
|
7477
|
+
for (const ch of text) {
|
|
7478
|
+
if (decimalDigitRe.test(ch))
|
|
7479
|
+
return true;
|
|
7480
|
+
}
|
|
7481
|
+
return false;
|
|
7482
|
+
}
|
|
7483
|
+
function isNumericRunSegment(text) {
|
|
7484
|
+
if (text.length === 0)
|
|
7485
|
+
return false;
|
|
7486
|
+
for (const ch of text) {
|
|
7487
|
+
if (decimalDigitRe.test(ch) || numericJoinerChars.has(ch))
|
|
7488
|
+
continue;
|
|
7489
|
+
return false;
|
|
7490
|
+
}
|
|
7491
|
+
return true;
|
|
7492
|
+
}
|
|
7493
|
+
function mergeNumericRuns(segmentation) {
|
|
7494
|
+
const texts = [];
|
|
7495
|
+
const isWordLike = [];
|
|
7496
|
+
const kinds = [];
|
|
7497
|
+
const starts = [];
|
|
7498
|
+
for (let i2 = 0; i2 < segmentation.len; i2++) {
|
|
7499
|
+
const text = segmentation.texts[i2];
|
|
7500
|
+
const kind = segmentation.kinds[i2];
|
|
7501
|
+
if (kind === "text" && isNumericRunSegment(text) && segmentContainsDecimalDigit(text)) {
|
|
7502
|
+
const mergedParts = [text];
|
|
7503
|
+
let j2 = i2 + 1;
|
|
7504
|
+
while (j2 < segmentation.len && segmentation.kinds[j2] === "text" && isNumericRunSegment(segmentation.texts[j2])) {
|
|
7505
|
+
mergedParts.push(segmentation.texts[j2]);
|
|
7506
|
+
j2++;
|
|
7507
|
+
}
|
|
7508
|
+
texts.push(joinTextParts(mergedParts));
|
|
7509
|
+
isWordLike.push(true);
|
|
7510
|
+
kinds.push("text");
|
|
7511
|
+
starts.push(segmentation.starts[i2]);
|
|
7512
|
+
i2 = j2 - 1;
|
|
7513
|
+
continue;
|
|
7514
|
+
}
|
|
7515
|
+
texts.push(text);
|
|
7516
|
+
isWordLike.push(segmentation.isWordLike[i2]);
|
|
7517
|
+
kinds.push(kind);
|
|
7518
|
+
starts.push(segmentation.starts[i2]);
|
|
7519
|
+
}
|
|
7520
|
+
return {
|
|
7521
|
+
len: texts.length,
|
|
7522
|
+
texts,
|
|
7523
|
+
isWordLike,
|
|
7524
|
+
kinds,
|
|
7525
|
+
starts
|
|
7526
|
+
};
|
|
7527
|
+
}
|
|
7528
|
+
function mergeAsciiPunctuationChains(segmentation) {
|
|
7529
|
+
const texts = [];
|
|
7530
|
+
const isWordLike = [];
|
|
7531
|
+
const kinds = [];
|
|
7532
|
+
const starts = [];
|
|
7533
|
+
for (let i2 = 0; i2 < segmentation.len; i2++) {
|
|
7534
|
+
const text = segmentation.texts[i2];
|
|
7535
|
+
const kind = segmentation.kinds[i2];
|
|
7536
|
+
const wordLike = segmentation.isWordLike[i2];
|
|
7537
|
+
if (kind === "text" && wordLike && asciiPunctuationChainSegmentRe.test(text)) {
|
|
7538
|
+
const mergedParts = [text];
|
|
7539
|
+
let endsWithJoiners = asciiPunctuationChainTrailingJoinersRe.test(text);
|
|
7540
|
+
let j2 = i2 + 1;
|
|
7541
|
+
while (endsWithJoiners && j2 < segmentation.len && segmentation.kinds[j2] === "text" && segmentation.isWordLike[j2] && asciiPunctuationChainSegmentRe.test(segmentation.texts[j2])) {
|
|
7542
|
+
const nextText = segmentation.texts[j2];
|
|
7543
|
+
mergedParts.push(nextText);
|
|
7544
|
+
endsWithJoiners = asciiPunctuationChainTrailingJoinersRe.test(nextText);
|
|
7545
|
+
j2++;
|
|
7546
|
+
}
|
|
7547
|
+
texts.push(joinTextParts(mergedParts));
|
|
7548
|
+
isWordLike.push(true);
|
|
7549
|
+
kinds.push("text");
|
|
7550
|
+
starts.push(segmentation.starts[i2]);
|
|
7551
|
+
i2 = j2 - 1;
|
|
7552
|
+
continue;
|
|
7553
|
+
}
|
|
7554
|
+
texts.push(text);
|
|
7555
|
+
isWordLike.push(wordLike);
|
|
7556
|
+
kinds.push(kind);
|
|
7557
|
+
starts.push(segmentation.starts[i2]);
|
|
7558
|
+
}
|
|
7559
|
+
return {
|
|
7560
|
+
len: texts.length,
|
|
7561
|
+
texts,
|
|
7562
|
+
isWordLike,
|
|
7563
|
+
kinds,
|
|
7564
|
+
starts
|
|
7565
|
+
};
|
|
7566
|
+
}
|
|
7567
|
+
function splitHyphenatedNumericRuns(segmentation) {
|
|
7568
|
+
const texts = [];
|
|
7569
|
+
const isWordLike = [];
|
|
7570
|
+
const kinds = [];
|
|
7571
|
+
const starts = [];
|
|
7572
|
+
for (let i2 = 0; i2 < segmentation.len; i2++) {
|
|
7573
|
+
const text = segmentation.texts[i2];
|
|
7574
|
+
if (segmentation.kinds[i2] === "text" && text.includes("-")) {
|
|
7575
|
+
const parts = text.split("-");
|
|
7576
|
+
let shouldSplit = parts.length > 1;
|
|
7577
|
+
for (let j2 = 0; j2 < parts.length; j2++) {
|
|
7578
|
+
const part = parts[j2];
|
|
7579
|
+
if (!shouldSplit)
|
|
7580
|
+
break;
|
|
7581
|
+
if (part.length === 0 || !segmentContainsDecimalDigit(part) || !isNumericRunSegment(part)) {
|
|
7582
|
+
shouldSplit = false;
|
|
7583
|
+
}
|
|
7584
|
+
}
|
|
7585
|
+
if (shouldSplit) {
|
|
7586
|
+
let offset = 0;
|
|
7587
|
+
for (let j2 = 0; j2 < parts.length; j2++) {
|
|
7588
|
+
const part = parts[j2];
|
|
7589
|
+
const splitText = j2 < parts.length - 1 ? `${part}-` : part;
|
|
7590
|
+
texts.push(splitText);
|
|
7591
|
+
isWordLike.push(true);
|
|
7592
|
+
kinds.push("text");
|
|
7593
|
+
starts.push(segmentation.starts[i2] + offset);
|
|
7594
|
+
offset += splitText.length;
|
|
7595
|
+
}
|
|
7596
|
+
continue;
|
|
7597
|
+
}
|
|
7598
|
+
}
|
|
7599
|
+
texts.push(text);
|
|
7600
|
+
isWordLike.push(segmentation.isWordLike[i2]);
|
|
7601
|
+
kinds.push(segmentation.kinds[i2]);
|
|
7602
|
+
starts.push(segmentation.starts[i2]);
|
|
7603
|
+
}
|
|
7604
|
+
return {
|
|
7605
|
+
len: texts.length,
|
|
7606
|
+
texts,
|
|
7607
|
+
isWordLike,
|
|
7608
|
+
kinds,
|
|
7609
|
+
starts
|
|
7610
|
+
};
|
|
7611
|
+
}
|
|
7612
|
+
function mergeGlueConnectedTextRuns(segmentation) {
|
|
7613
|
+
const texts = [];
|
|
7614
|
+
const isWordLike = [];
|
|
7615
|
+
const kinds = [];
|
|
7616
|
+
const starts = [];
|
|
7617
|
+
let read = 0;
|
|
7618
|
+
while (read < segmentation.len) {
|
|
7619
|
+
const textParts = [segmentation.texts[read]];
|
|
7620
|
+
let wordLike = segmentation.isWordLike[read];
|
|
7621
|
+
let kind = segmentation.kinds[read];
|
|
7622
|
+
let start = segmentation.starts[read];
|
|
7623
|
+
if (kind === "glue") {
|
|
7624
|
+
const glueParts = [textParts[0]];
|
|
7625
|
+
const glueStart = start;
|
|
7626
|
+
read++;
|
|
7627
|
+
while (read < segmentation.len && segmentation.kinds[read] === "glue") {
|
|
7628
|
+
glueParts.push(segmentation.texts[read]);
|
|
7629
|
+
read++;
|
|
7630
|
+
}
|
|
7631
|
+
const glueText = joinTextParts(glueParts);
|
|
7632
|
+
if (read < segmentation.len && segmentation.kinds[read] === "text") {
|
|
7633
|
+
textParts[0] = glueText;
|
|
7634
|
+
textParts.push(segmentation.texts[read]);
|
|
7635
|
+
wordLike = segmentation.isWordLike[read];
|
|
7636
|
+
kind = "text";
|
|
7637
|
+
start = glueStart;
|
|
7638
|
+
read++;
|
|
7639
|
+
} else {
|
|
7640
|
+
texts.push(glueText);
|
|
7641
|
+
isWordLike.push(false);
|
|
7642
|
+
kinds.push("glue");
|
|
7643
|
+
starts.push(glueStart);
|
|
7644
|
+
continue;
|
|
7645
|
+
}
|
|
7646
|
+
} else {
|
|
7647
|
+
read++;
|
|
7648
|
+
}
|
|
7649
|
+
if (kind === "text") {
|
|
7650
|
+
while (read < segmentation.len && segmentation.kinds[read] === "glue") {
|
|
7651
|
+
const glueParts = [];
|
|
7652
|
+
while (read < segmentation.len && segmentation.kinds[read] === "glue") {
|
|
7653
|
+
glueParts.push(segmentation.texts[read]);
|
|
7654
|
+
read++;
|
|
7655
|
+
}
|
|
7656
|
+
const glueText = joinTextParts(glueParts);
|
|
7657
|
+
if (read < segmentation.len && segmentation.kinds[read] === "text") {
|
|
7658
|
+
textParts.push(glueText, segmentation.texts[read]);
|
|
7659
|
+
wordLike = wordLike || segmentation.isWordLike[read];
|
|
7660
|
+
read++;
|
|
7661
|
+
continue;
|
|
7662
|
+
}
|
|
7663
|
+
textParts.push(glueText);
|
|
7664
|
+
}
|
|
7665
|
+
}
|
|
7666
|
+
texts.push(joinTextParts(textParts));
|
|
7667
|
+
isWordLike.push(wordLike);
|
|
7668
|
+
kinds.push(kind);
|
|
7669
|
+
starts.push(start);
|
|
7670
|
+
}
|
|
7671
|
+
return {
|
|
7672
|
+
len: texts.length,
|
|
7673
|
+
texts,
|
|
7674
|
+
isWordLike,
|
|
7675
|
+
kinds,
|
|
7676
|
+
starts
|
|
7677
|
+
};
|
|
7678
|
+
}
|
|
7679
|
+
function carryTrailingForwardStickyAcrossCJKBoundary(segmentation) {
|
|
7680
|
+
const texts = segmentation.texts.slice();
|
|
7681
|
+
const isWordLike = segmentation.isWordLike.slice();
|
|
7682
|
+
const kinds = segmentation.kinds.slice();
|
|
7683
|
+
const starts = segmentation.starts.slice();
|
|
7684
|
+
for (let i2 = 0; i2 < texts.length - 1; i2++) {
|
|
7685
|
+
if (kinds[i2] !== "text" || kinds[i2 + 1] !== "text")
|
|
7686
|
+
continue;
|
|
7687
|
+
if (!isCJK(texts[i2]) || !isCJK(texts[i2 + 1]))
|
|
7688
|
+
continue;
|
|
7689
|
+
const split = splitTrailingForwardStickyCluster(texts[i2]);
|
|
7690
|
+
if (split === null)
|
|
7691
|
+
continue;
|
|
7692
|
+
texts[i2] = split.head;
|
|
7693
|
+
texts[i2 + 1] = split.tail + texts[i2 + 1];
|
|
7694
|
+
starts[i2 + 1] = starts[i2] + split.head.length;
|
|
7695
|
+
}
|
|
7696
|
+
return {
|
|
7697
|
+
len: texts.length,
|
|
7698
|
+
texts,
|
|
7699
|
+
isWordLike,
|
|
7700
|
+
kinds,
|
|
7701
|
+
starts
|
|
7702
|
+
};
|
|
7703
|
+
}
|
|
7704
|
+
function buildMergedSegmentation(normalized, profile, whiteSpaceProfile) {
|
|
7705
|
+
const wordSegmenter = getSharedWordSegmenter();
|
|
7706
|
+
let mergedLen = 0;
|
|
7707
|
+
const mergedTexts = [];
|
|
7708
|
+
const mergedTextParts = [];
|
|
7709
|
+
const mergedWordLike = [];
|
|
7710
|
+
const mergedKinds = [];
|
|
7711
|
+
const mergedStarts = [];
|
|
7712
|
+
const mergedSingleCharRunChars = [];
|
|
7713
|
+
const mergedSingleCharRunLengths = [];
|
|
7714
|
+
const mergedContainsCJK = [];
|
|
7715
|
+
const mergedContainsArabicScript = [];
|
|
7716
|
+
const mergedEndsWithClosingQuote = [];
|
|
7717
|
+
const mergedEndsWithMyanmarMedialGlue = [];
|
|
7718
|
+
const mergedHasArabicNoSpacePunctuation = [];
|
|
7719
|
+
for (const s2 of wordSegmenter.segment(normalized)) {
|
|
7720
|
+
for (const piece of splitSegmentByBreakKind(s2.segment, s2.isWordLike ?? false, s2.index, whiteSpaceProfile)) {
|
|
7721
|
+
let appendPieceToPrevious2 = function() {
|
|
7722
|
+
if (mergedSingleCharRunChars[prevIndex] !== null) {
|
|
7723
|
+
mergedTextParts[prevIndex] = [
|
|
7724
|
+
materializeDeferredSingleCharRun(mergedTexts, mergedSingleCharRunChars, mergedSingleCharRunLengths, prevIndex)
|
|
7725
|
+
];
|
|
7726
|
+
mergedSingleCharRunChars[prevIndex] = null;
|
|
7727
|
+
}
|
|
7728
|
+
mergedTextParts[prevIndex].push(piece.text);
|
|
7729
|
+
mergedWordLike[prevIndex] = mergedWordLike[prevIndex] || piece.isWordLike;
|
|
7730
|
+
mergedContainsCJK[prevIndex] = mergedContainsCJK[prevIndex] || pieceContainsCJK;
|
|
7731
|
+
mergedContainsArabicScript[prevIndex] = mergedContainsArabicScript[prevIndex] || pieceContainsArabicScript;
|
|
7732
|
+
mergedEndsWithClosingQuote[prevIndex] = pieceEndsWithClosingQuote;
|
|
7733
|
+
mergedEndsWithMyanmarMedialGlue[prevIndex] = pieceEndsWithMyanmarMedialGlue;
|
|
7734
|
+
mergedHasArabicNoSpacePunctuation[prevIndex] = hasArabicNoSpacePunctuation(mergedContainsArabicScript[prevIndex], pieceLastCodePoint);
|
|
7735
|
+
};
|
|
7736
|
+
var appendPieceToPrevious = appendPieceToPrevious2;
|
|
7737
|
+
const isText2 = piece.kind === "text";
|
|
7738
|
+
const repeatableSingleCharRunChar = getRepeatableSingleCharRunChar(piece.text, piece.isWordLike, piece.kind);
|
|
7739
|
+
const pieceContainsCJK = isCJK(piece.text);
|
|
7740
|
+
const pieceContainsArabicScript = containsArabicScript(piece.text);
|
|
7741
|
+
const pieceLastCodePoint = getLastCodePoint(piece.text);
|
|
7742
|
+
const pieceEndsWithClosingQuote = endsWithClosingQuote(piece.text);
|
|
7743
|
+
const pieceEndsWithMyanmarMedialGlue = endsWithMyanmarMedialGlue(piece.text);
|
|
7744
|
+
const prevIndex = mergedLen - 1;
|
|
7745
|
+
if (profile.carryCJKAfterClosingQuote && isText2 && mergedLen > 0 && mergedKinds[prevIndex] === "text" && pieceContainsCJK && mergedContainsCJK[prevIndex] && mergedEndsWithClosingQuote[prevIndex]) {
|
|
7746
|
+
appendPieceToPrevious2();
|
|
7747
|
+
} else if (isText2 && mergedLen > 0 && mergedKinds[prevIndex] === "text" && isCJKLineStartProhibitedSegment(piece.text) && mergedContainsCJK[prevIndex]) {
|
|
7748
|
+
appendPieceToPrevious2();
|
|
7749
|
+
} else if (isText2 && mergedLen > 0 && mergedKinds[prevIndex] === "text" && mergedEndsWithMyanmarMedialGlue[prevIndex]) {
|
|
7750
|
+
appendPieceToPrevious2();
|
|
7751
|
+
} else if (isText2 && mergedLen > 0 && mergedKinds[prevIndex] === "text" && piece.isWordLike && pieceContainsArabicScript && mergedHasArabicNoSpacePunctuation[prevIndex]) {
|
|
7752
|
+
appendPieceToPrevious2();
|
|
7753
|
+
mergedWordLike[prevIndex] = true;
|
|
7754
|
+
} else if (repeatableSingleCharRunChar !== null && mergedLen > 0 && mergedKinds[prevIndex] === "text" && mergedSingleCharRunChars[prevIndex] === repeatableSingleCharRunChar) {
|
|
7755
|
+
mergedSingleCharRunLengths[prevIndex] = (mergedSingleCharRunLengths[prevIndex] ?? 1) + 1;
|
|
7756
|
+
} else if (isText2 && !piece.isWordLike && mergedLen > 0 && mergedKinds[prevIndex] === "text" && (isLeftStickyPunctuationSegment(piece.text) || piece.text === "-" && mergedWordLike[prevIndex])) {
|
|
7757
|
+
appendPieceToPrevious2();
|
|
7758
|
+
} else {
|
|
7759
|
+
mergedTexts[mergedLen] = piece.text;
|
|
7760
|
+
mergedTextParts[mergedLen] = [piece.text];
|
|
7761
|
+
mergedWordLike[mergedLen] = piece.isWordLike;
|
|
7762
|
+
mergedKinds[mergedLen] = piece.kind;
|
|
7763
|
+
mergedStarts[mergedLen] = piece.start;
|
|
7764
|
+
mergedSingleCharRunChars[mergedLen] = repeatableSingleCharRunChar;
|
|
7765
|
+
mergedSingleCharRunLengths[mergedLen] = repeatableSingleCharRunChar === null ? 0 : 1;
|
|
7766
|
+
mergedContainsCJK[mergedLen] = pieceContainsCJK;
|
|
7767
|
+
mergedContainsArabicScript[mergedLen] = pieceContainsArabicScript;
|
|
7768
|
+
mergedEndsWithClosingQuote[mergedLen] = pieceEndsWithClosingQuote;
|
|
7769
|
+
mergedEndsWithMyanmarMedialGlue[mergedLen] = pieceEndsWithMyanmarMedialGlue;
|
|
7770
|
+
mergedHasArabicNoSpacePunctuation[mergedLen] = hasArabicNoSpacePunctuation(pieceContainsArabicScript, pieceLastCodePoint);
|
|
7771
|
+
mergedLen++;
|
|
7772
|
+
}
|
|
7773
|
+
}
|
|
7774
|
+
}
|
|
7775
|
+
for (let i2 = 0; i2 < mergedLen; i2++) {
|
|
7776
|
+
if (mergedSingleCharRunChars[i2] !== null) {
|
|
7777
|
+
mergedTexts[i2] = materializeDeferredSingleCharRun(mergedTexts, mergedSingleCharRunChars, mergedSingleCharRunLengths, i2);
|
|
7778
|
+
continue;
|
|
7779
|
+
}
|
|
7780
|
+
mergedTexts[i2] = joinTextParts(mergedTextParts[i2]);
|
|
7781
|
+
}
|
|
7782
|
+
for (let i2 = 1; i2 < mergedLen; i2++) {
|
|
7783
|
+
if (mergedKinds[i2] === "text" && !mergedWordLike[i2] && isEscapedQuoteClusterSegment(mergedTexts[i2]) && mergedKinds[i2 - 1] === "text") {
|
|
7784
|
+
mergedTexts[i2 - 1] += mergedTexts[i2];
|
|
7785
|
+
mergedWordLike[i2 - 1] = mergedWordLike[i2 - 1] || mergedWordLike[i2];
|
|
7786
|
+
mergedTexts[i2] = "";
|
|
7787
|
+
}
|
|
7788
|
+
}
|
|
7789
|
+
const forwardStickyPrefixParts = Array.from({ length: mergedLen }, () => null);
|
|
7790
|
+
let nextLiveIndex = -1;
|
|
7791
|
+
for (let i2 = mergedLen - 1; i2 >= 0; i2--) {
|
|
7792
|
+
const text = mergedTexts[i2];
|
|
7793
|
+
if (text.length === 0)
|
|
7794
|
+
continue;
|
|
7795
|
+
if (mergedKinds[i2] === "text" && !mergedWordLike[i2] && isForwardStickyClusterSegment(text) && nextLiveIndex >= 0 && mergedKinds[nextLiveIndex] === "text") {
|
|
7796
|
+
const prefixParts = forwardStickyPrefixParts[nextLiveIndex] ?? [];
|
|
7797
|
+
prefixParts.push(text);
|
|
7798
|
+
forwardStickyPrefixParts[nextLiveIndex] = prefixParts;
|
|
7799
|
+
mergedStarts[nextLiveIndex] = mergedStarts[i2];
|
|
7800
|
+
mergedTexts[i2] = "";
|
|
7801
|
+
continue;
|
|
7802
|
+
}
|
|
7803
|
+
nextLiveIndex = i2;
|
|
7804
|
+
}
|
|
7805
|
+
for (let i2 = 0; i2 < mergedLen; i2++) {
|
|
7806
|
+
const prefixParts = forwardStickyPrefixParts[i2];
|
|
7807
|
+
if (prefixParts == null)
|
|
7808
|
+
continue;
|
|
7809
|
+
mergedTexts[i2] = joinReversedPrefixParts(prefixParts, mergedTexts[i2]);
|
|
7810
|
+
}
|
|
7811
|
+
let compactLen = 0;
|
|
7812
|
+
for (let read = 0; read < mergedLen; read++) {
|
|
7813
|
+
const text = mergedTexts[read];
|
|
7814
|
+
if (text.length === 0)
|
|
7815
|
+
continue;
|
|
7816
|
+
if (compactLen !== read) {
|
|
7817
|
+
mergedTexts[compactLen] = text;
|
|
7818
|
+
mergedWordLike[compactLen] = mergedWordLike[read];
|
|
7819
|
+
mergedKinds[compactLen] = mergedKinds[read];
|
|
7820
|
+
mergedStarts[compactLen] = mergedStarts[read];
|
|
7821
|
+
}
|
|
7822
|
+
compactLen++;
|
|
7823
|
+
}
|
|
7824
|
+
mergedTexts.length = compactLen;
|
|
7825
|
+
mergedWordLike.length = compactLen;
|
|
7826
|
+
mergedKinds.length = compactLen;
|
|
7827
|
+
mergedStarts.length = compactLen;
|
|
7828
|
+
const compacted = mergeGlueConnectedTextRuns({
|
|
7829
|
+
len: compactLen,
|
|
7830
|
+
texts: mergedTexts,
|
|
7831
|
+
isWordLike: mergedWordLike,
|
|
7832
|
+
kinds: mergedKinds,
|
|
7833
|
+
starts: mergedStarts
|
|
7834
|
+
});
|
|
7835
|
+
const withMergedUrls = carryTrailingForwardStickyAcrossCJKBoundary(mergeAsciiPunctuationChains(splitHyphenatedNumericRuns(mergeNumericRuns(mergeUrlQueryRuns(mergeUrlLikeRuns(compacted))))));
|
|
7836
|
+
for (let i2 = 0; i2 < withMergedUrls.len - 1; i2++) {
|
|
7837
|
+
const split = splitLeadingSpaceAndMarks(withMergedUrls.texts[i2]);
|
|
7838
|
+
if (split === null)
|
|
7839
|
+
continue;
|
|
7840
|
+
if (withMergedUrls.kinds[i2] !== "space" && withMergedUrls.kinds[i2] !== "preserved-space" || withMergedUrls.kinds[i2 + 1] !== "text" || !containsArabicScript(withMergedUrls.texts[i2 + 1])) {
|
|
7841
|
+
continue;
|
|
7842
|
+
}
|
|
7843
|
+
withMergedUrls.texts[i2] = split.space;
|
|
7844
|
+
withMergedUrls.isWordLike[i2] = false;
|
|
7845
|
+
withMergedUrls.kinds[i2] = withMergedUrls.kinds[i2] === "preserved-space" ? "preserved-space" : "space";
|
|
7846
|
+
withMergedUrls.texts[i2 + 1] = split.marks + withMergedUrls.texts[i2 + 1];
|
|
7847
|
+
withMergedUrls.starts[i2 + 1] = withMergedUrls.starts[i2] + split.space.length;
|
|
7848
|
+
}
|
|
7849
|
+
return withMergedUrls;
|
|
7850
|
+
}
|
|
7851
|
+
function compileAnalysisChunks(segmentation, whiteSpaceProfile) {
|
|
7852
|
+
if (segmentation.len === 0)
|
|
7853
|
+
return [];
|
|
7854
|
+
if (!whiteSpaceProfile.preserveHardBreaks) {
|
|
7855
|
+
return [{
|
|
7856
|
+
startSegmentIndex: 0,
|
|
7857
|
+
endSegmentIndex: segmentation.len,
|
|
7858
|
+
consumedEndSegmentIndex: segmentation.len
|
|
7859
|
+
}];
|
|
7860
|
+
}
|
|
7861
|
+
const chunks = [];
|
|
7862
|
+
let startSegmentIndex = 0;
|
|
7863
|
+
for (let i2 = 0; i2 < segmentation.len; i2++) {
|
|
7864
|
+
if (segmentation.kinds[i2] !== "hard-break")
|
|
7865
|
+
continue;
|
|
7866
|
+
chunks.push({
|
|
7867
|
+
startSegmentIndex,
|
|
7868
|
+
endSegmentIndex: i2,
|
|
7869
|
+
consumedEndSegmentIndex: i2 + 1
|
|
7870
|
+
});
|
|
7871
|
+
startSegmentIndex = i2 + 1;
|
|
7872
|
+
}
|
|
7873
|
+
if (startSegmentIndex < segmentation.len) {
|
|
7874
|
+
chunks.push({
|
|
7875
|
+
startSegmentIndex,
|
|
7876
|
+
endSegmentIndex: segmentation.len,
|
|
7877
|
+
consumedEndSegmentIndex: segmentation.len
|
|
7878
|
+
});
|
|
7879
|
+
}
|
|
7880
|
+
return chunks;
|
|
7881
|
+
}
|
|
7882
|
+
function mergeKeepAllTextSegments(segmentation) {
|
|
7883
|
+
if (segmentation.len <= 1)
|
|
7884
|
+
return segmentation;
|
|
7885
|
+
const texts = [];
|
|
7886
|
+
const isWordLike = [];
|
|
7887
|
+
const kinds = [];
|
|
7888
|
+
const starts = [];
|
|
7889
|
+
let pendingTextParts = null;
|
|
7890
|
+
let pendingWordLike = false;
|
|
7891
|
+
let pendingStart = 0;
|
|
7892
|
+
let pendingContainsCJK = false;
|
|
7893
|
+
let pendingCanContinue = false;
|
|
7894
|
+
function flushPendingText() {
|
|
7895
|
+
if (pendingTextParts === null)
|
|
7896
|
+
return;
|
|
7897
|
+
texts.push(joinTextParts(pendingTextParts));
|
|
7898
|
+
isWordLike.push(pendingWordLike);
|
|
7899
|
+
kinds.push("text");
|
|
7900
|
+
starts.push(pendingStart);
|
|
7901
|
+
pendingTextParts = null;
|
|
7902
|
+
}
|
|
7903
|
+
for (let i2 = 0; i2 < segmentation.len; i2++) {
|
|
7904
|
+
const text = segmentation.texts[i2];
|
|
7905
|
+
const kind = segmentation.kinds[i2];
|
|
7906
|
+
const wordLike = segmentation.isWordLike[i2];
|
|
7907
|
+
const start = segmentation.starts[i2];
|
|
7908
|
+
if (kind === "text") {
|
|
7909
|
+
const textContainsCJK = containsCJKText(text);
|
|
7910
|
+
const textCanContinue = canContinueKeepAllTextRun(text);
|
|
7911
|
+
if (pendingTextParts !== null && pendingContainsCJK && pendingCanContinue) {
|
|
7912
|
+
pendingTextParts.push(text);
|
|
7913
|
+
pendingWordLike = pendingWordLike || wordLike;
|
|
7914
|
+
pendingContainsCJK = pendingContainsCJK || textContainsCJK;
|
|
7915
|
+
pendingCanContinue = textCanContinue;
|
|
7916
|
+
continue;
|
|
7917
|
+
}
|
|
7918
|
+
flushPendingText();
|
|
7919
|
+
pendingTextParts = [text];
|
|
7920
|
+
pendingWordLike = wordLike;
|
|
7921
|
+
pendingStart = start;
|
|
7922
|
+
pendingContainsCJK = textContainsCJK;
|
|
7923
|
+
pendingCanContinue = textCanContinue;
|
|
7924
|
+
continue;
|
|
7925
|
+
}
|
|
7926
|
+
flushPendingText();
|
|
7927
|
+
texts.push(text);
|
|
7928
|
+
isWordLike.push(wordLike);
|
|
7929
|
+
kinds.push(kind);
|
|
7930
|
+
starts.push(start);
|
|
7931
|
+
}
|
|
7932
|
+
flushPendingText();
|
|
7933
|
+
return {
|
|
7934
|
+
len: texts.length,
|
|
7935
|
+
texts,
|
|
7936
|
+
isWordLike,
|
|
7937
|
+
kinds,
|
|
7938
|
+
starts
|
|
7939
|
+
};
|
|
7940
|
+
}
|
|
7941
|
+
function analyzeText(text, profile, whiteSpace = "normal", wordBreak = "normal") {
|
|
7942
|
+
const whiteSpaceProfile = getWhiteSpaceProfile(whiteSpace);
|
|
7943
|
+
const normalized = whiteSpaceProfile.mode === "pre-wrap" ? normalizeWhitespacePreWrap(text) : normalizeWhitespaceNormal(text);
|
|
7944
|
+
if (normalized.length === 0) {
|
|
7945
|
+
return {
|
|
7946
|
+
normalized,
|
|
7947
|
+
chunks: [],
|
|
7948
|
+
len: 0,
|
|
7949
|
+
texts: [],
|
|
7950
|
+
isWordLike: [],
|
|
7951
|
+
kinds: [],
|
|
7952
|
+
starts: []
|
|
7953
|
+
};
|
|
7954
|
+
}
|
|
7955
|
+
const segmentation = wordBreak === "keep-all" ? mergeKeepAllTextSegments(buildMergedSegmentation(normalized, profile, whiteSpaceProfile)) : buildMergedSegmentation(normalized, profile, whiteSpaceProfile);
|
|
7956
|
+
return {
|
|
7957
|
+
normalized,
|
|
7958
|
+
chunks: compileAnalysisChunks(segmentation, whiteSpaceProfile),
|
|
7959
|
+
...segmentation
|
|
7960
|
+
};
|
|
7961
|
+
}
|
|
7962
|
+
var collapsibleWhitespaceRunRe, needsWhitespaceNormalizationRe, sharedWordSegmenter, segmenterLocale, arabicScriptRe, combiningMarkRe, decimalDigitRe, keepAllGlueChars, kinsokuStart, kinsokuEnd, forwardStickyGlue, leftStickyPunctuation, arabicNoSpaceTrailingPunctuation, myanmarMedialGlue, closingQuoteChars, breakCharRe, urlSchemeSegmentRe, numericJoinerChars, asciiPunctuationChainSegmentRe, asciiPunctuationChainTrailingJoinersRe;
|
|
4860
7963
|
var init_analysis = __esm({
|
|
4861
7964
|
"../../node_modules/.bun/@chenglou+pretext@0.0.5/node_modules/@chenglou/pretext/dist/analysis.js"() {
|
|
4862
7965
|
"use strict";
|
|
7966
|
+
collapsibleWhitespaceRunRe = /[ \t\n\r\f]+/g;
|
|
7967
|
+
needsWhitespaceNormalizationRe = /[\t\n\r\f]| {2,}|^ | $/;
|
|
7968
|
+
sharedWordSegmenter = null;
|
|
4863
7969
|
arabicScriptRe = new RegExp("\\p{Script=Arabic}", "u");
|
|
4864
7970
|
combiningMarkRe = new RegExp("\\p{M}", "u");
|
|
4865
7971
|
decimalDigitRe = new RegExp("\\p{Nd}", "u");
|
|
7972
|
+
keepAllGlueChars = /* @__PURE__ */ new Set([
|
|
7973
|
+
"\xA0",
|
|
7974
|
+
"\u202F",
|
|
7975
|
+
"\u2060",
|
|
7976
|
+
"\uFEFF"
|
|
7977
|
+
]);
|
|
7978
|
+
kinsokuStart = /* @__PURE__ */ new Set([
|
|
7979
|
+
"\uFF0C",
|
|
7980
|
+
"\uFF0E",
|
|
7981
|
+
"\uFF01",
|
|
7982
|
+
"\uFF1A",
|
|
7983
|
+
"\uFF1B",
|
|
7984
|
+
"\uFF1F",
|
|
7985
|
+
"\u3001",
|
|
7986
|
+
"\u3002",
|
|
7987
|
+
"\u30FB",
|
|
7988
|
+
"\uFF09",
|
|
7989
|
+
"\u3015",
|
|
7990
|
+
"\u3009",
|
|
7991
|
+
"\u300B",
|
|
7992
|
+
"\u300D",
|
|
7993
|
+
"\u300F",
|
|
7994
|
+
"\u3011",
|
|
7995
|
+
"\u3017",
|
|
7996
|
+
"\u3019",
|
|
7997
|
+
"\u301B",
|
|
7998
|
+
"\u30FC",
|
|
7999
|
+
"\u3005",
|
|
8000
|
+
"\u303B",
|
|
8001
|
+
"\u309D",
|
|
8002
|
+
"\u309E",
|
|
8003
|
+
"\u30FD",
|
|
8004
|
+
"\u30FE"
|
|
8005
|
+
]);
|
|
8006
|
+
kinsokuEnd = /* @__PURE__ */ new Set([
|
|
8007
|
+
'"',
|
|
8008
|
+
"(",
|
|
8009
|
+
"[",
|
|
8010
|
+
"{",
|
|
8011
|
+
"\u201C",
|
|
8012
|
+
"\u2018",
|
|
8013
|
+
"\xAB",
|
|
8014
|
+
"\u2039",
|
|
8015
|
+
"\uFF08",
|
|
8016
|
+
"\u3014",
|
|
8017
|
+
"\u3008",
|
|
8018
|
+
"\u300A",
|
|
8019
|
+
"\u300C",
|
|
8020
|
+
"\u300E",
|
|
8021
|
+
"\u3010",
|
|
8022
|
+
"\u3016",
|
|
8023
|
+
"\u3018",
|
|
8024
|
+
"\u301A"
|
|
8025
|
+
]);
|
|
8026
|
+
forwardStickyGlue = /* @__PURE__ */ new Set([
|
|
8027
|
+
"'",
|
|
8028
|
+
"\u2019"
|
|
8029
|
+
]);
|
|
8030
|
+
leftStickyPunctuation = /* @__PURE__ */ new Set([
|
|
8031
|
+
".",
|
|
8032
|
+
",",
|
|
8033
|
+
"!",
|
|
8034
|
+
"?",
|
|
8035
|
+
":",
|
|
8036
|
+
";",
|
|
8037
|
+
"\u060C",
|
|
8038
|
+
"\u061B",
|
|
8039
|
+
"\u061F",
|
|
8040
|
+
"\u0964",
|
|
8041
|
+
"\u0965",
|
|
8042
|
+
"\u104A",
|
|
8043
|
+
"\u104B",
|
|
8044
|
+
"\u104C",
|
|
8045
|
+
"\u104D",
|
|
8046
|
+
"\u104F",
|
|
8047
|
+
")",
|
|
8048
|
+
"]",
|
|
8049
|
+
"}",
|
|
8050
|
+
"%",
|
|
8051
|
+
'"',
|
|
8052
|
+
"\u201D",
|
|
8053
|
+
"\u2019",
|
|
8054
|
+
"\xBB",
|
|
8055
|
+
"\u203A",
|
|
8056
|
+
"\u2026"
|
|
8057
|
+
]);
|
|
8058
|
+
arabicNoSpaceTrailingPunctuation = /* @__PURE__ */ new Set([
|
|
8059
|
+
":",
|
|
8060
|
+
".",
|
|
8061
|
+
"\u060C",
|
|
8062
|
+
"\u061B"
|
|
8063
|
+
]);
|
|
8064
|
+
myanmarMedialGlue = /* @__PURE__ */ new Set([
|
|
8065
|
+
"\u104F"
|
|
8066
|
+
]);
|
|
8067
|
+
closingQuoteChars = /* @__PURE__ */ new Set([
|
|
8068
|
+
"\u201D",
|
|
8069
|
+
"\u2019",
|
|
8070
|
+
"\xBB",
|
|
8071
|
+
"\u203A",
|
|
8072
|
+
"\u300D",
|
|
8073
|
+
"\u300F",
|
|
8074
|
+
"\u3011",
|
|
8075
|
+
"\u300B",
|
|
8076
|
+
"\u3009",
|
|
8077
|
+
"\u3015",
|
|
8078
|
+
"\uFF09"
|
|
8079
|
+
]);
|
|
8080
|
+
breakCharRe = /[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;
|
|
8081
|
+
urlSchemeSegmentRe = /^[A-Za-z][A-Za-z0-9+.-]*:$/;
|
|
8082
|
+
numericJoinerChars = /* @__PURE__ */ new Set([
|
|
8083
|
+
":",
|
|
8084
|
+
"-",
|
|
8085
|
+
"/",
|
|
8086
|
+
"\xD7",
|
|
8087
|
+
",",
|
|
8088
|
+
".",
|
|
8089
|
+
"+",
|
|
8090
|
+
"\u2013",
|
|
8091
|
+
"\u2014"
|
|
8092
|
+
]);
|
|
8093
|
+
asciiPunctuationChainSegmentRe = /^[A-Za-z0-9_]+[,:;]*$/;
|
|
8094
|
+
asciiPunctuationChainTrailingJoinersRe = /[,:;]+$/;
|
|
4866
8095
|
}
|
|
4867
8096
|
});
|
|
4868
8097
|
|
|
4869
8098
|
// ../../node_modules/.bun/@chenglou+pretext@0.0.5/node_modules/@chenglou/pretext/dist/measurement.js
|
|
4870
|
-
|
|
8099
|
+
function getMeasureContext() {
|
|
8100
|
+
if (measureContext !== null)
|
|
8101
|
+
return measureContext;
|
|
8102
|
+
if (typeof OffscreenCanvas !== "undefined") {
|
|
8103
|
+
measureContext = new OffscreenCanvas(1, 1).getContext("2d");
|
|
8104
|
+
return measureContext;
|
|
8105
|
+
}
|
|
8106
|
+
if (typeof document !== "undefined") {
|
|
8107
|
+
measureContext = document.createElement("canvas").getContext("2d");
|
|
8108
|
+
return measureContext;
|
|
8109
|
+
}
|
|
8110
|
+
throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.");
|
|
8111
|
+
}
|
|
8112
|
+
function getSegmentMetricCache(font) {
|
|
8113
|
+
let cache = segmentMetricCaches.get(font);
|
|
8114
|
+
if (!cache) {
|
|
8115
|
+
cache = /* @__PURE__ */ new Map();
|
|
8116
|
+
segmentMetricCaches.set(font, cache);
|
|
8117
|
+
}
|
|
8118
|
+
return cache;
|
|
8119
|
+
}
|
|
8120
|
+
function getSegmentMetrics(seg, cache) {
|
|
8121
|
+
let metrics = cache.get(seg);
|
|
8122
|
+
if (metrics === void 0) {
|
|
8123
|
+
const ctx = getMeasureContext();
|
|
8124
|
+
metrics = {
|
|
8125
|
+
width: ctx.measureText(seg).width,
|
|
8126
|
+
containsCJK: isCJK(seg)
|
|
8127
|
+
};
|
|
8128
|
+
cache.set(seg, metrics);
|
|
8129
|
+
}
|
|
8130
|
+
return metrics;
|
|
8131
|
+
}
|
|
8132
|
+
function getEngineProfile() {
|
|
8133
|
+
if (cachedEngineProfile !== null)
|
|
8134
|
+
return cachedEngineProfile;
|
|
8135
|
+
if (typeof navigator === "undefined") {
|
|
8136
|
+
cachedEngineProfile = {
|
|
8137
|
+
lineFitEpsilon: 5e-3,
|
|
8138
|
+
carryCJKAfterClosingQuote: false,
|
|
8139
|
+
preferPrefixWidthsForBreakableRuns: false,
|
|
8140
|
+
preferEarlySoftHyphenBreak: false
|
|
8141
|
+
};
|
|
8142
|
+
return cachedEngineProfile;
|
|
8143
|
+
}
|
|
8144
|
+
const ua = navigator.userAgent;
|
|
8145
|
+
const vendor = navigator.vendor;
|
|
8146
|
+
const isSafari = vendor === "Apple Computer, Inc." && ua.includes("Safari/") && !ua.includes("Chrome/") && !ua.includes("Chromium/") && !ua.includes("CriOS/") && !ua.includes("FxiOS/") && !ua.includes("EdgiOS/");
|
|
8147
|
+
const isChromium = ua.includes("Chrome/") || ua.includes("Chromium/") || ua.includes("CriOS/") || ua.includes("Edg/");
|
|
8148
|
+
cachedEngineProfile = {
|
|
8149
|
+
lineFitEpsilon: isSafari ? 1 / 64 : 5e-3,
|
|
8150
|
+
carryCJKAfterClosingQuote: isChromium,
|
|
8151
|
+
preferPrefixWidthsForBreakableRuns: isSafari,
|
|
8152
|
+
preferEarlySoftHyphenBreak: isSafari
|
|
8153
|
+
};
|
|
8154
|
+
return cachedEngineProfile;
|
|
8155
|
+
}
|
|
8156
|
+
function parseFontSize(font) {
|
|
8157
|
+
const m2 = font.match(/(\d+(?:\.\d+)?)\s*px/);
|
|
8158
|
+
return m2 ? parseFloat(m2[1]) : 16;
|
|
8159
|
+
}
|
|
8160
|
+
function getSharedGraphemeSegmenter() {
|
|
8161
|
+
if (sharedGraphemeSegmenter === null) {
|
|
8162
|
+
sharedGraphemeSegmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
8163
|
+
}
|
|
8164
|
+
return sharedGraphemeSegmenter;
|
|
8165
|
+
}
|
|
8166
|
+
function isEmojiGrapheme(g) {
|
|
8167
|
+
return emojiPresentationRe.test(g) || g.includes("\uFE0F");
|
|
8168
|
+
}
|
|
8169
|
+
function textMayContainEmoji(text) {
|
|
8170
|
+
return maybeEmojiRe.test(text);
|
|
8171
|
+
}
|
|
8172
|
+
function getEmojiCorrection(font, fontSize) {
|
|
8173
|
+
let correction = emojiCorrectionCache.get(font);
|
|
8174
|
+
if (correction !== void 0)
|
|
8175
|
+
return correction;
|
|
8176
|
+
const ctx = getMeasureContext();
|
|
8177
|
+
ctx.font = font;
|
|
8178
|
+
const canvasW = ctx.measureText("\u{1F600}").width;
|
|
8179
|
+
correction = 0;
|
|
8180
|
+
if (canvasW > fontSize + 0.5 && typeof document !== "undefined" && document.body !== null) {
|
|
8181
|
+
const span = document.createElement("span");
|
|
8182
|
+
span.style.font = font;
|
|
8183
|
+
span.style.display = "inline-block";
|
|
8184
|
+
span.style.visibility = "hidden";
|
|
8185
|
+
span.style.position = "absolute";
|
|
8186
|
+
span.textContent = "\u{1F600}";
|
|
8187
|
+
document.body.appendChild(span);
|
|
8188
|
+
const domW = span.getBoundingClientRect().width;
|
|
8189
|
+
document.body.removeChild(span);
|
|
8190
|
+
if (canvasW - domW > 0.5) {
|
|
8191
|
+
correction = canvasW - domW;
|
|
8192
|
+
}
|
|
8193
|
+
}
|
|
8194
|
+
emojiCorrectionCache.set(font, correction);
|
|
8195
|
+
return correction;
|
|
8196
|
+
}
|
|
8197
|
+
function countEmojiGraphemes(text) {
|
|
8198
|
+
let count = 0;
|
|
8199
|
+
const graphemeSegmenter = getSharedGraphemeSegmenter();
|
|
8200
|
+
for (const g of graphemeSegmenter.segment(text)) {
|
|
8201
|
+
if (isEmojiGrapheme(g.segment))
|
|
8202
|
+
count++;
|
|
8203
|
+
}
|
|
8204
|
+
return count;
|
|
8205
|
+
}
|
|
8206
|
+
function getEmojiCount(seg, metrics) {
|
|
8207
|
+
if (metrics.emojiCount === void 0) {
|
|
8208
|
+
metrics.emojiCount = countEmojiGraphemes(seg);
|
|
8209
|
+
}
|
|
8210
|
+
return metrics.emojiCount;
|
|
8211
|
+
}
|
|
8212
|
+
function getCorrectedSegmentWidth(seg, metrics, emojiCorrection) {
|
|
8213
|
+
if (emojiCorrection === 0)
|
|
8214
|
+
return metrics.width;
|
|
8215
|
+
return metrics.width - getEmojiCount(seg, metrics) * emojiCorrection;
|
|
8216
|
+
}
|
|
8217
|
+
function getSegmentBreakableFitAdvances(seg, metrics, cache, emojiCorrection, mode) {
|
|
8218
|
+
if (metrics.breakableFitAdvances !== void 0)
|
|
8219
|
+
return metrics.breakableFitAdvances;
|
|
8220
|
+
const graphemeSegmenter = getSharedGraphemeSegmenter();
|
|
8221
|
+
const graphemes = [];
|
|
8222
|
+
for (const gs of graphemeSegmenter.segment(seg)) {
|
|
8223
|
+
graphemes.push(gs.segment);
|
|
8224
|
+
}
|
|
8225
|
+
if (graphemes.length <= 1) {
|
|
8226
|
+
metrics.breakableFitAdvances = null;
|
|
8227
|
+
return metrics.breakableFitAdvances;
|
|
8228
|
+
}
|
|
8229
|
+
if (mode === "sum-graphemes") {
|
|
8230
|
+
const advances2 = [];
|
|
8231
|
+
for (const grapheme of graphemes) {
|
|
8232
|
+
const graphemeMetrics = getSegmentMetrics(grapheme, cache);
|
|
8233
|
+
advances2.push(getCorrectedSegmentWidth(grapheme, graphemeMetrics, emojiCorrection));
|
|
8234
|
+
}
|
|
8235
|
+
metrics.breakableFitAdvances = advances2;
|
|
8236
|
+
return metrics.breakableFitAdvances;
|
|
8237
|
+
}
|
|
8238
|
+
if (mode === "pair-context" || graphemes.length > MAX_PREFIX_FIT_GRAPHEMES) {
|
|
8239
|
+
const advances2 = [];
|
|
8240
|
+
let previousGrapheme = null;
|
|
8241
|
+
let previousWidth = 0;
|
|
8242
|
+
for (const grapheme of graphemes) {
|
|
8243
|
+
const graphemeMetrics = getSegmentMetrics(grapheme, cache);
|
|
8244
|
+
const currentWidth = getCorrectedSegmentWidth(grapheme, graphemeMetrics, emojiCorrection);
|
|
8245
|
+
if (previousGrapheme === null) {
|
|
8246
|
+
advances2.push(currentWidth);
|
|
8247
|
+
} else {
|
|
8248
|
+
const pair = previousGrapheme + grapheme;
|
|
8249
|
+
const pairMetrics = getSegmentMetrics(pair, cache);
|
|
8250
|
+
advances2.push(getCorrectedSegmentWidth(pair, pairMetrics, emojiCorrection) - previousWidth);
|
|
8251
|
+
}
|
|
8252
|
+
previousGrapheme = grapheme;
|
|
8253
|
+
previousWidth = currentWidth;
|
|
8254
|
+
}
|
|
8255
|
+
metrics.breakableFitAdvances = advances2;
|
|
8256
|
+
return metrics.breakableFitAdvances;
|
|
8257
|
+
}
|
|
8258
|
+
const advances = [];
|
|
8259
|
+
let prefix = "";
|
|
8260
|
+
let prefixWidth = 0;
|
|
8261
|
+
for (const grapheme of graphemes) {
|
|
8262
|
+
prefix += grapheme;
|
|
8263
|
+
const prefixMetrics = getSegmentMetrics(prefix, cache);
|
|
8264
|
+
const nextPrefixWidth = getCorrectedSegmentWidth(prefix, prefixMetrics, emojiCorrection);
|
|
8265
|
+
advances.push(nextPrefixWidth - prefixWidth);
|
|
8266
|
+
prefixWidth = nextPrefixWidth;
|
|
8267
|
+
}
|
|
8268
|
+
metrics.breakableFitAdvances = advances;
|
|
8269
|
+
return metrics.breakableFitAdvances;
|
|
8270
|
+
}
|
|
8271
|
+
function getFontMeasurementState(font, needsEmojiCorrection) {
|
|
8272
|
+
const ctx = getMeasureContext();
|
|
8273
|
+
ctx.font = font;
|
|
8274
|
+
const cache = getSegmentMetricCache(font);
|
|
8275
|
+
const fontSize = parseFontSize(font);
|
|
8276
|
+
const emojiCorrection = needsEmojiCorrection ? getEmojiCorrection(font, fontSize) : 0;
|
|
8277
|
+
return { cache, fontSize, emojiCorrection };
|
|
8278
|
+
}
|
|
8279
|
+
var measureContext, segmentMetricCaches, cachedEngineProfile, MAX_PREFIX_FIT_GRAPHEMES, emojiPresentationRe, maybeEmojiRe, sharedGraphemeSegmenter, emojiCorrectionCache;
|
|
4871
8280
|
var init_measurement = __esm({
|
|
4872
8281
|
"../../node_modules/.bun/@chenglou+pretext@0.0.5/node_modules/@chenglou/pretext/dist/measurement.js"() {
|
|
4873
8282
|
"use strict";
|
|
4874
8283
|
init_analysis();
|
|
8284
|
+
measureContext = null;
|
|
8285
|
+
segmentMetricCaches = /* @__PURE__ */ new Map();
|
|
8286
|
+
cachedEngineProfile = null;
|
|
8287
|
+
MAX_PREFIX_FIT_GRAPHEMES = 96;
|
|
4875
8288
|
emojiPresentationRe = new RegExp("\\p{Emoji_Presentation}", "u");
|
|
8289
|
+
maybeEmojiRe = /[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;
|
|
8290
|
+
sharedGraphemeSegmenter = null;
|
|
8291
|
+
emojiCorrectionCache = /* @__PURE__ */ new Map();
|
|
4876
8292
|
}
|
|
4877
8293
|
});
|
|
4878
8294
|
|
|
4879
8295
|
// ../../node_modules/.bun/@chenglou+pretext@0.0.5/node_modules/@chenglou/pretext/dist/line-break.js
|
|
8296
|
+
function normalizeSimpleLineStartSegmentIndex(prepared, segmentIndex) {
|
|
8297
|
+
while (segmentIndex < prepared.widths.length) {
|
|
8298
|
+
const kind = prepared.kinds[segmentIndex];
|
|
8299
|
+
if (kind !== "space" && kind !== "zero-width-break" && kind !== "soft-hyphen")
|
|
8300
|
+
break;
|
|
8301
|
+
segmentIndex++;
|
|
8302
|
+
}
|
|
8303
|
+
return segmentIndex;
|
|
8304
|
+
}
|
|
8305
|
+
function getTabAdvance(lineWidth, tabStopAdvance) {
|
|
8306
|
+
if (tabStopAdvance <= 0)
|
|
8307
|
+
return 0;
|
|
8308
|
+
const remainder = lineWidth % tabStopAdvance;
|
|
8309
|
+
if (Math.abs(remainder) <= 1e-6)
|
|
8310
|
+
return tabStopAdvance;
|
|
8311
|
+
return tabStopAdvance - remainder;
|
|
8312
|
+
}
|
|
8313
|
+
function fitSoftHyphenBreak(graphemeFitAdvances, initialWidth, maxWidth, lineFitEpsilon, discretionaryHyphenWidth) {
|
|
8314
|
+
let fitCount = 0;
|
|
8315
|
+
let fittedWidth = initialWidth;
|
|
8316
|
+
while (fitCount < graphemeFitAdvances.length) {
|
|
8317
|
+
const nextWidth = fittedWidth + graphemeFitAdvances[fitCount];
|
|
8318
|
+
const nextLineWidth = fitCount + 1 < graphemeFitAdvances.length ? nextWidth + discretionaryHyphenWidth : nextWidth;
|
|
8319
|
+
if (nextLineWidth > maxWidth + lineFitEpsilon)
|
|
8320
|
+
break;
|
|
8321
|
+
fittedWidth = nextWidth;
|
|
8322
|
+
fitCount++;
|
|
8323
|
+
}
|
|
8324
|
+
return { fitCount, fittedWidth };
|
|
8325
|
+
}
|
|
8326
|
+
function countPreparedLines(prepared, maxWidth) {
|
|
8327
|
+
if (prepared.simpleLineWalkFastPath) {
|
|
8328
|
+
return walkPreparedLinesSimple(prepared, maxWidth);
|
|
8329
|
+
}
|
|
8330
|
+
return walkPreparedLines(prepared, maxWidth);
|
|
8331
|
+
}
|
|
8332
|
+
function walkPreparedLinesSimple(prepared, maxWidth, onLine) {
|
|
8333
|
+
const { widths, kinds, breakableFitAdvances } = prepared;
|
|
8334
|
+
if (widths.length === 0)
|
|
8335
|
+
return 0;
|
|
8336
|
+
const engineProfile = getEngineProfile();
|
|
8337
|
+
const lineFitEpsilon = engineProfile.lineFitEpsilon;
|
|
8338
|
+
const fitLimit = maxWidth + lineFitEpsilon;
|
|
8339
|
+
let lineCount = 0;
|
|
8340
|
+
let lineW = 0;
|
|
8341
|
+
let hasContent = false;
|
|
8342
|
+
let lineStartSegmentIndex = 0;
|
|
8343
|
+
let lineStartGraphemeIndex = 0;
|
|
8344
|
+
let lineEndSegmentIndex = 0;
|
|
8345
|
+
let lineEndGraphemeIndex = 0;
|
|
8346
|
+
let pendingBreakSegmentIndex = -1;
|
|
8347
|
+
let pendingBreakPaintWidth = 0;
|
|
8348
|
+
function clearPendingBreak() {
|
|
8349
|
+
pendingBreakSegmentIndex = -1;
|
|
8350
|
+
pendingBreakPaintWidth = 0;
|
|
8351
|
+
}
|
|
8352
|
+
function emitCurrentLine(endSegmentIndex = lineEndSegmentIndex, endGraphemeIndex = lineEndGraphemeIndex, width = lineW) {
|
|
8353
|
+
lineCount++;
|
|
8354
|
+
onLine?.({
|
|
8355
|
+
startSegmentIndex: lineStartSegmentIndex,
|
|
8356
|
+
startGraphemeIndex: lineStartGraphemeIndex,
|
|
8357
|
+
endSegmentIndex,
|
|
8358
|
+
endGraphemeIndex,
|
|
8359
|
+
width
|
|
8360
|
+
});
|
|
8361
|
+
lineW = 0;
|
|
8362
|
+
hasContent = false;
|
|
8363
|
+
clearPendingBreak();
|
|
8364
|
+
}
|
|
8365
|
+
function startLineAtSegment(segmentIndex, width) {
|
|
8366
|
+
hasContent = true;
|
|
8367
|
+
lineStartSegmentIndex = segmentIndex;
|
|
8368
|
+
lineStartGraphemeIndex = 0;
|
|
8369
|
+
lineEndSegmentIndex = segmentIndex + 1;
|
|
8370
|
+
lineEndGraphemeIndex = 0;
|
|
8371
|
+
lineW = width;
|
|
8372
|
+
}
|
|
8373
|
+
function startLineAtGrapheme(segmentIndex, graphemeIndex, width) {
|
|
8374
|
+
hasContent = true;
|
|
8375
|
+
lineStartSegmentIndex = segmentIndex;
|
|
8376
|
+
lineStartGraphemeIndex = graphemeIndex;
|
|
8377
|
+
lineEndSegmentIndex = segmentIndex;
|
|
8378
|
+
lineEndGraphemeIndex = graphemeIndex + 1;
|
|
8379
|
+
lineW = width;
|
|
8380
|
+
}
|
|
8381
|
+
function appendWholeSegment(segmentIndex, width) {
|
|
8382
|
+
if (!hasContent) {
|
|
8383
|
+
startLineAtSegment(segmentIndex, width);
|
|
8384
|
+
return;
|
|
8385
|
+
}
|
|
8386
|
+
lineW += width;
|
|
8387
|
+
lineEndSegmentIndex = segmentIndex + 1;
|
|
8388
|
+
lineEndGraphemeIndex = 0;
|
|
8389
|
+
}
|
|
8390
|
+
function appendBreakableSegmentFrom(segmentIndex, startGraphemeIndex) {
|
|
8391
|
+
const fitAdvances = breakableFitAdvances[segmentIndex];
|
|
8392
|
+
for (let g = startGraphemeIndex; g < fitAdvances.length; g++) {
|
|
8393
|
+
const gw = fitAdvances[g];
|
|
8394
|
+
if (!hasContent) {
|
|
8395
|
+
startLineAtGrapheme(segmentIndex, g, gw);
|
|
8396
|
+
} else if (lineW + gw > fitLimit) {
|
|
8397
|
+
emitCurrentLine();
|
|
8398
|
+
startLineAtGrapheme(segmentIndex, g, gw);
|
|
8399
|
+
} else {
|
|
8400
|
+
lineW += gw;
|
|
8401
|
+
lineEndSegmentIndex = segmentIndex;
|
|
8402
|
+
lineEndGraphemeIndex = g + 1;
|
|
8403
|
+
}
|
|
8404
|
+
}
|
|
8405
|
+
if (hasContent && lineEndSegmentIndex === segmentIndex && lineEndGraphemeIndex === fitAdvances.length) {
|
|
8406
|
+
lineEndSegmentIndex = segmentIndex + 1;
|
|
8407
|
+
lineEndGraphemeIndex = 0;
|
|
8408
|
+
}
|
|
8409
|
+
}
|
|
8410
|
+
let i2 = 0;
|
|
8411
|
+
while (i2 < widths.length) {
|
|
8412
|
+
if (!hasContent) {
|
|
8413
|
+
i2 = normalizeSimpleLineStartSegmentIndex(prepared, i2);
|
|
8414
|
+
if (i2 >= widths.length)
|
|
8415
|
+
break;
|
|
8416
|
+
}
|
|
8417
|
+
const w = widths[i2];
|
|
8418
|
+
const kind = kinds[i2];
|
|
8419
|
+
const breakAfter = kind === "space" || kind === "preserved-space" || kind === "tab" || kind === "zero-width-break" || kind === "soft-hyphen";
|
|
8420
|
+
if (!hasContent) {
|
|
8421
|
+
if (w > maxWidth && breakableFitAdvances[i2] !== null) {
|
|
8422
|
+
appendBreakableSegmentFrom(i2, 0);
|
|
8423
|
+
} else {
|
|
8424
|
+
startLineAtSegment(i2, w);
|
|
8425
|
+
}
|
|
8426
|
+
if (breakAfter) {
|
|
8427
|
+
pendingBreakSegmentIndex = i2 + 1;
|
|
8428
|
+
pendingBreakPaintWidth = lineW - w;
|
|
8429
|
+
}
|
|
8430
|
+
i2++;
|
|
8431
|
+
continue;
|
|
8432
|
+
}
|
|
8433
|
+
const newW = lineW + w;
|
|
8434
|
+
if (newW > fitLimit) {
|
|
8435
|
+
if (breakAfter) {
|
|
8436
|
+
appendWholeSegment(i2, w);
|
|
8437
|
+
emitCurrentLine(i2 + 1, 0, lineW - w);
|
|
8438
|
+
i2++;
|
|
8439
|
+
continue;
|
|
8440
|
+
}
|
|
8441
|
+
if (pendingBreakSegmentIndex >= 0) {
|
|
8442
|
+
if (lineEndSegmentIndex > pendingBreakSegmentIndex || lineEndSegmentIndex === pendingBreakSegmentIndex && lineEndGraphemeIndex > 0) {
|
|
8443
|
+
emitCurrentLine();
|
|
8444
|
+
continue;
|
|
8445
|
+
}
|
|
8446
|
+
emitCurrentLine(pendingBreakSegmentIndex, 0, pendingBreakPaintWidth);
|
|
8447
|
+
continue;
|
|
8448
|
+
}
|
|
8449
|
+
if (w > maxWidth && breakableFitAdvances[i2] !== null) {
|
|
8450
|
+
emitCurrentLine();
|
|
8451
|
+
appendBreakableSegmentFrom(i2, 0);
|
|
8452
|
+
i2++;
|
|
8453
|
+
continue;
|
|
8454
|
+
}
|
|
8455
|
+
emitCurrentLine();
|
|
8456
|
+
continue;
|
|
8457
|
+
}
|
|
8458
|
+
appendWholeSegment(i2, w);
|
|
8459
|
+
if (breakAfter) {
|
|
8460
|
+
pendingBreakSegmentIndex = i2 + 1;
|
|
8461
|
+
pendingBreakPaintWidth = lineW - w;
|
|
8462
|
+
}
|
|
8463
|
+
i2++;
|
|
8464
|
+
}
|
|
8465
|
+
if (hasContent)
|
|
8466
|
+
emitCurrentLine();
|
|
8467
|
+
return lineCount;
|
|
8468
|
+
}
|
|
8469
|
+
function walkPreparedLines(prepared, maxWidth, onLine) {
|
|
8470
|
+
if (prepared.simpleLineWalkFastPath) {
|
|
8471
|
+
return walkPreparedLinesSimple(prepared, maxWidth, onLine);
|
|
8472
|
+
}
|
|
8473
|
+
const { widths, lineEndFitAdvances, lineEndPaintAdvances, kinds, breakableFitAdvances, discretionaryHyphenWidth, tabStopAdvance, chunks } = prepared;
|
|
8474
|
+
if (widths.length === 0 || chunks.length === 0)
|
|
8475
|
+
return 0;
|
|
8476
|
+
const engineProfile = getEngineProfile();
|
|
8477
|
+
const lineFitEpsilon = engineProfile.lineFitEpsilon;
|
|
8478
|
+
const fitLimit = maxWidth + lineFitEpsilon;
|
|
8479
|
+
let lineCount = 0;
|
|
8480
|
+
let lineW = 0;
|
|
8481
|
+
let hasContent = false;
|
|
8482
|
+
let lineStartSegmentIndex = 0;
|
|
8483
|
+
let lineStartGraphemeIndex = 0;
|
|
8484
|
+
let lineEndSegmentIndex = 0;
|
|
8485
|
+
let lineEndGraphemeIndex = 0;
|
|
8486
|
+
let pendingBreakSegmentIndex = -1;
|
|
8487
|
+
let pendingBreakFitWidth = 0;
|
|
8488
|
+
let pendingBreakPaintWidth = 0;
|
|
8489
|
+
let pendingBreakKind = null;
|
|
8490
|
+
function clearPendingBreak() {
|
|
8491
|
+
pendingBreakSegmentIndex = -1;
|
|
8492
|
+
pendingBreakFitWidth = 0;
|
|
8493
|
+
pendingBreakPaintWidth = 0;
|
|
8494
|
+
pendingBreakKind = null;
|
|
8495
|
+
}
|
|
8496
|
+
function emitCurrentLine(endSegmentIndex = lineEndSegmentIndex, endGraphemeIndex = lineEndGraphemeIndex, width = lineW) {
|
|
8497
|
+
lineCount++;
|
|
8498
|
+
onLine?.({
|
|
8499
|
+
startSegmentIndex: lineStartSegmentIndex,
|
|
8500
|
+
startGraphemeIndex: lineStartGraphemeIndex,
|
|
8501
|
+
endSegmentIndex,
|
|
8502
|
+
endGraphemeIndex,
|
|
8503
|
+
width
|
|
8504
|
+
});
|
|
8505
|
+
lineW = 0;
|
|
8506
|
+
hasContent = false;
|
|
8507
|
+
clearPendingBreak();
|
|
8508
|
+
}
|
|
8509
|
+
function startLineAtSegment(segmentIndex, width) {
|
|
8510
|
+
hasContent = true;
|
|
8511
|
+
lineStartSegmentIndex = segmentIndex;
|
|
8512
|
+
lineStartGraphemeIndex = 0;
|
|
8513
|
+
lineEndSegmentIndex = segmentIndex + 1;
|
|
8514
|
+
lineEndGraphemeIndex = 0;
|
|
8515
|
+
lineW = width;
|
|
8516
|
+
}
|
|
8517
|
+
function startLineAtGrapheme(segmentIndex, graphemeIndex, width) {
|
|
8518
|
+
hasContent = true;
|
|
8519
|
+
lineStartSegmentIndex = segmentIndex;
|
|
8520
|
+
lineStartGraphemeIndex = graphemeIndex;
|
|
8521
|
+
lineEndSegmentIndex = segmentIndex;
|
|
8522
|
+
lineEndGraphemeIndex = graphemeIndex + 1;
|
|
8523
|
+
lineW = width;
|
|
8524
|
+
}
|
|
8525
|
+
function appendWholeSegment(segmentIndex, width) {
|
|
8526
|
+
if (!hasContent) {
|
|
8527
|
+
startLineAtSegment(segmentIndex, width);
|
|
8528
|
+
return;
|
|
8529
|
+
}
|
|
8530
|
+
lineW += width;
|
|
8531
|
+
lineEndSegmentIndex = segmentIndex + 1;
|
|
8532
|
+
lineEndGraphemeIndex = 0;
|
|
8533
|
+
}
|
|
8534
|
+
function updatePendingBreakForWholeSegment(kind, breakAfter, segmentIndex, segmentWidth) {
|
|
8535
|
+
if (!breakAfter)
|
|
8536
|
+
return;
|
|
8537
|
+
const fitAdvance = kind === "tab" ? 0 : lineEndFitAdvances[segmentIndex];
|
|
8538
|
+
const paintAdvance = kind === "tab" ? segmentWidth : lineEndPaintAdvances[segmentIndex];
|
|
8539
|
+
pendingBreakSegmentIndex = segmentIndex + 1;
|
|
8540
|
+
pendingBreakFitWidth = lineW - segmentWidth + fitAdvance;
|
|
8541
|
+
pendingBreakPaintWidth = lineW - segmentWidth + paintAdvance;
|
|
8542
|
+
pendingBreakKind = kind;
|
|
8543
|
+
}
|
|
8544
|
+
function appendBreakableSegmentFrom(segmentIndex, startGraphemeIndex) {
|
|
8545
|
+
const fitAdvances = breakableFitAdvances[segmentIndex];
|
|
8546
|
+
for (let g = startGraphemeIndex; g < fitAdvances.length; g++) {
|
|
8547
|
+
const gw = fitAdvances[g];
|
|
8548
|
+
if (!hasContent) {
|
|
8549
|
+
startLineAtGrapheme(segmentIndex, g, gw);
|
|
8550
|
+
} else if (lineW + gw > fitLimit) {
|
|
8551
|
+
emitCurrentLine();
|
|
8552
|
+
startLineAtGrapheme(segmentIndex, g, gw);
|
|
8553
|
+
} else {
|
|
8554
|
+
lineW += gw;
|
|
8555
|
+
lineEndSegmentIndex = segmentIndex;
|
|
8556
|
+
lineEndGraphemeIndex = g + 1;
|
|
8557
|
+
}
|
|
8558
|
+
}
|
|
8559
|
+
if (hasContent && lineEndSegmentIndex === segmentIndex && lineEndGraphemeIndex === fitAdvances.length) {
|
|
8560
|
+
lineEndSegmentIndex = segmentIndex + 1;
|
|
8561
|
+
lineEndGraphemeIndex = 0;
|
|
8562
|
+
}
|
|
8563
|
+
}
|
|
8564
|
+
function continueSoftHyphenBreakableSegment(segmentIndex) {
|
|
8565
|
+
if (pendingBreakKind !== "soft-hyphen")
|
|
8566
|
+
return false;
|
|
8567
|
+
const fitWidths = breakableFitAdvances[segmentIndex];
|
|
8568
|
+
if (fitWidths == null)
|
|
8569
|
+
return false;
|
|
8570
|
+
const { fitCount, fittedWidth } = fitSoftHyphenBreak(fitWidths, lineW, maxWidth, lineFitEpsilon, discretionaryHyphenWidth);
|
|
8571
|
+
if (fitCount === 0)
|
|
8572
|
+
return false;
|
|
8573
|
+
lineW = fittedWidth;
|
|
8574
|
+
lineEndSegmentIndex = segmentIndex;
|
|
8575
|
+
lineEndGraphemeIndex = fitCount;
|
|
8576
|
+
clearPendingBreak();
|
|
8577
|
+
if (fitCount === fitWidths.length) {
|
|
8578
|
+
lineEndSegmentIndex = segmentIndex + 1;
|
|
8579
|
+
lineEndGraphemeIndex = 0;
|
|
8580
|
+
return true;
|
|
8581
|
+
}
|
|
8582
|
+
emitCurrentLine(segmentIndex, fitCount, fittedWidth + discretionaryHyphenWidth);
|
|
8583
|
+
appendBreakableSegmentFrom(segmentIndex, fitCount);
|
|
8584
|
+
return true;
|
|
8585
|
+
}
|
|
8586
|
+
function emitEmptyChunk(chunk) {
|
|
8587
|
+
lineCount++;
|
|
8588
|
+
onLine?.({
|
|
8589
|
+
startSegmentIndex: chunk.startSegmentIndex,
|
|
8590
|
+
startGraphemeIndex: 0,
|
|
8591
|
+
endSegmentIndex: chunk.consumedEndSegmentIndex,
|
|
8592
|
+
endGraphemeIndex: 0,
|
|
8593
|
+
width: 0
|
|
8594
|
+
});
|
|
8595
|
+
clearPendingBreak();
|
|
8596
|
+
}
|
|
8597
|
+
for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
|
|
8598
|
+
const chunk = chunks[chunkIndex];
|
|
8599
|
+
if (chunk.startSegmentIndex === chunk.endSegmentIndex) {
|
|
8600
|
+
emitEmptyChunk(chunk);
|
|
8601
|
+
continue;
|
|
8602
|
+
}
|
|
8603
|
+
hasContent = false;
|
|
8604
|
+
lineW = 0;
|
|
8605
|
+
lineStartSegmentIndex = chunk.startSegmentIndex;
|
|
8606
|
+
lineStartGraphemeIndex = 0;
|
|
8607
|
+
lineEndSegmentIndex = chunk.startSegmentIndex;
|
|
8608
|
+
lineEndGraphemeIndex = 0;
|
|
8609
|
+
clearPendingBreak();
|
|
8610
|
+
let i2 = chunk.startSegmentIndex;
|
|
8611
|
+
while (i2 < chunk.endSegmentIndex) {
|
|
8612
|
+
const kind = kinds[i2];
|
|
8613
|
+
const breakAfter = kind === "space" || kind === "preserved-space" || kind === "tab" || kind === "zero-width-break" || kind === "soft-hyphen";
|
|
8614
|
+
const w = kind === "tab" ? getTabAdvance(lineW, tabStopAdvance) : widths[i2];
|
|
8615
|
+
if (kind === "soft-hyphen") {
|
|
8616
|
+
if (hasContent) {
|
|
8617
|
+
lineEndSegmentIndex = i2 + 1;
|
|
8618
|
+
lineEndGraphemeIndex = 0;
|
|
8619
|
+
pendingBreakSegmentIndex = i2 + 1;
|
|
8620
|
+
pendingBreakFitWidth = lineW + discretionaryHyphenWidth;
|
|
8621
|
+
pendingBreakPaintWidth = lineW + discretionaryHyphenWidth;
|
|
8622
|
+
pendingBreakKind = kind;
|
|
8623
|
+
}
|
|
8624
|
+
i2++;
|
|
8625
|
+
continue;
|
|
8626
|
+
}
|
|
8627
|
+
if (!hasContent) {
|
|
8628
|
+
if (w > maxWidth && breakableFitAdvances[i2] !== null) {
|
|
8629
|
+
appendBreakableSegmentFrom(i2, 0);
|
|
8630
|
+
} else {
|
|
8631
|
+
startLineAtSegment(i2, w);
|
|
8632
|
+
}
|
|
8633
|
+
updatePendingBreakForWholeSegment(kind, breakAfter, i2, w);
|
|
8634
|
+
i2++;
|
|
8635
|
+
continue;
|
|
8636
|
+
}
|
|
8637
|
+
const newW = lineW + w;
|
|
8638
|
+
if (newW > fitLimit) {
|
|
8639
|
+
const currentBreakFitWidth = lineW + (kind === "tab" ? 0 : lineEndFitAdvances[i2]);
|
|
8640
|
+
const currentBreakPaintWidth = lineW + (kind === "tab" ? w : lineEndPaintAdvances[i2]);
|
|
8641
|
+
if (pendingBreakKind === "soft-hyphen" && engineProfile.preferEarlySoftHyphenBreak && pendingBreakFitWidth <= fitLimit) {
|
|
8642
|
+
emitCurrentLine(pendingBreakSegmentIndex, 0, pendingBreakPaintWidth);
|
|
8643
|
+
continue;
|
|
8644
|
+
}
|
|
8645
|
+
if (pendingBreakKind === "soft-hyphen" && continueSoftHyphenBreakableSegment(i2)) {
|
|
8646
|
+
i2++;
|
|
8647
|
+
continue;
|
|
8648
|
+
}
|
|
8649
|
+
if (breakAfter && currentBreakFitWidth <= fitLimit) {
|
|
8650
|
+
appendWholeSegment(i2, w);
|
|
8651
|
+
emitCurrentLine(i2 + 1, 0, currentBreakPaintWidth);
|
|
8652
|
+
i2++;
|
|
8653
|
+
continue;
|
|
8654
|
+
}
|
|
8655
|
+
if (pendingBreakSegmentIndex >= 0 && pendingBreakFitWidth <= fitLimit) {
|
|
8656
|
+
if (lineEndSegmentIndex > pendingBreakSegmentIndex || lineEndSegmentIndex === pendingBreakSegmentIndex && lineEndGraphemeIndex > 0) {
|
|
8657
|
+
emitCurrentLine();
|
|
8658
|
+
continue;
|
|
8659
|
+
}
|
|
8660
|
+
const nextSegmentIndex = pendingBreakSegmentIndex;
|
|
8661
|
+
emitCurrentLine(nextSegmentIndex, 0, pendingBreakPaintWidth);
|
|
8662
|
+
i2 = nextSegmentIndex;
|
|
8663
|
+
continue;
|
|
8664
|
+
}
|
|
8665
|
+
if (w > maxWidth && breakableFitAdvances[i2] !== null) {
|
|
8666
|
+
emitCurrentLine();
|
|
8667
|
+
appendBreakableSegmentFrom(i2, 0);
|
|
8668
|
+
i2++;
|
|
8669
|
+
continue;
|
|
8670
|
+
}
|
|
8671
|
+
emitCurrentLine();
|
|
8672
|
+
continue;
|
|
8673
|
+
}
|
|
8674
|
+
appendWholeSegment(i2, w);
|
|
8675
|
+
updatePendingBreakForWholeSegment(kind, breakAfter, i2, w);
|
|
8676
|
+
i2++;
|
|
8677
|
+
}
|
|
8678
|
+
if (hasContent) {
|
|
8679
|
+
const finalPaintWidth = pendingBreakSegmentIndex === chunk.consumedEndSegmentIndex ? pendingBreakPaintWidth : lineW;
|
|
8680
|
+
emitCurrentLine(chunk.consumedEndSegmentIndex, 0, finalPaintWidth);
|
|
8681
|
+
}
|
|
8682
|
+
}
|
|
8683
|
+
return lineCount;
|
|
8684
|
+
}
|
|
4880
8685
|
var init_line_break = __esm({
|
|
4881
8686
|
"../../node_modules/.bun/@chenglou+pretext@0.0.5/node_modules/@chenglou/pretext/dist/line-break.js"() {
|
|
4882
8687
|
"use strict";
|
|
@@ -4885,6 +8690,271 @@ var init_line_break = __esm({
|
|
|
4885
8690
|
});
|
|
4886
8691
|
|
|
4887
8692
|
// ../../node_modules/.bun/@chenglou+pretext@0.0.5/node_modules/@chenglou/pretext/dist/layout.js
|
|
8693
|
+
function getSharedGraphemeSegmenter2() {
|
|
8694
|
+
if (sharedGraphemeSegmenter2 === null) {
|
|
8695
|
+
sharedGraphemeSegmenter2 = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
8696
|
+
}
|
|
8697
|
+
return sharedGraphemeSegmenter2;
|
|
8698
|
+
}
|
|
8699
|
+
function createEmptyPrepared(includeSegments) {
|
|
8700
|
+
if (includeSegments) {
|
|
8701
|
+
return {
|
|
8702
|
+
widths: [],
|
|
8703
|
+
lineEndFitAdvances: [],
|
|
8704
|
+
lineEndPaintAdvances: [],
|
|
8705
|
+
kinds: [],
|
|
8706
|
+
simpleLineWalkFastPath: true,
|
|
8707
|
+
segLevels: null,
|
|
8708
|
+
breakableFitAdvances: [],
|
|
8709
|
+
discretionaryHyphenWidth: 0,
|
|
8710
|
+
tabStopAdvance: 0,
|
|
8711
|
+
chunks: [],
|
|
8712
|
+
segments: []
|
|
8713
|
+
};
|
|
8714
|
+
}
|
|
8715
|
+
return {
|
|
8716
|
+
widths: [],
|
|
8717
|
+
lineEndFitAdvances: [],
|
|
8718
|
+
lineEndPaintAdvances: [],
|
|
8719
|
+
kinds: [],
|
|
8720
|
+
simpleLineWalkFastPath: true,
|
|
8721
|
+
segLevels: null,
|
|
8722
|
+
breakableFitAdvances: [],
|
|
8723
|
+
discretionaryHyphenWidth: 0,
|
|
8724
|
+
tabStopAdvance: 0,
|
|
8725
|
+
chunks: []
|
|
8726
|
+
};
|
|
8727
|
+
}
|
|
8728
|
+
function buildBaseCjkUnits(segText, engineProfile) {
|
|
8729
|
+
const units = [];
|
|
8730
|
+
let unitParts = [];
|
|
8731
|
+
let unitStart = 0;
|
|
8732
|
+
let unitContainsCJK = false;
|
|
8733
|
+
let unitEndsWithClosingQuote = false;
|
|
8734
|
+
let unitIsSingleKinsokuEnd = false;
|
|
8735
|
+
function pushUnit() {
|
|
8736
|
+
if (unitParts.length === 0)
|
|
8737
|
+
return;
|
|
8738
|
+
units.push({
|
|
8739
|
+
text: unitParts.length === 1 ? unitParts[0] : unitParts.join(""),
|
|
8740
|
+
start: unitStart
|
|
8741
|
+
});
|
|
8742
|
+
unitParts = [];
|
|
8743
|
+
unitContainsCJK = false;
|
|
8744
|
+
unitEndsWithClosingQuote = false;
|
|
8745
|
+
unitIsSingleKinsokuEnd = false;
|
|
8746
|
+
}
|
|
8747
|
+
function startUnit(grapheme, start, graphemeContainsCJK) {
|
|
8748
|
+
unitParts = [grapheme];
|
|
8749
|
+
unitStart = start;
|
|
8750
|
+
unitContainsCJK = graphemeContainsCJK;
|
|
8751
|
+
unitEndsWithClosingQuote = endsWithClosingQuote(grapheme);
|
|
8752
|
+
unitIsSingleKinsokuEnd = kinsokuEnd.has(grapheme);
|
|
8753
|
+
}
|
|
8754
|
+
function appendToUnit(grapheme, graphemeContainsCJK) {
|
|
8755
|
+
unitParts.push(grapheme);
|
|
8756
|
+
unitContainsCJK = unitContainsCJK || graphemeContainsCJK;
|
|
8757
|
+
const graphemeEndsWithClosingQuote = endsWithClosingQuote(grapheme);
|
|
8758
|
+
if (grapheme.length === 1 && leftStickyPunctuation.has(grapheme)) {
|
|
8759
|
+
unitEndsWithClosingQuote = unitEndsWithClosingQuote || graphemeEndsWithClosingQuote;
|
|
8760
|
+
} else {
|
|
8761
|
+
unitEndsWithClosingQuote = graphemeEndsWithClosingQuote;
|
|
8762
|
+
}
|
|
8763
|
+
unitIsSingleKinsokuEnd = false;
|
|
8764
|
+
}
|
|
8765
|
+
for (const gs of getSharedGraphemeSegmenter2().segment(segText)) {
|
|
8766
|
+
const grapheme = gs.segment;
|
|
8767
|
+
const graphemeContainsCJK = isCJK(grapheme);
|
|
8768
|
+
if (unitParts.length === 0) {
|
|
8769
|
+
startUnit(grapheme, gs.index, graphemeContainsCJK);
|
|
8770
|
+
continue;
|
|
8771
|
+
}
|
|
8772
|
+
if (unitIsSingleKinsokuEnd || kinsokuStart.has(grapheme) || leftStickyPunctuation.has(grapheme) || engineProfile.carryCJKAfterClosingQuote && graphemeContainsCJK && unitEndsWithClosingQuote) {
|
|
8773
|
+
appendToUnit(grapheme, graphemeContainsCJK);
|
|
8774
|
+
continue;
|
|
8775
|
+
}
|
|
8776
|
+
if (!unitContainsCJK && !graphemeContainsCJK) {
|
|
8777
|
+
appendToUnit(grapheme, graphemeContainsCJK);
|
|
8778
|
+
continue;
|
|
8779
|
+
}
|
|
8780
|
+
pushUnit();
|
|
8781
|
+
startUnit(grapheme, gs.index, graphemeContainsCJK);
|
|
8782
|
+
}
|
|
8783
|
+
pushUnit();
|
|
8784
|
+
return units;
|
|
8785
|
+
}
|
|
8786
|
+
function mergeKeepAllTextUnits(units) {
|
|
8787
|
+
if (units.length <= 1)
|
|
8788
|
+
return units;
|
|
8789
|
+
const merged = [];
|
|
8790
|
+
let currentTextParts = [units[0].text];
|
|
8791
|
+
let currentStart = units[0].start;
|
|
8792
|
+
let currentContainsCJK = isCJK(units[0].text);
|
|
8793
|
+
let currentCanContinue = canContinueKeepAllTextRun(units[0].text);
|
|
8794
|
+
function flushCurrent() {
|
|
8795
|
+
merged.push({
|
|
8796
|
+
text: currentTextParts.length === 1 ? currentTextParts[0] : currentTextParts.join(""),
|
|
8797
|
+
start: currentStart
|
|
8798
|
+
});
|
|
8799
|
+
}
|
|
8800
|
+
for (let i2 = 1; i2 < units.length; i2++) {
|
|
8801
|
+
const next = units[i2];
|
|
8802
|
+
const nextContainsCJK = isCJK(next.text);
|
|
8803
|
+
const nextCanContinue = canContinueKeepAllTextRun(next.text);
|
|
8804
|
+
if (currentContainsCJK && currentCanContinue) {
|
|
8805
|
+
currentTextParts.push(next.text);
|
|
8806
|
+
currentContainsCJK = currentContainsCJK || nextContainsCJK;
|
|
8807
|
+
currentCanContinue = nextCanContinue;
|
|
8808
|
+
continue;
|
|
8809
|
+
}
|
|
8810
|
+
flushCurrent();
|
|
8811
|
+
currentTextParts = [next.text];
|
|
8812
|
+
currentStart = next.start;
|
|
8813
|
+
currentContainsCJK = nextContainsCJK;
|
|
8814
|
+
currentCanContinue = nextCanContinue;
|
|
8815
|
+
}
|
|
8816
|
+
flushCurrent();
|
|
8817
|
+
return merged;
|
|
8818
|
+
}
|
|
8819
|
+
function measureAnalysis(analysis, font, includeSegments, wordBreak) {
|
|
8820
|
+
const engineProfile = getEngineProfile();
|
|
8821
|
+
const { cache, emojiCorrection } = getFontMeasurementState(font, textMayContainEmoji(analysis.normalized));
|
|
8822
|
+
const discretionaryHyphenWidth = getCorrectedSegmentWidth("-", getSegmentMetrics("-", cache), emojiCorrection);
|
|
8823
|
+
const spaceWidth = getCorrectedSegmentWidth(" ", getSegmentMetrics(" ", cache), emojiCorrection);
|
|
8824
|
+
const tabStopAdvance = spaceWidth * 8;
|
|
8825
|
+
if (analysis.len === 0)
|
|
8826
|
+
return createEmptyPrepared(includeSegments);
|
|
8827
|
+
const widths = [];
|
|
8828
|
+
const lineEndFitAdvances = [];
|
|
8829
|
+
const lineEndPaintAdvances = [];
|
|
8830
|
+
const kinds = [];
|
|
8831
|
+
let simpleLineWalkFastPath = analysis.chunks.length <= 1;
|
|
8832
|
+
const segStarts = includeSegments ? [] : null;
|
|
8833
|
+
const breakableFitAdvances = [];
|
|
8834
|
+
const segments = includeSegments ? [] : null;
|
|
8835
|
+
const preparedStartByAnalysisIndex = Array.from({ length: analysis.len });
|
|
8836
|
+
function pushMeasuredSegment(text, width, lineEndFitAdvance, lineEndPaintAdvance, kind, start, breakableFitAdvance) {
|
|
8837
|
+
if (kind !== "text" && kind !== "space" && kind !== "zero-width-break") {
|
|
8838
|
+
simpleLineWalkFastPath = false;
|
|
8839
|
+
}
|
|
8840
|
+
widths.push(width);
|
|
8841
|
+
lineEndFitAdvances.push(lineEndFitAdvance);
|
|
8842
|
+
lineEndPaintAdvances.push(lineEndPaintAdvance);
|
|
8843
|
+
kinds.push(kind);
|
|
8844
|
+
segStarts?.push(start);
|
|
8845
|
+
breakableFitAdvances.push(breakableFitAdvance);
|
|
8846
|
+
if (segments !== null)
|
|
8847
|
+
segments.push(text);
|
|
8848
|
+
}
|
|
8849
|
+
function pushMeasuredTextSegment(text, kind, start, wordLike, allowOverflowBreaks) {
|
|
8850
|
+
const textMetrics = getSegmentMetrics(text, cache);
|
|
8851
|
+
const width = getCorrectedSegmentWidth(text, textMetrics, emojiCorrection);
|
|
8852
|
+
const lineEndFitAdvance = kind === "space" || kind === "preserved-space" || kind === "zero-width-break" ? 0 : width;
|
|
8853
|
+
const lineEndPaintAdvance = kind === "space" || kind === "zero-width-break" ? 0 : width;
|
|
8854
|
+
if (allowOverflowBreaks && wordLike && text.length > 1) {
|
|
8855
|
+
let fitMode = "sum-graphemes";
|
|
8856
|
+
if (isNumericRunSegment(text)) {
|
|
8857
|
+
fitMode = "pair-context";
|
|
8858
|
+
} else if (engineProfile.preferPrefixWidthsForBreakableRuns) {
|
|
8859
|
+
fitMode = "segment-prefixes";
|
|
8860
|
+
}
|
|
8861
|
+
const fitAdvances = getSegmentBreakableFitAdvances(text, textMetrics, cache, emojiCorrection, fitMode);
|
|
8862
|
+
pushMeasuredSegment(text, width, lineEndFitAdvance, lineEndPaintAdvance, kind, start, fitAdvances);
|
|
8863
|
+
return;
|
|
8864
|
+
}
|
|
8865
|
+
pushMeasuredSegment(text, width, lineEndFitAdvance, lineEndPaintAdvance, kind, start, null);
|
|
8866
|
+
}
|
|
8867
|
+
for (let mi = 0; mi < analysis.len; mi++) {
|
|
8868
|
+
preparedStartByAnalysisIndex[mi] = widths.length;
|
|
8869
|
+
const segText = analysis.texts[mi];
|
|
8870
|
+
const segWordLike = analysis.isWordLike[mi];
|
|
8871
|
+
const segKind = analysis.kinds[mi];
|
|
8872
|
+
const segStart = analysis.starts[mi];
|
|
8873
|
+
if (segKind === "soft-hyphen") {
|
|
8874
|
+
pushMeasuredSegment(segText, 0, discretionaryHyphenWidth, discretionaryHyphenWidth, segKind, segStart, null);
|
|
8875
|
+
continue;
|
|
8876
|
+
}
|
|
8877
|
+
if (segKind === "hard-break") {
|
|
8878
|
+
pushMeasuredSegment(segText, 0, 0, 0, segKind, segStart, null);
|
|
8879
|
+
continue;
|
|
8880
|
+
}
|
|
8881
|
+
if (segKind === "tab") {
|
|
8882
|
+
pushMeasuredSegment(segText, 0, 0, 0, segKind, segStart, null);
|
|
8883
|
+
continue;
|
|
8884
|
+
}
|
|
8885
|
+
const segMetrics = getSegmentMetrics(segText, cache);
|
|
8886
|
+
if (segKind === "text" && segMetrics.containsCJK) {
|
|
8887
|
+
const baseUnits = buildBaseCjkUnits(segText, engineProfile);
|
|
8888
|
+
const measuredUnits = wordBreak === "keep-all" ? mergeKeepAllTextUnits(baseUnits) : baseUnits;
|
|
8889
|
+
for (let i2 = 0; i2 < measuredUnits.length; i2++) {
|
|
8890
|
+
const unit = measuredUnits[i2];
|
|
8891
|
+
pushMeasuredTextSegment(unit.text, "text", segStart + unit.start, segWordLike, wordBreak === "keep-all" || !isCJK(unit.text));
|
|
8892
|
+
}
|
|
8893
|
+
continue;
|
|
8894
|
+
}
|
|
8895
|
+
pushMeasuredTextSegment(segText, segKind, segStart, segWordLike, true);
|
|
8896
|
+
}
|
|
8897
|
+
const chunks = mapAnalysisChunksToPreparedChunks(analysis.chunks, preparedStartByAnalysisIndex, widths.length);
|
|
8898
|
+
const segLevels = segStarts === null ? null : computeSegmentLevels(analysis.normalized, segStarts);
|
|
8899
|
+
if (segments !== null) {
|
|
8900
|
+
return {
|
|
8901
|
+
widths,
|
|
8902
|
+
lineEndFitAdvances,
|
|
8903
|
+
lineEndPaintAdvances,
|
|
8904
|
+
kinds,
|
|
8905
|
+
simpleLineWalkFastPath,
|
|
8906
|
+
segLevels,
|
|
8907
|
+
breakableFitAdvances,
|
|
8908
|
+
discretionaryHyphenWidth,
|
|
8909
|
+
tabStopAdvance,
|
|
8910
|
+
chunks,
|
|
8911
|
+
segments
|
|
8912
|
+
};
|
|
8913
|
+
}
|
|
8914
|
+
return {
|
|
8915
|
+
widths,
|
|
8916
|
+
lineEndFitAdvances,
|
|
8917
|
+
lineEndPaintAdvances,
|
|
8918
|
+
kinds,
|
|
8919
|
+
simpleLineWalkFastPath,
|
|
8920
|
+
segLevels,
|
|
8921
|
+
breakableFitAdvances,
|
|
8922
|
+
discretionaryHyphenWidth,
|
|
8923
|
+
tabStopAdvance,
|
|
8924
|
+
chunks
|
|
8925
|
+
};
|
|
8926
|
+
}
|
|
8927
|
+
function mapAnalysisChunksToPreparedChunks(chunks, preparedStartByAnalysisIndex, preparedEndSegmentIndex) {
|
|
8928
|
+
const preparedChunks = [];
|
|
8929
|
+
for (let i2 = 0; i2 < chunks.length; i2++) {
|
|
8930
|
+
const chunk = chunks[i2];
|
|
8931
|
+
const startSegmentIndex = chunk.startSegmentIndex < preparedStartByAnalysisIndex.length ? preparedStartByAnalysisIndex[chunk.startSegmentIndex] : preparedEndSegmentIndex;
|
|
8932
|
+
const endSegmentIndex = chunk.endSegmentIndex < preparedStartByAnalysisIndex.length ? preparedStartByAnalysisIndex[chunk.endSegmentIndex] : preparedEndSegmentIndex;
|
|
8933
|
+
const consumedEndSegmentIndex = chunk.consumedEndSegmentIndex < preparedStartByAnalysisIndex.length ? preparedStartByAnalysisIndex[chunk.consumedEndSegmentIndex] : preparedEndSegmentIndex;
|
|
8934
|
+
preparedChunks.push({
|
|
8935
|
+
startSegmentIndex,
|
|
8936
|
+
endSegmentIndex,
|
|
8937
|
+
consumedEndSegmentIndex
|
|
8938
|
+
});
|
|
8939
|
+
}
|
|
8940
|
+
return preparedChunks;
|
|
8941
|
+
}
|
|
8942
|
+
function prepareInternal(text, font, includeSegments, options) {
|
|
8943
|
+
const wordBreak = options?.wordBreak ?? "normal";
|
|
8944
|
+
const analysis = analyzeText(text, getEngineProfile(), options?.whiteSpace, wordBreak);
|
|
8945
|
+
return measureAnalysis(analysis, font, includeSegments, wordBreak);
|
|
8946
|
+
}
|
|
8947
|
+
function prepare(text, font, options) {
|
|
8948
|
+
return prepareInternal(text, font, false, options);
|
|
8949
|
+
}
|
|
8950
|
+
function getInternalPrepared(prepared) {
|
|
8951
|
+
return prepared;
|
|
8952
|
+
}
|
|
8953
|
+
function layout(prepared, maxWidth, lineHeight) {
|
|
8954
|
+
const lineCount = countPreparedLines(getInternalPrepared(prepared), maxWidth);
|
|
8955
|
+
return { lineCount, height: lineCount * lineHeight };
|
|
8956
|
+
}
|
|
8957
|
+
var sharedGraphemeSegmenter2;
|
|
4888
8958
|
var init_layout = __esm({
|
|
4889
8959
|
"../../node_modules/.bun/@chenglou+pretext@0.0.5/node_modules/@chenglou/pretext/dist/layout.js"() {
|
|
4890
8960
|
"use strict";
|
|
@@ -4892,14 +8962,37 @@ var init_layout = __esm({
|
|
|
4892
8962
|
init_analysis();
|
|
4893
8963
|
init_measurement();
|
|
4894
8964
|
init_line_break();
|
|
8965
|
+
sharedGraphemeSegmenter2 = null;
|
|
4895
8966
|
}
|
|
4896
8967
|
});
|
|
4897
8968
|
|
|
4898
8969
|
// ../core/src/text/fitTextFontSize.ts
|
|
8970
|
+
function fitTextFontSize(text, options) {
|
|
8971
|
+
const opts = { ...DEFAULTS, ...options };
|
|
8972
|
+
const lineHeightRatio = 1.2;
|
|
8973
|
+
for (let size = opts.baseFontSize; size >= opts.minFontSize; size -= opts.step) {
|
|
8974
|
+
const font = `${opts.fontWeight} ${size}px ${opts.fontFamily}`;
|
|
8975
|
+
const prepared = prepare(text, font);
|
|
8976
|
+
const { lineCount } = layout(prepared, opts.maxWidth, size * lineHeightRatio);
|
|
8977
|
+
if (lineCount <= 1) {
|
|
8978
|
+
return { fontSize: size, fits: true };
|
|
8979
|
+
}
|
|
8980
|
+
}
|
|
8981
|
+
return { fontSize: opts.minFontSize, fits: false };
|
|
8982
|
+
}
|
|
8983
|
+
var DEFAULTS;
|
|
4899
8984
|
var init_fitTextFontSize = __esm({
|
|
4900
8985
|
"../core/src/text/fitTextFontSize.ts"() {
|
|
4901
8986
|
"use strict";
|
|
4902
8987
|
init_layout();
|
|
8988
|
+
DEFAULTS = {
|
|
8989
|
+
maxWidth: 1600,
|
|
8990
|
+
baseFontSize: 78,
|
|
8991
|
+
minFontSize: 42,
|
|
8992
|
+
fontWeight: 900,
|
|
8993
|
+
fontFamily: "Outfit",
|
|
8994
|
+
step: 2
|
|
8995
|
+
};
|
|
4903
8996
|
}
|
|
4904
8997
|
});
|
|
4905
8998
|
|
|
@@ -4912,10 +9005,31 @@ var init_text = __esm({
|
|
|
4912
9005
|
});
|
|
4913
9006
|
|
|
4914
9007
|
// ../core/src/registry/types.ts
|
|
4915
|
-
|
|
9008
|
+
function isExampleItem(item) {
|
|
9009
|
+
return item.type === "hyperframes:example";
|
|
9010
|
+
}
|
|
9011
|
+
function isBlockItem(item) {
|
|
9012
|
+
return item.type === "hyperframes:block";
|
|
9013
|
+
}
|
|
9014
|
+
function isComponentItem(item) {
|
|
9015
|
+
return item.type === "hyperframes:component";
|
|
9016
|
+
}
|
|
9017
|
+
var ITEM_TYPES, FILE_TYPES, ITEM_TYPE_DIRS;
|
|
4916
9018
|
var init_types = __esm({
|
|
4917
9019
|
"../core/src/registry/types.ts"() {
|
|
4918
9020
|
"use strict";
|
|
9021
|
+
ITEM_TYPES = [
|
|
9022
|
+
"hyperframes:example",
|
|
9023
|
+
"hyperframes:block",
|
|
9024
|
+
"hyperframes:component"
|
|
9025
|
+
];
|
|
9026
|
+
FILE_TYPES = [
|
|
9027
|
+
"hyperframes:composition",
|
|
9028
|
+
"hyperframes:asset",
|
|
9029
|
+
"hyperframes:snippet",
|
|
9030
|
+
"hyperframes:style",
|
|
9031
|
+
"hyperframes:timeline"
|
|
9032
|
+
];
|
|
4919
9033
|
ITEM_TYPE_DIRS = {
|
|
4920
9034
|
"hyperframes:example": "examples",
|
|
4921
9035
|
"hyperframes:block": "blocks",
|
|
@@ -4933,6 +9047,75 @@ var init_registry = __esm({
|
|
|
4933
9047
|
});
|
|
4934
9048
|
|
|
4935
9049
|
// ../core/src/index.ts
|
|
9050
|
+
var src_exports = {};
|
|
9051
|
+
__export(src_exports, {
|
|
9052
|
+
BASE_STYLES: () => BASE_STYLES,
|
|
9053
|
+
CANVAS_DIMENSIONS: () => CANVAS_DIMENSIONS,
|
|
9054
|
+
DEFAULT_DURATIONS: () => DEFAULT_DURATIONS,
|
|
9055
|
+
ELEMENT_BASE_STYLES: () => ELEMENT_BASE_STYLES,
|
|
9056
|
+
FILE_TYPES: () => FILE_TYPES,
|
|
9057
|
+
GSAP_CDN: () => GSAP_CDN,
|
|
9058
|
+
HYPERFRAME_BRIDGE_SOURCES: () => HYPERFRAME_BRIDGE_SOURCES,
|
|
9059
|
+
HYPERFRAME_CONTROL_ACTIONS: () => HYPERFRAME_CONTROL_ACTIONS,
|
|
9060
|
+
HYPERFRAME_RUNTIME_ARTIFACTS: () => HYPERFRAME_RUNTIME_ARTIFACTS,
|
|
9061
|
+
HYPERFRAME_RUNTIME_CONTRACT: () => HYPERFRAME_RUNTIME_CONTRACT,
|
|
9062
|
+
HYPERFRAME_RUNTIME_GLOBALS: () => HYPERFRAME_RUNTIME_GLOBALS,
|
|
9063
|
+
ITEM_TYPES: () => ITEM_TYPES,
|
|
9064
|
+
ITEM_TYPE_DIRS: () => ITEM_TYPE_DIRS,
|
|
9065
|
+
MEDIA_STYLES: () => MEDIA_STYLES,
|
|
9066
|
+
MEDIA_VISUAL_STYLE_PROPERTIES: () => MEDIA_VISUAL_STYLE_PROPERTIES,
|
|
9067
|
+
SUPPORTED_EASES: () => SUPPORTED_EASES,
|
|
9068
|
+
SUPPORTED_PROPS: () => SUPPORTED_PROPS,
|
|
9069
|
+
TEXT_STYLES: () => TEXT_STYLES,
|
|
9070
|
+
TIMELINE_COLORS: () => TIMELINE_COLORS,
|
|
9071
|
+
ZOOM_CONTAINER_STYLES: () => ZOOM_CONTAINER_STYLES,
|
|
9072
|
+
addAnimationToScript: () => addAnimationToScript,
|
|
9073
|
+
addElementToHtml: () => addElementToHtml,
|
|
9074
|
+
buildHyperframesRuntimeScript: () => buildHyperframesRuntimeScript,
|
|
9075
|
+
clampDurations: () => clampDurations,
|
|
9076
|
+
compileTimingAttrs: () => compileTimingAttrs,
|
|
9077
|
+
copyMediaVisualStyles: () => copyMediaVisualStyles,
|
|
9078
|
+
createGSAPFrameAdapter: () => createGSAPFrameAdapter,
|
|
9079
|
+
extractCompositionMetadata: () => extractCompositionMetadata,
|
|
9080
|
+
extractResolvedMedia: () => extractResolvedMedia,
|
|
9081
|
+
fitTextFontSize: () => fitTextFontSize,
|
|
9082
|
+
generateBaseHtml: () => generateBaseHtml,
|
|
9083
|
+
generateGsapTimelineScript: () => generateGsapTimelineScript,
|
|
9084
|
+
generateHyperframesHtml: () => generateHyperframesHtml,
|
|
9085
|
+
generateHyperframesStyles: () => generateHyperframesStyles,
|
|
9086
|
+
getAnimationsForElement: () => getAnimationsForElement,
|
|
9087
|
+
getDefaultStageZoom: () => getDefaultStageZoom,
|
|
9088
|
+
getStageStyles: () => getStageStyles,
|
|
9089
|
+
gsapAnimationsToKeyframes: () => gsapAnimationsToKeyframes,
|
|
9090
|
+
injectDurations: () => injectDurations,
|
|
9091
|
+
isBlockItem: () => isBlockItem,
|
|
9092
|
+
isBooleanVariable: () => isBooleanVariable,
|
|
9093
|
+
isColorVariable: () => isColorVariable,
|
|
9094
|
+
isComponentItem: () => isComponentItem,
|
|
9095
|
+
isCompositionElement: () => isCompositionElement,
|
|
9096
|
+
isEnumVariable: () => isEnumVariable,
|
|
9097
|
+
isExampleItem: () => isExampleItem,
|
|
9098
|
+
isMediaElement: () => isMediaElement,
|
|
9099
|
+
isNumberVariable: () => isNumberVariable,
|
|
9100
|
+
isStringVariable: () => isStringVariable,
|
|
9101
|
+
isTextElement: () => isTextElement,
|
|
9102
|
+
keyframesToGsapAnimations: () => keyframesToGsapAnimations,
|
|
9103
|
+
lintHyperframeHtml: () => lintHyperframeHtml,
|
|
9104
|
+
loadHyperframeRuntimeSource: () => loadHyperframeRuntimeSource,
|
|
9105
|
+
parseGsapScript: () => parseGsapScript,
|
|
9106
|
+
parseHtml: () => parseHtml,
|
|
9107
|
+
quantizeTimeToFrame: () => quantizeTimeToFrame,
|
|
9108
|
+
removeAnimationFromScript: () => removeAnimationFromScript,
|
|
9109
|
+
removeElementFromHtml: () => removeElementFromHtml,
|
|
9110
|
+
rewriteAssetPath: () => rewriteAssetPath,
|
|
9111
|
+
rewriteAssetPaths: () => rewriteAssetPaths,
|
|
9112
|
+
rewriteCssAssetUrls: () => rewriteCssAssetUrls,
|
|
9113
|
+
serializeGsapAnimations: () => serializeGsapAnimations,
|
|
9114
|
+
updateAnimationInScript: () => updateAnimationInScript,
|
|
9115
|
+
updateElementInHtml: () => updateElementInHtml,
|
|
9116
|
+
validateCompositionGsap: () => validateCompositionGsap,
|
|
9117
|
+
validateCompositionHtml: () => validateCompositionHtml
|
|
9118
|
+
});
|
|
4936
9119
|
var init_src = __esm({
|
|
4937
9120
|
"../core/src/index.ts"() {
|
|
4938
9121
|
"use strict";
|
|
@@ -6843,6 +11026,24 @@ var init_fileWatcher = __esm({
|
|
|
6843
11026
|
}
|
|
6844
11027
|
});
|
|
6845
11028
|
|
|
11029
|
+
// src/server/runtimeSource.ts
|
|
11030
|
+
async function loadRuntimeSourceFallback() {
|
|
11031
|
+
try {
|
|
11032
|
+
const mod = await Promise.resolve().then(() => (init_src(), src_exports));
|
|
11033
|
+
if (typeof mod.loadHyperframeRuntimeSource === "function") {
|
|
11034
|
+
return mod.loadHyperframeRuntimeSource();
|
|
11035
|
+
}
|
|
11036
|
+
} catch (err) {
|
|
11037
|
+
console.warn("[studio] Failed to load runtime source fallback:", err);
|
|
11038
|
+
}
|
|
11039
|
+
return null;
|
|
11040
|
+
}
|
|
11041
|
+
var init_runtimeSource = __esm({
|
|
11042
|
+
"src/server/runtimeSource.ts"() {
|
|
11043
|
+
"use strict";
|
|
11044
|
+
}
|
|
11045
|
+
});
|
|
11046
|
+
|
|
6846
11047
|
// ../core/src/studio-api/helpers/safePath.ts
|
|
6847
11048
|
import { resolve as resolve7, sep, join as join10 } from "path";
|
|
6848
11049
|
import { readdirSync as readdirSync3 } from "fs";
|
|
@@ -20185,6 +24386,7 @@ function registerThumbnailRoutes(api, adapter2) {
|
|
|
20185
24386
|
const seekTime = parseFloat(url.searchParams.get("t") || "0.5") || 0.5;
|
|
20186
24387
|
const vpWidth = parseInt(url.searchParams.get("w") || "0") || 0;
|
|
20187
24388
|
const vpHeight = parseInt(url.searchParams.get("h") || "0") || 0;
|
|
24389
|
+
const selector = url.searchParams.get("selector") || void 0;
|
|
20188
24390
|
let compW = vpWidth || 1920;
|
|
20189
24391
|
let compH = vpHeight || 1080;
|
|
20190
24392
|
if (!vpWidth) {
|
|
@@ -20199,7 +24401,8 @@ function registerThumbnailRoutes(api, adapter2) {
|
|
|
20199
24401
|
}
|
|
20200
24402
|
const previewUrl = compPath === "index.html" ? `http://${c2.req.header("host")}/api/projects/${project.id}/preview` : `http://${c2.req.header("host")}/api/projects/${project.id}/preview/comp/${compPath}`;
|
|
20201
24403
|
const cacheDir = join15(project.dir, ".thumbnails");
|
|
20202
|
-
const
|
|
24404
|
+
const selectorKey = selector ? `_${selector.replace(/[^a-zA-Z0-9_-]+/g, "_").slice(0, 80)}` : "";
|
|
24405
|
+
const cacheKey = `${THUMBNAIL_CACHE_VERSION}_${compPath.replace(/\//g, "_")}_${seekTime.toFixed(2)}${selectorKey}.jpg`;
|
|
20203
24406
|
const cachePath2 = join15(cacheDir, cacheKey);
|
|
20204
24407
|
if (existsSync11(cachePath2)) {
|
|
20205
24408
|
return new Response(new Uint8Array(readFileSync13(cachePath2)), {
|
|
@@ -20213,7 +24416,8 @@ function registerThumbnailRoutes(api, adapter2) {
|
|
|
20213
24416
|
seekTime,
|
|
20214
24417
|
width: compW,
|
|
20215
24418
|
height: compH,
|
|
20216
|
-
previewUrl
|
|
24419
|
+
previewUrl,
|
|
24420
|
+
selector
|
|
20217
24421
|
});
|
|
20218
24422
|
if (!buffer) {
|
|
20219
24423
|
return c2.json({ error: "Thumbnail generation returned null" }, 500);
|
|
@@ -20229,9 +24433,11 @@ function registerThumbnailRoutes(api, adapter2) {
|
|
|
20229
24433
|
}
|
|
20230
24434
|
});
|
|
20231
24435
|
}
|
|
24436
|
+
var THUMBNAIL_CACHE_VERSION;
|
|
20232
24437
|
var init_thumbnail = __esm({
|
|
20233
24438
|
"../core/src/studio-api/routes/thumbnail.ts"() {
|
|
20234
24439
|
"use strict";
|
|
24440
|
+
THUMBNAIL_CACHE_VERSION = "v2";
|
|
20235
24441
|
}
|
|
20236
24442
|
});
|
|
20237
24443
|
|
|
@@ -25360,8 +29566,8 @@ var init_hdrCapture = __esm({
|
|
|
25360
29566
|
});
|
|
25361
29567
|
|
|
25362
29568
|
// ../engine/src/index.ts
|
|
25363
|
-
var
|
|
25364
|
-
__export(
|
|
29569
|
+
var src_exports2 = {};
|
|
29570
|
+
__export(src_exports2, {
|
|
25365
29571
|
DEFAULT_CONFIG: () => DEFAULT_CONFIG2,
|
|
25366
29572
|
DEFAULT_HDR10_MASTERING: () => DEFAULT_HDR10_MASTERING,
|
|
25367
29573
|
DOM_LAYER_MASK_STYLE_ID: () => DOM_LAYER_MASK_STYLE_ID,
|
|
@@ -30207,8 +34413,8 @@ var init_parityContract2 = __esm({
|
|
|
30207
34413
|
});
|
|
30208
34414
|
|
|
30209
34415
|
// ../producer/src/index.ts
|
|
30210
|
-
var
|
|
30211
|
-
__export(
|
|
34416
|
+
var src_exports3 = {};
|
|
34417
|
+
__export(src_exports3, {
|
|
30212
34418
|
DEFAULT_CONFIG: () => DEFAULT_CONFIG2,
|
|
30213
34419
|
RenderCancelledError: () => RenderCancelledError,
|
|
30214
34420
|
captureFrame: () => captureFrame,
|
|
@@ -30287,7 +34493,7 @@ async function getThumbnailBrowser() {
|
|
|
30287
34493
|
_thumbnailBrowserInitializing = (async () => {
|
|
30288
34494
|
try {
|
|
30289
34495
|
const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
|
|
30290
|
-
const { acquireBrowser: acquireBrowser2, buildChromeArgs: buildChromeArgs2 } = await Promise.resolve().then(() => (init_src2(),
|
|
34496
|
+
const { acquireBrowser: acquireBrowser2, buildChromeArgs: buildChromeArgs2 } = await Promise.resolve().then(() => (init_src2(), src_exports2));
|
|
30291
34497
|
try {
|
|
30292
34498
|
const b = await ensureBrowser2();
|
|
30293
34499
|
if (b.executablePath && !process.env.PRODUCER_HEADLESS_SHELL_PATH) {
|
|
@@ -30350,7 +34556,7 @@ function createStudioServer(options) {
|
|
|
30350
34556
|
};
|
|
30351
34557
|
(async () => {
|
|
30352
34558
|
try {
|
|
30353
|
-
const { createRenderJob: createRenderJob2, executeRenderJob: executeRenderJob2 } = await Promise.resolve().then(() => (init_src3(),
|
|
34559
|
+
const { createRenderJob: createRenderJob2, executeRenderJob: executeRenderJob2 } = await Promise.resolve().then(() => (init_src3(), src_exports3));
|
|
30354
34560
|
const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
|
|
30355
34561
|
try {
|
|
30356
34562
|
const browser = await ensureBrowser2();
|
|
@@ -30410,7 +34616,31 @@ function createStudioServer(options) {
|
|
|
30410
34616
|
}
|
|
30411
34617
|
}, opts.seekTime);
|
|
30412
34618
|
await new Promise((r2) => setTimeout(r2, 200));
|
|
30413
|
-
|
|
34619
|
+
let clip;
|
|
34620
|
+
if (opts.selector) {
|
|
34621
|
+
clip = await page.evaluate((selector) => {
|
|
34622
|
+
const el = document.querySelector(selector);
|
|
34623
|
+
if (!(el instanceof HTMLElement)) return void 0;
|
|
34624
|
+
const rect = el.getBoundingClientRect();
|
|
34625
|
+
if (rect.width < 4 || rect.height < 4) return void 0;
|
|
34626
|
+
const pad = 8;
|
|
34627
|
+
const x4 = Math.max(0, rect.left - pad);
|
|
34628
|
+
const y2 = Math.max(0, rect.top - pad);
|
|
34629
|
+
const maxWidth = window.innerWidth - x4;
|
|
34630
|
+
const maxHeight = window.innerHeight - y2;
|
|
34631
|
+
return {
|
|
34632
|
+
x: x4,
|
|
34633
|
+
y: y2,
|
|
34634
|
+
width: Math.max(1, Math.min(rect.width + pad * 2, maxWidth)),
|
|
34635
|
+
height: Math.max(1, Math.min(rect.height + pad * 2, maxHeight))
|
|
34636
|
+
};
|
|
34637
|
+
}, opts.selector);
|
|
34638
|
+
}
|
|
34639
|
+
const screenshot = await page.screenshot({
|
|
34640
|
+
type: "jpeg",
|
|
34641
|
+
quality: 80,
|
|
34642
|
+
...clip ? { clip } : {}
|
|
34643
|
+
});
|
|
30414
34644
|
return screenshot;
|
|
30415
34645
|
} catch {
|
|
30416
34646
|
return null;
|
|
@@ -30430,11 +34660,15 @@ function createStudioServer(options) {
|
|
|
30430
34660
|
});
|
|
30431
34661
|
});
|
|
30432
34662
|
app.get("/api/runtime.js", (c2) => {
|
|
30433
|
-
|
|
30434
|
-
|
|
30435
|
-
"
|
|
30436
|
-
|
|
30437
|
-
|
|
34663
|
+
const serve4 = async () => {
|
|
34664
|
+
const runtimeSource = existsSync31(runtimePath) ? readFileSync23(runtimePath, "utf-8") : await loadRuntimeSourceFallback();
|
|
34665
|
+
if (!runtimeSource) return c2.text("runtime not available", 404);
|
|
34666
|
+
return c2.body(runtimeSource, 200, {
|
|
34667
|
+
"Content-Type": "text/javascript",
|
|
34668
|
+
"Cache-Control": "no-store"
|
|
34669
|
+
});
|
|
34670
|
+
};
|
|
34671
|
+
return serve4();
|
|
30438
34672
|
});
|
|
30439
34673
|
app.get("/api/events", (c2) => {
|
|
30440
34674
|
return streamSSE3(c2, async (stream) => {
|
|
@@ -30491,6 +34725,7 @@ var init_studioServer = __esm({
|
|
|
30491
34725
|
"src/server/studioServer.ts"() {
|
|
30492
34726
|
"use strict";
|
|
30493
34727
|
init_fileWatcher();
|
|
34728
|
+
init_runtimeSource();
|
|
30494
34729
|
init_version();
|
|
30495
34730
|
init_studio_api();
|
|
30496
34731
|
_thumbnailBrowser = null;
|
|
@@ -32061,7 +36296,7 @@ var init_play = __esm({
|
|
|
32061
36296
|
|
|
32062
36297
|
// src/utils/producer.ts
|
|
32063
36298
|
async function loadProducer() {
|
|
32064
|
-
return await Promise.resolve().then(() => (init_src3(),
|
|
36299
|
+
return await Promise.resolve().then(() => (init_src3(), src_exports3));
|
|
32065
36300
|
}
|
|
32066
36301
|
var init_producer = __esm({
|
|
32067
36302
|
"src/utils/producer.ts"() {
|
|
@@ -35032,7 +39267,7 @@ async function captureSnapshots(projectDir, opts) {
|
|
|
35032
39267
|
let injectVideoFramesBatch2 = null;
|
|
35033
39268
|
let syncVideoFrameVisibility2 = null;
|
|
35034
39269
|
try {
|
|
35035
|
-
const engine = await Promise.resolve().then(() => (init_src2(),
|
|
39270
|
+
const engine = await Promise.resolve().then(() => (init_src2(), src_exports2));
|
|
35036
39271
|
injectVideoFramesBatch2 = engine.injectVideoFramesBatch;
|
|
35037
39272
|
syncVideoFrameVisibility2 = engine.syncVideoFrameVisibility;
|
|
35038
39273
|
} catch {
|
|
@@ -44747,8 +48982,8 @@ var init_abort_error = __esm({
|
|
|
44747
48982
|
});
|
|
44748
48983
|
|
|
44749
48984
|
// ../../node_modules/.bun/node-fetch@3.3.2/node_modules/node-fetch/src/index.js
|
|
44750
|
-
var
|
|
44751
|
-
__export(
|
|
48985
|
+
var src_exports4 = {};
|
|
48986
|
+
__export(src_exports4, {
|
|
44752
48987
|
AbortError: () => AbortError,
|
|
44753
48988
|
Blob: () => fetch_blob_default,
|
|
44754
48989
|
FetchError: () => FetchError,
|
|
@@ -45489,7 +49724,7 @@ Content-Type: ${partContentType}\r
|
|
|
45489
49724
|
}
|
|
45490
49725
|
static async #getFetch() {
|
|
45491
49726
|
const hasWindow = typeof window !== "undefined" && !!window;
|
|
45492
|
-
this.#fetch ||= hasWindow ? window.fetch : (await Promise.resolve().then(() => (init_src4(),
|
|
49727
|
+
this.#fetch ||= hasWindow ? window.fetch : (await Promise.resolve().then(() => (init_src4(), src_exports4))).default;
|
|
45493
49728
|
return this.#fetch;
|
|
45494
49729
|
}
|
|
45495
49730
|
/**
|