gaesup-world 1.0.29 → 1.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/blueprints-editor.cjs +1 -1
  2. package/dist/blueprints-editor.js +3 -3
  3. package/dist/blueprints.js +3 -3
  4. package/dist/core/building/components/BuildingUI/index.d.ts +21 -1
  5. package/dist/core/building/index.d.ts +1 -0
  6. package/dist/core/building/patterns.d.ts +17 -0
  7. package/dist/core/building/types/index.d.ts +22 -0
  8. package/dist/core/building/visibility/core.d.ts +1 -0
  9. package/dist/core/editor/components/EditorLayout/index.d.ts +1 -1
  10. package/dist/core/editor/components/EditorLayout/types.d.ts +45 -0
  11. package/dist/core/editor/shell.d.ts +3 -1
  12. package/dist/editor.cjs +1 -1
  13. package/dist/editor.js +267 -204
  14. package/dist/{index-CQIEDj8d.cjs → index-B0hwOX6q.cjs} +1 -1
  15. package/dist/{index-DF3L87BM.js → index-B8ox9lF3.js} +7 -7
  16. package/dist/{index-B5Qb5-nX.cjs → index-Bp13moJ5.cjs} +1 -1
  17. package/dist/{index-BNJYLGOq.js → index-CHt-OfEP.js} +10 -10
  18. package/dist/{index-cTsLtH45.cjs → index-CNcFJ4J5.cjs} +1 -1
  19. package/dist/index-CNpM73lW.cjs +1 -0
  20. package/dist/{index-CpI8dvM9.js → index-CbvxHEum.js} +1 -1
  21. package/dist/index-D-Uu0IQI.cjs +1 -0
  22. package/dist/{index-CaHCCnDn.js → index-DzeQOg8X.js} +4 -4
  23. package/dist/{index-DDaaxl5Q.js → index-Vd9e3jH5.js} +15 -15
  24. package/dist/{index-DxF9Qq56.js → index-gU5_l3Dv.js} +1 -1
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.js +13 -13
  27. package/dist/network.cjs +1 -1
  28. package/dist/network.js +4 -4
  29. package/dist/plugin-BD46UWoA.cjs +731 -0
  30. package/dist/{plugin-BgGBEKFI.js → plugin-BaUpXRkW.js} +6012 -5924
  31. package/dist/runtime.cjs +1 -1
  32. package/dist/runtime.js +22 -22
  33. package/dist/{useSpawnFromBlueprint-CMyxfh3o.js → useSpawnFromBlueprint-C_IzLBK5.js} +4 -5
  34. package/package.json +1 -1
  35. package/dist/index-BgfxTfWB.cjs +0 -1
  36. package/dist/index-D9ePpebB.cjs +0 -1
  37. package/dist/plugin-HaNJAUvX.cjs +0 -731
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),E=require("./useSpawnFromBlueprint-CAz_a7R2.cjs"),U=require("@react-three/drei"),W=require("@react-three/fiber"),z=require("@react-three/rapier"),H=require("three"),L=require("./gaesupStore-CRQ-tcIz.cjs"),R=require("./index-B5Qb5-nX.cjs"),V=require("./index-BgfxTfWB.cjs");function Y(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const u in t)if(u!=="default"){const s=Object.getOwnPropertyDescriptor(t,u);Object.defineProperty(o,u,s.get?s:{enumerable:!0,get:()=>t[u]})}}return o.default=t,Object.freeze(o)}const X=Y(H),g=t=>t?.type==="character";function Z({blueprint:t}){const o=L.useGaesupStore(r=>r.setUrls),u=L.useGaesupStore(r=>r.setCameraOption),s=L.useGaesupStore(r=>r.setMode),_=L.useGaesupStore(r=>r.mode),[l,h]=d.useState(20),c=g(t)?t.controls?.clickToMove??!0:!1,v=g(t)?t.controls?.enableKeyboard??!0:!1,A=g(t)?t.controls?.enableMouse??!0:!1;R.useKeyboard(v,v),d.useEffect(()=>{s({type:"character",control:g(t)&&t.camera?.mode||"thirdPerson"});const r=g(t)?t.camera||{}:{};u({xDistance:r.distance?.x||l,yDistance:r.distance?.y||l*.5,zDistance:r.distance?.z||l,offset:new X.Vector3(0,0,0),enableCollision:r.enableCollision??!1,smoothing:r.smoothing||{position:.25,rotation:.3,fov:.2},fov:r.fov||50,zoom:1,enableZoom:r.enableZoom??!0,zoomSpeed:r.zoomSpeed||.001,minZoom:r.minZoom||.5,maxZoom:r.maxZoom||3,enableFocus:!1,maxDistance:50,distance:10,bounds:{minY:2,maxY:50}})},[s,u,l,t]),d.useEffect(()=>{if(g(t)){if(t.visuals?.model)o({characterUrl:t.visuals.model});else if(t.visuals?.parts&&t.visuals.parts.length>0){const r=t.visuals.parts.find(b=>b.type==="body");r&&o({characterUrl:r.url})}}},[t,o]),d.useEffect(()=>{const r=b=>{if(g(t)&&t.camera?.enableZoom===!1)return;b.preventDefault();const N=b.deltaY*.01;h(P=>Math.max(10,Math.min(40,P+N)))};return window.addEventListener("wheel",r,{passive:!1}),()=>window.removeEventListener("wheel",r)},[t]);const C=()=>!g(t)||!t.visuals?.parts?[]:t.visuals.parts.filter(r=>r.type!=="body").map(r=>r.color?{url:r.url,color:r.color}:{url:r.url});return e.jsxs("div",{className:"blueprint-preview",children:[e.jsxs(W.Canvas,{shadows:!0,camera:{position:[0,10,20],fov:50},style:{width:"100%",height:"100%"},children:[e.jsx(V.Camera,{}),e.jsx(U.Environment,{preset:"sunset"}),e.jsx("ambientLight",{intensity:.5}),e.jsx("directionalLight",{castShadow:!0,position:[20,30,10],intensity:.5,"shadow-mapSize":[1024,1024],"shadow-camera-near":1,"shadow-camera-far":120,"shadow-camera-top":90,"shadow-camera-right":90,"shadow-camera-bottom":-90,"shadow-camera-left":-90}),e.jsxs(z.Physics,{debug:!1,gravity:[0,-9.81,0],children:[t&&_?.type==="character"&&e.jsx(R.ControllerWrapper,{controllerOptions:{lerp:{cameraTurn:.1,cameraPosition:.08}},rigidBodyProps:{lockRotations:!0},parts:C(),position:[0,1,0],rotation:z.euler({x:0,y:Math.PI,z:0})},`preview-${t.id}`),c&&e.jsxs(e.Fragment,{children:[e.jsx(R.Clicker,{}),e.jsx(R.GroundClicker,{})]}),e.jsx(z.RigidBody,{type:"fixed",children:e.jsxs("mesh",{receiveShadow:!0,position:[0,-.5,0],children:[e.jsx("boxGeometry",{args:[100,1,100]}),e.jsx("meshStandardMaterial",{color:"#303030"})]})}),e.jsx(U.Grid,{renderOrder:-1,position:[0,.01,0],infiniteGrid:!0,cellSize:1,cellThickness:.5,cellColor:"#404040",sectionSize:5,sectionThickness:1,sectionColor:"#606060",fadeDistance:50,fadeStrength:1,followCamera:!1,userData:{intangible:!0}})]})]}),t&&e.jsxs("div",{className:"blueprint-preview__info",children:[e.jsx("h4",{className:"blueprint-preview__name",children:t.name}),e.jsx("p",{className:"blueprint-preview__type",children:t.type}),g(t)&&t.physics&&e.jsxs("div",{className:"blueprint-preview__stats",children:[e.jsxs("div",{children:["Move Speed: ",t.physics.moveSpeed]}),e.jsxs("div",{children:["Jump Force: ",t.physics.jumpForce]})]}),e.jsxs("div",{className:"blueprint-preview__controls",children:[e.jsxs("div",{children:["Camera: ",g(t)?t.camera?.mode||"thirdPerson":"N/A"]}),e.jsxs("div",{children:["Keyboard: ",v?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Mouse: ",A?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Click to Move: ",c?"Enabled":"Disabled"]})]})]})]})}const ee=t=>{switch(t.type){case"animation-sequence":return"animation";case"behavior-tree":return"behavior";default:return t.type}},K=t=>({id:t.id,name:t.name,type:ee(t),version:t.version,tags:t.tags||[],description:t.description??"",lastModified:new Date().toISOString().split("T")[0]??""}),G=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),te=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!G(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return G(s)?(s[_]=u,!0):!1},se=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],re=({onClose:t})=>{const[o,u]=d.useState("character"),[s,_]=d.useState(null),[l,h]=d.useState(""),[c,v]=d.useState(null),[A,C]=d.useState(!0),{spawnAtCursor:r,isSpawning:b}=E.useSpawnFromBlueprint(),N=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),P=d.useMemo(()=>{const i={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return N.forEach(a=>{a.type in i&&i[a.type]++}),se.map(a=>({...a,count:i[a.type]})).filter(a=>a.count>0)},[N]),w=d.useMemo(()=>N.filter(i=>{const a=i.type===o,m=l===""||i.name.toLowerCase().includes(l.toLowerCase())||i.tags.some(x=>x.toLowerCase().includes(l.toLowerCase()));return a&&m}),[o,l,N]),M=d.useCallback((i,a)=>{v(m=>{if(!m)return null;const x=JSON.parse(JSON.stringify(m));return te(x,i,a)?x:m})},[]),S=d.useCallback(i=>{if(_(i),i){const a=E.blueprintRegistry.get(i);a&&v(JSON.parse(JSON.stringify(a)))}else v(null)},[]);d.useEffect(()=>{const i=w.some(a=>a.id===s);w[0]?.id&&w.length>0&&!i?S(w[0].id):w.length===0&&S(null)},[w,s,S]);const I=async()=>{if(!s)return;await r(s)&&t()},D=(i,a,m)=>Array.isArray(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),e.jsx("div",{className:"blueprint-editor__inspector-list",children:a.length===0?"비어 있음":`${a.length}개 항목`})]},m.join(".")):G(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),Object.entries(a).map(([x,T])=>D(x,T,[...m,x]))]},m.join(".")):typeof a=="boolean"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("button",{className:`blueprint-editor__toggle ${a?"blueprint-editor__toggle--on":""}`,onClick:()=>M(m,!a),children:a?"ON":"OFF"})]},m.join(".")):typeof a=="number"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"number",value:a,onChange:x=>M(m,Number(x.target.value)),className:"blueprint-editor__inspector-input"})]},m.join(".")):e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"text",value:typeof a=="string"?a:"",onChange:x=>M(m,x.target.value),className:"blueprint-editor__inspector-input"})]},m.join("."));return e.jsxs("div",{className:"blueprint-editor",children:[e.jsxs("div",{className:"blueprint-editor__sidebar",children:[e.jsx("div",{className:"blueprint-editor__search",children:e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:l,onChange:i=>h(i.target.value),className:"blueprint-editor__search-input"})}),e.jsx("div",{className:"blueprint-editor__categories",children:P.map(i=>e.jsxs("button",{onClick:()=>u(i.type),className:`blueprint-editor__category ${o===i.type?"active":""}`,children:[e.jsx("span",{className:"blueprint-editor__category-name",children:i.name}),e.jsx("span",{className:"blueprint-editor__category-count",children:i.count})]},i.id))}),e.jsx("div",{className:"blueprint-editor__list",children:w.map(i=>e.jsxs("div",{onClick:()=>S(i.id),className:`blueprint-editor__item ${s===i.id?"active":""}`,children:[e.jsx("div",{className:"blueprint-editor__item-name",children:i.name}),e.jsx("div",{className:"blueprint-editor__item-tags",children:i.tags.map(a=>e.jsx("span",{className:"blueprint-editor__tag",children:a},a))})]},i.id))}),e.jsx("div",{className:"blueprint-editor__actions",children:e.jsx("button",{onClick:I,disabled:!s||b,className:"blueprint-editor__spawn-button",children:b?"Spawning...":"Spawn Entity"})})]}),e.jsxs("div",{className:"blueprint-editor__main",children:[e.jsxs("div",{className:"blueprint-editor__preview-section",children:[e.jsxs("div",{className:"blueprint-editor__preview-header",children:[e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Preview"}),e.jsx("button",{onClick:()=>C(!A),className:"blueprint-editor__preview-toggle",children:A?"Hide":"Show"})]}),A&&e.jsx("div",{className:"blueprint-editor__preview-container",children:e.jsx(Z,{blueprint:c},c?c.id:"no-blueprint")})]}),e.jsxs("div",{className:"blueprint-editor__inspector-section",children:[e.jsx("div",{className:"blueprint-editor__preview-header",children:e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Inspector"})}),e.jsx("div",{className:"blueprint-editor__inspector",children:c?Object.entries(c).map(([i,a])=>D(i,a,[i])):e.jsx("div",{className:"blueprint-editor__empty",children:"블루프린트를 선택하세요."})})]})]})]})},F=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),ie=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!F(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return F(s)?(s[_]=u,!0):!1},ne=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],ae=({className:t="",style:o,children:u})=>{const[s,_]=d.useState("character"),[l,h]=d.useState(null),[c,v]=d.useState(""),[A,C]=d.useState(!1),[r,b]=d.useState(null),[N,P]=d.useState(!1),{spawnAtCursor:w,isSpawning:M}=E.useSpawnFromBlueprint(),S=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),I=d.useMemo(()=>{const n={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return S.forEach(p=>{p.type in n&&n[p.type]++}),ne.map(p=>({...p,count:n[p.type]}))},[S]),D=d.useMemo(()=>S.filter(n=>{const p=n.type===s,j=c===""||n.name.toLowerCase().includes(c.toLowerCase())||n.tags.some(f=>f.toLowerCase().includes(c.toLowerCase()));return p&&j}),[s,c,S]),i=n=>{h(n);const p=E.blueprintRegistry.get(n);p&&b(JSON.parse(JSON.stringify(p)))},a=()=>{C(!0)},m=()=>{r&&(E.blueprintRegistry.register(r),C(!1),P(!1),i(r.id))},x=()=>{if(C(!1),l){const n=E.blueprintRegistry.get(l);n&&b(JSON.parse(JSON.stringify(n)))}},T=()=>{let n;const p={id:`custom_${s}_${Date.now()}`,name:`New ${s.charAt(0).toUpperCase()+s.slice(1)}`,version:"1.0.0",tags:["custom"],description:"Custom blueprint"};switch(s){case"vehicle":n={...p,type:"vehicle",physics:{mass:1e3,maxSpeed:30,acceleration:10,braking:15,turning:2},seats:[{position:[0,1,0],isDriver:!0}],animations:{idle:""}};break;case"airplane":n={...p,type:"airplane",physics:{mass:2e3,maxSpeed:100,acceleration:20,turning:1,lift:50,drag:10},seats:[{position:[0,1,2],isDriver:!0}],animations:{idle:""}};break;default:n={...p,type:"character",physics:{mass:70,height:1.8,radius:.3,jumpForce:300,moveSpeed:5,runSpeed:10,airControl:.2},animations:{idle:"",walk:"",run:"",jump:{start:"",loop:"",land:""}},stats:{health:100,stamina:50,strength:10,defense:10,speed:10}}}b(n),h(n.id),P(!0),C(!0)},q=(n,p)=>{if(!r)return;const j=JSON.parse(JSON.stringify(r));ie(j,n,p)&&b(j)},J=(n,p=[])=>{const j=[];return Object.entries(n).forEach(([f,y])=>{const k=[...p,f],O=k.join(".");f==="id"||f==="type"?j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y,disabled:!0,className:"property-editor__input property-editor__input--disabled"})]},O)):F(y)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:J(y,k)})]},O)):Array.isArray(y)?y.length>0&&y.every(F)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:y.map((B,$)=>e.jsxs("div",{className:"property-editor__array-item",children:[e.jsxs("div",{className:"property-editor__array-item-title editor-text-small",children:["Item ",$+1]}),J(B,[...k,$.toString()])]},`${O}.${$}`))})]},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y.join(", "),onChange:B=>q(k,B.target.value.split(",").map($=>$.trim())),className:"property-editor__input"})]},O)):typeof y=="boolean"?j.push(e.jsx("div",{className:"property-editor__field",children:e.jsxs("label",{className:"property-editor__checkbox-label editor-text-small",children:[e.jsx("input",{type:"checkbox",checked:y,onChange:B=>q(k,B.target.checked),className:"property-editor__checkbox"}),f]})},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:typeof y=="number"?"number":"text",value:y,onChange:B=>q(k,typeof y=="number"?Number(B.target.value):B.target.value),className:"property-editor__input"})]},O))}),j},Q=async()=>{!l||await w(l)};return e.jsxs("div",{className:`blueprint-panel ${t}`,style:o,children:[e.jsx("h3",{className:"editor-title",children:"Blueprint Library"}),e.jsx("div",{className:"blueprint-panel__toolbar",children:e.jsxs("div",{className:"blueprint-panel__search-container",children:[e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:c,onChange:n=>v(n.target.value),className:"blueprint-panel__search-input"}),e.jsx("button",{onClick:T,className:"blueprint-panel__button blueprint-panel__button--primary",children:"+ New Blueprint"})]})}),e.jsx("div",{className:"blueprint-panel__categories",children:I.map(n=>e.jsxs("button",{onClick:()=>_(n.type),className:`blueprint-panel__category-button ${s===n.type?"blueprint-panel__category-button--active":""}`,children:[e.jsx("span",{children:n.name}),e.jsxs("span",{children:["(",n.count,")"]})]},n.id))}),A?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__property-editor-container editor-scrollbar",children:r&&e.jsxs("div",{children:[e.jsx("h4",{className:"blueprint-panel__property-editor-title editor-text",children:N?"Create New Blueprint":`Edit: ${r.name}`}),J(r)]})}),e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:m,className:"blueprint-panel__button blueprint-panel__button--primary",children:N?"Create":"Save"}),e.jsx("button",{onClick:x,className:"blueprint-panel__button blueprint-panel__button--danger",children:"Cancel"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__list editor-scrollbar",children:D.length===0?e.jsx("div",{className:"blueprint-panel__empty-message editor-text-small",children:"No blueprints found"}):D.map(n=>e.jsx("div",{onClick:()=>i(n.id),className:`blueprint-panel__list-item ${l===n.id?"blueprint-panel__list-item--selected":""}`,children:e.jsxs("div",{className:"list-item__content",children:[e.jsxs("div",{className:"list-item__text-content",children:[e.jsx("div",{className:"list-item__name editor-text",children:n.name}),e.jsx("div",{className:"list-item__description editor-text-small",children:n.description}),e.jsx("div",{className:"list-item__tags",children:n.tags.map(p=>e.jsx("span",{className:"list-item__tag editor-text-small",children:p},p))})]}),e.jsxs("div",{className:"list-item__meta editor-text-small",children:[e.jsxs("div",{children:["v",n.version]}),e.jsx("div",{children:n.lastModified})]})]})},n.id))}),l&&e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:a,className:"blueprint-panel__button blueprint-panel__button--secondary",children:"Edit Blueprint"}),e.jsx("button",{onClick:Q,disabled:M,className:"blueprint-panel__button blueprint-panel__button--primary",children:M?"Spawning...":"Spawn Entity"})]})})]}),u]})};exports.BlueprintEditor=re;exports.BlueprintPanel=ae;exports.BlueprintPreview=Z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),E=require("./useSpawnFromBlueprint-CAz_a7R2.cjs"),U=require("@react-three/drei"),W=require("@react-three/fiber"),z=require("@react-three/rapier"),H=require("three"),L=require("./gaesupStore-CRQ-tcIz.cjs"),R=require("./index-Bp13moJ5.cjs"),V=require("./index-CNpM73lW.cjs");function Y(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const u in t)if(u!=="default"){const s=Object.getOwnPropertyDescriptor(t,u);Object.defineProperty(o,u,s.get?s:{enumerable:!0,get:()=>t[u]})}}return o.default=t,Object.freeze(o)}const X=Y(H),g=t=>t?.type==="character";function Z({blueprint:t}){const o=L.useGaesupStore(r=>r.setUrls),u=L.useGaesupStore(r=>r.setCameraOption),s=L.useGaesupStore(r=>r.setMode),_=L.useGaesupStore(r=>r.mode),[l,h]=d.useState(20),c=g(t)?t.controls?.clickToMove??!0:!1,v=g(t)?t.controls?.enableKeyboard??!0:!1,A=g(t)?t.controls?.enableMouse??!0:!1;R.useKeyboard(v,v),d.useEffect(()=>{s({type:"character",control:g(t)&&t.camera?.mode||"thirdPerson"});const r=g(t)?t.camera||{}:{};u({xDistance:r.distance?.x||l,yDistance:r.distance?.y||l*.5,zDistance:r.distance?.z||l,offset:new X.Vector3(0,0,0),enableCollision:r.enableCollision??!1,smoothing:r.smoothing||{position:.25,rotation:.3,fov:.2},fov:r.fov||50,zoom:1,enableZoom:r.enableZoom??!0,zoomSpeed:r.zoomSpeed||.001,minZoom:r.minZoom||.5,maxZoom:r.maxZoom||3,enableFocus:!1,maxDistance:50,distance:10,bounds:{minY:2,maxY:50}})},[s,u,l,t]),d.useEffect(()=>{if(g(t)){if(t.visuals?.model)o({characterUrl:t.visuals.model});else if(t.visuals?.parts&&t.visuals.parts.length>0){const r=t.visuals.parts.find(b=>b.type==="body");r&&o({characterUrl:r.url})}}},[t,o]),d.useEffect(()=>{const r=b=>{if(g(t)&&t.camera?.enableZoom===!1)return;b.preventDefault();const N=b.deltaY*.01;h(P=>Math.max(10,Math.min(40,P+N)))};return window.addEventListener("wheel",r,{passive:!1}),()=>window.removeEventListener("wheel",r)},[t]);const C=()=>!g(t)||!t.visuals?.parts?[]:t.visuals.parts.filter(r=>r.type!=="body").map(r=>r.color?{url:r.url,color:r.color}:{url:r.url});return e.jsxs("div",{className:"blueprint-preview",children:[e.jsxs(W.Canvas,{shadows:!0,camera:{position:[0,10,20],fov:50},style:{width:"100%",height:"100%"},children:[e.jsx(V.Camera,{}),e.jsx(U.Environment,{preset:"sunset"}),e.jsx("ambientLight",{intensity:.5}),e.jsx("directionalLight",{castShadow:!0,position:[20,30,10],intensity:.5,"shadow-mapSize":[1024,1024],"shadow-camera-near":1,"shadow-camera-far":120,"shadow-camera-top":90,"shadow-camera-right":90,"shadow-camera-bottom":-90,"shadow-camera-left":-90}),e.jsxs(z.Physics,{debug:!1,gravity:[0,-9.81,0],children:[t&&_?.type==="character"&&e.jsx(R.ControllerWrapper,{controllerOptions:{lerp:{cameraTurn:.1,cameraPosition:.08}},rigidBodyProps:{lockRotations:!0},parts:C(),position:[0,1,0],rotation:z.euler({x:0,y:Math.PI,z:0})},`preview-${t.id}`),c&&e.jsxs(e.Fragment,{children:[e.jsx(R.Clicker,{}),e.jsx(R.GroundClicker,{})]}),e.jsx(z.RigidBody,{type:"fixed",children:e.jsxs("mesh",{receiveShadow:!0,position:[0,-.5,0],children:[e.jsx("boxGeometry",{args:[100,1,100]}),e.jsx("meshStandardMaterial",{color:"#303030"})]})}),e.jsx(U.Grid,{renderOrder:-1,position:[0,.01,0],infiniteGrid:!0,cellSize:1,cellThickness:.5,cellColor:"#404040",sectionSize:5,sectionThickness:1,sectionColor:"#606060",fadeDistance:50,fadeStrength:1,followCamera:!1,userData:{intangible:!0}})]})]}),t&&e.jsxs("div",{className:"blueprint-preview__info",children:[e.jsx("h4",{className:"blueprint-preview__name",children:t.name}),e.jsx("p",{className:"blueprint-preview__type",children:t.type}),g(t)&&t.physics&&e.jsxs("div",{className:"blueprint-preview__stats",children:[e.jsxs("div",{children:["Move Speed: ",t.physics.moveSpeed]}),e.jsxs("div",{children:["Jump Force: ",t.physics.jumpForce]})]}),e.jsxs("div",{className:"blueprint-preview__controls",children:[e.jsxs("div",{children:["Camera: ",g(t)?t.camera?.mode||"thirdPerson":"N/A"]}),e.jsxs("div",{children:["Keyboard: ",v?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Mouse: ",A?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Click to Move: ",c?"Enabled":"Disabled"]})]})]})]})}const ee=t=>{switch(t.type){case"animation-sequence":return"animation";case"behavior-tree":return"behavior";default:return t.type}},K=t=>({id:t.id,name:t.name,type:ee(t),version:t.version,tags:t.tags||[],description:t.description??"",lastModified:new Date().toISOString().split("T")[0]??""}),G=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),te=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!G(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return G(s)?(s[_]=u,!0):!1},se=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],re=({onClose:t})=>{const[o,u]=d.useState("character"),[s,_]=d.useState(null),[l,h]=d.useState(""),[c,v]=d.useState(null),[A,C]=d.useState(!0),{spawnAtCursor:r,isSpawning:b}=E.useSpawnFromBlueprint(),N=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),P=d.useMemo(()=>{const i={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return N.forEach(a=>{a.type in i&&i[a.type]++}),se.map(a=>({...a,count:i[a.type]})).filter(a=>a.count>0)},[N]),w=d.useMemo(()=>N.filter(i=>{const a=i.type===o,m=l===""||i.name.toLowerCase().includes(l.toLowerCase())||i.tags.some(x=>x.toLowerCase().includes(l.toLowerCase()));return a&&m}),[o,l,N]),M=d.useCallback((i,a)=>{v(m=>{if(!m)return null;const x=JSON.parse(JSON.stringify(m));return te(x,i,a)?x:m})},[]),S=d.useCallback(i=>{if(_(i),i){const a=E.blueprintRegistry.get(i);a&&v(JSON.parse(JSON.stringify(a)))}else v(null)},[]);d.useEffect(()=>{const i=w.some(a=>a.id===s);w[0]?.id&&w.length>0&&!i?S(w[0].id):w.length===0&&S(null)},[w,s,S]);const I=async()=>{if(!s)return;await r(s)&&t()},D=(i,a,m)=>Array.isArray(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),e.jsx("div",{className:"blueprint-editor__inspector-list",children:a.length===0?"비어 있음":`${a.length}개 항목`})]},m.join(".")):G(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),Object.entries(a).map(([x,T])=>D(x,T,[...m,x]))]},m.join(".")):typeof a=="boolean"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("button",{className:`blueprint-editor__toggle ${a?"blueprint-editor__toggle--on":""}`,onClick:()=>M(m,!a),children:a?"ON":"OFF"})]},m.join(".")):typeof a=="number"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"number",value:a,onChange:x=>M(m,Number(x.target.value)),className:"blueprint-editor__inspector-input"})]},m.join(".")):e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"text",value:typeof a=="string"?a:"",onChange:x=>M(m,x.target.value),className:"blueprint-editor__inspector-input"})]},m.join("."));return e.jsxs("div",{className:"blueprint-editor",children:[e.jsxs("div",{className:"blueprint-editor__sidebar",children:[e.jsx("div",{className:"blueprint-editor__search",children:e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:l,onChange:i=>h(i.target.value),className:"blueprint-editor__search-input"})}),e.jsx("div",{className:"blueprint-editor__categories",children:P.map(i=>e.jsxs("button",{onClick:()=>u(i.type),className:`blueprint-editor__category ${o===i.type?"active":""}`,children:[e.jsx("span",{className:"blueprint-editor__category-name",children:i.name}),e.jsx("span",{className:"blueprint-editor__category-count",children:i.count})]},i.id))}),e.jsx("div",{className:"blueprint-editor__list",children:w.map(i=>e.jsxs("div",{onClick:()=>S(i.id),className:`blueprint-editor__item ${s===i.id?"active":""}`,children:[e.jsx("div",{className:"blueprint-editor__item-name",children:i.name}),e.jsx("div",{className:"blueprint-editor__item-tags",children:i.tags.map(a=>e.jsx("span",{className:"blueprint-editor__tag",children:a},a))})]},i.id))}),e.jsx("div",{className:"blueprint-editor__actions",children:e.jsx("button",{onClick:I,disabled:!s||b,className:"blueprint-editor__spawn-button",children:b?"Spawning...":"Spawn Entity"})})]}),e.jsxs("div",{className:"blueprint-editor__main",children:[e.jsxs("div",{className:"blueprint-editor__preview-section",children:[e.jsxs("div",{className:"blueprint-editor__preview-header",children:[e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Preview"}),e.jsx("button",{onClick:()=>C(!A),className:"blueprint-editor__preview-toggle",children:A?"Hide":"Show"})]}),A&&e.jsx("div",{className:"blueprint-editor__preview-container",children:e.jsx(Z,{blueprint:c},c?c.id:"no-blueprint")})]}),e.jsxs("div",{className:"blueprint-editor__inspector-section",children:[e.jsx("div",{className:"blueprint-editor__preview-header",children:e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Inspector"})}),e.jsx("div",{className:"blueprint-editor__inspector",children:c?Object.entries(c).map(([i,a])=>D(i,a,[i])):e.jsx("div",{className:"blueprint-editor__empty",children:"블루프린트를 선택하세요."})})]})]})]})},F=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),ie=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!F(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return F(s)?(s[_]=u,!0):!1},ne=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],ae=({className:t="",style:o,children:u})=>{const[s,_]=d.useState("character"),[l,h]=d.useState(null),[c,v]=d.useState(""),[A,C]=d.useState(!1),[r,b]=d.useState(null),[N,P]=d.useState(!1),{spawnAtCursor:w,isSpawning:M}=E.useSpawnFromBlueprint(),S=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),I=d.useMemo(()=>{const n={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return S.forEach(p=>{p.type in n&&n[p.type]++}),ne.map(p=>({...p,count:n[p.type]}))},[S]),D=d.useMemo(()=>S.filter(n=>{const p=n.type===s,j=c===""||n.name.toLowerCase().includes(c.toLowerCase())||n.tags.some(f=>f.toLowerCase().includes(c.toLowerCase()));return p&&j}),[s,c,S]),i=n=>{h(n);const p=E.blueprintRegistry.get(n);p&&b(JSON.parse(JSON.stringify(p)))},a=()=>{C(!0)},m=()=>{r&&(E.blueprintRegistry.register(r),C(!1),P(!1),i(r.id))},x=()=>{if(C(!1),l){const n=E.blueprintRegistry.get(l);n&&b(JSON.parse(JSON.stringify(n)))}},T=()=>{let n;const p={id:`custom_${s}_${Date.now()}`,name:`New ${s.charAt(0).toUpperCase()+s.slice(1)}`,version:"1.0.0",tags:["custom"],description:"Custom blueprint"};switch(s){case"vehicle":n={...p,type:"vehicle",physics:{mass:1e3,maxSpeed:30,acceleration:10,braking:15,turning:2},seats:[{position:[0,1,0],isDriver:!0}],animations:{idle:""}};break;case"airplane":n={...p,type:"airplane",physics:{mass:2e3,maxSpeed:100,acceleration:20,turning:1,lift:50,drag:10},seats:[{position:[0,1,2],isDriver:!0}],animations:{idle:""}};break;default:n={...p,type:"character",physics:{mass:70,height:1.8,radius:.3,jumpForce:300,moveSpeed:5,runSpeed:10,airControl:.2},animations:{idle:"",walk:"",run:"",jump:{start:"",loop:"",land:""}},stats:{health:100,stamina:50,strength:10,defense:10,speed:10}}}b(n),h(n.id),P(!0),C(!0)},q=(n,p)=>{if(!r)return;const j=JSON.parse(JSON.stringify(r));ie(j,n,p)&&b(j)},J=(n,p=[])=>{const j=[];return Object.entries(n).forEach(([f,y])=>{const k=[...p,f],O=k.join(".");f==="id"||f==="type"?j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y,disabled:!0,className:"property-editor__input property-editor__input--disabled"})]},O)):F(y)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:J(y,k)})]},O)):Array.isArray(y)?y.length>0&&y.every(F)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:y.map((B,$)=>e.jsxs("div",{className:"property-editor__array-item",children:[e.jsxs("div",{className:"property-editor__array-item-title editor-text-small",children:["Item ",$+1]}),J(B,[...k,$.toString()])]},`${O}.${$}`))})]},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y.join(", "),onChange:B=>q(k,B.target.value.split(",").map($=>$.trim())),className:"property-editor__input"})]},O)):typeof y=="boolean"?j.push(e.jsx("div",{className:"property-editor__field",children:e.jsxs("label",{className:"property-editor__checkbox-label editor-text-small",children:[e.jsx("input",{type:"checkbox",checked:y,onChange:B=>q(k,B.target.checked),className:"property-editor__checkbox"}),f]})},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:typeof y=="number"?"number":"text",value:y,onChange:B=>q(k,typeof y=="number"?Number(B.target.value):B.target.value),className:"property-editor__input"})]},O))}),j},Q=async()=>{!l||await w(l)};return e.jsxs("div",{className:`blueprint-panel ${t}`,style:o,children:[e.jsx("h3",{className:"editor-title",children:"Blueprint Library"}),e.jsx("div",{className:"blueprint-panel__toolbar",children:e.jsxs("div",{className:"blueprint-panel__search-container",children:[e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:c,onChange:n=>v(n.target.value),className:"blueprint-panel__search-input"}),e.jsx("button",{onClick:T,className:"blueprint-panel__button blueprint-panel__button--primary",children:"+ New Blueprint"})]})}),e.jsx("div",{className:"blueprint-panel__categories",children:I.map(n=>e.jsxs("button",{onClick:()=>_(n.type),className:`blueprint-panel__category-button ${s===n.type?"blueprint-panel__category-button--active":""}`,children:[e.jsx("span",{children:n.name}),e.jsxs("span",{children:["(",n.count,")"]})]},n.id))}),A?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__property-editor-container editor-scrollbar",children:r&&e.jsxs("div",{children:[e.jsx("h4",{className:"blueprint-panel__property-editor-title editor-text",children:N?"Create New Blueprint":`Edit: ${r.name}`}),J(r)]})}),e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:m,className:"blueprint-panel__button blueprint-panel__button--primary",children:N?"Create":"Save"}),e.jsx("button",{onClick:x,className:"blueprint-panel__button blueprint-panel__button--danger",children:"Cancel"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__list editor-scrollbar",children:D.length===0?e.jsx("div",{className:"blueprint-panel__empty-message editor-text-small",children:"No blueprints found"}):D.map(n=>e.jsx("div",{onClick:()=>i(n.id),className:`blueprint-panel__list-item ${l===n.id?"blueprint-panel__list-item--selected":""}`,children:e.jsxs("div",{className:"list-item__content",children:[e.jsxs("div",{className:"list-item__text-content",children:[e.jsx("div",{className:"list-item__name editor-text",children:n.name}),e.jsx("div",{className:"list-item__description editor-text-small",children:n.description}),e.jsx("div",{className:"list-item__tags",children:n.tags.map(p=>e.jsx("span",{className:"list-item__tag editor-text-small",children:p},p))})]}),e.jsxs("div",{className:"list-item__meta editor-text-small",children:[e.jsxs("div",{children:["v",n.version]}),e.jsx("div",{children:n.lastModified})]})]})},n.id))}),l&&e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:a,className:"blueprint-panel__button blueprint-panel__button--secondary",children:"Edit Blueprint"}),e.jsx("button",{onClick:Q,disabled:M,className:"blueprint-panel__button blueprint-panel__button--primary",children:M?"Spawning...":"Spawn Entity"})]})})]}),u]})};exports.BlueprintEditor=re;exports.BlueprintPanel=ae;exports.BlueprintPreview=Z;
@@ -1,13 +1,13 @@
1
1
  import { jsxs as i, jsx as e, Fragment as K } from "react/jsx-runtime";
2
2
  import { useState as g, useEffect as F, useMemo as M, useCallback as Q } from "react";
3
- import { u as W, b as D } from "./useSpawnFromBlueprint-CMyxfh3o.js";
3
+ import { u as W, b as D } from "./useSpawnFromBlueprint-C_IzLBK5.js";
4
4
  import { Environment as H, Grid as q } from "@react-three/drei";
5
5
  import { Canvas as X } from "@react-three/fiber";
6
6
  import { Physics as ee, euler as te, RigidBody as ie } from "@react-three/rapier";
7
7
  import * as re from "three";
8
8
  import { u as J } from "./gaesupStore-x2iiDzsY.js";
9
- import { u as ne, C as ae, a as se, G as oe } from "./index-DF3L87BM.js";
10
- import { C as le } from "./index-BNJYLGOq.js";
9
+ import { u as ne, C as ae, a as se, G as oe } from "./index-B8ox9lF3.js";
10
+ import { C as le } from "./index-CHt-OfEP.js";
11
11
  const w = (t) => t?.type === "character";
12
12
  function ce({ blueprint: t }) {
13
13
  const d = J((n) => n.setUrls), b = J((n) => n.setCameraOption), r = J((n) => n.setMode), h = J((n) => n.mode), [l, u] = g(20), c = w(t) ? t.controls?.clickToMove ?? !0 : !1, C = w(t) ? t.controls?.enableKeyboard ?? !0 : !1, O = w(t) ? t.controls?.enableMouse ?? !0 : !1;
@@ -1,5 +1,5 @@
1
- import { b as x } from "./useSpawnFromBlueprint-CMyxfh3o.js";
2
- import { B as ee, F as te, W as ie, u as se } from "./useSpawnFromBlueprint-CMyxfh3o.js";
1
+ import { b as x } from "./useSpawnFromBlueprint-C_IzLBK5.js";
2
+ import { B as ee, F as te, W as ie, u as se } from "./useSpawnFromBlueprint-C_IzLBK5.js";
3
3
  import { jsx as C } from "react/jsx-runtime";
4
4
  import { useMemo as z, useRef as m, useEffect as M } from "react";
5
5
  import { RigidBody as b } from "@react-three/rapier";
@@ -674,7 +674,7 @@ class u {
674
674
  );
675
675
  }
676
676
  async createFromId(e, t) {
677
- const { blueprintRegistry: s } = await import("./useSpawnFromBlueprint-CMyxfh3o.js").then((n) => n.r), r = s.get(e);
677
+ const { blueprintRegistry: s } = await import("./useSpawnFromBlueprint-C_IzLBK5.js").then((n) => n.r), r = s.get(e);
678
678
  return r ? this.createEntity(r, t) : (console.error(`Blueprint not found: ${e}`), null);
679
679
  }
680
680
  createFromDefinition(e, t) {
@@ -5,11 +5,31 @@ export type BuildingUINPCPanelContext = {
5
5
  editMode: 'npc';
6
6
  };
7
7
  export type BuildingUINPCPanelRenderer = React.ReactNode | ((context: BuildingUINPCPanelContext) => React.ReactNode);
8
+ export type BuildingUIMode = 'wall' | 'tile' | 'block' | 'npc' | 'object';
9
+ export type BuildingUIModeButtonContext = {
10
+ mode: BuildingUIMode;
11
+ active: boolean;
12
+ label: string;
13
+ selectMode: () => void;
14
+ };
15
+ export type BuildingUICustomization = {
16
+ className?: string;
17
+ panelClassName?: string;
18
+ labels?: Partial<Record<BuildingUIMode | 'title' | 'close', string>>;
19
+ modeOrder?: BuildingUIMode[];
20
+ hiddenModes?: BuildingUIMode[];
21
+ renderModeButton?: (context: BuildingUIModeButtonContext) => React.ReactNode;
22
+ renderHeader?: (context: {
23
+ title: string;
24
+ close: () => void;
25
+ }) => React.ReactNode;
26
+ };
8
27
  export type BuildingUIProps = {
9
28
  onClose?: () => void;
10
29
  canEdit?: boolean;
11
30
  npcPanel?: BuildingUINPCPanelRenderer | false;
12
31
  extensionPanel?: React.ReactNode;
32
+ ui?: BuildingUICustomization;
13
33
  };
14
34
  export declare const createCustomMeshId: typeof createBuildingScopeId;
15
- export declare function BuildingUI({ onClose, canEdit, npcPanel, extensionPanel, }: BuildingUIProps): React.JSX.Element | null;
35
+ export declare function BuildingUI({ onClose, canEdit, npcPanel, extensionPanel, ui, }: BuildingUIProps): React.JSX.Element | null;
@@ -14,6 +14,7 @@ export * from './components/WallSystem';
14
14
  export * from './components/GridHelper';
15
15
  export * from './components/BuildingUI';
16
16
  export * from './model';
17
+ export * from './patterns';
17
18
  export * from './catalog';
18
19
  export * from './id';
19
20
  export * from './plugin';
@@ -0,0 +1,17 @@
1
+ import type { TileAreaPatternConfig, TileGroupConfig } from './types';
2
+ export type TilePatternApplyOptions = {
3
+ anchorCell?: {
4
+ x: number;
5
+ z: number;
6
+ };
7
+ patternId?: string;
8
+ replaceMaterials?: boolean;
9
+ replaceColors?: boolean;
10
+ };
11
+ export type TilePatternTemplateCell = Omit<TileAreaPatternConfig['cells'][number], 'x' | 'z'> & {
12
+ x?: number;
13
+ z?: number;
14
+ };
15
+ export declare function createTileAreaPattern(id: string, width: number, height: number, cells?: TilePatternTemplateCell[], options?: Partial<Pick<TileAreaPatternConfig, 'name' | 'repeat'>>): TileAreaPatternConfig;
16
+ export declare function createCheckerTileAreaPattern(id: string, width: number, height: number, colors: [string, string], name?: string): TileAreaPatternConfig;
17
+ export declare function applyTileAreaPattern(group: TileGroupConfig, pattern: TileAreaPatternConfig, options?: TilePatternApplyOptions): TileGroupConfig;
@@ -135,6 +135,12 @@ export interface TileConfig {
135
135
  rotation?: number;
136
136
  shape?: TileShapeType;
137
137
  objectType?: TileObjectType;
138
+ patternId?: string;
139
+ patternCell?: {
140
+ x: number;
141
+ z: number;
142
+ };
143
+ patternColor?: string;
138
144
  objectConfig?: {
139
145
  /** Blades per square meter. The mesh layer multiplies this by tile area. */
140
146
  grassDensity?: number;
@@ -143,6 +149,21 @@ export interface TileConfig {
143
149
  terrainAccentColor?: string;
144
150
  };
145
151
  }
152
+ export type TileAreaPatternCell = {
153
+ x: number;
154
+ z: number;
155
+ color?: string;
156
+ materialId?: string;
157
+ symbol?: string;
158
+ };
159
+ export type TileAreaPatternConfig = {
160
+ id: string;
161
+ name?: string;
162
+ width: number;
163
+ height: number;
164
+ cells: TileAreaPatternCell[];
165
+ repeat?: boolean;
166
+ };
146
167
  export interface BuildingBlockConfig {
147
168
  id: string;
148
169
  position: Position3D;
@@ -217,6 +238,7 @@ export interface TileGroupConfig {
217
238
  name: string;
218
239
  floorMeshId: string;
219
240
  tiles: TileConfig[];
241
+ patterns?: TileAreaPatternConfig[];
220
242
  }
221
243
  export interface WallCategory {
222
244
  id: string;
@@ -6,6 +6,7 @@ export declare const VISIBILITY_DIRECTION_BUCKETS = 8;
6
6
  export declare const OCCLUDER_MIN_RADIUS = 3.2;
7
7
  export declare const OCCLUDER_MIN_WALL_RADIUS = 2.4;
8
8
  export declare const OCCLUSION_ALIGNMENT = 0.985;
9
+ export declare const OCCLUDER_MIN_TILE_CENTER_Y = 1.1;
9
10
  export type VisibilityRecord = {
10
11
  id: string;
11
12
  centerX: number;
@@ -2,5 +2,5 @@ import { FC } from 'react';
2
2
  import type { EditorLayoutProps } from './types';
3
3
  import '../../styles/theme.css';
4
4
  export { EDITOR_PANEL_COMPONENT_KIND, isEditorPanelComponentExtension, resolveEditorPanelComponentExtensions, } from './types';
5
- export type { EditorLayoutProps, EditorPanelComponentExtension, EditorPanelDefaults, EditorShellAction, EditorShellPluginPanel, PanelConfig, } from './types';
5
+ export type { EditorLayoutProps, EditorLayoutRenderContext, EditorLayoutUIConfig, EditorPanelComponentExtension, EditorPanelDefaults, EditorPanelRenderContext, EditorShellAction, EditorShellPluginPanel, PanelConfig, } from './types';
6
6
  export declare const EditorLayout: FC<EditorLayoutProps>;
@@ -12,6 +12,7 @@ export interface EditorLayoutProps {
12
12
  panelOrder?: string[];
13
13
  panelDefaults?: Record<string, EditorPanelDefaults>;
14
14
  validateBundle?: EditorShellValidation;
15
+ ui?: EditorLayoutUIConfig;
15
16
  }
16
17
  export interface PanelConfig {
17
18
  id: string;
@@ -29,6 +30,50 @@ export interface PanelConfig {
29
30
  className?: string;
30
31
  style?: CSSProperties;
31
32
  }
33
+ export type EditorLayoutRenderContext = {
34
+ panels: PanelConfig[];
35
+ selectedPanelId: string;
36
+ selectedPanel?: PanelConfig;
37
+ isPanelOpen: boolean;
38
+ isModalOpen: boolean;
39
+ selectPanel: (panelId: string) => void;
40
+ closePanel: () => void;
41
+ openModal: () => void;
42
+ closeModal: () => void;
43
+ };
44
+ export type EditorPanelRenderContext = EditorLayoutRenderContext & {
45
+ panel: PanelConfig;
46
+ active: boolean;
47
+ };
48
+ export type EditorLayoutUIConfig = {
49
+ labels?: Partial<{
50
+ title: string;
51
+ emptyPanel: string;
52
+ panelRegion: string;
53
+ actionsRegion: string;
54
+ openModal: string;
55
+ closePanel: string;
56
+ returnToSidebar: string;
57
+ closeModal: string;
58
+ hint: string;
59
+ }>;
60
+ classNames?: Partial<{
61
+ root: string;
62
+ sidebar: string;
63
+ menu: string;
64
+ toggle: string;
65
+ panel: string;
66
+ modal: string;
67
+ modalSurface: string;
68
+ }>;
69
+ modalPreferredPanelIds?: string[];
70
+ renderSidebarHeader?: (context: EditorLayoutRenderContext) => ReactNode;
71
+ renderPanelToggle?: (context: EditorPanelRenderContext) => ReactNode;
72
+ renderActions?: (context: EditorLayoutRenderContext) => ReactNode;
73
+ renderSidebarFooter?: (context: EditorLayoutRenderContext) => ReactNode;
74
+ renderPanelHeader?: (context: EditorPanelRenderContext) => ReactNode;
75
+ renderModalHeader?: (context: EditorPanelRenderContext) => ReactNode;
76
+ };
32
77
  export type EditorPanelDefaults = Partial<Omit<PanelConfig, 'id' | 'component'>>;
33
78
  export interface EditorShellPluginPanel extends PanelConfig {
34
79
  pluginId?: string;
@@ -1,5 +1,5 @@
1
1
  import type { ContentBundle, ContentBundleValidation } from '../content';
2
- import type { EditorPanelDefaults, EditorShellAction, EditorShellPluginPanel } from './components/EditorLayout/types';
2
+ import type { EditorLayoutUIConfig, EditorPanelDefaults, EditorShellAction, EditorShellPluginPanel } from './components/EditorLayout/types';
3
3
  export type EditorShellCommand = {
4
4
  id: string;
5
5
  label: string;
@@ -15,6 +15,7 @@ export type EditorShellOptions = {
15
15
  hiddenBuiltInPanels?: string[];
16
16
  panelOrder?: string[];
17
17
  panelDefaults?: Record<string, EditorPanelDefaults>;
18
+ ui?: EditorLayoutUIConfig;
18
19
  commands?: EditorShellCommand[];
19
20
  validate?: EditorShellValidation;
20
21
  };
@@ -26,6 +27,7 @@ export type EditorShell = {
26
27
  hiddenBuiltInPanels?: string[];
27
28
  panelOrder?: string[];
28
29
  panelDefaults?: Record<string, EditorPanelDefaults>;
30
+ ui?: EditorLayoutUIConfig;
29
31
  actions: EditorShellAction[];
30
32
  validate?: EditorShellValidation;
31
33
  };
package/dist/editor.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("reflect-metadata");const e=require("./plugin-HaNJAUvX.cjs"),T=require("react"),S=require("@react-three/fiber"),I=require("three"),r=require("./index-Bl7z-DDw.cjs"),l=require("./gaesupStore-CRQ-tcIz.cjs"),E=require("./loader-D7cEHkCq.cjs");function g(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(i,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return i.default=t,Object.freeze(i)}const _=g(I);var B=Object.defineProperty,D=Object.getOwnPropertyDescriptor,u=(t,i,n,o)=>{for(var d=D(i,n),s=t.length-1,c;s>=0;s--)(c=t[s])&&(d=c(i,n,d)||d);return d&&B(i,n,d),d};class a{static convertLegacyPosition(i){return{x:i[0],y:i[1],z:i[2]}}static convertLegacyRotation(i){return{x:i[0],y:i[1],z:i[2]}}static convertToLegacyPosition(i){return[i.x,i.y,i.z]}static convertToLegacyRotation(i){return[i.x,i.y,i.z]}static convertLegacyWall(i){return{id:i.id||`wall-${Date.now()}`,position:this.convertLegacyPosition(i.position),rotation:this.convertLegacyRotation(i.rotation),wallGroupId:i.wall_parent_id||"default",width:4,height:4,depth:.5}}static convertLegacyTile(i){return{id:i.id||`tile-${Date.now()}`,position:this.convertLegacyPosition(i.position),tileGroupId:i.tile_parent_id||"default",size:4}}static convertLegacyMesh(i){const n={id:i.id||`mesh-${Date.now()}`,color:i.color||"#ffffff",material:i.material==="GLASS"?"GLASS":"STANDARD",roughness:i.roughness||.5,metalness:i.metalness||0,opacity:i.opacity||1,transparent:i.transparent||!1};return i.map_texture_url&&(n.mapTextureUrl=i.map_texture_url),i.normal_texture_url&&(n.normalTextureUrl=i.normal_texture_url),n}}u([l.HandleError(),l.Profile()],a,"convertLegacyPosition");u([l.HandleError(),l.Profile()],a,"convertLegacyRotation");u([l.HandleError()],a,"convertToLegacyPosition");u([l.HandleError()],a,"convertToLegacyRotation");u([l.HandleError(),l.Profile()],a,"convertLegacyWall");u([l.HandleError(),l.Profile()],a,"convertLegacyTile");u([l.HandleError(),l.Profile()],a,"convertLegacyMesh");function L(){const t=T.useMemo(()=>({frustum:new _.Frustum,matrix:new _.Matrix4,camPos:new _.Vector3}),[]);return S.useFrame((i,n)=>{const o=i.camera;e.getGrassManager().size()!==0&&(t.matrix.multiplyMatrices(o.projectionMatrix,o.matrixWorldInverse),t.frustum.setFromProjectionMatrix(t.matrix),t.camPos.copy(o.position),e.getGrassManager().tick({elapsedTime:i.clock.elapsedTime,delta:n,cameraPosition:t.camPos,frustum:t.frustum}))}),null}exports.AnimationPanel=e.AnimationPanel;exports.Billboard=e.index;exports.BlockSystem=e.BlockSystem;exports.BuildingController=e.BuildingController;exports.BuildingGpuCullingDriver=e.BuildingGpuCullingDriver;exports.BuildingGpuMirrorDriver=e.BuildingGpuMirrorDriver;exports.BuildingGpuUploadDriver=e.BuildingGpuUploadDriver;exports.BuildingIndirectArgsUploadDriver=e.BuildingIndirectArgsUploadDriver;exports.BuildingIndirectDrawDriver=e.BuildingIndirectDrawDriver;exports.BuildingNavigationObstacleDriver=e.BuildingNavigationObstacleDriver;exports.BuildingPanel=e.BuildingPanel;exports.BuildingRenderStateDriver=e.BuildingRenderStateDriver;exports.BuildingSystem=e.BuildingSystem;exports.BuildingUI=e.BuildingUI;exports.BuildingVisibilityDriver=e.BuildingVisibilityDriver;exports.CameraPanel=e.CameraPanel;exports.DEFAULT_BUILDING_GRID_EXTENSION_ID=e.DEFAULT_BUILDING_GRID_EXTENSION_ID;exports.DEFAULT_BUILDING_OBJECT_CATALOG=e.DEFAULT_BUILDING_OBJECT_CATALOG;exports.DEFAULT_BUILDING_PLACEMENT_EXTENSION_ID=e.DEFAULT_BUILDING_PLACEMENT_EXTENSION_ID;exports.DEFAULT_BUILDING_SAVE_EXTENSION_ID=e.DEFAULT_BUILDING_SAVE_EXTENSION_ID;exports.DEFAULT_BUILDING_STORE_SERVICE_ID=e.DEFAULT_BUILDING_STORE_SERVICE_ID;exports.DRAW_CLUSTER_BILLBOARD=e.DRAW_CLUSTER_BILLBOARD;exports.DRAW_CLUSTER_BLOCK=e.DRAW_CLUSTER_BLOCK;exports.DRAW_CLUSTER_COUNT=e.DRAW_CLUSTER_COUNT;exports.DRAW_CLUSTER_DESCRIPTORS=e.DRAW_CLUSTER_DESCRIPTORS;exports.DRAW_CLUSTER_FIRE=e.DRAW_CLUSTER_FIRE;exports.DRAW_CLUSTER_FLAG=e.DRAW_CLUSTER_FLAG;exports.DRAW_CLUSTER_GRASS=e.DRAW_CLUSTER_GRASS;exports.DRAW_CLUSTER_MODEL=e.DRAW_CLUSTER_MODEL;exports.DRAW_CLUSTER_SAKURA=e.DRAW_CLUSTER_SAKURA;exports.DRAW_CLUSTER_SAND=e.DRAW_CLUSTER_SAND;exports.DRAW_CLUSTER_SNOWFIELD=e.DRAW_CLUSTER_SNOWFIELD;exports.DRAW_CLUSTER_TILE=e.DRAW_CLUSTER_TILE;exports.DRAW_CLUSTER_WALL=e.DRAW_CLUSTER_WALL;exports.DRAW_CLUSTER_WATER=e.DRAW_CLUSTER_WATER;exports.EDITOR_PANEL_COMPONENT_KIND=e.EDITOR_PANEL_COMPONENT_KIND;exports.Editor=e.Editor;exports.EditorLayout=e.EditorLayout;exports.Fire=e.index$1;exports.GPU_META_STRIDE=e.GPU_META_STRIDE;exports.GPU_SPATIAL_STRIDE=e.GPU_SPATIAL_STRIDE;exports.GameplayEventPanel=e.GameplayEventPanel;exports.Grass=e.Grass;exports.GridHelper=e.GridHelper;exports.INDIRECT_DRAW_STRIDE=e.INDIRECT_DRAW_STRIDE;exports.MotionPanel=e.MotionPanel;exports.PerformancePanel=e.PerformancePanel;exports.ResizablePanel=e.ResizablePanel;exports.Sakura=e.Sakura;exports.SakuraBatch=e.SakuraBatch;exports.Sand=e.Sand;exports.SandBatch=e.SandBatch;exports.Snow=e.Snow;exports.Snowfield=e.Snowfield;exports.SnowfieldBatch=e.SnowfieldBatch;exports.StudioPanel=e.StudioPanel;exports.TileSystem=e.TileSystem;exports.VehiclePanel=e.VehiclePanel;exports.WallSystem=e.WallSystem;exports.Water=e.Ocean;exports.applyBuildingNavigationObstacles=e.applyBuildingNavigationObstacles;exports.buildBuildingGpuMirror=e.buildBuildingGpuMirror;exports.buildBuildingIndirectDrawMirror=e.buildBuildingIndirectDrawMirror;exports.buildingPlugin=e.buildingPlugin;exports.createBuildingGpuUploadPlan=e.createBuildingGpuUploadPlan;exports.createBuildingIndirectDrawUploadPlan=e.createBuildingIndirectDrawUploadPlan;exports.createBuildingPlugin=e.createBuildingPlugin;exports.createBuildingScopeId=e.createBuildingScopeId;exports.createCustomMeshId=e.createCustomMeshId;exports.createEditorCommandStack=e.createEditorCommandStack;exports.createEditorShell=e.createEditorShell;exports.createEditorSlice=e.createEditorSlice;exports.createEmptyBuildingGpuUploadResources=e.createEmptyBuildingGpuUploadResources;exports.createEmptyBuildingIndirectDrawMirror=e.createEmptyBuildingIndirectDrawMirror;exports.createEmptyGpuMirror=e.createEmptyGpuMirror;exports.createTerrainBlockMaterial=e.createTerrainBlockMaterial;exports.destroyBuildingGpuUploadResources=e.destroyBuildingGpuUploadResources;exports.editorSlice=e.editorSlice;exports.findTerrainBlockMaterial=e.findTerrainBlockMaterial;exports.getDefaultBuildingObject=e.getDefaultBuildingObject;exports.getDrawClusterForSnapshotEntry=e.getDrawClusterForSnapshotEntry;exports.getGrassManager=e.getGrassManager;exports.getIndirectInstanceCount=e.getIndirectInstanceCount;exports.getWallMaterialKey=e.getWallMaterialKey;exports.getWebGPUDeviceFromRenderer=e.getWebGPUDeviceFromRenderer;exports.isEditorPanelComponentExtension=e.isEditorPanelComponentExtension;exports.parseBuildingGpuVisibilityFlags=e.parseBuildingGpuVisibilityFlags;exports.resolveEditorPanelComponentExtensions=e.resolveEditorPanelComponentExtensions;exports.syncBuildingGpuBuffers=e.syncBuildingGpuBuffers;exports.syncBuildingIndirectArgsBuffer=e.syncBuildingIndirectArgsBuffer;exports.useBuildingEditor=e.useBuildingEditor;exports.useBuildingGpuCullingStore=e.useBuildingGpuCullingStore;exports.useBuildingRenderStateStore=e.useBuildingRenderStateStore;exports.useBuildingVisibilityStore=e.useBuildingVisibilityStore;exports.useEditor=e.useEditor;exports.useEditorStore=e.useEditorStore;exports.BUILDING_BASIC_OBJECT_OPTIONS=r.BUILDING_BASIC_OBJECT_OPTIONS;exports.BUILDING_FLAG_STYLE_OPTIONS=r.BUILDING_FLAG_STYLE_OPTIONS;exports.BUILDING_PLACED_OBJECT_OPTIONS=r.BUILDING_PLACED_OBJECT_OPTIONS;exports.BUILDING_TILE_OBJECT_OPTIONS=r.BUILDING_TILE_OBJECT_OPTIONS;exports.BUILDING_TILE_PRESETS=r.BUILDING_TILE_PRESETS;exports.BUILDING_TILE_SHAPE_OPTIONS=r.BUILDING_TILE_SHAPE_OPTIONS;exports.BUILDING_TREE_COLOR_PRESETS=r.BUILDING_TREE_COLOR_PRESETS;exports.BUILDING_TREE_OPTIONS=r.BUILDING_TREE_OPTIONS;exports.BUILDING_WALL_KIND_OPTIONS=r.BUILDING_WALL_KIND_OPTIONS;exports.BUILDING_WALL_PRESETS=r.BUILDING_WALL_PRESETS;exports.BUILDING_WEATHER_EFFECT_OPTIONS=r.BUILDING_WEATHER_EFFECT_OPTIONS;exports.FLAG_STYLE_META=r.FLAG_STYLE_META;exports.blockToPlacementEntry=r.blockToPlacementEntry;exports.buildingCellToWorld=r.buildingCellToWorld;exports.buildingGridAdapter=r.buildingGridAdapter;exports.buildingGroupsToPlacementEntries=r.buildingGroupsToPlacementEntries;exports.buildingPlacementAdapter=r.buildingPlacementAdapter;exports.cellToTilePosition=r.cellToTilePosition;exports.createBlockFootprint=r.createBlockFootprint;exports.createBuildingPlacementEngine=r.createBuildingPlacementEngine;exports.createTileFootprint=r.createTileFootprint;exports.edgeKey=r.edgeKey;exports.edgeSideToWallRotation=r.edgeSideToWallRotation;exports.edgeToWallTransform=r.edgeToWallTransform;exports.getTileSupportHeight=r.getTileSupportHeight;exports.hasTileCollision=r.hasTileCollision;exports.hasWallCollision=r.hasWallCollision;exports.indexAabb=r.indexAabb;exports.normalizeQuarterTurnRotation=r.normalizeQuarterTurnRotation;exports.pair=r.pair;exports.queryAabbIds=r.queryAabbIds;exports.snapBuildingPosition=r.snapBuildingPosition;exports.tileFootprintKeys=r.tileFootprintKeys;exports.tileGroupToPlacementEntries=r.tileGroupToPlacementEntries;exports.tileHalfSize=r.tileHalfSize;exports.tileOverlaps=r.tileOverlaps;exports.tilePositionToCell=r.tilePositionToCell;exports.tileToPlacementEntry=r.tileToPlacementEntry;exports.unindexId=r.unindexId;exports.useBuildingStore=r.useBuildingStore;exports.wallGroupToPlacementEntries=r.wallGroupToPlacementEntries;exports.wallToPlacementEntry=r.wallToPlacementEntry;exports.wallTransformToEdge=r.wallTransformToEdge;exports.worldToBuildingCell=r.worldToBuildingCell;exports.zigZag=r.zigZag;exports.CONTENT_SCHEMA_VERSION=E.CONTENT_SCHEMA_VERSION;exports.HttpContentBundleSource=E.HttpContentBundleSource;exports.createContentBundleFromSaveSystem=E.createContentBundleFromSaveSystem;exports.loadContentBundleFromManifest=E.loadContentBundleFromManifest;exports.validateContentBundle=E.validateContentBundle;exports.validateContentBundleManifest=E.validateContentBundleManifest;exports.BuildingBridge=a;exports.GrassDriver=L;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("reflect-metadata");const e=require("./plugin-BD46UWoA.cjs"),D=require("react"),L=require("@react-three/fiber"),P=require("three"),r=require("./index-Bl7z-DDw.cjs"),d=require("./gaesupStore-CRQ-tcIz.cjs"),S=require("./loader-D7cEHkCq.cjs");function R(n){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(i,t,a.get?a:{enumerable:!0,get:()=>n[t]})}}return i.default=n,Object.freeze(i)}const I=R(P);function B(n,i,t,a=[],l={}){const u=Math.max(1,Math.round(i)),o=Math.max(1,Math.round(t)),c=a.map((s,_)=>({...s,x:Math.max(0,Math.min(u-1,s.x??_%u)),z:Math.max(0,Math.min(o-1,s.z??Math.floor(_/u)))}));return{id:n,width:u,height:o,cells:c,...l.name?{name:l.name}:{},...l.repeat!==void 0?{repeat:l.repeat}:{}}}function p(n,i,t,a,l="Checker Pattern"){const u=[];for(let o=0;o<t;o+=1)for(let c=0;c<i;c+=1)u.push({x:c,z:o,color:a[(c+o)%2]});return B(n,i,t,u,{name:l})}function m(n,i,t={}){const a=t.anchorCell??C(n.tiles),l=t.patternId??i.id,u=new Map(i.cells.map(o=>[`${o.x}:${o.z}`,o]));return{...n,patterns:G(n.patterns,i),tiles:n.tiles.map(o=>{const c=o.cell;if(!c)return o;const s=c.x-a.x,_=c.z-a.z;if(s<0||_<0||s>=i.width||_>=i.height)return o;const g=u.get(`${s}:${_}`);return g?A(o,l,s,_,g,t):o})}}function A(n,i,t,a,l,u){return{...n,patternId:i,patternCell:{x:t,z:a},...u.replaceColors!==!1&&l.color?{patternColor:l.color}:{},...u.replaceMaterials&&l.materialId?{materialId:l.materialId}:{}}}function C(n){let i=1/0,t=1/0;for(const a of n)a.cell&&(i=Math.min(i,a.cell.x),t=Math.min(t,a.cell.z));return{x:Number.isFinite(i)?i:0,z:Number.isFinite(t)?t:0}}function G(n,i){const t=[...n??[]],a=t.findIndex(l=>l.id===i.id);return a===-1?t.push(i):t[a]=i,t}var U=Object.defineProperty,O=Object.getOwnPropertyDescriptor,T=(n,i,t,a)=>{for(var l=O(i,t),u=n.length-1,o;u>=0;u--)(o=n[u])&&(l=o(i,t,l)||l);return l&&U(i,t,l),l};class E{static convertLegacyPosition(i){return{x:i[0],y:i[1],z:i[2]}}static convertLegacyRotation(i){return{x:i[0],y:i[1],z:i[2]}}static convertToLegacyPosition(i){return[i.x,i.y,i.z]}static convertToLegacyRotation(i){return[i.x,i.y,i.z]}static convertLegacyWall(i){return{id:i.id||`wall-${Date.now()}`,position:this.convertLegacyPosition(i.position),rotation:this.convertLegacyRotation(i.rotation),wallGroupId:i.wall_parent_id||"default",width:4,height:4,depth:.5}}static convertLegacyTile(i){return{id:i.id||`tile-${Date.now()}`,position:this.convertLegacyPosition(i.position),tileGroupId:i.tile_parent_id||"default",size:4}}static convertLegacyMesh(i){const t={id:i.id||`mesh-${Date.now()}`,color:i.color||"#ffffff",material:i.material==="GLASS"?"GLASS":"STANDARD",roughness:i.roughness||.5,metalness:i.metalness||0,opacity:i.opacity||1,transparent:i.transparent||!1};return i.map_texture_url&&(t.mapTextureUrl=i.map_texture_url),i.normal_texture_url&&(t.normalTextureUrl=i.normal_texture_url),t}}T([d.HandleError(),d.Profile()],E,"convertLegacyPosition");T([d.HandleError(),d.Profile()],E,"convertLegacyRotation");T([d.HandleError()],E,"convertToLegacyPosition");T([d.HandleError()],E,"convertToLegacyRotation");T([d.HandleError(),d.Profile()],E,"convertLegacyWall");T([d.HandleError(),d.Profile()],E,"convertLegacyTile");T([d.HandleError(),d.Profile()],E,"convertLegacyMesh");function N(){const n=D.useMemo(()=>({frustum:new I.Frustum,matrix:new I.Matrix4,camPos:new I.Vector3}),[]);return L.useFrame((i,t)=>{const a=i.camera;e.getGrassManager().size()!==0&&(n.matrix.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),n.frustum.setFromProjectionMatrix(n.matrix),n.camPos.copy(a.position),e.getGrassManager().tick({elapsedTime:i.clock.elapsedTime,delta:t,cameraPosition:n.camPos,frustum:n.frustum}))}),null}exports.AnimationPanel=e.AnimationPanel;exports.Billboard=e.index;exports.BlockSystem=e.BlockSystem;exports.BuildingController=e.BuildingController;exports.BuildingGpuCullingDriver=e.BuildingGpuCullingDriver;exports.BuildingGpuMirrorDriver=e.BuildingGpuMirrorDriver;exports.BuildingGpuUploadDriver=e.BuildingGpuUploadDriver;exports.BuildingIndirectArgsUploadDriver=e.BuildingIndirectArgsUploadDriver;exports.BuildingIndirectDrawDriver=e.BuildingIndirectDrawDriver;exports.BuildingNavigationObstacleDriver=e.BuildingNavigationObstacleDriver;exports.BuildingPanel=e.BuildingPanel;exports.BuildingRenderStateDriver=e.BuildingRenderStateDriver;exports.BuildingSystem=e.BuildingSystem;exports.BuildingUI=e.BuildingUI;exports.BuildingVisibilityDriver=e.BuildingVisibilityDriver;exports.CameraPanel=e.CameraPanel;exports.DEFAULT_BUILDING_GRID_EXTENSION_ID=e.DEFAULT_BUILDING_GRID_EXTENSION_ID;exports.DEFAULT_BUILDING_OBJECT_CATALOG=e.DEFAULT_BUILDING_OBJECT_CATALOG;exports.DEFAULT_BUILDING_PLACEMENT_EXTENSION_ID=e.DEFAULT_BUILDING_PLACEMENT_EXTENSION_ID;exports.DEFAULT_BUILDING_SAVE_EXTENSION_ID=e.DEFAULT_BUILDING_SAVE_EXTENSION_ID;exports.DEFAULT_BUILDING_STORE_SERVICE_ID=e.DEFAULT_BUILDING_STORE_SERVICE_ID;exports.DRAW_CLUSTER_BILLBOARD=e.DRAW_CLUSTER_BILLBOARD;exports.DRAW_CLUSTER_BLOCK=e.DRAW_CLUSTER_BLOCK;exports.DRAW_CLUSTER_COUNT=e.DRAW_CLUSTER_COUNT;exports.DRAW_CLUSTER_DESCRIPTORS=e.DRAW_CLUSTER_DESCRIPTORS;exports.DRAW_CLUSTER_FIRE=e.DRAW_CLUSTER_FIRE;exports.DRAW_CLUSTER_FLAG=e.DRAW_CLUSTER_FLAG;exports.DRAW_CLUSTER_GRASS=e.DRAW_CLUSTER_GRASS;exports.DRAW_CLUSTER_MODEL=e.DRAW_CLUSTER_MODEL;exports.DRAW_CLUSTER_SAKURA=e.DRAW_CLUSTER_SAKURA;exports.DRAW_CLUSTER_SAND=e.DRAW_CLUSTER_SAND;exports.DRAW_CLUSTER_SNOWFIELD=e.DRAW_CLUSTER_SNOWFIELD;exports.DRAW_CLUSTER_TILE=e.DRAW_CLUSTER_TILE;exports.DRAW_CLUSTER_WALL=e.DRAW_CLUSTER_WALL;exports.DRAW_CLUSTER_WATER=e.DRAW_CLUSTER_WATER;exports.EDITOR_PANEL_COMPONENT_KIND=e.EDITOR_PANEL_COMPONENT_KIND;exports.Editor=e.Editor;exports.EditorLayout=e.EditorLayout;exports.Fire=e.index$1;exports.GPU_META_STRIDE=e.GPU_META_STRIDE;exports.GPU_SPATIAL_STRIDE=e.GPU_SPATIAL_STRIDE;exports.GameplayEventPanel=e.GameplayEventPanel;exports.Grass=e.Grass;exports.GridHelper=e.GridHelper;exports.INDIRECT_DRAW_STRIDE=e.INDIRECT_DRAW_STRIDE;exports.MotionPanel=e.MotionPanel;exports.PerformancePanel=e.PerformancePanel;exports.ResizablePanel=e.ResizablePanel;exports.Sakura=e.Sakura;exports.SakuraBatch=e.SakuraBatch;exports.Sand=e.Sand;exports.SandBatch=e.SandBatch;exports.Snow=e.Snow;exports.Snowfield=e.Snowfield;exports.SnowfieldBatch=e.SnowfieldBatch;exports.StudioPanel=e.StudioPanel;exports.TileSystem=e.TileSystem;exports.VehiclePanel=e.VehiclePanel;exports.WallSystem=e.WallSystem;exports.Water=e.Ocean;exports.applyBuildingNavigationObstacles=e.applyBuildingNavigationObstacles;exports.buildBuildingGpuMirror=e.buildBuildingGpuMirror;exports.buildBuildingIndirectDrawMirror=e.buildBuildingIndirectDrawMirror;exports.buildingPlugin=e.buildingPlugin;exports.createBuildingGpuUploadPlan=e.createBuildingGpuUploadPlan;exports.createBuildingIndirectDrawUploadPlan=e.createBuildingIndirectDrawUploadPlan;exports.createBuildingPlugin=e.createBuildingPlugin;exports.createBuildingScopeId=e.createBuildingScopeId;exports.createCustomMeshId=e.createCustomMeshId;exports.createEditorCommandStack=e.createEditorCommandStack;exports.createEditorShell=e.createEditorShell;exports.createEditorSlice=e.createEditorSlice;exports.createEmptyBuildingGpuUploadResources=e.createEmptyBuildingGpuUploadResources;exports.createEmptyBuildingIndirectDrawMirror=e.createEmptyBuildingIndirectDrawMirror;exports.createEmptyGpuMirror=e.createEmptyGpuMirror;exports.createTerrainBlockMaterial=e.createTerrainBlockMaterial;exports.destroyBuildingGpuUploadResources=e.destroyBuildingGpuUploadResources;exports.editorSlice=e.editorSlice;exports.findTerrainBlockMaterial=e.findTerrainBlockMaterial;exports.getDefaultBuildingObject=e.getDefaultBuildingObject;exports.getDrawClusterForSnapshotEntry=e.getDrawClusterForSnapshotEntry;exports.getGrassManager=e.getGrassManager;exports.getIndirectInstanceCount=e.getIndirectInstanceCount;exports.getWallMaterialKey=e.getWallMaterialKey;exports.getWebGPUDeviceFromRenderer=e.getWebGPUDeviceFromRenderer;exports.isEditorPanelComponentExtension=e.isEditorPanelComponentExtension;exports.parseBuildingGpuVisibilityFlags=e.parseBuildingGpuVisibilityFlags;exports.resolveEditorPanelComponentExtensions=e.resolveEditorPanelComponentExtensions;exports.syncBuildingGpuBuffers=e.syncBuildingGpuBuffers;exports.syncBuildingIndirectArgsBuffer=e.syncBuildingIndirectArgsBuffer;exports.useBuildingEditor=e.useBuildingEditor;exports.useBuildingGpuCullingStore=e.useBuildingGpuCullingStore;exports.useBuildingRenderStateStore=e.useBuildingRenderStateStore;exports.useBuildingVisibilityStore=e.useBuildingVisibilityStore;exports.useEditor=e.useEditor;exports.useEditorStore=e.useEditorStore;exports.BUILDING_BASIC_OBJECT_OPTIONS=r.BUILDING_BASIC_OBJECT_OPTIONS;exports.BUILDING_FLAG_STYLE_OPTIONS=r.BUILDING_FLAG_STYLE_OPTIONS;exports.BUILDING_PLACED_OBJECT_OPTIONS=r.BUILDING_PLACED_OBJECT_OPTIONS;exports.BUILDING_TILE_OBJECT_OPTIONS=r.BUILDING_TILE_OBJECT_OPTIONS;exports.BUILDING_TILE_PRESETS=r.BUILDING_TILE_PRESETS;exports.BUILDING_TILE_SHAPE_OPTIONS=r.BUILDING_TILE_SHAPE_OPTIONS;exports.BUILDING_TREE_COLOR_PRESETS=r.BUILDING_TREE_COLOR_PRESETS;exports.BUILDING_TREE_OPTIONS=r.BUILDING_TREE_OPTIONS;exports.BUILDING_WALL_KIND_OPTIONS=r.BUILDING_WALL_KIND_OPTIONS;exports.BUILDING_WALL_PRESETS=r.BUILDING_WALL_PRESETS;exports.BUILDING_WEATHER_EFFECT_OPTIONS=r.BUILDING_WEATHER_EFFECT_OPTIONS;exports.FLAG_STYLE_META=r.FLAG_STYLE_META;exports.blockToPlacementEntry=r.blockToPlacementEntry;exports.buildingCellToWorld=r.buildingCellToWorld;exports.buildingGridAdapter=r.buildingGridAdapter;exports.buildingGroupsToPlacementEntries=r.buildingGroupsToPlacementEntries;exports.buildingPlacementAdapter=r.buildingPlacementAdapter;exports.cellToTilePosition=r.cellToTilePosition;exports.createBlockFootprint=r.createBlockFootprint;exports.createBuildingPlacementEngine=r.createBuildingPlacementEngine;exports.createTileFootprint=r.createTileFootprint;exports.edgeKey=r.edgeKey;exports.edgeSideToWallRotation=r.edgeSideToWallRotation;exports.edgeToWallTransform=r.edgeToWallTransform;exports.getTileSupportHeight=r.getTileSupportHeight;exports.hasTileCollision=r.hasTileCollision;exports.hasWallCollision=r.hasWallCollision;exports.indexAabb=r.indexAabb;exports.normalizeQuarterTurnRotation=r.normalizeQuarterTurnRotation;exports.pair=r.pair;exports.queryAabbIds=r.queryAabbIds;exports.snapBuildingPosition=r.snapBuildingPosition;exports.tileFootprintKeys=r.tileFootprintKeys;exports.tileGroupToPlacementEntries=r.tileGroupToPlacementEntries;exports.tileHalfSize=r.tileHalfSize;exports.tileOverlaps=r.tileOverlaps;exports.tilePositionToCell=r.tilePositionToCell;exports.tileToPlacementEntry=r.tileToPlacementEntry;exports.unindexId=r.unindexId;exports.useBuildingStore=r.useBuildingStore;exports.wallGroupToPlacementEntries=r.wallGroupToPlacementEntries;exports.wallToPlacementEntry=r.wallToPlacementEntry;exports.wallTransformToEdge=r.wallTransformToEdge;exports.worldToBuildingCell=r.worldToBuildingCell;exports.zigZag=r.zigZag;exports.CONTENT_SCHEMA_VERSION=S.CONTENT_SCHEMA_VERSION;exports.HttpContentBundleSource=S.HttpContentBundleSource;exports.createContentBundleFromSaveSystem=S.createContentBundleFromSaveSystem;exports.loadContentBundleFromManifest=S.loadContentBundleFromManifest;exports.validateContentBundle=S.validateContentBundle;exports.validateContentBundleManifest=S.validateContentBundleManifest;exports.BuildingBridge=E;exports.GrassDriver=N;exports.applyTileAreaPattern=m;exports.createCheckerTileAreaPattern=p;exports.createTileAreaPattern=B;