gaesup-world 1.0.19 → 1.0.20

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),E=require("./useSpawnFromBlueprint-aIQsqI3Q.cjs"),U=require("@react-three/drei"),W=require("@react-three/fiber"),z=require("@react-three/rapier"),H=require("three"),L=require("./gaesupStore-2zKBYTYo.cjs"),R=require("./index-D0d_tDEf.cjs"),V=require("./index-B414uKZc.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-aIQsqI3Q.cjs"),U=require("@react-three/drei"),W=require("@react-three/fiber"),z=require("@react-three/rapier"),H=require("three"),L=require("./gaesupStore-2zKBYTYo.cjs"),R=require("./index-C-4Q2Amk.cjs"),V=require("./index-D1hpjfAw.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-BxRHlpvL.js";
3
+ import { u as W, b as D } from "./useSpawnFromBlueprint-TYxXKoM5.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-DTu0tYBp.js";
9
- import { u as ne, C as ae, a as se, G as oe } from "./index-BXluyPfP.js";
10
- import { C as le } from "./index-CfiJq_gE.js";
9
+ import { u as ne, C as ae, a as se, G as oe } from "./index-BKqky34r.js";
10
+ import { C as le } from "./index-B0hl0p1Z.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-BxRHlpvL.js";
2
- import { B as ee, F as te, W as ie, u as se } from "./useSpawnFromBlueprint-BxRHlpvL.js";
1
+ import { b as x } from "./useSpawnFromBlueprint-TYxXKoM5.js";
2
+ import { B as ee, F as te, W as ie, u as se } from "./useSpawnFromBlueprint-TYxXKoM5.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-BxRHlpvL.js").then((n) => n.r), r = s.get(e);
677
+ const { blueprintRegistry: s } = await import("./useSpawnFromBlueprint-TYxXKoM5.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) {
@@ -18,6 +18,7 @@ export type ModelRendererProps = {
18
18
  };
19
19
  export type InnerGroupRefType = {
20
20
  children?: React.ReactNode;
21
+ modelChildren?: React.ReactNode;
21
22
  objectNode?: THREE.Object3D;
22
23
  animationRef: RefObject<THREE.Object3D | null | undefined>;
23
24
  nodes: Record<string, THREE.Object3D>;
@@ -25,6 +26,7 @@ export type InnerGroupRefType = {
25
26
  skeleton?: THREE.Skeleton | null | undefined;
26
27
  componentType?: string;
27
28
  modelYawOffset?: number;
29
+ modelScale?: THREE.Vector3 | [number, number, number] | number;
28
30
  isActive?: boolean;
29
31
  ridingUrl?: string;
30
32
  offset?: THREE.Vector3;
package/dist/editor.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("reflect-metadata");const e=require("./plugin-Dnl88bC4.cjs"),T=require("react"),S=require("@react-three/fiber"),I=require("three"),r=require("./index-BOdJzeGD.cjs"),l=require("./gaesupStore-2zKBYTYo.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-CS2nMv9n.cjs"),T=require("react"),S=require("@react-three/fiber"),I=require("three"),r=require("./index-CJj-Z7Jr.cjs"),l=require("./gaesupStore-2zKBYTYo.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;
package/dist/editor.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import "reflect-metadata";
2
- import { g as _ } from "./plugin-Dntrv2mX.js";
3
- import { A, s as C, y as G, w as U, F as f, z as N, D as O, I as v, H as y, K as W, B as x, x as w, v as F, U as b, J as h, C as M, _ as z, X as H, $ as k, a0 as K, a1 as V, ac as j, ad as J, ae as q, a8 as X, af as $, ag as Q, ah as Y, ai as Z, aj as aa, ak as ea, al as ia, am as ta, an as ra, ao as sa, E as na, a as oa, b as la, t as ua, aq as da, ap as ca, G as _a, q as Ea, N as Ta, a6 as Sa, M as Ia, P as La, R as ma, j as Da, k as pa, l as Ba, m as ga, p as Ra, n as Pa, o as Aa, S as Ca, T as Ga, V as Ua, W as fa, O as Na, a4 as Oa, as as va, aa as ya, a3 as Wa, at as xa, ab as wa, a2 as Fa, Z as ba, Q as ha, c as Ma, d as za, h as Ha, ax as ka, a9 as Ka, ar as Va, aD as ja, az as Ja, e as qa, aE as Xa, Y as $a, au as Qa, a7 as Ya, L as Za, ay as ae, i as ee, av as ie, r as te, aA as re, aB as se, aF as ne, aw as oe, a5 as le, aC as ue, u as de, f as ce } from "./plugin-Dntrv2mX.js";
2
+ import { g as _ } from "./plugin--mlpG6-U.js";
3
+ import { A, s as C, y as G, w as U, F as f, z as N, D as O, I as v, H as y, K as W, B as x, x as w, v as F, U as b, J as h, C as M, _ as z, X as H, $ as k, a0 as K, a1 as V, ac as j, ad as J, ae as q, a8 as X, af as $, ag as Q, ah as Y, ai as Z, aj as aa, ak as ea, al as ia, am as ta, an as ra, ao as sa, E as na, a as oa, b as la, t as ua, aq as da, ap as ca, G as _a, q as Ea, N as Ta, a6 as Sa, M as Ia, P as La, R as ma, j as Da, k as pa, l as Ba, m as ga, p as Ra, n as Pa, o as Aa, S as Ca, T as Ga, V as Ua, W as fa, O as Na, a4 as Oa, as as va, aa as ya, a3 as Wa, at as xa, ab as wa, a2 as Fa, Z as ba, Q as ha, c as Ma, d as za, h as Ha, ax as ka, a9 as Ka, ar as Va, aD as ja, az as Ja, e as qa, aE as Xa, Y as $a, au as Qa, a7 as Ya, L as Za, ay as ae, i as ee, av as ie, r as te, aA as re, aB as se, aF as ne, aw as oe, a5 as le, aC as ue, u as de, f as ce } from "./plugin--mlpG6-U.js";
4
4
  import { useMemo as E } from "react";
5
5
  import { useFrame as T } from "@react-three/fiber";
6
6
  import * as d from "three";
7
- import { Q as Ee, S as Te, R as Se, O as Ie, L as Le, P as me, N as De, M as pe, I as Be, K as ge, H as Re, J as Pe, a as Ae, b as Ce, e as Ge, d as Ue, f as fe, n as Ne, o as Oe, c as ve, r as ye, g as We, h as xe, i as we, j as Fe, k as be, l as he, m as Me, F as ze, p as He, q as ke, s as Ke, u as Ve, t as je, v as Je, w as qe, x as Xe, y as $e, z as Qe, G as Ye, A as Ze, B as ai, C as ei, D as ii, E as ti } from "./index-eON1JSxy.js";
7
+ import { Q as Ee, S as Te, R as Se, O as Ie, L as Le, P as me, N as De, M as pe, I as Be, K as ge, H as Re, J as Pe, a as Ae, b as Ce, e as Ge, d as Ue, f as fe, n as Ne, o as Oe, c as ve, r as ye, g as We, h as xe, i as we, j as Fe, k as be, l as he, m as Me, F as ze, p as He, q as ke, s as Ke, u as Ve, t as je, v as Je, w as qe, x as Xe, y as $e, z as Qe, G as Ye, A as Ze, B as ai, C as ei, D as ii, E as ti } from "./index-C-wwuvo7.js";
8
8
  import { H as t, P as o } from "./gaesupStore-DTu0tYBp.js";
9
9
  import { C as si, H as ni, c as oi, l as li, v as ui, a as di } from "./loader-C3ZwumCe.js";
10
10
  var S = Object.defineProperty, I = Object.getOwnPropertyDescriptor, r = (e, a, i, l) => {
@@ -1,7 +1,7 @@
1
1
  import { useRef as h, useEffect as b, useCallback as A, useMemo as ut, useLayoutEffect as J } from "react";
2
2
  import { useFrame as ct, useThree as mt } from "@react-three/fiber";
3
3
  import * as a from "three";
4
- import { V as dt, G as ht, W as gt } from "./index-eON1JSxy.js";
4
+ import { V as dt, G as ht, W as gt } from "./index-C-wwuvo7.js";
5
5
  import { H, P as G, C as pt, M as vt, u as U } from "./gaesupStore-DTu0tYBp.js";
6
6
  import "reflect-metadata";
7
7
  import yt from "mitt";
@@ -2,8 +2,8 @@ import { jsx as s, jsxs as u } from "react/jsx-runtime";
2
2
  import { useRef as d, useMemo as f, useEffect as v, useLayoutEffect as h, Suspense as g } from "react";
3
3
  import { useThree as U, useFrame as D } from "@react-three/fiber";
4
4
  import { u as l } from "./gaesupStore-DTu0tYBp.js";
5
- import { T as x } from "./index-eON1JSxy.js";
6
- import { C as y } from "./index-CfiJq_gE.js";
5
+ import { T as x } from "./index-C-wwuvo7.js";
6
+ import { C as y } from "./index-B0hl0p1Z.js";
7
7
  function C() {
8
8
  const r = U((o) => o.gl), t = l((o) => o.setPerformance), n = d(0);
9
9
  return D(() => {
@@ -2,11 +2,12 @@ import { jsx as m, jsxs as E, Fragment as B } from "react/jsx-runtime";
2
2
  import { useRef as P, useState as C, useEffect as K, useMemo as x, useCallback as I, memo as U } from "react";
3
3
  import * as S from "three";
4
4
  import { Line as L } from "@react-three/drei";
5
- import { V as T, G as z, W as N, X as F, Y as A, Z as V, U as q, _ as W } from "./index-eON1JSxy.js";
5
+ import { V as T, G as z, W as N, X as F, Y as A, Z as V, U as q, _ as W } from "./index-C-wwuvo7.js";
6
6
  import { useFrame as Z } from "@react-three/fiber";
7
+ import "reflect-metadata";
7
8
  import { B as j, u as k } from "./gaesupStore-DTu0tYBp.js";
8
9
  import { vec3 as Y } from "@react-three/rapier";
9
- import { u as _ } from "./index-CfiJq_gE.js";
10
+ import { u as _ } from "./index-B0hl0p1Z.js";
10
11
  const H = () => ({
11
12
  position: new S.Vector3(0, 0, 0),
12
13
  velocity: new S.Vector3(0, 0, 0),
@@ -296,7 +297,7 @@ function te({ props: e, children: d }) {
296
297
  })();
297
298
  return f.type === "character" && l.isRiding ? null : /* @__PURE__ */ m(W, { ...n, children: d });
298
299
  }
299
- function ue(e) {
300
+ function de(e) {
300
301
  const { clickToMove: d, children: f, clickerOptions: l, ...g } = e, r = {
301
302
  ...l ?? {},
302
303
  ...l?.agentRadius === void 0 && g.colliderSize?.radius !== void 0 ? { agentRadius: g.colliderSize.radius } : {}
@@ -310,7 +311,7 @@ function ue(e) {
310
311
  ] }) });
311
312
  }
312
313
  export {
313
- ue as C,
314
+ de as C,
314
315
  ee as G,
315
316
  Q as a,
316
317
  X as b,
@@ -1,5 +1,5 @@
1
1
  import { useEffect as k, useRef as I, useState as P, useCallback as W, useMemo as Y } from "react";
2
- import { g as $, S as tt } from "./index-CauGUCKK.js";
2
+ import { g as $, S as tt } from "./index-FQgcO1SU.js";
3
3
  import { c as et, a as nt, f as rt } from "./runtimeFilter-CS35UPHd.js";
4
4
  import { u as st } from "./assetStore-mAClONjR.js";
5
5
  import { c as ot } from "./snapshot-OExk53wq.js";
@@ -1 +1 @@
1
- "use strict";const i=require("react/jsx-runtime"),h=require("react"),A=require("three"),O=require("@react-three/drei"),S=require("./index-BOdJzeGD.cjs"),T=require("@react-three/fiber"),E=require("./gaesupStore-2zKBYTYo.cjs"),D=require("@react-three/rapier"),z=require("./index-B414uKZc.cjs");function U(e){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const u=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(c,a,u.get?u:{enumerable:!0,get:()=>e[a]})}}return c.default=e,Object.freeze(c)}const k=U(A),q=()=>({position:new k.Vector3(0,0,0),velocity:new k.Vector3(0,0,0),rotation:new k.Euler(0,0,0),isMoving:!1,isGrounded:!1,speed:0,height:2});function G(e={}){const{updateInterval:c=0,entityId:a}=e,u=h.useRef(null);u.current||(u.current=q());const[,p]=h.useState(0),r=h.useRef(0),x=h.useRef(0),m=h.useRef({x:0,y:0,z:0}),g=h.useRef(void 0),R=h.useRef(null),{activeState:b,gameStates:v}=S.useStateSystem(),l=y=>{if(a)return a;if(g.current)return g.current;const n=y.getActiveEntities();return g.current=n[0],g.current};return h.useEffect(()=>{g.current=void 0,R.current=E.BridgeFactory.getOrCreate("motion");const y=R.current;if(!y)return;const n=y.subscribe((s,t)=>{const d=l(y);if(!d||t!==d)return;const f=performance.now();if(x.current=f,c>0&&f-r.current<c)return;r.current=f;const o=u.current;o.position.copy(s.position),o.velocity.copy(s.velocity),o.rotation.copy(s.rotation),o.isMoving=s.isMoving,o.isGrounded=s.isGrounded,o.speed=s.speed,o.height=2,p(w=>w+1)});return()=>{n()}},[a,c]),T.useFrame(()=>{const y=performance.now();if(c>0&&y-r.current<c)return;const n=u.current,s=R.current,t=d=>{const f=m.current,o=d.x-f.x,w=d.y-f.y,P=d.z-f.z;return o*o+w*w+P*P>1e-6?(f.x=d.x,f.y=d.y,f.z=d.z,!0):!1};if(s){const d=l(s);if(!(y-x.current<16)&&d){const o=s.snapshot(d);if(o){n.position.copy(o.position),n.velocity.copy(o.velocity),n.rotation.copy(o.rotation),n.isMoving=o.isMoving,n.isGrounded=o.isGrounded,n.speed=o.speed,n.height=2,r.current=y,t(n.position)&&p(w=>w+1);return}}}b?.position&&(n.position.copy(b.position),b.velocity?n.velocity.copy(b.velocity):n.velocity.set(0,0,0),b.euler?n.rotation.copy(b.euler):n.rotation.set(0,0,0),n.isMoving=v?.isMoving||!1,n.isGrounded=v?.isOnTheGround||!1,n.speed=b.velocity?b.velocity.length():0,n.height=2,r.current=y,t(n.position)&&p(d=>d+1))}),u.current}const N={KeyW:"forward",KeyA:"leftward",KeyS:"backward",KeyD:"rightward",ShiftLeft:"shift",Space:"space",KeyZ:"keyZ",KeyR:"keyR",KeyF:"keyF",KeyE:"keyE",Escape:"escape"},M=(e=!0,c=!0,a)=>{const u=E.useGaesupStore(l=>l.automation?.queue.isRunning),p=E.useGaesupStore(l=>l.stopAutomation),r=E.useGaesupStore(l=>l.interaction?.isActive??!0),x=S.useBuildingStore(l=>l.isInEditMode()),m=S.useInputBackend(),g=h.useRef(new Set),R=h.useMemo(()=>({...N}),[]),b=h.useCallback((l,y)=>{if(!r)return!1;try{return m.updateKeyboard({[l]:y}),y?g.current.add(l):g.current.delete(l),!0}catch(n){return console.error("Error updating keyboard state:",n),!1}},[m,r]),v=h.useCallback(()=>{g.current.clear(),m.updateKeyboard({forward:!1,backward:!1,leftward:!1,rightward:!1,shift:!1,space:!1,keyZ:!1,keyR:!1,keyF:!1,keyE:!1,escape:!1})},[m]);return h.useEffect(()=>{(!r||x)&&v()},[v,r,x]),h.useEffect(()=>{const l=(t,d)=>{const f=R[t.code];if(!f)return;if(!r||x){d&&t.preventDefault(),v();return}const o=g.current.has(t.code);d&&!o?(g.current.add(t.code),t.code==="Space"&&t.preventDefault(),c&&u&&(f==="forward"||f==="backward"||f==="leftward"||f==="rightward")&&(p(),m.updateMouse({isActive:!1,shouldRun:!1})),m.updateKeyboard({[f]:!0})):!d&&o&&(g.current.delete(t.code),m.updateKeyboard({[f]:!1}))},y=t=>l(t,!0),n=t=>l(t,!1),s=()=>document.hidden&&v();return window.addEventListener("keydown",y),window.addEventListener("keyup",n),document.addEventListener("visibilitychange",s),()=>{window.removeEventListener("keydown",y),window.removeEventListener("keyup",n),document.removeEventListener("visibilitychange",s)}},[R,c,p,u,v,r,x,m]),{pressedKeys:Array.from(g.current),pushKey:b,isKeyPressed:l=>g.current.has(l),clearAllKeys:v}},C=h.memo(({points:e,color:c})=>e.length<2?null:i.jsx(O.Line,{points:e,color:c,lineWidth:2,dashed:!1}));C.displayName="PathLine";const K=h.memo(()=>i.jsxs("group",{children:[i.jsxs("mesh",{children:[i.jsx("sphereGeometry",{args:[.2,16,16]}),i.jsx("meshStandardMaterial",{color:"#00ff88",emissive:"#00ff88",emissiveIntensity:.5,transparent:!0,opacity:.9})]}),i.jsxs("mesh",{rotation:[Math.PI/2,0,0],children:[i.jsx("ringGeometry",{args:[.3,.5,8]}),i.jsx("meshStandardMaterial",{color:"#00ff88",transparent:!0,opacity:.6,side:k.DoubleSide})]})]}));K.displayName="TargetMarker";function B(){const e=E.useGaesupStore(t=>t.automation),{position:c}=G(),{mouse:a}=S.useInteractionSystem(),[u,p]=h.useState(()=>[...S.getClickNavigationRoute()]);h.useEffect(()=>S.subscribeClickNavigationRoute(()=>{p([...S.getClickNavigationRoute()])}),[]);const r=a?.target||new k.Vector3,x=a?.isActive||!1,m=e?.queue||{actions:[],currentIndex:0},g=m.actions||[],R=m.currentIndex||0,v=c.distanceTo(r)<1,l=x&&!v,y=g.map(t=>t.type==="move"&&t.target?new k.Vector3(t.target.x,t.target.y,t.target.z):null).filter(t=>t!==null),n=u.length>0?u:[r],s=l?[c,...n,...y]:y.length>0?[c,...y]:[];return i.jsxs("group",{children:[l&&i.jsx("group",{position:r,children:i.jsx(K,{})}),s.length>1&&i.jsx(C,{points:s,color:R>=0?"#00ff88":"#ffaa00"}),g.map((t,d)=>{if(t.type==="move"&&t.target){const f=d===R,o=d<R;return i.jsx("group",{position:[t.target.x,t.target.y,t.target.z],children:i.jsxs("mesh",{children:[i.jsx("sphereGeometry",{args:[.1,8,8]}),i.jsx("meshStandardMaterial",{color:o?"#888":f?"#ff4444":"#ffaa00",transparent:!0,opacity:o?.3:.8})]})},`action-${d}`)}return null})]})}function I({clickerOptions:e}){const{onClick:c}=S.useClicker(e),a=u=>{u.stopPropagation();const{cameraOption:p,setCameraOption:r}=E.useGaesupStore.getState();if(p?.focus){r({focus:!1});return}c(u)};return i.jsxs("mesh",{position:[0,0,0],rotation:[-Math.PI/2,0,0],onPointerDown:a,visible:!0,userData:{intangible:!0},children:[i.jsx("planeGeometry",{args:[1e3,1e3]}),i.jsx("meshBasicMaterial",{transparent:!0,opacity:0})]})}function F({props:e,children:c}){const a=E.useGaesupStore(s=>s.mode),{gameStates:u}=S.useStateSystem(),p=E.useGaesupStore(s=>s.rideable),r=E.useGaesupStore(s=>s.urls),x=S.useBuildingStore(s=>s.isInEditMode()),m=z.useGenericRefs();if(M(),x||!a||!u||!p||!r||a.type==="character"&&!r.characterUrl||a.type==="vehicle"&&!r.vehicleUrl||a.type==="airplane"&&!r.airplaneUrl)return null;const{canRide:g,isRiding:R,currentRideable:b}=u,v=b?.id,l=h.useMemo(()=>(v?p[v]?.offset:void 0)??D.vec3(),[v,p]),n=(()=>{const s=e.rigidBodyRef??m.rigidBodyRef,t=e.outerGroupRef??m.outerGroupRef,d=e.innerGroupRef??m.innerGroupRef,f=e.colliderRef??m.colliderRef,o={isActive:!0,componentType:a.type,enableRiding:g,isRiderOn:R,offset:l,ref:s,outerGroupRef:t,innerGroupRef:d,colliderRef:f,parts:(e.parts||[]).filter(j=>!!j.url).map(j=>({...j,url:j.url})),...e.onAnimate?{onAnimate:e.onAnimate}:{},...e.onFrame?{onFrame:e.onFrame}:{},...e.onReady?{onReady:e.onReady}:{},...e.onDestroy?{onDestroy:e.onDestroy}:{},...e.onDestory?{onDestory:e.onDestory}:{},...typeof e.baseColor=="string"&&e.baseColor.trim().length>0?{baseColor:e.baseColor}:{},...Array.isArray(e.excludeBaseNodes)&&e.excludeBaseNodes.length>0?{excludeBaseNodes:e.excludeBaseNodes}:{},...e.rigidBodyProps?{rigidBodyProps:e.rigidBodyProps}:{},...e.controllerOptions?{controllerOptions:e.controllerOptions}:{},...e.groundRay?{groundRay:e.groundRay}:{},...e.colliderSize?{colliderSize:e.colliderSize}:{},...e.position?{position:e.position}:{},...e.rotation?{rotation:e.rotation}:{},...e.scale?{scale:e.scale}:{}},w=R&&a.type!=="character"?r.ridingUrl:void 0,P=typeof w=="string"&&w.length>0?{ridingUrl:w}:{};switch(a.type){case"character":return{...o,url:r.characterUrl||""};case"vehicle":return{...o,...P,url:r.vehicleUrl||"",wheelUrl:r.wheelUrl};case"airplane":return{...o,...P,url:r.airplaneUrl||""};default:return{...o,url:r.characterUrl||""}}})();return a.type==="character"&&u.isRiding?null:i.jsx(S.PhysicsEntity,{...n,children:c})}function L(e){const{clickToMove:c,children:a,clickerOptions:u,...p}=e,r={...u??{},...u?.agentRadius===void 0&&p.colliderSize?.radius!==void 0?{agentRadius:p.colliderSize.radius}:{}};return i.jsx(F,{props:p,children:i.jsxs(i.Fragment,{children:[c&&i.jsxs(i.Fragment,{children:[i.jsx(I,{clickerOptions:r}),i.jsx(B,{})]}),a]})})}exports.Clicker=B;exports.ControllerWrapper=L;exports.GroundClicker=I;exports.useKeyboard=M;exports.usePlayerPosition=G;
1
+ "use strict";const i=require("react/jsx-runtime"),h=require("react"),A=require("three"),O=require("@react-three/drei"),S=require("./index-CJj-Z7Jr.cjs"),T=require("@react-three/fiber"),E=require("./gaesupStore-2zKBYTYo.cjs"),D=require("@react-three/rapier"),z=require("./index-D1hpjfAw.cjs");function U(e){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const u=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(c,a,u.get?u:{enumerable:!0,get:()=>e[a]})}}return c.default=e,Object.freeze(c)}const k=U(A),q=()=>({position:new k.Vector3(0,0,0),velocity:new k.Vector3(0,0,0),rotation:new k.Euler(0,0,0),isMoving:!1,isGrounded:!1,speed:0,height:2});function G(e={}){const{updateInterval:c=0,entityId:a}=e,u=h.useRef(null);u.current||(u.current=q());const[,p]=h.useState(0),r=h.useRef(0),x=h.useRef(0),m=h.useRef({x:0,y:0,z:0}),g=h.useRef(void 0),R=h.useRef(null),{activeState:b,gameStates:v}=S.useStateSystem(),l=y=>{if(a)return a;if(g.current)return g.current;const n=y.getActiveEntities();return g.current=n[0],g.current};return h.useEffect(()=>{g.current=void 0,R.current=E.BridgeFactory.getOrCreate("motion");const y=R.current;if(!y)return;const n=y.subscribe((s,t)=>{const d=l(y);if(!d||t!==d)return;const f=performance.now();if(x.current=f,c>0&&f-r.current<c)return;r.current=f;const o=u.current;o.position.copy(s.position),o.velocity.copy(s.velocity),o.rotation.copy(s.rotation),o.isMoving=s.isMoving,o.isGrounded=s.isGrounded,o.speed=s.speed,o.height=2,p(w=>w+1)});return()=>{n()}},[a,c]),T.useFrame(()=>{const y=performance.now();if(c>0&&y-r.current<c)return;const n=u.current,s=R.current,t=d=>{const f=m.current,o=d.x-f.x,w=d.y-f.y,P=d.z-f.z;return o*o+w*w+P*P>1e-6?(f.x=d.x,f.y=d.y,f.z=d.z,!0):!1};if(s){const d=l(s);if(!(y-x.current<16)&&d){const o=s.snapshot(d);if(o){n.position.copy(o.position),n.velocity.copy(o.velocity),n.rotation.copy(o.rotation),n.isMoving=o.isMoving,n.isGrounded=o.isGrounded,n.speed=o.speed,n.height=2,r.current=y,t(n.position)&&p(w=>w+1);return}}}b?.position&&(n.position.copy(b.position),b.velocity?n.velocity.copy(b.velocity):n.velocity.set(0,0,0),b.euler?n.rotation.copy(b.euler):n.rotation.set(0,0,0),n.isMoving=v?.isMoving||!1,n.isGrounded=v?.isOnTheGround||!1,n.speed=b.velocity?b.velocity.length():0,n.height=2,r.current=y,t(n.position)&&p(d=>d+1))}),u.current}const N={KeyW:"forward",KeyA:"leftward",KeyS:"backward",KeyD:"rightward",ShiftLeft:"shift",Space:"space",KeyZ:"keyZ",KeyR:"keyR",KeyF:"keyF",KeyE:"keyE",Escape:"escape"},M=(e=!0,c=!0,a)=>{const u=E.useGaesupStore(l=>l.automation?.queue.isRunning),p=E.useGaesupStore(l=>l.stopAutomation),r=E.useGaesupStore(l=>l.interaction?.isActive??!0),x=S.useBuildingStore(l=>l.isInEditMode()),m=S.useInputBackend(),g=h.useRef(new Set),R=h.useMemo(()=>({...N}),[]),b=h.useCallback((l,y)=>{if(!r)return!1;try{return m.updateKeyboard({[l]:y}),y?g.current.add(l):g.current.delete(l),!0}catch(n){return console.error("Error updating keyboard state:",n),!1}},[m,r]),v=h.useCallback(()=>{g.current.clear(),m.updateKeyboard({forward:!1,backward:!1,leftward:!1,rightward:!1,shift:!1,space:!1,keyZ:!1,keyR:!1,keyF:!1,keyE:!1,escape:!1})},[m]);return h.useEffect(()=>{(!r||x)&&v()},[v,r,x]),h.useEffect(()=>{const l=(t,d)=>{const f=R[t.code];if(!f)return;if(!r||x){d&&t.preventDefault(),v();return}const o=g.current.has(t.code);d&&!o?(g.current.add(t.code),t.code==="Space"&&t.preventDefault(),c&&u&&(f==="forward"||f==="backward"||f==="leftward"||f==="rightward")&&(p(),m.updateMouse({isActive:!1,shouldRun:!1})),m.updateKeyboard({[f]:!0})):!d&&o&&(g.current.delete(t.code),m.updateKeyboard({[f]:!1}))},y=t=>l(t,!0),n=t=>l(t,!1),s=()=>document.hidden&&v();return window.addEventListener("keydown",y),window.addEventListener("keyup",n),document.addEventListener("visibilitychange",s),()=>{window.removeEventListener("keydown",y),window.removeEventListener("keyup",n),document.removeEventListener("visibilitychange",s)}},[R,c,p,u,v,r,x,m]),{pressedKeys:Array.from(g.current),pushKey:b,isKeyPressed:l=>g.current.has(l),clearAllKeys:v}},C=h.memo(({points:e,color:c})=>e.length<2?null:i.jsx(O.Line,{points:e,color:c,lineWidth:2,dashed:!1}));C.displayName="PathLine";const K=h.memo(()=>i.jsxs("group",{children:[i.jsxs("mesh",{children:[i.jsx("sphereGeometry",{args:[.2,16,16]}),i.jsx("meshStandardMaterial",{color:"#00ff88",emissive:"#00ff88",emissiveIntensity:.5,transparent:!0,opacity:.9})]}),i.jsxs("mesh",{rotation:[Math.PI/2,0,0],children:[i.jsx("ringGeometry",{args:[.3,.5,8]}),i.jsx("meshStandardMaterial",{color:"#00ff88",transparent:!0,opacity:.6,side:k.DoubleSide})]})]}));K.displayName="TargetMarker";function B(){const e=E.useGaesupStore(t=>t.automation),{position:c}=G(),{mouse:a}=S.useInteractionSystem(),[u,p]=h.useState(()=>[...S.getClickNavigationRoute()]);h.useEffect(()=>S.subscribeClickNavigationRoute(()=>{p([...S.getClickNavigationRoute()])}),[]);const r=a?.target||new k.Vector3,x=a?.isActive||!1,m=e?.queue||{actions:[],currentIndex:0},g=m.actions||[],R=m.currentIndex||0,v=c.distanceTo(r)<1,l=x&&!v,y=g.map(t=>t.type==="move"&&t.target?new k.Vector3(t.target.x,t.target.y,t.target.z):null).filter(t=>t!==null),n=u.length>0?u:[r],s=l?[c,...n,...y]:y.length>0?[c,...y]:[];return i.jsxs("group",{children:[l&&i.jsx("group",{position:r,children:i.jsx(K,{})}),s.length>1&&i.jsx(C,{points:s,color:R>=0?"#00ff88":"#ffaa00"}),g.map((t,d)=>{if(t.type==="move"&&t.target){const f=d===R,o=d<R;return i.jsx("group",{position:[t.target.x,t.target.y,t.target.z],children:i.jsxs("mesh",{children:[i.jsx("sphereGeometry",{args:[.1,8,8]}),i.jsx("meshStandardMaterial",{color:o?"#888":f?"#ff4444":"#ffaa00",transparent:!0,opacity:o?.3:.8})]})},`action-${d}`)}return null})]})}function I({clickerOptions:e}){const{onClick:c}=S.useClicker(e),a=u=>{u.stopPropagation();const{cameraOption:p,setCameraOption:r}=E.useGaesupStore.getState();if(p?.focus){r({focus:!1});return}c(u)};return i.jsxs("mesh",{position:[0,0,0],rotation:[-Math.PI/2,0,0],onPointerDown:a,visible:!0,userData:{intangible:!0},children:[i.jsx("planeGeometry",{args:[1e3,1e3]}),i.jsx("meshBasicMaterial",{transparent:!0,opacity:0})]})}function F({props:e,children:c}){const a=E.useGaesupStore(s=>s.mode),{gameStates:u}=S.useStateSystem(),p=E.useGaesupStore(s=>s.rideable),r=E.useGaesupStore(s=>s.urls),x=S.useBuildingStore(s=>s.isInEditMode()),m=z.useGenericRefs();if(M(),x||!a||!u||!p||!r||a.type==="character"&&!r.characterUrl||a.type==="vehicle"&&!r.vehicleUrl||a.type==="airplane"&&!r.airplaneUrl)return null;const{canRide:g,isRiding:R,currentRideable:b}=u,v=b?.id,l=h.useMemo(()=>(v?p[v]?.offset:void 0)??D.vec3(),[v,p]),n=(()=>{const s=e.rigidBodyRef??m.rigidBodyRef,t=e.outerGroupRef??m.outerGroupRef,d=e.innerGroupRef??m.innerGroupRef,f=e.colliderRef??m.colliderRef,o={isActive:!0,componentType:a.type,enableRiding:g,isRiderOn:R,offset:l,ref:s,outerGroupRef:t,innerGroupRef:d,colliderRef:f,parts:(e.parts||[]).filter(j=>!!j.url).map(j=>({...j,url:j.url})),...e.onAnimate?{onAnimate:e.onAnimate}:{},...e.onFrame?{onFrame:e.onFrame}:{},...e.onReady?{onReady:e.onReady}:{},...e.onDestroy?{onDestroy:e.onDestroy}:{},...e.onDestory?{onDestory:e.onDestory}:{},...typeof e.baseColor=="string"&&e.baseColor.trim().length>0?{baseColor:e.baseColor}:{},...Array.isArray(e.excludeBaseNodes)&&e.excludeBaseNodes.length>0?{excludeBaseNodes:e.excludeBaseNodes}:{},...e.rigidBodyProps?{rigidBodyProps:e.rigidBodyProps}:{},...e.controllerOptions?{controllerOptions:e.controllerOptions}:{},...e.groundRay?{groundRay:e.groundRay}:{},...e.colliderSize?{colliderSize:e.colliderSize}:{},...e.position?{position:e.position}:{},...e.rotation?{rotation:e.rotation}:{},...e.scale?{scale:e.scale}:{}},w=R&&a.type!=="character"?r.ridingUrl:void 0,P=typeof w=="string"&&w.length>0?{ridingUrl:w}:{};switch(a.type){case"character":return{...o,url:r.characterUrl||""};case"vehicle":return{...o,...P,url:r.vehicleUrl||"",wheelUrl:r.wheelUrl};case"airplane":return{...o,...P,url:r.airplaneUrl||""};default:return{...o,url:r.characterUrl||""}}})();return a.type==="character"&&u.isRiding?null:i.jsx(S.PhysicsEntity,{...n,children:c})}function L(e){const{clickToMove:c,children:a,clickerOptions:u,...p}=e,r={...u??{},...u?.agentRadius===void 0&&p.colliderSize?.radius!==void 0?{agentRadius:p.colliderSize.radius}:{}};return i.jsx(F,{props:p,children:i.jsxs(i.Fragment,{children:[c&&i.jsxs(i.Fragment,{children:[i.jsx(I,{clickerOptions:r}),i.jsx(B,{})]}),a]})})}exports.Clicker=B;exports.ControllerWrapper=L;exports.GroundClicker=I;exports.useKeyboard=M;exports.usePlayerPosition=G;
@@ -1,12 +1,12 @@
1
- import { jsx as j, Fragment as Zt, jsxs as ke } from "react/jsx-runtime";
1
+ import { jsx as H, Fragment as Zt, jsxs as ke } from "react/jsx-runtime";
2
2
  import { useRef as T, useEffect as W, useCallback as R, createContext as qt, useContext as gt, useSyncExternalStore as Ze, useMemo as L, useState as Jt, forwardRef as mt, useImperativeHandle as Yt, createElement as Xt } from "react";
3
3
  import { useGLTF as Oe, useAnimations as Qt } from "@react-three/drei";
4
4
  import { useFrame as en, useGraph as pt } from "@react-three/fiber";
5
5
  import { RigidBody as tn, euler as nn, CapsuleCollider as rn } from "@react-three/rapier";
6
6
  import * as w from "three";
7
7
  import { SkeletonUtils as yt } from "three-stdlib";
8
- import { l as ye, b as on, D as sn, A as bt, M as wt, u as B, B as vt, H as P, P as C, a as an, c as ae, d as ln, e as St, g as cn, V as qe } from "./gaesupStore-DTu0tYBp.js";
9
8
  import "reflect-metadata";
9
+ import { l as ye, b as on, D as sn, A as bt, M as wt, u as B, B as vt, H as P, P as C, a as an, c as ae, d as ln, e as St, g as cn, V as qe } from "./gaesupStore-DTu0tYBp.js";
10
10
  import { I as un } from "./EventBus-Ck0Dwee2.js";
11
11
  import { enableMapSet as dn } from "immer";
12
12
  import { create as hn } from "zustand";
@@ -1702,7 +1702,7 @@ function Io({
1702
1702
  revision: n = 0,
1703
1703
  children: e
1704
1704
  }) {
1705
- return /* @__PURE__ */ j(Ue.Provider, { value: { runtime: t, revision: n }, children: e });
1705
+ return /* @__PURE__ */ H(Ue.Provider, { value: { runtime: t, revision: n }, children: e });
1706
1706
  }
1707
1707
  function At() {
1708
1708
  return gt(Ue).runtime;
@@ -2259,7 +2259,7 @@ function Pt({ nodes: t, color: n, skeleton: e, url: r, excludeNodeNames: o }) {
2259
2259
  return W(() => () => {
2260
2260
  for (const a of s)
2261
2261
  a.dispose();
2262
- }, [s]), /* @__PURE__ */ j(Zt, { children: i.map((a) => a ? a.type === "skinnedMesh" ? /* @__PURE__ */ j(
2262
+ }, [s]), /* @__PURE__ */ H(Zt, { children: i.map((a) => a ? a.type === "skinnedMesh" ? /* @__PURE__ */ H(
2263
2263
  "skinnedMesh",
2264
2264
  {
2265
2265
  castShadow: !0,
@@ -2271,7 +2271,7 @@ function Pt({ nodes: t, color: n, skeleton: e, url: r, excludeNodeNames: o }) {
2271
2271
  dispose: null
2272
2272
  },
2273
2273
  a.key
2274
- ) : /* @__PURE__ */ j(
2274
+ ) : /* @__PURE__ */ H(
2275
2275
  "mesh",
2276
2276
  {
2277
2277
  castShadow: !0,
@@ -2285,7 +2285,7 @@ function Pt({ nodes: t, color: n, skeleton: e, url: r, excludeNodeNames: o }) {
2285
2285
  }
2286
2286
  function Gr({ url: t, isActive: n, color: e, skeleton: r }) {
2287
2287
  const { scene: o } = Oe(t), i = L(() => yt.clone(o), [o]), { nodes: s } = pt(i);
2288
- return Ot(n), /* @__PURE__ */ j("group", { children: /* @__PURE__ */ j(
2288
+ return Ot(n), /* @__PURE__ */ H("group", { children: /* @__PURE__ */ H(
2289
2289
  Pt,
2290
2290
  {
2291
2291
  nodes: s,
@@ -2297,29 +2297,32 @@ function Gr({ url: t, isActive: n, color: e, skeleton: r }) {
2297
2297
  }
2298
2298
  const Ft = mt((t, n) => {
2299
2299
  const e = typeof t.modelYawOffset == "number" ? t.modelYawOffset : t.componentType === "character" ? Math.PI : 0, r = t.baseColor ?? t.parts?.[0]?.color;
2300
- return /* @__PURE__ */ j("group", { receiveShadow: !0, castShadow: !0, ref: n, userData: { intangible: !0 }, children: /* @__PURE__ */ ke("group", { "rotation-y": e, children: [
2300
+ return /* @__PURE__ */ ke("group", { receiveShadow: !0, castShadow: !0, ref: n, userData: { intangible: !0 }, children: [
2301
2301
  t.children,
2302
- t.objectNode && t.animationRef && /* @__PURE__ */ j(
2303
- "primitive",
2304
- {
2305
- object: t.objectNode,
2306
- visible: !1,
2307
- receiveShadow: !0,
2308
- castShadow: !0,
2309
- ref: t.animationRef
2310
- }
2311
- ),
2312
- /* @__PURE__ */ j(
2313
- Pt,
2314
- {
2315
- nodes: t.nodes,
2316
- skeleton: t.skeleton,
2317
- url: t.url || "",
2318
- ...r ? { color: r } : {},
2319
- ...t.excludeBaseNodes && t.excludeBaseNodes.length > 0 ? { excludeNodeNames: t.excludeBaseNodes } : {}
2320
- }
2321
- )
2322
- ] }) });
2302
+ /* @__PURE__ */ ke("group", { "rotation-y": e, ...t.modelScale !== void 0 ? { scale: t.modelScale } : {}, children: [
2303
+ t.objectNode && t.animationRef && /* @__PURE__ */ H(
2304
+ "primitive",
2305
+ {
2306
+ object: t.objectNode,
2307
+ visible: !1,
2308
+ receiveShadow: !0,
2309
+ castShadow: !0,
2310
+ ref: t.animationRef
2311
+ }
2312
+ ),
2313
+ /* @__PURE__ */ H(
2314
+ Pt,
2315
+ {
2316
+ nodes: t.nodes,
2317
+ skeleton: t.skeleton,
2318
+ url: t.url || "",
2319
+ ...r ? { color: r } : {},
2320
+ ...t.excludeBaseNodes && t.excludeBaseNodes.length > 0 ? { excludeNodeNames: t.excludeBaseNodes } : {}
2321
+ }
2322
+ ),
2323
+ t.modelChildren
2324
+ ] })
2325
+ ] });
2323
2326
  });
2324
2327
  Ft.displayName = "InnerGroupRef";
2325
2328
  const be = /* @__PURE__ */ new Map();
@@ -2522,7 +2525,7 @@ const Fr = mt(
2522
2525
  if (!b || l.current === b) return;
2523
2526
  const y = l.current ? a[l.current] : void 0, I = a[b];
2524
2527
  y?.fadeOut(0.2), I?.reset().fadeIn(0.2).play(), l.current = b;
2525
- }, [a, t.currentAnimation]), /* @__PURE__ */ j("group", { ...z, userData: { intangible: !0 }, children: /* @__PURE__ */ ke(
2528
+ }, [a, t.currentAnimation]), /* @__PURE__ */ H("group", { ...z, userData: { intangible: !0 }, children: /* @__PURE__ */ ke(
2526
2529
  tn,
2527
2530
  {
2528
2531
  ...A,
@@ -2539,7 +2542,7 @@ const Fr = mt(
2539
2542
  onCollisionEnter: d,
2540
2543
  ...t.rigidBodyProps,
2541
2544
  children: [
2542
- !t.isNotColliding && /* @__PURE__ */ j(
2545
+ !t.isNotColliding && /* @__PURE__ */ H(
2543
2546
  rn,
2544
2547
  {
2545
2548
  ref: t.colliderRef,
@@ -2547,7 +2550,7 @@ const Fr = mt(
2547
2550
  position: [0, K.y, 0]
2548
2551
  }
2549
2552
  ),
2550
- /* @__PURE__ */ j("group", { ...t.scale !== void 0 ? { scale: t.scale } : {}, children: /* @__PURE__ */ ke(
2553
+ /* @__PURE__ */ H(
2551
2554
  Ft,
2552
2555
  {
2553
2556
  animationRef: c,
@@ -2557,6 +2560,7 @@ const Fr = mt(
2557
2560
  componentType: t.componentType,
2558
2561
  ...S ? { objectNode: S } : {},
2559
2562
  ...t.modelYawOffset !== void 0 ? { modelYawOffset: t.modelYawOffset } : {},
2563
+ ...t.scale !== void 0 ? { modelScale: t.scale } : {},
2560
2564
  ...t.isRiderOn !== void 0 ? { isRiderOn: t.isRiderOn } : {},
2561
2565
  ...t.enableRiding !== void 0 ? { enableRiding: t.enableRiding } : {},
2562
2566
  ...t.ridingUrl ? { ridingUrl: t.ridingUrl } : {},
@@ -2564,12 +2568,10 @@ const Fr = mt(
2564
2568
  ...t.baseColor ? { baseColor: t.baseColor } : {},
2565
2569
  ...t.excludeBaseNodes ? { excludeBaseNodes: t.excludeBaseNodes } : {},
2566
2570
  ...t.parts ? { parts: t.parts } : {},
2567
- children: [
2568
- t.children,
2569
- p
2570
- ]
2571
+ ...p ? { modelChildren: p } : {},
2572
+ children: t.children
2571
2573
  }
2572
- ) })
2574
+ )
2573
2575
  ]
2574
2576
  }
2575
2577
  ) });
@@ -2816,7 +2818,7 @@ const E = Object.freeze({
2816
2818
  GRID_DIVISIONS: 25,
2817
2819
  // 100m / 4m = 25 divisions
2818
2820
  DEFAULT_GRID_SIZE: 100
2819
- }), H = new Br({
2821
+ }), j = new Br({
2820
2822
  id: "building-square",
2821
2823
  spec: {
2822
2824
  cellSize: E.GRID_CELL_SIZE,
@@ -2830,7 +2832,7 @@ const E = Object.freeze({
2830
2832
  ...t,
2831
2833
  x: Math.round(t.x / E.SNAP_GRID_SIZE) * E.SNAP_GRID_SIZE,
2832
2834
  z: Math.round(t.z / E.SNAP_GRID_SIZE) * E.SNAP_GRID_SIZE
2833
- }), Vr = (t) => H.fromWorld(t), Zr = (t) => H.toWorld(t), qr = (t) => {
2835
+ }), Vr = (t) => j.fromWorld(t), Zr = (t) => j.toWorld(t), qr = (t) => {
2834
2836
  const n = Math.PI / 2;
2835
2837
  return (Math.round(t / n) % 4 + 4) % 4 * n;
2836
2838
  }, Jr = (t) => {
@@ -2843,7 +2845,7 @@ const E = Object.freeze({
2843
2845
  return 0;
2844
2846
  }
2845
2847
  }, Po = (t) => {
2846
- const n = H.edgeToWorld(t), e = Jr(t.side), r = E.WALL_SIZES.WIDTH / 2, o = {
2848
+ const n = j.edgeToWorld(t), e = Jr(t.side), r = E.WALL_SIZES.WIDTH / 2, o = {
2847
2849
  x: Math.sin(e),
2848
2850
  z: Math.cos(e)
2849
2851
  };
@@ -2876,7 +2878,7 @@ const E = Object.freeze({
2876
2878
  level: X(Math.round(i.y / E.HEIGHT_STEP)),
2877
2879
  side: i.z - Math.trunc(i.z / o) * o >= 0 ? "south" : "north"
2878
2880
  };
2879
- }, Fo = (t) => H.edgeKey(t), X = (t) => Object.is(t, -0) || Math.abs(t) < 1e-10 ? 0 : Number(t.toFixed(10)), U = (t) => Vr(t), Lo = (t) => Zr(t), ie = (t, n = 1) => {
2881
+ }, Fo = (t) => j.edgeKey(t), X = (t) => Object.is(t, -0) || Math.abs(t) < 1e-10 ? 0 : Number(t.toFixed(10)), U = (t) => Vr(t), Lo = (t) => Zr(t), ie = (t, n = 1) => {
2880
2882
  const e = Math.max(1, Math.round(n)), r = -Math.floor(e / 2), o = [];
2881
2883
  for (let i = 0; i < e; i++)
2882
2884
  for (let s = 0; s < e; s++)
@@ -2886,7 +2888,7 @@ const E = Object.freeze({
2886
2888
  level: t.level
2887
2889
  });
2888
2890
  return o;
2889
- }, Bo = (t) => t.map((n) => H.key(n)), Yr = (t, n = {}) => {
2891
+ }, Bo = (t) => t.map((n) => j.key(n)), Yr = (t, n = {}) => {
2890
2892
  const e = Math.max(1, Math.round(n.x ?? 1)), r = Math.max(1, Math.round(n.y ?? 1)), o = Math.max(1, Math.round(n.z ?? 1)), i = [];
2891
2893
  for (let s = 0; s < e; s++)
2892
2894
  for (let a = 0; a < r; a++)
@@ -2900,22 +2902,22 @@ const E = Object.freeze({
2900
2902
  }, Xr = {
2901
2903
  id: "building-placement",
2902
2904
  toWorld(t) {
2903
- return t.kind === "cell" ? H.toWorld(t.cell) : H.edgeToWorld(t.edge);
2905
+ return t.kind === "cell" ? j.toWorld(t.cell) : j.edgeToWorld(t.edge);
2904
2906
  },
2905
2907
  fromWorld(t) {
2906
2908
  return {
2907
2909
  kind: "cell",
2908
- cell: H.fromWorld(t)
2910
+ cell: j.fromWorld(t)
2909
2911
  };
2910
2912
  },
2911
2913
  getNeighbors(t) {
2912
- return t.kind === "edge" ? [t] : H.getNeighbors(t.cell).map((n) => ({ kind: "cell", cell: n }));
2914
+ return t.kind === "edge" ? [t] : j.getNeighbors(t.cell).map((n) => ({ kind: "cell", cell: n }));
2913
2915
  },
2914
2916
  equals(t, n) {
2915
2917
  return this.key(t) === this.key(n);
2916
2918
  },
2917
2919
  key(t) {
2918
- return t.kind === "cell" ? `cell:${H.key(t.cell)}` : `edge:${H.edgeKey(t.edge)}`;
2920
+ return t.kind === "cell" ? `cell:${j.key(t.cell)}` : `edge:${j.edgeKey(t.edge)}`;
2919
2921
  }
2920
2922
  }, Ht = (t) => {
2921
2923
  const n = t.cell ?? U(t.position), e = t.footprint ?? ie(n, t.size || 1), r = {
@@ -4160,7 +4162,7 @@ export {
4160
4162
  Zr as b,
4161
4163
  dt as c,
4162
4164
  no as d,
4163
- H as e,
4165
+ j as e,
4164
4166
  Xr as f,
4165
4167
  Fo as g,
4166
4168
  Jr as h,