@riverbankcms/sdk 0.70.2 → 0.70.4
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/README.md +29 -0
- package/dist/_dts/api/src/contentTypes.d.ts +2 -1
- package/dist/_dts/block-form/src/client/index.d.ts +1 -1
- package/dist/_dts/block-form/src/fields/types.d.ts +14 -2
- package/dist/_dts/block-form/src/registry/schemas.d.ts +2 -0
- package/dist/_dts/block-form/src/widgets/MediaField/mediaFieldDefaults.d.ts +2 -2
- package/dist/_dts/block-form/src/widgets/MediaField/mediaFieldSchema.d.ts +2 -2
- package/dist/_dts/blocks/src/lib/media.d.ts +1 -1
- package/dist/_dts/blocks/src/system/blocks/appointment-booking.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/blog-listing.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/cart.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/checkout.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/collection.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/cta-full.d.ts +1 -30727
- package/dist/_dts/blocks/src/system/blocks/events/event-spotlight.d.ts +11 -30827
- package/dist/_dts/blocks/src/system/blocks/faq.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/file-download.d.ts +3 -3
- package/dist/_dts/blocks/src/system/blocks/gifting.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/media-text.d.ts +106 -1
- package/dist/_dts/blocks/src/system/blocks/product-detail.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/product-list.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/shop.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/defineBlock.d.ts +3 -3
- package/dist/_dts/blocks/src/system/fragments/library/card.d.ts +2 -30793
- package/dist/_dts/blocks/src/system/fragments/library/ctaRow.d.ts +2 -30727
- package/dist/_dts/blocks/src/system/fragments/library/feedbackCallout.d.ts +2 -30779
- package/dist/_dts/blocks/src/system/fragments/library/heroCtaRow.d.ts +33 -30743
- package/dist/_dts/blocks/src/system/fragments/library/sectionState.d.ts +2 -30770
- package/dist/_dts/blocks/src/system/fragments/types.d.ts +8 -7
- package/dist/_dts/blocks/src/system/manifest/derivedContent.d.ts +7 -5
- package/dist/_dts/blocks/src/system/manifest/fieldValidation/index.d.ts +1 -1
- package/dist/_dts/blocks/src/system/manifest/schema.d.ts +192 -3
- package/dist/_dts/blocks/src/system/runtime/nodes/file-download.d.ts +1 -1
- package/dist/_dts/content-model/src/content-types/schema.d.ts +7 -0
- package/dist/_dts/content-model/src/contentManifest.d.ts +4 -1
- package/dist/_dts/content-model/src/templates/bindingTypeCompatibility.d.ts +1 -1
- package/dist/_dts/core/src/index.d.ts +1 -1
- package/dist/_dts/core/src/planner.d.ts +4 -0
- package/dist/_dts/db/src/generated/supabase/database.types.d.ts +53 -20
- package/dist/_dts/editor-blocks/src/index.d.ts +1 -1
- package/dist/_dts/editor-blocks/src/media/MediaField.d.ts +6 -5
- package/dist/_dts/media-core/src/videoSlotPolicy.d.ts +0 -1
- package/dist/_dts/media-editor/src/context.d.ts +4 -1
- package/dist/_dts/media-react/src/hooks/useApiMediaUploader.d.ts +8 -1
- package/dist/_dts/media-react/src/index.d.ts +1 -5
- package/dist/_dts/preview-next/src/client/widgets/PreviewMediaField.d.ts +2 -1
- package/dist/_dts/preview-next/src/client/widgets/widgetOverrides.d.ts +1 -0
- package/dist/_dts/sdk/src/cli/commands/delete.d.ts +3 -0
- package/dist/_dts/sdk/src/cli/commands/style.d.ts +18 -0
- package/dist/_dts/sdk/src/cli/helpers.d.ts +8 -33
- package/dist/_dts/sdk/src/cli/site-commands/oneOffCommands.d.ts +81 -0
- package/dist/_dts/sdk/src/components.d.ts +2 -1
- package/dist/_dts/sdk/src/config/field-definitions.d.ts +6 -2
- package/dist/_dts/sdk/src/config/typed-entries.d.ts +4 -2
- package/dist/_dts/sdk/src/contracts/system-block-content.d.ts +2 -1
- package/dist/_dts/sdk/src/manifest/prompt/examples/cta.d.ts +5 -5
- package/dist/_dts/sdk/src/manifest/prompt/examples/features-grid.d.ts +2 -2
- package/dist/_dts/sdk/src/manifest/prompt/examples/hero.d.ts +2 -2
- package/dist/_dts/sdk/src/manifest/prompt/examples/pricing.d.ts +10 -10
- package/dist/_dts/sdk/src/manifest/prompt/examples/testimonials.d.ts +4 -4
- package/dist/_dts/sdk/src/manifest/validation/output-schema.d.ts +11 -1
- package/dist/_dts/sdk/src/next/types.d.ts +4 -2
- package/dist/_dts/sdk/src/public-api/contracts.d.ts +2 -1
- package/dist/_dts/sdk/src/rendering/index.d.ts +2 -1
- package/dist/_dts/sdk/src/rendering/overrideResolution.d.ts +10 -0
- package/dist/_dts/sdk/src/rendering/overrides.d.ts +12 -0
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/cli/index.mjs +1072 -289
- package/dist/cli/init-docs/content/workflow-preview-mode.md +167 -0
- package/dist/client/client.mjs +443 -403
- package/dist/client/hooks.mjs +172 -121
- package/dist/client/rendering/client.mjs +148 -112
- package/dist/client/rendering/islands.mjs +80 -31
- package/dist/client/rendering.mjs +25531 -25481
- package/dist/preview-next/client/runtime.mjs +394 -1136
- package/dist/server/components.mjs +229 -171
- package/dist/server/config-template-validation.mjs +31 -1
- package/dist/server/config-validation.mjs +172 -121
- package/dist/server/config.mjs +172 -121
- package/dist/server/data.mjs +172 -121
- package/dist/server/index.mjs +1 -1
- package/dist/server/next.mjs +301 -174
- package/dist/server/page-converter.mjs +379 -185
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering/server.mjs +219 -171
- package/dist/server/rendering.mjs +229 -171
- package/dist/server/routing.mjs +175 -124
- package/dist/server/server.mjs +173 -122
- package/package.json +5 -3
|
@@ -16,10 +16,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
16
16
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
17
17
|
var __getProtoOf = Object.getPrototypeOf;
|
|
18
18
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
19
|
-
var __typeError = (msg) => {
|
|
20
|
-
throw TypeError(msg);
|
|
21
|
-
};
|
|
22
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
23
19
|
var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
|
|
24
20
|
get: (a2, b3) => (typeof require !== "undefined" ? require : a2)[b3]
|
|
25
21
|
}) : x2)(function(x2) {
|
|
@@ -52,11 +48,6 @@ var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__
|
|
|
52
48
|
!mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
|
|
53
49
|
mod2
|
|
54
50
|
));
|
|
55
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
56
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
57
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
58
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
59
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
60
51
|
|
|
61
52
|
// ../preview-next/src/auth-contract.ts
|
|
62
53
|
function resolvePreviewRuntimeSession(input) {
|
|
@@ -21150,7 +21141,7 @@ var init_file_x = __esm({
|
|
|
21150
21141
|
});
|
|
21151
21142
|
|
|
21152
21143
|
// ../../node_modules/.pnpm/lucide-react@0.563.0_react@19.2.4/node_modules/lucide-react/dist/esm/icons/file.js
|
|
21153
|
-
var __iconNode638,
|
|
21144
|
+
var __iconNode638, File;
|
|
21154
21145
|
var init_file = __esm({
|
|
21155
21146
|
"../../node_modules/.pnpm/lucide-react@0.563.0_react@19.2.4/node_modules/lucide-react/dist/esm/icons/file.js"() {
|
|
21156
21147
|
init_createLucideIcon();
|
|
@@ -21164,7 +21155,7 @@ var init_file = __esm({
|
|
|
21164
21155
|
],
|
|
21165
21156
|
["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
|
|
21166
21157
|
];
|
|
21167
|
-
|
|
21158
|
+
File = createLucideIcon("file", __iconNode638);
|
|
21168
21159
|
}
|
|
21169
21160
|
});
|
|
21170
21161
|
|
|
@@ -40359,7 +40350,7 @@ __export(icons_exports, {
|
|
|
40359
40350
|
Fence: () => Fence,
|
|
40360
40351
|
FerrisWheel: () => FerrisWheel,
|
|
40361
40352
|
Figma: () => Figma,
|
|
40362
|
-
File: () =>
|
|
40353
|
+
File: () => File,
|
|
40363
40354
|
FileArchive: () => FileArchive,
|
|
40364
40355
|
FileAxis3d: () => FileAxis3d,
|
|
40365
40356
|
FileBadge: () => FileBadge,
|
|
@@ -44451,7 +44442,7 @@ __export(lucide_react_exports, {
|
|
|
44451
44442
|
FerrisWheelIcon: () => FerrisWheel,
|
|
44452
44443
|
Figma: () => Figma,
|
|
44453
44444
|
FigmaIcon: () => Figma,
|
|
44454
|
-
File: () =>
|
|
44445
|
+
File: () => File,
|
|
44455
44446
|
FileArchive: () => FileArchive,
|
|
44456
44447
|
FileArchiveIcon: () => FileArchive,
|
|
44457
44448
|
FileAudio: () => FileHeadphone,
|
|
@@ -44516,7 +44507,7 @@ __export(lucide_react_exports, {
|
|
|
44516
44507
|
FileHeadphoneIcon: () => FileHeadphone,
|
|
44517
44508
|
FileHeart: () => FileHeart,
|
|
44518
44509
|
FileHeartIcon: () => FileHeart,
|
|
44519
|
-
FileIcon: () =>
|
|
44510
|
+
FileIcon: () => File,
|
|
44520
44511
|
FileImage: () => FileImage,
|
|
44521
44512
|
FileImageIcon: () => FileImage,
|
|
44522
44513
|
FileInput: () => FileInput,
|
|
@@ -45927,7 +45918,7 @@ __export(lucide_react_exports, {
|
|
|
45927
45918
|
LucideFence: () => Fence,
|
|
45928
45919
|
LucideFerrisWheel: () => FerrisWheel,
|
|
45929
45920
|
LucideFigma: () => Figma,
|
|
45930
|
-
LucideFile: () =>
|
|
45921
|
+
LucideFile: () => File,
|
|
45931
45922
|
LucideFileArchive: () => FileArchive,
|
|
45932
45923
|
LucideFileAudio: () => FileHeadphone,
|
|
45933
45924
|
LucideFileAudio2: () => FileHeadphone,
|
|
@@ -94137,7 +94128,7 @@ function InternalTabPanel(props2) {
|
|
|
94137
94128
|
searchQuery,
|
|
94138
94129
|
selectedRouteId,
|
|
94139
94130
|
selectedItem,
|
|
94140
|
-
errorMessage
|
|
94131
|
+
errorMessage,
|
|
94141
94132
|
onSearchChange,
|
|
94142
94133
|
onSelectRouteId
|
|
94143
94134
|
} = props2;
|
|
@@ -94184,7 +94175,7 @@ function InternalTabPanel(props2) {
|
|
|
94184
94175
|
},
|
|
94185
94176
|
item.routeId
|
|
94186
94177
|
);
|
|
94187
|
-
}) : /* @__PURE__ */ jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: loadingItems ? "Loading\u2026" :
|
|
94178
|
+
}) : /* @__PURE__ */ jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: loadingItems ? "Loading\u2026" : errorMessage ?? "No routable content yet" }) }),
|
|
94188
94179
|
selectedItem ? /* @__PURE__ */ jsxs("div", { className: "rounded-md border border-border bg-muted/30 px-3 py-2 text-sm", children: [
|
|
94189
94180
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
|
|
94190
94181
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
@@ -94205,7 +94196,7 @@ function InternalTabPanel(props2) {
|
|
|
94205
94196
|
] }),
|
|
94206
94197
|
/* @__PURE__ */ jsx("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: selectedItem.path })
|
|
94207
94198
|
] }) : null,
|
|
94208
|
-
|
|
94199
|
+
errorMessage ? /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: errorMessage }) : null
|
|
94209
94200
|
] });
|
|
94210
94201
|
}
|
|
94211
94202
|
function UrlTabPanel({
|
|
@@ -94236,7 +94227,7 @@ function LinkPopover({ editor, tone = "dark", initialItems, loadItems }) {
|
|
|
94236
94227
|
const [open, setOpen] = useState(false);
|
|
94237
94228
|
const [items, setItems] = useState(initialItems ?? []);
|
|
94238
94229
|
const [loadingItems, setLoadingItems] = useState(false);
|
|
94239
|
-
const [
|
|
94230
|
+
const [errorMessage, setErrorMessage] = useState(null);
|
|
94240
94231
|
const [tab, setTab] = useState("external");
|
|
94241
94232
|
const [searchQuery, setSearchQuery] = useState("");
|
|
94242
94233
|
const [externalUrlValue, setExternalUrlValue] = useState("");
|
|
@@ -94351,7 +94342,7 @@ function LinkPopover({ editor, tone = "dark", initialItems, loadItems }) {
|
|
|
94351
94342
|
searchQuery,
|
|
94352
94343
|
selectedRouteId,
|
|
94353
94344
|
selectedItem,
|
|
94354
|
-
errorMessage
|
|
94345
|
+
errorMessage,
|
|
94355
94346
|
onSearchChange: setSearchQuery,
|
|
94356
94347
|
onSelectRouteId: setSelectedRouteId
|
|
94357
94348
|
}
|
|
@@ -94542,6 +94533,13 @@ function RichTextToolbar({
|
|
|
94542
94533
|
}
|
|
94543
94534
|
return toolbarEl;
|
|
94544
94535
|
}
|
|
94536
|
+
function shouldHandleRichTextActivationKey(container, target) {
|
|
94537
|
+
if (!(target instanceof HTMLElement)) return true;
|
|
94538
|
+
if (target === container) return true;
|
|
94539
|
+
return !target.closest(
|
|
94540
|
+
'[contenteditable="true"], .ProseMirror, input, textarea, select, button, a[href]'
|
|
94541
|
+
);
|
|
94542
|
+
}
|
|
94545
94543
|
function RichTextEditorSurface({
|
|
94546
94544
|
editor,
|
|
94547
94545
|
config,
|
|
@@ -94565,7 +94563,7 @@ function RichTextEditorSurface({
|
|
|
94565
94563
|
role: "button",
|
|
94566
94564
|
tabIndex: 0,
|
|
94567
94565
|
onKeyDown: (event) => {
|
|
94568
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
94566
|
+
if ((event.key === "Enter" || event.key === " ") && shouldHandleRichTextActivationKey(event.currentTarget, event.target)) {
|
|
94569
94567
|
event.preventDefault();
|
|
94570
94568
|
onClick();
|
|
94571
94569
|
}
|
|
@@ -97693,7 +97691,13 @@ function toFieldDefinition(field, context = {}) {
|
|
|
97693
97691
|
return {
|
|
97694
97692
|
...base2,
|
|
97695
97693
|
type: "media",
|
|
97696
|
-
mediaKinds: field.mediaKinds
|
|
97694
|
+
mediaKinds: normalizeDisplayMediaKinds(field.mediaKinds)
|
|
97695
|
+
};
|
|
97696
|
+
case "file":
|
|
97697
|
+
return {
|
|
97698
|
+
...base2,
|
|
97699
|
+
type: "file",
|
|
97700
|
+
fileKinds: field.fileKinds && field.fileKinds.length ? field.fileKinds : ["document", "spreadsheet", "archive", "audio"]
|
|
97697
97701
|
};
|
|
97698
97702
|
case "boolean":
|
|
97699
97703
|
return {
|
|
@@ -97796,6 +97800,13 @@ function toFieldDefinition(field, context = {}) {
|
|
|
97796
97800
|
return null;
|
|
97797
97801
|
}
|
|
97798
97802
|
}
|
|
97803
|
+
function normalizeDisplayMediaKinds(mediaKinds) {
|
|
97804
|
+
const displayKinds = (mediaKinds ?? []).filter(isDisplayMediaKind);
|
|
97805
|
+
return displayKinds.length > 0 ? displayKinds : ["image"];
|
|
97806
|
+
}
|
|
97807
|
+
function isDisplayMediaKind(value) {
|
|
97808
|
+
return DISPLAY_MEDIA_KINDS.includes(value);
|
|
97809
|
+
}
|
|
97799
97810
|
function startCase(value) {
|
|
97800
97811
|
return value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[-_]/g, " ").replace(/\s+/g, " ").replace(/^./, (match2) => match2.toUpperCase());
|
|
97801
97812
|
}
|
|
@@ -97883,7 +97894,7 @@ function normalizeFieldUi(value) {
|
|
|
97883
97894
|
}
|
|
97884
97895
|
return value;
|
|
97885
97896
|
}
|
|
97886
|
-
var DEFAULT_BUTTON_VARIANTS;
|
|
97897
|
+
var DEFAULT_BUTTON_VARIANTS, DISPLAY_MEDIA_KINDS;
|
|
97887
97898
|
var init_contentManifest = __esm({
|
|
97888
97899
|
"../content-model/src/contentManifest.ts"() {
|
|
97889
97900
|
init_referenceFields();
|
|
@@ -97893,6 +97904,7 @@ var init_contentManifest = __esm({
|
|
|
97893
97904
|
{ value: "secondary", label: "Secondary" },
|
|
97894
97905
|
{ value: "outline", label: "Outline" }
|
|
97895
97906
|
];
|
|
97907
|
+
DISPLAY_MEDIA_KINDS = ["image", "video", "audio"];
|
|
97896
97908
|
}
|
|
97897
97909
|
});
|
|
97898
97910
|
|
|
@@ -98365,7 +98377,7 @@ var init_shared2 = __esm({
|
|
|
98365
98377
|
init_metadataConfig();
|
|
98366
98378
|
}
|
|
98367
98379
|
});
|
|
98368
|
-
var contentFieldTypes, BaseContentFieldSchema, ContentFieldSchema, RoutingSchema, LabelsSchema;
|
|
98380
|
+
var contentFieldTypes, FILE_FIELD_KINDS, LEGACY_MEDIA_KINDS, BaseContentFieldSchema, ContentFieldSchema, RoutingSchema, LabelsSchema;
|
|
98369
98381
|
var init_schema = __esm({
|
|
98370
98382
|
"../content-model/src/content-types/schema.ts"() {
|
|
98371
98383
|
init_referenceFields();
|
|
@@ -98378,6 +98390,7 @@ var init_schema = __esm({
|
|
|
98378
98390
|
"date",
|
|
98379
98391
|
"url",
|
|
98380
98392
|
"media",
|
|
98393
|
+
"file",
|
|
98381
98394
|
"boolean",
|
|
98382
98395
|
"select",
|
|
98383
98396
|
"reference",
|
|
@@ -98387,6 +98400,15 @@ var init_schema = __esm({
|
|
|
98387
98400
|
"repeater",
|
|
98388
98401
|
"datetime"
|
|
98389
98402
|
];
|
|
98403
|
+
FILE_FIELD_KINDS = ["document", "spreadsheet", "archive", "audio"];
|
|
98404
|
+
LEGACY_MEDIA_KINDS = [
|
|
98405
|
+
"image",
|
|
98406
|
+
"video",
|
|
98407
|
+
"audio",
|
|
98408
|
+
"document",
|
|
98409
|
+
"spreadsheet",
|
|
98410
|
+
"archive"
|
|
98411
|
+
];
|
|
98390
98412
|
BaseContentFieldSchema = z.object({
|
|
98391
98413
|
id: z.string(),
|
|
98392
98414
|
type: z.enum(contentFieldTypes),
|
|
@@ -98404,7 +98426,9 @@ var init_schema = __esm({
|
|
|
98404
98426
|
max: z.number().optional(),
|
|
98405
98427
|
step: z.number().positive().optional(),
|
|
98406
98428
|
// Media field options
|
|
98407
|
-
mediaKinds: z.array(z.enum(
|
|
98429
|
+
mediaKinds: z.array(z.enum(LEGACY_MEDIA_KINDS)).optional(),
|
|
98430
|
+
// File field options
|
|
98431
|
+
fileKinds: z.array(z.enum(FILE_FIELD_KINDS)).optional(),
|
|
98408
98432
|
// URL field options
|
|
98409
98433
|
allowRelative: z.boolean().optional(),
|
|
98410
98434
|
// Select field options
|
|
@@ -99803,36 +99827,9 @@ function deriveVideoPrepPolicy(intent) {
|
|
|
99803
99827
|
};
|
|
99804
99828
|
}
|
|
99805
99829
|
}
|
|
99806
|
-
function validateVideoPrepSource(source, policy) {
|
|
99807
|
-
if (!Number.isFinite(source.byteSize) || source.byteSize <= 0) {
|
|
99808
|
-
return err({ tag: "invalid-byte-size", byteSize: source.byteSize });
|
|
99809
|
-
}
|
|
99810
|
-
if (source.byteSize > policy.maxRawByteCount) {
|
|
99811
|
-
return err({
|
|
99812
|
-
tag: "raw-file-too-large",
|
|
99813
|
-
actualBytes: source.byteSize,
|
|
99814
|
-
maxBytes: policy.maxRawByteCount
|
|
99815
|
-
});
|
|
99816
|
-
}
|
|
99817
|
-
if (!Number.isFinite(source.durationSeconds) || source.durationSeconds <= 0) {
|
|
99818
|
-
return err({ tag: "invalid-duration", durationSeconds: source.durationSeconds });
|
|
99819
|
-
}
|
|
99820
|
-
if (policy.maxDurationSeconds !== void 0 && source.durationSeconds > policy.maxDurationSeconds) {
|
|
99821
|
-
return err({
|
|
99822
|
-
tag: "duration-too-long",
|
|
99823
|
-
actualSeconds: source.durationSeconds,
|
|
99824
|
-
maxSeconds: policy.maxDurationSeconds
|
|
99825
|
-
});
|
|
99826
|
-
}
|
|
99827
|
-
if (!Number.isFinite(source.width) || !Number.isFinite(source.height) || source.width <= 0 || source.height <= 0) {
|
|
99828
|
-
return err({ tag: "invalid-dimensions", width: source.width, height: source.height });
|
|
99829
|
-
}
|
|
99830
|
-
return ok(void 0);
|
|
99831
|
-
}
|
|
99832
99830
|
var VIDEO_PREP_LIMITS;
|
|
99833
99831
|
var init_videoPrep = __esm({
|
|
99834
99832
|
"../media-core/src/videoPrep.ts"() {
|
|
99835
|
-
init_src3();
|
|
99836
99833
|
VIDEO_PREP_LIMITS = {
|
|
99837
99834
|
maxRawByteCount: 500 * 1024 * 1024,
|
|
99838
99835
|
inlineContentMaxDurationSeconds: 60,
|
|
@@ -99845,7 +99842,8 @@ var init_videoPrep = __esm({
|
|
|
99845
99842
|
// ../media-core/src/videoSlotPolicy.ts
|
|
99846
99843
|
function deriveVideoSlotPolicy(intent) {
|
|
99847
99844
|
if (intent === void 0) return void 0;
|
|
99848
|
-
if (intent.tag !== "inline-content" && intent.tag !== "background-video")
|
|
99845
|
+
if (intent.tag !== "inline-content" && intent.tag !== "background-video")
|
|
99846
|
+
return void 0;
|
|
99849
99847
|
const prepPolicy = deriveVideoPrepPolicy(intent);
|
|
99850
99848
|
if (prepPolicy.maxDurationSeconds === void 0) return void 0;
|
|
99851
99849
|
return {
|
|
@@ -100797,6 +100795,9 @@ var init_repeaterGrid = __esm({
|
|
|
100797
100795
|
MAX_COLUMNS = 4;
|
|
100798
100796
|
}
|
|
100799
100797
|
});
|
|
100798
|
+
function isDisplayMediaKind2(kind) {
|
|
100799
|
+
return DISPLAY_MEDIA_KINDS2.includes(kind);
|
|
100800
|
+
}
|
|
100800
100801
|
function assertNeverSelectSource(value) {
|
|
100801
100802
|
throw new Error(`Unhandled select source: ${JSON.stringify(value)}`);
|
|
100802
100803
|
}
|
|
@@ -100808,6 +100809,7 @@ function getFieldSchemaInternal() {
|
|
|
100808
100809
|
textFieldSchema,
|
|
100809
100810
|
richTextFieldSchema,
|
|
100810
100811
|
mediaFieldSchema,
|
|
100812
|
+
fileFieldSchema,
|
|
100811
100813
|
booleanFieldSchema,
|
|
100812
100814
|
numberFieldSchema,
|
|
100813
100815
|
dateFieldSchema,
|
|
@@ -100874,13 +100876,32 @@ function createSdkSelectField(input) {
|
|
|
100874
100876
|
})
|
|
100875
100877
|
);
|
|
100876
100878
|
}
|
|
100877
|
-
var visibilityLevels, siteOptionSources, mediaDeliverySchema, selectOptionSchema, selectSourceSchema, uiSchema, baseFieldSchema, textFieldSchema, richTextFieldSchema, mediaFieldSchema, booleanFieldSchema, dateFieldSchema, timeFieldSchema, dateTimeFieldSchema, slugFieldSchema, urlFieldSchema, linkFieldSchema, selectFieldSchema, referenceFieldSchema, itemTypeSchema, repeaterFieldSchema, groupFieldSchema, modalFieldSchema, numberFieldSchema, tabDefinitionSchema, tabGroupFieldSchema, presetOptionSchema, presetOrCustomFieldSchema, contentTypeSelectFieldSchema, entryPickerFieldSchema, _fieldSchemaInternal, fieldSchema, slotSchema, typographyTokens, colorTokens, spacingTokens, radiusTokens, styleTokenSchema, behaviourSchema, blockCategoryEnum;
|
|
100879
|
+
var visibilityLevels, MEDIA_KINDS, DISPLAY_MEDIA_KINDS2, PUBLIC_FILE_FIELD_KINDS, siteOptionSources, mediaDeliverySchema, selectOptionSchema, selectSourceSchema, uiSchema, baseFieldSchema, textFieldSchema, richTextFieldSchema, mediaFieldSchema, fileFieldSchema, booleanFieldSchema, dateFieldSchema, timeFieldSchema, dateTimeFieldSchema, slugFieldSchema, urlFieldSchema, linkFieldSchema, selectFieldSchema, referenceFieldSchema, itemTypeSchema, repeaterFieldSchema, groupFieldSchema, modalFieldSchema, numberFieldSchema, tabDefinitionSchema, tabGroupFieldSchema, presetOptionSchema, presetOrCustomFieldSchema, contentTypeSelectFieldSchema, entryPickerFieldSchema, _fieldSchemaInternal, fieldSchema, slotSchema, typographyTokens, colorTokens, spacingTokens, radiusTokens, styleTokenSchema, behaviourSchema, blockCategoryEnum;
|
|
100878
100880
|
var init_schema3 = __esm({
|
|
100879
100881
|
"../blocks/src/system/manifest/schema.ts"() {
|
|
100880
100882
|
init_src5();
|
|
100881
100883
|
init_node();
|
|
100882
100884
|
init_repeaterGrid();
|
|
100883
100885
|
visibilityLevels = ["admin", "designer", "author"];
|
|
100886
|
+
MEDIA_KINDS = [
|
|
100887
|
+
"image",
|
|
100888
|
+
"video",
|
|
100889
|
+
"audio",
|
|
100890
|
+
"document",
|
|
100891
|
+
"spreadsheet",
|
|
100892
|
+
"archive"
|
|
100893
|
+
];
|
|
100894
|
+
DISPLAY_MEDIA_KINDS2 = [
|
|
100895
|
+
"image",
|
|
100896
|
+
"video",
|
|
100897
|
+
"audio"
|
|
100898
|
+
];
|
|
100899
|
+
PUBLIC_FILE_FIELD_KINDS = [
|
|
100900
|
+
"document",
|
|
100901
|
+
"spreadsheet",
|
|
100902
|
+
"archive",
|
|
100903
|
+
"audio"
|
|
100904
|
+
];
|
|
100884
100905
|
siteOptionSources = [
|
|
100885
100906
|
"eventCategories",
|
|
100886
100907
|
"venues",
|
|
@@ -101041,11 +101062,19 @@ var init_schema3 = __esm({
|
|
|
101041
101062
|
});
|
|
101042
101063
|
mediaFieldSchema = baseFieldSchema.extend({
|
|
101043
101064
|
type: z.literal("media"),
|
|
101044
|
-
|
|
101045
|
-
|
|
101046
|
-
|
|
101065
|
+
// Keep full MEDIA_KINDS parse compatibility for pre-file-field manifests.
|
|
101066
|
+
// New authoring surfaces should use `file.fileKinds` for document/archive
|
|
101067
|
+
// style assets, but old saved schemas must not fail to open.
|
|
101068
|
+
mediaKinds: z.array(z.enum(MEDIA_KINDS)).default(["image"]).transform((kinds) => {
|
|
101069
|
+
const displayKinds = kinds.filter(isDisplayMediaKind2);
|
|
101070
|
+
return displayKinds.length > 0 ? displayKinds : ["image"];
|
|
101071
|
+
}),
|
|
101047
101072
|
aspectRatio: z.string().optional()
|
|
101048
101073
|
});
|
|
101074
|
+
fileFieldSchema = baseFieldSchema.extend({
|
|
101075
|
+
type: z.literal("file"),
|
|
101076
|
+
fileKinds: z.array(z.enum(PUBLIC_FILE_FIELD_KINDS)).default([...PUBLIC_FILE_FIELD_KINDS])
|
|
101077
|
+
});
|
|
101049
101078
|
booleanFieldSchema = baseFieldSchema.extend({
|
|
101050
101079
|
type: z.literal("boolean")
|
|
101051
101080
|
});
|
|
@@ -101552,6 +101581,7 @@ function deriveFieldValidationPlan(field, path = [field.id]) {
|
|
|
101552
101581
|
case "richText":
|
|
101553
101582
|
return makePlan("richText", "object", field, path, required, commonConstraints(required, { kind: "richTextDoc" }));
|
|
101554
101583
|
case "media":
|
|
101584
|
+
case "file":
|
|
101555
101585
|
return makePlan("media", "object", field, path, required, commonConstraints(required, { kind: "mediaObject" }));
|
|
101556
101586
|
case "link":
|
|
101557
101587
|
return makePlan("link", "object", field, path, required, commonConstraints(required, { kind: "linkObject" }));
|
|
@@ -114217,13 +114247,19 @@ function defineFragment(config) {
|
|
|
114217
114247
|
function scopeFragmentFields(fragment, scope) {
|
|
114218
114248
|
const normalizedScope = scope.trim();
|
|
114219
114249
|
if (!normalizedScope) {
|
|
114220
|
-
return fragment.fields.map(
|
|
114250
|
+
return fragment.fields.map(
|
|
114251
|
+
(field) => cloneFieldDefinition2(field)
|
|
114252
|
+
);
|
|
114221
114253
|
}
|
|
114222
|
-
return fragment.fields.map(
|
|
114254
|
+
return fragment.fields.map(
|
|
114255
|
+
(field) => prefixFieldId(field, normalizedScope)
|
|
114256
|
+
);
|
|
114223
114257
|
}
|
|
114224
114258
|
function scopeFragmentLayout(fragment, scope) {
|
|
114225
114259
|
const normalizedScope = scope.trim();
|
|
114226
|
-
return fragment.layout.map(
|
|
114260
|
+
return fragment.layout.map(
|
|
114261
|
+
(node) => cloneAndScopeNode(node, normalizedScope)
|
|
114262
|
+
);
|
|
114227
114263
|
}
|
|
114228
114264
|
function validateFieldDefinitions(fields3, fragmentId) {
|
|
114229
114265
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -114305,7 +114341,9 @@ function cloneAndScopeNode(node, scope) {
|
|
|
114305
114341
|
...node
|
|
114306
114342
|
};
|
|
114307
114343
|
if (node.children) {
|
|
114308
|
-
cloned.children = node.children.map(
|
|
114344
|
+
cloned.children = node.children.map(
|
|
114345
|
+
(child) => cloneAndScopeNode(child, scope)
|
|
114346
|
+
);
|
|
114309
114347
|
}
|
|
114310
114348
|
if (node.props) {
|
|
114311
114349
|
cloned.props = scopePropBindings(node.props, scope);
|
|
@@ -114331,7 +114369,9 @@ function scopeBinding(binding, scope) {
|
|
|
114331
114369
|
const cloned = {
|
|
114332
114370
|
...binding,
|
|
114333
114371
|
transforms: binding.transforms?.map(
|
|
114334
|
-
(step) => ({
|
|
114372
|
+
(step) => ({
|
|
114373
|
+
...step
|
|
114374
|
+
})
|
|
114335
114375
|
) ?? []
|
|
114336
114376
|
};
|
|
114337
114377
|
cloned.from = scopeContentPath(binding.from, scope);
|
|
@@ -114375,7 +114415,9 @@ function scopePropValue(value, scope) {
|
|
|
114375
114415
|
};
|
|
114376
114416
|
}
|
|
114377
114417
|
const result = {};
|
|
114378
|
-
for (const [key, entry] of Object.entries(
|
|
114418
|
+
for (const [key, entry] of Object.entries(
|
|
114419
|
+
value
|
|
114420
|
+
)) {
|
|
114379
114421
|
result[key] = scopePropValue(entry, scope);
|
|
114380
114422
|
}
|
|
114381
114423
|
return result;
|
|
@@ -114421,13 +114463,18 @@ var init_types16 = __esm({
|
|
|
114421
114463
|
loader: dataLoaderSchema.optional()
|
|
114422
114464
|
});
|
|
114423
114465
|
fragmentConfigSchema = z.object({
|
|
114424
|
-
id: z.string().min(1, "Fragment id is required").regex(
|
|
114466
|
+
id: z.string().min(1, "Fragment id is required").regex(
|
|
114467
|
+
FRAGMENT_ID_PATTERN,
|
|
114468
|
+
"Fragment id must be alphanumeric with optional . _ - separators"
|
|
114469
|
+
),
|
|
114425
114470
|
title: z.string().optional(),
|
|
114426
114471
|
description: z.string().optional(),
|
|
114427
114472
|
category: z.enum(["content", "media", "interactive", "layout"]).optional(),
|
|
114428
114473
|
icon: z.string().optional(),
|
|
114429
114474
|
fields: fieldSchema.array().default([]),
|
|
114430
|
-
layout: z.union([NodeSchema, NodeSchema.array()]).transform(
|
|
114475
|
+
layout: z.union([NodeSchema, NodeSchema.array()]).transform(
|
|
114476
|
+
(value) => Array.isArray(value) ? value : [value]
|
|
114477
|
+
),
|
|
114431
114478
|
data: fragmentDataSchema.optional()
|
|
114432
114479
|
});
|
|
114433
114480
|
FragmentConfigError = class extends Error {
|
|
@@ -114897,34 +114944,35 @@ var init_ctaRow2 = __esm({
|
|
|
114897
114944
|
});
|
|
114898
114945
|
|
|
114899
114946
|
// ../blocks/src/system/fragments/library/heroCtaRow.ts
|
|
114900
|
-
var heroCtaRowFragment;
|
|
114947
|
+
var heroCtaFields, heroCtaRowFragment;
|
|
114901
114948
|
var init_heroCtaRow = __esm({
|
|
114902
114949
|
"../blocks/src/system/fragments/library/heroCtaRow.ts"() {
|
|
114903
114950
|
init_types16();
|
|
114904
114951
|
init_fragments();
|
|
114905
114952
|
init_ctas();
|
|
114953
|
+
heroCtaFields = [
|
|
114954
|
+
createCtasRepeater({
|
|
114955
|
+
label: "Calls to action",
|
|
114956
|
+
itemLabel: "CTA",
|
|
114957
|
+
maxItems: 3,
|
|
114958
|
+
button: {
|
|
114959
|
+
variants: [
|
|
114960
|
+
{ value: "default", label: "Default" },
|
|
114961
|
+
{ value: "primary", label: "Primary" },
|
|
114962
|
+
{ value: "secondary", label: "Secondary" },
|
|
114963
|
+
{ value: "outline", label: "Outline" }
|
|
114964
|
+
],
|
|
114965
|
+
defaultVariant: "default",
|
|
114966
|
+
includeSize: true,
|
|
114967
|
+
defaultSize: "lg"
|
|
114968
|
+
}
|
|
114969
|
+
})
|
|
114970
|
+
];
|
|
114906
114971
|
heroCtaRowFragment = defineFragment({
|
|
114907
114972
|
id: "heroCtaRow",
|
|
114908
114973
|
title: "Hero CTAs",
|
|
114909
114974
|
description: "Repeatable hero calls to action rendered inline.",
|
|
114910
|
-
fields:
|
|
114911
|
-
createCtasRepeater({
|
|
114912
|
-
label: "Calls to action",
|
|
114913
|
-
itemLabel: "CTA",
|
|
114914
|
-
maxItems: 3,
|
|
114915
|
-
button: {
|
|
114916
|
-
variants: [
|
|
114917
|
-
{ value: "default", label: "Default" },
|
|
114918
|
-
{ value: "primary", label: "Primary" },
|
|
114919
|
-
{ value: "secondary", label: "Secondary" },
|
|
114920
|
-
{ value: "outline", label: "Outline" }
|
|
114921
|
-
],
|
|
114922
|
-
defaultVariant: "default",
|
|
114923
|
-
includeSize: true,
|
|
114924
|
-
defaultSize: "lg"
|
|
114925
|
-
}
|
|
114926
|
-
})
|
|
114927
|
-
],
|
|
114975
|
+
fields: heroCtaFields,
|
|
114928
114976
|
layout: [
|
|
114929
114977
|
ctaRow({
|
|
114930
114978
|
collectionPath: "content.ctas",
|
|
@@ -121526,8 +121574,7 @@ var init_media3 = __esm({
|
|
|
121526
121574
|
"document",
|
|
121527
121575
|
"spreadsheet",
|
|
121528
121576
|
"archive",
|
|
121529
|
-
"audio"
|
|
121530
|
-
"video"
|
|
121577
|
+
"audio"
|
|
121531
121578
|
];
|
|
121532
121579
|
hotspotSchema2 = z40.object({
|
|
121533
121580
|
x: z40.number().min(0).max(1),
|
|
@@ -123356,7 +123403,7 @@ var init_course_details = __esm({
|
|
|
123356
123403
|
});
|
|
123357
123404
|
|
|
123358
123405
|
// ../blocks/src/system/blocks/events/event-spotlight.ts
|
|
123359
|
-
var eventSpotlightManifest, eventSpotlightBlockDefinition;
|
|
123406
|
+
var eventSpotlightFields, eventSpotlightLayout, eventSpotlightConfig, eventSpotlightManifest, eventSpotlightBlockDefinition;
|
|
123360
123407
|
var init_event_spotlight = __esm({
|
|
123361
123408
|
"../blocks/src/system/blocks/events/event-spotlight.ts"() {
|
|
123362
123409
|
init_builder();
|
|
@@ -123366,104 +123413,107 @@ var init_event_spotlight = __esm({
|
|
|
123366
123413
|
init_boxStyles();
|
|
123367
123414
|
init_defineBlock();
|
|
123368
123415
|
init_shared5();
|
|
123369
|
-
|
|
123416
|
+
eventSpotlightFields = [
|
|
123417
|
+
...sectionHeaderFields("Upcoming Events"),
|
|
123418
|
+
{
|
|
123419
|
+
id: "maxEvents",
|
|
123420
|
+
type: "select",
|
|
123421
|
+
label: "Events to display",
|
|
123422
|
+
description: "Number of events to show",
|
|
123423
|
+
required: false,
|
|
123424
|
+
multiple: false,
|
|
123425
|
+
defaultValue: "3",
|
|
123426
|
+
options: [
|
|
123427
|
+
{ value: "1", label: "1 event" },
|
|
123428
|
+
{ value: "2", label: "2 events" },
|
|
123429
|
+
{ value: "3", label: "3 events" },
|
|
123430
|
+
{ value: "4", label: "4 events" },
|
|
123431
|
+
{ value: "5", label: "5 events" },
|
|
123432
|
+
{ value: "6", label: "6 events" }
|
|
123433
|
+
],
|
|
123434
|
+
ui: { intent: "display" }
|
|
123435
|
+
},
|
|
123436
|
+
{
|
|
123437
|
+
id: "ctaLabel",
|
|
123438
|
+
type: "text",
|
|
123439
|
+
label: "Section button text",
|
|
123440
|
+
description: "Optional button shown below the spotlight cards",
|
|
123441
|
+
required: false,
|
|
123442
|
+
multiline: false,
|
|
123443
|
+
maxLength: 40,
|
|
123444
|
+
ui: { intent: "content" }
|
|
123445
|
+
},
|
|
123446
|
+
{
|
|
123447
|
+
id: "ctaUrl",
|
|
123448
|
+
type: "link",
|
|
123449
|
+
label: "Section button destination",
|
|
123450
|
+
required: false,
|
|
123451
|
+
ui: { intent: "display" }
|
|
123452
|
+
},
|
|
123453
|
+
layoutField,
|
|
123454
|
+
columnsField(["2", "3"]),
|
|
123455
|
+
...cardStylingFields,
|
|
123456
|
+
...eventDisplayFields,
|
|
123457
|
+
emptyStateField,
|
|
123458
|
+
sectionStylesField({
|
|
123459
|
+
id: "_sectionStyles",
|
|
123460
|
+
label: "Section styles"
|
|
123461
|
+
})
|
|
123462
|
+
];
|
|
123463
|
+
eventSpotlightLayout = [
|
|
123464
|
+
styledSection({
|
|
123465
|
+
children: sectionContainer([
|
|
123466
|
+
// Optional heading
|
|
123467
|
+
text(
|
|
123468
|
+
{ as: "h2" },
|
|
123469
|
+
bind2("content.heading"),
|
|
123470
|
+
when("content.heading")
|
|
123471
|
+
),
|
|
123472
|
+
// Optional description
|
|
123473
|
+
richText(
|
|
123474
|
+
{ className: "rb-prose rb-max-w-none" },
|
|
123475
|
+
bind2("content.description"),
|
|
123476
|
+
when("content.description")
|
|
123477
|
+
),
|
|
123478
|
+
// Event spotlight component
|
|
123479
|
+
el("event-spotlight", {
|
|
123480
|
+
events: { $bind: { from: "data.events" } },
|
|
123481
|
+
layout: { $bind: { from: "content.layout", fallback: "grid" } },
|
|
123482
|
+
columns: { $bind: { from: "content.columns", fallback: "3" } },
|
|
123483
|
+
cardVariant: { $bind: { from: "content.cardVariant", fallback: "default" } },
|
|
123484
|
+
buttonVariant: { $bind: { from: "content.buttonVariant", fallback: "primary" } },
|
|
123485
|
+
buttonText: { $bind: { from: "content.buttonText", fallback: "View event" } },
|
|
123486
|
+
ctaLabel: { $bind: { from: "content.ctaLabel" } },
|
|
123487
|
+
ctaUrl: { $bind: { from: "content.ctaUrl", transforms: [{ id: "links.resolve" }] } },
|
|
123488
|
+
showVenue: { $bind: { from: "content.showVenue" } },
|
|
123489
|
+
showMap: { $bind: { from: "content.showMap" } },
|
|
123490
|
+
showCapacity: { $bind: { from: "content.showCapacity" } },
|
|
123491
|
+
emptyMessage: { $bind: { from: "content.emptyMessage" } }
|
|
123492
|
+
})
|
|
123493
|
+
], {
|
|
123494
|
+
gap: "lg"
|
|
123495
|
+
}),
|
|
123496
|
+
// sectionContainer (rb-container) already provides horizontal padding
|
|
123497
|
+
baseClass: "",
|
|
123498
|
+
spacing: "comfortable"
|
|
123499
|
+
})
|
|
123500
|
+
];
|
|
123501
|
+
eventSpotlightConfig = {
|
|
123370
123502
|
id: "block.event-spotlight",
|
|
123371
123503
|
version: "1.1.0",
|
|
123372
123504
|
title: "Event Spotlight",
|
|
123373
123505
|
titleSource: "heading",
|
|
123374
123506
|
description: "Feature a few upcoming events on your homepage",
|
|
123375
123507
|
skipSectionStyles: true,
|
|
123376
|
-
additionalFields:
|
|
123377
|
-
...sectionHeaderFields("Upcoming Events"),
|
|
123378
|
-
{
|
|
123379
|
-
id: "maxEvents",
|
|
123380
|
-
type: "select",
|
|
123381
|
-
label: "Events to display",
|
|
123382
|
-
description: "Number of events to show",
|
|
123383
|
-
required: false,
|
|
123384
|
-
multiple: false,
|
|
123385
|
-
defaultValue: "3",
|
|
123386
|
-
options: [
|
|
123387
|
-
{ value: "1", label: "1 event" },
|
|
123388
|
-
{ value: "2", label: "2 events" },
|
|
123389
|
-
{ value: "3", label: "3 events" },
|
|
123390
|
-
{ value: "4", label: "4 events" },
|
|
123391
|
-
{ value: "5", label: "5 events" },
|
|
123392
|
-
{ value: "6", label: "6 events" }
|
|
123393
|
-
],
|
|
123394
|
-
ui: { intent: "display" }
|
|
123395
|
-
},
|
|
123396
|
-
{
|
|
123397
|
-
id: "ctaLabel",
|
|
123398
|
-
type: "text",
|
|
123399
|
-
label: "Section button text",
|
|
123400
|
-
description: "Optional button shown below the spotlight cards",
|
|
123401
|
-
required: false,
|
|
123402
|
-
multiline: false,
|
|
123403
|
-
maxLength: 40,
|
|
123404
|
-
ui: { intent: "content" }
|
|
123405
|
-
},
|
|
123406
|
-
{
|
|
123407
|
-
id: "ctaUrl",
|
|
123408
|
-
type: "link",
|
|
123409
|
-
label: "Section button destination",
|
|
123410
|
-
required: false,
|
|
123411
|
-
ui: { intent: "display" }
|
|
123412
|
-
},
|
|
123413
|
-
layoutField,
|
|
123414
|
-
columnsField(["2", "3"]),
|
|
123415
|
-
...cardStylingFields,
|
|
123416
|
-
...eventDisplayFields,
|
|
123417
|
-
emptyStateField,
|
|
123418
|
-
sectionStylesField({
|
|
123419
|
-
id: "_sectionStyles",
|
|
123420
|
-
label: "Section styles"
|
|
123421
|
-
})
|
|
123422
|
-
],
|
|
123508
|
+
additionalFields: eventSpotlightFields,
|
|
123423
123509
|
styleTokens: { background: "surface", typography: "body", spacing: "md" },
|
|
123424
123510
|
behaviours: { supportsThemeSwitching: true, inlineEditing: false, animation: false, paletteHidden: false },
|
|
123425
123511
|
category: "content",
|
|
123426
123512
|
tags: ["events", "featured", "homepage", "spotlight", "upcoming"],
|
|
123427
123513
|
icon: "Star",
|
|
123428
|
-
layout:
|
|
123429
|
-
|
|
123430
|
-
|
|
123431
|
-
// Optional heading
|
|
123432
|
-
text(
|
|
123433
|
-
{ as: "h2" },
|
|
123434
|
-
bind2("content.heading"),
|
|
123435
|
-
when("content.heading")
|
|
123436
|
-
),
|
|
123437
|
-
// Optional description
|
|
123438
|
-
richText(
|
|
123439
|
-
{ className: "rb-prose rb-max-w-none" },
|
|
123440
|
-
bind2("content.description"),
|
|
123441
|
-
when("content.description")
|
|
123442
|
-
),
|
|
123443
|
-
// Event spotlight component
|
|
123444
|
-
el("event-spotlight", {
|
|
123445
|
-
events: { $bind: { from: "data.events" } },
|
|
123446
|
-
layout: { $bind: { from: "content.layout", fallback: "grid" } },
|
|
123447
|
-
columns: { $bind: { from: "content.columns", fallback: "3" } },
|
|
123448
|
-
cardVariant: { $bind: { from: "content.cardVariant", fallback: "default" } },
|
|
123449
|
-
buttonVariant: { $bind: { from: "content.buttonVariant", fallback: "primary" } },
|
|
123450
|
-
buttonText: { $bind: { from: "content.buttonText", fallback: "View event" } },
|
|
123451
|
-
ctaLabel: { $bind: { from: "content.ctaLabel" } },
|
|
123452
|
-
ctaUrl: { $bind: { from: "content.ctaUrl", transforms: [{ id: "links.resolve" }] } },
|
|
123453
|
-
showVenue: { $bind: { from: "content.showVenue" } },
|
|
123454
|
-
showMap: { $bind: { from: "content.showMap" } },
|
|
123455
|
-
showCapacity: { $bind: { from: "content.showCapacity" } },
|
|
123456
|
-
emptyMessage: { $bind: { from: "content.emptyMessage" } }
|
|
123457
|
-
})
|
|
123458
|
-
], {
|
|
123459
|
-
gap: "lg"
|
|
123460
|
-
}),
|
|
123461
|
-
// sectionContainer (rb-container) already provides horizontal padding
|
|
123462
|
-
baseClass: "",
|
|
123463
|
-
spacing: "comfortable"
|
|
123464
|
-
})
|
|
123465
|
-
]
|
|
123466
|
-
});
|
|
123514
|
+
layout: eventSpotlightLayout
|
|
123515
|
+
};
|
|
123516
|
+
eventSpotlightManifest = createBlockManifest(eventSpotlightConfig);
|
|
123467
123517
|
eventSpotlightBlockDefinition = {
|
|
123468
123518
|
manifest: eventSpotlightManifest,
|
|
123469
123519
|
dataSchemas: {
|
|
@@ -128355,18 +128405,18 @@ var init_file_download = __esm({
|
|
|
128355
128405
|
title: "File Download",
|
|
128356
128406
|
titleSource: ["title", "file.filename"],
|
|
128357
128407
|
category: "media",
|
|
128358
|
-
description: "Add a simple public download link for a document, ZIP,
|
|
128408
|
+
description: "Add a simple public download link for a document, ZIP, or audio file.",
|
|
128359
128409
|
tags: ["file", "download", "document", "zip", "media"],
|
|
128360
128410
|
icon: "Download",
|
|
128361
128411
|
includeContainerStyles: true,
|
|
128362
128412
|
additionalFields: [
|
|
128363
128413
|
{
|
|
128364
128414
|
id: "file",
|
|
128365
|
-
type: "
|
|
128415
|
+
type: "file",
|
|
128366
128416
|
label: "Download file",
|
|
128367
128417
|
description: "Choose the file visitors can download.",
|
|
128368
128418
|
required: false,
|
|
128369
|
-
|
|
128419
|
+
fileKinds: [...PUBLIC_DOWNLOAD_MEDIA_TYPES],
|
|
128370
128420
|
ui: { intent: "content" }
|
|
128371
128421
|
},
|
|
128372
128422
|
{
|
|
@@ -133208,8 +133258,6 @@ function iconForMediaType(type) {
|
|
|
133208
133258
|
switch (type) {
|
|
133209
133259
|
case "audio":
|
|
133210
133260
|
return /* @__PURE__ */ jsx(FileHeadphone, { "aria-hidden": "true" });
|
|
133211
|
-
case "video":
|
|
133212
|
-
return /* @__PURE__ */ jsx(FilePlay, { "aria-hidden": "true" });
|
|
133213
133261
|
case "document":
|
|
133214
133262
|
return /* @__PURE__ */ jsx(FileText, { "aria-hidden": "true" });
|
|
133215
133263
|
case "spreadsheet":
|
|
@@ -133248,8 +133296,22 @@ function FileDownloadNode({
|
|
|
133248
133296
|
}
|
|
133249
133297
|
),
|
|
133250
133298
|
/* @__PURE__ */ jsxs("div", { className: "rb-min-w-0 rb-space-y-1", children: [
|
|
133251
|
-
/* @__PURE__ */ jsx(
|
|
133252
|
-
|
|
133299
|
+
/* @__PURE__ */ jsx(
|
|
133300
|
+
"h2",
|
|
133301
|
+
{
|
|
133302
|
+
className: "rb-m-0 rb-text-lg rb-font-semibold",
|
|
133303
|
+
style: textColorStyle("heading"),
|
|
133304
|
+
children: heading
|
|
133305
|
+
}
|
|
133306
|
+
),
|
|
133307
|
+
body ? /* @__PURE__ */ jsx(
|
|
133308
|
+
"p",
|
|
133309
|
+
{
|
|
133310
|
+
className: "rb-m-0 rb-text-sm",
|
|
133311
|
+
style: textColorStyle("mutedText"),
|
|
133312
|
+
children: body
|
|
133313
|
+
}
|
|
133314
|
+
) : null,
|
|
133253
133315
|
/* @__PURE__ */ jsx(
|
|
133254
133316
|
"p",
|
|
133255
133317
|
{
|
|
@@ -133286,7 +133348,12 @@ var init_file_download2 = __esm({
|
|
|
133286
133348
|
init_media3();
|
|
133287
133349
|
init_buttons();
|
|
133288
133350
|
init_media4();
|
|
133289
|
-
FILE_DOWNLOAD_BUTTON_VARIANTS = [
|
|
133351
|
+
FILE_DOWNLOAD_BUTTON_VARIANTS = [
|
|
133352
|
+
"primary",
|
|
133353
|
+
"secondary",
|
|
133354
|
+
"outline",
|
|
133355
|
+
"link"
|
|
133356
|
+
];
|
|
133290
133357
|
}
|
|
133291
133358
|
});
|
|
133292
133359
|
|
|
@@ -158138,7 +158205,7 @@ function useInternalValue(props2) {
|
|
|
158138
158205
|
]
|
|
158139
158206
|
);
|
|
158140
158207
|
const DEFAULT_AUTOSAVE_DELAY = 1500;
|
|
158141
|
-
const [
|
|
158208
|
+
const [errorMessage, setErrorMessage] = useState(null);
|
|
158142
158209
|
const skipAutoSaveRef = useRef(true);
|
|
158143
158210
|
const siteIdForInvalidation = siteId;
|
|
158144
158211
|
const typeForInvalidation = type;
|
|
@@ -158304,7 +158371,7 @@ function useInternalValue(props2) {
|
|
|
158304
158371
|
return {
|
|
158305
158372
|
entry,
|
|
158306
158373
|
baseline: uiStore.getState().metadata.getSnapshot().baseline ?? {},
|
|
158307
|
-
errorMessage
|
|
158374
|
+
errorMessage,
|
|
158308
158375
|
recoveryConflict: recoveryState.recoveryConflict ? {
|
|
158309
158376
|
affectedBlockIds: recoveryState.recoveryConflict.affectedBlockIds,
|
|
158310
158377
|
count: recoveryState.recoveryConflict.count,
|
|
@@ -158318,7 +158385,7 @@ function useInternalValue(props2) {
|
|
|
158318
158385
|
}, [
|
|
158319
158386
|
actions,
|
|
158320
158387
|
entry,
|
|
158321
|
-
|
|
158388
|
+
errorMessage,
|
|
158322
158389
|
recoveryState.discardRecoveredChanges,
|
|
158323
158390
|
recoveryState.recoveryConflict,
|
|
158324
158391
|
recoveryState.reviewAffectedBlocks,
|
|
@@ -158672,6 +158739,7 @@ function toManifestFieldInput(field) {
|
|
|
158672
158739
|
case "text":
|
|
158673
158740
|
case "richText":
|
|
158674
158741
|
case "media":
|
|
158742
|
+
case "file":
|
|
158675
158743
|
case "boolean":
|
|
158676
158744
|
case "date":
|
|
158677
158745
|
case "time":
|
|
@@ -169639,7 +169707,7 @@ var init_GuestDetailsSection = __esm({
|
|
|
169639
169707
|
onChange,
|
|
169640
169708
|
shake = false,
|
|
169641
169709
|
onShakeEnd,
|
|
169642
|
-
errorMessage
|
|
169710
|
+
errorMessage = DEFAULT_ERROR_MESSAGE
|
|
169643
169711
|
}) => {
|
|
169644
169712
|
const sectionRef = useRef(null);
|
|
169645
169713
|
const firstErrorRef = useRef(null);
|
|
@@ -169672,7 +169740,7 @@ var init_GuestDetailsSection = __esm({
|
|
|
169672
169740
|
onAnimationEnd: handleAnimationEnd,
|
|
169673
169741
|
children: [
|
|
169674
169742
|
/* @__PURE__ */ jsx("h3", { className: "er-title", children: "Who else is coming?" }),
|
|
169675
|
-
showErrorBanner && /* @__PURE__ */ jsx(FeedbackMessage, { tone: "error", className: "er-guest-section-error", role: "alert", children:
|
|
169743
|
+
showErrorBanner && /* @__PURE__ */ jsx(FeedbackMessage, { tone: "error", className: "er-guest-section-error", role: "alert", children: errorMessage }),
|
|
169676
169744
|
/* @__PURE__ */ jsx("div", { className: "er-guest-cards", children: guests.map((guest, index2) => {
|
|
169677
169745
|
const guestError = errors?.[index2]?.name;
|
|
169678
169746
|
const guestErrorId = `guest-${index2}-error`;
|
|
@@ -170831,20 +170899,20 @@ function usePaymentVerification(config) {
|
|
|
170831
170899
|
}, [api, config]);
|
|
170832
170900
|
const polling = usePolling(pollingConfig);
|
|
170833
170901
|
const paymentStatus = polling.result?.paymentStatus ?? null;
|
|
170834
|
-
let
|
|
170902
|
+
let errorMessage = null;
|
|
170835
170903
|
if (polling.status === "timeout") {
|
|
170836
|
-
|
|
170904
|
+
errorMessage = "Could not verify payment. If you were charged, please contact support.";
|
|
170837
170905
|
} else if (polling.status === "failed" && paymentStatus) {
|
|
170838
|
-
|
|
170906
|
+
errorMessage = paymentStatus === "refunded" ? "Payment was refunded. Please contact support." : "Payment was declined. Please try again.";
|
|
170839
170907
|
} else if (polling.error) {
|
|
170840
|
-
|
|
170908
|
+
errorMessage = polling.error.message;
|
|
170841
170909
|
}
|
|
170842
170910
|
return {
|
|
170843
170911
|
status: polling.status,
|
|
170844
170912
|
paymentStatus,
|
|
170845
170913
|
attendeeStatus: polling.result?.attendeeStatus ?? null,
|
|
170846
170914
|
waitlistPosition: polling.result?.waitlistPosition ?? null,
|
|
170847
|
-
error:
|
|
170915
|
+
error: errorMessage,
|
|
170848
170916
|
retry: polling.retry
|
|
170849
170917
|
};
|
|
170850
170918
|
}
|
|
@@ -171200,7 +171268,7 @@ function useEventRegistrationWizard(options) {
|
|
|
171200
171268
|
);
|
|
171201
171269
|
const [selectedTicketTypeId, setSelectedTicketTypeId] = useState(null);
|
|
171202
171270
|
const [registrationResult, setRegistrationResult] = useState(null);
|
|
171203
|
-
const [
|
|
171271
|
+
const [errorMessage, setErrorMessage] = useState("");
|
|
171204
171272
|
const [altchaSolution, setAltchaSolution] = useState(null);
|
|
171205
171273
|
const { authState: portalAuthState, profile: portalProfile } = usePortalAuth();
|
|
171206
171274
|
const waitlistClaim = useWaitlistClaim();
|
|
@@ -171586,7 +171654,7 @@ function useEventRegistrationWizard(options) {
|
|
|
171586
171654
|
guestSectionShake,
|
|
171587
171655
|
handleGuestShakeEnd,
|
|
171588
171656
|
registrationResult,
|
|
171589
|
-
errorMessage
|
|
171657
|
+
errorMessage,
|
|
171590
171658
|
altchaSolution,
|
|
171591
171659
|
setAltchaSolution,
|
|
171592
171660
|
portalAuthState,
|
|
@@ -172760,7 +172828,7 @@ function useCourseRegistrationWizard(props2) {
|
|
|
172760
172828
|
});
|
|
172761
172829
|
const [errors, setErrors] = useState({});
|
|
172762
172830
|
const [enrollmentResult, setEnrollmentResult] = useState(null);
|
|
172763
|
-
const [
|
|
172831
|
+
const [errorMessage, setErrorMessage] = useState("");
|
|
172764
172832
|
const [portalAuthState, setPortalAuthState] = useState("checking");
|
|
172765
172833
|
const [altchaSolution, setAltchaSolution] = useState(null);
|
|
172766
172834
|
const showSpamProtection = isSpamProtectionEnabled();
|
|
@@ -173268,7 +173336,7 @@ function useCourseRegistrationWizard(props2) {
|
|
|
173268
173336
|
setFormData,
|
|
173269
173337
|
errors,
|
|
173270
173338
|
enrollmentResult,
|
|
173271
|
-
errorMessage
|
|
173339
|
+
errorMessage,
|
|
173272
173340
|
portalAuthState,
|
|
173273
173341
|
handleLogout,
|
|
173274
173342
|
altchaSolution,
|
|
@@ -173348,7 +173416,7 @@ function CourseRegistrationWizard(props2) {
|
|
|
173348
173416
|
setFormData,
|
|
173349
173417
|
errors,
|
|
173350
173418
|
enrollmentResult,
|
|
173351
|
-
errorMessage
|
|
173419
|
+
errorMessage,
|
|
173352
173420
|
portalAuthState,
|
|
173353
173421
|
handleLogout,
|
|
173354
173422
|
setAltchaSolution,
|
|
@@ -173730,7 +173798,7 @@ function CourseRegistrationWizard(props2) {
|
|
|
173730
173798
|
step === "payment-failed" && /* @__PURE__ */ jsx(
|
|
173731
173799
|
PaymentFailedStep2,
|
|
173732
173800
|
{
|
|
173733
|
-
message:
|
|
173801
|
+
message: errorMessage,
|
|
173734
173802
|
buttonVariant,
|
|
173735
173803
|
onRetry: handleRetry
|
|
173736
173804
|
}
|
|
@@ -173753,7 +173821,7 @@ function CourseRegistrationWizard(props2) {
|
|
|
173753
173821
|
step === "error" && /* @__PURE__ */ jsx(
|
|
173754
173822
|
ErrorStep2,
|
|
173755
173823
|
{
|
|
173756
|
-
message:
|
|
173824
|
+
message: errorMessage,
|
|
173757
173825
|
buttonVariant,
|
|
173758
173826
|
onRetry: handleRetry
|
|
173759
173827
|
}
|
|
@@ -180524,6 +180592,7 @@ var init_schemas3 = __esm({
|
|
|
180524
180592
|
link: buildLinkFieldSchema,
|
|
180525
180593
|
richText: buildRichTextFieldSchema,
|
|
180526
180594
|
media: buildMediaFieldSchema,
|
|
180595
|
+
file: buildMediaFieldSchema,
|
|
180527
180596
|
tabGroup: buildTabGroupFieldSchema,
|
|
180528
180597
|
presetOrCustom: buildPresetOrCustomFieldSchema,
|
|
180529
180598
|
reference: buildReferenceFieldSchema,
|
|
@@ -180546,6 +180615,7 @@ var init_schemas3 = __esm({
|
|
|
180546
180615
|
link: getLinkFieldDefault,
|
|
180547
180616
|
richText: getRichTextFieldDefaultValue,
|
|
180548
180617
|
media: getMediaFieldDefaultValue,
|
|
180618
|
+
file: getMediaFieldDefaultValue,
|
|
180549
180619
|
tabGroup: getTabGroupFieldDefault,
|
|
180550
180620
|
presetOrCustom: getPresetOrCustomFieldDefault,
|
|
180551
180621
|
reference: getReferenceFieldDefault,
|
|
@@ -187924,7 +187994,7 @@ function assertRelativeStoragePath(value) {
|
|
|
187924
187994
|
}
|
|
187925
187995
|
return parsed.value;
|
|
187926
187996
|
}
|
|
187927
|
-
var asSiteId2, asStorageBucketName2, unsafeAsPositiveByteCount2, unsafeAsPositiveSeconds2, asBookingSessionId, asEntitlementId, asSiteFontId, asBookingRequirementId, IMAGE_FILE_FORMATS, VIDEO_FILE_FORMATS, AUDIO_FILE_FORMATS, DOCUMENT_FILE_FORMATS, SPREADSHEET_FILE_FORMATS, FONT_FILE_FORMATS, ARCHIVE_FILE_FORMATS, FILE_KIND_TAGS, RENDERABLE_FILE_KIND_TAGS, FILE_USE_TAGS, WORKFLOW_INPUT_KINDS, SITE_BRAND_ASSET_USES, TEMPORARY_INGESTION_KINDS, ACCESS_POLICY_TAGS, FILE_STORAGE_BUCKETS2, PRIVATE_SITE_FILE_BUCKET_MIME_TYPES2, RASTER_IMAGE_MIME_TYPES,
|
|
187997
|
+
var asSiteId2, asStorageBucketName2, unsafeAsPositiveByteCount2, unsafeAsPositiveSeconds2, asBookingSessionId, asEntitlementId, asSiteFontId, asBookingRequirementId, IMAGE_FILE_FORMATS, VIDEO_FILE_FORMATS, AUDIO_FILE_FORMATS, DOCUMENT_FILE_FORMATS, SPREADSHEET_FILE_FORMATS, FONT_FILE_FORMATS, ARCHIVE_FILE_FORMATS, FILE_KIND_TAGS, RENDERABLE_FILE_KIND_TAGS, FILE_USE_TAGS, WORKFLOW_INPUT_KINDS, SITE_BRAND_ASSET_USES, TEMPORARY_INGESTION_KINDS, ACCESS_POLICY_TAGS, FILE_STORAGE_BUCKETS2, PRIVATE_SITE_FILE_BUCKET_MIME_TYPES2, RASTER_IMAGE_MIME_TYPES, MEDIA_KINDS2, MEDIA_ASSET_FILE_FILTERS2, MEDIA_ASSET_LIBRARY_SCOPES, MediaStorageError, pad, extractExtension, generateId4, generateStoragePath, DEFAULT_BUCKET, MAX_LIMIT, fileKindSchema, fileUsesSchema, accessPolicySchema, fileDomainSchema, fileDomainPatchSchema, searchMatchRowSchema;
|
|
187928
187998
|
var init_dist91 = __esm({
|
|
187929
187999
|
"../media-storage-supabase/dist/index.mjs"() {
|
|
187930
188000
|
asSiteId2 = (id) => id;
|
|
@@ -188035,7 +188105,7 @@ var init_dist91 = __esm({
|
|
|
188035
188105
|
"image/avif"
|
|
188036
188106
|
];
|
|
188037
188107
|
new Set(RASTER_IMAGE_MIME_TYPES);
|
|
188038
|
-
|
|
188108
|
+
MEDIA_KINDS2 = [
|
|
188039
188109
|
"image",
|
|
188040
188110
|
"video",
|
|
188041
188111
|
"audio",
|
|
@@ -188179,7 +188249,7 @@ var init_dist91 = __esm({
|
|
|
188179
188249
|
orderBy: z.enum(["created_at", "filename"]).optional(),
|
|
188180
188250
|
orderDirection: z.enum(["asc", "desc"]).optional(),
|
|
188181
188251
|
labels: z.array(z.string()).optional(),
|
|
188182
|
-
mediaKinds: z.array(z.enum(
|
|
188252
|
+
mediaKinds: z.array(z.enum(MEDIA_KINDS2)).optional(),
|
|
188183
188253
|
fileFilter: z.enum(MEDIA_ASSET_FILE_FILTERS2).optional(),
|
|
188184
188254
|
libraryScope: z.enum(MEDIA_ASSET_LIBRARY_SCOPES).optional()
|
|
188185
188255
|
});
|
|
@@ -188296,874 +188366,14 @@ var init_classification = __esm({
|
|
|
188296
188366
|
};
|
|
188297
188367
|
}
|
|
188298
188368
|
});
|
|
188299
|
-
|
|
188300
|
-
// ../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/const.js
|
|
188301
|
-
var FFMessageType;
|
|
188302
|
-
var init_const = __esm({
|
|
188303
|
-
"../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/const.js"() {
|
|
188304
|
-
(function(FFMessageType2) {
|
|
188305
|
-
FFMessageType2["LOAD"] = "LOAD";
|
|
188306
|
-
FFMessageType2["EXEC"] = "EXEC";
|
|
188307
|
-
FFMessageType2["FFPROBE"] = "FFPROBE";
|
|
188308
|
-
FFMessageType2["WRITE_FILE"] = "WRITE_FILE";
|
|
188309
|
-
FFMessageType2["READ_FILE"] = "READ_FILE";
|
|
188310
|
-
FFMessageType2["DELETE_FILE"] = "DELETE_FILE";
|
|
188311
|
-
FFMessageType2["RENAME"] = "RENAME";
|
|
188312
|
-
FFMessageType2["CREATE_DIR"] = "CREATE_DIR";
|
|
188313
|
-
FFMessageType2["LIST_DIR"] = "LIST_DIR";
|
|
188314
|
-
FFMessageType2["DELETE_DIR"] = "DELETE_DIR";
|
|
188315
|
-
FFMessageType2["ERROR"] = "ERROR";
|
|
188316
|
-
FFMessageType2["DOWNLOAD"] = "DOWNLOAD";
|
|
188317
|
-
FFMessageType2["PROGRESS"] = "PROGRESS";
|
|
188318
|
-
FFMessageType2["LOG"] = "LOG";
|
|
188319
|
-
FFMessageType2["MOUNT"] = "MOUNT";
|
|
188320
|
-
FFMessageType2["UNMOUNT"] = "UNMOUNT";
|
|
188321
|
-
})(FFMessageType || (FFMessageType = {}));
|
|
188322
|
-
}
|
|
188323
|
-
});
|
|
188324
|
-
|
|
188325
|
-
// ../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/utils.js
|
|
188326
|
-
var getMessageID;
|
|
188327
|
-
var init_utils13 = __esm({
|
|
188328
|
-
"../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/utils.js"() {
|
|
188329
|
-
getMessageID = /* @__PURE__ */ (() => {
|
|
188330
|
-
let messageID = 0;
|
|
188331
|
-
return () => messageID++;
|
|
188332
|
-
})();
|
|
188333
|
-
}
|
|
188334
|
-
});
|
|
188335
|
-
|
|
188336
|
-
// ../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/errors.js
|
|
188337
|
-
var ERROR_NOT_LOADED, ERROR_TERMINATED;
|
|
188338
|
-
var init_errors = __esm({
|
|
188339
|
-
"../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/errors.js"() {
|
|
188340
|
-
ERROR_NOT_LOADED = new Error("ffmpeg is not loaded, call `await ffmpeg.load()` first");
|
|
188341
|
-
ERROR_TERMINATED = new Error("called FFmpeg.terminate()");
|
|
188342
|
-
}
|
|
188343
|
-
});
|
|
188344
|
-
|
|
188345
|
-
// ../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/classes.js
|
|
188346
|
-
var _worker, _resolves, _rejects, _logEventCallbacks, _progressEventCallbacks, _registerHandlers, _send, FFmpeg;
|
|
188347
|
-
var init_classes2 = __esm({
|
|
188348
|
-
"../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/classes.js"() {
|
|
188349
|
-
init_const();
|
|
188350
|
-
init_utils13();
|
|
188351
|
-
init_errors();
|
|
188352
|
-
FFmpeg = class {
|
|
188353
|
-
constructor() {
|
|
188354
|
-
__privateAdd(this, _worker, null);
|
|
188355
|
-
/**
|
|
188356
|
-
* #resolves and #rejects tracks Promise resolves and rejects to
|
|
188357
|
-
* be called when we receive message from web worker.
|
|
188358
|
-
*/
|
|
188359
|
-
__privateAdd(this, _resolves, {});
|
|
188360
|
-
__privateAdd(this, _rejects, {});
|
|
188361
|
-
__privateAdd(this, _logEventCallbacks, []);
|
|
188362
|
-
__privateAdd(this, _progressEventCallbacks, []);
|
|
188363
|
-
__publicField(this, "loaded", false);
|
|
188364
|
-
/**
|
|
188365
|
-
* register worker message event handlers.
|
|
188366
|
-
*/
|
|
188367
|
-
__privateAdd(this, _registerHandlers, () => {
|
|
188368
|
-
if (__privateGet(this, _worker)) {
|
|
188369
|
-
__privateGet(this, _worker).onmessage = ({ data: { id, type, data } }) => {
|
|
188370
|
-
switch (type) {
|
|
188371
|
-
case FFMessageType.LOAD:
|
|
188372
|
-
this.loaded = true;
|
|
188373
|
-
__privateGet(this, _resolves)[id](data);
|
|
188374
|
-
break;
|
|
188375
|
-
case FFMessageType.MOUNT:
|
|
188376
|
-
case FFMessageType.UNMOUNT:
|
|
188377
|
-
case FFMessageType.EXEC:
|
|
188378
|
-
case FFMessageType.FFPROBE:
|
|
188379
|
-
case FFMessageType.WRITE_FILE:
|
|
188380
|
-
case FFMessageType.READ_FILE:
|
|
188381
|
-
case FFMessageType.DELETE_FILE:
|
|
188382
|
-
case FFMessageType.RENAME:
|
|
188383
|
-
case FFMessageType.CREATE_DIR:
|
|
188384
|
-
case FFMessageType.LIST_DIR:
|
|
188385
|
-
case FFMessageType.DELETE_DIR:
|
|
188386
|
-
__privateGet(this, _resolves)[id](data);
|
|
188387
|
-
break;
|
|
188388
|
-
case FFMessageType.LOG:
|
|
188389
|
-
__privateGet(this, _logEventCallbacks).forEach((f2) => f2(data));
|
|
188390
|
-
break;
|
|
188391
|
-
case FFMessageType.PROGRESS:
|
|
188392
|
-
__privateGet(this, _progressEventCallbacks).forEach((f2) => f2(data));
|
|
188393
|
-
break;
|
|
188394
|
-
case FFMessageType.ERROR:
|
|
188395
|
-
__privateGet(this, _rejects)[id](data);
|
|
188396
|
-
break;
|
|
188397
|
-
}
|
|
188398
|
-
delete __privateGet(this, _resolves)[id];
|
|
188399
|
-
delete __privateGet(this, _rejects)[id];
|
|
188400
|
-
};
|
|
188401
|
-
}
|
|
188402
|
-
});
|
|
188403
|
-
/**
|
|
188404
|
-
* Generic function to send messages to web worker.
|
|
188405
|
-
*/
|
|
188406
|
-
__privateAdd(this, _send, ({ type, data }, trans = [], signal) => {
|
|
188407
|
-
if (!__privateGet(this, _worker)) {
|
|
188408
|
-
return Promise.reject(ERROR_NOT_LOADED);
|
|
188409
|
-
}
|
|
188410
|
-
return new Promise((resolve, reject) => {
|
|
188411
|
-
const id = getMessageID();
|
|
188412
|
-
__privateGet(this, _worker) && __privateGet(this, _worker).postMessage({ id, type, data }, trans);
|
|
188413
|
-
__privateGet(this, _resolves)[id] = resolve;
|
|
188414
|
-
__privateGet(this, _rejects)[id] = reject;
|
|
188415
|
-
signal?.addEventListener("abort", () => {
|
|
188416
|
-
reject(new DOMException(`Message # ${id} was aborted`, "AbortError"));
|
|
188417
|
-
}, { once: true });
|
|
188418
|
-
});
|
|
188419
|
-
});
|
|
188420
|
-
/**
|
|
188421
|
-
* Loads ffmpeg-core inside web worker. It is required to call this method first
|
|
188422
|
-
* as it initializes WebAssembly and other essential variables.
|
|
188423
|
-
*
|
|
188424
|
-
* @category FFmpeg
|
|
188425
|
-
* @returns `true` if ffmpeg core is loaded for the first time.
|
|
188426
|
-
*/
|
|
188427
|
-
__publicField(this, "load", ({ classWorkerURL, ...config } = {}, { signal } = {}) => {
|
|
188428
|
-
if (!__privateGet(this, _worker)) {
|
|
188429
|
-
__privateSet(this, _worker, classWorkerURL ? new Worker(new URL(classWorkerURL, import.meta.url), {
|
|
188430
|
-
type: "module"
|
|
188431
|
-
}) : (
|
|
188432
|
-
// We need to duplicated the code here to enable webpack
|
|
188433
|
-
// to bundle worekr.js here.
|
|
188434
|
-
new Worker(new URL("./worker.js", import.meta.url), {
|
|
188435
|
-
type: "module"
|
|
188436
|
-
})
|
|
188437
|
-
));
|
|
188438
|
-
__privateGet(this, _registerHandlers).call(this);
|
|
188439
|
-
}
|
|
188440
|
-
return __privateGet(this, _send).call(this, {
|
|
188441
|
-
type: FFMessageType.LOAD,
|
|
188442
|
-
data: config
|
|
188443
|
-
}, void 0, signal);
|
|
188444
|
-
});
|
|
188445
|
-
/**
|
|
188446
|
-
* Execute ffmpeg command.
|
|
188447
|
-
*
|
|
188448
|
-
* @remarks
|
|
188449
|
-
* To avoid common I/O issues, ["-nostdin", "-y"] are prepended to the args
|
|
188450
|
-
* by default.
|
|
188451
|
-
*
|
|
188452
|
-
* @example
|
|
188453
|
-
* ```ts
|
|
188454
|
-
* const ffmpeg = new FFmpeg();
|
|
188455
|
-
* await ffmpeg.load();
|
|
188456
|
-
* await ffmpeg.writeFile("video.avi", ...);
|
|
188457
|
-
* // ffmpeg -i video.avi video.mp4
|
|
188458
|
-
* await ffmpeg.exec(["-i", "video.avi", "video.mp4"]);
|
|
188459
|
-
* const data = ffmpeg.readFile("video.mp4");
|
|
188460
|
-
* ```
|
|
188461
|
-
*
|
|
188462
|
-
* @returns `0` if no error, `!= 0` if timeout (1) or error.
|
|
188463
|
-
* @category FFmpeg
|
|
188464
|
-
*/
|
|
188465
|
-
__publicField(this, "exec", (args, timeout = -1, { signal } = {}) => __privateGet(this, _send).call(this, {
|
|
188466
|
-
type: FFMessageType.EXEC,
|
|
188467
|
-
data: { args, timeout }
|
|
188468
|
-
}, void 0, signal));
|
|
188469
|
-
/**
|
|
188470
|
-
* Execute ffprobe command.
|
|
188471
|
-
*
|
|
188472
|
-
* @example
|
|
188473
|
-
* ```ts
|
|
188474
|
-
* const ffmpeg = new FFmpeg();
|
|
188475
|
-
* await ffmpeg.load();
|
|
188476
|
-
* await ffmpeg.writeFile("video.avi", ...);
|
|
188477
|
-
* // Getting duration of a video in seconds: ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 video.avi -o output.txt
|
|
188478
|
-
* await ffmpeg.ffprobe(["-v", "error", "-show_entries", "format=duration", "-of", "default=noprint_wrappers=1:nokey=1", "video.avi", "-o", "output.txt"]);
|
|
188479
|
-
* const data = ffmpeg.readFile("output.txt");
|
|
188480
|
-
* ```
|
|
188481
|
-
*
|
|
188482
|
-
* @returns `0` if no error, `!= 0` if timeout (1) or error.
|
|
188483
|
-
* @category FFmpeg
|
|
188484
|
-
*/
|
|
188485
|
-
__publicField(this, "ffprobe", (args, timeout = -1, { signal } = {}) => __privateGet(this, _send).call(this, {
|
|
188486
|
-
type: FFMessageType.FFPROBE,
|
|
188487
|
-
data: { args, timeout }
|
|
188488
|
-
}, void 0, signal));
|
|
188489
|
-
/**
|
|
188490
|
-
* Terminate all ongoing API calls and terminate web worker.
|
|
188491
|
-
* `FFmpeg.load()` must be called again before calling any other APIs.
|
|
188492
|
-
*
|
|
188493
|
-
* @category FFmpeg
|
|
188494
|
-
*/
|
|
188495
|
-
__publicField(this, "terminate", () => {
|
|
188496
|
-
const ids2 = Object.keys(__privateGet(this, _rejects));
|
|
188497
|
-
for (const id of ids2) {
|
|
188498
|
-
__privateGet(this, _rejects)[id](ERROR_TERMINATED);
|
|
188499
|
-
delete __privateGet(this, _rejects)[id];
|
|
188500
|
-
delete __privateGet(this, _resolves)[id];
|
|
188501
|
-
}
|
|
188502
|
-
if (__privateGet(this, _worker)) {
|
|
188503
|
-
__privateGet(this, _worker).terminate();
|
|
188504
|
-
__privateSet(this, _worker, null);
|
|
188505
|
-
this.loaded = false;
|
|
188506
|
-
}
|
|
188507
|
-
});
|
|
188508
|
-
/**
|
|
188509
|
-
* Write data to ffmpeg.wasm.
|
|
188510
|
-
*
|
|
188511
|
-
* @example
|
|
188512
|
-
* ```ts
|
|
188513
|
-
* const ffmpeg = new FFmpeg();
|
|
188514
|
-
* await ffmpeg.load();
|
|
188515
|
-
* await ffmpeg.writeFile("video.avi", await fetchFile("../video.avi"));
|
|
188516
|
-
* await ffmpeg.writeFile("text.txt", "hello world");
|
|
188517
|
-
* ```
|
|
188518
|
-
*
|
|
188519
|
-
* @category File System
|
|
188520
|
-
*/
|
|
188521
|
-
__publicField(this, "writeFile", (path, data, { signal } = {}) => {
|
|
188522
|
-
const trans = [];
|
|
188523
|
-
if (data instanceof Uint8Array) {
|
|
188524
|
-
trans.push(data.buffer);
|
|
188525
|
-
}
|
|
188526
|
-
return __privateGet(this, _send).call(this, {
|
|
188527
|
-
type: FFMessageType.WRITE_FILE,
|
|
188528
|
-
data: { path, data }
|
|
188529
|
-
}, trans, signal);
|
|
188530
|
-
});
|
|
188531
|
-
__publicField(this, "mount", (fsType, options, mountPoint) => {
|
|
188532
|
-
const trans = [];
|
|
188533
|
-
return __privateGet(this, _send).call(this, {
|
|
188534
|
-
type: FFMessageType.MOUNT,
|
|
188535
|
-
data: { fsType, options, mountPoint }
|
|
188536
|
-
}, trans);
|
|
188537
|
-
});
|
|
188538
|
-
__publicField(this, "unmount", (mountPoint) => {
|
|
188539
|
-
const trans = [];
|
|
188540
|
-
return __privateGet(this, _send).call(this, {
|
|
188541
|
-
type: FFMessageType.UNMOUNT,
|
|
188542
|
-
data: { mountPoint }
|
|
188543
|
-
}, trans);
|
|
188544
|
-
});
|
|
188545
|
-
/**
|
|
188546
|
-
* Read data from ffmpeg.wasm.
|
|
188547
|
-
*
|
|
188548
|
-
* @example
|
|
188549
|
-
* ```ts
|
|
188550
|
-
* const ffmpeg = new FFmpeg();
|
|
188551
|
-
* await ffmpeg.load();
|
|
188552
|
-
* const data = await ffmpeg.readFile("video.mp4");
|
|
188553
|
-
* ```
|
|
188554
|
-
*
|
|
188555
|
-
* @category File System
|
|
188556
|
-
*/
|
|
188557
|
-
__publicField(this, "readFile", (path, encoding = "binary", { signal } = {}) => __privateGet(this, _send).call(this, {
|
|
188558
|
-
type: FFMessageType.READ_FILE,
|
|
188559
|
-
data: { path, encoding }
|
|
188560
|
-
}, void 0, signal));
|
|
188561
|
-
/**
|
|
188562
|
-
* Delete a file.
|
|
188563
|
-
*
|
|
188564
|
-
* @category File System
|
|
188565
|
-
*/
|
|
188566
|
-
__publicField(this, "deleteFile", (path, { signal } = {}) => __privateGet(this, _send).call(this, {
|
|
188567
|
-
type: FFMessageType.DELETE_FILE,
|
|
188568
|
-
data: { path }
|
|
188569
|
-
}, void 0, signal));
|
|
188570
|
-
/**
|
|
188571
|
-
* Rename a file or directory.
|
|
188572
|
-
*
|
|
188573
|
-
* @category File System
|
|
188574
|
-
*/
|
|
188575
|
-
__publicField(this, "rename", (oldPath, newPath, { signal } = {}) => __privateGet(this, _send).call(this, {
|
|
188576
|
-
type: FFMessageType.RENAME,
|
|
188577
|
-
data: { oldPath, newPath }
|
|
188578
|
-
}, void 0, signal));
|
|
188579
|
-
/**
|
|
188580
|
-
* Create a directory.
|
|
188581
|
-
*
|
|
188582
|
-
* @category File System
|
|
188583
|
-
*/
|
|
188584
|
-
__publicField(this, "createDir", (path, { signal } = {}) => __privateGet(this, _send).call(this, {
|
|
188585
|
-
type: FFMessageType.CREATE_DIR,
|
|
188586
|
-
data: { path }
|
|
188587
|
-
}, void 0, signal));
|
|
188588
|
-
/**
|
|
188589
|
-
* List directory contents.
|
|
188590
|
-
*
|
|
188591
|
-
* @category File System
|
|
188592
|
-
*/
|
|
188593
|
-
__publicField(this, "listDir", (path, { signal } = {}) => __privateGet(this, _send).call(this, {
|
|
188594
|
-
type: FFMessageType.LIST_DIR,
|
|
188595
|
-
data: { path }
|
|
188596
|
-
}, void 0, signal));
|
|
188597
|
-
/**
|
|
188598
|
-
* Delete an empty directory.
|
|
188599
|
-
*
|
|
188600
|
-
* @category File System
|
|
188601
|
-
*/
|
|
188602
|
-
__publicField(this, "deleteDir", (path, { signal } = {}) => __privateGet(this, _send).call(this, {
|
|
188603
|
-
type: FFMessageType.DELETE_DIR,
|
|
188604
|
-
data: { path }
|
|
188605
|
-
}, void 0, signal));
|
|
188606
|
-
}
|
|
188607
|
-
on(event, callback) {
|
|
188608
|
-
if (event === "log") {
|
|
188609
|
-
__privateGet(this, _logEventCallbacks).push(callback);
|
|
188610
|
-
} else if (event === "progress") {
|
|
188611
|
-
__privateGet(this, _progressEventCallbacks).push(callback);
|
|
188612
|
-
}
|
|
188613
|
-
}
|
|
188614
|
-
off(event, callback) {
|
|
188615
|
-
if (event === "log") {
|
|
188616
|
-
__privateSet(this, _logEventCallbacks, __privateGet(this, _logEventCallbacks).filter((f2) => f2 !== callback));
|
|
188617
|
-
} else if (event === "progress") {
|
|
188618
|
-
__privateSet(this, _progressEventCallbacks, __privateGet(this, _progressEventCallbacks).filter((f2) => f2 !== callback));
|
|
188619
|
-
}
|
|
188620
|
-
}
|
|
188621
|
-
};
|
|
188622
|
-
_worker = new WeakMap();
|
|
188623
|
-
_resolves = new WeakMap();
|
|
188624
|
-
_rejects = new WeakMap();
|
|
188625
|
-
_logEventCallbacks = new WeakMap();
|
|
188626
|
-
_progressEventCallbacks = new WeakMap();
|
|
188627
|
-
_registerHandlers = new WeakMap();
|
|
188628
|
-
_send = new WeakMap();
|
|
188629
|
-
}
|
|
188630
|
-
});
|
|
188631
|
-
|
|
188632
|
-
// ../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/types.js
|
|
188633
|
-
var FFFSType;
|
|
188634
|
-
var init_types27 = __esm({
|
|
188635
|
-
"../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/types.js"() {
|
|
188636
|
-
(function(FFFSType2) {
|
|
188637
|
-
FFFSType2["MEMFS"] = "MEMFS";
|
|
188638
|
-
FFFSType2["NODEFS"] = "NODEFS";
|
|
188639
|
-
FFFSType2["NODERAWFS"] = "NODERAWFS";
|
|
188640
|
-
FFFSType2["IDBFS"] = "IDBFS";
|
|
188641
|
-
FFFSType2["WORKERFS"] = "WORKERFS";
|
|
188642
|
-
FFFSType2["PROXYFS"] = "PROXYFS";
|
|
188643
|
-
})(FFFSType || (FFFSType = {}));
|
|
188644
|
-
}
|
|
188645
|
-
});
|
|
188646
|
-
|
|
188647
|
-
// ../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/index.js
|
|
188648
|
-
var esm_exports = {};
|
|
188649
|
-
__export(esm_exports, {
|
|
188650
|
-
FFFSType: () => FFFSType,
|
|
188651
|
-
FFmpeg: () => FFmpeg
|
|
188652
|
-
});
|
|
188653
|
-
var init_esm9 = __esm({
|
|
188654
|
-
"../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/index.js"() {
|
|
188655
|
-
init_classes2();
|
|
188656
|
-
init_types27();
|
|
188657
|
-
}
|
|
188658
|
-
});
|
|
188659
|
-
|
|
188660
|
-
// ../../node_modules/.pnpm/@ffmpeg+util@0.12.2/node_modules/@ffmpeg/util/dist/esm/errors.js
|
|
188661
|
-
var ERROR_RESPONSE_BODY_READER, ERROR_INCOMPLETED_DOWNLOAD;
|
|
188662
|
-
var init_errors2 = __esm({
|
|
188663
|
-
"../../node_modules/.pnpm/@ffmpeg+util@0.12.2/node_modules/@ffmpeg/util/dist/esm/errors.js"() {
|
|
188664
|
-
ERROR_RESPONSE_BODY_READER = new Error("failed to get response body reader");
|
|
188665
|
-
ERROR_INCOMPLETED_DOWNLOAD = new Error("failed to complete download");
|
|
188666
|
-
}
|
|
188667
|
-
});
|
|
188668
|
-
|
|
188669
|
-
// ../../node_modules/.pnpm/@ffmpeg+util@0.12.2/node_modules/@ffmpeg/util/dist/esm/const.js
|
|
188670
|
-
var HeaderContentLength;
|
|
188671
|
-
var init_const2 = __esm({
|
|
188672
|
-
"../../node_modules/.pnpm/@ffmpeg+util@0.12.2/node_modules/@ffmpeg/util/dist/esm/const.js"() {
|
|
188673
|
-
HeaderContentLength = "Content-Length";
|
|
188674
|
-
}
|
|
188675
|
-
});
|
|
188676
|
-
|
|
188677
|
-
// ../../node_modules/.pnpm/@ffmpeg+util@0.12.2/node_modules/@ffmpeg/util/dist/esm/index.js
|
|
188678
|
-
var esm_exports2 = {};
|
|
188679
|
-
__export(esm_exports2, {
|
|
188680
|
-
downloadWithProgress: () => downloadWithProgress,
|
|
188681
|
-
fetchFile: () => fetchFile,
|
|
188682
|
-
importScript: () => importScript,
|
|
188683
|
-
toBlobURL: () => toBlobURL
|
|
188684
|
-
});
|
|
188685
|
-
var readFromBlobOrFile, fetchFile, importScript, downloadWithProgress, toBlobURL;
|
|
188686
|
-
var init_esm10 = __esm({
|
|
188687
|
-
"../../node_modules/.pnpm/@ffmpeg+util@0.12.2/node_modules/@ffmpeg/util/dist/esm/index.js"() {
|
|
188688
|
-
init_errors2();
|
|
188689
|
-
init_const2();
|
|
188690
|
-
readFromBlobOrFile = (blob) => new Promise((resolve, reject) => {
|
|
188691
|
-
const fileReader = new FileReader();
|
|
188692
|
-
fileReader.onload = () => {
|
|
188693
|
-
const { result } = fileReader;
|
|
188694
|
-
if (result instanceof ArrayBuffer) {
|
|
188695
|
-
resolve(new Uint8Array(result));
|
|
188696
|
-
} else {
|
|
188697
|
-
resolve(new Uint8Array());
|
|
188698
|
-
}
|
|
188699
|
-
};
|
|
188700
|
-
fileReader.onerror = (event) => {
|
|
188701
|
-
reject(Error(`File could not be read! Code=${event?.target?.error?.code || -1}`));
|
|
188702
|
-
};
|
|
188703
|
-
fileReader.readAsArrayBuffer(blob);
|
|
188704
|
-
});
|
|
188705
|
-
fetchFile = async (file) => {
|
|
188706
|
-
let data;
|
|
188707
|
-
if (typeof file === "string") {
|
|
188708
|
-
if (/data:_data\/([a-zA-Z]*);base64,([^"]*)/.test(file)) {
|
|
188709
|
-
data = atob(file.split(",")[1]).split("").map((c4) => c4.charCodeAt(0));
|
|
188710
|
-
} else {
|
|
188711
|
-
data = await (await fetch(file)).arrayBuffer();
|
|
188712
|
-
}
|
|
188713
|
-
} else if (file instanceof URL) {
|
|
188714
|
-
data = await (await fetch(file)).arrayBuffer();
|
|
188715
|
-
} else if (file instanceof File || file instanceof Blob) {
|
|
188716
|
-
data = await readFromBlobOrFile(file);
|
|
188717
|
-
} else {
|
|
188718
|
-
return new Uint8Array();
|
|
188719
|
-
}
|
|
188720
|
-
return new Uint8Array(data);
|
|
188721
|
-
};
|
|
188722
|
-
importScript = async (url) => new Promise((resolve) => {
|
|
188723
|
-
const script = document.createElement("script");
|
|
188724
|
-
const eventHandler = () => {
|
|
188725
|
-
script.removeEventListener("load", eventHandler);
|
|
188726
|
-
resolve();
|
|
188727
|
-
};
|
|
188728
|
-
script.src = url;
|
|
188729
|
-
script.type = "text/javascript";
|
|
188730
|
-
script.addEventListener("load", eventHandler);
|
|
188731
|
-
document.getElementsByTagName("head")[0].appendChild(script);
|
|
188732
|
-
});
|
|
188733
|
-
downloadWithProgress = async (url, cb) => {
|
|
188734
|
-
const resp = await fetch(url);
|
|
188735
|
-
let buf;
|
|
188736
|
-
try {
|
|
188737
|
-
const total = parseInt(resp.headers.get(HeaderContentLength) || "-1");
|
|
188738
|
-
const reader = resp.body?.getReader();
|
|
188739
|
-
if (!reader)
|
|
188740
|
-
throw ERROR_RESPONSE_BODY_READER;
|
|
188741
|
-
const chunks = [];
|
|
188742
|
-
let received = 0;
|
|
188743
|
-
for (; ; ) {
|
|
188744
|
-
const { done, value } = await reader.read();
|
|
188745
|
-
const delta = value ? value.length : 0;
|
|
188746
|
-
if (done) {
|
|
188747
|
-
if (total != -1 && total !== received)
|
|
188748
|
-
throw ERROR_INCOMPLETED_DOWNLOAD;
|
|
188749
|
-
cb && cb({ url, total, received, delta, done });
|
|
188750
|
-
break;
|
|
188751
|
-
}
|
|
188752
|
-
chunks.push(value);
|
|
188753
|
-
received += delta;
|
|
188754
|
-
cb && cb({ url, total, received, delta, done });
|
|
188755
|
-
}
|
|
188756
|
-
const data = new Uint8Array(received);
|
|
188757
|
-
let position = 0;
|
|
188758
|
-
for (const chunk of chunks) {
|
|
188759
|
-
data.set(chunk, position);
|
|
188760
|
-
position += chunk.length;
|
|
188761
|
-
}
|
|
188762
|
-
buf = data.buffer;
|
|
188763
|
-
} catch (e3) {
|
|
188764
|
-
console.log(`failed to send download progress event: `, e3);
|
|
188765
|
-
buf = await resp.arrayBuffer();
|
|
188766
|
-
cb && cb({
|
|
188767
|
-
url,
|
|
188768
|
-
total: buf.byteLength,
|
|
188769
|
-
received: buf.byteLength,
|
|
188770
|
-
delta: 0,
|
|
188771
|
-
done: true
|
|
188772
|
-
});
|
|
188773
|
-
}
|
|
188774
|
-
return buf;
|
|
188775
|
-
};
|
|
188776
|
-
toBlobURL = async (url, mimeType, progress = false, cb) => {
|
|
188777
|
-
const buf = progress ? await downloadWithProgress(url, cb) : await (await fetch(url)).arrayBuffer();
|
|
188778
|
-
const blob = new Blob([buf], { type: mimeType });
|
|
188779
|
-
return URL.createObjectURL(blob);
|
|
188780
|
-
};
|
|
188781
|
-
}
|
|
188782
|
-
});
|
|
188783
|
-
|
|
188784
|
-
// ../media-react/src/ffmpegLoader.ts
|
|
188785
|
-
async function loadBrowserFfmpeg(options = {}) {
|
|
188786
|
-
let modules;
|
|
188787
|
-
try {
|
|
188788
|
-
const [ffmpegModule, utilModule] = await Promise.all([
|
|
188789
|
-
Promise.resolve().then(() => (init_esm9(), esm_exports)),
|
|
188790
|
-
Promise.resolve().then(() => (init_esm10(), esm_exports2))
|
|
188791
|
-
]);
|
|
188792
|
-
modules = {
|
|
188793
|
-
FFmpeg: ffmpegModule.FFmpeg,
|
|
188794
|
-
fetchFile: utilModule.fetchFile
|
|
188795
|
-
};
|
|
188796
|
-
} catch (error) {
|
|
188797
|
-
return err({ tag: "ffmpeg-import-failed", message: errorMessage(error, "Failed to import FFmpeg") });
|
|
188798
|
-
}
|
|
188799
|
-
const ffmpeg = new modules.FFmpeg();
|
|
188800
|
-
try {
|
|
188801
|
-
await ffmpeg.load({
|
|
188802
|
-
coreURL: `${FFMPEG_CORE_BASE_PATH}/ffmpeg-core.js`,
|
|
188803
|
-
wasmURL: `${FFMPEG_CORE_BASE_PATH}/ffmpeg-core.wasm`
|
|
188804
|
-
}, { signal: options.signal });
|
|
188805
|
-
} catch (error) {
|
|
188806
|
-
ffmpeg.terminate();
|
|
188807
|
-
return err({ tag: "ffmpeg-core-load-failed", message: errorMessage(error, "Failed to load FFmpeg") });
|
|
188808
|
-
}
|
|
188809
|
-
return ok({ ffmpeg, fetchFile: modules.fetchFile });
|
|
188810
|
-
}
|
|
188811
|
-
function errorMessage(error, fallback2) {
|
|
188812
|
-
return error instanceof Error && error.message.trim() ? error.message : fallback2;
|
|
188813
|
-
}
|
|
188814
|
-
var FFMPEG_CORE_VERSION, FFMPEG_CORE_BASE_PATH;
|
|
188815
|
-
var init_ffmpegLoader = __esm({
|
|
188816
|
-
"../media-react/src/ffmpegLoader.ts"() {
|
|
188817
|
-
"use client";
|
|
188818
|
-
init_src3();
|
|
188819
|
-
FFMPEG_CORE_VERSION = "0.12.10";
|
|
188820
|
-
FFMPEG_CORE_BASE_PATH = `/vendor/ffmpeg/core/${FFMPEG_CORE_VERSION}`;
|
|
188821
|
-
}
|
|
188822
|
-
});
|
|
188823
|
-
|
|
188824
|
-
// ../media-react/src/videoFrameExtraction.ts
|
|
188825
|
-
function extractVideoPosterFrame(input, options = {}) {
|
|
188826
|
-
return new Promise((resolve) => {
|
|
188827
|
-
const video = document.createElement("video");
|
|
188828
|
-
const canvas = document.createElement("canvas");
|
|
188829
|
-
const source = resolveVideoSource(input);
|
|
188830
|
-
let settled = false;
|
|
188831
|
-
let metadataLoaded = false;
|
|
188832
|
-
const cleanup = () => {
|
|
188833
|
-
video.onloadedmetadata = null;
|
|
188834
|
-
video.onseeked = null;
|
|
188835
|
-
video.onerror = null;
|
|
188836
|
-
video.src = "";
|
|
188837
|
-
video.load();
|
|
188838
|
-
if (source.objectUrl !== void 0) {
|
|
188839
|
-
URL.revokeObjectURL(source.objectUrl);
|
|
188840
|
-
}
|
|
188841
|
-
};
|
|
188842
|
-
const finish = (result) => {
|
|
188843
|
-
if (settled) return;
|
|
188844
|
-
settled = true;
|
|
188845
|
-
cleanup();
|
|
188846
|
-
resolve(result);
|
|
188847
|
-
};
|
|
188848
|
-
const duration = () => video.duration;
|
|
188849
|
-
const width = () => video.videoWidth;
|
|
188850
|
-
const height = () => video.videoHeight;
|
|
188851
|
-
video.crossOrigin = options.crossOrigin ?? "anonymous";
|
|
188852
|
-
video.preload = "metadata";
|
|
188853
|
-
video.src = source.src;
|
|
188854
|
-
video.onloadedmetadata = () => {
|
|
188855
|
-
if (settled) return;
|
|
188856
|
-
metadataLoaded = true;
|
|
188857
|
-
if (!isValidVideoMetadata(duration(), width(), height())) {
|
|
188858
|
-
finish(err({
|
|
188859
|
-
tag: "invalid-video-metadata",
|
|
188860
|
-
durationSeconds: duration(),
|
|
188861
|
-
width: width(),
|
|
188862
|
-
height: height()
|
|
188863
|
-
}));
|
|
188864
|
-
return;
|
|
188865
|
-
}
|
|
188866
|
-
try {
|
|
188867
|
-
video.currentTime = resolvePosterSeekSeconds(duration(), options.seekSeconds);
|
|
188868
|
-
} catch {
|
|
188869
|
-
finish(err({ tag: "video-seek-failed" }));
|
|
188870
|
-
}
|
|
188871
|
-
};
|
|
188872
|
-
video.onseeked = () => {
|
|
188873
|
-
if (settled) return;
|
|
188874
|
-
const drawn = drawFrameToCanvas({ video, canvas, width: width(), height: height() });
|
|
188875
|
-
if (!drawn.ok) {
|
|
188876
|
-
finish(err(drawn.error));
|
|
188877
|
-
return;
|
|
188878
|
-
}
|
|
188879
|
-
void encodeCanvasToBlob(canvas, options).then((encoded) => {
|
|
188880
|
-
if (!encoded.ok) {
|
|
188881
|
-
finish(err(encoded.error));
|
|
188882
|
-
return;
|
|
188883
|
-
}
|
|
188884
|
-
finish(ok({
|
|
188885
|
-
posterBlob: encoded.value,
|
|
188886
|
-
durationSeconds: duration(),
|
|
188887
|
-
width: width(),
|
|
188888
|
-
height: height()
|
|
188889
|
-
}));
|
|
188890
|
-
});
|
|
188891
|
-
};
|
|
188892
|
-
video.onerror = () => {
|
|
188893
|
-
if (settled) return;
|
|
188894
|
-
finish(metadataLoaded ? err({ tag: "video-seek-failed" }) : err({ tag: "video-load-failed" }));
|
|
188895
|
-
};
|
|
188896
|
-
video.load();
|
|
188897
|
-
});
|
|
188898
|
-
}
|
|
188899
|
-
function resolveVideoSource(input) {
|
|
188900
|
-
if (typeof input === "string") {
|
|
188901
|
-
return { src: input };
|
|
188902
|
-
}
|
|
188903
|
-
const objectUrl = URL.createObjectURL(input);
|
|
188904
|
-
return { src: objectUrl, objectUrl };
|
|
188905
|
-
}
|
|
188906
|
-
function drawFrameToCanvas(input) {
|
|
188907
|
-
input.canvas.width = input.width;
|
|
188908
|
-
input.canvas.height = input.height;
|
|
188909
|
-
const context = input.canvas.getContext("2d");
|
|
188910
|
-
if (!context) {
|
|
188911
|
-
return err({ tag: "canvas-context-unavailable" });
|
|
188912
|
-
}
|
|
188913
|
-
try {
|
|
188914
|
-
context.drawImage(input.video, 0, 0, input.width, input.height);
|
|
188915
|
-
return ok(void 0);
|
|
188916
|
-
} catch (error) {
|
|
188917
|
-
return err({
|
|
188918
|
-
tag: "canvas-draw-failed",
|
|
188919
|
-
message: error instanceof Error ? error.message : "Canvas draw failed"
|
|
188920
|
-
});
|
|
188921
|
-
}
|
|
188922
|
-
}
|
|
188923
|
-
function encodeCanvasToBlob(canvas, options) {
|
|
188924
|
-
return new Promise((resolve) => {
|
|
188925
|
-
try {
|
|
188926
|
-
canvas.toBlob(
|
|
188927
|
-
(posterBlob) => {
|
|
188928
|
-
resolve(
|
|
188929
|
-
posterBlob ? ok(posterBlob) : err({ tag: "poster-blob-unavailable" })
|
|
188930
|
-
);
|
|
188931
|
-
},
|
|
188932
|
-
options.posterMimeType ?? "image/jpeg",
|
|
188933
|
-
normalizePosterQuality(options.posterQuality)
|
|
188934
|
-
);
|
|
188935
|
-
} catch (error) {
|
|
188936
|
-
resolve(err({
|
|
188937
|
-
tag: "canvas-draw-failed",
|
|
188938
|
-
message: error instanceof Error ? error.message : "Canvas encode failed"
|
|
188939
|
-
}));
|
|
188940
|
-
}
|
|
188941
|
-
});
|
|
188942
|
-
}
|
|
188943
|
-
function isValidVideoMetadata(durationSeconds, width, height) {
|
|
188944
|
-
return Number.isFinite(durationSeconds) && durationSeconds > 0 && Number.isFinite(width) && width > 0 && Number.isFinite(height) && height > 0;
|
|
188945
|
-
}
|
|
188946
|
-
function resolvePosterSeekSeconds(durationSeconds, preferredSeekSeconds) {
|
|
188947
|
-
if (preferredSeekSeconds !== void 0) {
|
|
188948
|
-
return Math.min(Math.max(0, preferredSeekSeconds), durationSeconds);
|
|
188949
|
-
}
|
|
188950
|
-
return Math.min(1, durationSeconds * 0.1);
|
|
188951
|
-
}
|
|
188952
|
-
function normalizePosterQuality(quality) {
|
|
188953
|
-
if (quality === void 0 || !Number.isFinite(quality)) {
|
|
188954
|
-
return 0.85;
|
|
188955
|
-
}
|
|
188956
|
-
return Math.min(1, Math.max(0, quality));
|
|
188957
|
-
}
|
|
188958
|
-
var init_videoFrameExtraction = __esm({
|
|
188959
|
-
"../media-react/src/videoFrameExtraction.ts"() {
|
|
188960
|
-
"use client";
|
|
188961
|
-
init_src3();
|
|
188962
|
-
}
|
|
188963
|
-
});
|
|
188964
|
-
|
|
188965
|
-
// ../media-react/src/videoPrepBrowser.ts
|
|
188966
|
-
async function prepareBrowserVideoUpload(input) {
|
|
188967
|
-
const policy = deriveVideoPrepPolicy(input.intent);
|
|
188968
|
-
input.onProgress?.({ tag: "metadata" });
|
|
188969
|
-
const poster = await extractVideoPosterFrame(input.file);
|
|
188970
|
-
if (!poster.ok) {
|
|
188971
|
-
return err({ tag: "metadata-load-failed", error: poster.error });
|
|
188972
|
-
}
|
|
188973
|
-
const metadata = {
|
|
188974
|
-
byteSize: input.file.size,
|
|
188975
|
-
durationSeconds: poster.value.durationSeconds,
|
|
188976
|
-
width: poster.value.width,
|
|
188977
|
-
height: poster.value.height
|
|
188978
|
-
};
|
|
188979
|
-
const validation = validateVideoPrepSource(metadata, policy);
|
|
188980
|
-
if (!validation.ok) {
|
|
188981
|
-
return err({ tag: "source-validation-failed", error: validation.error });
|
|
188982
|
-
}
|
|
188983
|
-
input.onProgress?.({ tag: "validated", metadata });
|
|
188984
|
-
if (!shouldTranscode(input.file, metadata, policy)) {
|
|
188985
|
-
const result2 = browserVideoPrepResult({
|
|
188986
|
-
file: input.file,
|
|
188987
|
-
originalFile: input.file,
|
|
188988
|
-
policy,
|
|
188989
|
-
metadata,
|
|
188990
|
-
posterBlob: poster.value.posterBlob,
|
|
188991
|
-
outputTag: "original"
|
|
188992
|
-
});
|
|
188993
|
-
input.onProgress?.({ tag: "complete", output: result2.output.tag });
|
|
188994
|
-
return ok(result2);
|
|
188995
|
-
}
|
|
188996
|
-
input.onProgress?.({ tag: "ffmpeg-load" });
|
|
188997
|
-
const runtime = await (input.loadFfmpeg ?? loadBrowserFfmpeg)({ signal: input.signal });
|
|
188998
|
-
if (!runtime.ok) {
|
|
188999
|
-
if (policy.allowOriginalFallback) {
|
|
189000
|
-
return ok(fallbackOriginal(input, policy, metadata, poster.value.posterBlob, {
|
|
189001
|
-
tag: "compression-failed",
|
|
189002
|
-
message: runtime.error.message
|
|
189003
|
-
}));
|
|
189004
|
-
}
|
|
189005
|
-
return err({ tag: "ffmpeg-load-failed", error: runtime.error });
|
|
189006
|
-
}
|
|
189007
|
-
const compressed = await transcodeVideo({
|
|
189008
|
-
runtime: runtime.value,
|
|
189009
|
-
file: input.file,
|
|
189010
|
-
policy,
|
|
189011
|
-
timeoutMs: input.timeoutMs ?? DEFAULT_FFMPEG_TIMEOUT_MS,
|
|
189012
|
-
signal: input.signal,
|
|
189013
|
-
onProgress: input.onProgress
|
|
189014
|
-
});
|
|
189015
|
-
if (!compressed.ok) {
|
|
189016
|
-
if (policy.allowOriginalFallback) {
|
|
189017
|
-
return ok(fallbackOriginal(input, policy, metadata, poster.value.posterBlob, compressed.error));
|
|
189018
|
-
}
|
|
189019
|
-
return err(compressed.error);
|
|
189020
|
-
}
|
|
189021
|
-
const result = browserVideoPrepResult({
|
|
189022
|
-
file: compressed.value,
|
|
189023
|
-
originalFile: input.file,
|
|
189024
|
-
policy,
|
|
189025
|
-
metadata,
|
|
189026
|
-
posterBlob: poster.value.posterBlob,
|
|
189027
|
-
outputTag: "compressed"
|
|
189028
|
-
});
|
|
189029
|
-
input.onProgress?.({ tag: "complete", output: result.output.tag });
|
|
189030
|
-
return ok(result);
|
|
189031
|
-
}
|
|
189032
|
-
function browserVideoPrepResult(input) {
|
|
189033
|
-
return {
|
|
189034
|
-
file: input.file,
|
|
189035
|
-
originalFile: input.originalFile,
|
|
189036
|
-
policy: input.policy,
|
|
189037
|
-
metadata: input.metadata,
|
|
189038
|
-
preparedMetadata: preparedMetadataForOutput(input.metadata, input.policy, input.outputTag),
|
|
189039
|
-
posterBlob: input.posterBlob,
|
|
189040
|
-
output: {
|
|
189041
|
-
tag: input.outputTag,
|
|
189042
|
-
originalBytes: input.originalFile.size,
|
|
189043
|
-
preparedBytes: input.file.size
|
|
189044
|
-
}
|
|
189045
|
-
};
|
|
189046
|
-
}
|
|
189047
|
-
function fallbackOriginal(input, policy, metadata, posterBlob, reason) {
|
|
189048
|
-
input.onProgress?.({ tag: "fallback-original", reason });
|
|
189049
|
-
const result = browserVideoPrepResult({
|
|
189050
|
-
file: input.file,
|
|
189051
|
-
originalFile: input.file,
|
|
189052
|
-
policy,
|
|
189053
|
-
metadata,
|
|
189054
|
-
posterBlob,
|
|
189055
|
-
outputTag: "fallback-original"
|
|
189056
|
-
});
|
|
189057
|
-
input.onProgress?.({ tag: "complete", output: result.output.tag });
|
|
189058
|
-
return result;
|
|
189059
|
-
}
|
|
189060
|
-
function shouldTranscode(file, metadata, policy) {
|
|
189061
|
-
return policy.stripAudio || metadata.width > policy.targetMaxDimensionPixels || metadata.height > policy.targetMaxDimensionPixels || file.type !== PREPARED_VIDEO_MIME_TYPE;
|
|
189062
|
-
}
|
|
189063
|
-
function preparedMetadataForOutput(metadata, policy, outputTag) {
|
|
189064
|
-
if (outputTag !== "compressed") {
|
|
189065
|
-
return metadata;
|
|
189066
|
-
}
|
|
189067
|
-
const maxDimension = Math.max(metadata.width, metadata.height);
|
|
189068
|
-
if (maxDimension <= policy.targetMaxDimensionPixels) {
|
|
189069
|
-
return metadata;
|
|
189070
|
-
}
|
|
189071
|
-
const scale = policy.targetMaxDimensionPixels / maxDimension;
|
|
189072
|
-
return {
|
|
189073
|
-
...metadata,
|
|
189074
|
-
width: evenPositiveInteger(metadata.width * scale),
|
|
189075
|
-
height: evenPositiveInteger(metadata.height * scale)
|
|
189076
|
-
};
|
|
189077
|
-
}
|
|
189078
|
-
function evenPositiveInteger(value) {
|
|
189079
|
-
return Math.max(2, Math.round(value / 2) * 2);
|
|
189080
|
-
}
|
|
189081
|
-
async function transcodeVideo(input) {
|
|
189082
|
-
const progressListener = ({ progress }) => {
|
|
189083
|
-
input.onProgress?.({ tag: "compressing", progress: Math.min(1, Math.max(0, progress)) });
|
|
189084
|
-
};
|
|
189085
|
-
input.runtime.ffmpeg.on("progress", progressListener);
|
|
189086
|
-
try {
|
|
189087
|
-
await input.runtime.ffmpeg.writeFile(INPUT_FILENAME, await input.runtime.fetchFile(input.file), { signal: input.signal });
|
|
189088
|
-
const exitCode3 = await input.runtime.ffmpeg.exec(
|
|
189089
|
-
ffmpegArgsForPolicy(input.policy),
|
|
189090
|
-
input.timeoutMs,
|
|
189091
|
-
{ signal: input.signal }
|
|
189092
|
-
);
|
|
189093
|
-
if (exitCode3 !== 0) {
|
|
189094
|
-
return err(exitCode3 === 1 ? { tag: "timed-out" } : { tag: "compression-failed", message: `FFmpeg exited with code ${exitCode3}` });
|
|
189095
|
-
}
|
|
189096
|
-
const output = await input.runtime.ffmpeg.readFile(OUTPUT_FILENAME, "binary", { signal: input.signal });
|
|
189097
|
-
if (!(output instanceof Uint8Array) || output.byteLength === 0) {
|
|
189098
|
-
return err({ tag: "compressed-output-invalid" });
|
|
189099
|
-
}
|
|
189100
|
-
const outputBuffer = new ArrayBuffer(output.byteLength);
|
|
189101
|
-
new Uint8Array(outputBuffer).set(output);
|
|
189102
|
-
return ok(new File([outputBuffer], mp4Filename(input.file.name), { type: PREPARED_VIDEO_MIME_TYPE }));
|
|
189103
|
-
} catch (error) {
|
|
189104
|
-
return err(isAbortError(error) ? { tag: "aborted" } : { tag: "compression-failed", message: errorMessage2(error, "Video compression failed") });
|
|
189105
|
-
} finally {
|
|
189106
|
-
input.runtime.ffmpeg.off("progress", progressListener);
|
|
189107
|
-
await deleteFfmpegFile(input.runtime.ffmpeg, INPUT_FILENAME);
|
|
189108
|
-
await deleteFfmpegFile(input.runtime.ffmpeg, OUTPUT_FILENAME);
|
|
189109
|
-
input.runtime.ffmpeg.terminate();
|
|
189110
|
-
}
|
|
189111
|
-
}
|
|
189112
|
-
function ffmpegArgsForPolicy(policy) {
|
|
189113
|
-
return [
|
|
189114
|
-
"-i",
|
|
189115
|
-
INPUT_FILENAME,
|
|
189116
|
-
"-vf",
|
|
189117
|
-
scaleFilter(policy.targetMaxDimensionPixels),
|
|
189118
|
-
"-c:v",
|
|
189119
|
-
"libx264",
|
|
189120
|
-
"-preset",
|
|
189121
|
-
"veryfast",
|
|
189122
|
-
"-crf",
|
|
189123
|
-
"28",
|
|
189124
|
-
"-movflags",
|
|
189125
|
-
"+faststart",
|
|
189126
|
-
...policy.stripAudio ? ["-an"] : ["-c:a", "aac", "-b:a", "128k"],
|
|
189127
|
-
OUTPUT_FILENAME
|
|
189128
|
-
];
|
|
189129
|
-
}
|
|
189130
|
-
function scaleFilter(targetMaxDimensionPixels) {
|
|
189131
|
-
const boundedWidth = `if(gte(iw,ih),min(${targetMaxDimensionPixels},iw),-2)`;
|
|
189132
|
-
const boundedHeight = `if(gte(iw,ih),-2,min(${targetMaxDimensionPixels},ih))`;
|
|
189133
|
-
return `scale='${boundedWidth}':'${boundedHeight}'`;
|
|
189134
|
-
}
|
|
189135
|
-
async function deleteFfmpegFile(ffmpeg, path) {
|
|
189136
|
-
await ffmpeg.deleteFile(path).catch(() => void 0);
|
|
189137
|
-
}
|
|
189138
|
-
function mp4Filename(filename) {
|
|
189139
|
-
const dotIndex = filename.lastIndexOf(".");
|
|
189140
|
-
const baseName = dotIndex > 0 ? filename.slice(0, dotIndex) : filename;
|
|
189141
|
-
return `${baseName}.mp4`;
|
|
189142
|
-
}
|
|
189143
|
-
function isAbortError(error) {
|
|
189144
|
-
return error instanceof DOMException && error.name === "AbortError";
|
|
189145
|
-
}
|
|
189146
|
-
function errorMessage2(error, fallback2) {
|
|
189147
|
-
return error instanceof Error && error.message.trim() ? error.message : fallback2;
|
|
189148
|
-
}
|
|
189149
|
-
var DEFAULT_FFMPEG_TIMEOUT_MS, INPUT_FILENAME, OUTPUT_FILENAME, PREPARED_VIDEO_MIME_TYPE;
|
|
189150
|
-
var init_videoPrepBrowser = __esm({
|
|
189151
|
-
"../media-react/src/videoPrepBrowser.ts"() {
|
|
189152
|
-
"use client";
|
|
189153
|
-
init_src5();
|
|
189154
|
-
init_src3();
|
|
189155
|
-
init_ffmpegLoader();
|
|
189156
|
-
init_videoFrameExtraction();
|
|
189157
|
-
DEFAULT_FFMPEG_TIMEOUT_MS = 12e4;
|
|
189158
|
-
INPUT_FILENAME = "input-video";
|
|
189159
|
-
OUTPUT_FILENAME = "prepared-video.mp4";
|
|
189160
|
-
PREPARED_VIDEO_MIME_TYPE = "video/mp4";
|
|
189161
|
-
}
|
|
189162
|
-
});
|
|
189163
188369
|
async function maybePrepareVideoFile(input) {
|
|
189164
188370
|
if (input.videoPrepIntent === void 0) {
|
|
189165
188371
|
return { file: input.file };
|
|
189166
188372
|
}
|
|
188373
|
+
if (input.loadVideoPrep === void 0) {
|
|
188374
|
+
throw new Error("Video preparation is not configured. Provide loadVideoPrep from @riverbankcms/media-react/video-prep.");
|
|
188375
|
+
}
|
|
188376
|
+
const { prepareBrowserVideoUpload } = await input.loadVideoPrep();
|
|
189167
188377
|
const result = await prepareBrowserVideoUpload({
|
|
189168
188378
|
file: input.file,
|
|
189169
188379
|
intent: input.videoPrepIntent,
|
|
@@ -189323,7 +188533,6 @@ var init_useApiMediaUploader = __esm({
|
|
|
189323
188533
|
init_common();
|
|
189324
188534
|
init_request();
|
|
189325
188535
|
init_common();
|
|
189326
|
-
init_videoPrepBrowser();
|
|
189327
188536
|
init_classification();
|
|
189328
188537
|
MediaUploaderError = class extends Error {
|
|
189329
188538
|
constructor(message2, options = {}) {
|
|
@@ -189341,6 +188550,7 @@ var init_useApiMediaUploader = __esm({
|
|
|
189341
188550
|
autoClassify = true,
|
|
189342
188551
|
uploadIntent,
|
|
189343
188552
|
videoPrepIntent,
|
|
188553
|
+
loadVideoPrep,
|
|
189344
188554
|
onClassification,
|
|
189345
188555
|
logger: providedLogger
|
|
189346
188556
|
}) => {
|
|
@@ -189373,6 +188583,7 @@ var init_useApiMediaUploader = __esm({
|
|
|
189373
188583
|
const prepared = await maybePrepareVideoFile({
|
|
189374
188584
|
file,
|
|
189375
188585
|
videoPrepIntent: resolvedVideoPrepIntent,
|
|
188586
|
+
loadVideoPrep,
|
|
189376
188587
|
onProgress
|
|
189377
188588
|
});
|
|
189378
188589
|
preparedVideo = prepared.videoPrepResult;
|
|
@@ -189437,7 +188648,7 @@ var init_useApiMediaUploader = __esm({
|
|
|
189437
188648
|
}
|
|
189438
188649
|
return asset;
|
|
189439
188650
|
},
|
|
189440
|
-
[siteId, autoClassify, onClassification, uploadIntent, videoPrepIntent]
|
|
188651
|
+
[siteId, autoClassify, onClassification, uploadIntent, videoPrepIntent, loadVideoPrep]
|
|
189441
188652
|
);
|
|
189442
188653
|
};
|
|
189443
188654
|
putBlobToSignedUrl = ({
|
|
@@ -189882,7 +189093,7 @@ function debounce(callback, delay) {
|
|
|
189882
189093
|
return result;
|
|
189883
189094
|
}
|
|
189884
189095
|
var isObject4;
|
|
189885
|
-
var
|
|
189096
|
+
var init_utils13 = __esm({
|
|
189886
189097
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/utils/index.js"() {
|
|
189887
189098
|
isObject4 = function(term) {
|
|
189888
189099
|
return term !== null && typeof term === "object";
|
|
@@ -190182,11 +189393,11 @@ function getCloserSize(candidates, reference, sizeRestrictions2, aspectRatio2) {
|
|
|
190182
189393
|
};
|
|
190183
189394
|
return traverse2() || traverse2(true);
|
|
190184
189395
|
}
|
|
190185
|
-
var
|
|
189396
|
+
var init_utils14 = __esm({
|
|
190186
189397
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/utils.js"() {
|
|
190187
189398
|
init_tslib_es6();
|
|
190188
189399
|
init_constants6();
|
|
190189
|
-
|
|
189400
|
+
init_utils13();
|
|
190190
189401
|
}
|
|
190191
189402
|
});
|
|
190192
189403
|
|
|
@@ -190298,8 +189509,8 @@ function isConsistentState(state, settings) {
|
|
|
190298
189509
|
var init_helpers3 = __esm({
|
|
190299
189510
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/helpers.js"() {
|
|
190300
189511
|
init_tslib_es6();
|
|
189512
|
+
init_utils13();
|
|
190301
189513
|
init_utils14();
|
|
190302
|
-
init_utils15();
|
|
190303
189514
|
init_sizeRestrictions();
|
|
190304
189515
|
}
|
|
190305
189516
|
});
|
|
@@ -190356,8 +189567,8 @@ function calculateAreaSizeRestrictions(state, settings) {
|
|
|
190356
189567
|
var init_sizeRestrictions = __esm({
|
|
190357
189568
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/sizeRestrictions.js"() {
|
|
190358
189569
|
init_tslib_es6();
|
|
189570
|
+
init_utils13();
|
|
190359
189571
|
init_utils14();
|
|
190360
|
-
init_utils15();
|
|
190361
189572
|
init_helpers3();
|
|
190362
189573
|
}
|
|
190363
189574
|
});
|
|
@@ -190368,13 +189579,13 @@ function copyState(state) {
|
|
|
190368
189579
|
}
|
|
190369
189580
|
var init_copyState = __esm({
|
|
190370
189581
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/copyState.js"() {
|
|
190371
|
-
|
|
189582
|
+
init_utils13();
|
|
190372
189583
|
}
|
|
190373
189584
|
});
|
|
190374
189585
|
|
|
190375
189586
|
// ../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/types/index.js
|
|
190376
189587
|
var ImageRestriction, Priority;
|
|
190377
|
-
var
|
|
189588
|
+
var init_types27 = __esm({
|
|
190378
189589
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/types/index.js"() {
|
|
190379
189590
|
(function(ImageRestriction2) {
|
|
190380
189591
|
ImageRestriction2["fillArea"] = "fillArea";
|
|
@@ -190418,7 +189629,7 @@ function approximateSize(params) {
|
|
|
190418
189629
|
}
|
|
190419
189630
|
var init_approximateSize = __esm({
|
|
190420
189631
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/approximateSize.js"() {
|
|
190421
|
-
|
|
189632
|
+
init_utils14();
|
|
190422
189633
|
}
|
|
190423
189634
|
});
|
|
190424
189635
|
|
|
@@ -190444,7 +189655,7 @@ function fitVisibleArea(state, settings) {
|
|
|
190444
189655
|
var init_fitVisibleArea = __esm({
|
|
190445
189656
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/fitVisibleArea.js"() {
|
|
190446
189657
|
init_tslib_es6();
|
|
190447
|
-
|
|
189658
|
+
init_utils14();
|
|
190448
189659
|
init_helpers3();
|
|
190449
189660
|
init_copyState();
|
|
190450
189661
|
init_approximateSize();
|
|
@@ -190458,7 +189669,7 @@ function moveCoordinatesAlgorithm(coordinates, directions3, positionRestrictions
|
|
|
190458
189669
|
}
|
|
190459
189670
|
var init_moveCoordinatesAlgorithm = __esm({
|
|
190460
189671
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/moveCoordinatesAlgorithm.js"() {
|
|
190461
|
-
|
|
189672
|
+
init_utils14();
|
|
190462
189673
|
}
|
|
190463
189674
|
});
|
|
190464
189675
|
|
|
@@ -190532,8 +189743,8 @@ var SetCoordinatesMode;
|
|
|
190532
189743
|
var init_setCoordinates = __esm({
|
|
190533
189744
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/setCoordinates.js"() {
|
|
190534
189745
|
init_tslib_es6();
|
|
189746
|
+
init_utils13();
|
|
190535
189747
|
init_utils14();
|
|
190536
|
-
init_utils15();
|
|
190537
189748
|
init_helpers3();
|
|
190538
189749
|
init_copyState();
|
|
190539
189750
|
init_approximateSize();
|
|
@@ -190573,7 +189784,7 @@ function fitCoordinates(state, settings) {
|
|
|
190573
189784
|
var init_fitCoordinates = __esm({
|
|
190574
189785
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/fitCoordinates.js"() {
|
|
190575
189786
|
init_tslib_es6();
|
|
190576
|
-
|
|
189787
|
+
init_utils14();
|
|
190577
189788
|
init_helpers3();
|
|
190578
189789
|
init_copyState();
|
|
190579
189790
|
init_approximateSize();
|
|
@@ -190639,7 +189850,7 @@ function createState(options, settings) {
|
|
|
190639
189850
|
var init_createState = __esm({
|
|
190640
189851
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/createState.js"() {
|
|
190641
189852
|
init_helpers3();
|
|
190642
|
-
|
|
189853
|
+
init_types27();
|
|
190643
189854
|
init_setCoordinates();
|
|
190644
189855
|
init_setVisibleArea();
|
|
190645
189856
|
}
|
|
@@ -190657,7 +189868,7 @@ function moveCoordinates(state, settings, directions3) {
|
|
|
190657
189868
|
}
|
|
190658
189869
|
var init_moveCoordinates = __esm({
|
|
190659
189870
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/moveCoordinates.js"() {
|
|
190660
|
-
|
|
189871
|
+
init_utils14();
|
|
190661
189872
|
init_helpers3();
|
|
190662
189873
|
init_copyState();
|
|
190663
189874
|
}
|
|
@@ -190947,8 +190158,8 @@ var init_resizeCoordinatesAlgorithm = __esm({
|
|
|
190947
190158
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/resizeCoordinatesAlgorithm.js"() {
|
|
190948
190159
|
init_tslib_es6();
|
|
190949
190160
|
init_constants6();
|
|
190161
|
+
init_utils13();
|
|
190950
190162
|
init_utils14();
|
|
190951
|
-
init_utils15();
|
|
190952
190163
|
init_moveCoordinatesAlgorithm();
|
|
190953
190164
|
}
|
|
190954
190165
|
});
|
|
@@ -190971,7 +190182,7 @@ function resizeCoordinates(state, settings, anchor, directions3, options) {
|
|
|
190971
190182
|
var init_resizeCoordinates = __esm({
|
|
190972
190183
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/resizeCoordinates.js"() {
|
|
190973
190184
|
init_tslib_es6();
|
|
190974
|
-
|
|
190185
|
+
init_utils14();
|
|
190975
190186
|
init_helpers3();
|
|
190976
190187
|
init_copyState();
|
|
190977
190188
|
init_resizeCoordinatesAlgorithm();
|
|
@@ -191005,7 +190216,7 @@ function setBoundary(state, settings, boundary) {
|
|
|
191005
190216
|
var init_setBoundary = __esm({
|
|
191006
190217
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/setBoundary.js"() {
|
|
191007
190218
|
init_tslib_es6();
|
|
191008
|
-
|
|
190219
|
+
init_utils14();
|
|
191009
190220
|
init_helpers3();
|
|
191010
190221
|
init_copyState();
|
|
191011
190222
|
init_fitCoordinates();
|
|
@@ -191044,8 +190255,8 @@ function rotateImageAlgorithm(state, settings, rotate) {
|
|
|
191044
190255
|
var init_rotateImageAlgorithm = __esm({
|
|
191045
190256
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/rotateImageAlgorithm.js"() {
|
|
191046
190257
|
init_tslib_es6();
|
|
190258
|
+
init_utils13();
|
|
191047
190259
|
init_utils14();
|
|
191048
|
-
init_utils15();
|
|
191049
190260
|
init_sizeRestrictions();
|
|
191050
190261
|
init_helpers3();
|
|
191051
190262
|
init_copyState();
|
|
@@ -191094,7 +190305,7 @@ function flipImageAlgorithm(state, settings, horizontal, vertical) {
|
|
|
191094
190305
|
}
|
|
191095
190306
|
var init_flipImageAlgorithm = __esm({
|
|
191096
190307
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/flipImageAlgorithm.js"() {
|
|
191097
|
-
|
|
190308
|
+
init_utils14();
|
|
191098
190309
|
init_helpers3();
|
|
191099
190310
|
init_copyState();
|
|
191100
190311
|
}
|
|
@@ -191180,8 +190391,8 @@ function transformImageAlgorithm(state, settings, transform) {
|
|
|
191180
190391
|
}
|
|
191181
190392
|
var init_transformImageAlgorithm = __esm({
|
|
191182
190393
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/transformImageAlgorithm.js"() {
|
|
190394
|
+
init_utils13();
|
|
191183
190395
|
init_utils14();
|
|
191184
|
-
init_utils15();
|
|
191185
190396
|
init_helpers3();
|
|
191186
190397
|
init_copyState();
|
|
191187
190398
|
}
|
|
@@ -191247,7 +190458,7 @@ function reconcileState(state, settings) {
|
|
|
191247
190458
|
var init_reconcileState = __esm({
|
|
191248
190459
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/reconcileState.js"() {
|
|
191249
190460
|
init_tslib_es6();
|
|
191250
|
-
|
|
190461
|
+
init_utils14();
|
|
191251
190462
|
init_sizeRestrictions();
|
|
191252
190463
|
init_helpers3();
|
|
191253
190464
|
init_copyState();
|
|
@@ -191330,7 +190541,7 @@ function normalizeImageTransform(state, transform) {
|
|
|
191330
190541
|
}
|
|
191331
190542
|
var init_normalize2 = __esm({
|
|
191332
190543
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/normalize.js"() {
|
|
191333
|
-
|
|
190544
|
+
init_utils13();
|
|
191334
190545
|
init_helpers3();
|
|
191335
190546
|
}
|
|
191336
190547
|
});
|
|
@@ -191416,7 +190627,7 @@ function wheelEventToImageTransform(event, container, ratio2) {
|
|
|
191416
190627
|
}
|
|
191417
190628
|
var init_imageTransforms = __esm({
|
|
191418
190629
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/imageTransforms.js"() {
|
|
191419
|
-
|
|
190630
|
+
init_utils13();
|
|
191420
190631
|
}
|
|
191421
190632
|
});
|
|
191422
190633
|
|
|
@@ -191508,7 +190719,7 @@ function defaultVisibleArea(state, settings) {
|
|
|
191508
190719
|
var init_defaultVisibleArea = __esm({
|
|
191509
190720
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultVisibleArea.js"() {
|
|
191510
190721
|
init_tslib_es6();
|
|
191511
|
-
|
|
190722
|
+
init_utils14();
|
|
191512
190723
|
init_helpers3();
|
|
191513
190724
|
}
|
|
191514
190725
|
});
|
|
@@ -191541,7 +190752,7 @@ function defaultSize(state, settings) {
|
|
|
191541
190752
|
var init_defaultSize = __esm({
|
|
191542
190753
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultSize.js"() {
|
|
191543
190754
|
init_tslib_es6();
|
|
191544
|
-
|
|
190755
|
+
init_utils14();
|
|
191545
190756
|
init_helpers3();
|
|
191546
190757
|
init_approximateSize();
|
|
191547
190758
|
}
|
|
@@ -191561,7 +190772,7 @@ function pixelsRestrictions(state, settings) {
|
|
|
191561
190772
|
}
|
|
191562
190773
|
var init_defaultSizeRestrictions = __esm({
|
|
191563
190774
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultSizeRestrictions.js"() {
|
|
191564
|
-
|
|
190775
|
+
init_utils13();
|
|
191565
190776
|
}
|
|
191566
190777
|
});
|
|
191567
190778
|
|
|
@@ -191628,9 +190839,9 @@ function defaultAreaPositionRestrictions(state, settings) {
|
|
|
191628
190839
|
}
|
|
191629
190840
|
var init_defaultAreaPositionRestrictions = __esm({
|
|
191630
190841
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultAreaPositionRestrictions.js"() {
|
|
191631
|
-
|
|
190842
|
+
init_utils14();
|
|
191632
190843
|
init_helpers3();
|
|
191633
|
-
|
|
190844
|
+
init_types27();
|
|
191634
190845
|
}
|
|
191635
190846
|
});
|
|
191636
190847
|
|
|
@@ -191661,9 +190872,9 @@ function defaultAreaSizeRestrictions(state, settings) {
|
|
|
191661
190872
|
}
|
|
191662
190873
|
var init_defaultAreaSizeRestrictions = __esm({
|
|
191663
190874
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultAreaSizeRestrictions.js"() {
|
|
191664
|
-
|
|
190875
|
+
init_utils14();
|
|
191665
190876
|
init_helpers3();
|
|
191666
|
-
|
|
190877
|
+
init_types27();
|
|
191667
190878
|
}
|
|
191668
190879
|
});
|
|
191669
190880
|
|
|
@@ -191691,8 +190902,8 @@ function defaultStencilConstraints(rawSettings, stencilProps) {
|
|
|
191691
190902
|
}
|
|
191692
190903
|
var init_defaultStencilConstraints = __esm({
|
|
191693
190904
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultStencilConstraints.js"() {
|
|
190905
|
+
init_utils13();
|
|
191694
190906
|
init_utils14();
|
|
191695
|
-
init_utils15();
|
|
191696
190907
|
}
|
|
191697
190908
|
});
|
|
191698
190909
|
|
|
@@ -191760,8 +190971,8 @@ function createDefaultSettings(params) {
|
|
|
191760
190971
|
var init_defaults5 = __esm({
|
|
191761
190972
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/index.js"() {
|
|
191762
190973
|
init_tslib_es6();
|
|
190974
|
+
init_utils13();
|
|
191763
190975
|
init_utils14();
|
|
191764
|
-
init_utils15();
|
|
191765
190976
|
init_sizeRestrictions();
|
|
191766
190977
|
init_defaultPositionRestrictions();
|
|
191767
190978
|
init_defaultVisibleArea();
|
|
@@ -191791,7 +191002,7 @@ var AbstractCropperInstance;
|
|
|
191791
191002
|
var init_AbstractCropperInstance = __esm({
|
|
191792
191003
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/instance/AbstractCropperInstance.js"() {
|
|
191793
191004
|
init_tslib_es6();
|
|
191794
|
-
|
|
191005
|
+
init_utils13();
|
|
191795
191006
|
init_helpers3();
|
|
191796
191007
|
init_copyState();
|
|
191797
191008
|
init_setCoordinates();
|
|
@@ -192437,8 +191648,8 @@ function drawCroppedArea(state, image, resultCanvas, spareCanvas, options) {
|
|
|
192437
191648
|
var init_canvas = __esm({
|
|
192438
191649
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/canvas/index.js"() {
|
|
192439
191650
|
init_tslib_es6();
|
|
191651
|
+
init_utils13();
|
|
192440
191652
|
init_utils14();
|
|
192441
|
-
init_utils15();
|
|
192442
191653
|
init_helpers3();
|
|
192443
191654
|
init_approximateSize();
|
|
192444
191655
|
}
|
|
@@ -192819,8 +192030,8 @@ var XHR_DONE;
|
|
|
192819
192030
|
var init_image3 = __esm({
|
|
192820
192031
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/image/index.js"() {
|
|
192821
192032
|
init_tslib_es6();
|
|
192033
|
+
init_utils13();
|
|
192822
192034
|
init_utils14();
|
|
192823
|
-
init_utils15();
|
|
192824
192035
|
init_helpers3();
|
|
192825
192036
|
XHR_DONE = 4;
|
|
192826
192037
|
}
|
|
@@ -192829,10 +192040,10 @@ var init_image3 = __esm({
|
|
|
192829
192040
|
// ../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/index.js
|
|
192830
192041
|
var init_advanced_cropper = __esm({
|
|
192831
192042
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/index.js"() {
|
|
192043
|
+
init_utils13();
|
|
192832
192044
|
init_utils14();
|
|
192833
|
-
init_utils15();
|
|
192834
192045
|
init_helpers3();
|
|
192835
|
-
|
|
192046
|
+
init_types27();
|
|
192836
192047
|
init_imageTransforms();
|
|
192837
192048
|
init_interactions();
|
|
192838
192049
|
init_defaultBoundary();
|
|
@@ -192849,7 +192060,7 @@ var init_advanced_cropper = __esm({
|
|
|
192849
192060
|
// ../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/index.js
|
|
192850
192061
|
var init_service = __esm({
|
|
192851
192062
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/index.js"() {
|
|
192852
|
-
|
|
192063
|
+
init_utils14();
|
|
192853
192064
|
init_helpers3();
|
|
192854
192065
|
}
|
|
192855
192066
|
});
|
|
@@ -193015,8 +192226,8 @@ function fixedStencil(state, settings, action) {
|
|
|
193015
192226
|
var init_stencil_size = __esm({
|
|
193016
192227
|
"../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/extensions/stencil-size/index.js"() {
|
|
193017
192228
|
init_tslib_es6();
|
|
192229
|
+
init_utils13();
|
|
193018
192230
|
init_utils14();
|
|
193019
|
-
init_utils15();
|
|
193020
192231
|
init_helpers3();
|
|
193021
192232
|
init_copyState();
|
|
193022
192233
|
init_approximateSize();
|
|
@@ -196178,7 +195389,7 @@ function classifyMimeForPreview(mimeType) {
|
|
|
196178
195389
|
}
|
|
196179
195390
|
if (mimeType === "application/zip") return { label: "ZIP", Icon: Archive };
|
|
196180
195391
|
if (mimeType.startsWith("text/") || mimeType.includes("document")) return { label: "Document", Icon: FileText };
|
|
196181
|
-
return { label: "File", Icon:
|
|
195392
|
+
return { label: "File", Icon: File };
|
|
196182
195393
|
}
|
|
196183
195394
|
function cx2(...values) {
|
|
196184
195395
|
return values.filter(Boolean).join(" ");
|
|
@@ -196199,7 +195410,7 @@ function isSvgUrl(url) {
|
|
|
196199
195410
|
return normalized.endsWith(".svg");
|
|
196200
195411
|
}
|
|
196201
195412
|
var DEFAULT_HOTSPOT, hasMediaValue, isImageValue, isVideoValue, isAudioValue, isDocumentValue, isSpreadsheetValue, isArchiveValue, isSvgValue;
|
|
196202
|
-
var
|
|
195413
|
+
var init_utils15 = __esm({
|
|
196203
195414
|
"../media-editor/src/utils.ts"() {
|
|
196204
195415
|
DEFAULT_HOTSPOT = { x: 0.5, y: 0.5, radius: 0.35 };
|
|
196205
195416
|
hasMediaValue = (value) => Boolean(value && (value.assetId || value.storagePath || value.src || value.identifier));
|
|
@@ -196280,7 +195491,7 @@ var init_MediaPickerDialog = __esm({
|
|
|
196280
195491
|
init_src5();
|
|
196281
195492
|
init_lucide_react();
|
|
196282
195493
|
init_FileAssetPreview();
|
|
196283
|
-
|
|
195494
|
+
init_utils15();
|
|
196284
195495
|
init_mediaKinds();
|
|
196285
195496
|
MediaPickerDialog = ({
|
|
196286
195497
|
allowedKinds,
|
|
@@ -196504,7 +195715,7 @@ var init_MediaPreview = __esm({
|
|
|
196504
195715
|
init_src();
|
|
196505
195716
|
init_lucide_react();
|
|
196506
195717
|
init_src7();
|
|
196507
|
-
|
|
195718
|
+
init_utils15();
|
|
196508
195719
|
init_context3();
|
|
196509
195720
|
MediaPreview = ({
|
|
196510
195721
|
value,
|
|
@@ -196593,7 +195804,7 @@ var init_MediaPreview = __esm({
|
|
|
196593
195804
|
document2 ? /* @__PURE__ */ jsx(FileText, { className: "h-8 w-8", "aria-hidden": "true" }) : null,
|
|
196594
195805
|
spreadsheet ? /* @__PURE__ */ jsx(FileSpreadsheet, { className: "h-8 w-8", "aria-hidden": "true" }) : null,
|
|
196595
195806
|
archive ? /* @__PURE__ */ jsx(FileArchive, { className: "h-8 w-8", "aria-hidden": "true" }) : null,
|
|
196596
|
-
!document2 && !spreadsheet && !archive ? /* @__PURE__ */ jsx(
|
|
195807
|
+
!document2 && !spreadsheet && !archive ? /* @__PURE__ */ jsx(File, { className: "h-8 w-8", "aria-hidden": "true" }) : null,
|
|
196597
195808
|
/* @__PURE__ */ jsx("p", { className: "max-w-full truncate", children: fileLabel })
|
|
196598
195809
|
] }) : null,
|
|
196599
195810
|
!hasValue ? /* @__PURE__ */ jsxs(
|
|
@@ -196801,7 +196012,7 @@ var ASPECT_MATCH_EPSILON;
|
|
|
196801
196012
|
var init_transformModel = __esm({
|
|
196802
196013
|
"../media-editor/src/transformModel.ts"() {
|
|
196803
196014
|
init_src5();
|
|
196804
|
-
|
|
196015
|
+
init_utils15();
|
|
196805
196016
|
ASPECT_MATCH_EPSILON = 1e-6;
|
|
196806
196017
|
}
|
|
196807
196018
|
});
|
|
@@ -196850,7 +196061,7 @@ var init_MediaEditor = __esm({
|
|
|
196850
196061
|
init_debug();
|
|
196851
196062
|
init_mediaKinds();
|
|
196852
196063
|
init_transformModel();
|
|
196853
|
-
|
|
196064
|
+
init_utils15();
|
|
196854
196065
|
MEDIA_PICKER_PAGE_SIZE = 18;
|
|
196855
196066
|
MediaEditor = ({
|
|
196856
196067
|
value,
|
|
@@ -196877,6 +196088,7 @@ var init_MediaEditor = __esm({
|
|
|
196877
196088
|
const scopedUploader = useApiMediaUploader({
|
|
196878
196089
|
siteId: context.siteId,
|
|
196879
196090
|
apiClient: context.apiClient,
|
|
196091
|
+
...context.uploaderOptions,
|
|
196880
196092
|
uploadIntent,
|
|
196881
196093
|
videoPrepIntent
|
|
196882
196094
|
});
|
|
@@ -197548,13 +196760,24 @@ function MediaEditorProvider({
|
|
|
197548
196760
|
apiClient,
|
|
197549
196761
|
repo,
|
|
197550
196762
|
uploader,
|
|
196763
|
+
uploaderOptions,
|
|
197551
196764
|
getPublicUrl: computePublicUrl,
|
|
197552
196765
|
registerMediaAsset,
|
|
197553
196766
|
bearerToken,
|
|
197554
196767
|
mediaAssetIndex: imageResolveContext.mediaAssetIndex,
|
|
197555
196768
|
imageResolveContext
|
|
197556
196769
|
}),
|
|
197557
|
-
[
|
|
196770
|
+
[
|
|
196771
|
+
apiClient,
|
|
196772
|
+
bearerToken,
|
|
196773
|
+
computePublicUrl,
|
|
196774
|
+
imageResolveContext,
|
|
196775
|
+
registerMediaAsset,
|
|
196776
|
+
repo,
|
|
196777
|
+
siteId,
|
|
196778
|
+
uploader,
|
|
196779
|
+
uploaderOptions
|
|
196780
|
+
]
|
|
197558
196781
|
);
|
|
197559
196782
|
return /* @__PURE__ */ jsx(MediaEditorContextProvider, { value, children: /* @__PURE__ */ jsx(ImageResolveContextProvider, { value: imageResolveContext, children }) });
|
|
197560
196783
|
}
|
|
@@ -199282,7 +198505,7 @@ var init_dateTimeUtils = __esm({
|
|
|
199282
198505
|
});
|
|
199283
198506
|
|
|
199284
198507
|
// ../block-form/src/widgets/DateTimeField/utils/index.ts
|
|
199285
|
-
var
|
|
198508
|
+
var init_utils16 = __esm({
|
|
199286
198509
|
"../block-form/src/widgets/DateTimeField/utils/index.ts"() {
|
|
199287
198510
|
init_dateTimeUtils();
|
|
199288
198511
|
}
|
|
@@ -199488,7 +198711,7 @@ var init_DateTimeField = __esm({
|
|
|
199488
198711
|
init_src();
|
|
199489
198712
|
init_FieldFrame();
|
|
199490
198713
|
init_DateField2();
|
|
199491
|
-
|
|
198714
|
+
init_utils16();
|
|
199492
198715
|
}
|
|
199493
198716
|
});
|
|
199494
198717
|
|
|
@@ -199583,7 +198806,7 @@ var init_slugUtils = __esm({
|
|
|
199583
198806
|
});
|
|
199584
198807
|
|
|
199585
198808
|
// ../block-form/src/widgets/SlugField/utils/index.ts
|
|
199586
|
-
var
|
|
198809
|
+
var init_utils17 = __esm({
|
|
199587
198810
|
"../block-form/src/widgets/SlugField/utils/index.ts"() {
|
|
199588
198811
|
init_pathUtils();
|
|
199589
198812
|
init_slugUtils();
|
|
@@ -199667,7 +198890,7 @@ var DEFAULT_SOURCE_FIELD_ID, DEFAULT_STATUS_FIELD_ID, DRAFT_STATUS;
|
|
|
199667
198890
|
var init_useSlugAutoGeneration = __esm({
|
|
199668
198891
|
"../block-form/src/widgets/SlugField/hooks/useSlugAutoGeneration.ts"() {
|
|
199669
198892
|
init_types22();
|
|
199670
|
-
|
|
198893
|
+
init_utils17();
|
|
199671
198894
|
DEFAULT_SOURCE_FIELD_ID = "title";
|
|
199672
198895
|
DEFAULT_STATUS_FIELD_ID = "status";
|
|
199673
198896
|
DRAFT_STATUS = "draft";
|
|
@@ -199741,7 +198964,7 @@ var init_SlugField = __esm({
|
|
|
199741
198964
|
init_src();
|
|
199742
198965
|
init_FieldFrame();
|
|
199743
198966
|
init_hooks6();
|
|
199744
|
-
|
|
198967
|
+
init_utils17();
|
|
199745
198968
|
}
|
|
199746
198969
|
});
|
|
199747
198970
|
|
|
@@ -201701,7 +200924,7 @@ function getEntryPickerOptionValueForStoredValue(storedValue, items) {
|
|
|
201701
200924
|
if (!matched) return isNonEmptyString(storedValue) ? storedValue : null;
|
|
201702
200925
|
return matched.value;
|
|
201703
200926
|
}
|
|
201704
|
-
var
|
|
200927
|
+
var init_utils18 = __esm({
|
|
201705
200928
|
"../editor-blocks/src/widgets/entry-picker/utils.ts"() {
|
|
201706
200929
|
}
|
|
201707
200930
|
});
|
|
@@ -201802,7 +201025,7 @@ var init_EntryPickerField = __esm({
|
|
|
201802
201025
|
init_client4();
|
|
201803
201026
|
init_src();
|
|
201804
201027
|
init_EntryPickerWidgetProvider();
|
|
201805
|
-
|
|
201028
|
+
init_utils18();
|
|
201806
201029
|
VALID_VALUE_FROM = ["id", "identifier", "slug"];
|
|
201807
201030
|
}
|
|
201808
201031
|
});
|
|
@@ -201893,7 +201116,7 @@ function isSameLinkValue(a2, b3) {
|
|
|
201893
201116
|
function getDisplayTitle2(item) {
|
|
201894
201117
|
return item.title || item.draftTitle || "Untitled";
|
|
201895
201118
|
}
|
|
201896
|
-
var
|
|
201119
|
+
var init_utils19 = __esm({
|
|
201897
201120
|
"../editor-blocks/src/widgets/link/utils.ts"() {
|
|
201898
201121
|
init_navigation2();
|
|
201899
201122
|
init_src7();
|
|
@@ -201909,7 +201132,7 @@ function LinkPicker(props2) {
|
|
|
201909
201132
|
const { siteId, value, onChange, disabled, initialItems, className, adapters } = props2;
|
|
201910
201133
|
const [items, setItems] = useState(initialItems ?? []);
|
|
201911
201134
|
const [loading, setLoading] = useState(false);
|
|
201912
|
-
const [
|
|
201135
|
+
const [errorMessage, setErrorMessage] = useState(null);
|
|
201913
201136
|
const [activeTab, setActiveTab] = useState(getActiveTab(value));
|
|
201914
201137
|
const [searchQuery, setSearchQuery] = useState("");
|
|
201915
201138
|
useEffect(() => setActiveTab(getActiveTab(value)), [value]);
|
|
@@ -202076,7 +201299,7 @@ function LinkPicker(props2) {
|
|
|
202076
201299
|
},
|
|
202077
201300
|
item.routeId
|
|
202078
201301
|
);
|
|
202079
|
-
}) : /* @__PURE__ */ jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: loading ? "Loading\u2026" :
|
|
201302
|
+
}) : /* @__PURE__ */ jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: loading ? "Loading\u2026" : errorMessage ?? "No routable content yet" }) }),
|
|
202080
201303
|
internalSelectedItem ? /* @__PURE__ */ jsxs("div", { className: "rounded-md border border-border bg-muted/30 px-3 py-2 text-sm", children: [
|
|
202081
201304
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
|
|
202082
201305
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
@@ -202098,7 +201321,7 @@ function LinkPicker(props2) {
|
|
|
202098
201321
|
] }),
|
|
202099
201322
|
/* @__PURE__ */ jsx("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: internalSelectedItem.path })
|
|
202100
201323
|
] }) : null,
|
|
202101
|
-
|
|
201324
|
+
errorMessage ? /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: errorMessage }) : null
|
|
202102
201325
|
] }) }),
|
|
202103
201326
|
/* @__PURE__ */ jsx(Content5, { value: "external", className: "focus-visible:outline-none", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2 pt-3", children: [
|
|
202104
201327
|
/* @__PURE__ */ jsx(Label4, { htmlFor: "link-picker-external", children: "Full URL" }),
|
|
@@ -202143,7 +201366,7 @@ var init_LinkPicker = __esm({
|
|
|
202143
201366
|
init_dist30();
|
|
202144
201367
|
init_src();
|
|
202145
201368
|
init_lucide_react();
|
|
202146
|
-
|
|
201369
|
+
init_utils19();
|
|
202147
201370
|
}
|
|
202148
201371
|
});
|
|
202149
201372
|
function LinkPickerDialog({
|
|
@@ -203562,6 +202785,40 @@ function PreviewMediaField({
|
|
|
203562
202785
|
}
|
|
203563
202786
|
return /* @__PURE__ */ jsx(FieldFrame, { label: config.label, description: config.description, children: () => widget });
|
|
203564
202787
|
}
|
|
202788
|
+
function PreviewFileField({
|
|
202789
|
+
path,
|
|
202790
|
+
backend,
|
|
202791
|
+
config
|
|
202792
|
+
}) {
|
|
202793
|
+
const { value, setValue } = useField(path, backend);
|
|
202794
|
+
const isInlineVariant = config.ui?.variant === "inline";
|
|
202795
|
+
const hideLabel = config.ui?.hideLabel === true;
|
|
202796
|
+
const mediaPickerAutoOpen = config.ui?.mediaPickerAutoOpen === true;
|
|
202797
|
+
const showMediaPreview = config.ui?.showMediaPreview !== false;
|
|
202798
|
+
const showMediaOverlayActions = config.ui?.showMediaOverlayActions !== false;
|
|
202799
|
+
const handleChange = (next) => {
|
|
202800
|
+
setValue(next);
|
|
202801
|
+
};
|
|
202802
|
+
const widget = /* @__PURE__ */ jsx(
|
|
202803
|
+
MediaEditor,
|
|
202804
|
+
{
|
|
202805
|
+
value: value ?? void 0,
|
|
202806
|
+
onChange: handleChange,
|
|
202807
|
+
allowedKinds: config.fileKinds ?? [...PUBLIC_FILE_FIELD_KINDS],
|
|
202808
|
+
showAltInput: false,
|
|
202809
|
+
mediaPickerAutoOpen,
|
|
202810
|
+
showPreview: showMediaPreview,
|
|
202811
|
+
showActionOverlay: showMediaOverlayActions,
|
|
202812
|
+
fullWidth: isInlineVariant,
|
|
202813
|
+
previewVariant: isInlineVariant ? "thumbnail" : "default",
|
|
202814
|
+
showRemoveAction: !isInlineVariant
|
|
202815
|
+
}
|
|
202816
|
+
);
|
|
202817
|
+
if (isInlineVariant || hideLabel) {
|
|
202818
|
+
return widget;
|
|
202819
|
+
}
|
|
202820
|
+
return /* @__PURE__ */ jsx(FieldFrame, { label: config.label, description: config.description, children: () => widget });
|
|
202821
|
+
}
|
|
203565
202822
|
var init_PreviewMediaField = __esm({
|
|
203566
202823
|
"../preview-next/src/client/widgets/PreviewMediaField.tsx"() {
|
|
203567
202824
|
"use client";
|
|
@@ -203639,6 +202896,7 @@ var init_widgetOverrides = __esm({
|
|
|
203639
202896
|
init_PreviewMediaField();
|
|
203640
202897
|
previewWidgetOverrides = {
|
|
203641
202898
|
link: LinkField,
|
|
202899
|
+
file: PreviewFileField,
|
|
203642
202900
|
media: PreviewMediaField,
|
|
203643
202901
|
richText: RichTextField,
|
|
203644
202902
|
reference: ReferenceField,
|
|
@@ -205165,7 +204423,7 @@ var init_useBlockExpandState = __esm({
|
|
|
205165
204423
|
|
|
205166
204424
|
// ../editor-blocks/src/block-editor/utils.ts
|
|
205167
204425
|
var normalizeBlockListInitial, reindexBlockList;
|
|
205168
|
-
var
|
|
204426
|
+
var init_utils20 = __esm({
|
|
205169
204427
|
"../editor-blocks/src/block-editor/utils.ts"() {
|
|
205170
204428
|
normalizeBlockListInitial = (items) => {
|
|
205171
204429
|
const sorted = [...items].map((block, index2) => ({ ...block, orderIndex: block.orderIndex ?? index2 })).sort((a2, b3) => (a2.orderIndex ?? 0) - (b3.orderIndex ?? 0));
|
|
@@ -205236,7 +204494,7 @@ function useBlockCreation({
|
|
|
205236
204494
|
const [pickerOpen, setPickerOpen] = useState(false);
|
|
205237
204495
|
const [insertPosition, setInsertPosition] = useState(null);
|
|
205238
204496
|
const [creatingBlockName, setCreatingBlockName] = useState(null);
|
|
205239
|
-
const [
|
|
204497
|
+
const [errorMessage, setErrorMessage] = useState(null);
|
|
205240
204498
|
const openPicker = useCallback((position) => {
|
|
205241
204499
|
if (!allowCreation) return;
|
|
205242
204500
|
setInsertPosition(position);
|
|
@@ -205308,7 +204566,7 @@ function useBlockCreation({
|
|
|
205308
204566
|
return {
|
|
205309
204567
|
pickerOpen,
|
|
205310
204568
|
creatingBlockName,
|
|
205311
|
-
errorMessage
|
|
204569
|
+
errorMessage,
|
|
205312
204570
|
setErrorMessage,
|
|
205313
204571
|
insertPosition,
|
|
205314
204572
|
setInsertPosition,
|
|
@@ -205321,7 +204579,7 @@ var init_useBlockCreation = __esm({
|
|
|
205321
204579
|
"../editor-blocks/src/block-editor/hooks/useBlockCreation.ts"() {
|
|
205322
204580
|
"use client";
|
|
205323
204581
|
init_blocks2();
|
|
205324
|
-
|
|
204582
|
+
init_utils20();
|
|
205325
204583
|
init_recentBlocksTracker();
|
|
205326
204584
|
init_buildInsertBlockHistoryCommand();
|
|
205327
204585
|
}
|
|
@@ -205451,7 +204709,7 @@ var init_useBlockDuplication = __esm({
|
|
|
205451
204709
|
"use client";
|
|
205452
204710
|
init_blocks2();
|
|
205453
204711
|
init_src3();
|
|
205454
|
-
|
|
204712
|
+
init_utils20();
|
|
205455
204713
|
init_buildInsertBlockHistoryCommand();
|
|
205456
204714
|
}
|
|
205457
204715
|
});
|
|
@@ -205555,7 +204813,7 @@ var init_useBlockReorder = __esm({
|
|
|
205555
204813
|
init_blocks2();
|
|
205556
204814
|
init_src3();
|
|
205557
204815
|
init_sortable_esm2();
|
|
205558
|
-
|
|
204816
|
+
init_utils20();
|
|
205559
204817
|
}
|
|
205560
204818
|
});
|
|
205561
204819
|
|
|
@@ -206663,7 +205921,7 @@ var init_BlockEditor = __esm({
|
|
|
206663
205921
|
init_useBlockReorder();
|
|
206664
205922
|
init_reorderControlMode();
|
|
206665
205923
|
init_SortableBlockItem();
|
|
206666
|
-
|
|
205924
|
+
init_utils20();
|
|
206667
205925
|
init_client4();
|
|
206668
205926
|
BlockEditor = forwardRef(function BlockEditor2({
|
|
206669
205927
|
siteId,
|
|
@@ -206687,7 +205945,7 @@ var init_BlockEditor = __esm({
|
|
|
206687
205945
|
reorderControlMode = DEFAULT_REORDER_CONTROL_MODE
|
|
206688
205946
|
}, ref) {
|
|
206689
205947
|
const [blockList, setBlockList] = useState(() => normalizeBlockListInitial(blocks));
|
|
206690
|
-
const [
|
|
205948
|
+
const [errorMessage, setErrorMessage] = useState(null);
|
|
206691
205949
|
const [highlightedBlockId, setHighlightedBlockId] = useState(null);
|
|
206692
205950
|
const blockRefs = useRef(/* @__PURE__ */ new Map());
|
|
206693
205951
|
const highlightTimerRef = useRef(null);
|
|
@@ -206926,7 +206184,7 @@ var init_BlockEditor = __esm({
|
|
|
206926
206184
|
);
|
|
206927
206185
|
return /* @__PURE__ */ jsx(BlockListProvider, { value: contextValue, children: /* @__PURE__ */ jsxs("div", { className: "space-y-3 touch-pan-y", children: [
|
|
206928
206186
|
/* @__PURE__ */ jsx(HeaderActions, { headerLeftSlot }),
|
|
206929
|
-
|
|
206187
|
+
errorMessage ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-destructive bg-destructive/10 px-4 py-2 text-sm text-destructive", children: errorMessage }) : null,
|
|
206930
206188
|
hasBlocks ? /* @__PURE__ */ jsx(
|
|
206931
206189
|
DndContext,
|
|
206932
206190
|
{
|