PageSourceSearch

https://beatbandit.ai/assets/ShotListWriterStage-BfugJkwc.js

js beatbandit.ai collected 2026-10-05 11:51:54 UTC 40,323 bytes, 2 lines download raw bytes

1import{r,j as e,l as $e,y as _s,ao as Cs,d as js,T as _,B as F,f as E,R as g,n as ws}from"./index-CzOd9Km7.js";import{c as ks,m as Ls,S as Ts}from"./ProjectView-Mi3StT_6.js";import{s as ae}from"./shotApi-DuiNJ0uk.js";import{u as Rs}from"./useOperationCost-DcX1tnSV.js";import{g as de}from"./axiosConfig-BS0LIV0L.js";import"./projectSchemas-h1QnwtOV.js";import"./screenplaySchemas-D4JI8Qiv.js";import"./supabaseAuthClient-D4COccm1.js";import{r as Bt}from"./videoTimelinePreferences-CACd4I44.js";import{u as Is}from"./useQuery-BcbK_yvX.js";import{u as Ms}from"./useShotList-Dl3VNezl.js";import{r as Gt}from"./weaveApi-BNjBXpjA.js";import{b as lt,a as Ps,c as qt}from"./shotListTaskCenter-BpPEtr1H.js";import{c as Os}from"./taskCenterStorage-CJYyvdpT.js";import{R as Bs,a as At,b as ct}from"./ReadinessChecklist-D8JoLVvO.js";import{I as As}from"./IconButton-DX7NfjoN.js";import{G as ee}from"./Grid-NNIo4zT1.js";import{C as Q}from"./dividerClasses-CE6pxdyz.js";import{d as $t}from"./AccountBalanceWallet-ogIlKerV.js";import{r as $s}from"./createSvgIcon-DaEeqn1R.js";import{D as Ee,a as Fe,b as ze,c as Ne,L as Es}from"./TrendingUp-DOlPqcSv.js";import{A as ne}from"./Alert-BXc9IPcV.js";import{W as Fs}from"./WizardResultDialogShell-vrBwouF1.js";import{L as Jt}from"./ListItem-B456oJov.js";import{L as zs}from"./Add-DR3ny3xK.js";import{C as dt}from"./Checkbox-CDjSoqnY.js";import{S as le}from"./Stack-E99Gdh2J.js";import{P as ge}from"./Paper-2iw6XA5a.js";import{F as Me,I as Pe,S as Oe,T as Ns}from"./TextField-BLDfXARA.js";import{M as xe}from"./MenuItem-CKC7Jjka.js";import{D as Et}from"./Divider-UFPhkgyE.js";import{F as Ft}from"./FormControlLabel-Cvt0lc2T.js";import{C as Ws}from"./CircularProgress-CFKeHsf1.js";import{L as zt}from"./Menu-BAMQbaXI.js";import{S as Ds}from"./Snackbar-zJwnOmcl.js";import"./useMutation-CJKToZ6s.js";import"./useProjects-CIew3vEQ.js";import"./useInfiniteQuery-DMg-BX9J.js";import"./useTemplate-ViNE3wSO.js";import"./useBillingPreference-D9W5TnwM.js";import"./useSupabaseAuth-DG28FngJ.js";import"./SupabaseProvider-CTgOxySk.js";import"./authRedirect-DCYLoor1.js";import"./billingApi-B525x-Ud.js";import"./Avatar-C-SXWBlB.js";import"./Person-Bgotsgvw.js";import"./Tabs-Ba5iDgru.js";import"./ownerWindow-D5LHhVun.js";import"./Warning-Ps4lknT4.js";import"./Restore-ruzW0M8I.js";import"./usePreviousProps-D6D_fzw_.js";import"./Popper-t1n9sSlv.js";import"./designTokens-CHJCN-yJ.js";import"./ExpandMore-5fy3CFZO.js";import"./Edit-hGaSq1bW.js";import"./Card-BXrAfFWw.js";import"./Collapse-Bnk0IQSm.js";import"./ButtonGroup-CVCxmEpG.js";import"./useMediaQuery-BbaHISUJ.js";import"./getThemeProps-whaKXyLK.js";import"./collaborationApi-Bg8o2r1s.js";import"./chunkPrefetch-Db-BfmQX.js";import"./Toolbar-Cld6iuHK.js";import"./CheckCircle-D4YsMZEr.js";import"./requirePropFactory-CXHKSpYe.js";import"./useControlled-C1WEhlQX.js";import"./Error--n9aLARG.js";import"./WarningAmber-CiMpmQi5.js";import"./InfoOutlined-D-D5tVgC.js";import"./SwitchBase-B_U2OR8-.js";import"./styled-D002SLmF.js";import"./useThemeProps-Dhrs3fnV.js";function Gs(n){const[a,h]=r.useState(null),u=r.useRef(null);r.useEffect(()=>()=>{var l;(l=u.current)==null||l.reject(new DOMException("Generation cancelled.","AbortError"))},[]);const f=r.useCallback((l,I)=>new Promise((p,d)=>{if(u.current){d(new Error("A shot-list quote is already open."));return}const x={id:crypto.randomUUID(),request:l,launch:I,resolve:p,reject:d,quoteRequest:{projectName:n,parameters:{approach_id:l.approachId,custom_prompt:l.customPrompt,parent_scene_code:l.parentSceneCode,shot_mode:l.shotMode,shot_split_mode:l.shotSplitMode,also_create_compact_video_prompt:l.alsoCreateCompactVideoPrompt??!1,shot_field_preset:l.shotFieldPreset??"standard_cinematic",requested_shot_fields:l.requestedShotFields??[],auto_manage_timeline:l.autoManageTimeline??!0,two_pass:!0}}};u.current=x,h(x)}),[n]),L=r.useCallback(l=>ae.quoteShotList(l.projectName,l.parameters),[]),k=a&&e.jsx(ks,{title:`Generate shots: ${a.request.scopeLabel||a.request.parentSceneCode}`,request:a.quoteRequest,getQuote:L,onConfirm:async l=>{a.result=await a.launch({...a.request,billing:l})},onClose:()=>{u.current=null,h(null),a.result?a.resolve(a.result):a.reject(new DOMException("Generation cancelled.","AbortError"))}},a.id);return{start:f,dialog:k}}function qs({projectName:n,stageId:a,stageLabel:h,onError:u}){const[{upsertTaskCenterTask:f}]=r.useState(Os),[L,k]=r.useState(()=>new Set),l=r.useCallback((p,d)=>{k(x=>{const R=new Set(x);return d?R.add(p):R.delete(p),R})},[]),I=r.useCallback(async p=>{if(!n)throw new Error("Project name unavailable for shot list generation.");const d=p.parentSceneCode&&p.parentSceneCode.trim()||"full";l(d,!0);try{const x=await ae.createShotListJob(n,p.billing,p.approachId,p.customPrompt,d,p.shotMode,p.shotSplitMode,p.alsoCreateCompactVideoPrompt??!1,p.shotFieldPreset??"standard_cinematic",p.requestedShotFields??[],p.autoManageTimeline??!0),R=x.id,z={jobId:R,projectName:n,stageId:a,stageLabel:h,scopeCode:d,scopeLabel:p.scopeLabel};if(x.status==="completed")return f(lt({...z,status:"ready",statusLabel:"Ready to review",action:Ps(a,d)})),l(d,!1),x;if(x.status==="failed"||x.status==="cancelled")return f(lt({...z,status:"failed",statusLabel:x.status==="cancelled"?"Cancelled":"Failed",errorMessage:x.error_message||"Shot-list generation failed."})),l(d,!1),x;const m=Gt({async:!0,job_id:R},{projectName:n,finalize:async()=>ae.getShotListJob(n,R),task:qt(z)});return l(d,!1),m.catch(b=>{const S=de(b)||"Shot-list generation failed.";!!(b!=null&&b.__taskCenterHandled)||f(lt({...z,status:"failed",statusLabel:"Failed",errorMessage:S}
1)),u==null||u(d,S),$e.warn("Background shot-list job failed",{parentJobId:R,scopeCode:d,error:b})}),x}catch(x){throw l(d,!1),x}},[u,n,l,a,h,f]);return{launchingScopeCodes:L,startShotListJobInBackground:I}}const Js=[{id:"pass1_planning",label:"Plan timing and recurring elements"},{id:"pass2_generation",label:"Generate final shots"}];function Hs({projectName:n,stageId:a,stageLabel:h,stepDefinitions:u=Js}){const[f,L]=r.useState(null),[k,l]=r.useState(!1),[I,p]=r.useState({}),d=r.useCallback((m,b)=>{p(S=>({...S,[m]:b}))},[]),x=r.useCallback((m,b)=>qt({jobId:m,projectName:n||"",stageId:a,stageLabel:h,scopeCode:b}),[n,a,h]),R=r.useCallback(async m=>{if(!n)throw new Error("Project name unavailable for shot list generation.");l(!0),L(null),p({}),d("pass1_planning","processing"),d("pass2_generation","pending");try{const b=await ae.createShotListJob(n,m.billing,m.approachId,m.customPrompt,m.parentSceneCode,m.shotMode,m.shotSplitMode,m.alsoCreateCompactVideoPrompt??!1,m.shotFieldPreset??"standard_cinematic",m.requestedShotFields??[],m.autoManageTimeline??!0);L(b);const S=b.id;return b.status==="failed"||b.status==="completed"||b.status==="cancelled"?b:await Gt({async:!0,job_id:S},{projectName:n,finalize:async()=>{try{const T=await ae.getShotListJob(n,S);return L(T),T.status==="failed"?d("pass2_generation","failed"):(d("pass1_planning","completed"),d("pass2_generation","completed")),T}catch(T){throw new Error(de(T)||"Failed to finalize shot-list job.")}},onStatus:T=>{const O=Array.isArray(T.steps)?T.steps:[];for(const U of O){if(!U||typeof U!="object")continue;const B=U;typeof B.id!="string"||typeof B.status!="string"||(B.id==="pass1_planning"||B.id==="pass2_generation")&&d(B.id,B.status)}},task:x(S,m.parentSceneCode)})}finally{l(!1)}},[x,n,d]),z=r.useMemo(()=>u.map((b,S)=>({...b,status:S===0?"processing":"pending"})).map(b=>{var U;const S=I[b.id];if(S)return{...b,status:S==="failed"?"processing":S};const T=(U=f==null?void 0:f.steps)==null?void 0:U.find(B=>B.id===b.id),O=T==null?void 0:T.status;return O==="failed"?{...b,status:"processing"}:{...b,status:O||b.status}}),[f,u,I]);return{startShotListJob:R,shotListJob:f,overlayVisible:k,steps:z}}const Qs=({readiness:n,selectedScope:a,scopeLabel:h="Scene",onRefresh:u,isRefreshing:f=!1})=>{var z;const L=Math.min(100,n.total_characters/n.character_threshold*100),k=a?(z=n.scope_characters)==null?void 0:z[a]:void 0,l=k!==void 0?Math.min(100,k/n.character_threshold*100):void 0,I=k!==void 0?k>=n.character_threshold:!1,p=n.total_characters>=n.character_threshold,d=n.ready_to_generate&&(!a||I),x=[],R=[];if(!p){const m=Math.max(0,n.character_threshold-n.total_characters);m>0&&x.push(`Add ${m} more characters of screenplay text to unlock shot generation.`)}if(a&&k!==void 0&&!I){const m=Math.max(0,n.character_threshold-k);m>0&&x.push(`The selected ${h.toLowerCase()} needs ${m} more characters (currently ${k}).`)}if(n.missing_requirements&&n.missing_requirements.length>0)for(const m of n.missing_requirements)x.includes(m)||x.push(m);return n.scenes_with_content<n.scenes_total&&R.push(`Add content to ${n.scenes_total-n.scenes_with_content} more scenes.`),e.jsxs(Bs,{ready:d,overallPercentage:L,title:"Project Readiness",compactMessage:a&&k!==void 0?`${k}/${n.character_threshold} characters in ${h.toLowerCase()}`:`${n.total_characters}/${n.character_threshold} screenplay characters`,actions:u&&e.jsx(As,{onClick:u,size:"small",disabled:f,children:e.jsx(_s,{})}),footer:e.jsxs(e.Fragment,{children:[x.length>0&&e.jsx(At,{title:"Blocking before generation",items:x,tone:"warning"}),R.length>0&&e.jsx(At,{title:"Recommended next",items:R,tone:"info"})]}),children:[e.jsx(ee,{item:!0,xs:12,md:6,children:e.jsx(ct,{title:"Screenplay Characters",filled:n.total_characters,total:n.character_threshold,percentage:L,valueText:`${n.total_characters}/${n.character_threshold}`,status:p?"complete":"missing",extraInfo:n.source&&e.jsx(Q,{label:`Source: ${n.source==="screenplay_document"?"Screenplay editor":"Card fallback"}`,size:"small",variant:"outlined"})})}),e.jsx(ee,{item:!0,xs:12,md:6,children:e.jsx(ct,{title:"Scenes",filled:n.scenes_with_content,total:n.scenes_total,percentage:n.scenes_with_content/Math.max(1,n.scenes_total)*100,valueText:`${n.scenes_with_content}/${n.scenes_total}`,status:"complete",extraInfo:e.jsx(Q,{label:`Meeting threshold: ${n.scenes_meeting_threshold}/${n.scenes_total}`,size:"small",variant:"outlined"})})}),a&&k!==void 0&&e.jsx(ee,{item:!0,xs:12,children:e.jsx(ct,{title:`${h} Selection`,filled:k,total:n.character_threshold,percentage:l??0,valueText:`${k}/${n.character_threshold}`,status:I?"complete":"missing"})})]})};var ut={},Us=Cs;
1Object.defineProperty(ut,"__esModule",{value:!0});var Ht=ut.default=void 0,Ks=Us($s()),Vs=e;Ht=ut.default=(0,Ks.default)((0,Vs.jsx)("path",{d:"M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2M1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.08-.14.12-.31.12-.48 0-.55-.45-1-1-1H5.21l-.94-2zm16 16c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2"}),"ShoppingCart");function Ys({open:n,onClose:a,currentBalance:h,requiredCredits:u,isDynamicPricing:f=!1}){const L=js(),k=()=>{a(),L("/credits")},l=u-h;return e.jsxs(Ee,{open:n,onClose:a,maxWidth:"sm",fullWidth:!0,children:[e.jsxs(Fe,{sx:{textAlign:"center",pb:1},children:[e.jsx($t,{sx:{fontSize:48,color:"warning.main",mb:1}}),e.jsx(_,{variant:"h5",component:"div",children:"Insufficient Credits"})]}),e.jsxs(ze,{sx:{textAlign:"center",pb:2},children:[e.jsx(ne,{severity:"warning",sx:{mb:3},children:"You don't have enough credits to send this message."}),e.jsxs(F,{sx:{mb:3},children:[e.jsxs(_,{variant:"body1",paragraph:!0,children:[e.jsx("strong",{children:"Current balance:"})," ",e.jsx(Q,{icon:e.jsx($t,{}),label:`${h} credits`,color:"default",variant:"outlined",size:"small"})]}),e.jsxs(_,{variant:"body1",paragraph:!0,children:[e.jsx("strong",{children:"Required:"})," ",e.jsx(Q,{label:`${u} credits`,color:"warning",variant:"outlined",size:"small"})]}),e.jsxs(_,{variant:"body1",paragraph:!0,children:[e.jsx("strong",{children:"Need:"})," ",e.jsx(Q,{label:`${l} more credits`,color:"error",variant:"outlined",size:"small"})]})]}),f&&e.jsxs(ne,{severity:"info",sx:{mb:3},children:["💡 ",e.jsx("strong",{children:"Tip:"})," Your message is longer than 5,000 characters, which increases the cost. Try shortening your message to reduce the credit requirement."]}),e.jsx(_,{variant:"body2",color:"text.secondary",paragraph:!0,children:"Purchase more credits to continue using the AI assistant for your screenplay development."}),e.jsx(F,{sx:{mt:2},children:e.jsx(_,{variant:"body2",color:"text.secondary",children:"✨ Credits are used for AI-powered features like chat, suggestions, and exports"})})]}),e.jsxs(Ne,{sx:{justifyContent:"center",gap:1,pb:3},children:[e.jsx(E,{onClick:a,variant:"outlined",children:"Cancel"}),e.jsx(E,{onClick:k,variant:"contained",startIcon:e.jsx(Ht,{}),color:"primary",children:"Purchase Credits"})]})]})}const ce=n=>{if(!n)return{};if(typeof n=="string")try{return JSON.parse(n)}catch{return{}}return n},Nt=n=>{if(!n||typeof n!="object")return;const a=n,h=d=>typeof d=="string"?d.trim():"",u=h(a.scope||a.slugline_scope||a.slug_scope),f=u?u.toUpperCase().replace(/\.$/,""):"",L=h(a.arena||a.location||a.slugline_location),k=L?L.toUpperCase():"",l=h(a.time_of_day||a.time||a.slugline_time),I=l?l.toUpperCase():"",p=[];return f&&p.push(f.endsWith(".")?f:`${f}.`),k&&p.push(k.toUpperCase()),I&&p.push(I),p.length?p.join(" - "):void 0},Xs=["screenplay","Screenplay","content","Content","text","Text","Trailer Script"],Zs=n=>{const a=ce(n);if(!a)return"";for(const h of Xs){const u=a==null?void 0:a[h];if(typeof u=="string"&&u.trim().length>0)return u}return""},en=n=>typeof n!="string"?0:n.replace(/\r/g,"").replace(/\n/g,"").trim().length,D=n=>({value:`length_${n}`,label:`${n} seconds`,description:`Target about ${n} seconds per generated clip. Actual runtime can land shorter or longer depending on pacing, dialogue density. If you find the pacing too slow, use "hidden" mode and use a longer shot length than what you actually need.`}),Wt=[{value:"separate_shots",label:"Separate shots",description:"Treat every shot as a standalone camera setup."},D(5),D(8),D(10),D(12),D(15),D(18),D(21),D(24),D(27),D(30),D(35)],Dt=[{value:"cut",label:"Cut",description:"Use [cut] markers between beats inside each grouped clip - no second-by-second indications."},{value:"timestamp",label:"Timestamp",description:"Use timestamp-based descriptions (00:00–00:02 Wide — …) for each clip."},{value:"cut_with_overlap",label:"Cut with overlap",description:"The last [cut] beat repeats verbatim as the first line of the next clip so shots have a few seconds of redundant action at each seam for better shot-to-shot continuity."},{value:"hidden",label:"Hidden",description:"Describe the clip in plain sequential prose with no timestamps, no [cut] markers, and no explicit camera shot labels, giving freedom for the video model to determine camera cuts and angles."}],tn=[{value:"what_we_see",label:"What we see",description:"Literal visual description of the shot."},{value:"what_happens",label:"What happens",description:"Core action/beat of the shot."},{value:"camera",label:"Camera",description:"Framing and camera movement."},{value:"movement",label:"Movement",description:"Non-camera motion on screen."},{value:"lighting",label:"Lighting",description:"Lighting direction and mood."},{value:"other_sounds",label:"Other sounds",description:"Ambient and sound cues."},{value:"compact_video_prompt",label:"Compact video prompt",description:"Short motion-focused video prompt."}],Be={standard_cinematic:{label:"Standard cinematic",description:"Broad default coverage with the main descriptive shot fields.",fields:["what_we_see","what_happens","camera","movement","lighting","other_sounds"]},seedance_storyboard:{label:"Seedance storyboard",description:"Optimized for storyboard boards and compact motion prompts.",fields:["what_we_see","what_happens","camera","movement","lighting","other_sounds","compact_video_prompt"]},minimal:{label:"Minimal",description:"Only the essential visual and action fields.",fields:["what_we_see","what_happens"]},motion_heavy:{label:"Motion-heavy",description:"Focus on movement, camera, sound, and compact video prompting.",fields:["what_happens","camera","movement","lighting","other_sounds","compact_video_prompt"]}},Z="55.10.10",Ae={fontFamily:"var(--bb-font-mono)",fontSize:"0.76rem",fontWeight:500,letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--bb-gold)"},sn=g.memo(function({code:a,meta:h,isSelected:u,onToggle:f}){const L=g.useCallback(()=>{f(a)},[a,f]),k=g.useCallback(I=>{I.stopPropagation()},[]),l=g.useCallback(()=>{f(a)},[a,f]);return e.jsx(Jt,{disablePadding:!0,divider:!0,children:e.jsxs(zs,{onClick:L,children:[e.jsx(dt,{edge:"start",tabIndex:-1,disableRipple:!0,checked:u,onClick:k,onChange:l}),e.jsxs(F,{sx:{flex:1,pr:2},children:[e.jsx(_,{variant:"subtitle2",children:h.label}),(h.slugline||h.summary)&&e.jsx(_,{variant:"caption",color:"text.secondary",children:h.slugline||h.summary})]}),e.jsxs(le,{spacing:1,alignItems:"flex-end",children:[e.jsx(Q,{size:"small",label:h.meetsThreshold?"Ready":"Needs text",color:h.meetsThreshold?"success":"warning",variant:h.meetsThreshold?"filled":"outlined"}),h.hasShots&&e.jsx(Q,{size:"small",label:`${h.shotCount} shot${h.shotCount===1?"":"s"}`,color:"info",variant:"outlined"})]})]})})});
1function wa({stage:n,project:a,onUpdateProject:h,refreshProject:u,onNavigateToStage:f}){var It,Mt;const L=ws(),l=((n==null?void 0:n.config)??{}).parent_scene_code||"full",[I,p]=r.useState([]),[d,x]=r.useState(""),[R,z]=r.useState(""),[m,b]=r.useState(!1),[S,T]=r.useState(null),[O,U]=r.useState(l),[B,Qt]=r.useState("length_15"),[oe,Ut]=r.useState("hidden"),[te,ht]=r.useState("seedance_storyboard"),[se,mt]=r.useState(Be.seedance_storyboard.fields),[Kt,We]=r.useState(!1),[De,Ge]=r.useState({}),[pt,ft]=r.useState(!1),[Vt,gt]=r.useState(!1),[nn,qe]=r.useState(0),[an,xt]=r.useState(0),[on,bt]=r.useState(null),[re,Je]=r.useState(null),[yt,be]=r.useState(!1),{start:ye,dialog:Yt}=Gs(a.name),Xt=a.mode==="single_scene"?"shot_list_writer_single_scene":"shot_list_writer",{cost:St}=Rs(Xt),[Se,N]=r.useState(null),[Zt,J]=r.useState(!1),[es,ve]=r.useState(!1),[He,Qe]=r.useState(!1),[$,vt]=r.useState(null),[Ue,_e]=r.useState(!1),Ce=g.useRef(""),ue=r.useMemo(()=>se.includes("compact_video_prompt"),[se]),ts=g.useCallback(t=>{ht(t),mt([...Be[t].fields])},[]),ss=g.useCallback((t,s)=>{mt(o=>s?Array.from(new Set([...o,t])):o.length>1?o.filter(v=>v!==t):o),ht("custom")},[]),{tasks:_t}=Ls(a.name),{startShotListJob:Ct}=Hs({projectName:a.name,stageId:n.id,stageLabel:n.name}),{launchingScopeCodes:Ke,startShotListJobInBackground:jt}=qs({projectName:a.name,stageId:n.id,stageLabel:n.name,onError:(t,s)=>{T({status:"error",message:s,scopeLabel:ie(t)}),J(!0)}}),Ve=g.useMemo(()=>{const t=(a.stages||[]).find(s=>s.type==="shot_list");return(t==null?void 0:t.id)||"shot_list"},[a.stages]),wt=g.useCallback(()=>{if(!f)return;const t=Ce.current||O||"full";f(Ve,{type:"shot-list-focus",scopeCode:t,stageId:Ve})},[f,O,Ve]),{data:C,isLoading:Ye,isError:ns,refetch:je,isRefetching:as}=Is({queryKey:["shot-list-readiness",a.name],queryFn:()=>ae.getReadiness(a.name),enabled:!!(a!=null&&a.name),staleTime:6e4}),H=r.useMemo(()=>{var t,s;return ce((s=(t=a.cards)==null?void 0:t[Z])==null?void 0:s.fields)},[a.cards]),we=r.useMemo(()=>Zs(H),[H]),Xe=r.useMemo(()=>en(we),[we]),kt=Xe>0,K=r.useMemo(()=>(C==null?void 0:C.scope_characters)??{},[C==null?void 0:C.scope_characters]),os=O||"",he=(C==null?void 0:C.character_threshold)??200,rs=(C==null?void 0:C.ready_to_generate)??!1,is=!!C&&!ns,ls=he-((C==null?void 0:C.total_characters)??0),cs=Math.max(0,ls),ds=(It=C==null?void 0:C.missing_requirements)==null?void 0:It[0];r.useEffect(()=>{(async()=>{try{const s=await ae.getShotListApproaches(a.mode);if(s.approaches&&s.approaches.length>0){p(s.approaches);const o=s.default||s.approaches[0].id;x(o)}else{const o=[{id:"default_cinematic",name:"Cinematic Style",description:"Traditional film-style shot list with emphasis on visual storytelling",icon:"🎬",parameters:{orientation:"horizontal"}},{id:"quick_cuts_energetic",name:"Quick Cuts",description:"Fast-paced editing style with short shots",icon:"⚡",parameters:{orientation:"horizontal"}},{id:"long_takes_deliberate",name:"Long Takes",description:"Deliberate pacing with extended shots",icon:"🎭",parameters:{orientation:"horizontal"}},{id:"vertical_social_format",name:"Vertical Format",description:"Optimized for mobile and social media",icon:"📱",parameters:{orientation:"vertical"}}];p(o),x(o[0].id)}}catch(s){$e.error("Error loading approaches:",s);const o=[{id:"default_cinematic",name:"Cinematic Style",description:"Traditional film-style shot list with emphasis on visual storytelling",icon:"🎬",parameters:{orientation:"horizontal"}},{id:"quick_cuts_energetic",name:"Quick Cuts",description:"Fast-paced editing style with short shots",icon:"⚡",parameters:{orientation:"horizontal"}},{id:"long_takes_deliberate",name:"Long Takes",description:"Deliberate pacing with extended shots",icon:"🎭",parameters:{orientation:"horizontal"}},{id:"vertical_social_format",name:"Vertical Format",description:"Optimized for mobile and social media",icon:"📱",parameters:{orientation:"vertical"}}];p(o),x(o[0].id),N({severity:"error",message:"Using default approaches - template configuration not available"})}})()},[a.mode]);const Lt=g.useCallback(t=>{if(!t)return!1;const s=a.mode;return t.startsWith("scene_")||["micro_drama","single_scene"].includes(s)&&t.startsWith("episode_"),!0},[a.mode]),ke=g.useCallback(t=>{if(!t)return!1;if(t===Z&&kt)return!0;const s=K==null?void 0:K[t];return typeof s=="number"?s>0:t===Z?!1:Lt(t)},[K,Lt,kt]),V=g.useMemo(()=>{const t=[],s=a.cards||{},o=a.mode,c=!["one_scene","single_scene"].includes(o);if(["micro_drama","single_scene"].includes(o))Object.values(s).filter(i=>typeof(i==null?void 0:i.code)=="string"&&i.code.startsWith("episode_")).sort((i,j)=>Number((i==null?void 0:i.position)??1e3)-Number((j==null?void 0:j.position)??1e3)).forEac
1h(i=>{const j=i.code||"",w=i.name||j,y=ce(i==null?void 0:i.fields),A=(y==null?void 0:y.summary)??(y==null?void 0:y.Content)??(y==null?void 0:y.screenplay)??(y==null?void 0:y.text),M=A?String(A).trim():"",W=ke(j),q=[M?`${w} — ${M}`:w];W||q.push("Needs screenplay text");const X=Nt(y);t.push({code:j,label:q.join(" — "),summary:M,slugline:X,needsScreenplay:!W})}),c&&t.push({code:"full",label:"Entire screenplay",summary:"Aggregated shot list"});else{Object.values(s).filter(w=>typeof(w==null?void 0:w.code)=="string"&&w.code.startsWith("scene_")).sort((w,y)=>{const A=ce(w==null?void 0:w.fields),M=ce(y==null?void 0:y.fields),W=Number((A==null?void 0:A.sequence)??999),q=Number((M==null?void 0:M.sequence)??999);if(!Number.isNaN(W)&&!Number.isNaN(q)&&W!==q)return W-q;const X=Number((w==null?void 0:w.position)??0),it=Number((y==null?void 0:y.position)??0);return X-it}).forEach((w,y)=>{const A=ce(w==null?void 0:w.fields),M=[],W=Number(A.sequence);Number.isNaN(W)||M.push(`Sequence ${W}`);const q=String(A.arena||"").trim();q&&M.push(q);const X=String(A.summary||"").trim(),it=Nt(A),Ie=[`Scene ${y+1}`];M.length&&Ie.push(M.join(" • ")),X&&X!==q&&Ie.push(X);const Pt=w.code||"",Ot=ke(Pt);Ot||Ie.push("Needs screenplay text");const vs=Ie.join(" — ");t.push({code:Pt,label:vs,slugline:it,summary:X,needsScreenplay:!Ot})}),c&&t.push({code:"full",label:"Entire screenplay",summary:"Aggregated shot list"});const j=s[Z];if(j){const w=ke(Z),y=(H==null?void 0:H.summary)??(H==null?void 0:H["Trailer Script"])??we,A=y?String(y).trim():"Promotional trailer script",M=(j==null?void 0:j.name)||"Trailer Script",W=w?M:`${M} — Needs trailer script`;t.push({code:Z,label:W,summary:A,needsScreenplay:!w})}}return t.filter((i,j,w)=>w.findIndex(y=>y.code===i.code)===j)},[a.cards,a.mode,ke,H,we]);r.useEffect(()=>{var t,s;if(!V.find(o=>o.code===O)){const c=((t=V.find(v=>v.code===l))==null?void 0:t.code)||((s=V[0])==null?void 0:s.code)||l;U(c)}},[V,O,l]);const Le=g.useMemo(()=>O===Z?"Trailer":["micro_drama","single_scene"].includes(a.mode)?"Episode":"Scene",[a.mode,O]),us=g.useMemo(()=>V.map(t=>t.code),[V]),{counts:Ze,refetch:et}=Ms(a.name,us),hs=O&&O.trim()||"full",ms=Ze[hs]??0,P=g.useMemo(()=>{const t={};return V.forEach(s=>{const o=s.code&&s.code.trim()||"full",c=o==="full"?(C==null?void 0:C.total_characters)??0:K==null?void 0:K[o],v=o===Z?typeof c=="number"&&c>0?c:Xe:typeof c=="number"?c:0,i=Ze[o]??0;t[o]={...s,code:o,characters:v,meetsThreshold:v>=he,shotCount:i,hasShots:i>0}}),t},[V,C==null?void 0:C.total_characters,he,K,Ze,Xe]),Te=g.useCallback(t=>{if(!t)return;const s=t.trim();return P[s||"full"]},[P]),me=g.useCallback(t=>{const s=Te(t);return Math.max(0,he-((s==null?void 0:s.characters)??0))},[Te,he]),ie=g.useCallback(t=>{var s;return((s=Te(t))==null?void 0:s.label)||t||"selection"},[Te]),Y=g.useMemo(()=>Object.keys(P),[P]),Tt=Y,tt=g.useMemo(()=>{const t={};return _t.forEach(s=>{var c;if(s.status!=="running"||s.resumeKey!=="shot_list_job"||s.sourceStageId&&s.sourceStageId!==n.id)return;const o=typeof((c=s.resumePayload)==null?void 0:c.scopeCode)=="string"?s.resumePayload.scopeCode:void 0;o&&(t[o]=s.statusLabel)}),t},[n.id,_t]),G=g.useMemo(()=>Y.filter(t=>De[t]),[Y,De]),st=g.useMemo(()=>G.filter(t=>{var s;return(s=P[t])==null?void 0:s.hasShots}),[G,P]),nt=g.useMemo(()=>G.filter(t=>{var s;return!((s=P[t])!=null&&s.meetsThreshold)}),[G,P]),ps=G.length>0&&nt.length===0&&(!st.length||pt)&&!m&&!Vt,fs=g.useCallback(t=>{Ge(s=>({...s,[t]:!s[t]}))},[]),at=g.useCallback(t=>{const s={};Y.forEach(o=>{const c=P[o];if(!c){s[o]=!1;return}if(t==="ready"){s[o]=c.meetsThreshold;return}if(t==="ready_without_shots"){s[o]=c.meetsThreshold&&!c.hasShots;return}s[o]=!0}),Ge(s)},[Y,P]),gs=g.useCallback(()=>{const t={};Y.forEach(s=>{t[s]=!1}),Ge(t)},[Y]),Re=g.useCallback(async(t,s)=>{const o=(s==null?void 0:s.skipProjectRefresh)??!1;if(!d)throw new Error("Please select an approach before generating.");const c=t&&t.trim()||"full",v=await(async()=>{try{const i=await ye({approachId:d,customPrompt:R||void 0,parentSceneCode:c,shotMode:B,shotSplitMode:oe,alsoCreateCompactVideoPrompt:ue,shotFieldPreset:te,requestedShotFields:se,autoManageTimeline:Bt(Number(a.id))},Ct);if(i.status==="failed"||i.status==="cancelled")throw new Error(i.error_message||"Failed to generate shot list.");return i}catch(i){const j=de(i)||"";if(j.toLowerCase().includes("insufficient credits")){const w=j.match(/need\s*(\d+)/i),y=j.match(/have\s*(\d+)/i),A=w?parseInt(w[1],10):($==null?void 0:$.requiredCredits)||1,M=y?parseInt(y[1],10):($==null?void 0:$.currentBalance)||0;vt({requiredCredits:A,currentBalance:M,isDynamicPricing:$==null?void 0:$.isDynamicPricing}),Qe(!0)}throw i}})();return o||_e(!0),v.result??v},[Ct,ye,R,d,B,oe,ue,te,se,$,a.id,_e]),xs=g.useCallback(async t=>{b(!0),J(!1),T(null);try{const s=await Re(t),o=Number(s==null?void 0:s.shots_created)||0;T({status:"success",shotsCreated:o,scopeLabel:ie(t)}),J(!0)}catch(s){if(s instanceof DOMException&&s.name==="AbortError")return;$e.error("Error generating shot list:",s);const o=de(s)||"Failed to generate shot list.";!He&&!o.toLowerCase().includes("insufficient credits")&&(T({status:"error",message:o,scopeLabel:ie(t)}),J(!0))}finally{b(!1)}},[ie,Re,He]),bs=async()=>{const t=Ce.current||O;
1if(!t){N({severity:"error",message:"No target selected for overwrite."}),ve(!1);return}ve(!1),await xs(t)},ys=g.useCallback(async()=>{if(G.length===0)return;We(!1),Je(null),J(!1),T(null),gt(!0),b(!0),qe(0),xt(G.length),be(!1);const t=[];let s=!1;try{for(let o=0;o<G.length;o++){const c=G[o],v=P[c];if(bt(c),qe(o+1),!(v!=null&&v.meetsThreshold)){const i=me(c);t.push({scopeCode:c,label:(v==null?void 0:v.label)||c,status:"skipped",message:i>0?`${i} more characters required before generating`:"Scope does not have screenplay text."});continue}try{const i=await Re(c,{skipProjectRefresh:!0}),j=Number(i==null?void 0:i.shots_created)||0;t.push({scopeCode:c,label:(v==null?void 0:v.label)||c,status:"success",shotsCreated:j}),Ce.current=c,s=!0}catch(i){if(i instanceof DOMException&&i.name==="AbortError")break;const j=de(i)||"Failed to generate shot list.";t.push({scopeCode:c,label:(v==null?void 0:v.label)||c,status:"failed",message:j}),N({severity:"error",message:`${ie(c)}: ${j}`})}}}finally{gt(!1),b(!1),bt(null),qe(0),xt(0),Je(t),ft(!1),be(s)}},[ie,Re,me,P,G,be]),Ss=g.useCallback(async t=>{const s=P[t];if(!s){N({severity:"error",message:"Shot-list scope is no longer available."});return}if(!d){N({severity:"error",message:"Please select an approach before generating."});return}if(Ye){N({severity:"error",message:"Still checking screenplay readiness. Please wait a moment."});return}if(!s.meetsThreshold){const o=me(t);N({severity:"error",message:o>0?`${s.label} needs ${o} more characters before shot generation.`:`${s.label} needs screenplay text before shot generation.`});return}if(tt[t]||Ke.has(t)){N({severity:"info",message:`${s.label} is already generating.`});return}try{Ce.current=t;const o=await ye({approachId:d,customPrompt:R||void 0,parentSceneCode:t,scopeLabel:s.label,shotMode:B,shotSplitMode:oe,alsoCreateCompactVideoPrompt:ue,shotFieldPreset:te,requestedShotFields:se,autoManageTimeline:Bt(Number(a.id))},jt);if(o.status==="failed"||o.status==="cancelled"){T({status:"error",message:o.error_message||"Shot-list generation failed.",scopeLabel:s.label}),J(!0);return}N({severity:"info",message:`${s.label} is generating in Task Center.`})}catch(o){if(o instanceof DOMException&&o.name==="AbortError")return;const c=de(o)||"Failed to start shot-list generation.";if(c.toLowerCase().includes("insufficient credits")){const v=c.match(/need\s*(\d+)/i),i=c.match(/have\s*(\d+)/i);vt({requiredCredits:v?parseInt(v[1],10):St??1,currentBalance:i?parseInt(i[1],10):0,isDynamicPricing:!1}),Qe(!0);return}T({status:"error",message:c,scopeLabel:s.label}),J(!0)}},[ue,R,Ye,Ke,St,a.id,se,tt,me,P,d,te,B,oe,jt,ye]),ot=I.find(t=>t.id===d),pe=Wt.find(t=>t.value===B),fe=Dt.find(t=>t.value===oe),rt=g.useCallback(()=>{Je(null),yt&&u&&u().catch(t=>{$e.warn("Failed to refresh project after batch generation",t)}),be(!1)},[u,yt]),Rt=g.useCallback(async()=>{J(!1),Ue&&(u&&await u(),L.invalidateQueries({queryKey:["video-timeline-scopes",Number(a.id)]}),L.invalidateQueries({queryKey:["video-timeline",Number(a.id)]}),L.invalidateQueries({queryKey:["video-stage-shots",Number(a.id)]}),await je(),await et(),_e(!1))},[a.id,L,je,et,u,Ue]);return e.jsxs(F,{sx:{p:3},children:[Yt,e.jsx(Ts,{title:n.name||"Shot List Wizard",description:n.stage_instructions??n.description??"Break your screenplay into production-ready shots for the selected scope.",variant:n.wizard?"wizard":"default"}),e.jsxs(ee,{container:!0,spacing:3,alignItems:"flex-start",sx:{mb:3},children:[e.jsxs(ee,{item:!0,xs:12,lg:6,children:[C&&e.jsx(F,{sx:{mb:3},children:e.jsx(Qs,{readiness:C,selectedScope:os,scopeLabel:Le,onRefresh:je,isRefreshing:Ye||as})}),is&&!rs&&e.jsx(ne,{severity:"warning",sx:{mb:3},children:ds||`Add ${cs} more characters of screenplay text to enable shot generation.`}),e.jsxs(ge,{sx:{p:3},children:[e.jsx(_,{component:"div",sx:{...Ae,mb:2},children:"Approach Settings"}),e.jsxs(Me,{fullWidth:!0,sx:{mb:3},children:[e.jsx(Pe,{children:"Shot List Approach"}),e.jsx(Oe,{value:d,onChange:t=>x(t.target.value),label:"Shot List Approach",disabled:m,children:I.map(t=>e.jsx(xe,{value:t.id,children:e.jsxs(F,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t.icon}),e.jsxs(F,{children:[e.jsx(_,{variant:"body1",children:t.name}),e.jsx(_,{variant:"caption",color:"text.secondary",children:t.description})]})]})},t.id))})]}),e.jsxs(Me,{fullWidth:!0,sx:{mb:2},children:[e.jsx(Pe,{children:"Shot length"}),e.jsx(Oe,{value:B,onChange:t=>Qt(t.target.value),label:"Shot length",disabled:m,children:Wt.map(t=>e.jsx(xe,{value:t.value,children:t.label},t.value))})]}),e.jsxs(Me,{fullWidth:!0,children:[e.jsx(Pe,{children:"Shot split mode"}),e.jsx(Oe,{value:oe,onChange:t=>Ut(t.target.value),label:"Shot split mode",disabled:m,children:Dt.map(t=>e.jsx(xe,{value:t.value,children:t.label},t.value))})]}),pe&&e.jsx(_,{variant:"body2",color:"text.secondary",sx:{mt:2},children:pe.description}),fe&&e.jsx(_,{variant:"body2",color:"text.secondary",sx:{mt:1},children:fe.description}),e.jsx(Et,{sx:{my:2}}),e.jsx(_,{component:"div",sx:{...Ae,mb:2},children:"Custom Instructions"}),e.jsx(Ns,{fullWidth:!0,multiline:!0,rows:3,label:"Custom Instructions (Optional)",placeholder:"Add any specific instructions for shot generation...",value:R,onChange:t=>z(t.target.value)})]})]}),e.jsx(ee,{item:!0,xs:12,lg:6,children:e.jsxs(ge,{sx:{p:3},children:[e.jsx(_,{component:"div",sx:{...Ae,mb:2},children:"Shot field preset"}),e.jsxs(Me,{fullWidth:!0,sx:{mb:2},children:[e.jsx(Pe,{children:"Field preset"}),e.jsxs(Oe,{value:te,onChange:t=>{const s=t.target.value;s!=="custom"&&ts(s)},label:"Field preset",disabled:m,children:[Object.entries(Be).map(([t,s])=>e.jsx(xe,{value:t,children:e.jsxs(F,{children:[e.jsx(_,{variant:"body2",children:s.label}),e.jsx(_,{variant:"caption",color:"text.secondary",children:s.description})]})},t)),e.jsx(xe,{value:"custom",disabled:!0,children:e.jsx("em",{children:"Custom"})})]})]}),e.jsx(_,{variant:"body2",fontWeight:500,sx:{mb:1},children:"Requested substantive fields"}),e.jsx(ee,{container:!0,spacing:1,children:tn.map(t=>{const s=se.includes(t.value);return e.jsx(ee,{item:!0,xs:12,sm:6,children:e.jsx(Ft,{sx:{alignItems:"flex-start",mr:0},control:e.jsx(dt,{checked:s,onChange:o=>ss(t.value,o.target.checked),disabled:m}),label:e.jsxs(F,{children:[e.jsx(_,{variant:"body2",fontWeight:500,children:t.label}),e.jsx(_,{variant:"caption",color:"text.secondary",children:t.description})]})})},t.value)})})]})})]}),e.jsxs(ge,{sx:{p:3,mb:3},children:[e.jsx(F,{display:"flex",justifyContent:"space-between",alignItems:"flex-start",ga
1p:2,sx:{mb:2},children:e.jsx(F,{children:e.jsx(_,{component:"div",sx:Ae,children:["micro_drama","single_scene"].includes(a.mode)?"Episodes":"Scenes"})})}),Tt.length===0?e.jsx(ne,{severity:"info",children:"No scene or episode scopes are available yet."}):e.jsx(le,{spacing:1.5,children:Tt.map(t=>{const s=P[t];if(!s)return null;const o=tt[t],c=Ke.has(t),v=!!(o||c),i=me(t),j=s.meetsThreshold?d?void 0:"Choose an approach first":i>0?`${i} more characters needed`:"Needs screenplay text";return e.jsx(ge,{variant:"outlined",sx:{p:2,borderRadius:0,borderColor:s.hasShots?"var(--bb-gold-dim)":"var(--bb-line)",bgcolor:v?"var(--bb-gold-wash)":"var(--bb-surface)"},children:e.jsxs(le,{direction:{xs:"column",md:"row"},spacing:2,alignItems:{xs:"stretch",md:"center"},children:[e.jsxs(F,{sx:{flex:1,minWidth:0},children:[e.jsx(_,{variant:"subtitle1",sx:{fontWeight:600},children:s.label}),j&&e.jsx(_,{variant:"caption",color:"warning.main",children:j})]}),e.jsxs(le,{direction:"row",spacing:1,alignItems:"center",flexWrap:"wrap",useFlexGap:!0,children:[!s.meetsThreshold&&e.jsx(Q,{size:"small",label:"Needs text",color:"warning",variant:"outlined"}),e.jsx(Q,{size:"small",label:s.hasShots?`${s.shotCount} shot${s.shotCount===1?"":"s"}`:"Not generated",color:s.hasShots?"info":"default",variant:"outlined"})]}),e.jsx(F,{sx:{minWidth:{md:150},display:"flex",justifyContent:{xs:"stretch",md:"flex-end"}},children:v?e.jsx(E,{fullWidth:!0,variant:"outlined",disabled:!0,startIcon:e.jsx(Ws,{size:16}),children:c?"Starting...":o||"Running"}):e.jsx(E,{fullWidth:!0,variant:s.hasShots?"outlined":"contained",disabled:!!j,onClick:()=>{Ss(t)},children:s.hasShots?"Regenerate":"Generate"})})]})},t)})})]}),e.jsxs(Ee,{open:Kt,onClose:()=>We(!1),maxWidth:"md",fullWidth:!0,children:[e.jsx(Fe,{children:"Batch Generate Shot Lists"}),e.jsx(ze,{dividers:!0,children:e.jsxs(le,{spacing:2,children:[e.jsxs(_,{variant:"body2",color:"text.secondary",children:["Select the ",Le.toLowerCase(),"s you want to process. The wizard runs them sequentially, deleting any existing shot lists before re-generating with the current approach, grouping mode, and split mode."]}),e.jsxs(F,{children:[e.jsx(_,{variant:"body2",color:"text.secondary",children:"Current settings:"}),e.jsxs(_,{variant:"body2",children:["Approach: ",(ot==null?void 0:ot.name)||"Choose an approach"," • Shot length: ",(pe==null?void 0:pe.label)||"Select shot length"," • Split: ",(fe==null?void 0:fe.label)||"Select split mode"," • Preset: ",te==="custom"?"Custom":((Mt=Be[te])==null?void 0:Mt.label)||"Standard cinematic"," • Compact prompt: ",ue?"On":"Off"]})]}),e.jsxs(le,{direction:"row",spacing:1,flexWrap:"wrap",children:[e.jsx(E,{variant:"outlined",size:"small",onClick:()=>at("all"),children:"Select All"}),e.jsx(E,{variant:"outlined",size:"small",onClick:()=>at("ready"),children:"Ready Only"}),e.jsx(E,{variant:"outlined",size:"small",onClick:()=>at("ready_without_shots"),children:"Ready w/o Shots"}),e.jsx(E,{size:"small",onClick:gs,children:"Clear"})]}),nt.length>0&&e.jsxs(ne,{severity:"warning",children:[nt.length," selected ",Le.toLowerCase(),"(s) still need screenplay text. Add more characters or deselect them before starting."]}),st.length>0&&e.jsxs(ne,{severity:"warning",children:[st.length," selected ",Le.toLowerCase(),"(s) already have shot lists.",e.jsx(Ft,{control:e.jsx(dt,{checked:pt,onChange:t=>ft(t.target.checked)}),label:"Delete existing shot lists before generating",sx:{ml:1}})]}),e.jsx(ge,{variant:"outlined",sx:{maxHeight:360,overflow:"auto"},children:e.jsx(zt,{dense:!0,disablePadding:!0,children:Y.map(t=>{const s=P[t];return s?e.jsx(sn,{code:t,meta:s,isSelected:!!De[t],onToggle:fs},t):null})})}),e.jsx(Et,{}),e.jsx(_,{variant:"body2",children:"Each selected scope has a quote to confirm before generation."})]})}),e.jsxs(Ne,{children:[e.jsx(E,{onClick:()=>We(!1),children:"Cancel"}),e.jsx(E,{variant:"contained",onClick:ys,disabled:!ps,children:"Start Batch"})]})]}),S&&e.jsx(Fs,{open:Zt,onClose:Rt,tone:S.status==="success"?"success":"error",title:S.status==="success"?"Shot List Generated":"Shot List Generation Failed",statusBadge:S.status==="success"&&S.scopeLabel?S.scopeLabel.split(" — ")[0]||S.scopeLabel:void 0,message:S.status==="success"?`${S.shotsCreated??0} shots created and ready for review.`:S.message||"Generation failed.",details:S.status!=="success"?"Please adjust your screenplay text or try again.":void 0,disableBackdropClose:!0,primaryAction:f&&S.status==="success"?{label:"Go to Shot List",variant:"contained",onClick:async()=>{Ue&&(u&&await u(),L.invalidateQueries({queryKey:["video-timeline-scopes",Number(a.id)]}),L.invalidateQueries({queryKey:["video-timeline",Number(a.id)]}),L.invalidateQueries({queryKey:["video-stage-shots",Number(a.id)]}),await je(),await et(),_e(!1)),J(!1),wt()}}:void 0,secondaryAction:{label:"Close",variant:S.status==="success"?"outlined":"contained",color:S.status==="success"?"inherit":"error",onClick:Rt}}),re&&e.jsxs(Ee,{open:!0,onClose:rt,maxWidth:"sm",fullWidth:!0,children:[e.jsx(Fe,{children:"Batch Generation Summary"}),e.jsxs(ze,{dividers:!0,children:[e.jsxs(_,{variant:"body2",sx:{mb:2},children:[re.filter(t=>t.status==="success").length," succeeded •"," ",re.filter(t=>t.status==="failed").length," failed •"," ",re.filter(t=>t.status==="skipped").length," skipped"]}),e.jsx(zt,{dense:!0,children:re.map(t=>e.jsx(Jt,{disablePadding:!0,children:e.jsx(Es,{primary:`${t.label} — ${t.status==="success"?`Completed (${t.shotsCreated??0} shots)`:t.status==="failed"?"Failed":"Skipped"}`,secondary:t.message})},`${t.scopeCode}-${t.status}`))})]}),e.jsxs(Ne,{children:[e.jsx(E,{onClick:rt,children:"Close"}),f&&re.some(t=>t.status==="success")&&e.jsx(E,{variant:"contained",onClick:()=>{rt(),wt()},children:"Review Shots"})]})]}),e.jsxs(Ee,{open:es,onClose:()=>ve(!1),children:[e.jsx(Fe,{children:"Overwrite existing shots?"}),e.jsx(ze,{children:e.jsxs(_,{variant:"body2",children:["There are already ",ms," shots for this selection. Generating again will delete them and create new ones. Continue?"]})}),e.jsxs(Ne,{children:[e.jsx(E,{onClick:()=>ve(!1),children:"Cancel"}),e.jsx(E,{color:"error",variant:"contained",onClick:bs,children:"Overwrite"})]})]}),e.jsx(Ds,{open:!!Se,autoHideDuration:6e3,onClose:()=>N(null),anchorOrigin:{vertical:"bottom",horizontal:"center"},children:Se?e.jsx(ne,{onClose:()=>N(null),severity:Se.severity,sx:{width:"100%",maxWidth:600},children:Se.message}):void 0}),$&&e.jsx(Ys,{open:He,onClose:()=>Qe(!1),currentBalance:$.currentBalance,requiredCredits:$.requiredCredits,isDynamicPricing:$.isDynamicPricing})]})}
1export{wa as ShotListWriterStage};
2//# sourceMappingURL=ShotListWriterStage-BfugJkwc.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.