Files

1 line
17 KiB
JavaScript

(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,587431,e=>{"use strict";var a=e.i(843476);e.i(958123);var t=e.i(71289),l=e.i(34731);e.i(818350);var r=e.i(173638),i=e.i(953372),n=e.i(415954),s=e.i(817468),o=e.i(6801),c=e.i(949035),d=e.i(127541),p=e.i(768970);e.i(592888);var h=e.i(810741),u=e.i(617128),S=e.i(573474),b=e.i(271645);let g="h-10 w-full rounded-lg border border-border/50 bg-[#2C2C2E] px-3 text-sm text-foreground outline-none transition-colors hover:bg-[#3e3e3e] focus:ring-1 focus:ring-border",m=Object.entries(t.COLUMN_PRESETS).map(([e,a])=>({value:e,label:a.label})),x={slender:{label:"Slender",height:3.6,width:.34,baseHeight:.18,capitalHeight:.16,baseWidthScale:1.18,capitalWidthScale:1.16,edgeSoftness:.02},standard:{label:"Standard",height:2.9,width:.44,baseHeight:.22,capitalHeight:.2,baseWidthScale:1.24,capitalWidthScale:1.22,edgeSoftness:.025},heavy:{label:"Heavy",height:3,width:.58,baseHeight:.28,capitalHeight:.26,baseWidthScale:1.34,capitalWidthScale:1.3,edgeSoftness:.035},stout:{label:"Short / Stout",height:2.2,width:.62,baseHeight:.3,capitalHeight:.28,baseWidthScale:1.38,capitalWidthScale:1.34,edgeSoftness:.04}},v=Object.entries(x).map(([e,a])=>({value:e,label:a.label})),C=[{label:"Vertical",value:"vertical"},{label:"A-Frame",value:"a-frame"},{label:"Y Support",value:"y-frame"},{label:"V Support",value:"v-frame"},{label:"X Brace",value:"x-brace"},{label:"K Brace",value:"k-brace"},{label:"Single Strut",value:"single-strut"},{label:"Tripod",value:"tripod"},{label:"Trestle",value:"trestle"},{label:"Portal Frame",value:"portal-frame"},{label:"Box Frame",value:"box-frame"}],f={"a-frame":{braceBottomSpread:1.4,braceTopSpread:.12,braceWidth:.16,braceDepth:.16},"y-frame":{braceBottomSpread:.2,braceTopSpread:.9,braceWidth:.16,braceDepth:.16},"v-frame":{braceBottomSpread:.2,braceTopSpread:1,braceWidth:.16,braceDepth:.16},"x-brace":{braceBottomSpread:1,braceTopSpread:1,braceWidth:.14,braceDepth:.14},"k-brace":{braceBottomSpread:1,braceTopSpread:1,braceWidth:.14,braceDepth:.14},"single-strut":{braceBottomSpread:.6,braceTopSpread:.6,braceWidth:.12,braceDepth:.12},tripod:{braceBottomSpread:1.1,braceTopSpread:1.1,braceWidth:.12,braceDepth:.12},trestle:{braceBottomSpread:1.2,braceTopSpread:1,braceWidth:.16,braceDepth:.16},"portal-frame":{braceBottomSpread:1.4,braceTopSpread:1,braceWidth:.16,braceDepth:.16},"box-frame":{braceBottomSpread:1.4,braceTopSpread:1,braceWidth:.16,braceDepth:.16}};e.s(["default",0,function(){let e=(0,h.useViewer)(e=>e.selection.selectedIds[0]),j=(0,h.useViewer)(e=>e.selection.selectedIds.length),T=(0,h.useViewer)(e=>e.setSelection),B=(0,l.useScene)(e=>e.updateNode),W=(0,l.useScene)(e=>e.deleteNode),y=(0,p.useEditor)(e=>e.setMovingNode),w=(0,l.useScene)(a=>e?a.nodes[e]:void 0),k=(0,b.useCallback)(a=>{e&&B(e,a)},[e,B]),D=(0,b.useCallback)(()=>{T({selectedIds:[]})},[T]),M=(0,b.useCallback)(()=>{e&&((0,d.triggerSFX)("sfx:structure-delete"),W(e),T({selectedIds:[]}))},[W,e,T]),H=(0,b.useCallback)(()=>{w&&((0,d.triggerSFX)("sfx:item-pick"),y(w),T({selectedIds:[]}))},[w,y,T]);if(!(w&&"column"===w.type&&e&&1===j))return null;let P=w.shaftProfile??"straight",N=w.supportStyle??"vertical",R="a-frame"===N||"y-frame"===N||"v-frame"===N||"x-brace"===N||"k-brace"===N||"single-strut"===N||"tripod"===N||"trestle"===N||"portal-frame"===N||"box-frame"===N;return(0,a.jsxs)(s.PanelWrapper,{icon:"/icons/column.webp",onClose:D,title:w.name||"Column",width:300,children:[(0,a.jsx)(n.PanelSection,{title:"Preset",children:(0,a.jsxs)("select",{className:g,onChange:e=>{e.target.value&&k(function(e){let{label:a,...l}=t.COLUMN_PRESETS[e];return{name:a,supportStyle:"supportStyle"in l?l.supportStyle:"vertical",...l}}(e.target.value))},value:"",children:[(0,a.jsx)("option",{value:"",children:"Apply preset..."}),m.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))]})}),(0,a.jsxs)(n.PanelSection,{title:"Shape",children:[(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2 px-1 pt-1",children:C.map(e=>{let t=N===e.value;return(0,a.jsx)("button",{className:(0,i.cn)("flex min-h-12 items-center rounded-lg border px-3 py-2.5 text-left text-xs transition-colors",t?"border-orange-400/60 bg-orange-400/10 text-foreground":"border-border/50 bg-[#2C2C2E] text-muted-foreground hover:bg-[#3e3e3e] hover:text-foreground"),onClick:()=>{let a="vertical"===e.value?{}:f[e.value];k({supportStyle:e.value,..."vertical"!==e.value?{crossSection:"rectangular",width:w.braceWidth??w.width,depth:w.braceDepth??w.depth,baseStyle:"none",capitalStyle:"none"}:{},...a})},type:"button",children:(0,a.jsx)("span",{className:"truncate font-medium",children:e.label})},e.value)})}),R?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.SliderControl,{label:"Brace Width",max:.8,min:.04,onChange:e=>k({braceWidth:e,width:e}),precision:2,step:.01,unit:"m",value:w.braceWidth??w.width}),(0,a.jsx)(o.SliderControl,{label:"Brace Depth",max:.8,min:.04,onChange:e=>k({braceDepth:e,depth:e}),precision:2,step:.01,unit:"m",value:w.braceDepth??w.depth})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"grid grid-cols-3 gap-2 px-1 pt-1",children:[{value:"round",label:"Round",icon:(0,a.jsx)("svg",{"aria-hidden":"true",fill:"none",height:"22",viewBox:"0 0 22 22",width:"22",children:(0,a.jsx)("circle",{cx:"11",cy:"11",r:"7.5",stroke:"currentColor",strokeWidth:"1.5"})})},{value:"square",label:"Square",icon:(0,a.jsx)("svg",{"aria-hidden":"true",fill:"none",height:"22",viewBox:"0 0 22 22",width:"22",children:(0,a.jsx)("rect",{height:"15",rx:"1.5",stroke:"currentColor",strokeWidth:"1.5",width:"15",x:"3.5",y:"3.5"})})},{value:"rectangular",label:"Rectangular",icon:(0,a.jsx)("svg",{"aria-hidden":"true",fill:"none",height:"22",viewBox:"0 0 22 22",width:"22",children:(0,a.jsx)("rect",{height:"11",rx:"1.5",stroke:"currentColor",strokeWidth:"1.5",width:"16",x:"3",y:"5.5"})})}].map(e=>{let t=w.crossSection===e.value;return(0,a.jsxs)("button",{className:(0,i.cn)("group flex flex-col items-center justify-center gap-1.5 rounded-lg border py-2.5 transition-all",t?"border-orange-400/60 bg-orange-400/10 text-foreground shadow-[0_0_0_1px_rgba(251,146,60,0.25)_inset]":"border-border/50 bg-[#2C2C2E] text-muted-foreground hover:border-border hover:bg-[#3e3e3e] hover:text-foreground"),onClick:()=>k({crossSection:e.value}),type:"button",children:[(0,a.jsx)("span",{className:(0,i.cn)("flex h-7 w-7 items-center justify-center",t?"text-orange-300":"text-muted-foreground/80"),children:e.icon}),(0,a.jsx)("span",{className:"font-medium text-[11px] leading-none tracking-wide",children:e.label})]},e.value)})}),(0,a.jsx)(o.SliderControl,{label:"Edge Softness",max:.12,min:0,onChange:e=>k({edgeSoftness:e}),precision:3,step:.005,unit:"m",value:w.edgeSoftness??.025}),("square"===w.crossSection||"rectangular"===w.crossSection)&&(0,a.jsx)(o.SliderControl,{label:"Shaft Corner Radius",max:.3,min:0,onChange:e=>k({shaftCornerRadius:e}),precision:3,step:.005,unit:"m",value:w.shaftCornerRadius??.035})]})]}),(0,a.jsxs)(n.PanelSection,{title:"Dimensions",children:[!R&&(0,a.jsxs)("select",{className:g,onChange:e=>{var a;let t,l,r;e.target.value&&k((a=w,t=x[e.target.value],l="rectangular"===a.crossSection?Math.min(1.6,Math.max(.12,t.width*(a.depth/Math.max(a.width,.01)))):t.width,r=Math.min(a.shaftCornerRadius??.035,.18*t.width),{height:t.height,width:t.width,depth:l,radius:t.width/2,baseHeight:t.baseHeight,capitalHeight:t.capitalHeight,baseWidthScale:t.baseWidthScale,baseDepthScale:t.baseWidthScale,capitalWidthScale:t.capitalWidthScale,capitalDepthScale:t.capitalWidthScale,edgeSoftness:t.edgeSoftness,shaftCornerRadius:r}))},value:"",children:[(0,a.jsx)("option",{value:"",children:"Apply proportion..."}),v.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,a.jsx)(o.SliderControl,{label:"Height",max:6,min:.8,onChange:e=>k({height:e}),precision:2,step:.05,unit:"m",value:w.height}),R?(0,a.jsxs)(a.Fragment,{children:[("a-frame"===N||"x-brace"===N||"k-brace"===N||"single-strut"===N||"tripod"===N||"trestle"===N||"portal-frame"===N||"box-frame"===N)&&(0,a.jsx)(o.SliderControl,{label:"Bottom Spread",max:4,min:.2,onChange:e=>k({braceBottomSpread:e,braceTopSpread:"a-frame"===N?Math.min(w.braceTopSpread??.12,e):w.braceTopSpread??1}),precision:2,step:.05,unit:"m",value:w.braceBottomSpread??1.2}),(0,a.jsx)(o.SliderControl,{label:"y-frame"===N?"Fork Spread":"Top Spread",max:"y-frame"===N||"v-frame"===N||"x-brace"===N||"k-brace"===N||"single-strut"===N||"tripod"===N||"trestle"===N||"box-frame"===N?4:Math.max(.2,w.braceBottomSpread??1.2),min:0,onChange:e=>k({braceTopSpread:e}),precision:2,step:.02,unit:"m",value:w.braceTopSpread??("y-frame"===N||"v-frame"===N||"x-brace"===N||"k-brace"===N||"single-strut"===N||"tripod"===N||"trestle"===N||"portal-frame"===N||"box-frame"===N?1:.12)}),(0,a.jsx)(c.ToggleControl,{checked:w.bracePlateEnabled??!0,label:"Connector Plates",onChange:e=>k({bracePlateEnabled:e})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.SliderControl,{label:"Width",max:1.6,min:.12,onChange:e=>k({width:e,radius:e/2,..."rectangular"===w.crossSection?{}:{depth:e}}),precision:2,step:.02,unit:"m",value:w.width}),"rectangular"===w.crossSection&&(0,a.jsx)(o.SliderControl,{label:"Depth",max:1.6,min:.12,onChange:e=>k({depth:e}),precision:2,step:.02,unit:"m",value:w.depth})]})]}),!R&&(0,a.jsxs)(n.PanelSection,{title:"Shaft",children:[(0,a.jsxs)("select",{className:g,onChange:e=>{var a;return k("tapered"===(a=e.target.value)?{shaftProfile:a,shaftTaper:.14,shaftBulge:0,shaftStartScale:.82,shaftEndScale:.72,shaftSegmentCount:32}:"bulged"===a?{shaftProfile:a,shaftTaper:0,shaftBulge:.12,shaftStartScale:.68,shaftEndScale:.68,shaftSegmentCount:32}:"hourglass"===a?{shaftProfile:a,shaftTaper:0,shaftBulge:.12,shaftStartScale:.84,shaftEndScale:.84,shaftSegmentCount:32}:{shaftProfile:a,shaftTaper:0,shaftBulge:0,shaftStartScale:.72,shaftEndScale:.72,shaftSegmentCount:1,shaftTwistStep:0})},value:P,children:[(0,a.jsx)("option",{value:"straight",children:"Straight"}),(0,a.jsx)("option",{value:"tapered",children:"Tapered"}),(0,a.jsx)("option",{value:"bulged",children:"Bulged"}),(0,a.jsx)("option",{value:"hourglass",children:"Hourglass"})]}),"straight"===P&&(0,a.jsx)(o.SliderControl,{label:"Shaft Width",max:1.2,min:.3,onChange:e=>k({shaftStartScale:e,shaftEndScale:e}),precision:2,step:.02,value:w.shaftStartScale??.72}),"tapered"===P&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.SliderControl,{label:"Bottom Width",max:1.2,min:.3,onChange:e=>k({shaftStartScale:e}),precision:2,step:.02,value:w.shaftStartScale??.82}),(0,a.jsx)(o.SliderControl,{label:"Top Width",max:1.2,min:.3,onChange:e=>k({shaftEndScale:e}),precision:2,step:.02,value:w.shaftEndScale??.72}),(0,a.jsx)(o.SliderControl,{label:"Taper",max:.45,min:0,onChange:e=>k({shaftTaper:e}),precision:2,step:.01,value:w.shaftTaper??.14})]}),"bulged"===P&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.SliderControl,{label:"End Width",max:1.2,min:.3,onChange:e=>k({shaftStartScale:e,shaftEndScale:e}),precision:2,step:.02,value:w.shaftStartScale??.68}),(0,a.jsx)(o.SliderControl,{label:"Bulge",max:.35,min:0,onChange:e=>k({shaftBulge:e}),precision:2,step:.01,value:w.shaftBulge??.12})]}),"hourglass"===P&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.SliderControl,{label:"End Width",max:1.2,min:.3,onChange:e=>k({shaftStartScale:e,shaftEndScale:e}),precision:2,step:.02,value:w.shaftStartScale??.84}),(0,a.jsx)(o.SliderControl,{label:"Waist",max:.35,min:0,onChange:e=>k({shaftBulge:e}),precision:2,step:.01,value:w.shaftBulge??.12})]}),(0,a.jsx)(o.SliderControl,{label:"Segment Twist",max:90,min:-90,onChange:e=>k({shaftTwistStep:e,...Math.abs(e)>.001&&(w.shaftSegmentCount??1)<8?{shaftSegmentCount:12}:{}}),precision:0,step:5,unit:"°",value:w.shaftTwistStep??0}),Math.abs(w.shaftTwistStep??0)>.001&&(0,a.jsx)(o.SliderControl,{label:"Twist Segments",max:48,min:4,onChange:e=>k({shaftSegmentCount:Math.round(e)}),precision:0,step:1,value:w.shaftSegmentCount??12}),(0,a.jsx)(o.SliderControl,{label:"Ring Pairs",max:4,min:0,onChange:e=>k({ringCount:2*Math.round(e),ringPlacement:"ends",ringSpread:w.ringSpread??.16,ringThickness:w.ringThickness??.055}),precision:0,step:1,value:Math.ceil((w.ringCount??0)/2)}),(w.ringCount??0)>0&&(0,a.jsx)(o.SliderControl,{label:"Ring Thickness",max:.14,min:.01,onChange:e=>k({ringThickness:e}),precision:3,step:.005,unit:"m",value:w.ringThickness??.055}),(w.ringCount??0)>0&&(0,a.jsx)(o.SliderControl,{label:"Ring Spread",max:.45,min:.04,onChange:e=>k({ringSpread:e,ringPlacement:"ends"}),precision:2,step:.01,value:w.ringSpread??.16})]}),!R&&(0,a.jsxs)(n.PanelSection,{title:"Ends",children:[(0,a.jsxs)("select",{className:g,onChange:e=>{let a=e.target.value;k({capitalStyle:a,..."none"===a?{}:{capitalHeight:Math.max(w.capitalHeight,.12),capitalTierCount:"stepped"===a?Math.max(w.capitalTierCount??3,3):w.capitalTierCount,capitalWidthScale:Math.max(w.capitalWidthScale??1.3,"stepped"===a?1.42:1.28),capitalDepthScale:Math.max(w.capitalDepthScale??1.3,"stepped"===a?1.42:1.28),capitalStepSpread:"stepped"===a?Math.max(w.capitalStepSpread??.34,.34):w.capitalStepSpread}})},value:"simple-slab"===w.capitalStyle?"simple":w.capitalStyle??"simple",children:[(0,a.jsx)("option",{value:"none",children:"No Top"}),(0,a.jsx)("option",{value:"simple",children:"Simple Top"}),(0,a.jsx)("option",{value:"stepped",children:"Stepped Top"}),(0,a.jsx)("option",{value:"rounded",children:"Rounded Top"})]}),"none"!==w.capitalStyle&&(0,a.jsx)(o.SliderControl,{label:"Top Height",max:.8,min:.06,onChange:e=>k({capitalHeight:e}),precision:2,step:.02,unit:"m",value:w.capitalHeight}),"none"!==w.capitalStyle&&(0,a.jsx)(o.SliderControl,{label:"Top Width",max:2.4,min:.6,onChange:e=>k({capitalWidthScale:e,..."rectangular"===w.crossSection?{}:{capitalDepthScale:e}}),precision:2,step:.02,value:w.capitalWidthScale??1.28}),"none"!==w.capitalStyle&&"rectangular"===w.crossSection&&(0,a.jsx)(o.SliderControl,{label:"Top Depth",max:2.4,min:.6,onChange:e=>k({capitalDepthScale:e}),precision:2,step:.02,value:w.capitalDepthScale??w.capitalWidthScale??1.28}),"stepped"===w.capitalStyle&&(0,a.jsx)(o.SliderControl,{label:"Top Tiers",max:8,min:3,onChange:e=>k({capitalTierCount:Math.round(e)}),precision:0,step:1,value:w.capitalTierCount??3}),"stepped"===w.capitalStyle&&(0,a.jsx)(o.SliderControl,{label:"Top Step Spread",max:.9,min:.05,onChange:e=>k({capitalStepSpread:e}),precision:2,step:.01,value:w.capitalStepSpread??.34}),(0,a.jsxs)("select",{className:`${g} mt-2`,onChange:e=>{let a=e.target.value;k({baseStyle:a,..."none"===a?{}:{baseHeight:Math.max(w.baseHeight,.12),baseTierCount:"stepped-square"===a?Math.max(w.baseTierCount??3,3):w.baseTierCount,baseWidthScale:Math.max(w.baseWidthScale??1.24,"stepped-square"===a?1.42:1.24),baseDepthScale:Math.max(w.baseDepthScale??1.24,"stepped-square"===a?1.42:1.24),baseStepSpread:"stepped-square"===a?Math.max(w.baseStepSpread??.34,.34):w.baseStepSpread,basePlinthHeightRatio:"round-rings"===a?w.basePlinthHeightRatio??.44:w.basePlinthHeightRatio,baseRoundBandScale:"round-rings"===a?w.baseRoundBandScale??.92:w.baseRoundBandScale,baseNeckScale:"round-rings"===a?w.baseNeckScale??.72:w.baseNeckScale}})},value:w.baseStyle??"square-plinth",children:[(0,a.jsx)("option",{value:"none",children:"No Bottom"}),(0,a.jsx)("option",{value:"simple-square",children:"Simple Block Bottom"}),(0,a.jsx)("option",{value:"square-plinth",children:"Square Plinth Bottom"}),(0,a.jsx)("option",{value:"stepped-square",children:"Stepped Bottom"}),(0,a.jsx)("option",{value:"round-rings",children:"Rounded Bottom"})]}),"none"!==w.baseStyle&&(0,a.jsx)(o.SliderControl,{label:"Bottom Height",max:.8,min:.06,onChange:e=>k({baseHeight:e}),precision:2,step:.02,unit:"m",value:w.baseHeight}),"none"!==w.baseStyle&&(0,a.jsx)(o.SliderControl,{label:"Bottom Width",max:2.4,min:.6,onChange:e=>k({baseWidthScale:e,..."rectangular"===w.crossSection?{}:{baseDepthScale:e}}),precision:2,step:.02,value:w.baseWidthScale??1.24}),"none"!==w.baseStyle&&"rectangular"===w.crossSection&&(0,a.jsx)(o.SliderControl,{label:"Bottom Depth",max:2.4,min:.6,onChange:e=>k({baseDepthScale:e}),precision:2,step:.02,value:w.baseDepthScale??w.baseWidthScale??1.24}),"round-rings"===w.baseStyle&&(0,a.jsx)(o.SliderControl,{label:"Plinth Thickness",max:.7,min:.2,onChange:e=>k({basePlinthHeightRatio:e}),precision:2,step:.01,value:w.basePlinthHeightRatio??.44}),"round-rings"===w.baseStyle&&(0,a.jsx)(o.SliderControl,{label:"Round Band Width",max:1.2,min:.5,onChange:e=>k({baseRoundBandScale:e}),precision:2,step:.01,value:w.baseRoundBandScale??.92}),"round-rings"===w.baseStyle&&(0,a.jsx)(o.SliderControl,{label:"Neck Width",max:1,min:.35,onChange:e=>k({baseNeckScale:e}),precision:2,step:.01,value:w.baseNeckScale??.72}),"stepped-square"===w.baseStyle&&(0,a.jsx)(o.SliderControl,{label:"Bottom Tiers",max:8,min:3,onChange:e=>k({baseTierCount:Math.round(e)}),precision:0,step:1,value:w.baseTierCount??3}),"stepped-square"===w.baseStyle&&(0,a.jsx)(o.SliderControl,{label:"Bottom Step Spread",max:.9,min:.05,onChange:e=>k({baseStepSpread:e}),precision:2,step:.01,value:w.baseStepSpread??.34})]}),(0,a.jsx)(n.PanelSection,{title:"Transform",children:(0,a.jsx)(o.SliderControl,{label:"Yaw",max:180,min:-180,onChange:e=>k({rotation:e*Math.PI/180}),precision:0,step:1,unit:"°",value:Math.round(180*w.rotation/Math.PI)})}),(0,a.jsx)(n.PanelSection,{title:"Actions",children:(0,a.jsxs)(r.ActionGroup,{children:[(0,a.jsx)(r.ActionButton,{icon:(0,a.jsx)(u.Move,{className:"h-4 w-4"}),label:"Move",onClick:H}),(0,a.jsx)(r.ActionButton,{className:"border-red-500/40 text-red-200 hover:bg-red-500/15",icon:(0,a.jsx)(S.Trash2,{className:"h-4 w-4"}),label:"Delete",onClick:M})]})})]})}])}]);