1import{j as e,b1 as P,bI as le,aH as Ce,J as Ie,dh as ne,U as Se,dm as Ee,bh as k,dn as Te,cW as Pe,dl as Le,a9 as Ae,dp as qe,aX as Re,ci as Be,$ as Fe,dq as Oe,aw as O,X as ce,dr as ie,b8 as de,G as $e,f9 as Ge,bn as We}from"./ui-vendor-CphGW0d_.js";import{r as f}from"./react-vendor-BOawO_dD.js";import{z as n,J as i,B as C,a0 as $,f as me,C as L,c as A,d as q,s as R,e as B,W as G,L as W,v as De,w as ze,x as D,y as z,I as ge}from"./index-Cn92Z84x.js";import{C as v}from"./categoryDefaultObjects-cAmVYXvV.js";import{u as Me}from"./useMediaLibrary-c3YGtJLd.js";import{c as He,u as Je}from"./react-ecosystem-BT3vmxzF.js";import"./data-vendor-CMH9r-4t.js";const Ve=[{id:"tv-modern",name:"Modern TV",category:"tv",imageUrl:"/assets/homeos/objects/tv.png",thumbnail:"/assets/homeos/objects/tv.png"},{id:"tv-front",name:"Front-Facing TV",category:"tv",imageUrl:"/assets/homeos/objects/tv-front-facing.png",thumbnail:"/assets/homeos/objects/tv-front-facing.png"},{id:"tv-retro",name:"Retro TV",category:"tv",imageUrl:"/assets/homeos/objects/tv-retro.png",thumbnail:"/assets/homeos/objects/tv-retro.png"},{id:"phone-smartphone",name:"Smartphone",category:"phone",imageUrl:"/assets/homeos/objects/phone.png",thumbnail:"/assets/homeos/objects/phone.png"},{id:"phone-tablet",name:"Tablet",category:"phone",imageUrl:"/assets/homeos/objects/tablet.png",thumbnail:"/assets/homeos/objects/tablet.png"},{id:"game-table-wooden",name:"Wooden Table",category:"game_table",imageUrl:"/assets/homeos/objects/game-table.png",thumbnail:"/assets/homeos/objects/game-table.png"},{id:"game-arcade",name:"Arcade Cabinet",category:"game_table",imageUrl:"/assets/homeos/objects/arcade-cabinet.png",thumbnail:"/assets/homeos/objects/arcade-cabinet.png"},{id:"bookshelf-wooden",name:"Wooden Bookshelf",category:"bookshelf",imageUrl:"/assets/homeos/objects/bookshelf.png",thumbnail:"/assets/homeos/objects/bookshelf.png"},{id:"bookshelf-modern",name:"Modern Shelf",category:"bookshelf",imageUrl:"/assets/homeos/objects/bookshelf-modern.png",thumbnail:"/assets/homeos/objects/bookshelf-modern.png"},{id:"whiteboard-standard",name:"Whiteboard",category:"whiteboard",imageUrl:"/assets/homeos/objects/whiteboard.png",thumbnail:"/assets/homeos/objects/whiteboard.png"},{id:"whiteboard-chalkboard",name:"Chalkboard",category:"whiteboard",imageUrl:"/assets/homeos/objects/chalkboard.png",thumbnail:"/assets/homeos/objects/chalkboard.png"},{id:"newspaper-standard",name:"Newspaper",category:"newspaper",imageUrl:"/assets/homeos/objects/newspaper.png",thumbnail:"/assets/homeos/objects/newspaper.png"},{id:"newspaper-magazine",name:"Magazine",category:"newspaper",imageUrl:"/assets/homeos/objects/magazine.png",thumbnail:"/assets/homeos/objects/magazine.png"},{id:"journal-notebook",name:"Notebook",category:"journal",imageUrl:"/assets/homeos/objects/journal.png",thumbnail:"/assets/homeos/objects/journal.png"},{id:"journal-diary",name:"Diary",category:"journal",imageUrl:"/assets/homeos/objects/diary.png",thumbnail:"/assets/homeos/objects/diary.png"},{id:"quote-frame-gold",name:"Gold Frame",category:"quote_frame",imageUrl:"/assets/homeos/objects/frame-gold.png",thumbnail:"/assets/homeos/objects/frame-gold.png"},{id:"quote-frame-wooden",name:"Wooden Frame",category:"quote_frame",imageUrl:"/assets/homeos/objects/frame-wooden.png",thumbnail:"/assets/homeos/objects/frame-wooden.png"},{id:"picture-frame-classic",name:"Classic Frame",category:"picture_frame",imageUrl:"/assets/homeos/objects/picture-frame.png",thumbnail:"/assets/homeos/objects/picture-frame.png"},{id:"picture-polaroid",name:"Polaroid",category:"picture_frame",imageUrl:"/assets/homeos/objects/polaroid.png",thumbnail:"/assets/homeos/objects/polaroid.png"},{id:"boom-box-retro",name:"Retro Boom Box",category:"boom_box",imageUrl:"/assets/homeos/objects/boom-box.png",thumbnail:"/assets/homeos/objects/boom-box.png"},{id:"boom-speaker",name:"Smart Speaker",category:"boom_box",imageUrl:"/assets/homeos/objects/smart-speaker.png",thumbnail:"/assets/homeos/objects/smart-speaker.png"},{id:"boom-headphones",name:"Headphones",category:"boom_box",imageUrl:"/assets/homeos/objects/headphones.png",thumbnail:"/assets/homeos/objects/headphones.png"},{id:"command-computer",name:"Computer",category:"command_center",imageUrl:"/assets/homeos/objects/computer.png",thumbnail:"/assets/homeos/objects/computer.png"}
1,{id:"command-laptop",name:"Laptop",category:"command_center",imageUrl:"/assets/homeos/objects/laptop.png",thumbnail:"/assets/homeos/objects/laptop.png"},{id:"decor-plant",name:"Plant",category:"decor",imageUrl:"/assets/homeos/objects/plant.png",thumbnail:"/assets/homeos/objects/plant.png"},{id:"decor-lamp",name:"Lamp",category:"decor",imageUrl:"/assets/homeos/objects/lamp.png",thumbnail:"/assets/homeos/objects/lamp.png"},{id:"decor-clock",name:"Clock",category:"decor",imageUrl:"/assets/homeos/objects/clock.png",thumbnail:"/assets/homeos/objects/clock.png"}],he=N=>Ve.filter(m=>m.category===N),M={wall_top:{yStart:10,yEnd:35,xPadding:10},surface:{yStart:60,yEnd:80,xPadding:15},floor:{yStart:55,yEnd:75,xPadding:10}},H=(N,m,l)=>{if(N.length===0)return[];const y=[],h=(100-m.xPadding*2)/(N.length+1);return N.forEach((p,u)=>{const _=v[p.category],F=m.xPadding+h*(u+1),S=m.yStart+(m.yEnd-m.yStart)/2;y.push({id:p.id,category:p.category,title:p.title,position:{x:F,y:S,z:l},scale:_?.defaultScale||{width:15,height:15},rotation:0})}),y},Ze=N=>{const m=[],l=[],y=[];N.forEach(u=>{const _=v[u.category];if(!_){l.push(u);return}switch(_.placementZone){case"wall":m.push(u);break;case"surface":l.push(u);break;case"floor":y.push(u);break;default:l.push(u)}});const I=H(m,M.wall_top,3),h=H(y,M.floor,2),p=H(l,M.surface,4);return[...I,...h,...p]},J={tv:Oe,game_table:Fe,phone:Be,whiteboard:Re,newspaper:qe,bookshelf:Ae,journal:Le,quote_frame:Pe,boom_box:Te,picture_frame:k,command_center:Ee,decor:Se},os=()=>{const[N]=He(),m=Je(),l=N.get("roomId"),[y,I]=f.useState(null),[h,p]=f.useState([]),[u,_]=f.useState(null),[F,S]=f.useState(!0),[V,Z]=f.useState(!1),[X,Y]=f.useState(!1),[b,E]=f.useState(""),[w,pe]=f.useState(""),{assets:Q,fetchAssets:ue,getAssetUrl:T,isLoading:be}=Me();f.useEffect(()=>{ue({media_type:"image"})},[]),f.useEffect(()=>{l&&xe()},[l]);const xe=async()=>{if(l){S(!0);try{const{data:s,error:a}=await n.from("homeos_rooms").select("*").eq("id",l).single();if(a)throw a;I(s),E(s.background_image_url||"");const{data:t,error:r}=await n.from("homeos_content_mappings").select(` 2 *, 3 collection_item:collection_items(*) 4 `).eq("room_id",l).order("display_order");if(r)throw r;const g=(t||[]).map(d=>{const c=d.collection_item,U=d.content_metadata||{},_e=c?.text_metadata?.title||c?.video_metadata?.title||c?.quiz_metadata?.title||c?.word_game_metadata?.title||c?.gadget_metadata?.title||c?.task_metadata?.title||c?.file_metadata?.title||"Untitled",oe=U.object_category,ke=d.object_image_url,Ue=he(oe)[0],re=ke||Ue?.imageUrl;return{id:d.id,collectionItemId:c?.id||"",title:_e,contentType:c?.content_type||U.original_type||"unknown",targetCategory:oe,interactionType:U.interaction_type||"focus_blur",objectImageUrl:re,position:void 0,scale:void 0,isAssigned:!!re,roomObjectId:d.room_object_id}}),x=Ze(g.map(d=>({id:d.id,category:d.targetCategory,title:d.title}))),j=g.map(d=>{const c=x.find(U=>U.id===d.id);return{...d,position:c?.position,scale:c?.scale}});p(j)}catch(s){console.error("Error loading room data:",s),i.error("Failed to load room data")}finally{S(!1)}}},K=async(s,a)=>{const{error:t}=await n.from("homeos_content_mappings").update({object_image_url:a}).eq("id",s);if(t)throw console.error("Error saving object image:",t),t},je=async(s,a)=>{try{const{data:{user:t}}=await n.auth.getUser();if(!t)throw new Error("Not authenticated");const r=a.name.split(".").pop(),g=`${t.id}/${l}/${s}.${r}`,{error:x}=await n.storage.from("room-assets").upload(g,a,{upsert:!0});if(x)throw x;const{data:{publicUrl:j}}=n.storage.from("room-assets").getPublicUrl(g);await K(s,j),p(d=>d.map(c=>c.id===s?{...c,objectImageUrl:j,isAssigned:!0}:c)),i.success("Image uploaded and saved!")}catch(t){console.error("Error uploading image:",t),i.error("Failed to upload image")}},ee=async(s,a)=>{try{await K(s,a),p(t=>t.map(r=>r.id===s?{...r,objectImageUrl:a,isAssigned:!0}:r)),i.success("Template selected and saved!")}catch(t){console.error("Error saving template selection:",t),i.error("Failed to save template selection")}},fe=async s=>{try{const{error:a}=await n.from("homeos_content_mappings").update({object_image_url:null}).eq("id",s);if(a)throw a;p(t=>t.map(r=>r.id===s?{...r,objectImageUrl:void 0,isAssigned:!1}:r)),i.success("Image cleared")}catch(a){console.error("Error clearing image:",a),i.error("Failed to clear image")}},Ne=async s=>{try{const{data:{user:a}}=await n.auth.getUser();if(!a)throw new Error("Not authenticated");const t=s.name.split(".").pop(),r=`${a.id}/${l}/background.${t}`,{error:g}=await n.storage.from("room-assets").upload(r,s,{upsert:!0});if(g)throw g;const{data:{publicUrl:x}}=n.storage.from("room-assets").getPublicUrl(r),{error:j}=await n.from("homeos_rooms").update({background_image_url:x}).eq("id",l);if(j)throw j;
4E(x),i.success("Background uploaded and saved!")}catch(a){console.error("Error uploading background:",a),i.error("Failed to upload background")}},ye=async s=>{E(s)},se=async()=>{if(l)try{const{error:s}=await n.from("homeos_rooms").update({background_image_url:b||null}).eq("id",l);if(s)throw s;i.success("Background URL saved")}catch(s){console.error("Error saving background URL:",s),i.error("Failed to save background URL")}},ve=async()=>{if(l){Y(!0);try{const{error:s}=await n.from("homeos_rooms").update({background_image_url:b||null}).eq("id",l);if(s)throw s;i.success("Progress saved!")}catch(s){console.error("Error saving progress:",s),i.error("Failed to save progress")}finally{Y(!1)}}},we=async()=>{if(!(!l||!y)){Z(!0);try{const{error:s}=await n.from("homeos_rooms").update({background_image_url:b}).eq("id",l);if(s)throw s;for(const a of h)if(!(!a.objectImageUrl||!a.position||!a.scale))if(a.roomObjectId){const{data:t,error:r}=await n.from("homeos_room_objects").select("object_id").eq("id",a.roomObjectId).single();if(r){console.error("Error fetching room object:",r);continue}if(t?.object_id){const{error:g}=await n.from("homeos_objects").update({image_url:a.objectImageUrl}).eq("id",t.object_id);g&&console.error("Error updating object image:",g)}}else{const{data:t,error:r}=await n.from("homeos_objects").insert({name:a.title,category:a.targetCategory,object_type:v[a.targetCategory]?.placementZone||"decor",image_url:a.objectImageUrl,default_position:a.position,default_scale:a.scale,default_rotation:0,interaction_type:a.interactionType,is_template:!1}).select().single();if(r)throw r;const{data:g,error:x}=await n.from("homeos_room_objects").insert({room_id:l,object_id:t.id,position:a.position,scale:a.scale,rotation:0,is_interactive:!0,custom_properties:{}}).select().single();if(x)throw x;const{error:j}=await n.from("homeos_content_mappings").update({room_object_id:g.id}).eq("id",a.id);if(j)throw j}i.success("Room assembled successfully!"),m(`/nexus/homeos-builder?roomId=${l}`)}catch(s){console.error("Error saving room:",s),i.error("Failed to save room")}finally{Z(!1)}}},ae=h.filter(s=>s.isAssigned).length,te=h.length,o=h.find(s=>s.id===u);return F?e.jsx("div",{className:"min-h-screen bg-[#0f172a] flex items-center justify-center",children:e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx(P,{className:"h-8 w-8 animate-spin mx-auto text-blue-400"}),e.jsx("p",{className:"text-slate-400",children:"Loading room assembly..."})]})}):y?e.jsx("div",{className:"min-h-screen bg-[#0f172a] text-foreground",children:e.jsx($,{className:"h-screen",children:e.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2 text-foreground",children:[e.jsx(le,{className:"h-6 w-6"}),"Room Assembly: ",y.name]}),e.jsx("p",{className:"text-slate-400 mt-1",children:"Assign images to each content item and position them in the room"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(me,{variant:ae===te?"default":"secondary",className:"bg-slate-700 text-slate-200",children:[ae,"/",te," assigned"]}),e.jsxs(C,{variant:"outline",onClick:ve,disabled:X,className:"gap-2 border-slate-600 text-slate-200 hover:bg-slate-700",children:[X?e.jsx(P,{className:"h-4 w-4 animate-spin"}):e.jsx(Ce,{className:"h-4 w-4"}),"Save Progress"]}),e.jsxs(C,{onClick:we,disabled:V,className:"gap-2",children:[V?e.jsx(P,{className:"h-4 w-4 animate-spin"}):e.jsx(Ie,{className:"h-4 w-4"}),"Continue to Builder"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs(L,{className:"lg:col-span-1 bg-slate-800/50 border-slate-700",children:[e.jsxs(A,{className:"pb-3",children:[e.jsx(q,{className:"text-lg text-foreground",children:"Content Items"}),e.jsx(R,{className:"text-slate-400",children:"Click an item to assign an object image"})]}),e.jsx(B,{className:"p-0",children:e.jsx($,{className:"h-[500px]",children:e.jsx("div",{className:"space-y-1 p-4 pt-0",children:h.length===0?e.jsxs("div",{className:"text-center py-8 text-slate-500",children:[e.jsx(ne,{className:"h-8 w-8 mx-auto mb-2"}),e.jsx("p",{children:"No content items found"})]}):h.map(s=>{const a=J[s.targetCategory]||k,t=u===s.id;return e.jsxs("div",{className:G("flex items-center gap-3 p-3 rounded-lg cursor-pointer transition-colors",t?"bg-blue-500/20 border border-blue-500/40":"hover:bg-slate-700/50",s.isAssigned&&"border-l-4 border-l-green-500"),onClick:()=>_(s.id),children:[e.jsx("div",{className:"flex-shrink-0",children:s.objectImageUrl?e.jsx("img",{src:s.objectImageUrl,alt:s.title,className:"w-10 h-10 rounded object-cover"}):e.jsx("div",{className:"w-10 h-10 rounded bg-slate-700 flex items-center justify-center",children:e.jsx(a,{className:"h-5 w-5 text-slate-400"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-sm truncate text-foreground",children:s.title}),e.jsx("p",{className:"text-xs text-slate-400",children:v[s.targetCategory]?.label||s.targetCategory})]}),s.isAssigned?e.jsx(O,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(me,{variant:"outline",className:"text-xs flex-shrink-0 border-slate-600 text-slate-400",children:"Needs Image"})]},s.id)})})})})]}),e.jsxs(L,{className:"lg:col-span-2 bg-slate-800/50 border-slate-700",children:[e.jsxs(A,{className:"pb-3",children:[e.jsx(q,{className:"text-lg text-foreground",children:o?`Assign Object: ${o.title}`:"Select an Item"}),e.jsx(R,{className:"text-slate-400",children:o?`Upload or select an image for this ${v[o.targetCategory]?.label||"object"}`:"Click on a content item to assign its visual representation"})]}),e.jsx(B,{children:o?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-start gap-4 p-4 bg-slate-700/50 rounded-lg",children:[e.jsx("div",{className:"flex-shrink-0",children:(()=>{const s=J[o.targetCategory]||k;return e.jsx(s,{className:"h-8 w-8 text-blue-400"})})()}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium text-foreground",children:o.title}),e.jsxs("p",{className:"text-sm text-slate-400 mt-1",children:["Content Type: ",o.contentType]}),e.jsxs("p",{className:"text-sm text-slate-400",children:["Target: ",v[o.targetCategory]?.label," (",v[o.targetCategory]?.placementZone," placement)"]}),e.jsxs("p",{className:"text-sm text-slate-400",children:["Interaction: ",o.interactionType]})]})]}),o.objectImageUrl&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{className:"text-slate-300",children:"Current Image"}),e.jsxs("div",{className:"relative w-48 h-48 border border-slate-600 rounded-lg overflow-hidden",children:[e.jsx("img",{src:o.objectImageUrl,alt:o.title,className:"w-full h-full object-contain bg-slate-700"}),e.jsx(C,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>fe(o.id),children:e.jsx(ce,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(W,{className:"text-slate-300",children:"Assign Object Image"}),e.jsxs(De,{defaultValue:"assets",className:"w-full",children:[e.jsxs(ze,{className:"grid w-full grid-cols-3 bg-slate-700",children:[e.jsxs(D,{value:"assets",className:"gap-2 data-[state=active]:bg-slate-600",children:[e.jsx(ie,{className:"h-4 w-4"}),"Asset Gallery"]}),e.jsxs(D,{value:"library",className:"gap-2 data-[state=active]:bg-slate-600",children:[e.jsx(ne,{className:"h-4 w-4"}),"Templates"]}),e.jsxs(D,{value:"upload",className:"gap-2 data-[state=active]:bg-slate-600",children:[e.jsx(de,{className:"h-4 w-4"}),"Upload"]})]}),e.jsx(z,{value:"assets",className:"mt-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx($e,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(ge,{placeholder:"Search assets...",value:w,onChange:s=>pe(s.target.value),className:"pl-9 bg-slate-700 border-slate-600 text-foreground placeholder:text-slate-500"})]}),be?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(P,{className:"h-6 w-6 animate-spin mx-auto text-slate-400"}),e.jsx("p",{className:"text-sm text-slate-400 mt-2",children:"Loading assets..."})]}):e.jsxs($,{className:"h-[280px]",children:[e.jsx("div",{className:"grid grid-cols-4 gap-3",children:Q.filter(s=>!w||s.file_name.toLowerCase().includes(w.toLowerCase())||s.description?.toLowerCase().includes(w.toLowerCase())).map(s=>e.jsxs("div",{className:G("relative cursor-pointer border border-slate-600 rounded-lg overflow-hidden transition-all hover:border-blue-500/50 hover:shadow-md",o.objectImageUrl===T(s.file_path)&&"border-blue-500 ring-2 ring-blue-500/20"),onClick:()=>ee(o.id,T(s.file_path)),children:[e.jsx("div",{className:"aspect-square bg-slate-700",children:e.jsx("img",{src:T(s.file_path),alt:s.file_name,className:"w-full h-full object-contain"})}),e.jsx("div",{className:"p-1.5 bg-slate-800",children:e.jsx("p",{className:"text-xs truncate text-slate-300",children:s.file_name})}),o.objectImageUrl===T(s.file_path)&&e.jsx("div",{className:"absolute top-1 right-1 bg-blue-500 text-foreground rounded-full p-0.5",children:e.jsx(O,{className:"h-3 w-3"})})]},s.id))}),Q.filter(s=>!w||s.file_name.toLowerCase().includes(w.toLowerCase())||s.description?.toLowerCase().includes(w.toLowerCase())).length===0&&e.jsxs("div",{className:"text-center py-8 text-slate-500",children:[e.jsx(ie,{className:"h-8 w-8 mx-auto mb-2"}),e.jsx("p",{className:"text-sm",children:"No assets found"}),e.jsx("p",{className:"text-xs mt-1",children:"Upload assets in /nexus/assets"})]})]})]})}),e.jsx(z,{value:"library",className:"mt-4",children:(()=>{const s=he(o.targetCategory);return s.length===0?e.jsxs("div",{className:"text-center py-8 border border-slate-600 rounded-lg bg-slate-700/30",children:[e.jsx(k,{className:"h-8 w-8 mx-auto text-slate-500 mb-2"}),e.jsxs("p",{className:"text-sm text-slate-400",children:["No templates available for ",v[o.targetCategory]?.label||"this category"]}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Use Asset Gallery or Upload tab instead"})]}):e.jsx("div",{className:"grid grid-cols-3 gap-3",children:s.map(a=>e.jsxs("div",{className:G("relative border border-slate-600 rounded-lg overflow-hidden cursor-pointer transition-all hover:border-blue-500/50 hover:shadow-md",o.objectImageUrl===a.imageUrl&&"border-blue-500 ring-2 ring-blue-500/20"),onClick:()=>ee(o.id,a.imageUrl),children:[e.jsxs("div",{className:"aspect-square bg-slate-700 flex items-center justify-center p-2",children:[e.jsx("img",{src:a.thumbnail,alt:a.name,className:"max-w-full max-h-full object-contain",onError:t=>{t.currentTarget.style.display="none";const r=t.currentTarget.nextElementSibling;r&&(r.style.display="flex")}}),e.jsx("div",{className:"hidden items-center justify-center w-full h-full",children:(()=>{const t=J[o.targetCategory]||k;return e.jsx(t,{className:"h-8 w-8 text-slate-500"})})()})]}),e.jsx("div",{className:"p-2 bg-slate-800",children:e.jsx("p",{className:"text-xs font-medium truncate text-slate-300",children:a.name})}),o.objectImageUrl===a.imageUrl&&e.jsx("div",{className:"absolute top-1 right-1 bg-blue-500 text-foreground rounded-full p-0.5",children:e.jsx(O,{className:"h-3 w-3"})})]},a.id))})})()}),e.jsx(z,{value:"upload",className:"mt-4",children:e.jsxs("div",{className:"border-2 border-dashed border-slate-600 rounded-lg p-8 text-center hover:border-blue-500/50 transition-colors",children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",id:`upload-${o.id}
4`,onChange:s=>{const a=s.target.files?.[0];a&&je(o.id,a)}}),e.jsxs("label",{htmlFor:`upload-${o.id}`,className:"cursor-pointer",children:[e.jsx(Ge,{className:"h-10 w-10 mx-auto text-slate-500 mb-3"}),e.jsx("p",{className:"text-sm font-medium text-slate-300",children:"Click to upload image"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"PNG, JPG, or WebP (recommended: transparent PNG)"})]})]})})]})]}),e.jsxs("p",{className:"text-xs text-slate-500",children:["ð¡ Tip: Use transparent PNGs for best results. The image should represent the ",v[o.targetCategory]?.label?.toLowerCase()||"object"," that students will click to interact with this content."]})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-[400px] text-center",children:[e.jsx(k,{className:"h-12 w-12 text-slate-500 mb-4"}),e.jsx("p",{className:"text-slate-400",children:"Select a content item from the list to assign its object image"})]})})]})]}),e.jsxs(L,{className:"bg-slate-800/50 border-slate-700",children:[e.jsxs(A,{className:"pb-3",children:[e.jsx(q,{className:"text-lg text-foreground",children:"Room Background"}),e.jsx(R,{className:"text-slate-400",children:"Set the background image for this room"})]}),e.jsx(B,{children:e.jsxs("div",{className:"flex items-start gap-6",children:[e.jsx("div",{className:"relative w-64 h-40 border border-slate-600 rounded-lg overflow-hidden bg-slate-700",children:b?e.jsx("img",{src:b,alt:"Room background",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("p",{className:"text-sm text-slate-500",children:"No background set"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"border-2 border-dashed border-slate-600 rounded-lg p-6 text-center hover:border-blue-500/50 transition-colors",children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",id:"upload-background",onChange:s=>{const a=s.target.files?.[0];a&&Ne(a)}}),e.jsxs("label",{htmlFor:"upload-background",className:"cursor-pointer",children:[e.jsx(de,{className:"h-8 w-8 mx-auto text-slate-500 mb-2"}),e.jsx("p",{className:"text-sm font-medium text-slate-300",children:"Upload Background Image"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Recommended: 1920x1080 or similar aspect ratio"})]})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx(W,{htmlFor:"bg-url",className:"text-sm text-slate-300",children:"Or enter image URL"}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(ge,{id:"bg-url",value:b,onChange:s=>ye(s.target.value),onBlur:se,placeholder:"https://...",className:"flex-1 bg-slate-700 border-slate-600 text-foreground placeholder:text-slate-500"}),b&&e.jsx(C,{variant:"outline",size:"icon",className:"border-slate-600",onClick:()=>{E(""),se()},children:e.jsx(ce,{className:"h-4 w-4"})})]})]})]})]})})]}),e.jsxs(L,{className:"bg-slate-800/50 border-slate-700",children:[e.jsxs(A,{className:"pb-3",children:[e.jsxs(q,{className:"text-lg flex items-center gap-2 text-foreground",children:[e.jsx(We,{className:"h-5 w-5"}),"Room Preview"]}),e.jsx(R,{className:"text-slate-400",children:"Visual preview of object placements (positions are approximate)"})]}),e.jsx(B,{children:e.jsxs("div",{className:"relative w-full h-64 rounded-lg overflow-hidden border border-slate-600",style:{backgroundImage:b?`url(${b})`:void 0,backgroundSize:"cover",backgroundPosition:"center",backgroundColor:b?void 0:"#334155"},children:[h.filter(s=>s.objectImageUrl&&s.position).map(s=>e.jsx("div",{className:"absolute cursor-pointer hover:scale-110 transition-transform",style:{left:`${s.position.x}%`,top:`${s.position.y}%`,transform:"translate(-50%, -50%)"},title:s.title,children:e.jsx("img",{src:s.objectImageUrl,alt:s.title,className:"max-w-16 max-h-16 object-contain drop-shadow-lg"})},s.id)),!h.some(s=>s.objectImageUrl)&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("p",{className:"text-slate-400 bg-slate-800/80 px-4 py-2 rounded",children:"Assign images to see preview"})})]})})]})]})})}):e.jsx("div",{className:"min-h-screen bg-[#0f172a] flex items-center justify-center",children:e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx(le,{className:"h-12 w-12 mx-auto text-slate-500"}),e.jsx("p",{className:"text-slate-400",children:"Room not found"}),e.jsx(C,{onClick:()=>m("/nexus/homeos-studio"),children:"Back to Studio"})]})})};export{os 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.