@vishu1301/script-writing 1.4.0 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -186,7 +186,7 @@ interface Shot {
186
186
  lens_feel: string;
187
187
  aperture: string;
188
188
  depth_of_field: string;
189
- fps?: string;
189
+ fps?: number;
190
190
  subject: string;
191
191
  action_blocking: string;
192
192
  emotional_purpose: string;
@@ -207,7 +207,7 @@ interface ShotBreakdown {
207
207
  shots: Shot[];
208
208
  }
209
209
 
210
- declare function ShotBreakdownView({ blocks, isLoading, shots, selectionMenu, handleMouseUp, addShot, updateShot, clearSelection, menuRef, cameras, sceneType, initializeProduction, }: {
210
+ declare function ShotBreakdownView({ blocks, isLoading, shots, selectionMenu, handleMouseUp, addShot, updateShot, clearSelection, menuRef, cameras, sceneType, initializeProduction, handleAISummarize, isSummarizing, aiSummarized, }: {
211
211
  blocks: Block[];
212
212
  isLoading: boolean;
213
213
  shots: Shot[];
@@ -224,6 +224,9 @@ declare function ShotBreakdownView({ blocks, isLoading, shots, selectionMenu, ha
224
224
  menuRef: React__default.RefObject<HTMLDivElement | null>;
225
225
  cameras: Camera[];
226
226
  initializeProduction: (count: number, type: string) => any;
227
+ handleAISummarize: () => void;
228
+ isSummarizing: boolean;
229
+ aiSummarized?: boolean;
227
230
  }): react_jsx_runtime.JSX.Element;
228
231
 
229
232
  interface UseShotBreakdownOptions {
@@ -235,7 +238,7 @@ interface UseShotBreakdownOptions {
235
238
  onShotRemoved?: (shotId: string) => any;
236
239
  onShotUpdated?: (shotId: string, detail: Shot) => any;
237
240
  onProductionInitialized?: (cameras: Camera[], type: string) => any;
238
- preLoadedShots?: Shot[];
241
+ preloadedShots?: Shot[];
239
242
  preloadedCameras?: Camera[];
240
243
  preloadedSceneType?: string;
241
244
  }
@@ -256,6 +259,8 @@ declare function useShotBreakdownScene(options: UseShotBreakdownOptions): {
256
259
  addShot: (shotDetails: Omit<Shot, "id" | "shot_number" | "parts">) => any;
257
260
  updateShot: (shotId: string | number, updatedDetails: Omit<Shot, "id" | "shot_number" | "parts">) => Promise<any>;
258
261
  clearSelection: () => void;
262
+ handleAISummarize: () => Promise<void>;
263
+ isSummarizing: boolean;
259
264
  menuRef: React$1.RefObject<HTMLDivElement | null>;
260
265
  };
261
266
 
@@ -283,7 +288,7 @@ declare const vfx_types: {
283
288
  name: string;
284
289
  }[];
285
290
  declare const fps_options: {
286
- value: string;
291
+ value: number;
287
292
  label: string;
288
293
  }[];
289
294
  declare const scene_types: {
package/dist/index.d.ts CHANGED
@@ -186,7 +186,7 @@ interface Shot {
186
186
  lens_feel: string;
187
187
  aperture: string;
188
188
  depth_of_field: string;
189
- fps?: string;
189
+ fps?: number;
190
190
  subject: string;
191
191
  action_blocking: string;
192
192
  emotional_purpose: string;
@@ -207,7 +207,7 @@ interface ShotBreakdown {
207
207
  shots: Shot[];
208
208
  }
209
209
 
210
- declare function ShotBreakdownView({ blocks, isLoading, shots, selectionMenu, handleMouseUp, addShot, updateShot, clearSelection, menuRef, cameras, sceneType, initializeProduction, }: {
210
+ declare function ShotBreakdownView({ blocks, isLoading, shots, selectionMenu, handleMouseUp, addShot, updateShot, clearSelection, menuRef, cameras, sceneType, initializeProduction, handleAISummarize, isSummarizing, aiSummarized, }: {
211
211
  blocks: Block[];
212
212
  isLoading: boolean;
213
213
  shots: Shot[];
@@ -224,6 +224,9 @@ declare function ShotBreakdownView({ blocks, isLoading, shots, selectionMenu, ha
224
224
  menuRef: React__default.RefObject<HTMLDivElement | null>;
225
225
  cameras: Camera[];
226
226
  initializeProduction: (count: number, type: string) => any;
227
+ handleAISummarize: () => void;
228
+ isSummarizing: boolean;
229
+ aiSummarized?: boolean;
227
230
  }): react_jsx_runtime.JSX.Element;
228
231
 
229
232
  interface UseShotBreakdownOptions {
@@ -235,7 +238,7 @@ interface UseShotBreakdownOptions {
235
238
  onShotRemoved?: (shotId: string) => any;
236
239
  onShotUpdated?: (shotId: string, detail: Shot) => any;
237
240
  onProductionInitialized?: (cameras: Camera[], type: string) => any;
238
- preLoadedShots?: Shot[];
241
+ preloadedShots?: Shot[];
239
242
  preloadedCameras?: Camera[];
240
243
  preloadedSceneType?: string;
241
244
  }
@@ -256,6 +259,8 @@ declare function useShotBreakdownScene(options: UseShotBreakdownOptions): {
256
259
  addShot: (shotDetails: Omit<Shot, "id" | "shot_number" | "parts">) => any;
257
260
  updateShot: (shotId: string | number, updatedDetails: Omit<Shot, "id" | "shot_number" | "parts">) => Promise<any>;
258
261
  clearSelection: () => void;
262
+ handleAISummarize: () => Promise<void>;
263
+ isSummarizing: boolean;
259
264
  menuRef: React$1.RefObject<HTMLDivElement | null>;
260
265
  };
261
266
 
@@ -283,7 +288,7 @@ declare const vfx_types: {
283
288
  name: string;
284
289
  }[];
285
290
  declare const fps_options: {
286
- value: string;
291
+ value: number;
287
292
  label: string;
288
293
  }[];
289
294
  declare const scene_types: {
package/dist/index.js CHANGED
@@ -1563,7 +1563,12 @@ function useScreenplayEditor(options) {
1563
1563
  }
1564
1564
  }
1565
1565
  const filename = ((_a = url.split("/").pop()) == null ? void 0 : _a.replace(/\.sbx$/i, "")) || "Imported from URL";
1566
- handleScriptImport(filename, scriptContent, preParsedBlocks, isInitialLoad);
1566
+ handleScriptImport(
1567
+ filename,
1568
+ scriptContent,
1569
+ preParsedBlocks,
1570
+ isInitialLoad
1571
+ );
1567
1572
  } catch (error) {
1568
1573
  console.error(
1569
1574
  "[useScreenplayEditor] Error loading script from URL:",
@@ -2797,9 +2802,7 @@ function useScriptBreakdownScene(options) {
2797
2802
  await ((_d = options.onTagUpdated) == null ? void 0 : _d.call(options, id, categoryId || null, details));
2798
2803
  } catch (error2) {
2799
2804
  console.error("Failed to update tag:", error2);
2800
- setTags(
2801
- (prev) => prev.map((t) => t.id === id ? tagToUpdate : t)
2802
- );
2805
+ setTags((prev) => prev.map((t) => t.id === id ? tagToUpdate : t));
2803
2806
  }
2804
2807
  };
2805
2808
  return {
@@ -3225,17 +3228,17 @@ var vfx_types = [
3225
3228
  { name: "CG Lighting / Light Wrap" }
3226
3229
  ];
3227
3230
  var fps_options = [
3228
- { value: "23.98", label: "23.98 fps" },
3229
- { value: "24", label: "24 fps" },
3230
- { value: "25", label: "25 fps" },
3231
- { value: "29.97", label: "29.97 fps" },
3232
- { value: "30", label: "30 fps" },
3233
- { value: "48", label: "48 fps" },
3234
- { value: "50", label: "50 fps" },
3235
- { value: "59.94", label: "59.94 fps" },
3236
- { value: "60", label: "60 fps" },
3237
- { value: "120", label: "120 fps (Slow Motion)" },
3238
- { value: "240", label: "240 fps (High Speed)" }
3231
+ { value: 23.98, label: "23.98 fps" },
3232
+ { value: 24, label: "24 fps" },
3233
+ { value: 25, label: "25 fps" },
3234
+ { value: 29.97, label: "29.97 fps" },
3235
+ { value: 30, label: "30 fps" },
3236
+ { value: 48, label: "48 fps" },
3237
+ { value: 50, label: "50 fps" },
3238
+ { value: 59.94, label: "59.94 fps" },
3239
+ { value: 60, label: "60 fps" },
3240
+ { value: 120, label: "120 fps (Slow Motion)" },
3241
+ { value: 240, label: "240 fps (High Speed)" }
3239
3242
  ];
3240
3243
  var scene_types = [
3241
3244
  { name: "Action / Adventure" },
@@ -3321,7 +3324,7 @@ var AddShotForm = ({
3321
3324
  lens_mm: "",
3322
3325
  lens_feel: "",
3323
3326
  aperture: "T2.8",
3324
- fps: "24",
3327
+ fps: 24,
3325
3328
  depth_of_field: "",
3326
3329
  subject: "",
3327
3330
  action_blocking: "",
@@ -4101,7 +4104,10 @@ function ShotBreakdownView({
4101
4104
  menuRef,
4102
4105
  cameras,
4103
4106
  sceneType,
4104
- initializeProduction
4107
+ initializeProduction,
4108
+ handleAISummarize,
4109
+ isSummarizing,
4110
+ aiSummarized = false
4105
4111
  }) {
4106
4112
  var _a, _b, _c;
4107
4113
  const COURIER_STACK = "'Courier Prime', 'Courier', monospace";
@@ -4255,115 +4261,132 @@ function ShotBreakdownView({
4255
4261
  "div",
4256
4262
  {
4257
4263
  className: `fixed xl:absolute top-0 right-0 z-50 h-full w-72 transform transition-transform duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] xl:translate-x-0 ${isSidebarOpen ? "translate-x-0 shadow-[0_0_40px_rgba(0,0,0,0.1)]" : "translate-x-full"}`,
4258
- children: /* @__PURE__ */ jsx("div", { className: "sticky top-0 flex h-[100dvh] max-h-screen w-full flex-col border-l border-l-[#eefafd] bg-white p-3 py-5", children: /* @__PURE__ */ jsxs("div", { className: "relative flex flex-col gap-3 py-5 my-5 flex-1 overflow-hidden", children: [
4259
- /* @__PURE__ */ jsxs("div", { className: "relative flex items-center justify-between mb-2 shrink-0 px-1", children: [
4260
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
4261
- /* @__PURE__ */ jsx("div", { className: "flex h-7 w-7 items-center justify-center rounded-md border border-slate-200 bg-slate-50 shadow-sm", children: /* @__PURE__ */ jsx(Video, { className: "h-3.5 w-3.5 text-slate-700" }) }),
4262
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
4263
- /* @__PURE__ */ jsx("h3", { className: "text-[11px] font-bold uppercase tracking-widest text-slate-800", children: "Shots" }),
4264
- sceneType && /* @__PURE__ */ jsx("span", { className: "text-[9px] font-bold text-[#15607b] uppercase tracking-tighter opacity-80 mt-0.5", children: sceneType })
4264
+ children: /* @__PURE__ */ jsxs("div", { className: "sticky top-0 flex h-[100dvh] max-h-screen w-full flex-col border-l border-l-[#eefafd] bg-white p-3 py-5", children: [
4265
+ !aiSummarized && /* @__PURE__ */ jsx(
4266
+ summarize_button_default,
4267
+ {
4268
+ onSummarize: handleAISummarize,
4269
+ isSummarizing
4270
+ }
4271
+ ),
4272
+ /* @__PURE__ */ jsxs("div", { className: "relative flex flex-col gap-3 py-5 my-5 border-t border-t-[#eefafd] flex-1 overflow-hidden", children: [
4273
+ /* @__PURE__ */ jsxs("div", { className: "relative flex items-center justify-between mb-6 shrink-0 px-1", children: [
4274
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
4275
+ /* @__PURE__ */ jsx("div", { className: "relative flex h-8 w-8 items-center justify-center rounded-[10px] border border-[#15607b]/20 bg-white shadow-sm", children: /* @__PURE__ */ jsx(Video, { className: "h-4 w-4 text-[#15607b]" }) }),
4276
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
4277
+ /* @__PURE__ */ jsx("h3", { className: "text-[12px] font-semibold uppercase tracking-[0.28em] text-[#134a61]", children: "Shots" }),
4278
+ sceneType && /* @__PURE__ */ jsx("span", { className: "text-[9px] font-bold text-[#15607b] uppercase tracking-tighter opacity-80 mt-0.5", children: sceneType })
4279
+ ] })
4280
+ ] }),
4281
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
4282
+ cameras.length === 0 && /* @__PURE__ */ jsx(
4283
+ "button",
4284
+ {
4285
+ onClick: () => setIsInitModalOpen(true),
4286
+ className: "flex h-7 w-7 items-center justify-center rounded-md border border-slate-200 bg-white shadow-sm transition-colors hover:bg-slate-50",
4287
+ title: "Project Setup",
4288
+ children: /* @__PURE__ */ jsx(Settings2, { className: "h-3.5 w-3.5 text-slate-600" })
4289
+ }
4290
+ ),
4291
+ shots.length > 0 && /* @__PURE__ */ jsx("span", { className: "rounded-md border border-slate-200 bg-white px-2 py-0.5 text-[10px] font-semibold text-slate-600 shadow-sm", children: shots.length })
4265
4292
  ] })
4266
4293
  ] }),
4267
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
4268
- cameras.length === 0 && /* @__PURE__ */ jsx(
4269
- "button",
4294
+ shots.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-10 px-4 text-center", children: [
4295
+ /* @__PURE__ */ jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-slate-50 border border-slate-100 mb-3", children: /* @__PURE__ */ jsx(Video, { className: "h-4 w-4 text-slate-300" }) }),
4296
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-semibold text-slate-700", children: "No shots created" }),
4297
+ /* @__PURE__ */ jsx("p", { className: "text-[11px] text-slate-500 mt-1 max-w-[160px] leading-relaxed", children: "Highlight text in the screenplay to add your first shot." })
4298
+ ] }) : /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2.5 overflow-y-auto overflow-x-hidden pb-4 pr-2 custom-scrollbar", children: shots.map((shot) => {
4299
+ const isActive = toggledShotId === shot.id;
4300
+ return /* @__PURE__ */ jsxs(
4301
+ "div",
4270
4302
  {
4271
- onClick: () => setIsInitModalOpen(true),
4272
- className: "flex h-7 w-7 items-center justify-center rounded-md border border-slate-200 bg-white shadow-sm transition-colors hover:bg-slate-50",
4273
- title: "Project Setup",
4274
- children: /* @__PURE__ */ jsx(Settings2, { className: "h-3.5 w-3.5 text-slate-600" })
4275
- }
4276
- ),
4277
- shots.length > 0 && /* @__PURE__ */ jsx("span", { className: "rounded-md border border-slate-200 bg-white px-2 py-0.5 text-[10px] font-semibold text-slate-600 shadow-sm", children: shots.length })
4278
- ] })
4279
- ] }),
4280
- cameras.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5 px-1 mb-6 mt-2", children: /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 text-[9px] font-bold uppercase tracking-widest bg-slate-100 text-slate-500 px-2 py-1 rounded-md border border-slate-200/50", children: [
4281
- cameras.length,
4282
- " Multi-Cam Setup"
4283
- ] }) }),
4284
- shots.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-10 px-4 text-center", children: [
4285
- /* @__PURE__ */ jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-slate-50 border border-slate-100 mb-3", children: /* @__PURE__ */ jsx(Video, { className: "h-4 w-4 text-slate-300" }) }),
4286
- /* @__PURE__ */ jsx("p", { className: "text-xs font-semibold text-slate-700", children: "No shots created" }),
4287
- /* @__PURE__ */ jsx("p", { className: "text-[11px] text-slate-500 mt-1 max-w-[160px] leading-relaxed", children: "Highlight text in the screenplay to add your first shot." })
4288
- ] }) : /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2.5 overflow-y-auto overflow-x-hidden pb-4 pr-2 custom-scrollbar", children: shots.map((shot) => {
4289
- const isActive = toggledShotId === shot.id;
4290
- return /* @__PURE__ */ jsxs(
4291
- "div",
4292
- {
4293
- onClick: () => {
4294
- var _a2;
4295
- return setToggledShotId(isActive ? null : (_a2 = shot.id) != null ? _a2 : null);
4296
- },
4297
- className: `group relative flex flex-col cursor-pointer gap-2 overflow-hidden rounded-lg border px-3.5 py-3 transition-colors duration-200 ${isActive ? "border-slate-800 bg-slate-50 shadow-[0_2px_8px_rgba(0,0,0,0.04)]" : "border-slate-200 bg-white hover:border-slate-300 hover:bg-slate-50/50"}`,
4298
- children: [
4299
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
4300
- /* @__PURE__ */ jsxs(
4301
- "span",
4302
- {
4303
- className: `text-xs font-semibold ${isActive ? "text-slate-900" : "text-slate-700"}`,
4304
- children: [
4305
- "Shot ",
4306
- shot.shot_number
4307
- ]
4308
- }
4309
- ),
4303
+ onClick: () => {
4304
+ var _a2;
4305
+ return setToggledShotId(isActive ? null : (_a2 = shot.id) != null ? _a2 : null);
4306
+ },
4307
+ className: `group relative cursor-pointer rounded-xl border transition-all duration-300 overflow-hidden ${isActive ? "border-slate-900 bg-slate-50 shadow-[0_6px_20px_rgba(0,0,0,0.06)]" : "border-slate-200 bg-white hover:border-slate-300 hover:shadow-[0_4px_14px_rgba(0,0,0,0.05)]"}`,
4308
+ children: [
4310
4309
  /* @__PURE__ */ jsx(
4311
- "span",
4310
+ "div",
4312
4311
  {
4313
- className: `rounded-md px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider ${isActive ? "bg-slate-200 text-slate-800" : "bg-slate-100 text-slate-500"}`,
4314
- children: shot.shot_type
4312
+ className: `absolute left-0 top-0 h-full w-[3px] transition-all duration-300
4313
+ ${isActive ? "bg-slate-900" : "bg-transparent group-hover:bg-slate-300"}`
4315
4314
  }
4316
- )
4317
- ] }),
4318
- /* @__PURE__ */ jsxs("span", { className: "text-[11px] font-medium text-slate-500 truncate", children: [
4319
- shot.camera_name,
4320
- " \u2022 ",
4321
- shot.lens_mm
4322
- ] }),
4323
- /* @__PURE__ */ jsx(
4324
- "div",
4325
- {
4326
- className: `grid grid-rows-[0fr] transition-all duration-300 ease-in-out ${isActive ? "grid-rows-[1fr] mt-0.5" : ""}`,
4327
- children: /* @__PURE__ */ jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 pt-2 border-t border-slate-200/60 mt-1", children: [
4328
- /* @__PURE__ */ jsxs(
4329
- "button",
4330
- {
4331
- onClick: (e) => {
4332
- var _a2;
4333
- e.stopPropagation();
4334
- setViewingShotId((_a2 = shot.id) != null ? _a2 : null);
4335
- },
4336
- className: "flex flex-1 items-center justify-center gap-1.5 rounded-md border border-slate-200 bg-white py-1.5 text-[10px] font-bold text-slate-700 shadow-sm transition-colors hover:bg-slate-50 hover:text-slate-900",
4337
- children: [
4338
- /* @__PURE__ */ jsx(Eye, { className: "h-3 w-3" }),
4339
- "View"
4340
- ]
4341
- }
4342
- ),
4343
- /* @__PURE__ */ jsxs(
4344
- "button",
4315
+ ),
4316
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 px-4 py-3.5", children: [
4317
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between", children: [
4318
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
4319
+ /* @__PURE__ */ jsxs(
4320
+ "span",
4321
+ {
4322
+ className: `text-[11px] font-semibold tracking-wide uppercase
4323
+ ${isActive ? "text-slate-900" : "text-slate-500"}`,
4324
+ children: [
4325
+ "Shot ",
4326
+ shot.shot_number
4327
+ ]
4328
+ }
4329
+ ),
4330
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-slate-800 leading-tight", children: shot.camera_name || "Unknown Camera" })
4331
+ ] }),
4332
+ /* @__PURE__ */ jsx(
4333
+ "span",
4345
4334
  {
4346
- onClick: (e) => {
4347
- var _a2;
4348
- e.stopPropagation();
4349
- setUpdatingShotId((_a2 = shot.id) != null ? _a2 : null);
4350
- },
4351
- className: "flex flex-1 items-center justify-center gap-1.5 rounded-md bg-slate-900 py-1.5 text-[10px] font-bold text-white shadow-sm transition-colors hover:bg-slate-800",
4352
- children: [
4353
- /* @__PURE__ */ jsx(Pencil, { className: "h-3 w-3" }),
4354
- "Edit"
4355
- ]
4335
+ className: `rounded-md px-2 py-0.5 text-[9px] font-bold uppercase tracking-wider ${isActive ? "bg-slate-900 text-white" : "bg-slate-100 text-slate-500 group-hover:bg-slate-200"}`,
4336
+ children: shot.shot_type
4356
4337
  }
4357
4338
  )
4358
- ] }) })
4359
- }
4360
- )
4361
- ]
4362
- },
4363
- shot.id
4364
- );
4365
- }) })
4366
- ] }) })
4339
+ ] }),
4340
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-[11px] text-slate-500", children: [
4341
+ /* @__PURE__ */ jsx("span", { children: shot.lens_mm ? `${shot.lens_mm}mm Lens` : "\u2014" }),
4342
+ /* @__PURE__ */ jsx("span", { className: "opacity-60", children: "Tap to expand" })
4343
+ ] }),
4344
+ /* @__PURE__ */ jsx(
4345
+ "div",
4346
+ {
4347
+ className: `grid transition-all duration-300 ease-in-out ${isActive ? "grid-rows-[2fr] mt-2" : "grid-rows-[0fr]"}`,
4348
+ children: /* @__PURE__ */ jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsxs("div", { className: "py-3 pb-4 border-t border-slate-200/70 flex gap-2", children: [
4349
+ /* @__PURE__ */ jsxs(
4350
+ "button",
4351
+ {
4352
+ onClick: (e) => {
4353
+ var _a2;
4354
+ e.stopPropagation();
4355
+ setViewingShotId((_a2 = shot.id) != null ? _a2 : null);
4356
+ },
4357
+ className: "flex flex-1 items-center justify-center gap-1.5 rounded-md border border-slate-200 bg-white py-2 text-[11px] font-semibold text-slate-700 transition-all hover:bg-slate-50 hover:text-slate-900",
4358
+ children: [
4359
+ /* @__PURE__ */ jsx(Eye, { className: "h-3.5 w-3.5" }),
4360
+ "View"
4361
+ ]
4362
+ }
4363
+ ),
4364
+ /* @__PURE__ */ jsxs(
4365
+ "button",
4366
+ {
4367
+ onClick: (e) => {
4368
+ var _a2;
4369
+ e.stopPropagation();
4370
+ setUpdatingShotId((_a2 = shot.id) != null ? _a2 : null);
4371
+ },
4372
+ className: "flex flex-1 items-center justify-center gap-1.5 rounded-md bg-slate-900 py-2 text-[11px] font-semibold text-white transition-all hover:bg-slate-800",
4373
+ children: [
4374
+ /* @__PURE__ */ jsx(Pencil, { className: "h-3.5 w-3.5" }),
4375
+ "Edit"
4376
+ ]
4377
+ }
4378
+ )
4379
+ ] }) })
4380
+ }
4381
+ )
4382
+ ] })
4383
+ ]
4384
+ },
4385
+ shot.id
4386
+ );
4387
+ }) })
4388
+ ] })
4389
+ ] })
4367
4390
  }
4368
4391
  ),
4369
4392
  selectionMenu && /* @__PURE__ */ jsx(
@@ -4446,7 +4469,7 @@ function ShotBreakdownView({
4446
4469
  );
4447
4470
  }
4448
4471
  function useShotBreakdownScene(options) {
4449
- const [shots, setShots] = useState(options.preLoadedShots || []);
4472
+ const [shots, setShots] = useState(options.preloadedShots || []);
4450
4473
  const [cameras, setCameras] = useState(
4451
4474
  options.preloadedCameras || []
4452
4475
  );
@@ -4455,9 +4478,38 @@ function useShotBreakdownScene(options) {
4455
4478
  );
4456
4479
  const [scene, setScene] = useState(null);
4457
4480
  const [isLoading, setIsLoading] = useState(true);
4481
+ const [isSummarizing, setIsSummarizing] = useState(false);
4458
4482
  const [error, setError] = useState(false);
4459
4483
  const [selectionMenu, setSelectionMenu] = useState(null);
4460
4484
  const menuRef = useRef(null);
4485
+ useEffect(() => {
4486
+ if (options.preloadedShots && options.preloadedShots.length > 0) {
4487
+ setShots((prev) => {
4488
+ if (JSON.stringify(prev) === JSON.stringify(options.preloadedShots)) {
4489
+ return prev;
4490
+ }
4491
+ return options.preloadedShots || [];
4492
+ });
4493
+ }
4494
+ }, [options.preloadedShots]);
4495
+ useEffect(() => {
4496
+ if (options.preloadedCameras && options.preloadedCameras.length > 0) {
4497
+ setCameras((prev) => {
4498
+ if (JSON.stringify(prev) === JSON.stringify(options.preloadedCameras)) {
4499
+ return prev;
4500
+ }
4501
+ return options.preloadedCameras || [];
4502
+ });
4503
+ }
4504
+ }, [options.preloadedCameras]);
4505
+ useEffect(() => {
4506
+ if (options.preloadedSceneType) {
4507
+ setSceneType((prev) => {
4508
+ if (prev === options.preloadedSceneType) return prev;
4509
+ return options.preloadedSceneType || "";
4510
+ });
4511
+ }
4512
+ }, [options.preloadedSceneType]);
4461
4513
  useEffect(() => {
4462
4514
  setIsLoading(true);
4463
4515
  const fetchScene = async () => {
@@ -4643,6 +4695,66 @@ function useShotBreakdownScene(options) {
4643
4695
  return result;
4644
4696
  }
4645
4697
  };
4698
+ const handleAISummarize = async () => {
4699
+ var _a;
4700
+ if (!scene || !scene.content || !options.onAISummarize) return;
4701
+ setIsSummarizing(true);
4702
+ try {
4703
+ const res = await ((_a = options.onAISummarize) == null ? void 0 : _a.call(options, scene.content));
4704
+ if (res && res.ok) {
4705
+ const data = await res.json();
4706
+ setIsSummarizing(false);
4707
+ console.log(data);
4708
+ const newShots = [];
4709
+ data.data.forEach((aiShot) => {
4710
+ var _a2;
4711
+ const newShot = {
4712
+ id: aiShot.id || uuid(),
4713
+ shot_number: (shots.length || 0) + newShots.length + 1,
4714
+ priority: aiShot.priority || "Essential",
4715
+ shot_type: aiShot.shot_type || "Medium Shot (MS)",
4716
+ framing: aiShot.framing || "Eye Level",
4717
+ camera_angle: aiShot.camera_angle || "Eye Level",
4718
+ camera_movement: aiShot.camera_movement || "Static (Locked-Off)",
4719
+ camera_support: aiShot.camera_support || "Tripod",
4720
+ lens_mm: aiShot.lens_mm || "35",
4721
+ lens_feel: aiShot.lens_feel || "Standard",
4722
+ aperture: aiShot.aperture || "T2.8",
4723
+ depth_of_field: aiShot.depth_of_field || "Deep",
4724
+ subject: aiShot.subject || "",
4725
+ action_blocking: aiShot.action_blocking || "",
4726
+ emotional_purpose: aiShot.emotional_purpose || "",
4727
+ lighting: aiShot.lighting || "",
4728
+ sound: aiShot.sound || "",
4729
+ duration_seconds: aiShot.duration_seconds || 5,
4730
+ edit_purpose: aiShot.edit_purpose || "",
4731
+ reason: aiShot.reason || "",
4732
+ vfx: aiShot.vfx || "None",
4733
+ camera_name: aiShot.camera_name || ((_a2 = cameras[0]) == null ? void 0 : _a2.name) || "Camera A",
4734
+ fps: aiShot.fps || 24,
4735
+ parts: aiShot.parts.map((part) => ({
4736
+ block_id: part.block_id.startsWith("par") ? part.block_id.substring(3) : part.block_id || uuid(),
4737
+ start_index: part.start_index,
4738
+ end_index: part.end_index,
4739
+ text: part.text
4740
+ })) || []
4741
+ };
4742
+ newShots.push(newShot);
4743
+ });
4744
+ if (newShots.length > 0) {
4745
+ setShots((prev) => [...prev, ...newShots]);
4746
+ if (options.onShotsBulkAdded) {
4747
+ await options.onShotsBulkAdded(newShots);
4748
+ }
4749
+ }
4750
+ } else {
4751
+ setIsSummarizing(false);
4752
+ }
4753
+ } catch (error2) {
4754
+ setIsSummarizing(false);
4755
+ console.error("Error in AI summarization:", error2);
4756
+ }
4757
+ };
4646
4758
  return {
4647
4759
  blocks,
4648
4760
  isLoading,
@@ -4656,6 +4768,8 @@ function useShotBreakdownScene(options) {
4656
4768
  addShot,
4657
4769
  updateShot,
4658
4770
  clearSelection,
4771
+ handleAISummarize,
4772
+ isSummarizing,
4659
4773
  menuRef
4660
4774
  };
4661
4775
  }