1import{a as i,d as j,j as e}from"./vendor-query-B-_nDQQY.js";import{C as R}from"./vendor-three-1K-S22da.js";import{B as c,v as q,Q as F,t as h,b as v}from"./index-D8ww6b7J.js";import{B as J,a as U}from"./BuilderControlPanel-UYzDoNv8.js";import{S as O}from"./SceneErrorBoundary-BrmzFkjG.js";import{m as A}from"./vendor-framer-DvY-ewtn.js";import{B as N}from"./box-CdJrBTHi.js";import{U as G}from"./undo-B7EFSuy7.js";import{R as K}from"./redo-BxiIyxEn.js";import{S as L}from"./save-d5GEALD8.js";import{L as Q}from"./layers-De-P0_bF.js";import{A as $}from"./arrow-up-Blck6wym.js";import"./vendor-charts-i-522T5A.js";import"./vendor-react-BUIlT3ms.js";import"./vendor-pdf-Bwkk3Ew0.js";import"./vendor-radix-X0WMATEu.js";import"./switch-Qo75U-WC.js";import"./grid-3x3-E2z5-2sj.js";import"./move-D9MCvWLl.js";import"./arrow-right-BeikyhzV.js";function we(){const[n,d]=i.useState([{id:"ct1",type:"countertop",x:-30,y:0,z:0,length:60,width:26,rotationX:0,rotationY:0,rotationZ:0,label:"CT1"},{id:"ct2",type:"countertop",x:30,y:0,z:0,length:60,width:26,rotationX:0,rotationY:90,rotationZ:0,label:"CT2"},{id:"wf1",type:"waterfall",x:-30,y:0,z:-13,length:36,width:2,rotationX:0,rotationY:0,rotationZ:0,label:"WF1"},{id:"bs1",type:"backsplash",x:0,y:4,z:13,length:60,width:2,rotationX:0,rotationY:0,rotationZ:0,label:"BS1"},{id:"sp1",type:"sidepanel",x:60,y:0,z:0,length:36,width:26,rotationX:0,rotationY:90,rotationZ:0,label:"SP1"}]),[m,k]=i.useState(null),[g,S]=i.useState(!0),[p,C]=i.useState(!0),[P,z]=i.useState(0),[f,B]=i.useState(""),[w,Y]=i.useState("assemble"),[l,H]=i.useState([]),[r,x]=i.useState(-1),u=n.find(t=>t.id===m),{data:V=[]}=j({queryKey:["jobs-for-builder"],queryFn:()=>v.entities.Job.list("-job_date",50)}),{data:W=[]}=j({queryKey:["inventory-for-builder"],queryFn:()=>v.entities.Inventory.list()}),b=t=>{if(!u)return;const o=n.map(s=>{if(s.id!==m)return s;let a={};switch(t){case"stand":a={rotationZ:s.rotationZ===0?Math.PI/2:0};break;case"lay":a={rotationZ:0};break;case"rotate90":a={rotationY:(s.rotationY+90)%360};break;case"rotate45":a={rotationY:(s.rotationY+45)%360};break;case"mirror":a={rotationY:(s.rotationY+180)%360};break;case"flip":a={rotationX:s.rotationX===0?Math.PI:0};break;case"nudge-up":a={z:s.z+1};break;case"nudge-down":a={z:s.z-1};break;case"nudge-left":a={x:s.x-1};break;case"nudge-right":a={x:s.x+1};break;case"height":a={y:P||parseFloat(f)||0};break}return{...s,...a}});d(o),y(o)},E=t=>{if(!u)return;const o=n.map(s=>s.id===m?{...s,type:t}:s);d(o),y(o)},y=t=>{const o=l.slice(0,r+1);o.push(JSON.stringify(t)),H(o),x(o.length-1)},Z=()=>{r>0&&(x(r-1),d(JSON.parse(l[r-1])),h.success("Undone"))},I=()=>{r<l.length-1&&(x(r+1),d(JSON.parse(l[r+1])),h.success("Redone"))},X=()=>{h.success("Design saved!")},D=()=>{h.success("Design exported!")},M=t=>{b(`nudge-${t}`)},T=t=>{z(t),b("height")};return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-background via-white to-muted flex flex-col",children:[e.jsx("div",{className:"bg-card backdrop-blur border-b border-border sticky top-0 z-50",children:e.jsx("div",{className:"max-w-[1920px] mx-auto px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(A.div,{initial:{scale:0,rotate:-180},animate:{scale:1,rotate:0},className:"w-12 h-12 rounded-xl bg-gradient-to-br from-primary to-accent flex items-center justify-center shadow-lg",children:e.jsx(N,{className:"w-6 h-6 text-primary-foreground"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-black text-foreground uppercase tracking-wider",children:"3D Builder Studio"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Professional slab manipulation & assembly"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(c,{variant:"outline",size:"sm",onClick:Z,disabled:r<=0,className:"border-slate-700 hover:bg-slate-800 text-slate-300",children:e.jsx(G,{className:"w-4 h-4"})}),e.jsx(c,{variant:"outline",size:"sm",onClick:I,disabled:r>=l.length-1,className:"border-slate-700 hover:bg-slate-800 text-slate-300",children:e.jsx(K,{className:"w-4 h-4"})}),e.jsx("div",{className:"w-px h-6 bg-slate-700"}),e.jsxs(c,{variant:"outline",size:"sm",onClick:D,className:"border-slate-700 hover:bg-slate-800 text-slate-300",children:[e.jsx(q,{className:"w-4 h-4 mr-2"})," Export"]}),e.jsxs(c,{size:"sm",onClick:X,className:"bg-gradient-to-r from-orange-500 to-amber-500 hover:from-orange-600 hover:to-amber-600 text-white shadow-lg shadow-orange-500/30",children:[e.jsx(L,{className:"w-4 h-4 mr-2"})," Save"]})]})]})})}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsx("div",{className:"w-16 bg-muted/50 border-r border-border flex flex-col items-center py-4 gap-2",children:["assemble","splashes","finish","review"].map(t=>e.jsxs(c,{variant:w===t?"default":"ghost",size:"icon",onClick:()=>Y(t),className:`w-12 h-12 rounded-xl transition-all ${w===t?"bg-gradient-to-br from-primary to-accent shadow-lg":"bg-muted/50 hover:bg-muted text-muted-foreground"}`,children:[t==="assemble"&&e.jsx(Q,{className:"w-5 h-5"}),t==="splashes"&&e.jsx($,{className:"w-5 h-5"}),t==="finish"&&e.jsx(F,{className:"w-5 h-5"}),t==="review"&&e.jsx(N,{className:"w-5 h-5"})]},t))}),e.jsxs("div",{className:"flex-1 bg-black relative",children:[e.jsx(O,{children:e.jsx(R,{shadows:!0,className:"w-full h-full",children:e.jsx(J,{pieces:n,selectedPieceId:m,onPieceClick:k,gridSnap:g,magneticEdges:p})})}),e.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-card/90 backdrop-blur border-t border-border px-4 py-2",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:"Click a piece (here or in the 3D) to fine-tune its spot â or drag it onto another slab. Right-click a piece to add / remove a seam."})})]}),e.jsx("div",{className:"w-80 bg-card/95 border-l border-border overflow-y-auto",children:e.jsx(U,{pieces:n,selectedPiece:u,gridSnap:g,magneticEdges:p,onGridSnapChange:S,onMagneticEdgesChange:C,onTransform:b,onTypeChange:E,onNudge:M,onHeightChange:T,customHeight:f,setCustomHeight:B})})]})]})}export{we 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.