@riverbankcms/sdk 0.70.3 → 0.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/_dts/api/src/contentTypes.d.ts +2 -1
  2. package/dist/_dts/block-form/src/client/index.d.ts +1 -1
  3. package/dist/_dts/block-form/src/fields/types.d.ts +14 -2
  4. package/dist/_dts/block-form/src/registry/schemas.d.ts +2 -0
  5. package/dist/_dts/block-form/src/widgets/MediaField/mediaFieldDefaults.d.ts +2 -2
  6. package/dist/_dts/block-form/src/widgets/MediaField/mediaFieldSchema.d.ts +2 -2
  7. package/dist/_dts/blocks/src/lib/media.d.ts +1 -1
  8. package/dist/_dts/blocks/src/system/blocks/appointment-booking.d.ts +1829 -149
  9. package/dist/_dts/blocks/src/system/blocks/blog-listing.d.ts +1829 -149
  10. package/dist/_dts/blocks/src/system/blocks/cart.d.ts +1829 -149
  11. package/dist/_dts/blocks/src/system/blocks/checkout.d.ts +1829 -149
  12. package/dist/_dts/blocks/src/system/blocks/collection.d.ts +1829 -149
  13. package/dist/_dts/blocks/src/system/blocks/cta-full.d.ts +1 -30727
  14. package/dist/_dts/blocks/src/system/blocks/events/event-spotlight.d.ts +11 -30827
  15. package/dist/_dts/blocks/src/system/blocks/faq.d.ts +1829 -149
  16. package/dist/_dts/blocks/src/system/blocks/file-download.d.ts +3 -3
  17. package/dist/_dts/blocks/src/system/blocks/gifting.d.ts +1829 -149
  18. package/dist/_dts/blocks/src/system/blocks/media-text.d.ts +106 -1
  19. package/dist/_dts/blocks/src/system/blocks/product-detail.d.ts +1829 -149
  20. package/dist/_dts/blocks/src/system/blocks/product-list.d.ts +1829 -149
  21. package/dist/_dts/blocks/src/system/blocks/shop.d.ts +1829 -149
  22. package/dist/_dts/blocks/src/system/defineBlock.d.ts +3 -3
  23. package/dist/_dts/blocks/src/system/fragments/library/card.d.ts +2 -30793
  24. package/dist/_dts/blocks/src/system/fragments/library/ctaRow.d.ts +2 -30727
  25. package/dist/_dts/blocks/src/system/fragments/library/feedbackCallout.d.ts +2 -30779
  26. package/dist/_dts/blocks/src/system/fragments/library/heroCtaRow.d.ts +33 -30743
  27. package/dist/_dts/blocks/src/system/fragments/library/sectionState.d.ts +2 -30770
  28. package/dist/_dts/blocks/src/system/fragments/types.d.ts +8 -7
  29. package/dist/_dts/blocks/src/system/manifest/derivedContent.d.ts +7 -5
  30. package/dist/_dts/blocks/src/system/manifest/fieldValidation/index.d.ts +1 -1
  31. package/dist/_dts/blocks/src/system/manifest/schema.d.ts +192 -3
  32. package/dist/_dts/blocks/src/system/runtime/nodes/file-download.d.ts +1 -1
  33. package/dist/_dts/content-model/src/content-types/schema.d.ts +7 -0
  34. package/dist/_dts/content-model/src/contentManifest.d.ts +4 -1
  35. package/dist/_dts/content-model/src/templates/bindingTypeCompatibility.d.ts +1 -1
  36. package/dist/_dts/core/src/index.d.ts +1 -1
  37. package/dist/_dts/core/src/planner.d.ts +4 -0
  38. package/dist/_dts/db/src/generated/supabase/database.types.d.ts +53 -20
  39. package/dist/_dts/editor-blocks/src/index.d.ts +1 -1
  40. package/dist/_dts/editor-blocks/src/media/MediaField.d.ts +6 -5
  41. package/dist/_dts/media-core/src/videoSlotPolicy.d.ts +0 -1
  42. package/dist/_dts/media-editor/src/context.d.ts +4 -1
  43. package/dist/_dts/media-react/src/hooks/useApiMediaUploader.d.ts +8 -1
  44. package/dist/_dts/media-react/src/index.d.ts +1 -5
  45. package/dist/_dts/preview-next/src/client/sdk/SdkPreviewMode.d.ts +1 -0
  46. package/dist/_dts/preview-next/src/client/widgets/PreviewMediaField.d.ts +2 -1
  47. package/dist/_dts/preview-next/src/client/widgets/widgetOverrides.d.ts +1 -0
  48. package/dist/_dts/sdk/src/config/field-definitions.d.ts +6 -2
  49. package/dist/_dts/sdk/src/config/typed-entries.d.ts +4 -2
  50. package/dist/_dts/sdk/src/contracts/system-block-content.d.ts +2 -1
  51. package/dist/_dts/sdk/src/manifest/prompt/examples/cta.d.ts +5 -5
  52. package/dist/_dts/sdk/src/manifest/prompt/examples/features-grid.d.ts +2 -2
  53. package/dist/_dts/sdk/src/manifest/prompt/examples/hero.d.ts +2 -2
  54. package/dist/_dts/sdk/src/manifest/prompt/examples/pricing.d.ts +10 -10
  55. package/dist/_dts/sdk/src/manifest/prompt/examples/testimonials.d.ts +4 -4
  56. package/dist/_dts/sdk/src/manifest/validation/output-schema.d.ts +11 -1
  57. package/dist/_dts/sdk/src/preview-next/client/index.d.ts +19 -1
  58. package/dist/_dts/sdk/src/public-api/contracts.d.ts +2 -1
  59. package/dist/_dts/sdk/src/version.d.ts +1 -1
  60. package/dist/cli/index.mjs +395 -190
  61. package/dist/cli/init-docs/content/workflow-preview-mode.md +167 -0
  62. package/dist/client/client.mjs +243 -203
  63. package/dist/client/hooks.mjs +172 -121
  64. package/dist/client/rendering/client.mjs +148 -112
  65. package/dist/client/rendering/islands.mjs +80 -31
  66. package/dist/client/rendering.mjs +242 -202
  67. package/dist/preview-next/client/index.mjs +60 -10
  68. package/dist/preview-next/client/runtime.mjs +408 -1141
  69. package/dist/server/components.mjs +219 -171
  70. package/dist/server/config-template-validation.mjs +31 -1
  71. package/dist/server/config-validation.mjs +172 -121
  72. package/dist/server/config.mjs +172 -121
  73. package/dist/server/data.mjs +172 -121
  74. package/dist/server/index.mjs +1 -1
  75. package/dist/server/next.mjs +220 -172
  76. package/dist/server/page-converter.mjs +379 -185
  77. package/dist/server/prebuild.mjs +1 -1
  78. package/dist/server/rendering/server.mjs +219 -171
  79. package/dist/server/rendering.mjs +219 -171
  80. package/dist/server/routing.mjs +175 -124
  81. package/dist/server/server.mjs +173 -122
  82. package/package.json +6 -1
@@ -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, File2;
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
- File2 = createLucideIcon("file", __iconNode638);
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: () => File2,
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: () => File2,
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: () => File2,
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: () => File2,
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: errorMessage3,
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" : errorMessage3 ?? "No routable content yet" }) }),
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
- errorMessage3 ? /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: errorMessage3 }) : null
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 [errorMessage3, setErrorMessage] = useState(null);
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: errorMessage3,
94345
+ errorMessage,
94355
94346
  onSearchChange: setSearchQuery,
94356
94347
  onSelectRouteId: setSelectedRouteId
94357
94348
  }
@@ -97700,7 +97691,13 @@ function toFieldDefinition(field, context = {}) {
97700
97691
  return {
97701
97692
  ...base2,
97702
97693
  type: "media",
97703
- mediaKinds: field.mediaKinds && field.mediaKinds.length ? field.mediaKinds : ["image"]
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"]
97704
97701
  };
97705
97702
  case "boolean":
97706
97703
  return {
@@ -97803,6 +97800,13 @@ function toFieldDefinition(field, context = {}) {
97803
97800
  return null;
97804
97801
  }
97805
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
+ }
97806
97810
  function startCase(value) {
97807
97811
  return value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[-_]/g, " ").replace(/\s+/g, " ").replace(/^./, (match2) => match2.toUpperCase());
97808
97812
  }
@@ -97890,7 +97894,7 @@ function normalizeFieldUi(value) {
97890
97894
  }
97891
97895
  return value;
97892
97896
  }
97893
- var DEFAULT_BUTTON_VARIANTS;
97897
+ var DEFAULT_BUTTON_VARIANTS, DISPLAY_MEDIA_KINDS;
97894
97898
  var init_contentManifest = __esm({
97895
97899
  "../content-model/src/contentManifest.ts"() {
97896
97900
  init_referenceFields();
@@ -97900,6 +97904,7 @@ var init_contentManifest = __esm({
97900
97904
  { value: "secondary", label: "Secondary" },
97901
97905
  { value: "outline", label: "Outline" }
97902
97906
  ];
97907
+ DISPLAY_MEDIA_KINDS = ["image", "video", "audio"];
97903
97908
  }
97904
97909
  });
97905
97910
 
@@ -98372,7 +98377,7 @@ var init_shared2 = __esm({
98372
98377
  init_metadataConfig();
98373
98378
  }
98374
98379
  });
98375
- var contentFieldTypes, BaseContentFieldSchema, ContentFieldSchema, RoutingSchema, LabelsSchema;
98380
+ var contentFieldTypes, FILE_FIELD_KINDS, LEGACY_MEDIA_KINDS, BaseContentFieldSchema, ContentFieldSchema, RoutingSchema, LabelsSchema;
98376
98381
  var init_schema = __esm({
98377
98382
  "../content-model/src/content-types/schema.ts"() {
98378
98383
  init_referenceFields();
@@ -98385,6 +98390,7 @@ var init_schema = __esm({
98385
98390
  "date",
98386
98391
  "url",
98387
98392
  "media",
98393
+ "file",
98388
98394
  "boolean",
98389
98395
  "select",
98390
98396
  "reference",
@@ -98394,6 +98400,15 @@ var init_schema = __esm({
98394
98400
  "repeater",
98395
98401
  "datetime"
98396
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
+ ];
98397
98412
  BaseContentFieldSchema = z.object({
98398
98413
  id: z.string(),
98399
98414
  type: z.enum(contentFieldTypes),
@@ -98411,7 +98426,9 @@ var init_schema = __esm({
98411
98426
  max: z.number().optional(),
98412
98427
  step: z.number().positive().optional(),
98413
98428
  // Media field options
98414
- mediaKinds: z.array(z.enum(["image", "video", "audio", "document", "spreadsheet", "archive"])).optional(),
98429
+ mediaKinds: z.array(z.enum(LEGACY_MEDIA_KINDS)).optional(),
98430
+ // File field options
98431
+ fileKinds: z.array(z.enum(FILE_FIELD_KINDS)).optional(),
98415
98432
  // URL field options
98416
98433
  allowRelative: z.boolean().optional(),
98417
98434
  // Select field options
@@ -99810,36 +99827,9 @@ function deriveVideoPrepPolicy(intent) {
99810
99827
  };
99811
99828
  }
99812
99829
  }
99813
- function validateVideoPrepSource(source, policy) {
99814
- if (!Number.isFinite(source.byteSize) || source.byteSize <= 0) {
99815
- return err({ tag: "invalid-byte-size", byteSize: source.byteSize });
99816
- }
99817
- if (source.byteSize > policy.maxRawByteCount) {
99818
- return err({
99819
- tag: "raw-file-too-large",
99820
- actualBytes: source.byteSize,
99821
- maxBytes: policy.maxRawByteCount
99822
- });
99823
- }
99824
- if (!Number.isFinite(source.durationSeconds) || source.durationSeconds <= 0) {
99825
- return err({ tag: "invalid-duration", durationSeconds: source.durationSeconds });
99826
- }
99827
- if (policy.maxDurationSeconds !== void 0 && source.durationSeconds > policy.maxDurationSeconds) {
99828
- return err({
99829
- tag: "duration-too-long",
99830
- actualSeconds: source.durationSeconds,
99831
- maxSeconds: policy.maxDurationSeconds
99832
- });
99833
- }
99834
- if (!Number.isFinite(source.width) || !Number.isFinite(source.height) || source.width <= 0 || source.height <= 0) {
99835
- return err({ tag: "invalid-dimensions", width: source.width, height: source.height });
99836
- }
99837
- return ok(void 0);
99838
- }
99839
99830
  var VIDEO_PREP_LIMITS;
99840
99831
  var init_videoPrep = __esm({
99841
99832
  "../media-core/src/videoPrep.ts"() {
99842
- init_src3();
99843
99833
  VIDEO_PREP_LIMITS = {
99844
99834
  maxRawByteCount: 500 * 1024 * 1024,
99845
99835
  inlineContentMaxDurationSeconds: 60,
@@ -99852,7 +99842,8 @@ var init_videoPrep = __esm({
99852
99842
  // ../media-core/src/videoSlotPolicy.ts
99853
99843
  function deriveVideoSlotPolicy(intent) {
99854
99844
  if (intent === void 0) return void 0;
99855
- if (intent.tag !== "inline-content" && intent.tag !== "background-video") return void 0;
99845
+ if (intent.tag !== "inline-content" && intent.tag !== "background-video")
99846
+ return void 0;
99856
99847
  const prepPolicy = deriveVideoPrepPolicy(intent);
99857
99848
  if (prepPolicy.maxDurationSeconds === void 0) return void 0;
99858
99849
  return {
@@ -100804,6 +100795,9 @@ var init_repeaterGrid = __esm({
100804
100795
  MAX_COLUMNS = 4;
100805
100796
  }
100806
100797
  });
100798
+ function isDisplayMediaKind2(kind) {
100799
+ return DISPLAY_MEDIA_KINDS2.includes(kind);
100800
+ }
100807
100801
  function assertNeverSelectSource(value) {
100808
100802
  throw new Error(`Unhandled select source: ${JSON.stringify(value)}`);
100809
100803
  }
@@ -100815,6 +100809,7 @@ function getFieldSchemaInternal() {
100815
100809
  textFieldSchema,
100816
100810
  richTextFieldSchema,
100817
100811
  mediaFieldSchema,
100812
+ fileFieldSchema,
100818
100813
  booleanFieldSchema,
100819
100814
  numberFieldSchema,
100820
100815
  dateFieldSchema,
@@ -100881,13 +100876,32 @@ function createSdkSelectField(input) {
100881
100876
  })
100882
100877
  );
100883
100878
  }
100884
- 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;
100885
100880
  var init_schema3 = __esm({
100886
100881
  "../blocks/src/system/manifest/schema.ts"() {
100887
100882
  init_src5();
100888
100883
  init_node();
100889
100884
  init_repeaterGrid();
100890
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
+ ];
100891
100905
  siteOptionSources = [
100892
100906
  "eventCategories",
100893
100907
  "venues",
@@ -101048,11 +101062,19 @@ var init_schema3 = __esm({
101048
101062
  });
101049
101063
  mediaFieldSchema = baseFieldSchema.extend({
101050
101064
  type: z.literal("media"),
101051
- mediaKinds: z.array(
101052
- z.enum(["image", "video", "audio", "document", "spreadsheet", "archive"])
101053
- ).default(["image"]),
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
+ }),
101054
101072
  aspectRatio: z.string().optional()
101055
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
+ });
101056
101078
  booleanFieldSchema = baseFieldSchema.extend({
101057
101079
  type: z.literal("boolean")
101058
101080
  });
@@ -101559,6 +101581,7 @@ function deriveFieldValidationPlan(field, path = [field.id]) {
101559
101581
  case "richText":
101560
101582
  return makePlan("richText", "object", field, path, required, commonConstraints(required, { kind: "richTextDoc" }));
101561
101583
  case "media":
101584
+ case "file":
101562
101585
  return makePlan("media", "object", field, path, required, commonConstraints(required, { kind: "mediaObject" }));
101563
101586
  case "link":
101564
101587
  return makePlan("link", "object", field, path, required, commonConstraints(required, { kind: "linkObject" }));
@@ -114224,13 +114247,19 @@ function defineFragment(config) {
114224
114247
  function scopeFragmentFields(fragment, scope) {
114225
114248
  const normalizedScope = scope.trim();
114226
114249
  if (!normalizedScope) {
114227
- return fragment.fields.map((field) => cloneFieldDefinition2(field));
114250
+ return fragment.fields.map(
114251
+ (field) => cloneFieldDefinition2(field)
114252
+ );
114228
114253
  }
114229
- return fragment.fields.map((field) => prefixFieldId(field, normalizedScope));
114254
+ return fragment.fields.map(
114255
+ (field) => prefixFieldId(field, normalizedScope)
114256
+ );
114230
114257
  }
114231
114258
  function scopeFragmentLayout(fragment, scope) {
114232
114259
  const normalizedScope = scope.trim();
114233
- return fragment.layout.map((node) => cloneAndScopeNode(node, normalizedScope));
114260
+ return fragment.layout.map(
114261
+ (node) => cloneAndScopeNode(node, normalizedScope)
114262
+ );
114234
114263
  }
114235
114264
  function validateFieldDefinitions(fields3, fragmentId) {
114236
114265
  const seen = /* @__PURE__ */ new Set();
@@ -114312,7 +114341,9 @@ function cloneAndScopeNode(node, scope) {
114312
114341
  ...node
114313
114342
  };
114314
114343
  if (node.children) {
114315
- cloned.children = node.children.map((child) => cloneAndScopeNode(child, scope));
114344
+ cloned.children = node.children.map(
114345
+ (child) => cloneAndScopeNode(child, scope)
114346
+ );
114316
114347
  }
114317
114348
  if (node.props) {
114318
114349
  cloned.props = scopePropBindings(node.props, scope);
@@ -114338,7 +114369,9 @@ function scopeBinding(binding, scope) {
114338
114369
  const cloned = {
114339
114370
  ...binding,
114340
114371
  transforms: binding.transforms?.map(
114341
- (step) => ({ ...step })
114372
+ (step) => ({
114373
+ ...step
114374
+ })
114342
114375
  ) ?? []
114343
114376
  };
114344
114377
  cloned.from = scopeContentPath(binding.from, scope);
@@ -114382,7 +114415,9 @@ function scopePropValue(value, scope) {
114382
114415
  };
114383
114416
  }
114384
114417
  const result = {};
114385
- for (const [key, entry] of Object.entries(value)) {
114418
+ for (const [key, entry] of Object.entries(
114419
+ value
114420
+ )) {
114386
114421
  result[key] = scopePropValue(entry, scope);
114387
114422
  }
114388
114423
  return result;
@@ -114428,13 +114463,18 @@ var init_types16 = __esm({
114428
114463
  loader: dataLoaderSchema.optional()
114429
114464
  });
114430
114465
  fragmentConfigSchema = z.object({
114431
- id: z.string().min(1, "Fragment id is required").regex(FRAGMENT_ID_PATTERN, "Fragment id must be alphanumeric with optional . _ - separators"),
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
+ ),
114432
114470
  title: z.string().optional(),
114433
114471
  description: z.string().optional(),
114434
114472
  category: z.enum(["content", "media", "interactive", "layout"]).optional(),
114435
114473
  icon: z.string().optional(),
114436
114474
  fields: fieldSchema.array().default([]),
114437
- layout: z.union([NodeSchema, NodeSchema.array()]).transform((value) => Array.isArray(value) ? value : [value]),
114475
+ layout: z.union([NodeSchema, NodeSchema.array()]).transform(
114476
+ (value) => Array.isArray(value) ? value : [value]
114477
+ ),
114438
114478
  data: fragmentDataSchema.optional()
114439
114479
  });
114440
114480
  FragmentConfigError = class extends Error {
@@ -114904,34 +114944,35 @@ var init_ctaRow2 = __esm({
114904
114944
  });
114905
114945
 
114906
114946
  // ../blocks/src/system/fragments/library/heroCtaRow.ts
114907
- var heroCtaRowFragment;
114947
+ var heroCtaFields, heroCtaRowFragment;
114908
114948
  var init_heroCtaRow = __esm({
114909
114949
  "../blocks/src/system/fragments/library/heroCtaRow.ts"() {
114910
114950
  init_types16();
114911
114951
  init_fragments();
114912
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
+ ];
114913
114971
  heroCtaRowFragment = defineFragment({
114914
114972
  id: "heroCtaRow",
114915
114973
  title: "Hero CTAs",
114916
114974
  description: "Repeatable hero calls to action rendered inline.",
114917
- fields: [
114918
- createCtasRepeater({
114919
- label: "Calls to action",
114920
- itemLabel: "CTA",
114921
- maxItems: 3,
114922
- button: {
114923
- variants: [
114924
- { value: "default", label: "Default" },
114925
- { value: "primary", label: "Primary" },
114926
- { value: "secondary", label: "Secondary" },
114927
- { value: "outline", label: "Outline" }
114928
- ],
114929
- defaultVariant: "default",
114930
- includeSize: true,
114931
- defaultSize: "lg"
114932
- }
114933
- })
114934
- ],
114975
+ fields: heroCtaFields,
114935
114976
  layout: [
114936
114977
  ctaRow({
114937
114978
  collectionPath: "content.ctas",
@@ -121533,8 +121574,7 @@ var init_media3 = __esm({
121533
121574
  "document",
121534
121575
  "spreadsheet",
121535
121576
  "archive",
121536
- "audio",
121537
- "video"
121577
+ "audio"
121538
121578
  ];
121539
121579
  hotspotSchema2 = z40.object({
121540
121580
  x: z40.number().min(0).max(1),
@@ -123363,7 +123403,7 @@ var init_course_details = __esm({
123363
123403
  });
123364
123404
 
123365
123405
  // ../blocks/src/system/blocks/events/event-spotlight.ts
123366
- var eventSpotlightManifest, eventSpotlightBlockDefinition;
123406
+ var eventSpotlightFields, eventSpotlightLayout, eventSpotlightConfig, eventSpotlightManifest, eventSpotlightBlockDefinition;
123367
123407
  var init_event_spotlight = __esm({
123368
123408
  "../blocks/src/system/blocks/events/event-spotlight.ts"() {
123369
123409
  init_builder();
@@ -123373,104 +123413,107 @@ var init_event_spotlight = __esm({
123373
123413
  init_boxStyles();
123374
123414
  init_defineBlock();
123375
123415
  init_shared5();
123376
- eventSpotlightManifest = createBlockManifest({
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 = {
123377
123502
  id: "block.event-spotlight",
123378
123503
  version: "1.1.0",
123379
123504
  title: "Event Spotlight",
123380
123505
  titleSource: "heading",
123381
123506
  description: "Feature a few upcoming events on your homepage",
123382
123507
  skipSectionStyles: true,
123383
- additionalFields: [
123384
- ...sectionHeaderFields("Upcoming Events"),
123385
- {
123386
- id: "maxEvents",
123387
- type: "select",
123388
- label: "Events to display",
123389
- description: "Number of events to show",
123390
- required: false,
123391
- multiple: false,
123392
- defaultValue: "3",
123393
- options: [
123394
- { value: "1", label: "1 event" },
123395
- { value: "2", label: "2 events" },
123396
- { value: "3", label: "3 events" },
123397
- { value: "4", label: "4 events" },
123398
- { value: "5", label: "5 events" },
123399
- { value: "6", label: "6 events" }
123400
- ],
123401
- ui: { intent: "display" }
123402
- },
123403
- {
123404
- id: "ctaLabel",
123405
- type: "text",
123406
- label: "Section button text",
123407
- description: "Optional button shown below the spotlight cards",
123408
- required: false,
123409
- multiline: false,
123410
- maxLength: 40,
123411
- ui: { intent: "content" }
123412
- },
123413
- {
123414
- id: "ctaUrl",
123415
- type: "link",
123416
- label: "Section button destination",
123417
- required: false,
123418
- ui: { intent: "display" }
123419
- },
123420
- layoutField,
123421
- columnsField(["2", "3"]),
123422
- ...cardStylingFields,
123423
- ...eventDisplayFields,
123424
- emptyStateField,
123425
- sectionStylesField({
123426
- id: "_sectionStyles",
123427
- label: "Section styles"
123428
- })
123429
- ],
123508
+ additionalFields: eventSpotlightFields,
123430
123509
  styleTokens: { background: "surface", typography: "body", spacing: "md" },
123431
123510
  behaviours: { supportsThemeSwitching: true, inlineEditing: false, animation: false, paletteHidden: false },
123432
123511
  category: "content",
123433
123512
  tags: ["events", "featured", "homepage", "spotlight", "upcoming"],
123434
123513
  icon: "Star",
123435
- layout: [
123436
- styledSection({
123437
- children: sectionContainer([
123438
- // Optional heading
123439
- text(
123440
- { as: "h2" },
123441
- bind2("content.heading"),
123442
- when("content.heading")
123443
- ),
123444
- // Optional description
123445
- richText(
123446
- { className: "rb-prose rb-max-w-none" },
123447
- bind2("content.description"),
123448
- when("content.description")
123449
- ),
123450
- // Event spotlight component
123451
- el("event-spotlight", {
123452
- events: { $bind: { from: "data.events" } },
123453
- layout: { $bind: { from: "content.layout", fallback: "grid" } },
123454
- columns: { $bind: { from: "content.columns", fallback: "3" } },
123455
- cardVariant: { $bind: { from: "content.cardVariant", fallback: "default" } },
123456
- buttonVariant: { $bind: { from: "content.buttonVariant", fallback: "primary" } },
123457
- buttonText: { $bind: { from: "content.buttonText", fallback: "View event" } },
123458
- ctaLabel: { $bind: { from: "content.ctaLabel" } },
123459
- ctaUrl: { $bind: { from: "content.ctaUrl", transforms: [{ id: "links.resolve" }] } },
123460
- showVenue: { $bind: { from: "content.showVenue" } },
123461
- showMap: { $bind: { from: "content.showMap" } },
123462
- showCapacity: { $bind: { from: "content.showCapacity" } },
123463
- emptyMessage: { $bind: { from: "content.emptyMessage" } }
123464
- })
123465
- ], {
123466
- gap: "lg"
123467
- }),
123468
- // sectionContainer (rb-container) already provides horizontal padding
123469
- baseClass: "",
123470
- spacing: "comfortable"
123471
- })
123472
- ]
123473
- });
123514
+ layout: eventSpotlightLayout
123515
+ };
123516
+ eventSpotlightManifest = createBlockManifest(eventSpotlightConfig);
123474
123517
  eventSpotlightBlockDefinition = {
123475
123518
  manifest: eventSpotlightManifest,
123476
123519
  dataSchemas: {
@@ -128362,18 +128405,18 @@ var init_file_download = __esm({
128362
128405
  title: "File Download",
128363
128406
  titleSource: ["title", "file.filename"],
128364
128407
  category: "media",
128365
- description: "Add a simple public download link for a document, ZIP, audio, or video file.",
128408
+ description: "Add a simple public download link for a document, ZIP, or audio file.",
128366
128409
  tags: ["file", "download", "document", "zip", "media"],
128367
128410
  icon: "Download",
128368
128411
  includeContainerStyles: true,
128369
128412
  additionalFields: [
128370
128413
  {
128371
128414
  id: "file",
128372
- type: "media",
128415
+ type: "file",
128373
128416
  label: "Download file",
128374
128417
  description: "Choose the file visitors can download.",
128375
128418
  required: false,
128376
- mediaKinds: [...PUBLIC_DOWNLOAD_MEDIA_TYPES],
128419
+ fileKinds: [...PUBLIC_DOWNLOAD_MEDIA_TYPES],
128377
128420
  ui: { intent: "content" }
128378
128421
  },
128379
128422
  {
@@ -133215,8 +133258,6 @@ function iconForMediaType(type) {
133215
133258
  switch (type) {
133216
133259
  case "audio":
133217
133260
  return /* @__PURE__ */ jsx(FileHeadphone, { "aria-hidden": "true" });
133218
- case "video":
133219
- return /* @__PURE__ */ jsx(FilePlay, { "aria-hidden": "true" });
133220
133261
  case "document":
133221
133262
  return /* @__PURE__ */ jsx(FileText, { "aria-hidden": "true" });
133222
133263
  case "spreadsheet":
@@ -133255,8 +133296,22 @@ function FileDownloadNode({
133255
133296
  }
133256
133297
  ),
133257
133298
  /* @__PURE__ */ jsxs("div", { className: "rb-min-w-0 rb-space-y-1", children: [
133258
- /* @__PURE__ */ jsx("h2", { className: "rb-m-0 rb-text-lg rb-font-semibold", style: textColorStyle("heading"), children: heading }),
133259
- body ? /* @__PURE__ */ jsx("p", { className: "rb-m-0 rb-text-sm", style: textColorStyle("mutedText"), children: body }) : null,
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,
133260
133315
  /* @__PURE__ */ jsx(
133261
133316
  "p",
133262
133317
  {
@@ -133293,7 +133348,12 @@ var init_file_download2 = __esm({
133293
133348
  init_media3();
133294
133349
  init_buttons();
133295
133350
  init_media4();
133296
- FILE_DOWNLOAD_BUTTON_VARIANTS = ["primary", "secondary", "outline", "link"];
133351
+ FILE_DOWNLOAD_BUTTON_VARIANTS = [
133352
+ "primary",
133353
+ "secondary",
133354
+ "outline",
133355
+ "link"
133356
+ ];
133297
133357
  }
133298
133358
  });
133299
133359
 
@@ -158145,7 +158205,7 @@ function useInternalValue(props2) {
158145
158205
  ]
158146
158206
  );
158147
158207
  const DEFAULT_AUTOSAVE_DELAY = 1500;
158148
- const [errorMessage3, setErrorMessage] = useState(null);
158208
+ const [errorMessage, setErrorMessage] = useState(null);
158149
158209
  const skipAutoSaveRef = useRef(true);
158150
158210
  const siteIdForInvalidation = siteId;
158151
158211
  const typeForInvalidation = type;
@@ -158311,7 +158371,7 @@ function useInternalValue(props2) {
158311
158371
  return {
158312
158372
  entry,
158313
158373
  baseline: uiStore.getState().metadata.getSnapshot().baseline ?? {},
158314
- errorMessage: errorMessage3,
158374
+ errorMessage,
158315
158375
  recoveryConflict: recoveryState.recoveryConflict ? {
158316
158376
  affectedBlockIds: recoveryState.recoveryConflict.affectedBlockIds,
158317
158377
  count: recoveryState.recoveryConflict.count,
@@ -158325,7 +158385,7 @@ function useInternalValue(props2) {
158325
158385
  }, [
158326
158386
  actions,
158327
158387
  entry,
158328
- errorMessage3,
158388
+ errorMessage,
158329
158389
  recoveryState.discardRecoveredChanges,
158330
158390
  recoveryState.recoveryConflict,
158331
158391
  recoveryState.reviewAffectedBlocks,
@@ -158679,6 +158739,7 @@ function toManifestFieldInput(field) {
158679
158739
  case "text":
158680
158740
  case "richText":
158681
158741
  case "media":
158742
+ case "file":
158682
158743
  case "boolean":
158683
158744
  case "date":
158684
158745
  case "time":
@@ -169646,7 +169707,7 @@ var init_GuestDetailsSection = __esm({
169646
169707
  onChange,
169647
169708
  shake = false,
169648
169709
  onShakeEnd,
169649
- errorMessage: errorMessage3 = DEFAULT_ERROR_MESSAGE
169710
+ errorMessage = DEFAULT_ERROR_MESSAGE
169650
169711
  }) => {
169651
169712
  const sectionRef = useRef(null);
169652
169713
  const firstErrorRef = useRef(null);
@@ -169679,7 +169740,7 @@ var init_GuestDetailsSection = __esm({
169679
169740
  onAnimationEnd: handleAnimationEnd,
169680
169741
  children: [
169681
169742
  /* @__PURE__ */ jsx("h3", { className: "er-title", children: "Who else is coming?" }),
169682
- showErrorBanner && /* @__PURE__ */ jsx(FeedbackMessage, { tone: "error", className: "er-guest-section-error", role: "alert", children: errorMessage3 }),
169743
+ showErrorBanner && /* @__PURE__ */ jsx(FeedbackMessage, { tone: "error", className: "er-guest-section-error", role: "alert", children: errorMessage }),
169683
169744
  /* @__PURE__ */ jsx("div", { className: "er-guest-cards", children: guests.map((guest, index2) => {
169684
169745
  const guestError = errors?.[index2]?.name;
169685
169746
  const guestErrorId = `guest-${index2}-error`;
@@ -170838,20 +170899,20 @@ function usePaymentVerification(config) {
170838
170899
  }, [api, config]);
170839
170900
  const polling = usePolling(pollingConfig);
170840
170901
  const paymentStatus = polling.result?.paymentStatus ?? null;
170841
- let errorMessage3 = null;
170902
+ let errorMessage = null;
170842
170903
  if (polling.status === "timeout") {
170843
- errorMessage3 = "Could not verify payment. If you were charged, please contact support.";
170904
+ errorMessage = "Could not verify payment. If you were charged, please contact support.";
170844
170905
  } else if (polling.status === "failed" && paymentStatus) {
170845
- errorMessage3 = paymentStatus === "refunded" ? "Payment was refunded. Please contact support." : "Payment was declined. Please try again.";
170906
+ errorMessage = paymentStatus === "refunded" ? "Payment was refunded. Please contact support." : "Payment was declined. Please try again.";
170846
170907
  } else if (polling.error) {
170847
- errorMessage3 = polling.error.message;
170908
+ errorMessage = polling.error.message;
170848
170909
  }
170849
170910
  return {
170850
170911
  status: polling.status,
170851
170912
  paymentStatus,
170852
170913
  attendeeStatus: polling.result?.attendeeStatus ?? null,
170853
170914
  waitlistPosition: polling.result?.waitlistPosition ?? null,
170854
- error: errorMessage3,
170915
+ error: errorMessage,
170855
170916
  retry: polling.retry
170856
170917
  };
170857
170918
  }
@@ -171207,7 +171268,7 @@ function useEventRegistrationWizard(options) {
171207
171268
  );
171208
171269
  const [selectedTicketTypeId, setSelectedTicketTypeId] = useState(null);
171209
171270
  const [registrationResult, setRegistrationResult] = useState(null);
171210
- const [errorMessage3, setErrorMessage] = useState("");
171271
+ const [errorMessage, setErrorMessage] = useState("");
171211
171272
  const [altchaSolution, setAltchaSolution] = useState(null);
171212
171273
  const { authState: portalAuthState, profile: portalProfile } = usePortalAuth();
171213
171274
  const waitlistClaim = useWaitlistClaim();
@@ -171593,7 +171654,7 @@ function useEventRegistrationWizard(options) {
171593
171654
  guestSectionShake,
171594
171655
  handleGuestShakeEnd,
171595
171656
  registrationResult,
171596
- errorMessage: errorMessage3,
171657
+ errorMessage,
171597
171658
  altchaSolution,
171598
171659
  setAltchaSolution,
171599
171660
  portalAuthState,
@@ -172767,7 +172828,7 @@ function useCourseRegistrationWizard(props2) {
172767
172828
  });
172768
172829
  const [errors, setErrors] = useState({});
172769
172830
  const [enrollmentResult, setEnrollmentResult] = useState(null);
172770
- const [errorMessage3, setErrorMessage] = useState("");
172831
+ const [errorMessage, setErrorMessage] = useState("");
172771
172832
  const [portalAuthState, setPortalAuthState] = useState("checking");
172772
172833
  const [altchaSolution, setAltchaSolution] = useState(null);
172773
172834
  const showSpamProtection = isSpamProtectionEnabled();
@@ -173275,7 +173336,7 @@ function useCourseRegistrationWizard(props2) {
173275
173336
  setFormData,
173276
173337
  errors,
173277
173338
  enrollmentResult,
173278
- errorMessage: errorMessage3,
173339
+ errorMessage,
173279
173340
  portalAuthState,
173280
173341
  handleLogout,
173281
173342
  altchaSolution,
@@ -173355,7 +173416,7 @@ function CourseRegistrationWizard(props2) {
173355
173416
  setFormData,
173356
173417
  errors,
173357
173418
  enrollmentResult,
173358
- errorMessage: errorMessage3,
173419
+ errorMessage,
173359
173420
  portalAuthState,
173360
173421
  handleLogout,
173361
173422
  setAltchaSolution,
@@ -173737,7 +173798,7 @@ function CourseRegistrationWizard(props2) {
173737
173798
  step === "payment-failed" && /* @__PURE__ */ jsx(
173738
173799
  PaymentFailedStep2,
173739
173800
  {
173740
- message: errorMessage3,
173801
+ message: errorMessage,
173741
173802
  buttonVariant,
173742
173803
  onRetry: handleRetry
173743
173804
  }
@@ -173760,7 +173821,7 @@ function CourseRegistrationWizard(props2) {
173760
173821
  step === "error" && /* @__PURE__ */ jsx(
173761
173822
  ErrorStep2,
173762
173823
  {
173763
- message: errorMessage3,
173824
+ message: errorMessage,
173764
173825
  buttonVariant,
173765
173826
  onRetry: handleRetry
173766
173827
  }
@@ -180531,6 +180592,7 @@ var init_schemas3 = __esm({
180531
180592
  link: buildLinkFieldSchema,
180532
180593
  richText: buildRichTextFieldSchema,
180533
180594
  media: buildMediaFieldSchema,
180595
+ file: buildMediaFieldSchema,
180534
180596
  tabGroup: buildTabGroupFieldSchema,
180535
180597
  presetOrCustom: buildPresetOrCustomFieldSchema,
180536
180598
  reference: buildReferenceFieldSchema,
@@ -180553,6 +180615,7 @@ var init_schemas3 = __esm({
180553
180615
  link: getLinkFieldDefault,
180554
180616
  richText: getRichTextFieldDefaultValue,
180555
180617
  media: getMediaFieldDefaultValue,
180618
+ file: getMediaFieldDefaultValue,
180556
180619
  tabGroup: getTabGroupFieldDefault,
180557
180620
  presetOrCustom: getPresetOrCustomFieldDefault,
180558
180621
  reference: getReferenceFieldDefault,
@@ -187931,7 +187994,7 @@ function assertRelativeStoragePath(value) {
187931
187994
  }
187932
187995
  return parsed.value;
187933
187996
  }
187934
- 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_KINDS, MEDIA_ASSET_FILE_FILTERS2, MEDIA_ASSET_LIBRARY_SCOPES, MediaStorageError, pad, extractExtension, generateId4, generateStoragePath, DEFAULT_BUCKET, MAX_LIMIT, fileKindSchema, fileUsesSchema, accessPolicySchema, fileDomainSchema, fileDomainPatchSchema, searchMatchRowSchema;
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;
187935
187998
  var init_dist91 = __esm({
187936
187999
  "../media-storage-supabase/dist/index.mjs"() {
187937
188000
  asSiteId2 = (id) => id;
@@ -188042,7 +188105,7 @@ var init_dist91 = __esm({
188042
188105
  "image/avif"
188043
188106
  ];
188044
188107
  new Set(RASTER_IMAGE_MIME_TYPES);
188045
- MEDIA_KINDS = [
188108
+ MEDIA_KINDS2 = [
188046
188109
  "image",
188047
188110
  "video",
188048
188111
  "audio",
@@ -188186,7 +188249,7 @@ var init_dist91 = __esm({
188186
188249
  orderBy: z.enum(["created_at", "filename"]).optional(),
188187
188250
  orderDirection: z.enum(["asc", "desc"]).optional(),
188188
188251
  labels: z.array(z.string()).optional(),
188189
- mediaKinds: z.array(z.enum(MEDIA_KINDS)).optional(),
188252
+ mediaKinds: z.array(z.enum(MEDIA_KINDS2)).optional(),
188190
188253
  fileFilter: z.enum(MEDIA_ASSET_FILE_FILTERS2).optional(),
188191
188254
  libraryScope: z.enum(MEDIA_ASSET_LIBRARY_SCOPES).optional()
188192
188255
  });
@@ -188303,874 +188366,14 @@ var init_classification = __esm({
188303
188366
  };
188304
188367
  }
188305
188368
  });
188306
-
188307
- // ../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/const.js
188308
- var FFMessageType;
188309
- var init_const = __esm({
188310
- "../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/const.js"() {
188311
- (function(FFMessageType2) {
188312
- FFMessageType2["LOAD"] = "LOAD";
188313
- FFMessageType2["EXEC"] = "EXEC";
188314
- FFMessageType2["FFPROBE"] = "FFPROBE";
188315
- FFMessageType2["WRITE_FILE"] = "WRITE_FILE";
188316
- FFMessageType2["READ_FILE"] = "READ_FILE";
188317
- FFMessageType2["DELETE_FILE"] = "DELETE_FILE";
188318
- FFMessageType2["RENAME"] = "RENAME";
188319
- FFMessageType2["CREATE_DIR"] = "CREATE_DIR";
188320
- FFMessageType2["LIST_DIR"] = "LIST_DIR";
188321
- FFMessageType2["DELETE_DIR"] = "DELETE_DIR";
188322
- FFMessageType2["ERROR"] = "ERROR";
188323
- FFMessageType2["DOWNLOAD"] = "DOWNLOAD";
188324
- FFMessageType2["PROGRESS"] = "PROGRESS";
188325
- FFMessageType2["LOG"] = "LOG";
188326
- FFMessageType2["MOUNT"] = "MOUNT";
188327
- FFMessageType2["UNMOUNT"] = "UNMOUNT";
188328
- })(FFMessageType || (FFMessageType = {}));
188329
- }
188330
- });
188331
-
188332
- // ../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/utils.js
188333
- var getMessageID;
188334
- var init_utils13 = __esm({
188335
- "../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/utils.js"() {
188336
- getMessageID = /* @__PURE__ */ (() => {
188337
- let messageID = 0;
188338
- return () => messageID++;
188339
- })();
188340
- }
188341
- });
188342
-
188343
- // ../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/errors.js
188344
- var ERROR_NOT_LOADED, ERROR_TERMINATED;
188345
- var init_errors = __esm({
188346
- "../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/errors.js"() {
188347
- ERROR_NOT_LOADED = new Error("ffmpeg is not loaded, call `await ffmpeg.load()` first");
188348
- ERROR_TERMINATED = new Error("called FFmpeg.terminate()");
188349
- }
188350
- });
188351
-
188352
- // ../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/classes.js
188353
- var _worker, _resolves, _rejects, _logEventCallbacks, _progressEventCallbacks, _registerHandlers, _send, FFmpeg;
188354
- var init_classes2 = __esm({
188355
- "../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/classes.js"() {
188356
- init_const();
188357
- init_utils13();
188358
- init_errors();
188359
- FFmpeg = class {
188360
- constructor() {
188361
- __privateAdd(this, _worker, null);
188362
- /**
188363
- * #resolves and #rejects tracks Promise resolves and rejects to
188364
- * be called when we receive message from web worker.
188365
- */
188366
- __privateAdd(this, _resolves, {});
188367
- __privateAdd(this, _rejects, {});
188368
- __privateAdd(this, _logEventCallbacks, []);
188369
- __privateAdd(this, _progressEventCallbacks, []);
188370
- __publicField(this, "loaded", false);
188371
- /**
188372
- * register worker message event handlers.
188373
- */
188374
- __privateAdd(this, _registerHandlers, () => {
188375
- if (__privateGet(this, _worker)) {
188376
- __privateGet(this, _worker).onmessage = ({ data: { id, type, data } }) => {
188377
- switch (type) {
188378
- case FFMessageType.LOAD:
188379
- this.loaded = true;
188380
- __privateGet(this, _resolves)[id](data);
188381
- break;
188382
- case FFMessageType.MOUNT:
188383
- case FFMessageType.UNMOUNT:
188384
- case FFMessageType.EXEC:
188385
- case FFMessageType.FFPROBE:
188386
- case FFMessageType.WRITE_FILE:
188387
- case FFMessageType.READ_FILE:
188388
- case FFMessageType.DELETE_FILE:
188389
- case FFMessageType.RENAME:
188390
- case FFMessageType.CREATE_DIR:
188391
- case FFMessageType.LIST_DIR:
188392
- case FFMessageType.DELETE_DIR:
188393
- __privateGet(this, _resolves)[id](data);
188394
- break;
188395
- case FFMessageType.LOG:
188396
- __privateGet(this, _logEventCallbacks).forEach((f2) => f2(data));
188397
- break;
188398
- case FFMessageType.PROGRESS:
188399
- __privateGet(this, _progressEventCallbacks).forEach((f2) => f2(data));
188400
- break;
188401
- case FFMessageType.ERROR:
188402
- __privateGet(this, _rejects)[id](data);
188403
- break;
188404
- }
188405
- delete __privateGet(this, _resolves)[id];
188406
- delete __privateGet(this, _rejects)[id];
188407
- };
188408
- }
188409
- });
188410
- /**
188411
- * Generic function to send messages to web worker.
188412
- */
188413
- __privateAdd(this, _send, ({ type, data }, trans = [], signal) => {
188414
- if (!__privateGet(this, _worker)) {
188415
- return Promise.reject(ERROR_NOT_LOADED);
188416
- }
188417
- return new Promise((resolve, reject) => {
188418
- const id = getMessageID();
188419
- __privateGet(this, _worker) && __privateGet(this, _worker).postMessage({ id, type, data }, trans);
188420
- __privateGet(this, _resolves)[id] = resolve;
188421
- __privateGet(this, _rejects)[id] = reject;
188422
- signal?.addEventListener("abort", () => {
188423
- reject(new DOMException(`Message # ${id} was aborted`, "AbortError"));
188424
- }, { once: true });
188425
- });
188426
- });
188427
- /**
188428
- * Loads ffmpeg-core inside web worker. It is required to call this method first
188429
- * as it initializes WebAssembly and other essential variables.
188430
- *
188431
- * @category FFmpeg
188432
- * @returns `true` if ffmpeg core is loaded for the first time.
188433
- */
188434
- __publicField(this, "load", ({ classWorkerURL, ...config } = {}, { signal } = {}) => {
188435
- if (!__privateGet(this, _worker)) {
188436
- __privateSet(this, _worker, classWorkerURL ? new Worker(new URL(classWorkerURL, import.meta.url), {
188437
- type: "module"
188438
- }) : (
188439
- // We need to duplicated the code here to enable webpack
188440
- // to bundle worekr.js here.
188441
- new Worker(new URL("./worker.js", import.meta.url), {
188442
- type: "module"
188443
- })
188444
- ));
188445
- __privateGet(this, _registerHandlers).call(this);
188446
- }
188447
- return __privateGet(this, _send).call(this, {
188448
- type: FFMessageType.LOAD,
188449
- data: config
188450
- }, void 0, signal);
188451
- });
188452
- /**
188453
- * Execute ffmpeg command.
188454
- *
188455
- * @remarks
188456
- * To avoid common I/O issues, ["-nostdin", "-y"] are prepended to the args
188457
- * by default.
188458
- *
188459
- * @example
188460
- * ```ts
188461
- * const ffmpeg = new FFmpeg();
188462
- * await ffmpeg.load();
188463
- * await ffmpeg.writeFile("video.avi", ...);
188464
- * // ffmpeg -i video.avi video.mp4
188465
- * await ffmpeg.exec(["-i", "video.avi", "video.mp4"]);
188466
- * const data = ffmpeg.readFile("video.mp4");
188467
- * ```
188468
- *
188469
- * @returns `0` if no error, `!= 0` if timeout (1) or error.
188470
- * @category FFmpeg
188471
- */
188472
- __publicField(this, "exec", (args, timeout = -1, { signal } = {}) => __privateGet(this, _send).call(this, {
188473
- type: FFMessageType.EXEC,
188474
- data: { args, timeout }
188475
- }, void 0, signal));
188476
- /**
188477
- * Execute ffprobe command.
188478
- *
188479
- * @example
188480
- * ```ts
188481
- * const ffmpeg = new FFmpeg();
188482
- * await ffmpeg.load();
188483
- * await ffmpeg.writeFile("video.avi", ...);
188484
- * // 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
188485
- * await ffmpeg.ffprobe(["-v", "error", "-show_entries", "format=duration", "-of", "default=noprint_wrappers=1:nokey=1", "video.avi", "-o", "output.txt"]);
188486
- * const data = ffmpeg.readFile("output.txt");
188487
- * ```
188488
- *
188489
- * @returns `0` if no error, `!= 0` if timeout (1) or error.
188490
- * @category FFmpeg
188491
- */
188492
- __publicField(this, "ffprobe", (args, timeout = -1, { signal } = {}) => __privateGet(this, _send).call(this, {
188493
- type: FFMessageType.FFPROBE,
188494
- data: { args, timeout }
188495
- }, void 0, signal));
188496
- /**
188497
- * Terminate all ongoing API calls and terminate web worker.
188498
- * `FFmpeg.load()` must be called again before calling any other APIs.
188499
- *
188500
- * @category FFmpeg
188501
- */
188502
- __publicField(this, "terminate", () => {
188503
- const ids2 = Object.keys(__privateGet(this, _rejects));
188504
- for (const id of ids2) {
188505
- __privateGet(this, _rejects)[id](ERROR_TERMINATED);
188506
- delete __privateGet(this, _rejects)[id];
188507
- delete __privateGet(this, _resolves)[id];
188508
- }
188509
- if (__privateGet(this, _worker)) {
188510
- __privateGet(this, _worker).terminate();
188511
- __privateSet(this, _worker, null);
188512
- this.loaded = false;
188513
- }
188514
- });
188515
- /**
188516
- * Write data to ffmpeg.wasm.
188517
- *
188518
- * @example
188519
- * ```ts
188520
- * const ffmpeg = new FFmpeg();
188521
- * await ffmpeg.load();
188522
- * await ffmpeg.writeFile("video.avi", await fetchFile("../video.avi"));
188523
- * await ffmpeg.writeFile("text.txt", "hello world");
188524
- * ```
188525
- *
188526
- * @category File System
188527
- */
188528
- __publicField(this, "writeFile", (path, data, { signal } = {}) => {
188529
- const trans = [];
188530
- if (data instanceof Uint8Array) {
188531
- trans.push(data.buffer);
188532
- }
188533
- return __privateGet(this, _send).call(this, {
188534
- type: FFMessageType.WRITE_FILE,
188535
- data: { path, data }
188536
- }, trans, signal);
188537
- });
188538
- __publicField(this, "mount", (fsType, options, mountPoint) => {
188539
- const trans = [];
188540
- return __privateGet(this, _send).call(this, {
188541
- type: FFMessageType.MOUNT,
188542
- data: { fsType, options, mountPoint }
188543
- }, trans);
188544
- });
188545
- __publicField(this, "unmount", (mountPoint) => {
188546
- const trans = [];
188547
- return __privateGet(this, _send).call(this, {
188548
- type: FFMessageType.UNMOUNT,
188549
- data: { mountPoint }
188550
- }, trans);
188551
- });
188552
- /**
188553
- * Read data from ffmpeg.wasm.
188554
- *
188555
- * @example
188556
- * ```ts
188557
- * const ffmpeg = new FFmpeg();
188558
- * await ffmpeg.load();
188559
- * const data = await ffmpeg.readFile("video.mp4");
188560
- * ```
188561
- *
188562
- * @category File System
188563
- */
188564
- __publicField(this, "readFile", (path, encoding = "binary", { signal } = {}) => __privateGet(this, _send).call(this, {
188565
- type: FFMessageType.READ_FILE,
188566
- data: { path, encoding }
188567
- }, void 0, signal));
188568
- /**
188569
- * Delete a file.
188570
- *
188571
- * @category File System
188572
- */
188573
- __publicField(this, "deleteFile", (path, { signal } = {}) => __privateGet(this, _send).call(this, {
188574
- type: FFMessageType.DELETE_FILE,
188575
- data: { path }
188576
- }, void 0, signal));
188577
- /**
188578
- * Rename a file or directory.
188579
- *
188580
- * @category File System
188581
- */
188582
- __publicField(this, "rename", (oldPath, newPath, { signal } = {}) => __privateGet(this, _send).call(this, {
188583
- type: FFMessageType.RENAME,
188584
- data: { oldPath, newPath }
188585
- }, void 0, signal));
188586
- /**
188587
- * Create a directory.
188588
- *
188589
- * @category File System
188590
- */
188591
- __publicField(this, "createDir", (path, { signal } = {}) => __privateGet(this, _send).call(this, {
188592
- type: FFMessageType.CREATE_DIR,
188593
- data: { path }
188594
- }, void 0, signal));
188595
- /**
188596
- * List directory contents.
188597
- *
188598
- * @category File System
188599
- */
188600
- __publicField(this, "listDir", (path, { signal } = {}) => __privateGet(this, _send).call(this, {
188601
- type: FFMessageType.LIST_DIR,
188602
- data: { path }
188603
- }, void 0, signal));
188604
- /**
188605
- * Delete an empty directory.
188606
- *
188607
- * @category File System
188608
- */
188609
- __publicField(this, "deleteDir", (path, { signal } = {}) => __privateGet(this, _send).call(this, {
188610
- type: FFMessageType.DELETE_DIR,
188611
- data: { path }
188612
- }, void 0, signal));
188613
- }
188614
- on(event, callback) {
188615
- if (event === "log") {
188616
- __privateGet(this, _logEventCallbacks).push(callback);
188617
- } else if (event === "progress") {
188618
- __privateGet(this, _progressEventCallbacks).push(callback);
188619
- }
188620
- }
188621
- off(event, callback) {
188622
- if (event === "log") {
188623
- __privateSet(this, _logEventCallbacks, __privateGet(this, _logEventCallbacks).filter((f2) => f2 !== callback));
188624
- } else if (event === "progress") {
188625
- __privateSet(this, _progressEventCallbacks, __privateGet(this, _progressEventCallbacks).filter((f2) => f2 !== callback));
188626
- }
188627
- }
188628
- };
188629
- _worker = new WeakMap();
188630
- _resolves = new WeakMap();
188631
- _rejects = new WeakMap();
188632
- _logEventCallbacks = new WeakMap();
188633
- _progressEventCallbacks = new WeakMap();
188634
- _registerHandlers = new WeakMap();
188635
- _send = new WeakMap();
188636
- }
188637
- });
188638
-
188639
- // ../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/types.js
188640
- var FFFSType;
188641
- var init_types27 = __esm({
188642
- "../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/types.js"() {
188643
- (function(FFFSType2) {
188644
- FFFSType2["MEMFS"] = "MEMFS";
188645
- FFFSType2["NODEFS"] = "NODEFS";
188646
- FFFSType2["NODERAWFS"] = "NODERAWFS";
188647
- FFFSType2["IDBFS"] = "IDBFS";
188648
- FFFSType2["WORKERFS"] = "WORKERFS";
188649
- FFFSType2["PROXYFS"] = "PROXYFS";
188650
- })(FFFSType || (FFFSType = {}));
188651
- }
188652
- });
188653
-
188654
- // ../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/index.js
188655
- var esm_exports = {};
188656
- __export(esm_exports, {
188657
- FFFSType: () => FFFSType,
188658
- FFmpeg: () => FFmpeg
188659
- });
188660
- var init_esm9 = __esm({
188661
- "../../node_modules/.pnpm/@ffmpeg+ffmpeg@0.12.15/node_modules/@ffmpeg/ffmpeg/dist/esm/index.js"() {
188662
- init_classes2();
188663
- init_types27();
188664
- }
188665
- });
188666
-
188667
- // ../../node_modules/.pnpm/@ffmpeg+util@0.12.2/node_modules/@ffmpeg/util/dist/esm/errors.js
188668
- var ERROR_RESPONSE_BODY_READER, ERROR_INCOMPLETED_DOWNLOAD;
188669
- var init_errors2 = __esm({
188670
- "../../node_modules/.pnpm/@ffmpeg+util@0.12.2/node_modules/@ffmpeg/util/dist/esm/errors.js"() {
188671
- ERROR_RESPONSE_BODY_READER = new Error("failed to get response body reader");
188672
- ERROR_INCOMPLETED_DOWNLOAD = new Error("failed to complete download");
188673
- }
188674
- });
188675
-
188676
- // ../../node_modules/.pnpm/@ffmpeg+util@0.12.2/node_modules/@ffmpeg/util/dist/esm/const.js
188677
- var HeaderContentLength;
188678
- var init_const2 = __esm({
188679
- "../../node_modules/.pnpm/@ffmpeg+util@0.12.2/node_modules/@ffmpeg/util/dist/esm/const.js"() {
188680
- HeaderContentLength = "Content-Length";
188681
- }
188682
- });
188683
-
188684
- // ../../node_modules/.pnpm/@ffmpeg+util@0.12.2/node_modules/@ffmpeg/util/dist/esm/index.js
188685
- var esm_exports2 = {};
188686
- __export(esm_exports2, {
188687
- downloadWithProgress: () => downloadWithProgress,
188688
- fetchFile: () => fetchFile,
188689
- importScript: () => importScript,
188690
- toBlobURL: () => toBlobURL
188691
- });
188692
- var readFromBlobOrFile, fetchFile, importScript, downloadWithProgress, toBlobURL;
188693
- var init_esm10 = __esm({
188694
- "../../node_modules/.pnpm/@ffmpeg+util@0.12.2/node_modules/@ffmpeg/util/dist/esm/index.js"() {
188695
- init_errors2();
188696
- init_const2();
188697
- readFromBlobOrFile = (blob) => new Promise((resolve, reject) => {
188698
- const fileReader = new FileReader();
188699
- fileReader.onload = () => {
188700
- const { result } = fileReader;
188701
- if (result instanceof ArrayBuffer) {
188702
- resolve(new Uint8Array(result));
188703
- } else {
188704
- resolve(new Uint8Array());
188705
- }
188706
- };
188707
- fileReader.onerror = (event) => {
188708
- reject(Error(`File could not be read! Code=${event?.target?.error?.code || -1}`));
188709
- };
188710
- fileReader.readAsArrayBuffer(blob);
188711
- });
188712
- fetchFile = async (file) => {
188713
- let data;
188714
- if (typeof file === "string") {
188715
- if (/data:_data\/([a-zA-Z]*);base64,([^"]*)/.test(file)) {
188716
- data = atob(file.split(",")[1]).split("").map((c4) => c4.charCodeAt(0));
188717
- } else {
188718
- data = await (await fetch(file)).arrayBuffer();
188719
- }
188720
- } else if (file instanceof URL) {
188721
- data = await (await fetch(file)).arrayBuffer();
188722
- } else if (file instanceof File || file instanceof Blob) {
188723
- data = await readFromBlobOrFile(file);
188724
- } else {
188725
- return new Uint8Array();
188726
- }
188727
- return new Uint8Array(data);
188728
- };
188729
- importScript = async (url) => new Promise((resolve) => {
188730
- const script = document.createElement("script");
188731
- const eventHandler = () => {
188732
- script.removeEventListener("load", eventHandler);
188733
- resolve();
188734
- };
188735
- script.src = url;
188736
- script.type = "text/javascript";
188737
- script.addEventListener("load", eventHandler);
188738
- document.getElementsByTagName("head")[0].appendChild(script);
188739
- });
188740
- downloadWithProgress = async (url, cb) => {
188741
- const resp = await fetch(url);
188742
- let buf;
188743
- try {
188744
- const total = parseInt(resp.headers.get(HeaderContentLength) || "-1");
188745
- const reader = resp.body?.getReader();
188746
- if (!reader)
188747
- throw ERROR_RESPONSE_BODY_READER;
188748
- const chunks = [];
188749
- let received = 0;
188750
- for (; ; ) {
188751
- const { done, value } = await reader.read();
188752
- const delta = value ? value.length : 0;
188753
- if (done) {
188754
- if (total != -1 && total !== received)
188755
- throw ERROR_INCOMPLETED_DOWNLOAD;
188756
- cb && cb({ url, total, received, delta, done });
188757
- break;
188758
- }
188759
- chunks.push(value);
188760
- received += delta;
188761
- cb && cb({ url, total, received, delta, done });
188762
- }
188763
- const data = new Uint8Array(received);
188764
- let position = 0;
188765
- for (const chunk of chunks) {
188766
- data.set(chunk, position);
188767
- position += chunk.length;
188768
- }
188769
- buf = data.buffer;
188770
- } catch (e3) {
188771
- console.log(`failed to send download progress event: `, e3);
188772
- buf = await resp.arrayBuffer();
188773
- cb && cb({
188774
- url,
188775
- total: buf.byteLength,
188776
- received: buf.byteLength,
188777
- delta: 0,
188778
- done: true
188779
- });
188780
- }
188781
- return buf;
188782
- };
188783
- toBlobURL = async (url, mimeType, progress = false, cb) => {
188784
- const buf = progress ? await downloadWithProgress(url, cb) : await (await fetch(url)).arrayBuffer();
188785
- const blob = new Blob([buf], { type: mimeType });
188786
- return URL.createObjectURL(blob);
188787
- };
188788
- }
188789
- });
188790
-
188791
- // ../media-react/src/ffmpegLoader.ts
188792
- async function loadBrowserFfmpeg(options = {}) {
188793
- let modules;
188794
- try {
188795
- const [ffmpegModule, utilModule] = await Promise.all([
188796
- Promise.resolve().then(() => (init_esm9(), esm_exports)),
188797
- Promise.resolve().then(() => (init_esm10(), esm_exports2))
188798
- ]);
188799
- modules = {
188800
- FFmpeg: ffmpegModule.FFmpeg,
188801
- fetchFile: utilModule.fetchFile
188802
- };
188803
- } catch (error) {
188804
- return err({ tag: "ffmpeg-import-failed", message: errorMessage(error, "Failed to import FFmpeg") });
188805
- }
188806
- const ffmpeg = new modules.FFmpeg();
188807
- try {
188808
- await ffmpeg.load({
188809
- coreURL: `${FFMPEG_CORE_BASE_PATH}/ffmpeg-core.js`,
188810
- wasmURL: `${FFMPEG_CORE_BASE_PATH}/ffmpeg-core.wasm`
188811
- }, { signal: options.signal });
188812
- } catch (error) {
188813
- ffmpeg.terminate();
188814
- return err({ tag: "ffmpeg-core-load-failed", message: errorMessage(error, "Failed to load FFmpeg") });
188815
- }
188816
- return ok({ ffmpeg, fetchFile: modules.fetchFile });
188817
- }
188818
- function errorMessage(error, fallback2) {
188819
- return error instanceof Error && error.message.trim() ? error.message : fallback2;
188820
- }
188821
- var FFMPEG_CORE_VERSION, FFMPEG_CORE_BASE_PATH;
188822
- var init_ffmpegLoader = __esm({
188823
- "../media-react/src/ffmpegLoader.ts"() {
188824
- "use client";
188825
- init_src3();
188826
- FFMPEG_CORE_VERSION = "0.12.10";
188827
- FFMPEG_CORE_BASE_PATH = `/vendor/ffmpeg/core/${FFMPEG_CORE_VERSION}`;
188828
- }
188829
- });
188830
-
188831
- // ../media-react/src/videoFrameExtraction.ts
188832
- function extractVideoPosterFrame(input, options = {}) {
188833
- return new Promise((resolve) => {
188834
- const video = document.createElement("video");
188835
- const canvas = document.createElement("canvas");
188836
- const source = resolveVideoSource(input);
188837
- let settled = false;
188838
- let metadataLoaded = false;
188839
- const cleanup = () => {
188840
- video.onloadedmetadata = null;
188841
- video.onseeked = null;
188842
- video.onerror = null;
188843
- video.src = "";
188844
- video.load();
188845
- if (source.objectUrl !== void 0) {
188846
- URL.revokeObjectURL(source.objectUrl);
188847
- }
188848
- };
188849
- const finish = (result) => {
188850
- if (settled) return;
188851
- settled = true;
188852
- cleanup();
188853
- resolve(result);
188854
- };
188855
- const duration = () => video.duration;
188856
- const width = () => video.videoWidth;
188857
- const height = () => video.videoHeight;
188858
- video.crossOrigin = options.crossOrigin ?? "anonymous";
188859
- video.preload = "metadata";
188860
- video.src = source.src;
188861
- video.onloadedmetadata = () => {
188862
- if (settled) return;
188863
- metadataLoaded = true;
188864
- if (!isValidVideoMetadata(duration(), width(), height())) {
188865
- finish(err({
188866
- tag: "invalid-video-metadata",
188867
- durationSeconds: duration(),
188868
- width: width(),
188869
- height: height()
188870
- }));
188871
- return;
188872
- }
188873
- try {
188874
- video.currentTime = resolvePosterSeekSeconds(duration(), options.seekSeconds);
188875
- } catch {
188876
- finish(err({ tag: "video-seek-failed" }));
188877
- }
188878
- };
188879
- video.onseeked = () => {
188880
- if (settled) return;
188881
- const drawn = drawFrameToCanvas({ video, canvas, width: width(), height: height() });
188882
- if (!drawn.ok) {
188883
- finish(err(drawn.error));
188884
- return;
188885
- }
188886
- void encodeCanvasToBlob(canvas, options).then((encoded) => {
188887
- if (!encoded.ok) {
188888
- finish(err(encoded.error));
188889
- return;
188890
- }
188891
- finish(ok({
188892
- posterBlob: encoded.value,
188893
- durationSeconds: duration(),
188894
- width: width(),
188895
- height: height()
188896
- }));
188897
- });
188898
- };
188899
- video.onerror = () => {
188900
- if (settled) return;
188901
- finish(metadataLoaded ? err({ tag: "video-seek-failed" }) : err({ tag: "video-load-failed" }));
188902
- };
188903
- video.load();
188904
- });
188905
- }
188906
- function resolveVideoSource(input) {
188907
- if (typeof input === "string") {
188908
- return { src: input };
188909
- }
188910
- const objectUrl = URL.createObjectURL(input);
188911
- return { src: objectUrl, objectUrl };
188912
- }
188913
- function drawFrameToCanvas(input) {
188914
- input.canvas.width = input.width;
188915
- input.canvas.height = input.height;
188916
- const context = input.canvas.getContext("2d");
188917
- if (!context) {
188918
- return err({ tag: "canvas-context-unavailable" });
188919
- }
188920
- try {
188921
- context.drawImage(input.video, 0, 0, input.width, input.height);
188922
- return ok(void 0);
188923
- } catch (error) {
188924
- return err({
188925
- tag: "canvas-draw-failed",
188926
- message: error instanceof Error ? error.message : "Canvas draw failed"
188927
- });
188928
- }
188929
- }
188930
- function encodeCanvasToBlob(canvas, options) {
188931
- return new Promise((resolve) => {
188932
- try {
188933
- canvas.toBlob(
188934
- (posterBlob) => {
188935
- resolve(
188936
- posterBlob ? ok(posterBlob) : err({ tag: "poster-blob-unavailable" })
188937
- );
188938
- },
188939
- options.posterMimeType ?? "image/jpeg",
188940
- normalizePosterQuality(options.posterQuality)
188941
- );
188942
- } catch (error) {
188943
- resolve(err({
188944
- tag: "canvas-draw-failed",
188945
- message: error instanceof Error ? error.message : "Canvas encode failed"
188946
- }));
188947
- }
188948
- });
188949
- }
188950
- function isValidVideoMetadata(durationSeconds, width, height) {
188951
- return Number.isFinite(durationSeconds) && durationSeconds > 0 && Number.isFinite(width) && width > 0 && Number.isFinite(height) && height > 0;
188952
- }
188953
- function resolvePosterSeekSeconds(durationSeconds, preferredSeekSeconds) {
188954
- if (preferredSeekSeconds !== void 0) {
188955
- return Math.min(Math.max(0, preferredSeekSeconds), durationSeconds);
188956
- }
188957
- return Math.min(1, durationSeconds * 0.1);
188958
- }
188959
- function normalizePosterQuality(quality) {
188960
- if (quality === void 0 || !Number.isFinite(quality)) {
188961
- return 0.85;
188962
- }
188963
- return Math.min(1, Math.max(0, quality));
188964
- }
188965
- var init_videoFrameExtraction = __esm({
188966
- "../media-react/src/videoFrameExtraction.ts"() {
188967
- "use client";
188968
- init_src3();
188969
- }
188970
- });
188971
-
188972
- // ../media-react/src/videoPrepBrowser.ts
188973
- async function prepareBrowserVideoUpload(input) {
188974
- const policy = deriveVideoPrepPolicy(input.intent);
188975
- input.onProgress?.({ tag: "metadata" });
188976
- const poster = await extractVideoPosterFrame(input.file);
188977
- if (!poster.ok) {
188978
- return err({ tag: "metadata-load-failed", error: poster.error });
188979
- }
188980
- const metadata = {
188981
- byteSize: input.file.size,
188982
- durationSeconds: poster.value.durationSeconds,
188983
- width: poster.value.width,
188984
- height: poster.value.height
188985
- };
188986
- const validation = validateVideoPrepSource(metadata, policy);
188987
- if (!validation.ok) {
188988
- return err({ tag: "source-validation-failed", error: validation.error });
188989
- }
188990
- input.onProgress?.({ tag: "validated", metadata });
188991
- if (!shouldTranscode(input.file, metadata, policy)) {
188992
- const result2 = browserVideoPrepResult({
188993
- file: input.file,
188994
- originalFile: input.file,
188995
- policy,
188996
- metadata,
188997
- posterBlob: poster.value.posterBlob,
188998
- outputTag: "original"
188999
- });
189000
- input.onProgress?.({ tag: "complete", output: result2.output.tag });
189001
- return ok(result2);
189002
- }
189003
- input.onProgress?.({ tag: "ffmpeg-load" });
189004
- const runtime = await (input.loadFfmpeg ?? loadBrowserFfmpeg)({ signal: input.signal });
189005
- if (!runtime.ok) {
189006
- if (policy.allowOriginalFallback) {
189007
- return ok(fallbackOriginal(input, policy, metadata, poster.value.posterBlob, {
189008
- tag: "compression-failed",
189009
- message: runtime.error.message
189010
- }));
189011
- }
189012
- return err({ tag: "ffmpeg-load-failed", error: runtime.error });
189013
- }
189014
- const compressed = await transcodeVideo({
189015
- runtime: runtime.value,
189016
- file: input.file,
189017
- policy,
189018
- timeoutMs: input.timeoutMs ?? DEFAULT_FFMPEG_TIMEOUT_MS,
189019
- signal: input.signal,
189020
- onProgress: input.onProgress
189021
- });
189022
- if (!compressed.ok) {
189023
- if (policy.allowOriginalFallback) {
189024
- return ok(fallbackOriginal(input, policy, metadata, poster.value.posterBlob, compressed.error));
189025
- }
189026
- return err(compressed.error);
189027
- }
189028
- const result = browserVideoPrepResult({
189029
- file: compressed.value,
189030
- originalFile: input.file,
189031
- policy,
189032
- metadata,
189033
- posterBlob: poster.value.posterBlob,
189034
- outputTag: "compressed"
189035
- });
189036
- input.onProgress?.({ tag: "complete", output: result.output.tag });
189037
- return ok(result);
189038
- }
189039
- function browserVideoPrepResult(input) {
189040
- return {
189041
- file: input.file,
189042
- originalFile: input.originalFile,
189043
- policy: input.policy,
189044
- metadata: input.metadata,
189045
- preparedMetadata: preparedMetadataForOutput(input.metadata, input.policy, input.outputTag),
189046
- posterBlob: input.posterBlob,
189047
- output: {
189048
- tag: input.outputTag,
189049
- originalBytes: input.originalFile.size,
189050
- preparedBytes: input.file.size
189051
- }
189052
- };
189053
- }
189054
- function fallbackOriginal(input, policy, metadata, posterBlob, reason) {
189055
- input.onProgress?.({ tag: "fallback-original", reason });
189056
- const result = browserVideoPrepResult({
189057
- file: input.file,
189058
- originalFile: input.file,
189059
- policy,
189060
- metadata,
189061
- posterBlob,
189062
- outputTag: "fallback-original"
189063
- });
189064
- input.onProgress?.({ tag: "complete", output: result.output.tag });
189065
- return result;
189066
- }
189067
- function shouldTranscode(file, metadata, policy) {
189068
- return policy.stripAudio || metadata.width > policy.targetMaxDimensionPixels || metadata.height > policy.targetMaxDimensionPixels || file.type !== PREPARED_VIDEO_MIME_TYPE;
189069
- }
189070
- function preparedMetadataForOutput(metadata, policy, outputTag) {
189071
- if (outputTag !== "compressed") {
189072
- return metadata;
189073
- }
189074
- const maxDimension = Math.max(metadata.width, metadata.height);
189075
- if (maxDimension <= policy.targetMaxDimensionPixels) {
189076
- return metadata;
189077
- }
189078
- const scale = policy.targetMaxDimensionPixels / maxDimension;
189079
- return {
189080
- ...metadata,
189081
- width: evenPositiveInteger(metadata.width * scale),
189082
- height: evenPositiveInteger(metadata.height * scale)
189083
- };
189084
- }
189085
- function evenPositiveInteger(value) {
189086
- return Math.max(2, Math.round(value / 2) * 2);
189087
- }
189088
- async function transcodeVideo(input) {
189089
- const progressListener = ({ progress }) => {
189090
- input.onProgress?.({ tag: "compressing", progress: Math.min(1, Math.max(0, progress)) });
189091
- };
189092
- input.runtime.ffmpeg.on("progress", progressListener);
189093
- try {
189094
- await input.runtime.ffmpeg.writeFile(INPUT_FILENAME, await input.runtime.fetchFile(input.file), { signal: input.signal });
189095
- const exitCode3 = await input.runtime.ffmpeg.exec(
189096
- ffmpegArgsForPolicy(input.policy),
189097
- input.timeoutMs,
189098
- { signal: input.signal }
189099
- );
189100
- if (exitCode3 !== 0) {
189101
- return err(exitCode3 === 1 ? { tag: "timed-out" } : { tag: "compression-failed", message: `FFmpeg exited with code ${exitCode3}` });
189102
- }
189103
- const output = await input.runtime.ffmpeg.readFile(OUTPUT_FILENAME, "binary", { signal: input.signal });
189104
- if (!(output instanceof Uint8Array) || output.byteLength === 0) {
189105
- return err({ tag: "compressed-output-invalid" });
189106
- }
189107
- const outputBuffer = new ArrayBuffer(output.byteLength);
189108
- new Uint8Array(outputBuffer).set(output);
189109
- return ok(new File([outputBuffer], mp4Filename(input.file.name), { type: PREPARED_VIDEO_MIME_TYPE }));
189110
- } catch (error) {
189111
- return err(isAbortError(error) ? { tag: "aborted" } : { tag: "compression-failed", message: errorMessage2(error, "Video compression failed") });
189112
- } finally {
189113
- input.runtime.ffmpeg.off("progress", progressListener);
189114
- await deleteFfmpegFile(input.runtime.ffmpeg, INPUT_FILENAME);
189115
- await deleteFfmpegFile(input.runtime.ffmpeg, OUTPUT_FILENAME);
189116
- input.runtime.ffmpeg.terminate();
189117
- }
189118
- }
189119
- function ffmpegArgsForPolicy(policy) {
189120
- return [
189121
- "-i",
189122
- INPUT_FILENAME,
189123
- "-vf",
189124
- scaleFilter(policy.targetMaxDimensionPixels),
189125
- "-c:v",
189126
- "libx264",
189127
- "-preset",
189128
- "veryfast",
189129
- "-crf",
189130
- "28",
189131
- "-movflags",
189132
- "+faststart",
189133
- ...policy.stripAudio ? ["-an"] : ["-c:a", "aac", "-b:a", "128k"],
189134
- OUTPUT_FILENAME
189135
- ];
189136
- }
189137
- function scaleFilter(targetMaxDimensionPixels) {
189138
- const boundedWidth = `if(gte(iw,ih),min(${targetMaxDimensionPixels},iw),-2)`;
189139
- const boundedHeight = `if(gte(iw,ih),-2,min(${targetMaxDimensionPixels},ih))`;
189140
- return `scale='${boundedWidth}':'${boundedHeight}'`;
189141
- }
189142
- async function deleteFfmpegFile(ffmpeg, path) {
189143
- await ffmpeg.deleteFile(path).catch(() => void 0);
189144
- }
189145
- function mp4Filename(filename) {
189146
- const dotIndex = filename.lastIndexOf(".");
189147
- const baseName = dotIndex > 0 ? filename.slice(0, dotIndex) : filename;
189148
- return `${baseName}.mp4`;
189149
- }
189150
- function isAbortError(error) {
189151
- return error instanceof DOMException && error.name === "AbortError";
189152
- }
189153
- function errorMessage2(error, fallback2) {
189154
- return error instanceof Error && error.message.trim() ? error.message : fallback2;
189155
- }
189156
- var DEFAULT_FFMPEG_TIMEOUT_MS, INPUT_FILENAME, OUTPUT_FILENAME, PREPARED_VIDEO_MIME_TYPE;
189157
- var init_videoPrepBrowser = __esm({
189158
- "../media-react/src/videoPrepBrowser.ts"() {
189159
- "use client";
189160
- init_src5();
189161
- init_src3();
189162
- init_ffmpegLoader();
189163
- init_videoFrameExtraction();
189164
- DEFAULT_FFMPEG_TIMEOUT_MS = 12e4;
189165
- INPUT_FILENAME = "input-video";
189166
- OUTPUT_FILENAME = "prepared-video.mp4";
189167
- PREPARED_VIDEO_MIME_TYPE = "video/mp4";
189168
- }
189169
- });
189170
188369
  async function maybePrepareVideoFile(input) {
189171
188370
  if (input.videoPrepIntent === void 0) {
189172
188371
  return { file: input.file };
189173
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();
189174
188377
  const result = await prepareBrowserVideoUpload({
189175
188378
  file: input.file,
189176
188379
  intent: input.videoPrepIntent,
@@ -189330,7 +188533,6 @@ var init_useApiMediaUploader = __esm({
189330
188533
  init_common();
189331
188534
  init_request();
189332
188535
  init_common();
189333
- init_videoPrepBrowser();
189334
188536
  init_classification();
189335
188537
  MediaUploaderError = class extends Error {
189336
188538
  constructor(message2, options = {}) {
@@ -189348,6 +188550,7 @@ var init_useApiMediaUploader = __esm({
189348
188550
  autoClassify = true,
189349
188551
  uploadIntent,
189350
188552
  videoPrepIntent,
188553
+ loadVideoPrep,
189351
188554
  onClassification,
189352
188555
  logger: providedLogger
189353
188556
  }) => {
@@ -189380,6 +188583,7 @@ var init_useApiMediaUploader = __esm({
189380
188583
  const prepared = await maybePrepareVideoFile({
189381
188584
  file,
189382
188585
  videoPrepIntent: resolvedVideoPrepIntent,
188586
+ loadVideoPrep,
189383
188587
  onProgress
189384
188588
  });
189385
188589
  preparedVideo = prepared.videoPrepResult;
@@ -189444,7 +188648,7 @@ var init_useApiMediaUploader = __esm({
189444
188648
  }
189445
188649
  return asset;
189446
188650
  },
189447
- [siteId, autoClassify, onClassification, uploadIntent, videoPrepIntent]
188651
+ [siteId, autoClassify, onClassification, uploadIntent, videoPrepIntent, loadVideoPrep]
189448
188652
  );
189449
188653
  };
189450
188654
  putBlobToSignedUrl = ({
@@ -189889,7 +189093,7 @@ function debounce(callback, delay) {
189889
189093
  return result;
189890
189094
  }
189891
189095
  var isObject4;
189892
- var init_utils14 = __esm({
189096
+ var init_utils13 = __esm({
189893
189097
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/utils/index.js"() {
189894
189098
  isObject4 = function(term) {
189895
189099
  return term !== null && typeof term === "object";
@@ -190189,11 +189393,11 @@ function getCloserSize(candidates, reference, sizeRestrictions2, aspectRatio2) {
190189
189393
  };
190190
189394
  return traverse2() || traverse2(true);
190191
189395
  }
190192
- var init_utils15 = __esm({
189396
+ var init_utils14 = __esm({
190193
189397
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/utils.js"() {
190194
189398
  init_tslib_es6();
190195
189399
  init_constants6();
190196
- init_utils14();
189400
+ init_utils13();
190197
189401
  }
190198
189402
  });
190199
189403
 
@@ -190305,8 +189509,8 @@ function isConsistentState(state, settings) {
190305
189509
  var init_helpers3 = __esm({
190306
189510
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/helpers.js"() {
190307
189511
  init_tslib_es6();
189512
+ init_utils13();
190308
189513
  init_utils14();
190309
- init_utils15();
190310
189514
  init_sizeRestrictions();
190311
189515
  }
190312
189516
  });
@@ -190363,8 +189567,8 @@ function calculateAreaSizeRestrictions(state, settings) {
190363
189567
  var init_sizeRestrictions = __esm({
190364
189568
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/sizeRestrictions.js"() {
190365
189569
  init_tslib_es6();
189570
+ init_utils13();
190366
189571
  init_utils14();
190367
- init_utils15();
190368
189572
  init_helpers3();
190369
189573
  }
190370
189574
  });
@@ -190375,13 +189579,13 @@ function copyState(state) {
190375
189579
  }
190376
189580
  var init_copyState = __esm({
190377
189581
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/copyState.js"() {
190378
- init_utils14();
189582
+ init_utils13();
190379
189583
  }
190380
189584
  });
190381
189585
 
190382
189586
  // ../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/types/index.js
190383
189587
  var ImageRestriction, Priority;
190384
- var init_types28 = __esm({
189588
+ var init_types27 = __esm({
190385
189589
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/types/index.js"() {
190386
189590
  (function(ImageRestriction2) {
190387
189591
  ImageRestriction2["fillArea"] = "fillArea";
@@ -190425,7 +189629,7 @@ function approximateSize(params) {
190425
189629
  }
190426
189630
  var init_approximateSize = __esm({
190427
189631
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/approximateSize.js"() {
190428
- init_utils15();
189632
+ init_utils14();
190429
189633
  }
190430
189634
  });
190431
189635
 
@@ -190451,7 +189655,7 @@ function fitVisibleArea(state, settings) {
190451
189655
  var init_fitVisibleArea = __esm({
190452
189656
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/fitVisibleArea.js"() {
190453
189657
  init_tslib_es6();
190454
- init_utils15();
189658
+ init_utils14();
190455
189659
  init_helpers3();
190456
189660
  init_copyState();
190457
189661
  init_approximateSize();
@@ -190465,7 +189669,7 @@ function moveCoordinatesAlgorithm(coordinates, directions3, positionRestrictions
190465
189669
  }
190466
189670
  var init_moveCoordinatesAlgorithm = __esm({
190467
189671
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/moveCoordinatesAlgorithm.js"() {
190468
- init_utils15();
189672
+ init_utils14();
190469
189673
  }
190470
189674
  });
190471
189675
 
@@ -190539,8 +189743,8 @@ var SetCoordinatesMode;
190539
189743
  var init_setCoordinates = __esm({
190540
189744
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/setCoordinates.js"() {
190541
189745
  init_tslib_es6();
189746
+ init_utils13();
190542
189747
  init_utils14();
190543
- init_utils15();
190544
189748
  init_helpers3();
190545
189749
  init_copyState();
190546
189750
  init_approximateSize();
@@ -190580,7 +189784,7 @@ function fitCoordinates(state, settings) {
190580
189784
  var init_fitCoordinates = __esm({
190581
189785
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/fitCoordinates.js"() {
190582
189786
  init_tslib_es6();
190583
- init_utils15();
189787
+ init_utils14();
190584
189788
  init_helpers3();
190585
189789
  init_copyState();
190586
189790
  init_approximateSize();
@@ -190646,7 +189850,7 @@ function createState(options, settings) {
190646
189850
  var init_createState = __esm({
190647
189851
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/createState.js"() {
190648
189852
  init_helpers3();
190649
- init_types28();
189853
+ init_types27();
190650
189854
  init_setCoordinates();
190651
189855
  init_setVisibleArea();
190652
189856
  }
@@ -190664,7 +189868,7 @@ function moveCoordinates(state, settings, directions3) {
190664
189868
  }
190665
189869
  var init_moveCoordinates = __esm({
190666
189870
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/moveCoordinates.js"() {
190667
- init_utils15();
189871
+ init_utils14();
190668
189872
  init_helpers3();
190669
189873
  init_copyState();
190670
189874
  }
@@ -190954,8 +190158,8 @@ var init_resizeCoordinatesAlgorithm = __esm({
190954
190158
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/resizeCoordinatesAlgorithm.js"() {
190955
190159
  init_tslib_es6();
190956
190160
  init_constants6();
190161
+ init_utils13();
190957
190162
  init_utils14();
190958
- init_utils15();
190959
190163
  init_moveCoordinatesAlgorithm();
190960
190164
  }
190961
190165
  });
@@ -190978,7 +190182,7 @@ function resizeCoordinates(state, settings, anchor, directions3, options) {
190978
190182
  var init_resizeCoordinates = __esm({
190979
190183
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/resizeCoordinates.js"() {
190980
190184
  init_tslib_es6();
190981
- init_utils15();
190185
+ init_utils14();
190982
190186
  init_helpers3();
190983
190187
  init_copyState();
190984
190188
  init_resizeCoordinatesAlgorithm();
@@ -191012,7 +190216,7 @@ function setBoundary(state, settings, boundary) {
191012
190216
  var init_setBoundary = __esm({
191013
190217
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/setBoundary.js"() {
191014
190218
  init_tslib_es6();
191015
- init_utils15();
190219
+ init_utils14();
191016
190220
  init_helpers3();
191017
190221
  init_copyState();
191018
190222
  init_fitCoordinates();
@@ -191051,8 +190255,8 @@ function rotateImageAlgorithm(state, settings, rotate) {
191051
190255
  var init_rotateImageAlgorithm = __esm({
191052
190256
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/rotateImageAlgorithm.js"() {
191053
190257
  init_tslib_es6();
190258
+ init_utils13();
191054
190259
  init_utils14();
191055
- init_utils15();
191056
190260
  init_sizeRestrictions();
191057
190261
  init_helpers3();
191058
190262
  init_copyState();
@@ -191101,7 +190305,7 @@ function flipImageAlgorithm(state, settings, horizontal, vertical) {
191101
190305
  }
191102
190306
  var init_flipImageAlgorithm = __esm({
191103
190307
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/flipImageAlgorithm.js"() {
191104
- init_utils15();
190308
+ init_utils14();
191105
190309
  init_helpers3();
191106
190310
  init_copyState();
191107
190311
  }
@@ -191187,8 +190391,8 @@ function transformImageAlgorithm(state, settings, transform) {
191187
190391
  }
191188
190392
  var init_transformImageAlgorithm = __esm({
191189
190393
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/algorithms/transformImageAlgorithm.js"() {
190394
+ init_utils13();
191190
190395
  init_utils14();
191191
- init_utils15();
191192
190396
  init_helpers3();
191193
190397
  init_copyState();
191194
190398
  }
@@ -191254,7 +190458,7 @@ function reconcileState(state, settings) {
191254
190458
  var init_reconcileState = __esm({
191255
190459
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/state/reconcileState.js"() {
191256
190460
  init_tslib_es6();
191257
- init_utils15();
190461
+ init_utils14();
191258
190462
  init_sizeRestrictions();
191259
190463
  init_helpers3();
191260
190464
  init_copyState();
@@ -191337,7 +190541,7 @@ function normalizeImageTransform(state, transform) {
191337
190541
  }
191338
190542
  var init_normalize2 = __esm({
191339
190543
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/normalize.js"() {
191340
- init_utils14();
190544
+ init_utils13();
191341
190545
  init_helpers3();
191342
190546
  }
191343
190547
  });
@@ -191423,7 +190627,7 @@ function wheelEventToImageTransform(event, container, ratio2) {
191423
190627
  }
191424
190628
  var init_imageTransforms = __esm({
191425
190629
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/imageTransforms.js"() {
191426
- init_utils14();
190630
+ init_utils13();
191427
190631
  }
191428
190632
  });
191429
190633
 
@@ -191515,7 +190719,7 @@ function defaultVisibleArea(state, settings) {
191515
190719
  var init_defaultVisibleArea = __esm({
191516
190720
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultVisibleArea.js"() {
191517
190721
  init_tslib_es6();
191518
- init_utils15();
190722
+ init_utils14();
191519
190723
  init_helpers3();
191520
190724
  }
191521
190725
  });
@@ -191548,7 +190752,7 @@ function defaultSize(state, settings) {
191548
190752
  var init_defaultSize = __esm({
191549
190753
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultSize.js"() {
191550
190754
  init_tslib_es6();
191551
- init_utils15();
190755
+ init_utils14();
191552
190756
  init_helpers3();
191553
190757
  init_approximateSize();
191554
190758
  }
@@ -191568,7 +190772,7 @@ function pixelsRestrictions(state, settings) {
191568
190772
  }
191569
190773
  var init_defaultSizeRestrictions = __esm({
191570
190774
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultSizeRestrictions.js"() {
191571
- init_utils14();
190775
+ init_utils13();
191572
190776
  }
191573
190777
  });
191574
190778
 
@@ -191635,9 +190839,9 @@ function defaultAreaPositionRestrictions(state, settings) {
191635
190839
  }
191636
190840
  var init_defaultAreaPositionRestrictions = __esm({
191637
190841
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultAreaPositionRestrictions.js"() {
191638
- init_utils15();
190842
+ init_utils14();
191639
190843
  init_helpers3();
191640
- init_types28();
190844
+ init_types27();
191641
190845
  }
191642
190846
  });
191643
190847
 
@@ -191668,9 +190872,9 @@ function defaultAreaSizeRestrictions(state, settings) {
191668
190872
  }
191669
190873
  var init_defaultAreaSizeRestrictions = __esm({
191670
190874
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultAreaSizeRestrictions.js"() {
191671
- init_utils15();
190875
+ init_utils14();
191672
190876
  init_helpers3();
191673
- init_types28();
190877
+ init_types27();
191674
190878
  }
191675
190879
  });
191676
190880
 
@@ -191698,8 +190902,8 @@ function defaultStencilConstraints(rawSettings, stencilProps) {
191698
190902
  }
191699
190903
  var init_defaultStencilConstraints = __esm({
191700
190904
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/defaultStencilConstraints.js"() {
190905
+ init_utils13();
191701
190906
  init_utils14();
191702
- init_utils15();
191703
190907
  }
191704
190908
  });
191705
190909
 
@@ -191767,8 +190971,8 @@ function createDefaultSettings(params) {
191767
190971
  var init_defaults5 = __esm({
191768
190972
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/defaults/index.js"() {
191769
190973
  init_tslib_es6();
190974
+ init_utils13();
191770
190975
  init_utils14();
191771
- init_utils15();
191772
190976
  init_sizeRestrictions();
191773
190977
  init_defaultPositionRestrictions();
191774
190978
  init_defaultVisibleArea();
@@ -191798,7 +191002,7 @@ var AbstractCropperInstance;
191798
191002
  var init_AbstractCropperInstance = __esm({
191799
191003
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/instance/AbstractCropperInstance.js"() {
191800
191004
  init_tslib_es6();
191801
- init_utils14();
191005
+ init_utils13();
191802
191006
  init_helpers3();
191803
191007
  init_copyState();
191804
191008
  init_setCoordinates();
@@ -192444,8 +191648,8 @@ function drawCroppedArea(state, image, resultCanvas, spareCanvas, options) {
192444
191648
  var init_canvas = __esm({
192445
191649
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/canvas/index.js"() {
192446
191650
  init_tslib_es6();
191651
+ init_utils13();
192447
191652
  init_utils14();
192448
- init_utils15();
192449
191653
  init_helpers3();
192450
191654
  init_approximateSize();
192451
191655
  }
@@ -192826,8 +192030,8 @@ var XHR_DONE;
192826
192030
  var init_image3 = __esm({
192827
192031
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/image/index.js"() {
192828
192032
  init_tslib_es6();
192033
+ init_utils13();
192829
192034
  init_utils14();
192830
- init_utils15();
192831
192035
  init_helpers3();
192832
192036
  XHR_DONE = 4;
192833
192037
  }
@@ -192836,10 +192040,10 @@ var init_image3 = __esm({
192836
192040
  // ../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/index.js
192837
192041
  var init_advanced_cropper = __esm({
192838
192042
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/index.js"() {
192043
+ init_utils13();
192839
192044
  init_utils14();
192840
- init_utils15();
192841
192045
  init_helpers3();
192842
- init_types28();
192046
+ init_types27();
192843
192047
  init_imageTransforms();
192844
192048
  init_interactions();
192845
192049
  init_defaultBoundary();
@@ -192856,7 +192060,7 @@ var init_advanced_cropper = __esm({
192856
192060
  // ../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/index.js
192857
192061
  var init_service = __esm({
192858
192062
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/service/index.js"() {
192859
- init_utils15();
192063
+ init_utils14();
192860
192064
  init_helpers3();
192861
192065
  }
192862
192066
  });
@@ -193022,8 +192226,8 @@ function fixedStencil(state, settings, action) {
193022
192226
  var init_stencil_size = __esm({
193023
192227
  "../../node_modules/.pnpm/advanced-cropper@0.17.1/node_modules/advanced-cropper/extensions/stencil-size/index.js"() {
193024
192228
  init_tslib_es6();
192229
+ init_utils13();
193025
192230
  init_utils14();
193026
- init_utils15();
193027
192231
  init_helpers3();
193028
192232
  init_copyState();
193029
192233
  init_approximateSize();
@@ -196185,7 +195389,7 @@ function classifyMimeForPreview(mimeType) {
196185
195389
  }
196186
195390
  if (mimeType === "application/zip") return { label: "ZIP", Icon: Archive };
196187
195391
  if (mimeType.startsWith("text/") || mimeType.includes("document")) return { label: "Document", Icon: FileText };
196188
- return { label: "File", Icon: File2 };
195392
+ return { label: "File", Icon: File };
196189
195393
  }
196190
195394
  function cx2(...values) {
196191
195395
  return values.filter(Boolean).join(" ");
@@ -196206,7 +195410,7 @@ function isSvgUrl(url) {
196206
195410
  return normalized.endsWith(".svg");
196207
195411
  }
196208
195412
  var DEFAULT_HOTSPOT, hasMediaValue, isImageValue, isVideoValue, isAudioValue, isDocumentValue, isSpreadsheetValue, isArchiveValue, isSvgValue;
196209
- var init_utils16 = __esm({
195413
+ var init_utils15 = __esm({
196210
195414
  "../media-editor/src/utils.ts"() {
196211
195415
  DEFAULT_HOTSPOT = { x: 0.5, y: 0.5, radius: 0.35 };
196212
195416
  hasMediaValue = (value) => Boolean(value && (value.assetId || value.storagePath || value.src || value.identifier));
@@ -196287,7 +195491,7 @@ var init_MediaPickerDialog = __esm({
196287
195491
  init_src5();
196288
195492
  init_lucide_react();
196289
195493
  init_FileAssetPreview();
196290
- init_utils16();
195494
+ init_utils15();
196291
195495
  init_mediaKinds();
196292
195496
  MediaPickerDialog = ({
196293
195497
  allowedKinds,
@@ -196511,7 +195715,7 @@ var init_MediaPreview = __esm({
196511
195715
  init_src();
196512
195716
  init_lucide_react();
196513
195717
  init_src7();
196514
- init_utils16();
195718
+ init_utils15();
196515
195719
  init_context3();
196516
195720
  MediaPreview = ({
196517
195721
  value,
@@ -196600,7 +195804,7 @@ var init_MediaPreview = __esm({
196600
195804
  document2 ? /* @__PURE__ */ jsx(FileText, { className: "h-8 w-8", "aria-hidden": "true" }) : null,
196601
195805
  spreadsheet ? /* @__PURE__ */ jsx(FileSpreadsheet, { className: "h-8 w-8", "aria-hidden": "true" }) : null,
196602
195806
  archive ? /* @__PURE__ */ jsx(FileArchive, { className: "h-8 w-8", "aria-hidden": "true" }) : null,
196603
- !document2 && !spreadsheet && !archive ? /* @__PURE__ */ jsx(File2, { className: "h-8 w-8", "aria-hidden": "true" }) : null,
195807
+ !document2 && !spreadsheet && !archive ? /* @__PURE__ */ jsx(File, { className: "h-8 w-8", "aria-hidden": "true" }) : null,
196604
195808
  /* @__PURE__ */ jsx("p", { className: "max-w-full truncate", children: fileLabel })
196605
195809
  ] }) : null,
196606
195810
  !hasValue ? /* @__PURE__ */ jsxs(
@@ -196808,7 +196012,7 @@ var ASPECT_MATCH_EPSILON;
196808
196012
  var init_transformModel = __esm({
196809
196013
  "../media-editor/src/transformModel.ts"() {
196810
196014
  init_src5();
196811
- init_utils16();
196015
+ init_utils15();
196812
196016
  ASPECT_MATCH_EPSILON = 1e-6;
196813
196017
  }
196814
196018
  });
@@ -196857,7 +196061,7 @@ var init_MediaEditor = __esm({
196857
196061
  init_debug();
196858
196062
  init_mediaKinds();
196859
196063
  init_transformModel();
196860
- init_utils16();
196064
+ init_utils15();
196861
196065
  MEDIA_PICKER_PAGE_SIZE = 18;
196862
196066
  MediaEditor = ({
196863
196067
  value,
@@ -196884,6 +196088,7 @@ var init_MediaEditor = __esm({
196884
196088
  const scopedUploader = useApiMediaUploader({
196885
196089
  siteId: context.siteId,
196886
196090
  apiClient: context.apiClient,
196091
+ ...context.uploaderOptions,
196887
196092
  uploadIntent,
196888
196093
  videoPrepIntent
196889
196094
  });
@@ -197555,13 +196760,24 @@ function MediaEditorProvider({
197555
196760
  apiClient,
197556
196761
  repo,
197557
196762
  uploader,
196763
+ uploaderOptions,
197558
196764
  getPublicUrl: computePublicUrl,
197559
196765
  registerMediaAsset,
197560
196766
  bearerToken,
197561
196767
  mediaAssetIndex: imageResolveContext.mediaAssetIndex,
197562
196768
  imageResolveContext
197563
196769
  }),
197564
- [apiClient, bearerToken, computePublicUrl, imageResolveContext, registerMediaAsset, repo, siteId, uploader]
196770
+ [
196771
+ apiClient,
196772
+ bearerToken,
196773
+ computePublicUrl,
196774
+ imageResolveContext,
196775
+ registerMediaAsset,
196776
+ repo,
196777
+ siteId,
196778
+ uploader,
196779
+ uploaderOptions
196780
+ ]
197565
196781
  );
197566
196782
  return /* @__PURE__ */ jsx(MediaEditorContextProvider, { value, children: /* @__PURE__ */ jsx(ImageResolveContextProvider, { value: imageResolveContext, children }) });
197567
196783
  }
@@ -199289,7 +198505,7 @@ var init_dateTimeUtils = __esm({
199289
198505
  });
199290
198506
 
199291
198507
  // ../block-form/src/widgets/DateTimeField/utils/index.ts
199292
- var init_utils17 = __esm({
198508
+ var init_utils16 = __esm({
199293
198509
  "../block-form/src/widgets/DateTimeField/utils/index.ts"() {
199294
198510
  init_dateTimeUtils();
199295
198511
  }
@@ -199495,7 +198711,7 @@ var init_DateTimeField = __esm({
199495
198711
  init_src();
199496
198712
  init_FieldFrame();
199497
198713
  init_DateField2();
199498
- init_utils17();
198714
+ init_utils16();
199499
198715
  }
199500
198716
  });
199501
198717
 
@@ -199590,7 +198806,7 @@ var init_slugUtils = __esm({
199590
198806
  });
199591
198807
 
199592
198808
  // ../block-form/src/widgets/SlugField/utils/index.ts
199593
- var init_utils18 = __esm({
198809
+ var init_utils17 = __esm({
199594
198810
  "../block-form/src/widgets/SlugField/utils/index.ts"() {
199595
198811
  init_pathUtils();
199596
198812
  init_slugUtils();
@@ -199674,7 +198890,7 @@ var DEFAULT_SOURCE_FIELD_ID, DEFAULT_STATUS_FIELD_ID, DRAFT_STATUS;
199674
198890
  var init_useSlugAutoGeneration = __esm({
199675
198891
  "../block-form/src/widgets/SlugField/hooks/useSlugAutoGeneration.ts"() {
199676
198892
  init_types22();
199677
- init_utils18();
198893
+ init_utils17();
199678
198894
  DEFAULT_SOURCE_FIELD_ID = "title";
199679
198895
  DEFAULT_STATUS_FIELD_ID = "status";
199680
198896
  DRAFT_STATUS = "draft";
@@ -199748,7 +198964,7 @@ var init_SlugField = __esm({
199748
198964
  init_src();
199749
198965
  init_FieldFrame();
199750
198966
  init_hooks6();
199751
- init_utils18();
198967
+ init_utils17();
199752
198968
  }
199753
198969
  });
199754
198970
 
@@ -201708,7 +200924,7 @@ function getEntryPickerOptionValueForStoredValue(storedValue, items) {
201708
200924
  if (!matched) return isNonEmptyString(storedValue) ? storedValue : null;
201709
200925
  return matched.value;
201710
200926
  }
201711
- var init_utils19 = __esm({
200927
+ var init_utils18 = __esm({
201712
200928
  "../editor-blocks/src/widgets/entry-picker/utils.ts"() {
201713
200929
  }
201714
200930
  });
@@ -201809,7 +201025,7 @@ var init_EntryPickerField = __esm({
201809
201025
  init_client4();
201810
201026
  init_src();
201811
201027
  init_EntryPickerWidgetProvider();
201812
- init_utils19();
201028
+ init_utils18();
201813
201029
  VALID_VALUE_FROM = ["id", "identifier", "slug"];
201814
201030
  }
201815
201031
  });
@@ -201900,7 +201116,7 @@ function isSameLinkValue(a2, b3) {
201900
201116
  function getDisplayTitle2(item) {
201901
201117
  return item.title || item.draftTitle || "Untitled";
201902
201118
  }
201903
- var init_utils20 = __esm({
201119
+ var init_utils19 = __esm({
201904
201120
  "../editor-blocks/src/widgets/link/utils.ts"() {
201905
201121
  init_navigation2();
201906
201122
  init_src7();
@@ -201916,7 +201132,7 @@ function LinkPicker(props2) {
201916
201132
  const { siteId, value, onChange, disabled, initialItems, className, adapters } = props2;
201917
201133
  const [items, setItems] = useState(initialItems ?? []);
201918
201134
  const [loading, setLoading] = useState(false);
201919
- const [errorMessage3, setErrorMessage] = useState(null);
201135
+ const [errorMessage, setErrorMessage] = useState(null);
201920
201136
  const [activeTab, setActiveTab] = useState(getActiveTab(value));
201921
201137
  const [searchQuery, setSearchQuery] = useState("");
201922
201138
  useEffect(() => setActiveTab(getActiveTab(value)), [value]);
@@ -202083,7 +201299,7 @@ function LinkPicker(props2) {
202083
201299
  },
202084
201300
  item.routeId
202085
201301
  );
202086
- }) : /* @__PURE__ */ jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: loading ? "Loading\u2026" : errorMessage3 ?? "No routable content yet" }) }),
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" }) }),
202087
201303
  internalSelectedItem ? /* @__PURE__ */ jsxs("div", { className: "rounded-md border border-border bg-muted/30 px-3 py-2 text-sm", children: [
202088
201304
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
202089
201305
  /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
@@ -202105,7 +201321,7 @@ function LinkPicker(props2) {
202105
201321
  ] }),
202106
201322
  /* @__PURE__ */ jsx("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: internalSelectedItem.path })
202107
201323
  ] }) : null,
202108
- errorMessage3 ? /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: errorMessage3 }) : null
201324
+ errorMessage ? /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: errorMessage }) : null
202109
201325
  ] }) }),
202110
201326
  /* @__PURE__ */ jsx(Content5, { value: "external", className: "focus-visible:outline-none", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2 pt-3", children: [
202111
201327
  /* @__PURE__ */ jsx(Label4, { htmlFor: "link-picker-external", children: "Full URL" }),
@@ -202150,7 +201366,7 @@ var init_LinkPicker = __esm({
202150
201366
  init_dist30();
202151
201367
  init_src();
202152
201368
  init_lucide_react();
202153
- init_utils20();
201369
+ init_utils19();
202154
201370
  }
202155
201371
  });
202156
201372
  function LinkPickerDialog({
@@ -203569,6 +202785,40 @@ function PreviewMediaField({
203569
202785
  }
203570
202786
  return /* @__PURE__ */ jsx(FieldFrame, { label: config.label, description: config.description, children: () => widget });
203571
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
+ }
203572
202822
  var init_PreviewMediaField = __esm({
203573
202823
  "../preview-next/src/client/widgets/PreviewMediaField.tsx"() {
203574
202824
  "use client";
@@ -203646,6 +202896,7 @@ var init_widgetOverrides = __esm({
203646
202896
  init_PreviewMediaField();
203647
202897
  previewWidgetOverrides = {
203648
202898
  link: LinkField,
202899
+ file: PreviewFileField,
203649
202900
  media: PreviewMediaField,
203650
202901
  richText: RichTextField,
203651
202902
  reference: ReferenceField,
@@ -205172,7 +204423,7 @@ var init_useBlockExpandState = __esm({
205172
204423
 
205173
204424
  // ../editor-blocks/src/block-editor/utils.ts
205174
204425
  var normalizeBlockListInitial, reindexBlockList;
205175
- var init_utils21 = __esm({
204426
+ var init_utils20 = __esm({
205176
204427
  "../editor-blocks/src/block-editor/utils.ts"() {
205177
204428
  normalizeBlockListInitial = (items) => {
205178
204429
  const sorted = [...items].map((block, index2) => ({ ...block, orderIndex: block.orderIndex ?? index2 })).sort((a2, b3) => (a2.orderIndex ?? 0) - (b3.orderIndex ?? 0));
@@ -205243,7 +204494,7 @@ function useBlockCreation({
205243
204494
  const [pickerOpen, setPickerOpen] = useState(false);
205244
204495
  const [insertPosition, setInsertPosition] = useState(null);
205245
204496
  const [creatingBlockName, setCreatingBlockName] = useState(null);
205246
- const [errorMessage3, setErrorMessage] = useState(null);
204497
+ const [errorMessage, setErrorMessage] = useState(null);
205247
204498
  const openPicker = useCallback((position) => {
205248
204499
  if (!allowCreation) return;
205249
204500
  setInsertPosition(position);
@@ -205315,7 +204566,7 @@ function useBlockCreation({
205315
204566
  return {
205316
204567
  pickerOpen,
205317
204568
  creatingBlockName,
205318
- errorMessage: errorMessage3,
204569
+ errorMessage,
205319
204570
  setErrorMessage,
205320
204571
  insertPosition,
205321
204572
  setInsertPosition,
@@ -205328,7 +204579,7 @@ var init_useBlockCreation = __esm({
205328
204579
  "../editor-blocks/src/block-editor/hooks/useBlockCreation.ts"() {
205329
204580
  "use client";
205330
204581
  init_blocks2();
205331
- init_utils21();
204582
+ init_utils20();
205332
204583
  init_recentBlocksTracker();
205333
204584
  init_buildInsertBlockHistoryCommand();
205334
204585
  }
@@ -205458,7 +204709,7 @@ var init_useBlockDuplication = __esm({
205458
204709
  "use client";
205459
204710
  init_blocks2();
205460
204711
  init_src3();
205461
- init_utils21();
204712
+ init_utils20();
205462
204713
  init_buildInsertBlockHistoryCommand();
205463
204714
  }
205464
204715
  });
@@ -205562,7 +204813,7 @@ var init_useBlockReorder = __esm({
205562
204813
  init_blocks2();
205563
204814
  init_src3();
205564
204815
  init_sortable_esm2();
205565
- init_utils21();
204816
+ init_utils20();
205566
204817
  }
205567
204818
  });
205568
204819
 
@@ -206670,7 +205921,7 @@ var init_BlockEditor = __esm({
206670
205921
  init_useBlockReorder();
206671
205922
  init_reorderControlMode();
206672
205923
  init_SortableBlockItem();
206673
- init_utils21();
205924
+ init_utils20();
206674
205925
  init_client4();
206675
205926
  BlockEditor = forwardRef(function BlockEditor2({
206676
205927
  siteId,
@@ -206694,7 +205945,7 @@ var init_BlockEditor = __esm({
206694
205945
  reorderControlMode = DEFAULT_REORDER_CONTROL_MODE
206695
205946
  }, ref) {
206696
205947
  const [blockList, setBlockList] = useState(() => normalizeBlockListInitial(blocks));
206697
- const [errorMessage3, setErrorMessage] = useState(null);
205948
+ const [errorMessage, setErrorMessage] = useState(null);
206698
205949
  const [highlightedBlockId, setHighlightedBlockId] = useState(null);
206699
205950
  const blockRefs = useRef(/* @__PURE__ */ new Map());
206700
205951
  const highlightTimerRef = useRef(null);
@@ -206933,7 +206184,7 @@ var init_BlockEditor = __esm({
206933
206184
  );
206934
206185
  return /* @__PURE__ */ jsx(BlockListProvider, { value: contextValue, children: /* @__PURE__ */ jsxs("div", { className: "space-y-3 touch-pan-y", children: [
206935
206186
  /* @__PURE__ */ jsx(HeaderActions, { headerLeftSlot }),
206936
- errorMessage3 ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-destructive bg-destructive/10 px-4 py-2 text-sm text-destructive", children: errorMessage3 }) : null,
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,
206937
206188
  hasBlocks ? /* @__PURE__ */ jsx(
206938
206189
  DndContext,
206939
206190
  {
@@ -211440,12 +210691,17 @@ function PreviewAuthBanner({
211440
210691
  launchReadiness.pendingRequiredCount
211441
210692
  ]);
211442
210693
  const handleReauthenticate = useCallback(() => {
211443
- if (typeof window === "undefined") return;
211444
- const restartUrl = new URL("/api/preview/restart", window.location.origin);
211445
- restartUrl.searchParams.set("return", window.location.href);
211446
- if (siteSlug) restartUrl.searchParams.set("siteSlug", siteSlug);
211447
- window.location.href = restartUrl.toString();
211448
- }, [siteSlug]);
210694
+ if (!dashboardBaseUrl || typeof window === "undefined") return;
210695
+ const currentUrl = window.location.href;
210696
+ window.location.assign(
210697
+ buildPreviewAuthEntryUrl({
210698
+ dashboardBaseUrl,
210699
+ returnUrl: currentUrl,
210700
+ fallbackUrl: currentUrl,
210701
+ siteSlug
210702
+ })
210703
+ );
210704
+ }, [dashboardBaseUrl, siteSlug]);
211449
210705
  const dashboardContinueUrl = useMemo(() => {
211450
210706
  if (!dashboardBaseUrl) return null;
211451
210707
  if (authMode === "onboardingGrant") {
@@ -211500,6 +210756,7 @@ function PreviewAuthBanner({
211500
210756
  type: "button",
211501
210757
  size: "sm",
211502
210758
  variant: "onDark",
210759
+ disabled: !dashboardBaseUrl,
211503
210760
  onClick: handleReauthenticate,
211504
210761
  children: "Reauthenticate"
211505
210762
  }
@@ -213967,6 +213224,7 @@ init_src2();
213967
213224
  function SdkPreviewMode(props2) {
213968
213225
  const {
213969
213226
  apiBaseUrl,
213227
+ dashboardBaseUrl,
213970
213228
  siteId,
213971
213229
  siteSlug,
213972
213230
  previewSession,
@@ -213975,6 +213233,7 @@ function SdkPreviewMode(props2) {
213975
213233
  blockOverrides,
213976
213234
  useThemeScope = true
213977
213235
  } = props2;
213236
+ const resolvedDashboardBaseUrl = dashboardBaseUrl ?? deriveDashboardBaseUrlFromApiBaseUrl(apiBaseUrl);
213978
213237
  const surfaceId = props2.surfaceId ?? resolvePreviewSurfaceId() ?? DEFAULT_SURFACE_ID;
213979
213238
  const theme = content.theme;
213980
213239
  const page = content.page;
@@ -214038,6 +213297,7 @@ function SdkPreviewMode(props2) {
214038
213297
  editableId: content.pageId,
214039
213298
  previewSession,
214040
213299
  previewToken,
213300
+ dashboardBaseUrl: resolvedDashboardBaseUrl,
214041
213301
  surfaceId,
214042
213302
  theme,
214043
213303
  pageId: content.pageId,
@@ -214070,6 +213330,13 @@ function SdkPreviewMode(props2) {
214070
213330
  }
214071
213331
  );
214072
213332
  }
213333
+ function deriveDashboardBaseUrlFromApiBaseUrl(apiBaseUrl) {
213334
+ try {
213335
+ return new URL(apiBaseUrl).origin;
213336
+ } catch {
213337
+ return null;
213338
+ }
213339
+ }
214073
213340
  /*! Bundled license information:
214074
213341
 
214075
213342
  lucide-react/dist/esm/shared/src/utils/mergeClasses.js: