@nodaro/shared 3.2.0 → 3.5.0
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/index.cjs +315 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +347 -3
- package/dist/index.d.ts +347 -3
- package/dist/index.js +280 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/image-overlay-credits.test.ts +24 -0
- package/src/__tests__/scene3d-input-assets.test.ts +31 -0
- package/src/__tests__/scene3d-v2.test.ts +24 -0
- package/src/__tests__/sequence-execution.test.ts +20 -0
- package/src/credit-estimators/image-overlay.ts +30 -0
- package/src/credit-estimators/index.ts +7 -0
- package/src/image-overlay-layers.ts +149 -0
- package/src/image-overlay-platforms.ts +88 -0
- package/src/image-overlay-shapes.ts +89 -0
- package/src/index.ts +5 -0
- package/src/pro-3d-render.ts +7 -1
- package/src/scene3d-input-assets.ts +27 -0
- package/src/scene3d-v2-plan.ts +6 -0
- package/src/scene3d-v2.ts +12 -2
- package/src/sequence-execution.ts +24 -0
package/dist/index.cjs
CHANGED
|
@@ -4945,6 +4945,63 @@ function assembleNarratedVideoCredits(blockCount) {
|
|
|
4945
4945
|
return 3 + Math.ceil(blockCount / 6);
|
|
4946
4946
|
}
|
|
4947
4947
|
|
|
4948
|
+
// src/image-overlay-platforms.ts
|
|
4949
|
+
var YT_BANNER_ALL = { x: (2560 - 1546) / 2 / 2560, y: (1440 - 423) / 2 / 1440, w: 1546 / 2560, h: 423 / 1440 };
|
|
4950
|
+
var OVERLAY_PLATFORMS = [
|
|
4951
|
+
{ id: "youtube-thumbnail", label: "YouTube thumbnail", width: 1280, height: 720, safe: { x: 0, y: 0, w: 1, h: 0.86 }, note: "The bottom-right corner carries the duration badge." },
|
|
4952
|
+
{
|
|
4953
|
+
id: "youtube-banner",
|
|
4954
|
+
label: "YouTube channel banner",
|
|
4955
|
+
width: 2560,
|
|
4956
|
+
height: 1440,
|
|
4957
|
+
safe: YT_BANNER_ALL,
|
|
4958
|
+
zones: [
|
|
4959
|
+
{ id: "tv", x: 0, y: 0, w: 1, h: 1 },
|
|
4960
|
+
{ id: "desktop", x: 0, y: (1440 - 423) / 2 / 1440, w: 1, h: 423 / 1440 },
|
|
4961
|
+
{ id: "all", ...YT_BANNER_ALL }
|
|
4962
|
+
],
|
|
4963
|
+
note: "TV shows the whole banner, desktop a 2560\xD7423 strip, phones only the centre 1546\xD7423."
|
|
4964
|
+
},
|
|
4965
|
+
{ id: "linkedin-company", label: "LinkedIn company cover", width: 1128, height: 191, safe: { x: 0.18, y: 0, w: 0.82, h: 1 }, note: "The company logo sits over the left ~200px." },
|
|
4966
|
+
{ id: "linkedin-personal", label: "LinkedIn personal cover", width: 1584, height: 396, safe: { x: 0.24, y: 0, w: 0.76, h: 0.9 }, note: "The profile photo covers the bottom-left." },
|
|
4967
|
+
{ id: "x-header", label: "X / Twitter header", width: 1500, height: 500, safe: { x: 0.2, y: 0.05, w: 0.78, h: 0.9 }, note: "The profile photo covers the bottom-left." },
|
|
4968
|
+
{ id: "facebook-cover", label: "Facebook page cover", width: 820, height: 312, safe: { x: 0.05, y: 0.08, w: 0.9, h: 0.84 } },
|
|
4969
|
+
{ id: "instagram-post", label: "Instagram post (1:1)", width: 1080, height: 1080 },
|
|
4970
|
+
{ id: "instagram-portrait", label: "Instagram post (4:5)", width: 1080, height: 1350 },
|
|
4971
|
+
{ id: "instagram-story", label: "Instagram / TikTok story (9:16)", width: 1080, height: 1920, safe: { x: 0, y: 250 / 1920, w: 1, h: (1920 - 500) / 1920 }, note: "The top and bottom 250px sit under the story UI." },
|
|
4972
|
+
{ id: "open-graph", label: "Link preview (Open Graph)", width: 1200, height: 630 },
|
|
4973
|
+
{ id: "presentation", label: "Presentation slide (16:9)", width: 1920, height: 1080 },
|
|
4974
|
+
{ id: "a4-print", label: "Print A4 @300dpi", width: 2480, height: 3508, safe: { x: 0.05, y: 0.05, w: 0.9, h: 0.9 }, note: "5% bleed margin." }
|
|
4975
|
+
];
|
|
4976
|
+
var OVERLAY_PLATFORM_IDS = OVERLAY_PLATFORMS.map((p) => p.id);
|
|
4977
|
+
function overlayPlatformById(id) {
|
|
4978
|
+
return id ? OVERLAY_PLATFORMS.find((p) => p.id === id) : void 0;
|
|
4979
|
+
}
|
|
4980
|
+
var OVERLAY_MAX_VARIANTS = OVERLAY_PLATFORMS.length;
|
|
4981
|
+
var OVERLAY_VARIANT_HANDLE_PREFIX = "variant:";
|
|
4982
|
+
function overlayVariantHandle(platformId) {
|
|
4983
|
+
return `${OVERLAY_VARIANT_HANDLE_PREFIX}${platformId}`;
|
|
4984
|
+
}
|
|
4985
|
+
function overlayVariantIdFromHandle(handle) {
|
|
4986
|
+
if (!handle || !handle.startsWith(OVERLAY_VARIANT_HANDLE_PREFIX)) return null;
|
|
4987
|
+
const id = handle.slice(OVERLAY_VARIANT_HANDLE_PREFIX.length);
|
|
4988
|
+
return overlayPlatformById(id) ? id : null;
|
|
4989
|
+
}
|
|
4990
|
+
|
|
4991
|
+
// src/credit-estimators/image-overlay.ts
|
|
4992
|
+
var IMAGE_OVERLAY_BASE_CREDITS = 10;
|
|
4993
|
+
var IMAGE_OVERLAY_VARIANT_CREDITS = 2;
|
|
4994
|
+
function imageOverlayBillableVariants(variants) {
|
|
4995
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4996
|
+
for (const v of variants ?? []) {
|
|
4997
|
+
if (typeof v === "string" && overlayPlatformById(v)) seen.add(v);
|
|
4998
|
+
}
|
|
4999
|
+
return [...seen];
|
|
5000
|
+
}
|
|
5001
|
+
function imageOverlayCredits(variants) {
|
|
5002
|
+
return IMAGE_OVERLAY_BASE_CREDITS + IMAGE_OVERLAY_VARIANT_CREDITS * imageOverlayBillableVariants(variants).length;
|
|
5003
|
+
}
|
|
5004
|
+
|
|
4948
5005
|
// src/video-duration.ts
|
|
4949
5006
|
function extractVideoDurationFromNode(data) {
|
|
4950
5007
|
if (!data) return void 0;
|
|
@@ -13922,6 +13979,167 @@ var SUPPORTED_FONT_NAMES = [
|
|
|
13922
13979
|
"Tajawal"
|
|
13923
13980
|
];
|
|
13924
13981
|
|
|
13982
|
+
// src/image-overlay-shapes.ts
|
|
13983
|
+
var OVERLAY_SHAPES = [
|
|
13984
|
+
"rect",
|
|
13985
|
+
"rounded",
|
|
13986
|
+
"pill",
|
|
13987
|
+
"circle",
|
|
13988
|
+
"ribbon",
|
|
13989
|
+
"triangle",
|
|
13990
|
+
"diamond",
|
|
13991
|
+
"hexagon",
|
|
13992
|
+
"star",
|
|
13993
|
+
"burst",
|
|
13994
|
+
"arrow"
|
|
13995
|
+
];
|
|
13996
|
+
function round(n) {
|
|
13997
|
+
return Math.round(n * 100) / 100;
|
|
13998
|
+
}
|
|
13999
|
+
function points(list) {
|
|
14000
|
+
return list.map(([x, y]) => `${round(x)},${round(y)}`).join(" ");
|
|
14001
|
+
}
|
|
14002
|
+
function radial(cx, cy, rx, ry, n, inner) {
|
|
14003
|
+
const pts = [];
|
|
14004
|
+
for (let i = 0; i < n * 2; i++) {
|
|
14005
|
+
const a = -Math.PI / 2 + i * Math.PI / n;
|
|
14006
|
+
const f = i % 2 === 0 ? 1 : inner;
|
|
14007
|
+
pts.push([cx + Math.cos(a) * rx * f, cy + Math.sin(a) * ry * f]);
|
|
14008
|
+
}
|
|
14009
|
+
return points(pts);
|
|
14010
|
+
}
|
|
14011
|
+
function overlayShapeElement(shape, w, h, inset = 0) {
|
|
14012
|
+
const i = Math.max(0, inset);
|
|
14013
|
+
const iw = Math.max(0, w - 2 * i);
|
|
14014
|
+
const ih = Math.max(0, h - 2 * i);
|
|
14015
|
+
const cx = w / 2;
|
|
14016
|
+
const cy = h / 2;
|
|
14017
|
+
switch (shape) {
|
|
14018
|
+
case "rounded":
|
|
14019
|
+
return { tag: "rect", attrs: { x: i, y: i, width: iw, height: ih, rx: round(Math.min(iw, ih) * 0.18) } };
|
|
14020
|
+
case "pill":
|
|
14021
|
+
return { tag: "rect", attrs: { x: i, y: i, width: iw, height: ih, rx: round(ih / 2) } };
|
|
14022
|
+
case "circle":
|
|
14023
|
+
return { tag: "ellipse", attrs: { cx, cy, rx: round(iw / 2), ry: round(ih / 2) } };
|
|
14024
|
+
case "ribbon": {
|
|
14025
|
+
const notch = Math.min(w / 4, h / 2);
|
|
14026
|
+
return { tag: "polygon", attrs: { points: points([[i, i], [w - i, i], [w - notch, cy], [w - i, h - i], [i, h - i], [notch, cy]]) } };
|
|
14027
|
+
}
|
|
14028
|
+
case "triangle":
|
|
14029
|
+
return { tag: "polygon", attrs: { points: points([[cx, i], [w - i, h - i], [i, h - i]]) } };
|
|
14030
|
+
case "diamond":
|
|
14031
|
+
return { tag: "polygon", attrs: { points: points([[cx, i], [w - i, cy], [cx, h - i], [i, cy]]) } };
|
|
14032
|
+
case "hexagon":
|
|
14033
|
+
return { tag: "polygon", attrs: { points: points([[w * 0.25, i], [w * 0.75, i], [w - i, cy], [w * 0.75, h - i], [w * 0.25, h - i], [i, cy]]) } };
|
|
14034
|
+
case "star":
|
|
14035
|
+
return { tag: "polygon", attrs: { points: radial(cx, cy, iw / 2, ih / 2, 5, 0.42) } };
|
|
14036
|
+
case "burst":
|
|
14037
|
+
return { tag: "polygon", attrs: { points: radial(cx, cy, iw / 2, ih / 2, 14, 0.82) } };
|
|
14038
|
+
case "arrow":
|
|
14039
|
+
return {
|
|
14040
|
+
tag: "polygon",
|
|
14041
|
+
attrs: { points: points([[i, h * 0.25], [w * 0.6, h * 0.25], [w * 0.6, i], [w - i, cy], [w * 0.6, h - i], [w * 0.6, h * 0.75], [i, h * 0.75]]) }
|
|
14042
|
+
};
|
|
14043
|
+
default:
|
|
14044
|
+
return { tag: "rect", attrs: { x: i, y: i, width: iw, height: ih } };
|
|
14045
|
+
}
|
|
14046
|
+
}
|
|
14047
|
+
|
|
14048
|
+
// src/image-overlay-layers.ts
|
|
14049
|
+
var OVERLAY_LAYER_KINDS = ["image", "text", "qr", "shape"];
|
|
14050
|
+
var OVERLAY_TEXT_ALIGNS = ["left", "center", "right"];
|
|
14051
|
+
var OVERLAY_IMAGE_MASKS = ["none", "circle"];
|
|
14052
|
+
var OVERLAY_FONTS = [
|
|
14053
|
+
{ id: "inter", family: "Inter", file: "Inter.ttf", variable: true, scripts: ["latin"], category: "sans" },
|
|
14054
|
+
{ id: "montserrat", family: "Montserrat", file: "Montserrat.ttf", variable: true, scripts: ["latin"], category: "sans" },
|
|
14055
|
+
{ id: "space-grotesk", family: "Space Grotesk", file: "SpaceGrotesk.ttf", variable: true, scripts: ["latin"], category: "sans" },
|
|
14056
|
+
{ id: "playfair-display", family: "Playfair Display", file: "PlayfairDisplay.ttf", variable: true, scripts: ["latin"], category: "serif" },
|
|
14057
|
+
{ id: "oswald", family: "Oswald", file: "Oswald.ttf", variable: true, scripts: ["latin"], category: "display" },
|
|
14058
|
+
{ id: "bebas-neue", family: "Bebas Neue", file: "BebasNeue.ttf", variable: false, scripts: ["latin"], category: "display" },
|
|
14059
|
+
{ id: "anton", family: "Anton", file: "Anton.ttf", variable: false, scripts: ["latin"], category: "display" },
|
|
14060
|
+
{ id: "pacifico", family: "Pacifico", file: "Pacifico.ttf", variable: false, scripts: ["latin"], category: "script" },
|
|
14061
|
+
{ id: "rubik", family: "Rubik", file: "Rubik.ttf", variable: true, scripts: ["latin", "hebrew"], category: "sans" },
|
|
14062
|
+
{ id: "heebo", family: "Heebo", file: "Heebo.ttf", variable: true, scripts: ["latin", "hebrew"], category: "sans" }
|
|
14063
|
+
];
|
|
14064
|
+
var OVERLAY_FONT_IDS = OVERLAY_FONTS.map((f) => f.id);
|
|
14065
|
+
function overlayFontById(id) {
|
|
14066
|
+
return OVERLAY_FONTS.find((f) => f.id === id);
|
|
14067
|
+
}
|
|
14068
|
+
var hex6 = zod.z.string().regex(/^#[0-9a-fA-F]{6}$/, "Expected a #RRGGBB color");
|
|
14069
|
+
var overlayStrokeSchema = zod.z.object({
|
|
14070
|
+
/** px on the base image */
|
|
14071
|
+
width: zod.z.number().min(0).max(50),
|
|
14072
|
+
color: hex6
|
|
14073
|
+
});
|
|
14074
|
+
var overlayTextStyleSchema = zod.z.object({
|
|
14075
|
+
text: zod.z.string().min(1).max(500),
|
|
14076
|
+
fontId: zod.z.enum(OVERLAY_FONT_IDS).default("inter"),
|
|
14077
|
+
fontWeight: zod.z.number().int().min(100).max(900).default(700),
|
|
14078
|
+
/** % of the BASE height */
|
|
14079
|
+
fontSize: zod.z.number().min(1).max(50).default(8),
|
|
14080
|
+
color: hex6.default("#ffffff"),
|
|
14081
|
+
align: zod.z.enum(OVERLAY_TEXT_ALIGNS).default("center"),
|
|
14082
|
+
/** em */
|
|
14083
|
+
letterSpacing: zod.z.number().min(-0.2).max(1).default(0),
|
|
14084
|
+
lineHeight: zod.z.number().min(0.8).max(2.5).default(1.15),
|
|
14085
|
+
uppercase: zod.z.boolean().default(false),
|
|
14086
|
+
stroke: overlayStrokeSchema.optional(),
|
|
14087
|
+
/** A filled box behind the text — a pill, a badge, a lower third. */
|
|
14088
|
+
background: zod.z.object({
|
|
14089
|
+
color: hex6,
|
|
14090
|
+
opacity: zod.z.number().min(0).max(1).default(1),
|
|
14091
|
+
/** px on the base image */
|
|
14092
|
+
padding: zod.z.number().min(0).max(300).default(24),
|
|
14093
|
+
/** px corner radius; a huge value makes a pill */
|
|
14094
|
+
radius: zod.z.number().min(0).max(1e3).default(0)
|
|
14095
|
+
}).optional()
|
|
14096
|
+
});
|
|
14097
|
+
var overlayQrStyleSchema = zod.z.object({
|
|
14098
|
+
/** The link / text the code opens. May be empty ONLY while `fromInput` is
|
|
14099
|
+
* set — the run then fills it from the node's "QR link" text handle. */
|
|
14100
|
+
text: zod.z.string().max(2e3).default(""),
|
|
14101
|
+
/** Take the payload from the node's QR link handle (a Text node, a List
|
|
14102
|
+
* column, any text output) instead of this style's `text`. */
|
|
14103
|
+
fromInput: zod.z.boolean().optional(),
|
|
14104
|
+
color: hex6.default("#000000"),
|
|
14105
|
+
/** Absent = transparent quiet zone and background. */
|
|
14106
|
+
background: hex6.optional(),
|
|
14107
|
+
/** Quiet-zone modules */
|
|
14108
|
+
margin: zod.z.number().int().min(0).max(8).default(1)
|
|
14109
|
+
});
|
|
14110
|
+
var overlayShapeStyleSchema = zod.z.object({
|
|
14111
|
+
shape: zod.z.enum(OVERLAY_SHAPES).default("rect"),
|
|
14112
|
+
color: hex6.default("#ff0073"),
|
|
14113
|
+
stroke: overlayStrokeSchema.optional()
|
|
14114
|
+
});
|
|
14115
|
+
var overlayImageEffectsSchema = zod.z.object({
|
|
14116
|
+
mask: zod.z.enum(OVERLAY_IMAGE_MASKS).optional(),
|
|
14117
|
+
/** px on the base image — edge fade width */
|
|
14118
|
+
feather: zod.z.number().min(0).max(500).optional(),
|
|
14119
|
+
stroke: overlayStrokeSchema.optional(),
|
|
14120
|
+
glow: zod.z.object({
|
|
14121
|
+
blur: zod.z.number().min(0).max(200),
|
|
14122
|
+
color: hex6,
|
|
14123
|
+
opacity: zod.z.number().min(0).max(1)
|
|
14124
|
+
}).optional()
|
|
14125
|
+
});
|
|
14126
|
+
var DEFAULT_OVERLAY_TEXT = {
|
|
14127
|
+
text: "Your text",
|
|
14128
|
+
fontId: "inter",
|
|
14129
|
+
fontWeight: 700,
|
|
14130
|
+
fontSize: 8,
|
|
14131
|
+
color: "#ffffff",
|
|
14132
|
+
align: "center",
|
|
14133
|
+
letterSpacing: 0,
|
|
14134
|
+
lineHeight: 1.15,
|
|
14135
|
+
uppercase: false
|
|
14136
|
+
};
|
|
14137
|
+
var DEFAULT_OVERLAY_QR = { text: "https://nodaro.ai", color: "#000000", background: "#ffffff", margin: 1 };
|
|
14138
|
+
var DEFAULT_OVERLAY_SHAPE = { shape: "pill", color: "#ff0073" };
|
|
14139
|
+
function isRtlText(text) {
|
|
14140
|
+
return /[--ۿݐ-ݿࢠ-ࣿיִ-﷿ﹰ-]/.test(text);
|
|
14141
|
+
}
|
|
14142
|
+
|
|
13925
14143
|
// src/entity-image-handle.ts
|
|
13926
14144
|
var ENTITY_IMAGE_HANDLE_TYPES = /* @__PURE__ */ new Set([
|
|
13927
14145
|
"character",
|
|
@@ -15257,6 +15475,7 @@ var SCENE3D_V2_LIMITS = {
|
|
|
15257
15475
|
maxIdLength: SCENE3D_LIMITS.maxIdLength,
|
|
15258
15476
|
maxAssetIdLength: 128,
|
|
15259
15477
|
maxNodeIdLength: 128,
|
|
15478
|
+
maxNodeNameLength: 256,
|
|
15260
15479
|
maxNameLength: SCENE3D_LIMITS.maxNameLength,
|
|
15261
15480
|
maxLabelLength: SCENE3D_LIMITS.maxNameLength,
|
|
15262
15481
|
maxMaterialNameLength: 120,
|
|
@@ -15328,6 +15547,7 @@ var SCENE3D_PRIMITIVE_MATERIAL_ROLE = "identity";
|
|
|
15328
15547
|
var SCENE3D_CLAY_LIGHTING_PRESETS = ["clay-studio-v1"];
|
|
15329
15548
|
var scene3DAssetIdSchema = zod.z.string().min(1).max(SCENE3D_V2_LIMITS.maxAssetIdLength).regex(/^[A-Za-z0-9][A-Za-z0-9_.:-]*$/, "assetId must be an opaque id (letters, digits, '_', '-', '.', ':')").refine((value) => !value.includes(".."), "assetId must not contain '..'");
|
|
15330
15549
|
var scene3DNodeIdSchema = zod.z.string().min(1).max(SCENE3D_V2_LIMITS.maxNodeIdLength).regex(/^[A-Za-z0-9][A-Za-z0-9_.:-]*$/, "node id must be an exporter-generated stable id");
|
|
15550
|
+
var scene3DNodeNameSchema = zod.z.string().min(1).max(SCENE3D_V2_LIMITS.maxNodeNameLength).regex(/^[^\u0000-\u001f\u007f]+$/, "node name must not contain control characters");
|
|
15331
15551
|
var scene3DSha256Schema = zod.z.string().regex(/^[0-9a-f]{64}$/, "sha256 must be 64 lowercase hex characters");
|
|
15332
15552
|
var scene3DVersionTokenSchema = zod.z.string().min(1).max(SCENE3D_V2_LIMITS.maxVersionLength).regex(
|
|
15333
15553
|
/^[A-Za-z0-9][A-Za-z0-9_.+-]*$/,
|
|
@@ -15342,6 +15562,7 @@ var scene3DEntityCapabilitySchema = zod.z.enum(["transform", "color", "visibilit
|
|
|
15342
15562
|
var scene3DAnchorSchema = zod.z.object({
|
|
15343
15563
|
name: scene3DAnchorNameSchema,
|
|
15344
15564
|
position: vec3Schema,
|
|
15565
|
+
nodeName: scene3DNodeNameSchema.optional(),
|
|
15345
15566
|
rotation: rotationVec3Schema.optional()
|
|
15346
15567
|
}).strict();
|
|
15347
15568
|
var scene3DMaterialBindingSchema = zod.z.object({
|
|
@@ -15526,6 +15747,12 @@ function checkEntities(plan, byId, issues) {
|
|
|
15526
15747
|
});
|
|
15527
15748
|
const anchorNames = /* @__PURE__ */ new Set();
|
|
15528
15749
|
(entity.anchors ?? []).forEach((anchor, anchorIndex) => {
|
|
15750
|
+
if (anchor.nodeName !== void 0 && entity.visual.kind !== "asset") {
|
|
15751
|
+
issues.push({
|
|
15752
|
+
path: at("anchors", anchorIndex, "nodeName"),
|
|
15753
|
+
message: `entity "${entity.id}" can bind anchor nodes only with an asset visual`
|
|
15754
|
+
});
|
|
15755
|
+
}
|
|
15529
15756
|
if (anchorNames.has(anchor.name)) {
|
|
15530
15757
|
issues.push({
|
|
15531
15758
|
path: at("anchors", anchorIndex, "name"),
|
|
@@ -16274,8 +16501,8 @@ function scene3DCameraTrackIssues(track) {
|
|
|
16274
16501
|
}
|
|
16275
16502
|
const quaternionTolerance = SCENE3D_CAMERA_TRACK_LIMITS.quaternionTolerance;
|
|
16276
16503
|
track.samples.forEach((sample, index) => {
|
|
16277
|
-
const [x, y,
|
|
16278
|
-
const norm = Math.sqrt(x * x + y * y +
|
|
16504
|
+
const [x, y, z25, w] = sample.quaternion;
|
|
16505
|
+
const norm = Math.sqrt(x * x + y * y + z25 * z25 + w * w);
|
|
16279
16506
|
if (Math.abs(norm - 1) > quaternionTolerance) {
|
|
16280
16507
|
issues.push({
|
|
16281
16508
|
path: ["samples", index, "quaternion"],
|
|
@@ -16366,6 +16593,26 @@ function parseScene3DCameraTrackJson(text) {
|
|
|
16366
16593
|
}
|
|
16367
16594
|
return { ok: true, value: parsed.data };
|
|
16368
16595
|
}
|
|
16596
|
+
var scene3DInputAssetSchema = zod.z.object({
|
|
16597
|
+
id: zod.z.string().regex(/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$/),
|
|
16598
|
+
revisionId: zod.z.uuid(),
|
|
16599
|
+
assetId: zod.z.uuid(),
|
|
16600
|
+
label: zod.z.string().min(1).max(64).regex(/^[^\u0000-\u001f]+$/).optional()
|
|
16601
|
+
}).strict();
|
|
16602
|
+
var scene3DInputAssetsSchema = zod.z.array(scene3DInputAssetSchema).max(8).superRefine((values, ctx) => {
|
|
16603
|
+
if (new Set(values.map((value) => value.id)).size !== values.length || new Set(values.map((value) => value.assetId)).size !== values.length) {
|
|
16604
|
+
ctx.addIssue({ code: "custom", message: "Scene input assets must have unique identities" });
|
|
16605
|
+
}
|
|
16606
|
+
});
|
|
16607
|
+
function scene3DInputAssetsForEngine(value, engine) {
|
|
16608
|
+
const assets = scene3DInputAssetsSchema.parse(value ?? []);
|
|
16609
|
+
if (assets.length && engine !== "blender-cloud" && engine !== "blender-local") {
|
|
16610
|
+
throw new Error("Imported 3D assets require an advanced scene engine");
|
|
16611
|
+
}
|
|
16612
|
+
return assets;
|
|
16613
|
+
}
|
|
16614
|
+
|
|
16615
|
+
// src/pro-3d-render.ts
|
|
16369
16616
|
var PRO3D_RENDER_NODE_TYPE = "pro-3d-render";
|
|
16370
16617
|
var PRO3D_RENDER_LABEL = "3D Render Pro";
|
|
16371
16618
|
var PRO3D_RENDER_CREDIT_ID = "pro-3d-render";
|
|
@@ -16468,9 +16715,16 @@ function buildPro3DRenderSource(input) {
|
|
|
16468
16715
|
return { ok: false, message: "no brief \u2014 describe the scene, or wire a prompt in." };
|
|
16469
16716
|
}
|
|
16470
16717
|
const references = input.references ?? [];
|
|
16718
|
+
const parsedAssets = scene3DInputAssetsSchema.safeParse(input.inputAssets ?? []);
|
|
16719
|
+
if (!parsedAssets.success) return { ok: false, message: "invalid scene input assets" };
|
|
16471
16720
|
return {
|
|
16472
16721
|
ok: true,
|
|
16473
|
-
source: {
|
|
16722
|
+
source: {
|
|
16723
|
+
kind: "prompt",
|
|
16724
|
+
prompt,
|
|
16725
|
+
...references.length > 0 ? { references } : {},
|
|
16726
|
+
...parsedAssets.data.length ? { inputAssets: parsedAssets.data } : {}
|
|
16727
|
+
}
|
|
16474
16728
|
};
|
|
16475
16729
|
}
|
|
16476
16730
|
function pro3DRenderTimingOverrides(input) {
|
|
@@ -16663,6 +16917,28 @@ async function applyScene3DV2EditOperations(input, operations, options) {
|
|
|
16663
16917
|
return { ok: true, plan: { ...plan, provenance: { ...plan.provenance, contentHash } }, changeSummary: `Applied ${ops.data.length} scene edit${ops.data.length === 1 ? "" : "s"}` };
|
|
16664
16918
|
}
|
|
16665
16919
|
|
|
16920
|
+
// src/sequence-execution.ts
|
|
16921
|
+
var STUDIO_DEPENDENT_FRAMES_CAPABILITY = "studio-dependent-frames-v1";
|
|
16922
|
+
var SequenceExecutionRequiredError = class extends Error {
|
|
16923
|
+
constructor(nodeIds) {
|
|
16924
|
+
super("Generate linked frames and clips in Studio or through its production API so the reviewed images are used.");
|
|
16925
|
+
this.nodeIds = nodeIds;
|
|
16926
|
+
this.name = "SequenceExecutionRequiredError";
|
|
16927
|
+
}
|
|
16928
|
+
nodeIds;
|
|
16929
|
+
code = "sequence_execution_required";
|
|
16930
|
+
statusCode = 400;
|
|
16931
|
+
};
|
|
16932
|
+
function requiresSequenceExecution(node) {
|
|
16933
|
+
if (!node.data || typeof node.data !== "object" || Array.isArray(node.data)) return false;
|
|
16934
|
+
const data = node.data;
|
|
16935
|
+
return data.keyframeId !== void 0 || data.sequenceBinding !== void 0 || Array.isArray(data.requiredCapabilities) && data.requiredCapabilities.includes(STUDIO_DEPENDENT_FRAMES_CAPABILITY);
|
|
16936
|
+
}
|
|
16937
|
+
function assertCanvasExecutionAllowed(nodes) {
|
|
16938
|
+
const blocked = nodes.filter(requiresSequenceExecution).map((node) => node.id);
|
|
16939
|
+
if (blocked.length) throw new SequenceExecutionRequiredError(blocked);
|
|
16940
|
+
}
|
|
16941
|
+
|
|
16666
16942
|
// src/scene3d-authoring-engine.ts
|
|
16667
16943
|
var SCENE3D_BASIC_ENGINE = "basic";
|
|
16668
16944
|
var SCENE3D_AUTHORING_ENGINES = [SCENE3D_BASIC_ENGINE, ...SCENE3D_V2_ENGINES];
|
|
@@ -16829,6 +17105,9 @@ exports.DEFAULT_CHARACTER_EXPRESSION_COUNT = DEFAULT_CHARACTER_EXPRESSION_COUNT;
|
|
|
16829
17105
|
exports.DEFAULT_CHARACTER_FACET = DEFAULT_CHARACTER_FACET;
|
|
16830
17106
|
exports.DEFAULT_LABEL_BY_SOURCE = DEFAULT_LABEL_BY_SOURCE;
|
|
16831
17107
|
exports.DEFAULT_LOCATION_USAGE_MODE = DEFAULT_LOCATION_USAGE_MODE;
|
|
17108
|
+
exports.DEFAULT_OVERLAY_QR = DEFAULT_OVERLAY_QR;
|
|
17109
|
+
exports.DEFAULT_OVERLAY_SHAPE = DEFAULT_OVERLAY_SHAPE;
|
|
17110
|
+
exports.DEFAULT_OVERLAY_TEXT = DEFAULT_OVERLAY_TEXT;
|
|
16832
17111
|
exports.DEFAULT_PANEL_COUNT = DEFAULT_PANEL_COUNT;
|
|
16833
17112
|
exports.DEFAULT_REF_IMAGE_MAX = DEFAULT_REF_IMAGE_MAX;
|
|
16834
17113
|
exports.DEFAULT_SECTIONS = DEFAULT_SECTIONS;
|
|
@@ -16915,6 +17194,8 @@ exports.IMAGE_EDIT_PROVIDERS = IMAGE_EDIT_PROVIDERS;
|
|
|
16915
17194
|
exports.IMAGE_GEN_PROVIDERS = IMAGE_GEN_PROVIDERS;
|
|
16916
17195
|
exports.IMAGE_I2I_PROVIDERS = IMAGE_I2I_PROVIDERS;
|
|
16917
17196
|
exports.IMAGE_MASK_MODE = IMAGE_MASK_MODE;
|
|
17197
|
+
exports.IMAGE_OVERLAY_BASE_CREDITS = IMAGE_OVERLAY_BASE_CREDITS;
|
|
17198
|
+
exports.IMAGE_OVERLAY_VARIANT_CREDITS = IMAGE_OVERLAY_VARIANT_CREDITS;
|
|
16918
17199
|
exports.IMAGE_PROMPT_MAX = IMAGE_PROMPT_MAX;
|
|
16919
17200
|
exports.IMAGE_REF_TYPES = IMAGE_REF_TYPES;
|
|
16920
17201
|
exports.IMAGE_TO_VIDEO_PROVIDERS = IMAGE_TO_VIDEO_PROVIDERS;
|
|
@@ -17005,6 +17286,16 @@ exports.ORG_ROLES = ORG_ROLES;
|
|
|
17005
17286
|
exports.ORG_STATUSES = ORG_STATUSES;
|
|
17006
17287
|
exports.OUTPUT_FIELD_MAP = OUTPUT_FIELD_MAP;
|
|
17007
17288
|
exports.OUTPUT_FORMATS = OUTPUT_FORMATS;
|
|
17289
|
+
exports.OVERLAY_FONTS = OVERLAY_FONTS;
|
|
17290
|
+
exports.OVERLAY_FONT_IDS = OVERLAY_FONT_IDS;
|
|
17291
|
+
exports.OVERLAY_IMAGE_MASKS = OVERLAY_IMAGE_MASKS;
|
|
17292
|
+
exports.OVERLAY_LAYER_KINDS = OVERLAY_LAYER_KINDS;
|
|
17293
|
+
exports.OVERLAY_MAX_VARIANTS = OVERLAY_MAX_VARIANTS;
|
|
17294
|
+
exports.OVERLAY_PLATFORMS = OVERLAY_PLATFORMS;
|
|
17295
|
+
exports.OVERLAY_PLATFORM_IDS = OVERLAY_PLATFORM_IDS;
|
|
17296
|
+
exports.OVERLAY_SHAPES = OVERLAY_SHAPES;
|
|
17297
|
+
exports.OVERLAY_TEXT_ALIGNS = OVERLAY_TEXT_ALIGNS;
|
|
17298
|
+
exports.OVERLAY_VARIANT_HANDLE_PREFIX = OVERLAY_VARIANT_HANDLE_PREFIX;
|
|
17008
17299
|
exports.ObjectMetadataSchema = ObjectMetadataSchema;
|
|
17009
17300
|
exports.OptimizeForModelInputSchema = OptimizeForModelInputSchema;
|
|
17010
17301
|
exports.OptimizeForModelResultSchema = OptimizeForModelResultSchema;
|
|
@@ -17155,6 +17446,7 @@ exports.STAGE_PATCH_SCHEMA = STAGE_PATCH_SCHEMA;
|
|
|
17155
17446
|
exports.STATIC_CAPTION_STYLES = STATIC_CAPTION_STYLES;
|
|
17156
17447
|
exports.STRUCTURAL_SECTIONS = STRUCTURAL_SECTIONS;
|
|
17157
17448
|
exports.STRUCTURED_VISION_MODELS = STRUCTURED_VISION_MODELS;
|
|
17449
|
+
exports.STUDIO_DEPENDENT_FRAMES_CAPABILITY = STUDIO_DEPENDENT_FRAMES_CAPABILITY;
|
|
17158
17450
|
exports.STUDIO_SHOT_TRANSIENT_KEYS = STUDIO_SHOT_TRANSIENT_KEYS;
|
|
17159
17451
|
exports.STUDIO_TRANSIENT_KEYS = STUDIO_TRANSIENT_KEYS;
|
|
17160
17452
|
exports.SUBMISSION_STATUSES = SUBMISSION_STATUSES;
|
|
@@ -17177,6 +17469,7 @@ exports.SceneMetadataSchema = SceneMetadataSchema;
|
|
|
17177
17469
|
exports.SceneNodeDataSchema = SceneNodeDataSchema;
|
|
17178
17470
|
exports.SceneSpecSchema = SceneSpecSchema;
|
|
17179
17471
|
exports.ScriptCriticVerdictSchema = ScriptCriticVerdictSchema;
|
|
17472
|
+
exports.SequenceExecutionRequiredError = SequenceExecutionRequiredError;
|
|
17180
17473
|
exports.ShotSpecSchema = ShotSpecSchema;
|
|
17181
17474
|
exports.ShowrunnerPlanSchema = ShowrunnerPlanSchema;
|
|
17182
17475
|
exports.StageAwaitingSubGateEventSchema = StageAwaitingSubGateEventSchema;
|
|
@@ -17291,6 +17584,7 @@ exports.aspectRatioFromDims = aspectRatioFromDims;
|
|
|
17291
17584
|
exports.aspectRatioOptionsByKind = aspectRatioOptionsByKind;
|
|
17292
17585
|
exports.aspectRatioToNumber = aspectRatioToNumber;
|
|
17293
17586
|
exports.assembleNarratedVideoCredits = assembleNarratedVideoCredits;
|
|
17587
|
+
exports.assertCanvasExecutionAllowed = assertCanvasExecutionAllowed;
|
|
17294
17588
|
exports.availableReasoningEfforts = availableReasoningEfforts;
|
|
17295
17589
|
exports.bucketSecondsFromAuditCreditId = bucketSecondsFromAuditCreditId;
|
|
17296
17590
|
exports.bucketSecondsFromCreditId = bucketSecondsFromCreditId;
|
|
@@ -17447,6 +17741,8 @@ exports.hexToRgbaArray = hexToRgbaArray;
|
|
|
17447
17741
|
exports.humanizeSlotSid = humanizeSlotSid;
|
|
17448
17742
|
exports.imageMentionSlug = imageMentionSlug;
|
|
17449
17743
|
exports.imageMentionSlugForRef = imageMentionSlugForRef;
|
|
17744
|
+
exports.imageOverlayBillableVariants = imageOverlayBillableVariants;
|
|
17745
|
+
exports.imageOverlayCredits = imageOverlayCredits;
|
|
17450
17746
|
exports.imageReferenceLimit = imageReferenceLimit;
|
|
17451
17747
|
exports.inferMusicVideo = inferMusicVideo;
|
|
17452
17748
|
exports.isAggregateableType = isAggregateableType;
|
|
@@ -17469,6 +17765,7 @@ exports.isPerSecondLipSyncProvider = isPerSecondLipSyncProvider;
|
|
|
17469
17765
|
exports.isPro3DRenderJobOutput = isPro3DRenderJobOutput;
|
|
17470
17766
|
exports.isPro3DRenderQuote = isPro3DRenderQuote;
|
|
17471
17767
|
exports.isPro3DRenderRenderOnly = isPro3DRenderRenderOnly;
|
|
17768
|
+
exports.isRtlText = isRtlText;
|
|
17472
17769
|
exports.isScene3DAuthoringEngine = isScene3DAuthoringEngine;
|
|
17473
17770
|
exports.isScene3DCameraTrack = isScene3DCameraTrack;
|
|
17474
17771
|
exports.isScene3DHttpUrl = isScene3DHttpUrl;
|
|
@@ -17520,6 +17817,16 @@ exports.normalizeRoleSlug = normalizeRoleSlug;
|
|
|
17520
17817
|
exports.normalizeVideoRequestParams = normalizeVideoRequestParams;
|
|
17521
17818
|
exports.normalizeWan3Resolution = normalizeWan3Resolution;
|
|
17522
17819
|
exports.orderedLlmModels = orderedLlmModels;
|
|
17820
|
+
exports.overlayFontById = overlayFontById;
|
|
17821
|
+
exports.overlayImageEffectsSchema = overlayImageEffectsSchema;
|
|
17822
|
+
exports.overlayPlatformById = overlayPlatformById;
|
|
17823
|
+
exports.overlayQrStyleSchema = overlayQrStyleSchema;
|
|
17824
|
+
exports.overlayShapeElement = overlayShapeElement;
|
|
17825
|
+
exports.overlayShapeStyleSchema = overlayShapeStyleSchema;
|
|
17826
|
+
exports.overlayStrokeSchema = overlayStrokeSchema;
|
|
17827
|
+
exports.overlayTextStyleSchema = overlayTextStyleSchema;
|
|
17828
|
+
exports.overlayVariantHandle = overlayVariantHandle;
|
|
17829
|
+
exports.overlayVariantIdFromHandle = overlayVariantIdFromHandle;
|
|
17523
17830
|
exports.parseAttributedDialogue = parseAttributedDialogue;
|
|
17524
17831
|
exports.parseCharacterMentionToken = parseCharacterMentionToken;
|
|
17525
17832
|
exports.parseEntityMentionToken = parseEntityMentionToken;
|
|
@@ -17558,6 +17865,7 @@ exports.referenceSheetCreditId = referenceSheetCreditId;
|
|
|
17558
17865
|
exports.registerCatalogSidecars = registerCatalogSidecars;
|
|
17559
17866
|
exports.registerSidecarLoaders = registerSidecarLoaders;
|
|
17560
17867
|
exports.renderAnalyzedScene = renderAnalyzedScene;
|
|
17868
|
+
exports.requiresSequenceExecution = requiresSequenceExecution;
|
|
17561
17869
|
exports.resetCatalogSidecars = resetCatalogSidecars;
|
|
17562
17870
|
exports.resolutionOptionsByKind = resolutionOptionsByKind;
|
|
17563
17871
|
exports.resolveAiAvatarCreditId = resolveAiAvatarCreditId;
|
|
@@ -17637,6 +17945,9 @@ exports.scene3DEntityCapabilitySchema = scene3DEntityCapabilitySchema;
|
|
|
17637
17945
|
exports.scene3DEntityV2Schema = scene3DEntityV2Schema;
|
|
17638
17946
|
exports.scene3DEntityVisualSchema = scene3DEntityVisualSchema;
|
|
17639
17947
|
exports.scene3DIdSchema = scene3DIdSchema;
|
|
17948
|
+
exports.scene3DInputAssetSchema = scene3DInputAssetSchema;
|
|
17949
|
+
exports.scene3DInputAssetsForEngine = scene3DInputAssetsForEngine;
|
|
17950
|
+
exports.scene3DInputAssetsSchema = scene3DInputAssetsSchema;
|
|
17640
17951
|
exports.scene3DJsonByteLength = scene3DJsonByteLength;
|
|
17641
17952
|
exports.scene3DLightingChangesSchema = scene3DLightingChangesSchema;
|
|
17642
17953
|
exports.scene3DLightingSchema = scene3DLightingSchema;
|
|
@@ -17644,6 +17955,7 @@ exports.scene3DMaterialBindingSchema = scene3DMaterialBindingSchema;
|
|
|
17644
17955
|
exports.scene3DMaterialNameSchema = scene3DMaterialNameSchema;
|
|
17645
17956
|
exports.scene3DMaterialRoleSchema = scene3DMaterialRoleSchema;
|
|
17646
17957
|
exports.scene3DNodeIdSchema = scene3DNodeIdSchema;
|
|
17958
|
+
exports.scene3DNodeNameSchema = scene3DNodeNameSchema;
|
|
17647
17959
|
exports.scene3DObjectChangesSchema = scene3DObjectChangesSchema;
|
|
17648
17960
|
exports.scene3DObjectKeyframeSchema = scene3DObjectKeyframeSchema;
|
|
17649
17961
|
exports.scene3DObjectSchema = scene3DObjectSchema;
|