PageSourceSearch

https://presentazioni.ai/assets/CinemaReelArea-C7beiE7i.js

js presentazioni.ai collected 2026-10-05 12:31:17 UTC 24,850 bytes, 11 lines download raw bytes

1import{n as he,r as s,s as p,j as e,a8 as Le,a9 as De,aa as Ae,ab as Te,aN as se,b3 as Me,L as z,B as X,ak as Ue,X as pe,b4 as d,e as Oe,d as $e,t as B,a1 as me,P as Ve,ai as fe,F as Fe,b5 as Ge,_ as ge,b6 as He,b7 as qe,b8 as Be,b9 as Xe,ba as We,bb as Qe,bc as Ke,bd as Ye,T as Je,be as Ze,f as ee}from"./index-BQdhh5bh.js";import{CINEMA_REEL_STYLE_OPTIONS as et}from"./CinemaReelModal-CxiYtVbU.js";import{S as tt,a as st,b as rt,c as at,d as xe}from"./select-D6FCt9Tm.js";import{S as ot,M as lt}from"./smartphone-0GZtJwR9.js";import"./chevron-up-vVSxxE5H.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const it=he("Music2",[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const nt=he("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]),ct=m=>{switch(m){case"16:9":return"aspect-video";case"9:16":return"aspect-[9/16]";case"4:5":return"aspect-[4/5]";default:return"aspect-square"}},dt=({open:m,onClose:j,onImport:w,maxSelection:k,alreadySelected:C,onGoToPhotoLab:S})=>{const[x,N]=s.useState([]),[_,I]=s.useState(!0),[g,c]=s.useState(new Set),f=Math.max(0,k-C);s.useEffect(()=>{let o=!1;return(async()=>{try{const{data:{session:l}}=await p.auth.getSession();if(!l){o||N([]);return}const{data:y,error:A}=await p.from("photo_lab_images").select("id, image_url, aspect_ratio, created_at").eq("user_id",l.user.id).order("created_at",{ascending:!1}).limit(120);if(A)throw A;if(o)return;const T=y||[];N(T),T.slice(0,24).forEach(U=>{const O=new Image;O.src=U.image_url})}catch(l){console.warn("[PhotoLabPicker] preload failed",l)}finally{o||I(!1)}})(),()=>{o=!0}},[]),s.useEffect(()=>{m&&c(new Set)},[m]);const E=o=>{c(l=>{const y=new Set(l);if(y.has(o.id))y.delete(o.id);else{if(y.size>=f)return d.error(`Puoi importare al massimo ${f} foto`),l;y.add(o.id)}return y})},D=()=>{const o=x.filter(l=>g.has(l.id)).map(l=>l.image_url);if(o.length===0){d.error("Seleziona almeno una foto");return}w(o),j()};return e.jsx(Le,{open:m,onOpenChange:o=>!o&&j(),children:e.jsxs(De,{className:"max-w-3xl max-h-[85vh] flex flex-col p-0",children:[e.jsxs(Ae,{className:"px-5 pt-5 pb-3 border-b border-border",children:[e.jsxs(Te,{className:"flex items-center gap-2",children:[e.jsx(se,{className:"w-4 h-4 text-vertical-photo"}),"Importa da Photo Lab"]}),e.jsxs(Me,{children:["Seleziona le foto da usare nel tuo reel. Slot disponibili: ",f,"."]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:_?e.jsx("div",{className:"flex items-center justify-center py-16 text-muted-foreground",children:e.jsx(z,{className:"w-5 h-5 animate-spin"})}):x.length===0?e.jsxs("div",{className:"text-center py-12 px-4",children:[e.jsx("span",{className:"inline-flex w-12 h-12 rounded-2xl bg-vertical-photo/10 text-vertical-photo items-center justify-center mb-3",children:e.jsx(se,{className:"w-5 h-5"})}),e.jsx("p",{className:"text-sm font-semibold mb-1",children:"Non hai ancora foto in Photo Lab"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4 max-w-sm mx-auto",children:"Genera foto fotorealistiche con AI quando non hai uno shooting a disposizione."}),S&&e.jsx(X,{onClick:()=>{j(),S()},className:"bg-vertical-photo text-vertical-photo-foreground hover:bg-vertical-photo/90",children:"Vai a Photo Lab"})]}):e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:x.map(o=>{const l=g.has(o.id);return e.jsxs("button",{type:"button",onClick:()=>E(o),className:`relative rounded-lg overflow-hidden border-2 transition-all focus:outline-none focus:ring-0 ${ct(o.aspect_ratio)} ${l?"border-vertical-photo ring-2 ring-vertical-photo/40":"border-border hover:border-foreground
11/30"}`,children:[e.jsx("img",{src:o.image_url,alt:"",className:"w-full h-full object-cover",loading:"lazy"}),e.jsx("div",{className:`absolute top-2 right-2 w-6 h-6 rounded-full flex items-center justify-center border-2 transition-all ${l?"bg-vertical-photo border-vertical-photo text-vertical-photo-foreground":"bg-black/50 border-white/70 text-transparent"}`,children:e.jsx(Ue,{className:"w-3.5 h-3.5"})})]},o.id)})})}),e.jsxs("div",{className:"px-5 py-3 border-t border-border flex items-center justify-between gap-3",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.size," selezionate"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(X,{variant:"outline",onClick:j,children:[e.jsx(pe,{className:"w-4 h-4 mr-1"}),"Annulla"]}),e.jsxs(X,{onClick:D,disabled:g.size===0,className:"bg-vertical-photo text-vertical-photo-foreground hover:bg-vertical-photo/90",children:["Importa (",g.size,")"]})]})]})]})})},P=9,ut=60,mt=80,te=["Carico il modello cinematografico","Analizzo le foto","Costruisco lo storyboard","Genero i frame chiave","Applico la color grading","Monto la sequenza","Finalizzo il reel"],ft=({reel:m,paused:j,onOpen:w,onPrewarm:k,onDownload:C,onDelete:S})=>{const x=s.useRef(null),N=s.useRef(null),[_,I]=s.useState(!1);s.useEffect(()=>{const c=x.current;if(!c||_)return;const f=new IntersectionObserver(([E])=>{E.isIntersecting&&(I(!0),f.disconnect())},{rootMargin:"300px",threshold:.01});return f.observe(c),()=>f.disconnect()},[_]),s.useEffect(()=>{const c=N.current;if(!(!c||!_))if(j)try{c.pause()}catch{}else c.play().catch(()=>{})},[j,_]);const g=m.status==="completed"&&!!m.video_url;return e.jsx("div",{ref:x,onClick:()=>g&&w(),onPointerDown:k,onMouseEnter:k,onTouchStart:k,className:`relative group rounded-xl overflow-hidden border border-border bg-black ${m.aspect_ratio==="16:9"?"aspect-video":"aspect-[9/16]"} ${g?"cursor-pointer":""}`,children:g?e.jsxs(e.Fragment,{children:[_?e.jsx("video",{ref:N,src:m.video_url,className:"w-full h-full object-cover",loop:!0,muted:!0,playsInline:!0,autoPlay:!0,preload:"auto"}):e.jsx("div",{className:"absolute inset-0 bg-black"}),e.jsxs("div",{className:"absolute bottom-2 left-2 right-2 flex gap-2 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsxs("button",{onClick:c=>{c.stopPropagation(),C()},className:"flex-1 flex items-center justify-center gap-1.5 h-9 rounded-lg bg-black/60 text-white text-xs font-medium hover:bg-white hover:text-black backdrop-blur-sm transition-colors focus:outline-none focus:ring-0",title:"Scarica",children:[e.jsx(ge,{className:"w-4 h-4"}),"Scarica"]}),e.jsxs("button",{onClick:c=>{c.stopPropagation(),S()},className:"flex-1 flex items-center justify-center gap-1.5 h-9 rounded-lg bg-black/60 text-white text-xs font-medium hover:bg-red-500/70 backdrop-blur-sm transition-colors focus:outline-none focus:ring-0",title:"Elimina",children:[e.jsx(Je,{className:"w-4 h-4"}),"Elimina"]})]})]}):m.status==="processing"?e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground gap-2",children:[e.jsx(z,{className:"w-6 h-6 animate-spin text-vertical-reel"}),e.jsx("span",{className:"text-[11px] font-medium",children:"In elaborazione"})]}):e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground gap-2 px-3 text-center",children:[e.jsx(Ze,{className:"w-6 h-6 text-destructive"}),e.jsx("span",{className:"text-[11px] font-medium",children:"Generazione non riuscita"}),m.error_message&&e.jsx("span",{className:"text-[10px] opacity-70 line-clamp-2",children:m.error_message})]})})},vt=({onBack:m,isPaidPlan:j,onRequestAuth:w,onOpenPhotoLab:k})=>{Oe();const{user:C,credits:S}=$e(),[x,N]=s.useState([]),[_,I]=s.useState(!0),[g,c]=s.useState(!1),[f,E]=s.useState(null),[D,o]=s.useState(!1),[l,y]=s.useState(null),A=s.useRef(null),T=s.useCallback(()=>{const t=A.current;if(t){try{t.pause()}catch{}try{t.removeAttribute("src"),t.load()}catch{}}y(null)},[]),U=s.useRef(new Set),O=t=>{if(!(!t||U.current.has(t))){U.current.add(t);try{fetch(t,{mode:"cors",credentials:"omit",headers:{Range:"bytes=0-1048575"}}).catch(()=>{})}catch{}}},[u,$]=s.useState([]),[re,ae]=s.useState(!1),[V,W]=s.useState(""),[Q,oe]=s.useState(!1),[b,le]=s.useState(!1),[be,F]=s.useState(""),[ie,ve]=s.useState("9:16"),[ne,je]=s.useState(!0),[K,we]=s.useState("hd"),ce=K==="ultra"?mt:ut,G=s.useRef(null),[ye,de]=s.useState(!1),[L,Y]=s.useState(null),[Ne,H]=s.useState(null),[_e,J]=s.useState(!1),Se=t=>{t.length!==0&&($(r=>{const a=[...r,...t];
11return Array.from(new Set(a)).slice(0,P)}),d.success(`${t.length} foto importate da Photo Lab`))},ke=S?S.slides_total-S.slides_used:0;s.useEffect(()=>{if(u.length===0){H(null),Y(null);return}let t=!1;J(!0);const r=setTimeout(async()=>{try{const{data:a,error:n}=await p.functions.invoke("detect-reel-subject",{body:{imageUrls:u}});if(t)return;if(n)H(!1);else{const i=!!(a!=null&&a.isVehicle);H(i),i||Y(null)}}catch{t||H(!1)}finally{t||J(!1)}},1200);return()=>{t=!0,clearTimeout(r),J(!1)}},[u]);const R=s.useCallback(async()=>{try{const{data:{session:t}}=await p.auth.getSession();if(!t){N([]),I(!1);return}const{data:r,error:a}=await p.from("cinema_reels").select("id, status, video_url, vehicle_make, vehicle_model, vehicle_year, style, aspect_ratio, created_at, error_message").eq("user_id",t.user.id).in("status",["completed","processing"]).order("created_at",{ascending:!1}).limit(60);if(a)throw a;N(r||[])}catch(t){console.warn("[CinemaReelArea] load failed",t),d.error("Caricamento reel non riuscito")}finally{I(!1)}},[]);s.useEffect(()=>{R(),B("cinema_reel_area_open")},[R]),s.useEffect(()=>{if(!x.some(r=>r.status==="processing"))return;const t=setInterval(R,15e3);return()=>clearInterval(t)},[x,R]);const Ce=async t=>{const r=Array.from(t.target.files||[]);if(r.length===0)return;if(!C){d.error("Accedi per caricare foto"),w==null||w();return}const a=P-u.length,n=r.slice(0,a);ae(!0);try{const i=[];for(const h of n){if(!h.type.startsWith("image/"))continue;if(h.size>10*1024*1024){d.error("Foto troppo grande (max 10MB)");continue}const Z=h.name.split(".").pop()||"jpg",q=`${C.id}/reel-uploads/${Date.now()}-${Math.random().toString(36).slice(2,8)}.${Z}`,{error:M}=await p.storage.from("slide-images").upload(q,h,{upsert:!1,contentType:h.type});if(M){console.error("Reel photo upload failed",M);continue}const{data:v}=p.storage.from("slide-images").getPublicUrl(q);v!=null&&v.publicUrl&&i.push(v.publicUrl)}i.length>0&&$(h=>[...h,...i].slice(0,P))}finally{ae(!1),G.current&&(G.current.value="")}},Ee=t=>{$(r=>r.filter((a,n)=>n!==t))},Re=async()=>{if(u.length===0){d.error("Carica almeno una foto");return}oe(!0);try{const{data:t,error:r}=await p.functions.invoke("suggest-reel-prompt",{body:{imageUrls:u}});if(r)throw r;const a=t==null?void 0:t.prompt;if(a)W(a),d.success("Prompt suggerito");else throw new Error("Nessun prompt suggerito")}catch(t){d.error(ee(t)||"Errore suggerimento")}finally{oe(!1)}},Pe=async()=>{if(!C){w==null||w();return}if(!j){B("cinema_reel_area_locked_click"),c(!0);return}if(u.length===0){d.error("Carica almeno una foto");return}if(!V.trim()&&!L){d.error("Scrivi un prompt o seleziona uno stile cinematografico");return}if(ke<ce){c(!0);return}le(!0),F(te[0]);let t=0;const r=setInterval(()=>{t=(t+1)%te.length,F(te[t])},4500);try{const{data:a,error:n}=await p.functions.invoke("generate-cinema-reel",{body:{standalone:!0,customPrompt:V.trim(),imageUrls:u,mood:"cinematic",aspectRatio:ie,withMusic:ne,quality:K,...L?{style:L}:{}}});if(n)throw n;const i=a==null?void 0:a.reelId;if(!i)throw new Error("Reel non avviato");await R();const h=Date.now(),Z=12*60*1e3;let q=null,M=!0;for(;Date.now()-h<Z;){await new Promise(Ie=>setTimeout(Ie,5e3));const{data:v}=await p.from("cinema_reels").select("status, video_url, error_message").eq("id",i).maybeSingle();if(v){if(v.status==="completed"&&v.video_url){q=v.video_url,M=!1;break}if(v.status==="failed")throw new Error(v.error_message||"Generazione fallita")}}if(M){d.message("Sta richiedendo più del previsto",{description:"Il video apparirà qui appena pronto, puoi anche tornare più tardi."}),clearInterval(r),F("In coda di finalizzazione..."),await R();return}window.dispatchEvent(new Event("credits-changed")),W(""),$([]),d.success("Reel generato"),await R()}catch(a){d.error(ee(a)||"Errore generazione reel")}finally{clearInterval(r),le(!1),F("")}},ue=async t=>{if(t.video_url)try{const a=await(await fetch(t.video_url)).blob(),n=URL.createObjectURL(a),i=document.createElement("a");i.href=n;const h=`${t.vehicle_make||"reel"}-${t.vehicle_model||"video"}`.replace(/[^a-z0-9-_]+/gi,"-");i.download=`cinema-reel-${h}.mp4`,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(n),B("cinema_reel_area_download",{reelId:t.id})}catch{d.error("Download non riuscito")}},ze=async()=>
11{if(f){o(!0);try{const t=x.find(i=>i.id===f),r=(t==null?void 0:t.video_url)||null,{data:a,error:n}=await p.from("cinema_reels").delete().eq("id",f).select("id");if(n)throw n;if(!a||a.length===0)throw new Error("Eliminazione non consentita");r&&await p.from("generated_ads").delete().eq("source","cinema_reel").eq("url",r),N(i=>i.filter(h=>h.id!==f)),d.success("Reel eliminato"),B("cinema_reel_area_delete",{reelId:f})}catch(t){d.error(ee(t)||"Eliminazione non riuscita")}finally{o(!1),E(null)}}};return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsxs("div",{className:"max-w-[66rem] mx-auto px-4 sm:px-6 py-6 pb-24 space-y-6",children:[e.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-vertical-reel/20 via-vertical-reel/10 to-transparent border border-vertical-reel/40 px-6 py-8 sm:py-10",children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,hsl(var(--vertical-reel)/0.18),transparent_70%)]"}),e.jsxs("div",{className:"relative flex items-center gap-4",children:[e.jsx("div",{className:"flex items-center justify-center w-12 h-12 rounded-xl bg-vertical-reel/20 text-vertical-reel shrink-0",children:e.jsx(me,{className:"w-6 h-6"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold text-foreground tracking-tight",children:"Cinema Reel"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:"Carica le foto, descrivi il reel e genera un video cinematografico verticale di 8-10 secondi."})]})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"rounded-2xl border border-border bg-card p-4 sm:p-5 shadow-sm space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-xs font-medium text-foreground",children:["Foto di riferimento"," ",e.jsxs("span",{className:"text-muted-foreground",children:["(",u.length,"/",P,")"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[u.map((t,r)=>e.jsxs("div",{className:"relative w-20 h-20 rounded-lg overflow-hidden border border-border bg-muted group",children:[e.jsx("img",{src:t,alt:`reel ${r+1}`,className:"w-full h-full object-cover"}),e.jsx("button",{type:"button",onClick:()=>Ee(r),disabled:b,className:"absolute top-1 right-1 p-0.5 rounded-full bg-black/60 text-white opacity-0 group-hover:opacity-100 transition-opacity focus:outline-none focus:ring-0",title:"Rimuovi",children:e.jsx(pe,{className:"w-3 h-3"})})]},r)),u.length<P&&e.jsx("button",{type:"button",onClick:()=>{var t;return(t=G.current)==null?void 0:t.click()},disabled:re||b,className:"w-20 h-20 rounded-lg border border-dashed border-border bg-muted/40 flex items-center justify-center text-muted-foreground hover:bg-muted/70 transition-colors disabled:opacity-50 focus:outline-none focus:ring-0",title:"Aggiungi foto",children:re?e.jsx(z,{className:"w-5 h-5 animate-spin"}):e.jsx(Ve,{className:"w-5 h-5"})})]}),e.jsx("input",{ref:G,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:Ce}),e.jsxs("button",{type:"button",onClick:()=>de(!0),disabled:b||u.length>=P,className:"inline-flex items-center gap-1.5 mt-1 text-[11px] font-medium text-vertical-photo hover:underline disabled:opacity-50 disabled:no-underline focus:outline-none focus:ring-0",children:[e.jsx(se,{className:"w-3 h-3"}),"Importa da Photo Lab"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-xs font-medium text-foreground",children:"Prompt cinematografico"}),e.jsxs("button",{type:"button",onClick:Re,disabled:Q||b||u.length===0,className:"flex items-center gap-1.5 text-[11px] font-medium text-vertical-reel hover:underline disabled:opacity-50 disabled:no-underline focus:outline-none focus:ring-0",children:[Q?e.jsx(z,{className:"w-3 h-3 animate-spin"}):e.jsx(fe,{className:"w-3 h-3"}),Q?"Analizzo le foto...":"Suggerisci dalle foto"]})]}),e.jsx(Fe,{value:V,onChange:t=>W(t.target.value),placeholder:"Es: Una corsa al tramonto sulla spiaggia, riprese aeree con drone, palette calda, slow motion sul finale.",className:"min-h-[100px] resize-none text-sm",disabled:b}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-1.5 leading-snug",children:"L'AI tratta le tue foto come fonte di verità e mantiene identici tutti gli elementi visibili (testi, loghi, badge, pinze freno, quadro strumenti, menu, insegne, packaging). Descrivi solo atmosfera, luce, regia e ritmo."})]}),Ne&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-xs font-medium text-foreground",children:"Stile cinematografico (opzionale)"}),_e&&e.jsxs("span",{className:"text-[11px] text-muted-foreground inline-flex items-center gap-1",children:[e.jsx(z,{className:"w-3 h-3 animate-spin"}),"Analizzo"]})]}),e.jsxs(tt,{value:L??"__none__",onValueChange:t=>Y(t==="__none__"?null:t),disabled:b,children:[e.jsx(st,{className:"h-10 text-sm focus:ring-0",children:e.jsx(rt,{placeholder:"Nessuno stile, usa solo il prompt"})}),e.jsxs(at,{className:"max-h-[320px]",children:[e.jsx(xe,{value:"__none__",children:"Nessuno stile, usa solo il prompt"}),et.map(t=>e.jsx(xe,{value:t.id,children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:"text-sm font-medium",children:t.label}),e.jsx("span",{className:"text-[11px] text-muted-foreground leading-snug",children:t.description})]})},t.id))]})]}),L&&e.jsx("p",{className:"text-[11px] text-muted-foreground leading-snug",children:"Lo stile selezionato definisce regia, ritmo e atmosfera. Il prompt diventa una nota opzionale."})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2 rounded-xl border border-border bg-muted/20 p-4",children:[e.jsx("label",{className:"text-xs font-medium text-foreground",children:"Formato video"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{value:"9:16",label:"9:16 Verticale",Icon:ot},{value:"16:9",label:"16:9 Orizzontale",Icon:lt}].map(({value:t,label:r,Icon:a})=>{const n=ie===t;return e.jsxs("button",{type:"button",onClick:()=>ve(t),disabled:b,className:`flex items-center justify-center gap-1.5 h-10 rounded-lg border text-xs font-medium transition-colors focus:outline-none focus:ring-0 disabled:opacity-50 ${n?"bg-vertical-reel/20 border-vertical-reel/60 text-vertical-reel":"bg-background border-border text-muted-foreground hover:bg-muted/60"}`,children:[e.jsx(a,{className:"w-3.5 h-3.5"}),r]},t)})})]}),e.jsxs("div",{className:"space-y-2 rounded-xl border border-border bg-muted/20 p-4",children:[e.jsx("label",{className:"text-xs font-medium text-foreground",children:"Audio"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{value:!0,label:"Con musica",Icon:it},{value:!1,label:"Senza musica",Icon:nt}].map(({value:t,label:r,Icon:a})=>{const n=ne===t;return e.jsxs("button",{type:"button",onClick:()=>je(t),disabled:b,className:`flex items-center justify-center gap-1.5 h-10 rounded-lg border text-xs font-medium transition-colors focus:outline-none focus:ring-0 disabled:opacity-50 ${n?"bg-vertical-reel/20 border-vertical-reel/60 text-vertical-reel":"bg-background border-border text-muted-foreground hover:bg-muted/60"}`,children:[e.jsx(a,{className:"w-3.5 h-3.5"}),r]},String(t))})})]}),e.jsxs("div",{className:"space-y-2 rounded-xl border border-border bg-muted/20 p-4 sm:col-span-2",children:[e.jsx("label",{className:"text-xs font-medium text-foreground",children:"Qualità"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{value:"hd",label:"HD"},{value:"ultra",label:"Ultra 4K"}].map(({value:t,label:r})=>{const a=K===t;return e.jsx("button",{type:"button",onClick:()=>we(t),disabled:b,className:`flex items-center justify-center gap-1.5 h-10 rounded-lg border text-xs font-medium transition-colors focus:outline-none focus:ring-0 disabled:opacity-50 ${a?"bg-vertical-reel/20 border-vertical-reel/60 text-vertical-reel":"bg-background border-border text-muted-foreground hover:bg-muted/60"}`,children:r},t)})})]})]}),e.jsx(X,{onClick:Pe,disabled:b||u.length===0||!V.trim()&&!L,className:"w-full gap-2 bg-vertical-reel text-vertical-reel-foreground hover:bg-vertical-reel/90",children:b?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"w-4 h-4 animate-spin"}),be||"Genero il reel..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4"}),j?`Genera reel · ${ce} crediti`:"Sblocca Cinema Reel"]})})]}),_?e.jsx("div",{className:"flex items-center justify-center py-20 text-muted-foreground",children:e.jsx(z,{className:"w-5 h-5 animate-spin"})}):x.length===0?e.jsxs("div",{className:"border border-dashed border-border rounded-2xl p-10 text-center",children:[e.jsx("span",{className:"inline-flex w-12 h-12 rounded-2xl bg-vertical-reel/10 text-vertical-reel items-center justify-center mb-3",children:e.jsx(fe,{className:"w-5 h-5"})}),e.jsx("h2",{className:"text-base font-semibold tracking-tight mb-1",children:"Nessun reel ancora"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-md mx-auto",children:"Carica le foto qui sopra, scrivi un prompt e in pochi minuti avrai il tuo primo Cinema Reel pronto per i social."})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("p",{className:"text-xs uppercase tracking-wider text-muted-foreground font-semibold",children:["I tuoi reel (",x.length,")"]})}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-4",children:x.map(t=>e.jsx(ft,{reel:t,paused:!!l,onOpen:()=>{t.status==="completed"&&t.video_url&&(O(t.video_url),y(t))},onPrewarm:()=>O(t.video_url),onDownload:()=>ue(t),onDelete:()=>
11E(t.id)},t.id))})]})]})]})}),e.jsx(Ge,{open:g,onClose:()=>c(!1)}),l&&l.video_url&&e.jsxs("div",{className:"fixed inset-0 z-[200] bg-black/90 backdrop-blur-sm flex items-center justify-center p-4 sm:p-8 animate-in fade-in duration-150",onClick:T,children:[e.jsxs("div",{className:"absolute top-4 right-4 flex items-center gap-2",onClick:t=>t.stopPropagation(),children:[e.jsx("button",{type:"button",onClick:()=>ue(l),className:"w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 text-white flex items-center justify-center transition-colors focus:outline-none focus:ring-0",title:"Scarica",children:e.jsx(ge,{className:"w-4 h-4"})}),e.jsx("button",{type:"button",onClick:T,className:"w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 text-white flex items-center justify-center transition-colors focus:outline-none focus:ring-0",title:"Chiudi",children:e.jsx("span",{className:"text-xl leading-none",children:"×"})})]}),e.jsx("div",{className:l.aspect_ratio==="16:9"?"relative w-full max-w-[calc((100vh-4rem)*16/9)] aspect-video":"relative h-[calc(100vh-4rem)] max-w-full aspect-[9/16]",onClick:t=>t.stopPropagation(),children:e.jsx("video",{ref:A,src:l.video_url,className:"absolute inset-0 w-full h-full object-contain rounded-lg shadow-2xl bg-black",controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",crossOrigin:"anonymous",controlsList:"nodownload noremoteplayback"},l.id)})]}),e.jsx(He,{open:!!f,onOpenChange:t=>!t&&E(null),children:e.jsxs(qe,{children:[e.jsxs(Be,{children:[e.jsx(Xe,{children:"Eliminare questo reel?"}),e.jsx(We,{children:"L'azione è permanente. Il video verrà rimosso dalla tua libreria."})]}),e.jsxs(Qe,{children:[e.jsx(Ke,{disabled:D,children:"Annulla"}),e.jsx(Ye,{onClick:ze,disabled:D,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:D?"Elimino...":"Elimina"})]})]})}),e.jsx(dt,{open:ye,onClose:()=>de(!1),onImport:Se,maxSelection:P,alreadySelected:u.length,onGoToPhotoLab:k})]})};export{vt as default};

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.