@remotion/studio 4.0.424 → 4.0.426

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 (88) hide show
  1. package/dist/api/create-composition.d.ts +1 -2
  2. package/dist/api/helpers/calc-new-props.d.ts +1 -2
  3. package/dist/components/AssetSelector.js +1 -1
  4. package/dist/components/AssetSelectorItem.d.ts +1 -0
  5. package/dist/components/AssetSelectorItem.js +9 -8
  6. package/dist/components/InitialCompositionLoader.js +13 -1
  7. package/dist/components/NewComposition/CodemodFooter.d.ts +1 -0
  8. package/dist/components/NewComposition/CodemodFooter.js +3 -1
  9. package/dist/components/NewComposition/DeleteComposition.js +1 -1
  10. package/dist/components/NewComposition/DuplicateComposition.js +5 -1
  11. package/dist/components/NewComposition/RenameComposition.js +1 -1
  12. package/dist/components/RenderModal/DataEditor.d.ts +2 -1
  13. package/dist/components/RenderModal/DataEditor.js +6 -6
  14. package/dist/components/RenderModal/RenderModalJSONPropsEditor.d.ts +2 -2
  15. package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +3 -2
  16. package/dist/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +3 -3
  17. package/dist/components/RenderModal/SchemaEditor/SchemaEditor.js +4 -5
  18. package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +3 -3
  19. package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +1 -0
  20. package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.d.ts +2 -2
  21. package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.js +4 -3
  22. package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +2 -2
  23. package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.js +3 -6
  24. package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.d.ts +2 -1
  25. package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.js +2 -2
  26. package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -2
  27. package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +2 -2
  28. package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +2 -2
  29. package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.d.ts +3 -3
  30. package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.js +2 -1
  31. package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.d.ts +2 -2
  32. package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +18 -18
  33. package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +2 -2
  34. package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.js +6 -10
  35. package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +2 -2
  36. package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +4 -12
  37. package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.d.ts +2 -2
  38. package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.js +2 -2
  39. package/dist/components/RenderModal/SchemaEditor/ZodFieldValidation.js +4 -3
  40. package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.d.ts +2 -2
  41. package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.js +3 -2
  42. package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +2 -2
  43. package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.js +2 -1
  44. package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +2 -2
  45. package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +49 -21
  46. package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +2 -2
  47. package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +4 -9
  48. package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +2 -2
  49. package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.js +2 -1
  50. package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +3 -3
  51. package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +2 -2
  52. package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +0 -10
  53. package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +2 -2
  54. package/dist/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +2 -2
  55. package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +38 -33
  56. package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.d.ts +2 -2
  57. package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.d.ts +2 -2
  58. package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.js +3 -6
  59. package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.d.ts +2 -1
  60. package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.js +2 -2
  61. package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +2 -2
  62. package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.js +11 -15
  63. package/dist/components/RenderModal/SchemaEditor/create-zod-values.d.ts +2 -2
  64. package/dist/components/RenderModal/SchemaEditor/create-zod-values.js +108 -110
  65. package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +3 -3
  66. package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.js +72 -87
  67. package/dist/components/RenderModal/SchemaEditor/local-state.d.ts +3 -3
  68. package/dist/components/RenderModal/SchemaEditor/local-state.js +5 -4
  69. package/dist/components/RenderModal/SchemaEditor/zod-schema-type.d.ts +176 -0
  70. package/dist/components/RenderModal/SchemaEditor/zod-schema-type.js +330 -0
  71. package/dist/components/Tabs/index.js +2 -0
  72. package/dist/components/Tabs/vertical.js +2 -0
  73. package/dist/components/TimeValue.js +0 -2
  74. package/dist/components/Timeline/TimelineDragHandler.js +6 -0
  75. package/dist/components/get-zod-if-possible.d.ts +3 -0
  76. package/dist/components/get-zod-if-possible.js +23 -2
  77. package/dist/esm/{chunk-3g77e2p9.js → chunk-kde77jse.js} +589 -373
  78. package/dist/esm/index.mjs +170 -81
  79. package/dist/esm/internals.mjs +589 -373
  80. package/dist/esm/previewEntry.mjs +598 -375
  81. package/dist/esm/renderEntry.mjs +1 -1
  82. package/dist/helpers/inject-css.js +2 -1
  83. package/dist/index.d.ts +2 -2
  84. package/dist/previewEntry.d.ts +5 -0
  85. package/dist/previewEntry.js +11 -2
  86. package/dist/visual-controls/VisualControls.d.ts +4 -4
  87. package/dist/visual-controls/VisualControls.js +1 -1
  88. package/package.json +11 -11
@@ -3693,7 +3693,8 @@ var AssetFolderItem = ({
3693
3693
  parentFolder,
3694
3694
  toggleFolder,
3695
3695
  dropLocation,
3696
- setDropLocation
3696
+ setDropLocation,
3697
+ readOnlyStudio
3697
3698
  }) => {
3698
3699
  const [hovered, setHovered] = useState15(false);
3699
3700
  const openFolderTimerRef = useRef12(null);
@@ -3776,7 +3777,8 @@ var AssetFolderItem = ({
3776
3777
  tabIndex,
3777
3778
  toggleFolder,
3778
3779
  dropLocation,
3779
- setDropLocation
3780
+ setDropLocation,
3781
+ readOnlyStudio
3780
3782
  }, item.name) : null
3781
3783
  ]
3782
3784
  });
@@ -3789,7 +3791,8 @@ var AssetFolderTree = ({
3789
3791
  toggleFolder,
3790
3792
  tabIndex,
3791
3793
  dropLocation,
3792
- setDropLocation
3794
+ setDropLocation,
3795
+ readOnlyStudio
3793
3796
  }) => {
3794
3797
  const combinedParents = useMemo23(() => {
3795
3798
  return [parentFolder, name].filter(NoReactInternals3.truthy).join("/");
@@ -3804,7 +3807,8 @@ var AssetFolderTree = ({
3804
3807
  parentFolder: combinedParents,
3805
3808
  toggleFolder,
3806
3809
  dropLocation,
3807
- setDropLocation
3810
+ setDropLocation,
3811
+ readOnlyStudio
3808
3812
  }, folder.name);
3809
3813
  }),
3810
3814
  item.files.map((file) => {
@@ -3812,13 +3816,14 @@ var AssetFolderTree = ({
3812
3816
  item: file,
3813
3817
  tabIndex,
3814
3818
  level,
3815
- parentFolder: combinedParents
3819
+ parentFolder: combinedParents,
3820
+ readOnlyStudio
3816
3821
  }, file.src);
3817
3822
  })
3818
3823
  ]
3819
3824
  });
3820
3825
  };
3821
- var AssetSelectorItem = ({ item, tabIndex, level, parentFolder }) => {
3826
+ var AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio }) => {
3822
3827
  const isMobileLayout = useMobileLayout();
3823
3828
  const [hovered, setHovered] = useState15(false);
3824
3829
  const { setSidebarCollapsedState } = useContext10(SidebarContext);
@@ -3925,13 +3930,17 @@ var AssetSelectorItem = ({ item, tabIndex, level, parentFolder }) => {
3925
3930
  renderAction: renderCopyAction,
3926
3931
  onClick: copyToClipboard
3927
3932
  }),
3928
- /* @__PURE__ */ jsx35(Spacing, {
3929
- x: 0.5
3930
- }),
3931
- /* @__PURE__ */ jsx35(InlineAction, {
3932
- title: "Open in Explorer",
3933
- renderAction: renderFileExplorerAction,
3934
- onClick: revealInExplorer
3933
+ readOnlyStudio ? null : /* @__PURE__ */ jsxs9(Fragment5, {
3934
+ children: [
3935
+ /* @__PURE__ */ jsx35(Spacing, {
3936
+ x: 0.5
3937
+ }),
3938
+ /* @__PURE__ */ jsx35(InlineAction, {
3939
+ title: "Open in Explorer",
3940
+ renderAction: renderFileExplorerAction,
3941
+ onClick: revealInExplorer
3942
+ })
3943
+ ]
3935
3944
  })
3936
3945
  ]
3937
3946
  }) : null
@@ -4286,7 +4295,8 @@ var AssetSelector = ({ readOnlyStudio }) => {
4286
4295
  tabIndex,
4287
4296
  toggleFolder,
4288
4297
  dropLocation,
4289
- setDropLocation
4298
+ setDropLocation,
4299
+ readOnlyStudio
4290
4300
  })
4291
4301
  })
4292
4302
  ]
@@ -4407,7 +4417,9 @@ var selectorButton = {
4407
4417
  fontSize: 14,
4408
4418
  color: "inherit",
4409
4419
  alignItems: "center",
4410
- cursor: "default"
4420
+ cursor: "default",
4421
+ userSelect: "none",
4422
+ WebkitUserSelect: "none"
4411
4423
  };
4412
4424
  var Tab = ({ children, onClick, style, selected }) => {
4413
4425
  const [hovered, setHovered] = useState20(false);
@@ -4577,10 +4589,16 @@ var InitialCompositionLoader = () => {
4577
4589
  const selectAsset = useSelectAsset();
4578
4590
  const staticFiles = useStaticFiles();
4579
4591
  useEffect15(() => {
4592
+ const canvasContentFromUrl = deriveCanvasContentFromUrl();
4580
4593
  if (canvasContent) {
4594
+ if (canvasContentFromUrl && canvasContentFromUrl.type === "composition" && canvasContent.type === "composition" && canvasContentFromUrl.compositionId !== canvasContent.compositionId) {
4595
+ const exists = compositions.find((c) => c.id === canvasContentFromUrl.compositionId);
4596
+ if (exists) {
4597
+ selectComposition(exists, false);
4598
+ }
4599
+ }
4581
4600
  return;
4582
4601
  }
4583
- const canvasContentFromUrl = deriveCanvasContentFromUrl();
4584
4602
  if (canvasContentFromUrl && canvasContentFromUrl.type === "composition") {
4585
4603
  const exists = compositions.find((c) => c.id === canvasContentFromUrl.compositionId);
4586
4604
  if (exists) {
@@ -10839,6 +10857,14 @@ async function getZodIfPossible() {
10839
10857
  return null;
10840
10858
  }
10841
10859
  }
10860
+ var getZodV3IfPossible = async () => {
10861
+ try {
10862
+ const mod = await import("zod/v3");
10863
+ return mod;
10864
+ } catch {
10865
+ return null;
10866
+ }
10867
+ };
10842
10868
  var getZTypesIfPossible = async () => {
10843
10869
  try {
10844
10870
  const mod = await import("@remotion/zod-types");
@@ -10858,19 +10884,24 @@ var useZodTypesIfPossible = () => {
10858
10884
  var ZodContext = createContext16(null);
10859
10885
  var ZodProvider = ({ children }) => {
10860
10886
  const [zod, setZod] = useState39(null);
10887
+ const [zodV3, setZodV3] = useState39(null);
10861
10888
  const [zodTypes, setZodTypes] = useState39(null);
10862
10889
  useEffect39(() => {
10863
10890
  getZodIfPossible().then((z) => setZod(z));
10864
10891
  }, []);
10892
+ useEffect39(() => {
10893
+ getZodV3IfPossible().then((z) => setZodV3(z));
10894
+ }, []);
10865
10895
  useEffect39(() => {
10866
10896
  getZTypesIfPossible().then((z) => setZodTypes(z));
10867
10897
  }, []);
10868
10898
  const contextValue = useMemo53(() => {
10869
10899
  return {
10870
10900
  zod,
10901
+ zodV3,
10871
10902
  zodTypes
10872
10903
  };
10873
- }, [zod, zodTypes]);
10904
+ }, [zod, zodV3, zodTypes]);
10874
10905
  return /* @__PURE__ */ jsx95(ZodContext.Provider, {
10875
10906
  value: contextValue,
10876
10907
  children
@@ -11012,6 +11043,184 @@ import { Internals as Internals30 } from "remotion";
11012
11043
  // src/api/save-default-props.ts
11013
11044
  import { getRemotionEnvironment as getRemotionEnvironment4 } from "remotion";
11014
11045
 
11046
+ // src/components/RenderModal/SchemaEditor/zod-schema-type.ts
11047
+ var zodSafeParse = (schema, data) => {
11048
+ return schema.safeParse(data);
11049
+ };
11050
+ var getZodDef = (schema) => {
11051
+ if (schema._def)
11052
+ return schema._def;
11053
+ if (schema._zod)
11054
+ return schema._zod.def;
11055
+ throw new Error("Invalid zod schema: missing _def and _zod");
11056
+ };
11057
+ var v3TypeNameMap = {
11058
+ ZodString: "string",
11059
+ ZodNumber: "number",
11060
+ ZodBoolean: "boolean",
11061
+ ZodObject: "object",
11062
+ ZodArray: "array",
11063
+ ZodEnum: "enum",
11064
+ ZodUnion: "union",
11065
+ ZodDiscriminatedUnion: "discriminatedUnion",
11066
+ ZodOptional: "optional",
11067
+ ZodNullable: "nullable",
11068
+ ZodDefault: "default",
11069
+ ZodTuple: "tuple",
11070
+ ZodDate: "date",
11071
+ ZodAny: "any",
11072
+ ZodUnknown: "unknown",
11073
+ ZodBigInt: "bigint",
11074
+ ZodNull: "null",
11075
+ ZodUndefined: "undefined",
11076
+ ZodEffects: "effects",
11077
+ ZodLiteral: "literal",
11078
+ ZodRecord: "record",
11079
+ ZodNever: "never",
11080
+ ZodVoid: "void",
11081
+ ZodNaN: "nan",
11082
+ ZodSymbol: "symbol",
11083
+ ZodIntersection: "intersection",
11084
+ ZodMap: "map",
11085
+ ZodSet: "set",
11086
+ ZodLazy: "lazy",
11087
+ ZodFunction: "function",
11088
+ ZodNativeEnum: "nativeEnum",
11089
+ ZodCatch: "catch",
11090
+ ZodPromise: "promise",
11091
+ ZodBranded: "branded",
11092
+ ZodPipeline: "pipeline"
11093
+ };
11094
+ var isZodV3Schema = (schema) => {
11095
+ const def = getZodDef(schema);
11096
+ return "typeName" in def;
11097
+ };
11098
+ var getZodSchemaType = (schema) => {
11099
+ const def = getZodDef(schema);
11100
+ if ("typeName" in def) {
11101
+ const { typeName } = def;
11102
+ return v3TypeNameMap[typeName] ?? typeName;
11103
+ }
11104
+ const { type } = def;
11105
+ if (type === "union" && def.discriminator !== undefined) {
11106
+ return "discriminatedUnion";
11107
+ }
11108
+ return type;
11109
+ };
11110
+ var getZodSchemaDescription = (schema) => {
11111
+ if (isZodV3Schema(schema)) {
11112
+ return getZodDef(schema).description;
11113
+ }
11114
+ return schema.description;
11115
+ };
11116
+ var getObjectShape = (schema) => {
11117
+ const { shape } = getZodDef(schema);
11118
+ return typeof shape === "function" ? shape() : shape;
11119
+ };
11120
+ var getArrayElement = (schema) => {
11121
+ const def = getZodDef(schema);
11122
+ return isZodV3Schema(schema) ? def.type : def.element;
11123
+ };
11124
+ var getInnerType = (schema) => {
11125
+ return getZodDef(schema).innerType;
11126
+ };
11127
+ var getEffectsInner = (schema) => {
11128
+ return getZodDef(schema).schema;
11129
+ };
11130
+ var getLiteralValue = (schema) => {
11131
+ const def = getZodDef(schema);
11132
+ if (isZodV3Schema(schema)) {
11133
+ return def.value;
11134
+ }
11135
+ return def.values?.[0];
11136
+ };
11137
+ var getEnumValues = (schema) => {
11138
+ const def = getZodDef(schema);
11139
+ if (isZodV3Schema(schema)) {
11140
+ return def.values;
11141
+ }
11142
+ const { entries } = def;
11143
+ return Object.values(entries);
11144
+ };
11145
+ var getFirstEnumValue = (schema) => {
11146
+ const def = getZodDef(schema);
11147
+ if (isZodV3Schema(schema)) {
11148
+ if (def.typeName === "ZodNativeEnum") {
11149
+ const vals = Object.values(def.values);
11150
+ return vals[0];
11151
+ }
11152
+ return def.values[0];
11153
+ }
11154
+ const { entries } = def;
11155
+ const pairs = Object.entries(entries);
11156
+ const hasReverseMapping = pairs.some(([key, value]) => key !== String(value));
11157
+ if (hasReverseMapping) {
11158
+ const forwardPairs = pairs.filter(([key]) => Number.isNaN(Number(key)));
11159
+ if (forwardPairs.length > 0) {
11160
+ return forwardPairs[0][1];
11161
+ }
11162
+ }
11163
+ return Object.values(entries)[0];
11164
+ };
11165
+ var getUnionOptions = (schema) => {
11166
+ return getZodDef(schema).options;
11167
+ };
11168
+ var getDefaultValue = (schema) => {
11169
+ const dv = getZodDef(schema).defaultValue;
11170
+ return typeof dv === "function" ? dv() : dv;
11171
+ };
11172
+ var getDiscriminator = (schema) => {
11173
+ return getZodDef(schema).discriminator;
11174
+ };
11175
+ var getDiscriminatedOptionKeys = (schema) => {
11176
+ const def = getZodDef(schema);
11177
+ const discriminator = getDiscriminator(schema);
11178
+ if (isZodV3Schema(schema) && def.optionsMap) {
11179
+ return [...def.optionsMap.keys()];
11180
+ }
11181
+ const options = getUnionOptions(schema);
11182
+ return options.map((option) => {
11183
+ const shape = getObjectShape(option);
11184
+ const discriminatorSchema = shape[discriminator];
11185
+ return getLiteralValue(discriminatorSchema);
11186
+ });
11187
+ };
11188
+ var getDiscriminatedOption = (schema, discriminatorValue) => {
11189
+ const def = getZodDef(schema);
11190
+ const discriminator = getDiscriminator(schema);
11191
+ if (isZodV3Schema(schema) && def.optionsMap) {
11192
+ return def.optionsMap.get(discriminatorValue);
11193
+ }
11194
+ const options = getUnionOptions(schema);
11195
+ return options.find((option) => {
11196
+ const shape = getObjectShape(option);
11197
+ const discriminatorSchema = shape[discriminator];
11198
+ return getLiteralValue(discriminatorSchema) === discriminatorValue;
11199
+ });
11200
+ };
11201
+ var getIntersectionSchemas = (schema) => {
11202
+ const def = getZodDef(schema);
11203
+ return { left: def.left, right: def.right };
11204
+ };
11205
+ var getTupleItems = (schema) => {
11206
+ return getZodDef(schema).items;
11207
+ };
11208
+ var getRecordValueType = (schema) => {
11209
+ return getZodDef(schema).valueType;
11210
+ };
11211
+ var getRecordKeyType = (schema) => {
11212
+ return getZodDef(schema).keyType;
11213
+ };
11214
+ var getPipelineOutput = (schema) => {
11215
+ return getZodDef(schema).out;
11216
+ };
11217
+ var getPipelineInput = (schema) => {
11218
+ return getZodDef(schema).in;
11219
+ };
11220
+ var getBrandedInner = (schema) => {
11221
+ return isZodV3Schema(schema) ? getZodDef(schema).type : schema;
11222
+ };
11223
+
11015
11224
  // src/components/RenderModal/SchemaEditor/extract-enum-json-paths.ts
11016
11225
  var extractEnumJsonPaths = ({
11017
11226
  schema,
@@ -11019,11 +11228,14 @@ var extractEnumJsonPaths = ({
11019
11228
  currentPath,
11020
11229
  zodTypes
11021
11230
  }) => {
11022
- const def = schema._def;
11023
- const typeName = def.typeName;
11231
+ const description = getZodSchemaDescription(schema);
11232
+ if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
11233
+ return [currentPath];
11234
+ }
11235
+ const typeName = getZodSchemaType(schema);
11024
11236
  switch (typeName) {
11025
- case zodRuntime.ZodFirstPartyTypeKind.ZodObject: {
11026
- const shape = def.shape();
11237
+ case "object": {
11238
+ const shape = getObjectShape(schema);
11027
11239
  const keys = Object.keys(shape);
11028
11240
  return keys.map((key) => {
11029
11241
  return extractEnumJsonPaths({
@@ -11034,16 +11246,16 @@ var extractEnumJsonPaths = ({
11034
11246
  });
11035
11247
  }).flat(1);
11036
11248
  }
11037
- case zodRuntime.ZodFirstPartyTypeKind.ZodArray: {
11249
+ case "array": {
11038
11250
  return extractEnumJsonPaths({
11039
- schema: def.type,
11251
+ schema: getArrayElement(schema),
11040
11252
  zodRuntime,
11041
11253
  currentPath: [...currentPath, "[]"],
11042
11254
  zodTypes
11043
11255
  });
11044
11256
  }
11045
- case zodRuntime.ZodFirstPartyTypeKind.ZodUnion: {
11046
- return def.options.map((option) => {
11257
+ case "union": {
11258
+ return getUnionOptions(schema).map((option) => {
11047
11259
  return extractEnumJsonPaths({
11048
11260
  schema: option,
11049
11261
  zodRuntime,
@@ -11052,8 +11264,8 @@ var extractEnumJsonPaths = ({
11052
11264
  });
11053
11265
  }).flat(1);
11054
11266
  }
11055
- case zodRuntime.ZodFirstPartyTypeKind.ZodDiscriminatedUnion: {
11056
- return def.options.map((op) => {
11267
+ case "discriminatedUnion": {
11268
+ return getUnionOptions(schema).map((op) => {
11057
11269
  return extractEnumJsonPaths({
11058
11270
  schema: op,
11059
11271
  zodRuntime,
@@ -11062,22 +11274,19 @@ var extractEnumJsonPaths = ({
11062
11274
  });
11063
11275
  }).flat(1);
11064
11276
  }
11065
- case zodRuntime.ZodFirstPartyTypeKind.ZodLiteral: {
11277
+ case "literal": {
11066
11278
  return [currentPath];
11067
11279
  }
11068
- case zodRuntime.ZodFirstPartyTypeKind.ZodEffects: {
11069
- if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
11070
- return [currentPath];
11071
- }
11280
+ case "effects": {
11072
11281
  return extractEnumJsonPaths({
11073
- schema: def.schema,
11282
+ schema: getEffectsInner(schema),
11074
11283
  zodRuntime,
11075
11284
  currentPath,
11076
11285
  zodTypes
11077
11286
  });
11078
11287
  }
11079
- case zodRuntime.ZodFirstPartyTypeKind.ZodIntersection: {
11080
- const { left: left3, right } = def;
11288
+ case "intersection": {
11289
+ const { left: left3, right } = getIntersectionSchemas(schema);
11081
11290
  const leftValue = extractEnumJsonPaths({
11082
11291
  schema: left3,
11083
11292
  zodRuntime,
@@ -11092,109 +11301,94 @@ var extractEnumJsonPaths = ({
11092
11301
  });
11093
11302
  return [...leftValue, ...rightValue];
11094
11303
  }
11095
- case zodRuntime.ZodFirstPartyTypeKind.ZodTuple: {
11096
- return def.items.map((item, i) => extractEnumJsonPaths({
11304
+ case "tuple": {
11305
+ return getTupleItems(schema).map((item, i) => extractEnumJsonPaths({
11097
11306
  schema: item,
11098
11307
  zodRuntime,
11099
11308
  currentPath: [...currentPath, i],
11100
11309
  zodTypes
11101
11310
  })).flat(1);
11102
11311
  }
11103
- case zodRuntime.ZodFirstPartyTypeKind.ZodRecord: {
11104
- const values = extractEnumJsonPaths({
11105
- schema: def.valueType,
11312
+ case "record": {
11313
+ const recordPath = [...currentPath, "{}"];
11314
+ const keyResults = extractEnumJsonPaths({
11315
+ schema: getRecordKeyType(schema),
11316
+ zodRuntime,
11317
+ currentPath: recordPath,
11318
+ zodTypes
11319
+ });
11320
+ const valueResults = extractEnumJsonPaths({
11321
+ schema: getRecordValueType(schema),
11106
11322
  zodRuntime,
11107
- currentPath: [...currentPath, "{}"],
11323
+ currentPath: recordPath,
11108
11324
  zodTypes
11109
11325
  });
11110
- return values;
11326
+ return [...keyResults, ...valueResults];
11111
11327
  }
11112
- case zodRuntime.ZodFirstPartyTypeKind.ZodFunction: {
11328
+ case "function": {
11113
11329
  throw new Error("Cannot create a value for type function");
11114
11330
  }
11115
- case zodRuntime.ZodFirstPartyTypeKind.ZodEnum: {
11331
+ case "enum": {
11116
11332
  return [currentPath];
11117
11333
  }
11118
- case zodRuntime.ZodFirstPartyTypeKind.ZodNativeEnum: {
11334
+ case "nativeEnum": {
11119
11335
  return [];
11120
11336
  }
11121
- case zodRuntime.ZodFirstPartyTypeKind.ZodOptional: {
11122
- const defType = def;
11123
- const value = extractEnumJsonPaths({
11124
- schema: defType.innerType,
11125
- zodRuntime,
11126
- currentPath,
11127
- zodTypes
11128
- });
11129
- return value;
11130
- }
11131
- case zodRuntime.ZodFirstPartyTypeKind.ZodNullable: {
11132
- const defType = def;
11133
- const value = extractEnumJsonPaths({
11134
- schema: defType.innerType,
11135
- zodRuntime,
11136
- currentPath,
11137
- zodTypes
11138
- });
11139
- return value;
11140
- }
11141
- case zodRuntime.ZodFirstPartyTypeKind.ZodDefault: {
11142
- const defType = def;
11337
+ case "optional":
11338
+ case "nullable":
11339
+ case "catch": {
11143
11340
  return extractEnumJsonPaths({
11144
- schema: defType.innerType,
11341
+ schema: getInnerType(schema),
11145
11342
  zodRuntime,
11146
11343
  currentPath,
11147
11344
  zodTypes
11148
11345
  });
11149
11346
  }
11150
- case zodRuntime.ZodFirstPartyTypeKind.ZodCatch: {
11151
- const defType = def;
11347
+ case "default": {
11152
11348
  return extractEnumJsonPaths({
11153
- schema: defType.innerType,
11349
+ schema: getInnerType(schema),
11154
11350
  zodRuntime,
11155
11351
  currentPath,
11156
11352
  zodTypes
11157
11353
  });
11158
11354
  }
11159
- case zodRuntime.ZodFirstPartyTypeKind.ZodPromise: {
11355
+ case "promise": {
11160
11356
  return [];
11161
11357
  }
11162
- case zodRuntime.ZodFirstPartyTypeKind.ZodBranded: {
11163
- const defType = def;
11164
- const value = extractEnumJsonPaths({
11165
- schema: defType.type,
11358
+ case "branded": {
11359
+ return extractEnumJsonPaths({
11360
+ schema: getBrandedInner(schema),
11166
11361
  zodRuntime,
11167
11362
  currentPath,
11168
11363
  zodTypes
11169
11364
  });
11170
- return value;
11171
11365
  }
11172
- case zodRuntime.ZodFirstPartyTypeKind.ZodPipeline: {
11173
- const defType = def;
11174
- const value = extractEnumJsonPaths({
11175
- schema: defType.out,
11366
+ case "pipeline":
11367
+ case "pipe": {
11368
+ return extractEnumJsonPaths({
11369
+ schema: getPipelineOutput(schema),
11176
11370
  zodRuntime,
11177
11371
  currentPath,
11178
11372
  zodTypes
11179
11373
  });
11180
- return value;
11181
11374
  }
11182
- case zodRuntime.ZodFirstPartyTypeKind.ZodString:
11183
- case zodRuntime.ZodFirstPartyTypeKind.ZodNumber:
11184
- case zodRuntime.ZodFirstPartyTypeKind.ZodBigInt:
11185
- case zodRuntime.ZodFirstPartyTypeKind.ZodBoolean:
11186
- case zodRuntime.ZodFirstPartyTypeKind.ZodNaN:
11187
- case zodRuntime.ZodFirstPartyTypeKind.ZodDate:
11188
- case zodRuntime.ZodFirstPartyTypeKind.ZodSymbol:
11189
- case zodRuntime.ZodFirstPartyTypeKind.ZodUndefined:
11190
- case zodRuntime.ZodFirstPartyTypeKind.ZodNull:
11191
- case zodRuntime.ZodFirstPartyTypeKind.ZodAny:
11192
- case zodRuntime.ZodFirstPartyTypeKind.ZodUnknown:
11193
- case zodRuntime.ZodFirstPartyTypeKind.ZodNever:
11194
- case zodRuntime.ZodFirstPartyTypeKind.ZodVoid:
11195
- case zodRuntime.ZodFirstPartyTypeKind.ZodMap:
11196
- case zodRuntime.ZodFirstPartyTypeKind.ZodLazy:
11197
- case zodRuntime.ZodFirstPartyTypeKind.ZodSet: {
11375
+ case "string":
11376
+ case "number":
11377
+ case "bigint":
11378
+ case "boolean":
11379
+ case "nan":
11380
+ case "date":
11381
+ case "symbol":
11382
+ case "undefined":
11383
+ case "null":
11384
+ case "any":
11385
+ case "unknown":
11386
+ case "never":
11387
+ case "void":
11388
+ case "map":
11389
+ case "lazy":
11390
+ case "set":
11391
+ case "custom": {
11198
11392
  return [];
11199
11393
  }
11200
11394
  default:
@@ -11550,7 +11744,7 @@ var ZodErrorMessages = ({ zodValidationResult, viewTab }) => {
11550
11744
  }, []);
11551
11745
  if (viewTab === "json") {
11552
11746
  return /* @__PURE__ */ jsx102("div", {
11553
- children: zodValidationResult.error.errors.map((error) => {
11747
+ children: zodValidationResult.error.issues.map((error) => {
11554
11748
  return /* @__PURE__ */ jsxs46("div", {
11555
11749
  style: style7,
11556
11750
  children: [
@@ -11570,7 +11764,7 @@ var ZodErrorMessages = ({ zodValidationResult, viewTab }) => {
11570
11764
  });
11571
11765
  }
11572
11766
  return /* @__PURE__ */ jsx102("div", {
11573
- children: zodValidationResult.error.errors.map((error) => {
11767
+ children: zodValidationResult.error.issues.map((error) => {
11574
11768
  return /* @__PURE__ */ jsxs46("div", {
11575
11769
  style: style7,
11576
11770
  children: [
@@ -11627,7 +11821,7 @@ var scrollable = {
11627
11821
  var parseJSON = (str, schema) => {
11628
11822
  try {
11629
11823
  const value = NoReactInternals8.deserializeJSONWithSpecialTypes(str);
11630
- const zodValidation = schema.safeParse(value);
11824
+ const zodValidation = zodSafeParse(schema, value);
11631
11825
  return { str, value, validJSON: true, zodValidation };
11632
11826
  } catch (e) {
11633
11827
  return { str, validJSON: false, error: e.message };
@@ -11659,7 +11853,7 @@ var RenderModalJSONPropsEditor = ({
11659
11853
  const onChange = useCallback47((e) => {
11660
11854
  const parsed = parseJSON(e.target.value, schema);
11661
11855
  if (parsed.validJSON) {
11662
- const validationResult = schema.safeParse(parsed.value);
11856
+ const validationResult = zodSafeParse(schema, parsed.value);
11663
11857
  setLocalValue({
11664
11858
  str: e.target.value,
11665
11859
  value: parsed.value,
@@ -12271,46 +12465,72 @@ var createZodValues = (schema, zodRuntime, zodTypes) => {
12271
12465
  if (!schema) {
12272
12466
  throw new Error("Invalid zod schema");
12273
12467
  }
12274
- const def = schema._def;
12275
- const typeName = def.typeName;
12468
+ const description = getZodSchemaDescription(schema);
12469
+ if (zodTypes) {
12470
+ if (description === zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
12471
+ return "#ffffff";
12472
+ }
12473
+ if (description === zodTypes.ZodZypesInternals.REMOTION_TEXTAREA_BRAND) {
12474
+ return "";
12475
+ }
12476
+ if (description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
12477
+ return [
12478
+ [1, 0, 0],
12479
+ [0, 1, 0],
12480
+ [0, 0, 1]
12481
+ ];
12482
+ }
12483
+ }
12484
+ const typeName = getZodSchemaType(schema);
12276
12485
  switch (typeName) {
12277
- case zodRuntime.ZodFirstPartyTypeKind.ZodString:
12486
+ case "string":
12278
12487
  return "";
12279
- case zodRuntime.ZodFirstPartyTypeKind.ZodNumber: {
12280
- for (const check of def.checks) {
12281
- if (check.kind === "min") {
12282
- return check.value;
12283
- }
12284
- if (check.kind === "max" && check.value < 0) {
12285
- return check.value;
12488
+ case "number": {
12489
+ const { checks } = getZodDef(schema);
12490
+ if (checks) {
12491
+ if (isZodV3Schema(schema)) {
12492
+ for (const check of checks) {
12493
+ if (check.kind === "min")
12494
+ return check.value;
12495
+ if (check.kind === "max" && check.value < 0)
12496
+ return check.value;
12497
+ }
12498
+ } else {
12499
+ for (const check of checks) {
12500
+ const cd = check._zod?.def;
12501
+ if (cd?.check === "greater_than")
12502
+ return cd.value;
12503
+ if (cd?.check === "less_than" && cd.value < 0)
12504
+ return cd.value;
12505
+ }
12286
12506
  }
12287
12507
  }
12288
12508
  return 0;
12289
12509
  }
12290
- case zodRuntime.ZodFirstPartyTypeKind.ZodBigInt:
12510
+ case "bigint":
12291
12511
  return BigInt(0);
12292
- case zodRuntime.ZodFirstPartyTypeKind.ZodBoolean:
12512
+ case "boolean":
12293
12513
  return false;
12294
- case zodRuntime.ZodFirstPartyTypeKind.ZodNaN:
12514
+ case "nan":
12295
12515
  return NaN;
12296
- case zodRuntime.ZodFirstPartyTypeKind.ZodDate:
12516
+ case "date":
12297
12517
  return new Date;
12298
- case zodRuntime.ZodFirstPartyTypeKind.ZodSymbol:
12518
+ case "symbol":
12299
12519
  return Symbol("remotion");
12300
- case zodRuntime.ZodFirstPartyTypeKind.ZodUndefined:
12520
+ case "undefined":
12521
+ case "void":
12301
12522
  return;
12302
- case zodRuntime.ZodFirstPartyTypeKind.ZodNull:
12523
+ case "null":
12303
12524
  return null;
12304
- case zodRuntime.ZodFirstPartyTypeKind.ZodAny:
12525
+ case "any":
12526
+ case "custom":
12305
12527
  throw new Error("Cannot create a value for type z.any()");
12306
- case zodRuntime.ZodFirstPartyTypeKind.ZodUnknown:
12528
+ case "unknown":
12307
12529
  throw new Error("Cannot create a value for type z.unknown()");
12308
- case zodRuntime.ZodFirstPartyTypeKind.ZodNever:
12530
+ case "never":
12309
12531
  throw new Error("Cannot create a value for type z.never()");
12310
- case zodRuntime.ZodFirstPartyTypeKind.ZodVoid:
12311
- return;
12312
- case zodRuntime.ZodFirstPartyTypeKind.ZodObject: {
12313
- const shape = def.shape();
12532
+ case "object": {
12533
+ const shape = getObjectShape(schema);
12314
12534
  const keys = Object.keys(shape);
12315
12535
  const returnValue = keys.reduce((existing, key) => {
12316
12536
  existing[key] = createZodValues(shape[key], zodRuntime, zodTypes);
@@ -12318,40 +12538,25 @@ var createZodValues = (schema, zodRuntime, zodTypes) => {
12318
12538
  }, {});
12319
12539
  return returnValue;
12320
12540
  }
12321
- case zodRuntime.ZodFirstPartyTypeKind.ZodArray: {
12322
- return [
12323
- createZodValues(def.type, zodRuntime, zodTypes)
12324
- ];
12541
+ case "array": {
12542
+ return [createZodValues(getArrayElement(schema), zodRuntime, zodTypes)];
12325
12543
  }
12326
- case zodRuntime.ZodFirstPartyTypeKind.ZodUnion: {
12327
- const firstOptions = def.options[0];
12328
- return firstOptions ? createZodValues(firstOptions, zodRuntime, zodTypes) : undefined;
12544
+ case "union": {
12545
+ const firstOption = getUnionOptions(schema)[0];
12546
+ return firstOption ? createZodValues(firstOption, zodRuntime, zodTypes) : undefined;
12329
12547
  }
12330
- case zodRuntime.ZodFirstPartyTypeKind.ZodDiscriminatedUnion: {
12331
- const options = def.options[0];
12332
- return createZodValues(options, zodRuntime, zodTypes);
12548
+ case "discriminatedUnion": {
12549
+ const firstOption = getUnionOptions(schema)[0];
12550
+ return createZodValues(firstOption, zodRuntime, zodTypes);
12333
12551
  }
12334
- case zodRuntime.ZodFirstPartyTypeKind.ZodLiteral: {
12335
- return def.value;
12552
+ case "literal": {
12553
+ return getLiteralValue(schema);
12336
12554
  }
12337
- case zodRuntime.ZodFirstPartyTypeKind.ZodEffects: {
12338
- if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
12339
- return "#ffffff";
12340
- }
12341
- if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_TEXTAREA_BRAND) {
12342
- return "";
12343
- }
12344
- if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
12345
- return [
12346
- [1, 0, 0],
12347
- [0, 1, 0],
12348
- [0, 0, 1]
12349
- ];
12350
- }
12351
- return createZodValues(def.schema, zodRuntime, zodTypes);
12555
+ case "effects": {
12556
+ return createZodValues(getEffectsInner(schema), zodRuntime, zodTypes);
12352
12557
  }
12353
- case zodRuntime.ZodFirstPartyTypeKind.ZodIntersection: {
12354
- const { left: left3, right } = def;
12558
+ case "intersection": {
12559
+ const { left: left3, right } = getIntersectionSchemas(schema);
12355
12560
  const leftValue = createZodValues(left3, zodRuntime, zodTypes);
12356
12561
  if (typeof leftValue !== "object") {
12357
12562
  throw new Error("Cannot create value for type z.intersection: Left side is not an object");
@@ -12362,73 +12567,59 @@ var createZodValues = (schema, zodRuntime, zodTypes) => {
12362
12567
  }
12363
12568
  return { ...leftValue, ...rightValue };
12364
12569
  }
12365
- case zodRuntime.ZodFirstPartyTypeKind.ZodTuple: {
12366
- const items = def.items.map((item2) => createZodValues(item2, zodRuntime, zodTypes));
12367
- return items;
12570
+ case "tuple": {
12571
+ return getTupleItems(schema).map((item2) => createZodValues(item2, zodRuntime, zodTypes));
12368
12572
  }
12369
- case zodRuntime.ZodFirstPartyTypeKind.ZodRecord: {
12370
- const values = createZodValues(def.valueType, zodRuntime, zodTypes);
12573
+ case "record": {
12574
+ const values = createZodValues(getRecordValueType(schema), zodRuntime, zodTypes);
12371
12575
  return { key: values };
12372
12576
  }
12373
- case zodRuntime.ZodFirstPartyTypeKind.ZodMap: {
12374
- const defType = def;
12375
- const values = createZodValues(defType.valueType, zodRuntime, zodTypes);
12376
- const key = createZodValues(defType.keyType, zodRuntime, zodTypes);
12577
+ case "map": {
12578
+ const values = createZodValues(getRecordValueType(schema), zodRuntime, zodTypes);
12579
+ const key = createZodValues(getRecordKeyType(schema), zodRuntime, zodTypes);
12377
12580
  return new Map([[key, values]]);
12378
12581
  }
12379
- case zodRuntime.ZodFirstPartyTypeKind.ZodLazy: {
12380
- const defType = def;
12381
- const type = defType.getter();
12582
+ case "lazy": {
12583
+ const type = getZodDef(schema).getter();
12382
12584
  return createZodValues(type, zodRuntime, zodTypes);
12383
12585
  }
12384
- case zodRuntime.ZodFirstPartyTypeKind.ZodSet: {
12385
- const defType = def;
12386
- const values = createZodValues(defType.valueType, zodRuntime, zodTypes);
12586
+ case "set": {
12587
+ const values = createZodValues(getZodDef(schema).valueType, zodRuntime, zodTypes);
12387
12588
  return new Set([values]);
12388
12589
  }
12389
- case zodRuntime.ZodFirstPartyTypeKind.ZodFunction: {
12590
+ case "function": {
12390
12591
  throw new Error("Cannot create a value for type function");
12391
12592
  }
12392
- case zodRuntime.ZodFirstPartyTypeKind.ZodEnum: {
12393
- const { values } = def;
12394
- return values[0];
12593
+ case "enum": {
12594
+ return getFirstEnumValue(schema);
12395
12595
  }
12396
- case zodRuntime.ZodFirstPartyTypeKind.ZodNativeEnum: {
12596
+ case "nativeEnum": {
12397
12597
  return 0;
12398
12598
  }
12399
- case zodRuntime.ZodFirstPartyTypeKind.ZodOptional: {
12400
- const defType = def;
12401
- const value = createZodValues(defType.innerType, zodRuntime, zodTypes);
12402
- return value;
12599
+ case "optional":
12600
+ case "nullable":
12601
+ case "catch": {
12602
+ return createZodValues(getInnerType(schema), zodRuntime, zodTypes);
12403
12603
  }
12404
- case zodRuntime.ZodFirstPartyTypeKind.ZodNullable: {
12405
- const defType = def;
12406
- const value = createZodValues(defType.innerType, zodRuntime, zodTypes);
12407
- return value;
12408
- }
12409
- case zodRuntime.ZodFirstPartyTypeKind.ZodDefault: {
12410
- const defType = def;
12411
- return defType.defaultValue();
12604
+ case "default": {
12605
+ return getDefaultValue(schema);
12412
12606
  }
12413
- case zodRuntime.ZodFirstPartyTypeKind.ZodCatch: {
12414
- const defType = def;
12415
- const value = createZodValues(defType.innerType, zodRuntime, zodTypes);
12416
- return value;
12417
- }
12418
- case zodRuntime.ZodFirstPartyTypeKind.ZodPromise: {
12419
- const defType = def;
12420
- const value = createZodValues(defType.type, zodRuntime, zodTypes);
12607
+ case "promise": {
12608
+ const def = getZodDef(schema);
12609
+ const inner = isZodV3Schema(schema) ? def.type : def.innerType;
12610
+ const value = createZodValues(inner, zodRuntime, zodTypes);
12421
12611
  return Promise.resolve(value);
12422
12612
  }
12423
- case zodRuntime.ZodFirstPartyTypeKind.ZodBranded: {
12424
- const defType = def;
12425
- const value = createZodValues(defType.type, zodRuntime, zodTypes);
12426
- return value;
12613
+ case "branded": {
12614
+ return createZodValues(getBrandedInner(schema), zodRuntime, zodTypes);
12427
12615
  }
12428
- case zodRuntime.ZodFirstPartyTypeKind.ZodPipeline: {
12429
- const defType = def;
12430
- const value = createZodValues(defType.out, zodRuntime, zodTypes);
12431
- return value;
12616
+ case "pipeline":
12617
+ case "pipe": {
12618
+ const out = getPipelineOutput(schema);
12619
+ if (getZodSchemaType(out) === "transform") {
12620
+ return createZodValues(getPipelineInput(schema), zodRuntime, zodTypes);
12621
+ }
12622
+ return createZodValues(out, zodRuntime, zodTypes);
12432
12623
  }
12433
12624
  default:
12434
12625
  throw new Error("Not implemented: " + typeName);
@@ -12461,16 +12652,16 @@ var SchemaArrayItemSeparationLine = ({ onChange, index, schema, isLast, showAddB
12461
12652
  if (!z) {
12462
12653
  throw new Error("expected zod");
12463
12654
  }
12464
- const def = schema._def;
12655
+ const arrayElement = getArrayElement(schema);
12465
12656
  const onAdd = useCallback50(() => {
12466
12657
  onChange((oldV) => {
12467
12658
  return [
12468
12659
  ...oldV.slice(0, index + 1),
12469
- createZodValues(def.type, z, zodTypes),
12660
+ createZodValues(arrayElement, z, zodTypes),
12470
12661
  ...oldV.slice(index + 1)
12471
12662
  ];
12472
12663
  }, false, true);
12473
- }, [def.type, index, onChange, z, zodTypes]);
12664
+ }, [arrayElement, index, onChange, z, zodTypes]);
12474
12665
  const dynamicAddButtonStyle = useMemo61(() => {
12475
12666
  return {
12476
12667
  display: "flex",
@@ -12601,7 +12792,7 @@ import React78, { useMemo as useMemo67, useState as useState46 } from "react";
12601
12792
  import { useCallback as useCallback51, useMemo as useMemo63 } from "react";
12602
12793
  import { jsx as jsx111 } from "react/jsx-runtime";
12603
12794
  var ZodArrayItemEditor = ({
12604
- def,
12795
+ elementSchema,
12605
12796
  onChange,
12606
12797
  jsonPath,
12607
12798
  index,
@@ -12639,7 +12830,7 @@ var ZodArrayItemEditor = ({
12639
12830
  return /* @__PURE__ */ jsx111("div", {
12640
12831
  children: /* @__PURE__ */ jsx111(ZodSwitch, {
12641
12832
  jsonPath: newJsonPath,
12642
- schema: def.type,
12833
+ schema: elementSchema,
12643
12834
  value,
12644
12835
  setValue,
12645
12836
  defaultValue,
@@ -12873,7 +13064,8 @@ var stackTraceLabel = {
12873
13064
  fontSize: 14
12874
13065
  };
12875
13066
  var ZodFieldValidation = ({ localValue, path }) => {
12876
- if (localValue.zodValidation.success) {
13067
+ const { zodValidation } = localValue;
13068
+ if (zodValidation.success) {
12877
13069
  return null;
12878
13070
  }
12879
13071
  return /* @__PURE__ */ jsxs54("div", {
@@ -12881,7 +13073,7 @@ var ZodFieldValidation = ({ localValue, path }) => {
12881
13073
  children: [
12882
13074
  /* @__PURE__ */ jsx114(ValidationMessage, {
12883
13075
  align: "flex-start",
12884
- message: localValue.zodValidation.error.format()._errors[0],
13076
+ message: zodValidation.error.format()._errors[0],
12885
13077
  type: "error"
12886
13078
  }),
12887
13079
  /* @__PURE__ */ jsx114(Spacing, {
@@ -12896,7 +13088,7 @@ var ZodFieldValidation = ({ localValue, path }) => {
12896
13088
  style: stackTraceLabel,
12897
13089
  children: "Zod Validation has failed:"
12898
13090
  }),
12899
- localValue.zodValidation.error.errors.map((error, index) => /* @__PURE__ */ jsxs54("div", {
13091
+ zodValidation.error.issues.map((error, index) => /* @__PURE__ */ jsxs54("div", {
12900
13092
  style: stackTraceLabel,
12901
13093
  children: [
12902
13094
  "Type: ",
@@ -12948,7 +13140,7 @@ var useLocalState = ({
12948
13140
  [parentRevision]: {
12949
13141
  value: unsavedValue,
12950
13142
  keyStabilityRevision: 0,
12951
- zodValidation: schema.safeParse(unsavedValue)
13143
+ zodValidation: zodSafeParse(schema, unsavedValue)
12952
13144
  }
12953
13145
  };
12954
13146
  });
@@ -12957,7 +13149,7 @@ var useLocalState = ({
12957
13149
  return {
12958
13150
  value: unsavedValue,
12959
13151
  keyStabilityRevision: 0,
12960
- zodValidation: schema.safeParse(unsavedValue)
13152
+ zodValidation: zodSafeParse(schema, unsavedValue)
12961
13153
  };
12962
13154
  }
12963
13155
  return localValueOrNull[parentRevision];
@@ -12976,7 +13168,7 @@ var useLocalState = ({
12976
13168
  return localUnsavedValue ?? {
12977
13169
  value: savedValue,
12978
13170
  keyStabilityRevision: 0,
12979
- zodValidation: schema.safeParse(savedValue)
13171
+ zodValidation: zodSafeParse(schema, savedValue)
12980
13172
  };
12981
13173
  }, [localUnsavedValue, savedValue, schema]);
12982
13174
  const stateRef = useRef26(currentLocalValue);
@@ -12987,7 +13179,7 @@ var useLocalState = ({
12987
13179
  if (isSame) {
12988
13180
  return;
12989
13181
  }
12990
- const safeParse = schema.safeParse(newValue);
13182
+ const safeParse = zodSafeParse(schema, newValue);
12991
13183
  if (safeParse.success || forceApply) {
12992
13184
  setValue(updater, forceApply, increment);
12993
13185
  }
@@ -13055,7 +13247,7 @@ var ZodArrayEditor = ({
13055
13247
  savedValue: defaultValue
13056
13248
  });
13057
13249
  const [expanded, setExpanded] = useState46(true);
13058
- const def = schema._def;
13250
+ const arrayElement = getArrayElement(schema);
13059
13251
  const suffix2 = useMemo67(() => {
13060
13252
  return expanded ? " [" : " [...] ";
13061
13253
  }, [expanded]);
@@ -13064,10 +13256,6 @@ var ZodArrayEditor = ({
13064
13256
  throw new Error("expected zod");
13065
13257
  }
13066
13258
  const zodTypes = useZodTypesIfPossible();
13067
- const typeName = def.typeName;
13068
- if (typeName !== z.ZodFirstPartyTypeKind.ZodArray) {
13069
- throw new Error("expected object");
13070
- }
13071
13259
  const isDefaultValue = useMemo67(() => {
13072
13260
  return deepEqual(localValue.value, defaultValue);
13073
13261
  }, [defaultValue, localValue]);
@@ -13106,10 +13294,10 @@ var ZodArrayEditor = ({
13106
13294
  /* @__PURE__ */ jsx116(ZodArrayItemEditor, {
13107
13295
  onChange,
13108
13296
  value: child,
13109
- def,
13297
+ elementSchema: arrayElement,
13110
13298
  index: i,
13111
13299
  jsonPath,
13112
- defaultValue: defaultValue?.[i] ?? createZodValues(def.type, z, zodTypes),
13300
+ defaultValue: defaultValue?.[i] ?? createZodValues(arrayElement, z, zodTypes),
13113
13301
  onSave,
13114
13302
  showSaveButton,
13115
13303
  saving,
@@ -13758,7 +13946,7 @@ var ZodDefaultEditor = ({
13758
13946
  saveDisabledByParent,
13759
13947
  mayPad
13760
13948
  }) => {
13761
- const { innerType } = schema._def;
13949
+ const innerType = getInnerType(schema);
13762
13950
  return /* @__PURE__ */ jsx123(ZodSwitch, {
13763
13951
  defaultValue,
13764
13952
  jsonPath,
@@ -13795,8 +13983,8 @@ var ZodDiscriminatedUnionEditor = ({
13795
13983
  throw new Error("expected zod");
13796
13984
  }
13797
13985
  const zodTypes = useZodTypesIfPossible();
13798
- const typedSchema = schema._def;
13799
- const options = useMemo72(() => [...typedSchema.optionsMap.keys()], [typedSchema.optionsMap]);
13986
+ const discriminator = getDiscriminator(schema);
13987
+ const options = useMemo72(() => getDiscriminatedOptionKeys(schema), [schema]);
13800
13988
  const {
13801
13989
  localValue,
13802
13990
  onChange: setLocalValue,
@@ -13814,9 +14002,13 @@ var ZodDiscriminatedUnionEditor = ({
13814
14002
  label: option,
13815
14003
  id: option,
13816
14004
  keyHint: null,
13817
- leftItem: option === value[typedSchema.discriminator] ? /* @__PURE__ */ jsx124(Checkmark, {}) : null,
14005
+ leftItem: option === value[discriminator] ? /* @__PURE__ */ jsx124(Checkmark, {}) : null,
13818
14006
  onClick: () => {
13819
- const val = createZodValues(typedSchema.optionsMap.get(option), z, zodTypes);
14007
+ const optionSchema = getDiscriminatedOption(schema, option);
14008
+ if (!optionSchema) {
14009
+ throw new Error(`No schema found for discriminator value: ${option}`);
14010
+ }
14011
+ const val = createZodValues(optionSchema, z, zodTypes);
13820
14012
  setLocalValue(() => val, false, false);
13821
14013
  },
13822
14014
  quickSwitcherLabel: null,
@@ -13824,29 +14016,21 @@ var ZodDiscriminatedUnionEditor = ({
13824
14016
  type: "item"
13825
14017
  };
13826
14018
  });
13827
- }, [
13828
- options,
13829
- setLocalValue,
13830
- typedSchema.discriminator,
13831
- typedSchema.optionsMap,
13832
- value,
13833
- z,
13834
- zodTypes
13835
- ]);
14019
+ }, [options, setLocalValue, discriminator, schema, value, z, zodTypes]);
13836
14020
  const save = useCallback58(() => {
13837
14021
  onSave(() => value, false, false);
13838
14022
  }, [onSave, value]);
13839
14023
  const discriminatedUnionReplacement = useMemo72(() => {
13840
14024
  return {
13841
- discriminator: typedSchema.discriminator,
14025
+ discriminator,
13842
14026
  markup: /* @__PURE__ */ jsxs60(Fieldset, {
13843
14027
  shouldPad: mayPad,
13844
14028
  success: true,
13845
14029
  children: [
13846
14030
  /* @__PURE__ */ jsx124(SchemaLabel, {
13847
14031
  handleClick: null,
13848
- isDefaultValue: localValue.value[typedSchema.discriminator] === defaultValue[typedSchema.discriminator],
13849
- jsonPath: [...jsonPath, typedSchema.discriminator],
14032
+ isDefaultValue: localValue.value[discriminator] === defaultValue[discriminator],
14033
+ jsonPath: [...jsonPath, discriminator],
13850
14034
  onRemove,
13851
14035
  onReset: reset,
13852
14036
  onSave: save,
@@ -13859,7 +14043,7 @@ var ZodDiscriminatedUnionEditor = ({
13859
14043
  /* @__PURE__ */ jsx124(Combobox, {
13860
14044
  title: "Select type",
13861
14045
  values: comboBoxValues,
13862
- selectedId: value[typedSchema.discriminator]
14046
+ selectedId: value[discriminator]
13863
14047
  })
13864
14048
  ]
13865
14049
  }, "replacement")
@@ -13877,9 +14061,13 @@ var ZodDiscriminatedUnionEditor = ({
13877
14061
  saveDisabledByParent,
13878
14062
  saving,
13879
14063
  showSaveButton,
13880
- typedSchema.discriminator,
14064
+ discriminator,
13881
14065
  value
13882
14066
  ]);
14067
+ const currentOptionSchema = getDiscriminatedOption(schema, value[discriminator]);
14068
+ if (!currentOptionSchema) {
14069
+ throw new Error("No matching option found for discriminated union");
14070
+ }
13883
14071
  return /* @__PURE__ */ jsx124(ZodObjectEditor, {
13884
14072
  jsonPath,
13885
14073
  mayPad,
@@ -13888,12 +14076,12 @@ var ZodDiscriminatedUnionEditor = ({
13888
14076
  onSave,
13889
14077
  saveDisabledByParent,
13890
14078
  saving,
13891
- schema: typedSchema.optionsMap.get(value[typedSchema.discriminator]),
14079
+ schema: currentOptionSchema,
13892
14080
  setValue: setLocalValue,
13893
14081
  showSaveButton,
13894
14082
  unsavedValue: value,
13895
14083
  discriminatedUnionReplacement
13896
- }, value[typedSchema.discriminator]);
14084
+ }, value[discriminator]);
13897
14085
  };
13898
14086
 
13899
14087
  // src/components/RenderModal/SchemaEditor/ZodEffectEditor.tsx
@@ -13913,9 +14101,9 @@ var ZodEffectEditor = ({
13913
14101
  saving,
13914
14102
  mayPad
13915
14103
  }) => {
13916
- const z = useZodIfPossible();
13917
- if (!z) {
13918
- throw new Error("expected zod");
14104
+ const typeName = getZodSchemaType(schema);
14105
+ if (typeName !== "effects") {
14106
+ throw new Error("expected effect");
13919
14107
  }
13920
14108
  const { localValue, onChange } = useLocalState({
13921
14109
  unsavedValue: value,
@@ -13923,11 +14111,7 @@ var ZodEffectEditor = ({
13923
14111
  setValue: updateValue,
13924
14112
  savedValue: defaultValue
13925
14113
  });
13926
- const def = schema._def;
13927
- const typeName = def.typeName;
13928
- if (typeName !== z.ZodFirstPartyTypeKind.ZodEffects) {
13929
- throw new Error("expected effect");
13930
- }
14114
+ const innerSchema = getEffectsInner(schema);
13931
14115
  return /* @__PURE__ */ jsxs61(Fieldset, {
13932
14116
  shouldPad: mayPad,
13933
14117
  success: localValue.zodValidation.success,
@@ -13938,7 +14122,7 @@ var ZodEffectEditor = ({
13938
14122
  value,
13939
14123
  setValue: onChange,
13940
14124
  jsonPath,
13941
- schema: def.schema,
14125
+ schema: innerSchema,
13942
14126
  defaultValue,
13943
14127
  onSave,
13944
14128
  showSaveButton,
@@ -13973,10 +14157,6 @@ var ZodEnumEditor = ({
13973
14157
  onRemove,
13974
14158
  saving
13975
14159
  }) => {
13976
- const z = useZodIfPossible();
13977
- if (!z) {
13978
- throw new Error("expected zod");
13979
- }
13980
14160
  const {
13981
14161
  localValue,
13982
14162
  onChange: setLocalValue,
@@ -13987,14 +14167,10 @@ var ZodEnumEditor = ({
13987
14167
  unsavedValue: value,
13988
14168
  savedValue: defaultValue
13989
14169
  });
13990
- const def = schema._def;
13991
- const typeName = def.typeName;
13992
- if (typeName !== z.ZodFirstPartyTypeKind.ZodEnum) {
13993
- throw new Error("expected enum");
13994
- }
14170
+ const enumValues = getEnumValues(schema);
13995
14171
  const isRoot = jsonPath.length === 0;
13996
14172
  const comboBoxValues = useMemo73(() => {
13997
- return def.values.map((option) => {
14173
+ return enumValues.map((option) => {
13998
14174
  return {
13999
14175
  value: option,
14000
14176
  label: option,
@@ -14009,7 +14185,7 @@ var ZodEnumEditor = ({
14009
14185
  type: "item"
14010
14186
  };
14011
14187
  });
14012
- }, [def.values, setLocalValue, value]);
14188
+ }, [enumValues, setLocalValue, value]);
14013
14189
  const save = useCallback59(() => {
14014
14190
  onSave(() => value, false, false);
14015
14191
  }, [onSave, value]);
@@ -14074,7 +14250,7 @@ var ZodMatrixEditor = ({
14074
14250
  savedValue: defaultValue
14075
14251
  });
14076
14252
  const [expanded, setExpanded] = useState49(true);
14077
- const def = schema._def;
14253
+ const arrayElement = getArrayElement(schema);
14078
14254
  const suffix2 = useMemo74(() => {
14079
14255
  return expanded ? " [" : " [...] ";
14080
14256
  }, [expanded]);
@@ -14132,10 +14308,10 @@ var ZodMatrixEditor = ({
14132
14308
  children: /* @__PURE__ */ jsx127(ZodArrayItemEditor, {
14133
14309
  onChange,
14134
14310
  value: item2,
14135
- def,
14311
+ elementSchema: arrayElement,
14136
14312
  index: actualIndex,
14137
14313
  jsonPath,
14138
- defaultValue: defaultValue?.[actualIndex] ?? createZodValues(def.type, z, zodTypes),
14314
+ defaultValue: defaultValue?.[actualIndex] ?? createZodValues(arrayElement, z, zodTypes),
14139
14315
  onSave,
14140
14316
  showSaveButton,
14141
14317
  saving,
@@ -14335,7 +14511,7 @@ var ZodNullableEditor = ({
14335
14511
  saveDisabledByParent,
14336
14512
  mayPad
14337
14513
  }) => {
14338
- const { innerType } = schema._def;
14514
+ const innerType = getInnerType(schema);
14339
14515
  return /* @__PURE__ */ jsx130(ZodOrNullishEditor, {
14340
14516
  defaultValue,
14341
14517
  jsonPath,
@@ -14360,40 +14536,58 @@ var fullWidth6 = {
14360
14536
  width: "100%"
14361
14537
  };
14362
14538
  var getMinValue = (schema) => {
14363
- const minCheck = schema._def.checks.find((c) => c.kind === "min");
14364
- if (!minCheck) {
14365
- return -Infinity;
14366
- }
14367
- if (minCheck.kind !== "min") {
14368
- throw new Error("Expected min check");
14369
- }
14370
- if (!minCheck.inclusive) {
14539
+ const { checks } = getZodDef(schema);
14540
+ if (!checks)
14371
14541
  return -Infinity;
14542
+ if (isZodV3Schema(schema)) {
14543
+ const minCheck = checks.find((c) => c.kind === "min");
14544
+ if (!minCheck || !minCheck.inclusive)
14545
+ return -Infinity;
14546
+ return minCheck.value;
14547
+ }
14548
+ for (const c of checks) {
14549
+ const def = c._zod?.def;
14550
+ if (def?.check === "greater_than" && def.inclusive) {
14551
+ return def.value;
14552
+ }
14372
14553
  }
14373
- return minCheck.value;
14554
+ return -Infinity;
14374
14555
  };
14375
14556
  var getMaxValue = (schema) => {
14376
- const maxCheck = schema._def.checks.find((c) => c.kind === "max");
14377
- if (!maxCheck) {
14378
- return Infinity;
14379
- }
14380
- if (maxCheck.kind !== "max") {
14381
- throw new Error("Expected max check");
14382
- }
14383
- if (!maxCheck.inclusive) {
14557
+ const { checks } = getZodDef(schema);
14558
+ if (!checks)
14384
14559
  return Infinity;
14560
+ if (isZodV3Schema(schema)) {
14561
+ const maxCheck = checks.find((c) => c.kind === "max");
14562
+ if (!maxCheck || !maxCheck.inclusive)
14563
+ return Infinity;
14564
+ return maxCheck.value;
14565
+ }
14566
+ for (const c of checks) {
14567
+ const def = c._zod?.def;
14568
+ if (def?.check === "less_than" && def.inclusive) {
14569
+ return def.value;
14570
+ }
14385
14571
  }
14386
- return maxCheck.value;
14572
+ return Infinity;
14387
14573
  };
14388
14574
  var getStep = (schema) => {
14389
- const multipleStep = schema._def.checks.find((c) => c.kind === "multipleOf");
14390
- if (!multipleStep) {
14575
+ const { checks } = getZodDef(schema);
14576
+ if (!checks)
14391
14577
  return;
14578
+ if (isZodV3Schema(schema)) {
14579
+ const multipleStep = checks.find((c) => c.kind === "multipleOf");
14580
+ if (!multipleStep)
14581
+ return;
14582
+ return multipleStep.value;
14392
14583
  }
14393
- if (multipleStep.kind !== "multipleOf") {
14394
- throw new Error("Expected multipleOf check");
14584
+ for (const c of checks) {
14585
+ const def = c._zod?.def;
14586
+ if (def?.check === "multiple_of") {
14587
+ return def.value;
14588
+ }
14395
14589
  }
14396
- return multipleStep.value;
14590
+ return;
14397
14591
  };
14398
14592
  var ZodNumberEditor = ({
14399
14593
  jsonPath,
@@ -14486,7 +14680,7 @@ var ZodOptionalEditor = ({
14486
14680
  saveDisabledByParent,
14487
14681
  mayPad
14488
14682
  }) => {
14489
- const { innerType } = schema._def;
14683
+ const innerType = getInnerType(schema);
14490
14684
  return /* @__PURE__ */ jsx132(ZodOrNullishEditor, {
14491
14685
  defaultValue,
14492
14686
  jsonPath,
@@ -14523,10 +14717,6 @@ var ZodStaticFileEditor = ({
14523
14717
  saveDisabledByParent,
14524
14718
  mayPad
14525
14719
  }) => {
14526
- const z = useZodIfPossible();
14527
- if (!z) {
14528
- throw new Error("expected zod");
14529
- }
14530
14720
  const {
14531
14721
  localValue,
14532
14722
  onChange: setLocalValue,
@@ -14537,11 +14727,6 @@ var ZodStaticFileEditor = ({
14537
14727
  unsavedValue: value,
14538
14728
  savedValue: defaultValue
14539
14729
  });
14540
- const def = schema._def;
14541
- const typeName = def.typeName;
14542
- if (typeName !== z.ZodFirstPartyTypeKind.ZodString) {
14543
- throw new Error("expected enum");
14544
- }
14545
14730
  const isRoot = jsonPath.length === 0;
14546
14731
  const staticFiles = useStaticFiles();
14547
14732
  const comboBoxValues = useMemo75(() => {
@@ -14766,7 +14951,7 @@ import React92, { useMemo as useMemo77, useState as useState50 } from "react";
14766
14951
  import { useCallback as useCallback66, useMemo as useMemo76 } from "react";
14767
14952
  import { jsx as jsx136 } from "react/jsx-runtime";
14768
14953
  var ZodTupleItemEditor = ({
14769
- def,
14954
+ tupleItems,
14770
14955
  onChange,
14771
14956
  jsonPath,
14772
14957
  index,
@@ -14800,7 +14985,7 @@ var ZodTupleItemEditor = ({
14800
14985
  return /* @__PURE__ */ jsx136("div", {
14801
14986
  children: /* @__PURE__ */ jsx136(ZodSwitch, {
14802
14987
  jsonPath: newJsonPath,
14803
- schema: def.items[index],
14988
+ schema: tupleItems[index],
14804
14989
  value,
14805
14990
  setValue,
14806
14991
  defaultValue,
@@ -14836,7 +15021,7 @@ var ZodTupleEditor = ({
14836
15021
  savedValue: defaultValue
14837
15022
  });
14838
15023
  const [expanded, setExpanded] = useState50(true);
14839
- const def = schema._def;
15024
+ const tupleItems = getTupleItems(schema);
14840
15025
  const suffix2 = useMemo77(() => {
14841
15026
  return expanded ? " [" : " [...] ";
14842
15027
  }, [expanded]);
@@ -14845,10 +15030,6 @@ var ZodTupleEditor = ({
14845
15030
  throw new Error("expected zod");
14846
15031
  }
14847
15032
  const zodTypes = useZodTypesIfPossible();
14848
- const typeName = def.typeName;
14849
- if (typeName !== z.ZodFirstPartyTypeKind.ZodTuple) {
14850
- throw new Error("expected object");
14851
- }
14852
15033
  const isDefaultValue = useMemo77(() => {
14853
15034
  return deepEqual(localValue.value, defaultValue);
14854
15035
  }, [defaultValue, localValue]);
@@ -14887,10 +15068,10 @@ var ZodTupleEditor = ({
14887
15068
  /* @__PURE__ */ jsx137(ZodTupleItemEditor, {
14888
15069
  onChange,
14889
15070
  value: child,
14890
- def,
15071
+ tupleItems,
14891
15072
  index: i,
14892
15073
  jsonPath,
14893
- defaultValue: defaultValue?.[i] ?? createZodValues(def.items[i], z, zodTypes),
15074
+ defaultValue: defaultValue?.[i] ?? createZodValues(tupleItems[i], z, zodTypes),
14894
15075
  onSave,
14895
15076
  showSaveButton,
14896
15077
  saving,
@@ -14927,14 +15108,18 @@ var ZodTupleEditor = ({
14927
15108
 
14928
15109
  // src/components/RenderModal/SchemaEditor/ZodUnionEditor.tsx
14929
15110
  import { jsx as jsx138 } from "react/jsx-runtime";
14930
- var findNull = (value, zodType) => {
14931
- const nullIndex = value.findIndex((v) => v._def.typeName === zodType.ZodFirstPartyTypeKind.ZodNull || v._def.typeName === zodType.ZodFirstPartyTypeKind.ZodUndefined);
15111
+ var findNull = (value) => {
15112
+ const nullIndex = value.findIndex((v) => {
15113
+ const type = getZodSchemaType(v);
15114
+ return type === "null" || type === "undefined";
15115
+ });
14932
15116
  if (nullIndex === -1) {
14933
15117
  return null;
14934
15118
  }
14935
- const nullishValue = value[nullIndex]._def.typeName === zodType.ZodFirstPartyTypeKind.ZodNull ? null : undefined;
15119
+ const nullishValue = getZodSchemaType(value[nullIndex]) === "null" ? null : undefined;
14936
15120
  const otherSchema = value[nullIndex === 0 ? 1 : 0];
14937
- const otherSchemaIsAlsoNullish = otherSchema._def.typeName === zodType.ZodFirstPartyTypeKind.ZodNull || otherSchema._def.typeName === zodType.ZodFirstPartyTypeKind.ZodUndefined;
15121
+ const otherType = getZodSchemaType(otherSchema);
15122
+ const otherSchemaIsAlsoNullish = otherType === "null" || otherType === "undefined";
14938
15123
  return {
14939
15124
  nullIndex,
14940
15125
  nullishValue,
@@ -14955,11 +15140,7 @@ var ZodUnionEditor = ({
14955
15140
  saveDisabledByParent,
14956
15141
  mayPad
14957
15142
  }) => {
14958
- const { options } = schema._def;
14959
- const z = useZodIfPossible();
14960
- if (!z) {
14961
- throw new Error("expected zod");
14962
- }
15143
+ const options = getUnionOptions(schema);
14963
15144
  if (options.length > 2) {
14964
15145
  return /* @__PURE__ */ jsx138(ZonNonEditableValue, {
14965
15146
  jsonPath,
@@ -14978,7 +15159,7 @@ var ZodUnionEditor = ({
14978
15159
  mayPad
14979
15160
  });
14980
15161
  }
14981
- const nullResult = findNull(options, z);
15162
+ const nullResult = findNull(options);
14982
15163
  if (!nullResult) {
14983
15164
  return /* @__PURE__ */ jsx138(ZonNonEditableValue, {
14984
15165
  jsonPath,
@@ -15030,14 +15211,10 @@ var ZodSwitch = ({
15030
15211
  saveDisabledByParent,
15031
15212
  mayPad
15032
15213
  }) => {
15033
- const def = schema._def;
15034
- const typeName = def.typeName;
15035
- const z = useZodIfPossible();
15036
- if (!z) {
15037
- throw new Error("expected zod");
15038
- }
15214
+ const typeName = getZodSchemaType(schema);
15215
+ const description = getZodSchemaDescription(schema);
15039
15216
  const zodTypes = useZodTypesIfPossible();
15040
- if (typeName === z.ZodFirstPartyTypeKind.ZodObject) {
15217
+ if (typeName === "object") {
15041
15218
  return /* @__PURE__ */ jsx139(ZodObjectEditor, {
15042
15219
  setValue,
15043
15220
  unsavedValue: value,
@@ -15053,7 +15230,22 @@ var ZodSwitch = ({
15053
15230
  discriminatedUnionReplacement: null
15054
15231
  });
15055
15232
  }
15056
- if (typeName === z.ZodFirstPartyTypeKind.ZodString) {
15233
+ if (typeName === "string") {
15234
+ if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
15235
+ return /* @__PURE__ */ jsx139(ZodColorEditor, {
15236
+ value,
15237
+ setValue,
15238
+ jsonPath,
15239
+ schema,
15240
+ onSave,
15241
+ defaultValue,
15242
+ showSaveButton,
15243
+ onRemove,
15244
+ saving,
15245
+ saveDisabledByParent,
15246
+ mayPad
15247
+ });
15248
+ }
15057
15249
  if (value.startsWith(window.remotion_staticBase)) {
15058
15250
  return /* @__PURE__ */ jsx139(ZodStaticFileEditor, {
15059
15251
  setValue,
@@ -15069,7 +15261,7 @@ var ZodSwitch = ({
15069
15261
  mayPad
15070
15262
  });
15071
15263
  }
15072
- if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_TEXTAREA_BRAND) {
15264
+ if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_TEXTAREA_BRAND) {
15073
15265
  return /* @__PURE__ */ jsx139(ZodTextareaEditor, {
15074
15266
  value,
15075
15267
  setValue,
@@ -15098,7 +15290,7 @@ var ZodSwitch = ({
15098
15290
  mayPad
15099
15291
  });
15100
15292
  }
15101
- if (typeName === z.ZodFirstPartyTypeKind.ZodDate) {
15293
+ if (typeName === "date") {
15102
15294
  return /* @__PURE__ */ jsx139(ZodDateEditor, {
15103
15295
  value,
15104
15296
  setValue,
@@ -15113,7 +15305,7 @@ var ZodSwitch = ({
15113
15305
  mayPad
15114
15306
  });
15115
15307
  }
15116
- if (typeName === z.ZodFirstPartyTypeKind.ZodNumber) {
15308
+ if (typeName === "number") {
15117
15309
  return /* @__PURE__ */ jsx139(ZodNumberEditor, {
15118
15310
  value,
15119
15311
  setValue,
@@ -15128,7 +15320,7 @@ var ZodSwitch = ({
15128
15320
  mayPad
15129
15321
  });
15130
15322
  }
15131
- if (typeName === z.ZodFirstPartyTypeKind.ZodBoolean) {
15323
+ if (typeName === "boolean") {
15132
15324
  return /* @__PURE__ */ jsx139(ZodBooleanEditor, {
15133
15325
  value,
15134
15326
  setValue,
@@ -15143,7 +15335,7 @@ var ZodSwitch = ({
15143
15335
  schema
15144
15336
  });
15145
15337
  }
15146
- if (typeName === z.ZodFirstPartyTypeKind.ZodUndefined) {
15338
+ if (typeName === "undefined") {
15147
15339
  return /* @__PURE__ */ jsx139(ZonNonEditableValue, {
15148
15340
  jsonPath,
15149
15341
  showSaveButton,
@@ -15152,7 +15344,7 @@ var ZodSwitch = ({
15152
15344
  mayPad
15153
15345
  });
15154
15346
  }
15155
- if (typeName === z.ZodFirstPartyTypeKind.ZodNull) {
15347
+ if (typeName === "null") {
15156
15348
  return /* @__PURE__ */ jsx139(ZonNonEditableValue, {
15157
15349
  jsonPath,
15158
15350
  showSaveButton,
@@ -15161,7 +15353,7 @@ var ZodSwitch = ({
15161
15353
  mayPad
15162
15354
  });
15163
15355
  }
15164
- if (typeName === z.ZodFirstPartyTypeKind.ZodAny) {
15356
+ if (typeName === "any") {
15165
15357
  return /* @__PURE__ */ jsx139(ZonNonEditableValue, {
15166
15358
  jsonPath,
15167
15359
  showSaveButton,
@@ -15170,7 +15362,7 @@ var ZodSwitch = ({
15170
15362
  mayPad
15171
15363
  });
15172
15364
  }
15173
- if (typeName === z.ZodFirstPartyTypeKind.ZodBigInt) {
15365
+ if (typeName === "bigint") {
15174
15366
  return /* @__PURE__ */ jsx139(ZonNonEditableValue, {
15175
15367
  jsonPath,
15176
15368
  showSaveButton,
@@ -15179,7 +15371,7 @@ var ZodSwitch = ({
15179
15371
  mayPad
15180
15372
  });
15181
15373
  }
15182
- if (typeName === z.ZodFirstPartyTypeKind.ZodUnknown) {
15374
+ if (typeName === "unknown") {
15183
15375
  return /* @__PURE__ */ jsx139(ZonNonEditableValue, {
15184
15376
  jsonPath,
15185
15377
  showSaveButton,
@@ -15188,7 +15380,22 @@ var ZodSwitch = ({
15188
15380
  mayPad
15189
15381
  });
15190
15382
  }
15191
- if (typeName === z.ZodFirstPartyTypeKind.ZodArray) {
15383
+ if (typeName === "array") {
15384
+ if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
15385
+ return /* @__PURE__ */ jsx139(ZodMatrixEditor, {
15386
+ setValue,
15387
+ value,
15388
+ jsonPath,
15389
+ schema,
15390
+ defaultValue,
15391
+ onSave,
15392
+ showSaveButton,
15393
+ onRemove,
15394
+ saving,
15395
+ saveDisabledByParent,
15396
+ mayPad
15397
+ });
15398
+ }
15192
15399
  return /* @__PURE__ */ jsx139(ZodArrayEditor, {
15193
15400
  setValue,
15194
15401
  value,
@@ -15203,7 +15410,7 @@ var ZodSwitch = ({
15203
15410
  mayPad
15204
15411
  });
15205
15412
  }
15206
- if (typeName === z.ZodFirstPartyTypeKind.ZodEnum) {
15413
+ if (typeName === "enum") {
15207
15414
  return /* @__PURE__ */ jsx139(ZodEnumEditor, {
15208
15415
  setValue,
15209
15416
  value,
@@ -15216,8 +15423,8 @@ var ZodSwitch = ({
15216
15423
  saving
15217
15424
  });
15218
15425
  }
15219
- if (typeName === z.ZodFirstPartyTypeKind.ZodEffects) {
15220
- if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
15426
+ if (typeName === "effects") {
15427
+ if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
15221
15428
  return /* @__PURE__ */ jsx139(ZodColorEditor, {
15222
15429
  value,
15223
15430
  setValue,
@@ -15232,12 +15439,12 @@ var ZodSwitch = ({
15232
15439
  mayPad
15233
15440
  });
15234
15441
  }
15235
- if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
15442
+ if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
15236
15443
  return /* @__PURE__ */ jsx139(ZodMatrixEditor, {
15237
15444
  setValue,
15238
15445
  value,
15239
15446
  jsonPath,
15240
- schema: schema._def.schema,
15447
+ schema: getEffectsInner(schema),
15241
15448
  defaultValue,
15242
15449
  onSave,
15243
15450
  showSaveButton,
@@ -15260,7 +15467,7 @@ var ZodSwitch = ({
15260
15467
  mayPad
15261
15468
  });
15262
15469
  }
15263
- if (typeName === z.ZodFirstPartyTypeKind.ZodUnion) {
15470
+ if (typeName === "union") {
15264
15471
  return /* @__PURE__ */ jsx139(ZodUnionEditor, {
15265
15472
  schema,
15266
15473
  showSaveButton,
@@ -15275,7 +15482,7 @@ var ZodSwitch = ({
15275
15482
  mayPad
15276
15483
  });
15277
15484
  }
15278
- if (typeName === z.ZodFirstPartyTypeKind.ZodOptional) {
15485
+ if (typeName === "optional") {
15279
15486
  return /* @__PURE__ */ jsx139(ZodOptionalEditor, {
15280
15487
  jsonPath,
15281
15488
  showSaveButton,
@@ -15290,7 +15497,7 @@ var ZodSwitch = ({
15290
15497
  mayPad
15291
15498
  });
15292
15499
  }
15293
- if (typeName === z.ZodFirstPartyTypeKind.ZodNullable) {
15500
+ if (typeName === "nullable") {
15294
15501
  return /* @__PURE__ */ jsx139(ZodNullableEditor, {
15295
15502
  jsonPath,
15296
15503
  showSaveButton,
@@ -15305,7 +15512,7 @@ var ZodSwitch = ({
15305
15512
  mayPad
15306
15513
  });
15307
15514
  }
15308
- if (typeName === z.ZodFirstPartyTypeKind.ZodDefault) {
15515
+ if (typeName === "default") {
15309
15516
  return /* @__PURE__ */ jsx139(ZodDefaultEditor, {
15310
15517
  jsonPath,
15311
15518
  showSaveButton,
@@ -15320,7 +15527,7 @@ var ZodSwitch = ({
15320
15527
  mayPad
15321
15528
  });
15322
15529
  }
15323
- if (typeName === z.ZodFirstPartyTypeKind.ZodDiscriminatedUnion) {
15530
+ if (typeName === "discriminatedUnion") {
15324
15531
  return /* @__PURE__ */ jsx139(ZodDiscriminatedUnionEditor, {
15325
15532
  defaultValue,
15326
15533
  mayPad,
@@ -15335,7 +15542,7 @@ var ZodSwitch = ({
15335
15542
  showSaveButton
15336
15543
  });
15337
15544
  }
15338
- if (typeName === z.ZodFirstPartyTypeKind.ZodTuple) {
15545
+ if (typeName === "tuple") {
15339
15546
  return /* @__PURE__ */ jsx139(ZodTupleEditor, {
15340
15547
  setValue,
15341
15548
  value,
@@ -15375,10 +15582,6 @@ var ZodObjectEditor = ({
15375
15582
  mayPad,
15376
15583
  discriminatedUnionReplacement
15377
15584
  }) => {
15378
- const z = useZodIfPossible();
15379
- if (!z) {
15380
- throw new Error("expected zod");
15381
- }
15382
15585
  const [expanded, setExpanded] = useState51(true);
15383
15586
  const { localValue, onChange, RevisionContextProvider, reset } = useLocalState({
15384
15587
  schema,
@@ -15386,12 +15589,11 @@ var ZodObjectEditor = ({
15386
15589
  unsavedValue,
15387
15590
  savedValue
15388
15591
  });
15389
- const def = schema._def;
15390
- const typeName = def.typeName;
15391
- if (typeName !== z.ZodFirstPartyTypeKind.ZodObject) {
15592
+ const typeName = getZodSchemaType(schema);
15593
+ if (typeName !== "object") {
15392
15594
  throw new Error("expected object");
15393
15595
  }
15394
- const shape = def.shape();
15596
+ const shape = getObjectShape(schema);
15395
15597
  const keys = Object.keys(shape);
15396
15598
  const isRoot = jsonPath.length === 0;
15397
15599
  const isDefaultValue = useMemo78(() => {
@@ -15536,13 +15738,12 @@ var SchemaEditor = ({
15536
15738
  save.unregister();
15537
15739
  };
15538
15740
  }, [keybindings, onQuickSave, onSave]);
15539
- const def = schema._def;
15540
- const typeName = def.typeName;
15741
+ const typeName = getZodSchemaType(schema);
15541
15742
  const reset = useCallback67(() => {
15542
15743
  setValue(savedDefaultProps);
15543
15744
  }, [savedDefaultProps, setValue]);
15544
15745
  if (!zodValidationResult.success) {
15545
- const defaultPropsValid = schema.safeParse(savedDefaultProps);
15746
+ const defaultPropsValid = zodSafeParse(schema, savedDefaultProps);
15546
15747
  if (!defaultPropsValid.success) {
15547
15748
  return /* @__PURE__ */ jsx141(InvalidDefaultProps, {
15548
15749
  zodValidationResult
@@ -15553,7 +15754,7 @@ var SchemaEditor = ({
15553
15754
  zodValidationResult
15554
15755
  });
15555
15756
  }
15556
- if (typeName !== z.ZodFirstPartyTypeKind.ZodObject) {
15757
+ if (typeName !== "object") {
15557
15758
  return /* @__PURE__ */ jsx141(TopLevelZodValue, {
15558
15759
  typeReceived: typeName
15559
15760
  });
@@ -15815,7 +16016,7 @@ var DataEditor = ({
15815
16016
  if (schema === "no-schema") {
15816
16017
  return "no-schema";
15817
16018
  }
15818
- return schema.safeParse(defaultProps);
16019
+ return zodSafeParse(schema, defaultProps);
15819
16020
  }, [defaultProps, schema]);
15820
16021
  const setShowWarning = useCallback69((val) => {
15821
16022
  setShowWarningWithoutPersistance((prevVal) => {
@@ -15990,9 +16191,8 @@ var DataEditor = ({
15990
16191
  if (zodValidationResult === "no-schema") {
15991
16192
  throw new Error("expected schema");
15992
16193
  }
15993
- const def = schema._def;
15994
- const typeName = def.typeName;
15995
- if (typeName === z.ZodFirstPartyTypeKind.ZodAny) {
16194
+ const typeName = getZodSchemaType(schema);
16195
+ if (typeName === "any") {
15996
16196
  return /* @__PURE__ */ jsx143(NoSchemaDefined, {});
15997
16197
  }
15998
16198
  if (!unresolvedComposition.defaultProps) {
@@ -20543,6 +20743,8 @@ var Inner2 = () => {
20543
20743
  if (!videoConfig) {
20544
20744
  return;
20545
20745
  }
20746
+ document.body.style.userSelect = "none";
20747
+ document.body.style.webkitUserSelect = "none";
20546
20748
  if (e.target === inPointerHandle.current) {
20547
20749
  if (inFrame === null) {
20548
20750
  throw new Error("expected outframe");
@@ -20704,6 +20906,8 @@ var Inner2 = () => {
20704
20906
  }, [get, inFrame, inOutDragging, outFrame, videoConfig, width]);
20705
20907
  const onPointerUpScrubbing = useCallback96((e) => {
20706
20908
  stopInterval();
20909
+ document.body.style.userSelect = "";
20910
+ document.body.style.webkitUserSelect = "";
20707
20911
  if (!videoConfig) {
20708
20912
  return;
20709
20913
  }
@@ -20729,6 +20933,8 @@ var Inner2 = () => {
20729
20933
  }
20730
20934
  }, [dragging, left3, play, videoConfig, setFrame, width]);
20731
20935
  const onPointerUpInOut = useCallback96((e) => {
20936
+ document.body.style.userSelect = "";
20937
+ document.body.style.webkitUserSelect = "";
20732
20938
  if (!videoConfig) {
20733
20939
  return;
20734
20940
  }
@@ -21234,9 +21440,7 @@ var text = {
21234
21440
  alignItems: "center",
21235
21441
  fontVariantNumeric: "tabular-nums",
21236
21442
  lineHeight: 1,
21237
- width: "100%",
21238
- userSelect: "none",
21239
- WebkitUserSelect: "none"
21443
+ width: "100%"
21240
21444
  };
21241
21445
  var time = {
21242
21446
  display: "inline-block",
@@ -23340,7 +23544,8 @@ var CodemodFooter = ({
23340
23544
  successNotification,
23341
23545
  errorNotification,
23342
23546
  genericSubmitLabel,
23343
- submitLabel
23547
+ submitLabel,
23548
+ onSuccess
23344
23549
  }) => {
23345
23550
  const [submitting, setSubmitting] = useState72(false);
23346
23551
  const { setSelectedModal } = useContext78(ModalsContext);
@@ -23369,6 +23574,7 @@ var CodemodFooter = ({
23369
23574
  signal: new AbortController().signal
23370
23575
  }).then(() => {
23371
23576
  notification2.replaceContent(successNotification, 2000);
23577
+ onSuccess?.();
23372
23578
  }).catch((err) => {
23373
23579
  notification2.replaceContent(`${errorNotification}: ${err.message}`, 2000);
23374
23580
  });
@@ -23376,6 +23582,7 @@ var CodemodFooter = ({
23376
23582
  codemod,
23377
23583
  errorNotification,
23378
23584
  loadingNotification,
23585
+ onSuccess,
23379
23586
  setSelectedModal,
23380
23587
  successNotification
23381
23588
  ]);
@@ -23520,7 +23727,8 @@ var DeleteCompositionLoaded = ({ compositionId }) => {
23520
23727
  genericSubmitLabel: `Delete`,
23521
23728
  submitLabel: ({ relativeRootPath }) => `Delete from ${relativeRootPath}`,
23522
23729
  codemod,
23523
- valid: true
23730
+ valid: true,
23731
+ onSuccess: null
23524
23732
  })
23525
23733
  })
23526
23734
  ]
@@ -23781,6 +23989,9 @@ var DuplicateCompositionLoaded = ({ initialType }) => {
23781
23989
  size4.width,
23782
23990
  type
23783
23991
  ]);
23992
+ const onDuplicateSuccess = useCallback106(() => {
23993
+ pushUrl(`/${newId}`);
23994
+ }, [newId]);
23784
23995
  const onSubmit = useCallback106((e) => {
23785
23996
  e.preventDefault();
23786
23997
  }, []);
@@ -23979,7 +24190,8 @@ var DuplicateCompositionLoaded = ({ initialType }) => {
23979
24190
  genericSubmitLabel: "Duplicate",
23980
24191
  submitLabel: ({ relativeRootPath }) => `Add to ${relativeRootPath}`,
23981
24192
  codemod,
23982
- valid
24193
+ valid,
24194
+ onSuccess: onDuplicateSuccess
23983
24195
  })
23984
24196
  })
23985
24197
  ]
@@ -24091,7 +24303,8 @@ var RenameCompositionLoaded = () => {
24091
24303
  genericSubmitLabel: "Rename",
24092
24304
  submitLabel: ({ relativeRootPath }) => `Modify ${relativeRootPath}`,
24093
24305
  codemod,
24094
- valid
24306
+ valid,
24307
+ onSuccess: null
24095
24308
  })
24096
24309
  })
24097
24310
  ]
@@ -26202,7 +26415,9 @@ var selectorButton2 = {
26202
26415
  flexDirection: "row",
26203
26416
  fontSize: 14,
26204
26417
  color: "inherit",
26205
- alignItems: "center"
26418
+ alignItems: "center",
26419
+ userSelect: "none",
26420
+ WebkitUserSelect: "none"
26206
26421
  };
26207
26422
  var VerticalTab = ({ children, onClick, style: style12, selected }) => {
26208
26423
  const [hovered, setHovered] = useState79(false);
@@ -32845,9 +33060,10 @@ var makeDefaultGlobalCSS = () => {
32845
33060
  /* Override Chakra UI position: relative on body */
32846
33061
  position: static !important;
32847
33062
  }
32848
-
33063
+
32849
33064
  .remotion-splitter {
32850
33065
  user-select: none;
33066
+ -webkit-user-select: none;
32851
33067
  }
32852
33068
 
32853
33069
  .remotion-splitter-horizontal {