gaesup-world 1.0.27 → 1.0.28

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-CAz_a7R2.cjs"),U=require("@react-three/drei"),W=require("@react-three/fiber"),z=require("@react-three/rapier"),H=require("three"),L=require("./gaesupStore-CRQ-tcIz.cjs"),R=require("./index-D_JJFQre.cjs"),V=require("./index-B241fpz2.cjs");function Y(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const u in t)if(u!=="default"){const s=Object.getOwnPropertyDescriptor(t,u);Object.defineProperty(o,u,s.get?s:{enumerable:!0,get:()=>t[u]})}}return o.default=t,Object.freeze(o)}const X=Y(H),g=t=>t?.type==="character";function Z({blueprint:t}){const o=L.useGaesupStore(r=>r.setUrls),u=L.useGaesupStore(r=>r.setCameraOption),s=L.useGaesupStore(r=>r.setMode),_=L.useGaesupStore(r=>r.mode),[l,h]=d.useState(20),c=g(t)?t.controls?.clickToMove??!0:!1,v=g(t)?t.controls?.enableKeyboard??!0:!1,A=g(t)?t.controls?.enableMouse??!0:!1;R.useKeyboard(v,v),d.useEffect(()=>{s({type:"character",control:g(t)&&t.camera?.mode||"thirdPerson"});const r=g(t)?t.camera||{}:{};u({xDistance:r.distance?.x||l,yDistance:r.distance?.y||l*.5,zDistance:r.distance?.z||l,offset:new X.Vector3(0,0,0),enableCollision:r.enableCollision??!1,smoothing:r.smoothing||{position:.25,rotation:.3,fov:.2},fov:r.fov||50,zoom:1,enableZoom:r.enableZoom??!0,zoomSpeed:r.zoomSpeed||.001,minZoom:r.minZoom||.5,maxZoom:r.maxZoom||3,enableFocus:!1,maxDistance:50,distance:10,bounds:{minY:2,maxY:50}})},[s,u,l,t]),d.useEffect(()=>{if(g(t)){if(t.visuals?.model)o({characterUrl:t.visuals.model});else if(t.visuals?.parts&&t.visuals.parts.length>0){const r=t.visuals.parts.find(b=>b.type==="body");r&&o({characterUrl:r.url})}}},[t,o]),d.useEffect(()=>{const r=b=>{if(g(t)&&t.camera?.enableZoom===!1)return;b.preventDefault();const N=b.deltaY*.01;h(P=>Math.max(10,Math.min(40,P+N)))};return window.addEventListener("wheel",r,{passive:!1}),()=>window.removeEventListener("wheel",r)},[t]);const C=()=>!g(t)||!t.visuals?.parts?[]:t.visuals.parts.filter(r=>r.type!=="body").map(r=>r.color?{url:r.url,color:r.color}:{url:r.url});return e.jsxs("div",{className:"blueprint-preview",children:[e.jsxs(W.Canvas,{shadows:!0,camera:{position:[0,10,20],fov:50},style:{width:"100%",height:"100%"},children:[e.jsx(V.Camera,{}),e.jsx(U.Environment,{preset:"sunset"}),e.jsx("ambientLight",{intensity:.5}),e.jsx("directionalLight",{castShadow:!0,position:[20,30,10],intensity:.5,"shadow-mapSize":[1024,1024],"shadow-camera-near":1,"shadow-camera-far":120,"shadow-camera-top":90,"shadow-camera-right":90,"shadow-camera-bottom":-90,"shadow-camera-left":-90}),e.jsxs(z.Physics,{debug:!1,gravity:[0,-9.81,0],children:[t&&_?.type==="character"&&e.jsx(R.ControllerWrapper,{controllerOptions:{lerp:{cameraTurn:.1,cameraPosition:.08}},rigidBodyProps:{lockRotations:!0},parts:C(),position:[0,1,0],rotation:z.euler({x:0,y:Math.PI,z:0})},`preview-${t.id}`),c&&e.jsxs(e.Fragment,{children:[e.jsx(R.Clicker,{}),e.jsx(R.GroundClicker,{})]}),e.jsx(z.RigidBody,{type:"fixed",children:e.jsxs("mesh",{receiveShadow:!0,position:[0,-.5,0],children:[e.jsx("boxGeometry",{args:[100,1,100]}),e.jsx("meshStandardMaterial",{color:"#303030"})]})}),e.jsx(U.Grid,{renderOrder:-1,position:[0,.01,0],infiniteGrid:!0,cellSize:1,cellThickness:.5,cellColor:"#404040",sectionSize:5,sectionThickness:1,sectionColor:"#606060",fadeDistance:50,fadeStrength:1,followCamera:!1,userData:{intangible:!0}})]})]}),t&&e.jsxs("div",{className:"blueprint-preview__info",children:[e.jsx("h4",{className:"blueprint-preview__name",children:t.name}),e.jsx("p",{className:"blueprint-preview__type",children:t.type}),g(t)&&t.physics&&e.jsxs("div",{className:"blueprint-preview__stats",children:[e.jsxs("div",{children:["Move Speed: ",t.physics.moveSpeed]}),e.jsxs("div",{children:["Jump Force: ",t.physics.jumpForce]})]}),e.jsxs("div",{className:"blueprint-preview__controls",children:[e.jsxs("div",{children:["Camera: ",g(t)?t.camera?.mode||"thirdPerson":"N/A"]}),e.jsxs("div",{children:["Keyboard: ",v?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Mouse: ",A?"Enabled":"Disabled"]}),e.jsxs("div",{children:["Click to Move: ",c?"Enabled":"Disabled"]})]})]})]})}const ee=t=>{switch(t.type){case"animation-sequence":return"animation";case"behavior-tree":return"behavior";default:return t.type}},K=t=>({id:t.id,name:t.name,type:ee(t),version:t.version,tags:t.tags||[],description:t.description??"",lastModified:new Date().toISOString().split("T")[0]??""}),G=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),te=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!G(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return G(s)?(s[_]=u,!0):!1},se=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],re=({onClose:t})=>{const[o,u]=d.useState("character"),[s,_]=d.useState(null),[l,h]=d.useState(""),[c,v]=d.useState(null),[A,C]=d.useState(!0),{spawnAtCursor:r,isSpawning:b}=E.useSpawnFromBlueprint(),N=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),P=d.useMemo(()=>{const i={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return N.forEach(a=>{a.type in i&&i[a.type]++}),se.map(a=>({...a,count:i[a.type]})).filter(a=>a.count>0)},[N]),w=d.useMemo(()=>N.filter(i=>{const a=i.type===o,m=l===""||i.name.toLowerCase().includes(l.toLowerCase())||i.tags.some(x=>x.toLowerCase().includes(l.toLowerCase()));return a&&m}),[o,l,N]),M=d.useCallback((i,a)=>{v(m=>{if(!m)return null;const x=JSON.parse(JSON.stringify(m));return te(x,i,a)?x:m})},[]),S=d.useCallback(i=>{if(_(i),i){const a=E.blueprintRegistry.get(i);a&&v(JSON.parse(JSON.stringify(a)))}else v(null)},[]);d.useEffect(()=>{const i=w.some(a=>a.id===s);w[0]?.id&&w.length>0&&!i?S(w[0].id):w.length===0&&S(null)},[w,s,S]);const I=async()=>{if(!s)return;await r(s)&&t()},D=(i,a,m)=>Array.isArray(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),e.jsx("div",{className:"blueprint-editor__inspector-list",children:a.length===0?"비어 있음":`${a.length}개 항목`})]},m.join(".")):G(a)?e.jsxs("div",{className:"blueprint-editor__inspector-group",children:[e.jsx("div",{className:"blueprint-editor__inspector-title",children:i}),Object.entries(a).map(([x,T])=>D(x,T,[...m,x]))]},m.join(".")):typeof a=="boolean"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("button",{className:`blueprint-editor__toggle ${a?"blueprint-editor__toggle--on":""}`,onClick:()=>M(m,!a),children:a?"ON":"OFF"})]},m.join(".")):typeof a=="number"?e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"number",value:a,onChange:x=>M(m,Number(x.target.value)),className:"blueprint-editor__inspector-input"})]},m.join(".")):e.jsxs("label",{className:"blueprint-editor__inspector-field",children:[e.jsx("span",{children:i}),e.jsx("input",{type:"text",value:typeof a=="string"?a:"",onChange:x=>M(m,x.target.value),className:"blueprint-editor__inspector-input"})]},m.join("."));return e.jsxs("div",{className:"blueprint-editor",children:[e.jsxs("div",{className:"blueprint-editor__sidebar",children:[e.jsx("div",{className:"blueprint-editor__search",children:e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:l,onChange:i=>h(i.target.value),className:"blueprint-editor__search-input"})}),e.jsx("div",{className:"blueprint-editor__categories",children:P.map(i=>e.jsxs("button",{onClick:()=>u(i.type),className:`blueprint-editor__category ${o===i.type?"active":""}`,children:[e.jsx("span",{className:"blueprint-editor__category-name",children:i.name}),e.jsx("span",{className:"blueprint-editor__category-count",children:i.count})]},i.id))}),e.jsx("div",{className:"blueprint-editor__list",children:w.map(i=>e.jsxs("div",{onClick:()=>S(i.id),className:`blueprint-editor__item ${s===i.id?"active":""}`,children:[e.jsx("div",{className:"blueprint-editor__item-name",children:i.name}),e.jsx("div",{className:"blueprint-editor__item-tags",children:i.tags.map(a=>e.jsx("span",{className:"blueprint-editor__tag",children:a},a))})]},i.id))}),e.jsx("div",{className:"blueprint-editor__actions",children:e.jsx("button",{onClick:I,disabled:!s||b,className:"blueprint-editor__spawn-button",children:b?"Spawning...":"Spawn Entity"})})]}),e.jsxs("div",{className:"blueprint-editor__main",children:[e.jsxs("div",{className:"blueprint-editor__preview-section",children:[e.jsxs("div",{className:"blueprint-editor__preview-header",children:[e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Preview"}),e.jsx("button",{onClick:()=>C(!A),className:"blueprint-editor__preview-toggle",children:A?"Hide":"Show"})]}),A&&e.jsx("div",{className:"blueprint-editor__preview-container",children:e.jsx(Z,{blueprint:c},c?c.id:"no-blueprint")})]}),e.jsxs("div",{className:"blueprint-editor__inspector-section",children:[e.jsx("div",{className:"blueprint-editor__preview-header",children:e.jsx("h3",{className:"blueprint-editor__preview-title",children:"Inspector"})}),e.jsx("div",{className:"blueprint-editor__inspector",children:c?Object.entries(c).map(([i,a])=>D(i,a,[i])):e.jsx("div",{className:"blueprint-editor__empty",children:"블루프린트를 선택하세요."})})]})]})]})},F=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),ie=(t,o,u)=>{if(o.length===0)return!1;let s=t;for(let l=0;l<o.length-1;l++){const h=o[l];if(!h)return!1;if(Array.isArray(s)){const c=Number(h);if(!Number.isInteger(c)||c<0||c>=s.length)return!1;s=s[c];continue}if(!F(s))return!1;s=s[h]}const _=o[o.length-1];if(!_)return!1;if(Array.isArray(s)){const l=Number(_);return!Number.isInteger(l)||l<0||l>=s.length?!1:(s[l]=u,!0)}return F(s)?(s[_]=u,!0):!1},ne=[{id:"characters",name:"Characters",type:"character",count:0},{id:"vehicles",name:"Vehicles",type:"vehicle",count:0},{id:"airplanes",name:"Airplanes",type:"airplane",count:0},{id:"animations",name:"Animations",type:"animation",count:0},{id:"behaviors",name:"Behaviors",type:"behavior",count:0},{id:"items",name:"Items",type:"item",count:0}],ae=({className:t="",style:o,children:u})=>{const[s,_]=d.useState("character"),[l,h]=d.useState(null),[c,v]=d.useState(""),[A,C]=d.useState(!1),[r,b]=d.useState(null),[N,P]=d.useState(!1),{spawnAtCursor:w,isSpawning:M}=E.useSpawnFromBlueprint(),S=d.useMemo(()=>E.blueprintRegistry.getAll().map(K),[]),I=d.useMemo(()=>{const n={character:0,vehicle:0,airplane:0,animation:0,behavior:0,item:0};return S.forEach(p=>{p.type in n&&n[p.type]++}),ne.map(p=>({...p,count:n[p.type]}))},[S]),D=d.useMemo(()=>S.filter(n=>{const p=n.type===s,j=c===""||n.name.toLowerCase().includes(c.toLowerCase())||n.tags.some(f=>f.toLowerCase().includes(c.toLowerCase()));return p&&j}),[s,c,S]),i=n=>{h(n);const p=E.blueprintRegistry.get(n);p&&b(JSON.parse(JSON.stringify(p)))},a=()=>{C(!0)},m=()=>{r&&(E.blueprintRegistry.register(r),C(!1),P(!1),i(r.id))},x=()=>{if(C(!1),l){const n=E.blueprintRegistry.get(l);n&&b(JSON.parse(JSON.stringify(n)))}},T=()=>{let n;const p={id:`custom_${s}_${Date.now()}`,name:`New ${s.charAt(0).toUpperCase()+s.slice(1)}`,version:"1.0.0",tags:["custom"],description:"Custom blueprint"};switch(s){case"vehicle":n={...p,type:"vehicle",physics:{mass:1e3,maxSpeed:30,acceleration:10,braking:15,turning:2},seats:[{position:[0,1,0],isDriver:!0}],animations:{idle:""}};break;case"airplane":n={...p,type:"airplane",physics:{mass:2e3,maxSpeed:100,acceleration:20,turning:1,lift:50,drag:10},seats:[{position:[0,1,2],isDriver:!0}],animations:{idle:""}};break;default:n={...p,type:"character",physics:{mass:70,height:1.8,radius:.3,jumpForce:300,moveSpeed:5,runSpeed:10,airControl:.2},animations:{idle:"",walk:"",run:"",jump:{start:"",loop:"",land:""}},stats:{health:100,stamina:50,strength:10,defense:10,speed:10}}}b(n),h(n.id),P(!0),C(!0)},q=(n,p)=>{if(!r)return;const j=JSON.parse(JSON.stringify(r));ie(j,n,p)&&b(j)},J=(n,p=[])=>{const j=[];return Object.entries(n).forEach(([f,y])=>{const k=[...p,f],O=k.join(".");f==="id"||f==="type"?j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y,disabled:!0,className:"property-editor__input property-editor__input--disabled"})]},O)):F(y)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:J(y,k)})]},O)):Array.isArray(y)?y.length>0&&y.every(F)?j.push(e.jsxs("div",{className:"property-editor__group",children:[e.jsxs("div",{className:"property-editor__group-title editor-text",children:[f.charAt(0).toUpperCase()+f.slice(1),":"]}),e.jsx("div",{className:"property-editor__group-content",children:y.map((B,$)=>e.jsxs("div",{className:"property-editor__array-item",children:[e.jsxs("div",{className:"property-editor__array-item-title editor-text-small",children:["Item ",$+1]}),J(B,[...k,$.toString()])]},`${O}.${$}`))})]},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:"text",value:y.join(", "),onChange:B=>q(k,B.target.value.split(",").map($=>$.trim())),className:"property-editor__input"})]},O)):typeof y=="boolean"?j.push(e.jsx("div",{className:"property-editor__field",children:e.jsxs("label",{className:"property-editor__checkbox-label editor-text-small",children:[e.jsx("input",{type:"checkbox",checked:y,onChange:B=>q(k,B.target.checked),className:"property-editor__checkbox"}),f]})},O)):j.push(e.jsxs("div",{className:"property-editor__field",children:[e.jsxs("label",{className:"property-editor__label editor-text-small",children:[f,":"]}),e.jsx("input",{type:typeof y=="number"?"number":"text",value:y,onChange:B=>q(k,typeof y=="number"?Number(B.target.value):B.target.value),className:"property-editor__input"})]},O))}),j},Q=async()=>{!l||await w(l)};return e.jsxs("div",{className:`blueprint-panel ${t}`,style:o,children:[e.jsx("h3",{className:"editor-title",children:"Blueprint Library"}),e.jsx("div",{className:"blueprint-panel__toolbar",children:e.jsxs("div",{className:"blueprint-panel__search-container",children:[e.jsx("input",{type:"text",placeholder:"Search blueprints...",value:c,onChange:n=>v(n.target.value),className:"blueprint-panel__search-input"}),e.jsx("button",{onClick:T,className:"blueprint-panel__button blueprint-panel__button--primary",children:"+ New Blueprint"})]})}),e.jsx("div",{className:"blueprint-panel__categories",children:I.map(n=>e.jsxs("button",{onClick:()=>_(n.type),className:`blueprint-panel__category-button ${s===n.type?"blueprint-panel__category-button--active":""}`,children:[e.jsx("span",{children:n.name}),e.jsxs("span",{children:["(",n.count,")"]})]},n.id))}),A?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__property-editor-container editor-scrollbar",children:r&&e.jsxs("div",{children:[e.jsx("h4",{className:"blueprint-panel__property-editor-title editor-text",children:N?"Create New Blueprint":`Edit: ${r.name}`}),J(r)]})}),e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:m,className:"blueprint-panel__button blueprint-panel__button--primary",children:N?"Create":"Save"}),e.jsx("button",{onClick:x,className:"blueprint-panel__button blueprint-panel__button--danger",children:"Cancel"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"blueprint-panel__list editor-scrollbar",children:D.length===0?e.jsx("div",{className:"blueprint-panel__empty-message editor-text-small",children:"No blueprints found"}):D.map(n=>e.jsx("div",{onClick:()=>i(n.id),className:`blueprint-panel__list-item ${l===n.id?"blueprint-panel__list-item--selected":""}`,children:e.jsxs("div",{className:"list-item__content",children:[e.jsxs("div",{className:"list-item__text-content",children:[e.jsx("div",{className:"list-item__name editor-text",children:n.name}),e.jsx("div",{className:"list-item__description editor-text-small",children:n.description}),e.jsx("div",{className:"list-item__tags",children:n.tags.map(p=>e.jsx("span",{className:"list-item__tag editor-text-small",children:p},p))})]}),e.jsxs("div",{className:"list-item__meta editor-text-small",children:[e.jsxs("div",{children:["v",n.version]}),e.jsx("div",{children:n.lastModified})]})]})},n.id))}),l&&e.jsx("div",{className:"blueprint-panel__footer",children:e.jsxs("div",{className:"blueprint-panel__footer-buttons",children:[e.jsx("button",{onClick:a,className:"blueprint-panel__button blueprint-panel__button--secondary",children:"Edit Blueprint"}),e.jsx("button",{onClick:Q,disabled:M,className:"blueprint-panel__button blueprint-panel__button--primary",children:M?"Spawning...":"Spawn Entity"})]})})]}),u]})};exports.BlueprintEditor=re;exports.BlueprintPanel=ae;exports.BlueprintPreview=Z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),E=require("./useSpawnFromBlueprint-CAz_a7R2.cjs"),U=require("@react-three/drei"),W=require("@react-three/fiber"),z=require("@react-three/rapier"),H=require("three"),L=require("./gaesupStore-CRQ-tcIz.cjs"),R=require("./index-BZHsQ1wA.cjs"),V=require("./index-Blu9CUgt.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;
@@ -6,8 +6,8 @@ import { Canvas as X } from "@react-three/fiber";
6
6
  import { Physics as ee, euler as te, RigidBody as ie } from "@react-three/rapier";
7
7
  import * as re from "three";
8
8
  import { u as J } from "./gaesupStore-x2iiDzsY.js";
9
- import { u as ne, C as ae, a as se, G as oe } from "./index-f0IJPBnb.js";
10
- import { C as le } from "./index-Bz9Gk3DQ.js";
9
+ import { u as ne, C as ae, a as se, G as oe } from "./index-D36kM7GZ.js";
10
+ import { C as le } from "./index-DHdmWNTv.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;
package/dist/editor.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("reflect-metadata");const e=require("./plugin-BX7hcU4d.cjs"),T=require("react"),S=require("@react-three/fiber"),I=require("three"),r=require("./index-CHq2GX18.cjs"),l=require("./gaesupStore-CRQ-tcIz.cjs"),E=require("./loader-D7cEHkCq.cjs");function g(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(i,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return i.default=t,Object.freeze(i)}const _=g(I);var B=Object.defineProperty,D=Object.getOwnPropertyDescriptor,u=(t,i,n,o)=>{for(var d=D(i,n),s=t.length-1,c;s>=0;s--)(c=t[s])&&(d=c(i,n,d)||d);return d&&B(i,n,d),d};class a{static convertLegacyPosition(i){return{x:i[0],y:i[1],z:i[2]}}static convertLegacyRotation(i){return{x:i[0],y:i[1],z:i[2]}}static convertToLegacyPosition(i){return[i.x,i.y,i.z]}static convertToLegacyRotation(i){return[i.x,i.y,i.z]}static convertLegacyWall(i){return{id:i.id||`wall-${Date.now()}`,position:this.convertLegacyPosition(i.position),rotation:this.convertLegacyRotation(i.rotation),wallGroupId:i.wall_parent_id||"default",width:4,height:4,depth:.5}}static convertLegacyTile(i){return{id:i.id||`tile-${Date.now()}`,position:this.convertLegacyPosition(i.position),tileGroupId:i.tile_parent_id||"default",size:4}}static convertLegacyMesh(i){const n={id:i.id||`mesh-${Date.now()}`,color:i.color||"#ffffff",material:i.material==="GLASS"?"GLASS":"STANDARD",roughness:i.roughness||.5,metalness:i.metalness||0,opacity:i.opacity||1,transparent:i.transparent||!1};return i.map_texture_url&&(n.mapTextureUrl=i.map_texture_url),i.normal_texture_url&&(n.normalTextureUrl=i.normal_texture_url),n}}u([l.HandleError(),l.Profile()],a,"convertLegacyPosition");u([l.HandleError(),l.Profile()],a,"convertLegacyRotation");u([l.HandleError()],a,"convertToLegacyPosition");u([l.HandleError()],a,"convertToLegacyRotation");u([l.HandleError(),l.Profile()],a,"convertLegacyWall");u([l.HandleError(),l.Profile()],a,"convertLegacyTile");u([l.HandleError(),l.Profile()],a,"convertLegacyMesh");function L(){const t=T.useMemo(()=>({frustum:new _.Frustum,matrix:new _.Matrix4,camPos:new _.Vector3}),[]);return S.useFrame((i,n)=>{const o=i.camera;e.getGrassManager().size()!==0&&(t.matrix.multiplyMatrices(o.projectionMatrix,o.matrixWorldInverse),t.frustum.setFromProjectionMatrix(t.matrix),t.camPos.copy(o.position),e.getGrassManager().tick({elapsedTime:i.clock.elapsedTime,delta:n,cameraPosition:t.camPos,frustum:t.frustum}))}),null}exports.AnimationPanel=e.AnimationPanel;exports.Billboard=e.index;exports.BlockSystem=e.BlockSystem;exports.BuildingController=e.BuildingController;exports.BuildingGpuCullingDriver=e.BuildingGpuCullingDriver;exports.BuildingGpuMirrorDriver=e.BuildingGpuMirrorDriver;exports.BuildingGpuUploadDriver=e.BuildingGpuUploadDriver;exports.BuildingIndirectArgsUploadDriver=e.BuildingIndirectArgsUploadDriver;exports.BuildingIndirectDrawDriver=e.BuildingIndirectDrawDriver;exports.BuildingNavigationObstacleDriver=e.BuildingNavigationObstacleDriver;exports.BuildingPanel=e.BuildingPanel;exports.BuildingRenderStateDriver=e.BuildingRenderStateDriver;exports.BuildingSystem=e.BuildingSystem;exports.BuildingUI=e.BuildingUI;exports.BuildingVisibilityDriver=e.BuildingVisibilityDriver;exports.CameraPanel=e.CameraPanel;exports.DEFAULT_BUILDING_GRID_EXTENSION_ID=e.DEFAULT_BUILDING_GRID_EXTENSION_ID;exports.DEFAULT_BUILDING_OBJECT_CATALOG=e.DEFAULT_BUILDING_OBJECT_CATALOG;exports.DEFAULT_BUILDING_PLACEMENT_EXTENSION_ID=e.DEFAULT_BUILDING_PLACEMENT_EXTENSION_ID;exports.DEFAULT_BUILDING_SAVE_EXTENSION_ID=e.DEFAULT_BUILDING_SAVE_EXTENSION_ID;exports.DEFAULT_BUILDING_STORE_SERVICE_ID=e.DEFAULT_BUILDING_STORE_SERVICE_ID;exports.DRAW_CLUSTER_BILLBOARD=e.DRAW_CLUSTER_BILLBOARD;exports.DRAW_CLUSTER_BLOCK=e.DRAW_CLUSTER_BLOCK;exports.DRAW_CLUSTER_COUNT=e.DRAW_CLUSTER_COUNT;exports.DRAW_CLUSTER_DESCRIPTORS=e.DRAW_CLUSTER_DESCRIPTORS;exports.DRAW_CLUSTER_FIRE=e.DRAW_CLUSTER_FIRE;exports.DRAW_CLUSTER_FLAG=e.DRAW_CLUSTER_FLAG;exports.DRAW_CLUSTER_GRASS=e.DRAW_CLUSTER_GRASS;exports.DRAW_CLUSTER_MODEL=e.DRAW_CLUSTER_MODEL;exports.DRAW_CLUSTER_SAKURA=e.DRAW_CLUSTER_SAKURA;exports.DRAW_CLUSTER_SAND=e.DRAW_CLUSTER_SAND;exports.DRAW_CLUSTER_SNOWFIELD=e.DRAW_CLUSTER_SNOWFIELD;exports.DRAW_CLUSTER_TILE=e.DRAW_CLUSTER_TILE;exports.DRAW_CLUSTER_WALL=e.DRAW_CLUSTER_WALL;exports.DRAW_CLUSTER_WATER=e.DRAW_CLUSTER_WATER;exports.EDITOR_PANEL_COMPONENT_KIND=e.EDITOR_PANEL_COMPONENT_KIND;exports.Editor=e.Editor;exports.EditorLayout=e.EditorLayout;exports.Fire=e.index$1;exports.GPU_META_STRIDE=e.GPU_META_STRIDE;exports.GPU_SPATIAL_STRIDE=e.GPU_SPATIAL_STRIDE;exports.GameplayEventPanel=e.GameplayEventPanel;exports.Grass=e.Grass;exports.GridHelper=e.GridHelper;exports.INDIRECT_DRAW_STRIDE=e.INDIRECT_DRAW_STRIDE;exports.MotionPanel=e.MotionPanel;exports.PerformancePanel=e.PerformancePanel;exports.ResizablePanel=e.ResizablePanel;exports.Sakura=e.Sakura;exports.SakuraBatch=e.SakuraBatch;exports.Sand=e.Sand;exports.SandBatch=e.SandBatch;exports.Snow=e.Snow;exports.Snowfield=e.Snowfield;exports.SnowfieldBatch=e.SnowfieldBatch;exports.StudioPanel=e.StudioPanel;exports.TileSystem=e.TileSystem;exports.VehiclePanel=e.VehiclePanel;exports.WallSystem=e.WallSystem;exports.Water=e.Ocean;exports.applyBuildingNavigationObstacles=e.applyBuildingNavigationObstacles;exports.buildBuildingGpuMirror=e.buildBuildingGpuMirror;exports.buildBuildingIndirectDrawMirror=e.buildBuildingIndirectDrawMirror;exports.buildingPlugin=e.buildingPlugin;exports.createBuildingGpuUploadPlan=e.createBuildingGpuUploadPlan;exports.createBuildingIndirectDrawUploadPlan=e.createBuildingIndirectDrawUploadPlan;exports.createBuildingPlugin=e.createBuildingPlugin;exports.createBuildingScopeId=e.createBuildingScopeId;exports.createCustomMeshId=e.createCustomMeshId;exports.createEditorCommandStack=e.createEditorCommandStack;exports.createEditorShell=e.createEditorShell;exports.createEditorSlice=e.createEditorSlice;exports.createEmptyBuildingGpuUploadResources=e.createEmptyBuildingGpuUploadResources;exports.createEmptyBuildingIndirectDrawMirror=e.createEmptyBuildingIndirectDrawMirror;exports.createEmptyGpuMirror=e.createEmptyGpuMirror;exports.createTerrainBlockMaterial=e.createTerrainBlockMaterial;exports.destroyBuildingGpuUploadResources=e.destroyBuildingGpuUploadResources;exports.editorSlice=e.editorSlice;exports.findTerrainBlockMaterial=e.findTerrainBlockMaterial;exports.getDefaultBuildingObject=e.getDefaultBuildingObject;exports.getDrawClusterForSnapshotEntry=e.getDrawClusterForSnapshotEntry;exports.getGrassManager=e.getGrassManager;exports.getIndirectInstanceCount=e.getIndirectInstanceCount;exports.getWallMaterialKey=e.getWallMaterialKey;exports.getWebGPUDeviceFromRenderer=e.getWebGPUDeviceFromRenderer;exports.isEditorPanelComponentExtension=e.isEditorPanelComponentExtension;exports.parseBuildingGpuVisibilityFlags=e.parseBuildingGpuVisibilityFlags;exports.resolveEditorPanelComponentExtensions=e.resolveEditorPanelComponentExtensions;exports.syncBuildingGpuBuffers=e.syncBuildingGpuBuffers;exports.syncBuildingIndirectArgsBuffer=e.syncBuildingIndirectArgsBuffer;exports.useBuildingEditor=e.useBuildingEditor;exports.useBuildingGpuCullingStore=e.useBuildingGpuCullingStore;exports.useBuildingRenderStateStore=e.useBuildingRenderStateStore;exports.useBuildingVisibilityStore=e.useBuildingVisibilityStore;exports.useEditor=e.useEditor;exports.useEditorStore=e.useEditorStore;exports.BUILDING_BASIC_OBJECT_OPTIONS=r.BUILDING_BASIC_OBJECT_OPTIONS;exports.BUILDING_FLAG_STYLE_OPTIONS=r.BUILDING_FLAG_STYLE_OPTIONS;exports.BUILDING_PLACED_OBJECT_OPTIONS=r.BUILDING_PLACED_OBJECT_OPTIONS;exports.BUILDING_TILE_OBJECT_OPTIONS=r.BUILDING_TILE_OBJECT_OPTIONS;exports.BUILDING_TILE_PRESETS=r.BUILDING_TILE_PRESETS;exports.BUILDING_TILE_SHAPE_OPTIONS=r.BUILDING_TILE_SHAPE_OPTIONS;exports.BUILDING_TREE_COLOR_PRESETS=r.BUILDING_TREE_COLOR_PRESETS;exports.BUILDING_TREE_OPTIONS=r.BUILDING_TREE_OPTIONS;exports.BUILDING_WALL_KIND_OPTIONS=r.BUILDING_WALL_KIND_OPTIONS;exports.BUILDING_WALL_PRESETS=r.BUILDING_WALL_PRESETS;exports.BUILDING_WEATHER_EFFECT_OPTIONS=r.BUILDING_WEATHER_EFFECT_OPTIONS;exports.FLAG_STYLE_META=r.FLAG_STYLE_META;exports.blockToPlacementEntry=r.blockToPlacementEntry;exports.buildingCellToWorld=r.buildingCellToWorld;exports.buildingGridAdapter=r.buildingGridAdapter;exports.buildingGroupsToPlacementEntries=r.buildingGroupsToPlacementEntries;exports.buildingPlacementAdapter=r.buildingPlacementAdapter;exports.cellToTilePosition=r.cellToTilePosition;exports.createBlockFootprint=r.createBlockFootprint;exports.createBuildingPlacementEngine=r.createBuildingPlacementEngine;exports.createTileFootprint=r.createTileFootprint;exports.edgeKey=r.edgeKey;exports.edgeSideToWallRotation=r.edgeSideToWallRotation;exports.edgeToWallTransform=r.edgeToWallTransform;exports.getTileSupportHeight=r.getTileSupportHeight;exports.hasTileCollision=r.hasTileCollision;exports.hasWallCollision=r.hasWallCollision;exports.indexAabb=r.indexAabb;exports.normalizeQuarterTurnRotation=r.normalizeQuarterTurnRotation;exports.pair=r.pair;exports.queryAabbIds=r.queryAabbIds;exports.snapBuildingPosition=r.snapBuildingPosition;exports.tileFootprintKeys=r.tileFootprintKeys;exports.tileGroupToPlacementEntries=r.tileGroupToPlacementEntries;exports.tileHalfSize=r.tileHalfSize;exports.tileOverlaps=r.tileOverlaps;exports.tilePositionToCell=r.tilePositionToCell;exports.tileToPlacementEntry=r.tileToPlacementEntry;exports.unindexId=r.unindexId;exports.useBuildingStore=r.useBuildingStore;exports.wallGroupToPlacementEntries=r.wallGroupToPlacementEntries;exports.wallToPlacementEntry=r.wallToPlacementEntry;exports.wallTransformToEdge=r.wallTransformToEdge;exports.worldToBuildingCell=r.worldToBuildingCell;exports.zigZag=r.zigZag;exports.CONTENT_SCHEMA_VERSION=E.CONTENT_SCHEMA_VERSION;exports.HttpContentBundleSource=E.HttpContentBundleSource;exports.createContentBundleFromSaveSystem=E.createContentBundleFromSaveSystem;exports.loadContentBundleFromManifest=E.loadContentBundleFromManifest;exports.validateContentBundle=E.validateContentBundle;exports.validateContentBundleManifest=E.validateContentBundleManifest;exports.BuildingBridge=a;exports.GrassDriver=L;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("reflect-metadata");const e=require("./plugin-C_L54TSL.cjs"),T=require("react"),S=require("@react-three/fiber"),I=require("three"),r=require("./index-D3fGCOPK.cjs"),l=require("./gaesupStore-CRQ-tcIz.cjs"),E=require("./loader-D7cEHkCq.cjs");function g(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(i,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return i.default=t,Object.freeze(i)}const _=g(I);var B=Object.defineProperty,D=Object.getOwnPropertyDescriptor,u=(t,i,n,o)=>{for(var d=D(i,n),s=t.length-1,c;s>=0;s--)(c=t[s])&&(d=c(i,n,d)||d);return d&&B(i,n,d),d};class a{static convertLegacyPosition(i){return{x:i[0],y:i[1],z:i[2]}}static convertLegacyRotation(i){return{x:i[0],y:i[1],z:i[2]}}static convertToLegacyPosition(i){return[i.x,i.y,i.z]}static convertToLegacyRotation(i){return[i.x,i.y,i.z]}static convertLegacyWall(i){return{id:i.id||`wall-${Date.now()}`,position:this.convertLegacyPosition(i.position),rotation:this.convertLegacyRotation(i.rotation),wallGroupId:i.wall_parent_id||"default",width:4,height:4,depth:.5}}static convertLegacyTile(i){return{id:i.id||`tile-${Date.now()}`,position:this.convertLegacyPosition(i.position),tileGroupId:i.tile_parent_id||"default",size:4}}static convertLegacyMesh(i){const n={id:i.id||`mesh-${Date.now()}`,color:i.color||"#ffffff",material:i.material==="GLASS"?"GLASS":"STANDARD",roughness:i.roughness||.5,metalness:i.metalness||0,opacity:i.opacity||1,transparent:i.transparent||!1};return i.map_texture_url&&(n.mapTextureUrl=i.map_texture_url),i.normal_texture_url&&(n.normalTextureUrl=i.normal_texture_url),n}}u([l.HandleError(),l.Profile()],a,"convertLegacyPosition");u([l.HandleError(),l.Profile()],a,"convertLegacyRotation");u([l.HandleError()],a,"convertToLegacyPosition");u([l.HandleError()],a,"convertToLegacyRotation");u([l.HandleError(),l.Profile()],a,"convertLegacyWall");u([l.HandleError(),l.Profile()],a,"convertLegacyTile");u([l.HandleError(),l.Profile()],a,"convertLegacyMesh");function L(){const t=T.useMemo(()=>({frustum:new _.Frustum,matrix:new _.Matrix4,camPos:new _.Vector3}),[]);return S.useFrame((i,n)=>{const o=i.camera;e.getGrassManager().size()!==0&&(t.matrix.multiplyMatrices(o.projectionMatrix,o.matrixWorldInverse),t.frustum.setFromProjectionMatrix(t.matrix),t.camPos.copy(o.position),e.getGrassManager().tick({elapsedTime:i.clock.elapsedTime,delta:n,cameraPosition:t.camPos,frustum:t.frustum}))}),null}exports.AnimationPanel=e.AnimationPanel;exports.Billboard=e.index;exports.BlockSystem=e.BlockSystem;exports.BuildingController=e.BuildingController;exports.BuildingGpuCullingDriver=e.BuildingGpuCullingDriver;exports.BuildingGpuMirrorDriver=e.BuildingGpuMirrorDriver;exports.BuildingGpuUploadDriver=e.BuildingGpuUploadDriver;exports.BuildingIndirectArgsUploadDriver=e.BuildingIndirectArgsUploadDriver;exports.BuildingIndirectDrawDriver=e.BuildingIndirectDrawDriver;exports.BuildingNavigationObstacleDriver=e.BuildingNavigationObstacleDriver;exports.BuildingPanel=e.BuildingPanel;exports.BuildingRenderStateDriver=e.BuildingRenderStateDriver;exports.BuildingSystem=e.BuildingSystem;exports.BuildingUI=e.BuildingUI;exports.BuildingVisibilityDriver=e.BuildingVisibilityDriver;exports.CameraPanel=e.CameraPanel;exports.DEFAULT_BUILDING_GRID_EXTENSION_ID=e.DEFAULT_BUILDING_GRID_EXTENSION_ID;exports.DEFAULT_BUILDING_OBJECT_CATALOG=e.DEFAULT_BUILDING_OBJECT_CATALOG;exports.DEFAULT_BUILDING_PLACEMENT_EXTENSION_ID=e.DEFAULT_BUILDING_PLACEMENT_EXTENSION_ID;exports.DEFAULT_BUILDING_SAVE_EXTENSION_ID=e.DEFAULT_BUILDING_SAVE_EXTENSION_ID;exports.DEFAULT_BUILDING_STORE_SERVICE_ID=e.DEFAULT_BUILDING_STORE_SERVICE_ID;exports.DRAW_CLUSTER_BILLBOARD=e.DRAW_CLUSTER_BILLBOARD;exports.DRAW_CLUSTER_BLOCK=e.DRAW_CLUSTER_BLOCK;exports.DRAW_CLUSTER_COUNT=e.DRAW_CLUSTER_COUNT;exports.DRAW_CLUSTER_DESCRIPTORS=e.DRAW_CLUSTER_DESCRIPTORS;exports.DRAW_CLUSTER_FIRE=e.DRAW_CLUSTER_FIRE;exports.DRAW_CLUSTER_FLAG=e.DRAW_CLUSTER_FLAG;exports.DRAW_CLUSTER_GRASS=e.DRAW_CLUSTER_GRASS;exports.DRAW_CLUSTER_MODEL=e.DRAW_CLUSTER_MODEL;exports.DRAW_CLUSTER_SAKURA=e.DRAW_CLUSTER_SAKURA;exports.DRAW_CLUSTER_SAND=e.DRAW_CLUSTER_SAND;exports.DRAW_CLUSTER_SNOWFIELD=e.DRAW_CLUSTER_SNOWFIELD;exports.DRAW_CLUSTER_TILE=e.DRAW_CLUSTER_TILE;exports.DRAW_CLUSTER_WALL=e.DRAW_CLUSTER_WALL;exports.DRAW_CLUSTER_WATER=e.DRAW_CLUSTER_WATER;exports.EDITOR_PANEL_COMPONENT_KIND=e.EDITOR_PANEL_COMPONENT_KIND;exports.Editor=e.Editor;exports.EditorLayout=e.EditorLayout;exports.Fire=e.index$1;exports.GPU_META_STRIDE=e.GPU_META_STRIDE;exports.GPU_SPATIAL_STRIDE=e.GPU_SPATIAL_STRIDE;exports.GameplayEventPanel=e.GameplayEventPanel;exports.Grass=e.Grass;exports.GridHelper=e.GridHelper;exports.INDIRECT_DRAW_STRIDE=e.INDIRECT_DRAW_STRIDE;exports.MotionPanel=e.MotionPanel;exports.PerformancePanel=e.PerformancePanel;exports.ResizablePanel=e.ResizablePanel;exports.Sakura=e.Sakura;exports.SakuraBatch=e.SakuraBatch;exports.Sand=e.Sand;exports.SandBatch=e.SandBatch;exports.Snow=e.Snow;exports.Snowfield=e.Snowfield;exports.SnowfieldBatch=e.SnowfieldBatch;exports.StudioPanel=e.StudioPanel;exports.TileSystem=e.TileSystem;exports.VehiclePanel=e.VehiclePanel;exports.WallSystem=e.WallSystem;exports.Water=e.Ocean;exports.applyBuildingNavigationObstacles=e.applyBuildingNavigationObstacles;exports.buildBuildingGpuMirror=e.buildBuildingGpuMirror;exports.buildBuildingIndirectDrawMirror=e.buildBuildingIndirectDrawMirror;exports.buildingPlugin=e.buildingPlugin;exports.createBuildingGpuUploadPlan=e.createBuildingGpuUploadPlan;exports.createBuildingIndirectDrawUploadPlan=e.createBuildingIndirectDrawUploadPlan;exports.createBuildingPlugin=e.createBuildingPlugin;exports.createBuildingScopeId=e.createBuildingScopeId;exports.createCustomMeshId=e.createCustomMeshId;exports.createEditorCommandStack=e.createEditorCommandStack;exports.createEditorShell=e.createEditorShell;exports.createEditorSlice=e.createEditorSlice;exports.createEmptyBuildingGpuUploadResources=e.createEmptyBuildingGpuUploadResources;exports.createEmptyBuildingIndirectDrawMirror=e.createEmptyBuildingIndirectDrawMirror;exports.createEmptyGpuMirror=e.createEmptyGpuMirror;exports.createTerrainBlockMaterial=e.createTerrainBlockMaterial;exports.destroyBuildingGpuUploadResources=e.destroyBuildingGpuUploadResources;exports.editorSlice=e.editorSlice;exports.findTerrainBlockMaterial=e.findTerrainBlockMaterial;exports.getDefaultBuildingObject=e.getDefaultBuildingObject;exports.getDrawClusterForSnapshotEntry=e.getDrawClusterForSnapshotEntry;exports.getGrassManager=e.getGrassManager;exports.getIndirectInstanceCount=e.getIndirectInstanceCount;exports.getWallMaterialKey=e.getWallMaterialKey;exports.getWebGPUDeviceFromRenderer=e.getWebGPUDeviceFromRenderer;exports.isEditorPanelComponentExtension=e.isEditorPanelComponentExtension;exports.parseBuildingGpuVisibilityFlags=e.parseBuildingGpuVisibilityFlags;exports.resolveEditorPanelComponentExtensions=e.resolveEditorPanelComponentExtensions;exports.syncBuildingGpuBuffers=e.syncBuildingGpuBuffers;exports.syncBuildingIndirectArgsBuffer=e.syncBuildingIndirectArgsBuffer;exports.useBuildingEditor=e.useBuildingEditor;exports.useBuildingGpuCullingStore=e.useBuildingGpuCullingStore;exports.useBuildingRenderStateStore=e.useBuildingRenderStateStore;exports.useBuildingVisibilityStore=e.useBuildingVisibilityStore;exports.useEditor=e.useEditor;exports.useEditorStore=e.useEditorStore;exports.BUILDING_BASIC_OBJECT_OPTIONS=r.BUILDING_BASIC_OBJECT_OPTIONS;exports.BUILDING_FLAG_STYLE_OPTIONS=r.BUILDING_FLAG_STYLE_OPTIONS;exports.BUILDING_PLACED_OBJECT_OPTIONS=r.BUILDING_PLACED_OBJECT_OPTIONS;exports.BUILDING_TILE_OBJECT_OPTIONS=r.BUILDING_TILE_OBJECT_OPTIONS;exports.BUILDING_TILE_PRESETS=r.BUILDING_TILE_PRESETS;exports.BUILDING_TILE_SHAPE_OPTIONS=r.BUILDING_TILE_SHAPE_OPTIONS;exports.BUILDING_TREE_COLOR_PRESETS=r.BUILDING_TREE_COLOR_PRESETS;exports.BUILDING_TREE_OPTIONS=r.BUILDING_TREE_OPTIONS;exports.BUILDING_WALL_KIND_OPTIONS=r.BUILDING_WALL_KIND_OPTIONS;exports.BUILDING_WALL_PRESETS=r.BUILDING_WALL_PRESETS;exports.BUILDING_WEATHER_EFFECT_OPTIONS=r.BUILDING_WEATHER_EFFECT_OPTIONS;exports.FLAG_STYLE_META=r.FLAG_STYLE_META;exports.blockToPlacementEntry=r.blockToPlacementEntry;exports.buildingCellToWorld=r.buildingCellToWorld;exports.buildingGridAdapter=r.buildingGridAdapter;exports.buildingGroupsToPlacementEntries=r.buildingGroupsToPlacementEntries;exports.buildingPlacementAdapter=r.buildingPlacementAdapter;exports.cellToTilePosition=r.cellToTilePosition;exports.createBlockFootprint=r.createBlockFootprint;exports.createBuildingPlacementEngine=r.createBuildingPlacementEngine;exports.createTileFootprint=r.createTileFootprint;exports.edgeKey=r.edgeKey;exports.edgeSideToWallRotation=r.edgeSideToWallRotation;exports.edgeToWallTransform=r.edgeToWallTransform;exports.getTileSupportHeight=r.getTileSupportHeight;exports.hasTileCollision=r.hasTileCollision;exports.hasWallCollision=r.hasWallCollision;exports.indexAabb=r.indexAabb;exports.normalizeQuarterTurnRotation=r.normalizeQuarterTurnRotation;exports.pair=r.pair;exports.queryAabbIds=r.queryAabbIds;exports.snapBuildingPosition=r.snapBuildingPosition;exports.tileFootprintKeys=r.tileFootprintKeys;exports.tileGroupToPlacementEntries=r.tileGroupToPlacementEntries;exports.tileHalfSize=r.tileHalfSize;exports.tileOverlaps=r.tileOverlaps;exports.tilePositionToCell=r.tilePositionToCell;exports.tileToPlacementEntry=r.tileToPlacementEntry;exports.unindexId=r.unindexId;exports.useBuildingStore=r.useBuildingStore;exports.wallGroupToPlacementEntries=r.wallGroupToPlacementEntries;exports.wallToPlacementEntry=r.wallToPlacementEntry;exports.wallTransformToEdge=r.wallTransformToEdge;exports.worldToBuildingCell=r.worldToBuildingCell;exports.zigZag=r.zigZag;exports.CONTENT_SCHEMA_VERSION=E.CONTENT_SCHEMA_VERSION;exports.HttpContentBundleSource=E.HttpContentBundleSource;exports.createContentBundleFromSaveSystem=E.createContentBundleFromSaveSystem;exports.loadContentBundleFromManifest=E.loadContentBundleFromManifest;exports.validateContentBundle=E.validateContentBundle;exports.validateContentBundleManifest=E.validateContentBundleManifest;exports.BuildingBridge=a;exports.GrassDriver=L;
package/dist/editor.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import "reflect-metadata";
2
- import { g as _ } from "./plugin-CpuNVAa4.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-CpuNVAa4.js";
2
+ import { g as _ } from "./plugin-CN4Qa0sW.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-CN4Qa0sW.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-DUzx7X82.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-CfRfBVRR.js";
8
8
  import { H as t, P as o } from "./gaesupStore-x2iiDzsY.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 +1 @@
1
- "use strict";const o=require("react/jsx-runtime"),a=require("react"),B=require("three"),D=require("@react-three/fiber"),p=require("./index-CHq2GX18.cjs"),b=require("./gaesupStore-CRQ-tcIz.cjs"),I=require("@react-three/rapier"),O=require("./index-B241fpz2.cjs");function N(e){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(u,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}return u.default=e,Object.freeze(u)}const v=N(B),U={KeyW:"forward",KeyA:"leftward",KeyS:"backward",KeyD:"rightward",ShiftLeft:"shift",Space:"space",KeyZ:"keyZ",KeyR:"keyR",KeyF:"keyF",KeyE:"keyE",Escape:"escape"},P=(e=!0,u=!0,r)=>{const i=b.useGaesupStore(d=>d.automation?.queue.isRunning),c=b.useGaesupStore(d=>d.stopAutomation),n=b.useGaesupStore(d=>d.interaction?.isActive??!0),l=p.useBuildingStore(d=>d.isInEditMode()),s=p.useInputBackend(),t=a.useRef(new Set),y=a.useMemo(()=>({...U}),[]),g=a.useCallback((d,S)=>{if(!n)return!1;try{return s.updateKeyboard({[d]:S}),S?t.current.add(d):t.current.delete(d),!0}catch(k){return console.error("Error updating keyboard state:",k),!1}},[s,n]),f=a.useCallback(()=>{t.current.clear(),s.updateKeyboard({forward:!1,backward:!1,leftward:!1,rightward:!1,shift:!1,space:!1,keyZ:!1,keyR:!1,keyF:!1,keyE:!1,escape:!1})},[s]);return a.useEffect(()=>{(!n||l)&&f()},[f,n,l]),a.useEffect(()=>{const d=(m,w)=>{const R=y[m.code];if(!R)return;if(!n||l){w&&m.preventDefault(),f();return}const x=t.current.has(m.code);w&&!x?(t.current.add(m.code),m.code==="Space"&&m.preventDefault(),u&&i&&(R==="forward"||R==="backward"||R==="leftward"||R==="rightward")&&(c(),s.updateMouse({isActive:!1,shouldRun:!1})),s.updateKeyboard({[R]:!0})):!w&&x&&(t.current.delete(m.code),s.updateKeyboard({[R]:!1}))},S=m=>d(m,!0),k=m=>d(m,!1),h=()=>document.hidden&&f();return window.addEventListener("keydown",S),window.addEventListener("keyup",k),document.addEventListener("visibilitychange",h),()=>{window.removeEventListener("keydown",S),window.removeEventListener("keyup",k),document.removeEventListener("visibilitychange",h)}},[y,u,c,i,f,n,l,s]),{pressedKeys:Array.from(t.current),pushKey:g,isKeyPressed:d=>t.current.has(d),clearAllKeys:f}},C=a.memo(({points:e,color:u})=>{const r=a.useMemo(()=>new v.BufferGeometry,[]),i=a.useMemo(()=>new v.LineBasicMaterial({color:u}),[]),c=a.useMemo(()=>new v.Line(r,i),[r,i]),n=a.useRef(null),l=a.useRef(0);return a.useLayoutEffect(()=>{i.color.set(u)},[u,i]),a.useEffect(()=>{const s=e.length+1;l.current=s;const t=new Float32Array(s*3);n.current=t;for(let y=0;y<e.length;y+=1){const g=e[y];if(!g)continue;const f=(y+1)*3;t[f]=g.x,t[f+1]=g.y,t[f+2]=g.z}r.setAttribute("position",new v.BufferAttribute(t,3)),r.setDrawRange(0,s),r.computeBoundingSphere()},[r,e]),D.useFrame(()=>{const s=n.current;if(!s||l.current<2)return;const t=p.getGlobalStateManager().getActiveState().position,y=s[4]??t.y;s[0]=t.x,s[1]=y,s[2]=t.z;const g=r.getAttribute("position");g&&(g.needsUpdate=!0)}),a.useEffect(()=>()=>{r.dispose(),i.dispose()},[r,i]),e.length<1?null:o.jsx("primitive",{object:c,frustumCulled:!1})});C.displayName="PathLine";const A=a.memo(()=>o.jsxs("group",{children:[o.jsxs("mesh",{children:[o.jsx("sphereGeometry",{args:[.2,16,16]}),o.jsx("meshStandardMaterial",{color:"#00ff88",emissive:"#00ff88",emissiveIntensity:.5,transparent:!0,opacity:.9})]}),o.jsxs("mesh",{rotation:[Math.PI/2,0,0],children:[o.jsx("ringGeometry",{args:[.3,.5,8]}),o.jsx("meshStandardMaterial",{color:"#00ff88",transparent:!0,opacity:.6,side:v.DoubleSide})]})]}));A.displayName="TargetMarker";const L=[];function G(){const e=b.useGaesupStore(t=>t.automation?.queue.actions??L),u=b.useGaesupStore(t=>t.automation?.queue.currentIndex??0),[r,i]=a.useState(()=>[...p.getClickNavigationRoute()]);a.useEffect(()=>p.subscribeClickNavigationRoute(()=>{i([...p.getClickNavigationRoute()])}),[]);const c=a.useMemo(()=>e.map(t=>t.type==="move"&&t.target?new v.Vector3(t.target.x,t.target.y,t.target.z):null).filter(t=>t!==null),[e]),n=a.useMemo(()=>r.length>0?[...r,...c]:c,[r,c]),l=r[r.length-1]??null,s=a.useMemo(()=>l?[l.x,l.y,l.z]:null,[l?.x,l?.y,l?.z]);return o.jsxs("group",{children:[s&&o.jsx("group",{position:s,children:o.jsx(A,{})}),n.length>0&&o.jsx(C,{points:n,color:u>=0?"#00ff88":"#ffaa00"}),e.map((t,y)=>{if(t.type==="move"&&t.target){const g=y===u,f=y<u;return o.jsx("group",{position:[t.target.x,t.target.y,t.target.z],children:o.jsxs("mesh",{children:[o.jsx("sphereGeometry",{args:[.1,8,8]}),o.jsx("meshStandardMaterial",{color:f?"#888":g?"#ff4444":"#ffaa00",transparent:!0,opacity:f?.3:.8})]})},`action-${y}`)}return null})]})}function K({clickerOptions:e,clickPlaneHeight:u=.16}){const{onClick:r}=p.useClicker({groundTargetY:0,...e??{}}),i=c=>{c.stopPropagation();const{cameraOption:n,setCameraOption:l}=b.useGaesupStore.getState();if(n?.focus){l({focus:!1});return}r(c)};return o.jsxs("mesh",{position:[0,u,0],rotation:[-Math.PI/2,0,0],onPointerDown:i,visible:!0,userData:{intangible:!0},children:[o.jsx("planeGeometry",{args:[1e3,1e3]}),o.jsx("meshBasicMaterial",{transparent:!0,opacity:0})]})}function q({props:e,children:u}){const r=b.useGaesupStore(h=>h.mode),{gameStates:i}=p.useStateSystem(),c=b.useGaesupStore(h=>h.rideable),n=b.useGaesupStore(h=>h.urls),l=p.useBuildingStore(h=>h.isInEditMode()),s=O.useGenericRefs();if(P(),l||!r||!i||!c||!n||r.type==="character"&&!n.characterUrl||r.type==="vehicle"&&!n.vehicleUrl||r.type==="airplane"&&!n.airplaneUrl)return null;const{canRide:t,isRiding:y,currentRideable:g}=i,f=g?.id,d=a.useMemo(()=>(f?c[f]?.offset:void 0)??I.vec3(),[f,c]),k=(()=>{const h=e.rigidBodyRef??s.rigidBodyRef,m=e.outerGroupRef??s.outerGroupRef,w=e.innerGroupRef??s.innerGroupRef,R=e.colliderRef??s.colliderRef,x={isActive:!0,componentType:r.type,enableRiding:t,isRiderOn:y,offset:d,ref:h,outerGroupRef:m,innerGroupRef:w,colliderRef:R,parts:(e.parts||[]).filter(E=>!!E.url).map(E=>({...E,url:E.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}:{}},j=y&&r.type!=="character"?n.ridingUrl:void 0,M=typeof j=="string"&&j.length>0?{ridingUrl:j}:{};switch(r.type){case"character":return{...x,url:n.characterUrl||""};case"vehicle":return{...x,...M,url:n.vehicleUrl||"",wheelUrl:n.wheelUrl};case"airplane":return{...x,...M,url:n.airplaneUrl||""};default:return{...x,url:n.characterUrl||""}}})();return r.type==="character"&&i.isRiding?null:o.jsx(p.PhysicsEntity,{...k,children:u})}const z=.5;function T(e){const{clickToMove:u,children:r,clickerOptions:i,...c}=e,n={...i??{},...i?.agentRadius===void 0&&c.colliderSize?.radius!==void 0?{agentRadius:Math.min(c.colliderSize.radius,z)}:{}};return o.jsxs(o.Fragment,{children:[o.jsx(q,{props:c,children:r}),u&&o.jsxs(o.Fragment,{children:[o.jsx(K,{clickerOptions:n}),o.jsx(G,{})]})]})}exports.Clicker=G;exports.ControllerWrapper=T;exports.GroundClicker=K;exports.useKeyboard=P;
1
+ "use strict";const o=require("react/jsx-runtime"),a=require("react"),B=require("three"),D=require("@react-three/fiber"),p=require("./index-D3fGCOPK.cjs"),b=require("./gaesupStore-CRQ-tcIz.cjs"),I=require("@react-three/rapier"),O=require("./index-Blu9CUgt.cjs");function N(e){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(u,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}return u.default=e,Object.freeze(u)}const v=N(B),U={KeyW:"forward",KeyA:"leftward",KeyS:"backward",KeyD:"rightward",ShiftLeft:"shift",Space:"space",KeyZ:"keyZ",KeyR:"keyR",KeyF:"keyF",KeyE:"keyE",Escape:"escape"},P=(e=!0,u=!0,r)=>{const i=b.useGaesupStore(d=>d.automation?.queue.isRunning),c=b.useGaesupStore(d=>d.stopAutomation),n=b.useGaesupStore(d=>d.interaction?.isActive??!0),l=p.useBuildingStore(d=>d.isInEditMode()),s=p.useInputBackend(),t=a.useRef(new Set),y=a.useMemo(()=>({...U}),[]),g=a.useCallback((d,S)=>{if(!n)return!1;try{return s.updateKeyboard({[d]:S}),S?t.current.add(d):t.current.delete(d),!0}catch(k){return console.error("Error updating keyboard state:",k),!1}},[s,n]),f=a.useCallback(()=>{t.current.clear(),s.updateKeyboard({forward:!1,backward:!1,leftward:!1,rightward:!1,shift:!1,space:!1,keyZ:!1,keyR:!1,keyF:!1,keyE:!1,escape:!1})},[s]);return a.useEffect(()=>{(!n||l)&&f()},[f,n,l]),a.useEffect(()=>{const d=(m,w)=>{const R=y[m.code];if(!R)return;if(!n||l){w&&m.preventDefault(),f();return}const x=t.current.has(m.code);w&&!x?(t.current.add(m.code),m.code==="Space"&&m.preventDefault(),u&&i&&(R==="forward"||R==="backward"||R==="leftward"||R==="rightward")&&(c(),s.updateMouse({isActive:!1,shouldRun:!1})),s.updateKeyboard({[R]:!0})):!w&&x&&(t.current.delete(m.code),s.updateKeyboard({[R]:!1}))},S=m=>d(m,!0),k=m=>d(m,!1),h=()=>document.hidden&&f();return window.addEventListener("keydown",S),window.addEventListener("keyup",k),document.addEventListener("visibilitychange",h),()=>{window.removeEventListener("keydown",S),window.removeEventListener("keyup",k),document.removeEventListener("visibilitychange",h)}},[y,u,c,i,f,n,l,s]),{pressedKeys:Array.from(t.current),pushKey:g,isKeyPressed:d=>t.current.has(d),clearAllKeys:f}},C=a.memo(({points:e,color:u})=>{const r=a.useMemo(()=>new v.BufferGeometry,[]),i=a.useMemo(()=>new v.LineBasicMaterial({color:u}),[]),c=a.useMemo(()=>new v.Line(r,i),[r,i]),n=a.useRef(null),l=a.useRef(0);return a.useLayoutEffect(()=>{i.color.set(u)},[u,i]),a.useEffect(()=>{const s=e.length+1;l.current=s;const t=new Float32Array(s*3);n.current=t;for(let y=0;y<e.length;y+=1){const g=e[y];if(!g)continue;const f=(y+1)*3;t[f]=g.x,t[f+1]=g.y,t[f+2]=g.z}r.setAttribute("position",new v.BufferAttribute(t,3)),r.setDrawRange(0,s),r.computeBoundingSphere()},[r,e]),D.useFrame(()=>{const s=n.current;if(!s||l.current<2)return;const t=p.getGlobalStateManager().getActiveState().position,y=s[4]??t.y;s[0]=t.x,s[1]=y,s[2]=t.z;const g=r.getAttribute("position");g&&(g.needsUpdate=!0)}),a.useEffect(()=>()=>{r.dispose(),i.dispose()},[r,i]),e.length<1?null:o.jsx("primitive",{object:c,frustumCulled:!1})});C.displayName="PathLine";const A=a.memo(()=>o.jsxs("group",{children:[o.jsxs("mesh",{children:[o.jsx("sphereGeometry",{args:[.2,16,16]}),o.jsx("meshStandardMaterial",{color:"#00ff88",emissive:"#00ff88",emissiveIntensity:.5,transparent:!0,opacity:.9})]}),o.jsxs("mesh",{rotation:[Math.PI/2,0,0],children:[o.jsx("ringGeometry",{args:[.3,.5,8]}),o.jsx("meshStandardMaterial",{color:"#00ff88",transparent:!0,opacity:.6,side:v.DoubleSide})]})]}));A.displayName="TargetMarker";const L=[];function G(){const e=b.useGaesupStore(t=>t.automation?.queue.actions??L),u=b.useGaesupStore(t=>t.automation?.queue.currentIndex??0),[r,i]=a.useState(()=>[...p.getClickNavigationRoute()]);a.useEffect(()=>p.subscribeClickNavigationRoute(()=>{i([...p.getClickNavigationRoute()])}),[]);const c=a.useMemo(()=>e.map(t=>t.type==="move"&&t.target?new v.Vector3(t.target.x,t.target.y,t.target.z):null).filter(t=>t!==null),[e]),n=a.useMemo(()=>r.length>0?[...r,...c]:c,[r,c]),l=r[r.length-1]??null,s=a.useMemo(()=>l?[l.x,l.y,l.z]:null,[l?.x,l?.y,l?.z]);return o.jsxs("group",{children:[s&&o.jsx("group",{position:s,children:o.jsx(A,{})}),n.length>0&&o.jsx(C,{points:n,color:u>=0?"#00ff88":"#ffaa00"}),e.map((t,y)=>{if(t.type==="move"&&t.target){const g=y===u,f=y<u;return o.jsx("group",{position:[t.target.x,t.target.y,t.target.z],children:o.jsxs("mesh",{children:[o.jsx("sphereGeometry",{args:[.1,8,8]}),o.jsx("meshStandardMaterial",{color:f?"#888":g?"#ff4444":"#ffaa00",transparent:!0,opacity:f?.3:.8})]})},`action-${y}`)}return null})]})}function K({clickerOptions:e,clickPlaneHeight:u=.75}){const{onClick:r}=p.useClicker({groundTargetY:0,...e??{}}),i=c=>{c.stopPropagation();const{cameraOption:n,setCameraOption:l}=b.useGaesupStore.getState();if(n?.focus){l({focus:!1});return}r(c)};return o.jsxs("mesh",{position:[0,u,0],rotation:[-Math.PI/2,0,0],onPointerDown:i,visible:!0,userData:{intangible:!0},children:[o.jsx("planeGeometry",{args:[1e3,1e3]}),o.jsx("meshBasicMaterial",{transparent:!0,opacity:0})]})}function q({props:e,children:u}){const r=b.useGaesupStore(h=>h.mode),{gameStates:i}=p.useStateSystem(),c=b.useGaesupStore(h=>h.rideable),n=b.useGaesupStore(h=>h.urls),l=p.useBuildingStore(h=>h.isInEditMode()),s=O.useGenericRefs();if(P(),l||!r||!i||!c||!n||r.type==="character"&&!n.characterUrl||r.type==="vehicle"&&!n.vehicleUrl||r.type==="airplane"&&!n.airplaneUrl)return null;const{canRide:t,isRiding:y,currentRideable:g}=i,f=g?.id,d=a.useMemo(()=>(f?c[f]?.offset:void 0)??I.vec3(),[f,c]),k=(()=>{const h=e.rigidBodyRef??s.rigidBodyRef,m=e.outerGroupRef??s.outerGroupRef,w=e.innerGroupRef??s.innerGroupRef,R=e.colliderRef??s.colliderRef,x={isActive:!0,componentType:r.type,enableRiding:t,isRiderOn:y,offset:d,ref:h,outerGroupRef:m,innerGroupRef:w,colliderRef:R,parts:(e.parts||[]).filter(E=>!!E.url).map(E=>({...E,url:E.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}:{}},j=y&&r.type!=="character"?n.ridingUrl:void 0,M=typeof j=="string"&&j.length>0?{ridingUrl:j}:{};switch(r.type){case"character":return{...x,url:n.characterUrl||""};case"vehicle":return{...x,...M,url:n.vehicleUrl||"",wheelUrl:n.wheelUrl};case"airplane":return{...x,...M,url:n.airplaneUrl||""};default:return{...x,url:n.characterUrl||""}}})();return r.type==="character"&&i.isRiding?null:o.jsx(p.PhysicsEntity,{...k,children:u})}const z=.5;function T(e){const{clickToMove:u,children:r,clickerOptions:i,...c}=e,n={...i??{},...i?.agentRadius===void 0&&c.colliderSize?.radius!==void 0?{agentRadius:Math.min(c.colliderSize.radius,z)}:{}};return o.jsxs(o.Fragment,{children:[o.jsx(q,{props:c,children:r}),u&&o.jsxs(o.Fragment,{children:[o.jsx(K,{clickerOptions:n}),o.jsx(G,{})]})]})}exports.Clicker=G;exports.ControllerWrapper=T;exports.GroundClicker=K;exports.useKeyboard=P;
@@ -0,0 +1 @@
1
+ "use strict";const u=require("react"),j=require("@react-three/fiber"),rt=require("three"),q=require("./index-D3fGCOPK.cjs"),C=require("./gaesupStore-CRQ-tcIz.cjs");require("reflect-metadata");const at=require("mitt");function ct(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const a=ct(rt);var lt=Object.defineProperty,ut=Object.getOwnPropertyDescriptor,H=(o,e,t,i)=>{for(var n=ut(e,t),r=o.length-1,c;r>=0;r--)(c=o[r])&&(n=c(e,t,n)||n);return n&&lt(e,t,n),n};function _(o){return{...o,distance:{...o.distance},smoothing:{...o.smoothing},...o.focusTarget?{focusTarget:{...o.focusTarget}}:{},...o.offset?{offset:{...o.offset}}:{},...o.lookAt?{lookAt:{...o.lookAt}}:{}}}class I{emitter;config;metrics={frameCount:0,totalFrameTime:0,lastUpdateTime:0};constructor(e){this.emitter=at(),this.config=_(e)}updateConfig(e){const t={...this.config};this.config=_({...this.config,...e}),Object.keys(e).forEach(i=>{this.emitter.emit("configChange",{key:i,value:e[i]})}),t.mode!==this.config.mode&&this.emitter.emit("modeChange",{from:t.mode,to:this.config.mode})}getConfig(){return _(this.config)}getState(){return{config:this.getConfig(),metrics:this.getMetrics()}}getMetrics(){return{frameCount:this.metrics.frameCount,averageFrameTime:this.metrics.frameCount>0?this.metrics.totalFrameTime/this.metrics.frameCount:0,lastUpdateTime:this.metrics.lastUpdateTime}}trackFrameMetrics(e){this.metrics.frameCount++,this.metrics.totalFrameTime+=e,this.metrics.lastUpdateTime=Date.now()}emitError(e,t){this.emitter.emit("error",{message:e,details:t})}destroy(){this.emitter.all.clear()}}H([C.HandleError()],I.prototype,"updateConfig");H([C.Profile()],I.prototype,"trackFrameMetrics");H([C.HandleError()],I.prototype,"destroy");const D=new a.Vector3,B=new a.Vector3,ft=new a.Quaternion,mt=new a.Matrix4,G=new a.Quaternion,R=new a.Vector3,A=new a.Raycaster,U=[],K=new a.Vector3,$=new a.Vector3,dt=new a.Vector3,ht=new a.Euler,gt=new a.Vector3,pt=new a.Vector3;new a.Vector3;let Z=[],J=null,W=-1;function tt(o){const e=[];return o.traverse(t=>{t instanceof a.Mesh&&!t.userData.intangible&&t.geometry?.boundingSphere&&e.push(t)}),e}function yt(o){const e=o._frameId;return e===void 0?tt(o):(o===J&&e-W<60||(J=o,W=e,Z=tt(o)),Z)}function vt(o,e){if(!e||e.length===0)return!1;let t=o;for(;t;){for(let i=0,n=e.length;i<n;i++)if(t===e[i])return!0;t=t.parent}return!1}const v={tempVectors:{temp1:new a.Vector3,temp2:new a.Vector3,temp3:new a.Vector3},clampValue:(o,e,t)=>Math.max(e,Math.min(t,o)),smoothingToSpeed:(o,e=C.CAMERA_CONSTANTS.FRAME_RATE_LERP_SPEED)=>{if(o===void 0||!Number.isFinite(o))return e;if(o<=0)return 0;if(o>=1)return o;const t=v.clampValue(o,.001,.999);return-Math.log(1-t)*60},frameRateIndependentLerpVector3:(o,e,t,i)=>{const n=1-Math.exp(-t*i);o.lerp(e,n)},smoothLookAt:(o,e,t,i)=>{const n=ft.setFromRotationMatrix(mt.lookAt(o.position,e,o.up)).normalize();G.copy(o.quaternion).normalize(),G.dot(n)<0&&(n.x*=-1,n.y*=-1,n.z*=-1,n.w*=-1);const r=1-Math.exp(-t*i);o.quaternion.slerp(n,r).normalize()},preventCameraJitter:(o,e,t,i,n,r=i*.8)=>{v.frameRateIndependentLerpVector3(o.position,e,i,n),v.smoothLookAt(o,t,r,n)},improvedCollisionCheck:(o,e,t,i=.5,n)=>{R.subVectors(e,o);const r=R.length();if(r<=0)return{safe:!0,position:e,obstacles:[]};R.multiplyScalar(1/r),A.set(o,R),A.near=0,A.far=r;const c=[],l=yt(t);for(let d=0,S=l.length;d<S;d++){const w=l[d];if(!w||vt(w,n))continue;U.length=0,A.intersectObject(w,!1,U);const g=U[0];g&&c.push({object:w,distance:g.distance,point:g.point})}if(c.length===0)return{safe:!0,position:e,obstacles:[]};const m=c.reduce((d,S)=>S.distance<d.distance?S:d);return K.copy(o).addScaledVector(R,Math.max(0,m.distance-i)),$.copy(K),{safe:!1,position:$,obstacles:c}},distanceSquared:(o,e)=>D.subVectors(o,e).lengthSq(),safeNormalize:o=>{const e=o.length();return e>0?o.divideScalar(e):o.set(0,0,0)},smoothDamp:(o,e,t,i,n,r)=>{const c=2/i,l=c*n,m=1/(1+l+.48*l*l+.235*l*l*l);D.subVectors(o,e);const d=r?r*i:1/0;D.clampLength(0,d),B.copy(t).addScaledVector(D,c).multiplyScalar(n),t.copy(t).sub(B).multiplyScalar(m),o.copy(e).add(D.add(B).multiplyScalar(m))},calculateBounds:(o,e,t)=>{if(!t)return o;const i=t.minX!==void 0?Math.max(t.minX,o.x):o.x,n=t.minY!==void 0?Math.max(t.minY,o.y):o.y,r=t.minZ!==void 0?Math.max(t.minZ,o.z):o.z,c=t.maxX!==void 0?Math.min(t.maxX,i):i,l=t.maxY!==void 0?Math.min(t.maxY,n):n,m=t.maxZ!==void 0?Math.min(t.maxZ,r):r;return D.set(c,l,m)},fastAtan2:(o,e)=>e===0?o>0?Math.PI/2:o<0?-Math.PI/2:0:e>0?Math.atan(o/e):Math.atan(o/e)+(o>=0?Math.PI:-Math.PI),updateFOV:(o,e,t,i)=>{if(!t||t<=0){if(Math.abs(e-o.fov)<1e-4)return;o.fov=e,o.updateProjectionMatrix();return}const n=i===void 0?t:1-Math.exp(-v.smoothingToSpeed(t)*i),r=n>=1?e:a.MathUtils.lerp(o.fov,e,n);Math.abs(r-o.fov)<1e-4||(o.fov=r,o.updateProjectionMatrix())},clampPosition:(o,e)=>(e&&(o.y=v.clampValue(o.y,e.minY||-1/0,e.maxY||1/0)),o),isPositionEqual:(o,e,t=.001)=>Math.abs(o.x-e.x)<t&&Math.abs(o.y-e.y)<t&&Math.abs(o.z-e.z)<t,pool:{vectors:[],getVector3:()=>v.pool.vectors.pop()||new a.Vector3,releaseVector3:o=>{o.set(0,0,0),v.pool.vectors.push(o)}},calculateSafeDistance:(o,e,t,i)=>{const n=o.distanceTo(e);return a.MathUtils.clamp(n,t,i)},isPositionValid:(o,e)=>e?o.y>=(e.minY??-1/0)&&o.y<=(e.maxY??1/0):!0},y={getPosition:o=>o?.position?o.position:dt.set(0,0,0),getEuler:o=>o?.euler?o.euler:ht.set(0,0,0),getVelocity:o=>o?.velocity?o.velocity:gt.set(0,0,0),calculateCameraOffset:(o,e,t)=>{const{xDistance:i=15,yDistance:n=8,zDistance:r=15,euler:c,mode:l="thirdPerson"}=e,m=t??pt;switch(l){case"chase":if(c){const d=1/Math.SQRT2;return m.set(-i*Math.sin(c.y)*d,n*d,-r*Math.cos(c.y)*d)}return m.set(-i,n,-r);case"thirdPerson":default:return m.set(-i,n,-r)}},getCameraTarget:(o,e)=>{const t=y.getPosition(o);return e.target||t}};var wt=Object.defineProperty,Ct=Object.getOwnPropertyDescriptor,it=(o,e,t,i)=>{for(var n=Ct(e,t),r=o.length-1,c;r>=0;r--)(c=o[r])&&(n=c(e,t,n)||n);return n&&wt(e,t,n),n};class P{focusTarget=new a.Vector3;focusDirection=new a.Vector3;focusBasePosition=new a.Vector3;focusTargetPosition=new a.Vector3;orbitRight=new a.Vector3;orbitYawQuaternion=new a.Quaternion;orbitPitchQuaternion=new a.Quaternion;xAxis=new a.Vector3(1,0,0);yAxis=new a.Vector3(0,1,0);applyDefaults(e){const t=this.defaultConfig,i=e.config;if(t.enableCollision!==void 0&&i.enableCollision===void 0&&(i.enableCollision=t.enableCollision),t.distance){const n=i.distance;n?(n.x===void 0&&t.distance.x!==void 0&&(n.x=t.distance.x),n.y===void 0&&t.distance.y!==void 0&&(n.y=t.distance.y),n.z===void 0&&t.distance.z!==void 0&&(n.z=t.distance.z)):i.distance={...t.distance}}if(t.smoothing){const n=i.smoothing;n?(n.position===void 0&&t.smoothing.position!==void 0&&(n.position=t.smoothing.position),n.rotation===void 0&&t.smoothing.rotation!==void 0&&(n.rotation=t.smoothing.rotation),n.fov===void 0&&t.smoothing.fov!==void 0&&(n.fov=t.smoothing.fov)):i.smoothing={...t.smoothing}}}calculateLookAt(e,t){return y.getPosition(e.activeState)}applyOrbitOffset(e,t){const i=t.config.orbitYaw??0,n=t.config.orbitPitch??0;return i===0&&n===0||(i!==0&&(this.orbitYawQuaternion.setFromAxisAngle(this.yAxis,i),e.applyQuaternion(this.orbitYawQuaternion)),n!==0&&(this.orbitRight.crossVectors(e,this.yAxis),this.orbitRight.lengthSq()<=1e-6?this.orbitRight.copy(this.xAxis):this.orbitRight.normalize(),this.orbitPitchQuaternion.setFromAxisAngle(this.orbitRight,n),e.applyQuaternion(this.orbitPitchQuaternion))),e}update(e,t){const{camera:i,deltaTime:n,activeState:r}=e;if(!r)return;this.applyDefaults(t);const c=t.config;let l,m;if(c.focus&&c.focusTarget){const g=this.focusTarget;g.set(c.focusTarget.x,c.focusTarget.y,c.focusTarget.z),m=g;const z=c.focusDistance||10,E=this.focusBasePosition.copy(this.calculateTargetPosition(e,t)),p=this.focusDirection;p.copy(E).sub(g),p.lengthSq()===0&&p.copy(i.position).sub(g),p.lengthSq()===0&&p.set(1,1,1),p.normalize(),l=this.focusTargetPosition.copy(g).addScaledVector(p,z)}else l=this.calculateTargetPosition(e,t),m=this.calculateLookAt(e,t);c.enableCollision&&(l=v.improvedCollisionCheck(m,l,e.scene,c.collisionMargin??.5,e.excludeObjects).position);const d=c.focusLerpSpeed||10,S=c.focus?d:v.smoothingToSpeed(c.smoothing?.position),w=c.focus?d*.8:v.smoothingToSpeed(c.smoothing?.rotation,S*.8);v.preventCameraJitter(i,l,m,S,n,w),t.config.fov&&i instanceof a.PerspectiveCamera&&v.updateFOV(i,t.config.fov,t.config.smoothing?.fov,n)}}it([C.Profile()],P.prototype,"calculateLookAt");it([C.HandleError(),C.Profile()],P.prototype,"update");class xt extends P{name="thirdPerson";target=new a.Vector3;offset=new a.Vector3;defaultConfig={distance:{x:15,y:8,z:15},smoothing:{position:.1,rotation:.1,fov:.1},enableCollision:!0};calculateTargetPosition(e,t){const i=y.getPosition(e.activeState),n=t.config.zoom||1;return y.calculateCameraOffset(i,{xDistance:t.config.distance.x*n,yDistance:t.config.distance.y*n,zDistance:t.config.distance.z*n,mode:"thirdPerson"},this.offset),this.applyOrbitOffset(this.offset,t),this.target.copy(i).add(this.offset)}}class bt extends P{name="firstPerson";target=new a.Vector3;lookAt=new a.Vector3;lookDirection=new a.Vector3;eyePosition=new a.Vector3;defaultConfig={distance:{x:0,y:2,z:.45},smoothing:{position:.2,rotation:.15,fov:.1},enableCollision:!1};calculateTargetPosition(e,t){const i=y.getPosition(e.activeState),n=y.getEuler(e.activeState),r=t.config.distance.y||this.defaultConfig.distance?.y||2,c=t.config.distance.z||this.defaultConfig.distance?.z||.45,l=this.lookDirection.set(0,0,-1);return n&&l.applyEuler(n),this.target.set(i.x,i.y+r,i.z).addScaledVector(l,c)}calculateLookAt(e,t){const i=this.eyePosition.copy(this.calculateTargetPosition(e,t)),n=y.getEuler(e.activeState),r=this.lookDirection.set(0,0,-1);return n&&r.applyEuler(n),this.lookAt.copy(i).add(r)}}class St extends P{name="chase";target=new a.Vector3;offset=new a.Vector3;defaultConfig={distance:{x:10,y:5,z:10},smoothing:{position:.15,rotation:.1,fov:.1},enableCollision:!0};calculateTargetPosition(e,t){const i=y.getPosition(e.activeState),n=y.getEuler(e.activeState),r=t.config.zoom||-1;return y.calculateCameraOffset(i,{xDistance:t.config.distance.x*r,yDistance:t.config.distance.y*r,zDistance:t.config.distance.z*r,euler:n,mode:"chase"},this.offset),this.applyOrbitOffset(this.offset,t),this.target.copy(i).add(this.offset)}}class Pt extends P{name="topDown";target=new a.Vector3;offset=new a.Vector3;yawQuaternion=new a.Quaternion;pitchQuaternion=new a.Quaternion;topDownXAxis=new a.Vector3(1,0,0);topDownYAxis=new a.Vector3(0,1,0);defaultConfig={distance:{x:0,y:20,z:0},smoothing:{position:.1,rotation:.1,fov:.1},enableCollision:!1};calculateTargetPosition(e,t){const i=y.getPosition(e.activeState),n=t.config.zoom||1,r=this.offset.set(0,t.config.distance.y*n,0),c=t.config.orbitPitch??0,l=t.config.orbitYaw??0;return c!==0&&(this.pitchQuaternion.setFromAxisAngle(this.topDownXAxis,c),r.applyQuaternion(this.pitchQuaternion)),l!==0&&(this.yawQuaternion.setFromAxisAngle(this.topDownYAxis,l),r.applyQuaternion(this.yawQuaternion)),this.target.copy(i).add(r)}}class Mt extends P{name="isometric";target=new a.Vector3;defaultConfig={distance:{x:15,y:15,z:15},smoothing:{position:.1,rotation:.1,fov:.1},enableCollision:!1};calculateTargetPosition(e,t){const i=y.getPosition(e.activeState),n=Math.PI/4,r=Math.sqrt(t.config.distance.x**2+t.config.distance.z**2);return this.target.set(i.x+Math.cos(n)*r,i.y+t.config.distance.y,i.z+Math.sin(n)*r)}}class Et extends P{name="sideScroll";target=new a.Vector3;defaultConfig={distance:{x:0,y:5,z:18},smoothing:{position:.08,rotation:.1,fov:.1},enableCollision:!1};calculateTargetPosition(e,t){const i=y.getPosition(e.activeState);return this.target.set(i.x+t.config.distance.x,i.y+t.config.distance.y,i.z+t.config.distance.z)}}class zt extends P{name="fixed";defaultPosition=new a.Vector3(0,10,10);defaultLookAt=new a.Vector3(0,0,0);defaultConfig={distance:{x:0,y:0,z:0},smoothing:{position:0,rotation:0,fov:0},enableCollision:!1};calculateTargetPosition(e,t){return t.config.fixedPosition||this.defaultPosition}calculateLookAt(e,t){return t.config.fixedLookAt||this.defaultLookAt}}var Tt=Object.getOwnPropertyDescriptor,Dt=(o,e,t,i)=>{for(var n=i>1?void 0:i?Tt(e,t):e,r=o.length-1,c;r>=0;r--)(c=o[r])&&(n=c(n)||n);return n};exports.CameraSystem=class extends I{controllers=new Map;state;cameraStates=new Map;currentCameraStateName="default";cameraTransitions=[];constructor(e){super(e),this.state=this.createInitialState(e),this.registerControllers(),this.initializeCameraStates()}createInitialState(e){return{config:_(e),lastUpdate:Date.now()}}initializeCameraStates(){const e={name:"default",type:"thirdPerson",position:new a.Vector3(0,5,10),rotation:new a.Euler(0,0,0),fov:75,config:{distance:{x:15,y:8,z:15},height:5,followSpeed:.1,rotationSpeed:.1},priority:0,tags:[]};this.cameraStates.set("default",e)}registerController(e){this.controllers.set(e.name,e)}updateConfig(e){super.updateConfig(e),this.state.config=this.getConfig()}update(e){this.trackFrameMetrics(e)}calculate(e){try{const t=this.controllers.get(this.state.config.mode);if(!t)return;this.state.activeController=t,t.update(e,this.state)}catch(t){this.emitError("Camera calculation failed",t instanceof Error?t.message:void 0)}}getCameraState(e){return this.cameraStates.get(e)}getCurrentCameraState(){return this.cameraStates.get(this.currentCameraStateName)}addCameraState(e,t){this.cameraStates.set(e,t)}setCameraTransitions(e){this.cameraTransitions=e,this.cameraTransitions.length}switchCameraState(e){if(this.cameraStates.has(e)){this.currentCameraStateName=e;const t=this.cameraStates.get(e),i={mode:t.type,fov:t.fov};t.config.distance&&(i.distance=t.config.distance),this.updateConfig(i)}}registerControllers(){this.registerController(new xt),this.registerController(new bt),this.registerController(new St),this.registerController(new Pt),this.registerController(new Mt),this.registerController(new Et),this.registerController(new zt)}};exports.CameraSystem=Dt([C.ManageRuntime({autoStart:!1})],exports.CameraSystem);function Rt(o,e,t){const i=u.useRef(null);i.current||(i.current=new o(e));const n=i.current;j.useFrame((m,d)=>{n?.update(d)}),u.useEffect(()=>{},[t,n]),u.useEffect(()=>()=>{n?.destroy()},[n]);const r=u.useCallback(m=>{n?.updateConfig(m)},[n]),c=u.useCallback(()=>n?.getState(),[n]),l=u.useCallback(()=>n?.getMetrics(),[n]);return{system:n,updateConfig:r,getState:c,getMetrics:l}}const et=.0015,ot=10,nt=1e-4,Vt=-.65,Ot=.85,N=o=>{if(!(o instanceof HTMLElement))return!1;const e=o.tagName.toLowerCase();return e==="input"||e==="textarea"||e==="select"||o.isContentEditable};function kt(){const{gl:o}=j.useThree(),{activeState:e}=q.useStateSystem(),t=C.useGaesupStore(s=>s.cameraOption),i=C.useGaesupStore(s=>s.setCameraOption),n=C.useGaesupStore(s=>s.mode),r=q.useBuildingStore(s=>s.isInEditMode()),c=q.useInputBackend(),l=u.useRef(t);u.useEffect(()=>{l.current=t},[t]);const m=u.useRef(n);u.useEffect(()=>{m.current=n},[n]);const d=u.useRef(r);u.useEffect(()=>{d.current=r},[r]);const S=u.useRef([]),w=u.useRef(null),g=u.useRef(new Set),z=u.useRef(!1),E=u.useRef(0),p=u.useRef(0),X=u.useRef(0),Y=u.useRef(0),st=u.useMemo(()=>({mode:n?.control||"thirdPerson",distance:{x:t?.xDistance??0,y:t?.yDistance??0,z:t?.zDistance??0},smoothing:{position:t?.smoothing?.position??.1,rotation:t?.smoothing?.rotation??.1,fov:t?.smoothing?.fov??.1},fov:t?.fov??75,zoom:t?.zoom??1,enableCollision:t?.enableCollision??!0,...t?.collisionMargin!==void 0?{collisionMargin:t.collisionMargin}:{},orbitYaw:E.current,orbitPitch:p.current,...t?.maxDistance!==void 0?{maxDistance:t.maxDistance}:{},...t?.offset?{offset:{x:t.offset.x,y:t.offset.y,z:t.offset.z}}:{},...t?.target?{lookAt:{x:t.target.x,y:t.target.y,z:t.target.z}}:{}}),[]),{system:Q,updateConfig:V}=Rt(exports.CameraSystem,st),O=u.useCallback(()=>{const s=l.current,h=m.current;V({mode:h?.control||"thirdPerson",distance:{x:s?.xDistance??0,y:s?.yDistance??0,z:s?.zDistance??0},smoothing:{position:s?.smoothing?.position??.1,rotation:s?.smoothing?.rotation??.1,fov:s?.smoothing?.fov??.1},fov:s?.fov??75,zoom:s?.zoom??1,enableCollision:s?.enableCollision??!0,...s?.collisionMargin!==void 0?{collisionMargin:s.collisionMargin}:{},orbitYaw:E.current,orbitPitch:p.current,...s?.maxDistance!==void 0?{maxDistance:s.maxDistance}:{},...s?.offset?{offset:{x:s.offset.x,y:s.offset.y,z:s.offset.z}}:{},...s?.target?{lookAt:{x:s.target.x,y:s.target.y,z:s.target.z}}:{},...s?.focus!==void 0?{focus:s.focus}:{},...s?.focusTarget?{focusTarget:{x:s.focusTarget.x,y:s.focusTarget.y,z:s.focusTarget.z}}:{focusTarget:void 0},...s?.focusDistance!==void 0?{focusDistance:s.focusDistance}:{},...s?.focusLerpSpeed!==void 0?{focusLerpSpeed:s.focusLerpSpeed}:{}})},[V]),F=u.useCallback(s=>{const h=l.current;if(!h?.enableZoom)return;s.preventDefault();const x=h.zoomSpeed||.001,M=h.minZoom||.45,b=h.maxZoom||2.4,k=h.zoom||1,T=s.deltaY*x,L=Math.min(Math.max(k+T,M),b);i({zoom:L})},[i]);return u.useEffect(()=>{const s=o.domElement;if(t?.enableZoom)return s.addEventListener("wheel",F,{passive:!1}),()=>{s.removeEventListener("wheel",F)}},[o,F,t?.enableZoom]),u.useEffect(()=>{const s=o.domElement,h=f=>{N(f.target)||(f.code==="ControlLeft"||f.code==="ControlRight")&&g.current.add(f.code)},x=f=>{f.code!=="ControlLeft"&&f.code!=="ControlRight"||g.current.delete(f.code)},M=f=>{!d.current||N(f.target)||f.button!==1&&f.button!==2||(f.preventDefault(),z.current=!0)},b=f=>{f.button!==1&&f.button!==2||(z.current=!1)},k=f=>{!(g.current.size>0||z.current)||N(f.target)||f.movementX===0&&f.movementY===0||(X.current-=f.movementX*et,Y.current=a.MathUtils.clamp(Y.current+f.movementY*et,Vt,Ot))},T=()=>{g.current.clear(),z.current=!1},L=f=>{d.current&&f.preventDefault()};return window.addEventListener("keydown",h),window.addEventListener("keyup",x),window.addEventListener("mousemove",k),window.addEventListener("mouseup",b),window.addEventListener("blur",T),document.addEventListener("visibilitychange",T),s.addEventListener("mousedown",M),s.addEventListener("contextmenu",L),()=>{window.removeEventListener("keydown",h),window.removeEventListener("keyup",x),window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",b),window.removeEventListener("blur",T),document.removeEventListener("visibilitychange",T),s.removeEventListener("mousedown",M),s.removeEventListener("contextmenu",L)}},[o,V]),u.useEffect(()=>{const s=h=>{const x=l.current;h.key==="Escape"&&x?.focus&&i({focus:!1})};if(t?.enableFocus&&!r)return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s)}},[t?.enableFocus,r,i]),u.useLayoutEffect(()=>{c.updateMouse({isLookAround:!1}),O()},[c,O]),u.useLayoutEffect(()=>{O()},[t,n,O]),j.useFrame((s,h)=>{if(!Q)return;const x=a.MathUtils.damp(E.current,X.current,ot,h),M=a.MathUtils.damp(p.current,Y.current,ot,h);if((Math.abs(x-E.current)>nt||Math.abs(M-p.current)>nt)&&(E.current=x,p.current=M,V({orbitYaw:x,orbitPitch:M})),!w.current)w.current={camera:s.camera,scene:s.scene,deltaTime:h,activeState:e,clock:s.clock,excludeObjects:S.current};else{const b=w.current;b.camera=s.camera,b.scene=s.scene,b.deltaTime=h,b.activeState=e,b.clock=s.clock}Q.calculate(w.current)}),{system:Q}}function Lt(){return kt(),null}function At(){const o=u.useRef(null),e=u.useRef(null),t=u.useRef(null),i=u.useRef(null);return{outerGroupRef:o,innerGroupRef:e,rigidBodyRef:t,colliderRef:i}}exports.Camera=Lt;exports.useGenericRefs=At;
@@ -1,7 +1,7 @@
1
1
  import { jsxs as I, jsx as C } from "react/jsx-runtime";
2
2
  import { useRef as B, useMemo as A, useEffect as z, useCallback as E } from "react";
3
3
  import * as b from "three";
4
- import { U as O } from "./index-DUzx7X82.js";
4
+ import { U as O } from "./index-CfRfBVRR.js";
5
5
  import "reflect-metadata";
6
6
  import { A as _, R as L, M as V } from "./gaesupStore-x2iiDzsY.js";
7
7
  const W = "gaesup-save", j = 1, v = "slots";
@@ -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-x2iiDzsY.js";
5
- import { T as x } from "./index-DUzx7X82.js";
6
- import { C as y } from "./index-Bz9Gk3DQ.js";
5
+ import { T as x } from "./index-CfRfBVRR.js";
6
+ import { C as y } from "./index-DHdmWNTv.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(() => {
@@ -1 +1 @@
1
- "use strict";const f=require("react"),j=require("./index-Dpgu-of6.cjs"),U=require("./runtimeFilter-W6iMw1pL.cjs"),re=require("./assetStore-DVPge_2j.cjs"),se=require("./snapshot-DRqZrbCu.cjs"),c=require("react/jsx-runtime"),W=require("@react-three/fiber"),oe=require("three"),m=require("./eventsStore-Cipkf938.cjs"),V=require("./timeStore-CDN035t4.cjs"),C=require("./weatherStore-1unmwIen.cjs");function ie(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const P=ie(oe);function ae({intervalMs:e=5*60*1e3,slot:t,saveOnUnload:n=!0,saveOnVisibilityChange:r=!0}={}){f.useEffect(()=>{const s=j.getSaveSystem();let o=!1;const a=()=>{o||s.save(t)},u=window.setInterval(a,Math.max(1e3,e)),l=()=>{s.save(t)},g=()=>{document.visibilityState==="hidden"&&s.save(t)};return n&&window.addEventListener("beforeunload",l),r&&document.addEventListener("visibilitychange",g),()=>{o=!0,window.clearInterval(u),n&&window.removeEventListener("beforeunload",l),r&&document.removeEventListener("visibilitychange",g)}},[e,t,n,r])}function ce(e,t){f.useEffect(()=>{const n=j.getSaveSystem();let r=!1;return n.load(e).then(s=>{!r&&t&&t(s)}),()=>{r=!0}},[e,t])}const L="runtime.saveDiagnostics",$="runtime:saveDiagnostic";function K(e={}){const t=Math.max(1,e.maxEntries??50),n=[],r=new Set;let s=1;return{report(o){const a=J(o.error),u={...o,id:s,reportedAt:Date.now(),errorMessage:a,message:H(o,a)};s+=1,n.push(u),n.length>t&&n.splice(0,n.length-t);for(const l of r)l(u);return u},getDiagnostics(){return n.map(o=>({...o}))},getLatest(){const o=n[n.length-1];return o?{...o}:void 0},clear(){n.length=0},subscribe(o){return r.add(o),()=>{r.delete(o)}}}}function H(e,t=J(e.error)){return`Save domain "${e.key}" failed during ${e.phase} for slot "${e.slot}": ${t}`}function J(e){return e instanceof Error?e.message:typeof e=="string"?e:"Unknown save error"}function ue(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.key=="string"&&typeof t.serialize=="function"&&typeof t.hydrate=="function"}function fe(e={}){const t=U.createPluginLogger(e.logger),n=U.createPluginRegistry(e.logger?{logger:e.logger}:{}),r=e.pluginRuntime??"client",s=e.saveSystem??(e.saveOptions?new j.SaveSystem(le(e.saveOptions)):j.getSaveSystem()),o=K(e.saveDiagnostics),a=s.subscribeDiagnostics(i=>{const d=o.report(i);t.warn(d.message,d),n.context.events.emit($,d)}),u=new Map;n.context.services.register(L,o,"gaesup.runtime");for(const i of U.filterPluginsForRuntime(e.plugins??[],r))n.register(i);const l=i=>{if(u.has(i.key))return;const d=s.register({key:i.key,serialize:()=>i.serialize()??null,hydrate:i.hydrate});u.set(i.key,d)};for(const i of e.saveBindings??[])l(i);const g=()=>{for(const i of n.context.save.list())ue(i.value)&&l(i.value)},w=async()=>{const i=e.assets?.source;i&&await re.useAssetStore.getState().loadAssets(i)};return{pluginRuntime:r,plugins:n,save:s,saveDiagnostics:o,loadAssets:w,getService:i=>n.context.services.get(i),requireService:i=>n.context.services.require(i),setup:async()=>{e.assets?.loadOnCreate&&await w(),await n.setupAll(),g()},dispose:async()=>{await n.disposeAll(),a();for(const i of u.values())i();u.clear(),n.context.services.remove(L)}}}function le(e){return{...e}}const Q={lighting:{ambientIntensity:1,directionalIntensity:1,directionalPosition:{x:0,y:10,z:0}}};function I(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function O(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function _(e){return Array.isArray(e)?e.map(t=>O(t)):[]}function k(e,t){const n=e[t];return I(n)?n:void 0}function F(e){if(Array.isArray(e)&&e.length>=3){const[t,n,r]=e;if(typeof t=="number"&&typeof n=="number"&&typeof r=="number")return{x:t,y:n,z:r}}if(I(e)&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number")return{x:e.x,y:e.y,z:e.z}}function de(e){if(!I(e)||typeof e.id!="string")return null;const t=F(e.position)??{x:0,y:0,z:0},n=F(e.rotation)??{x:0,y:0,z:0},r=I(e.metadata)?O(e.metadata):void 0,s=I(e.behavior)?e.behavior:void 0,o=s&&typeof s.mode=="string"?s.mode:void 0;return{id:e.id,name:typeof e.name=="string"?e.name:e.id,position:t,rotation:n,...typeof e.modelUrl=="string"?{modelUrl:e.modelUrl}:{},...o?{behavior:o}:{},...r?{metadata:r}:{}}}function me(e){const t=e?.instances;return Array.isArray(t)?t.map(de).filter(n=>n!==null):[]}function X(e){if(!e)return;const t=I(e.cameraOption)?e.cameraOption:e,n=F(t.position);if(!n)return;const r=F(t.rotation)??{x:0,y:0,z:0},s=I(e.mode)?e.mode:void 0,o=typeof e.mode=="string"?e.mode:s&&typeof s.control=="string"?s.control:"default",a=I(e.settings)?O(e.settings):I(e.cameraOption)?O(e.cameraOption):void 0;return{position:n,rotation:r,mode:o,...a?{settings:a}:{}}}function Z(e,t,n){const r=k(e,"building"),s=X(k(e,"camera"));return{id:t,name:n,buildings:{wallGroups:_(r?.wallGroups),tileGroups:_(r?.tileGroups),blocks:_(r?.blocks),meshes:_(r?.meshes)},npcs:me(k(e,"npc")),environment:Q,...s?{camera:s}:{}}}function Y(e){const t=e.slice(e.lastIndexOf("_")+1),n=Number(t);return Number.isFinite(n)?n:Date.now()}function ee(e){const t=e.lastIndexOf("_");return t>0?e.slice(0,t):e}function te(e,t){if(e)return{...e,createdAt:e.createdAt??t,updatedAt:e.updatedAt??t}}function ge(e,t,n,r){const s=Y(t),o=ee(t),a={version:"1.0.0",timestamp:s,world:Z(se.collectSaveDomains(e),o,n??o)},u=te(r,s);return u?{...a,metadata:u}:a}class he{byKind=new Map;global=new Set;on(t,n){let r=this.byKind.get(t);return r||(r=new Set,this.byKind.set(t,r)),r.add(n),()=>{r.delete(n)}}onAny(t){return this.global.add(t),()=>{this.global.delete(t)}}emit(t){const n=this.byKind.get(t.kind);if(n){for(const r of n)if(r(t)===!0)return}for(const r of this.global)r(t)}clear(){this.byKind.clear(),this.global.clear()}}let G=null;function ne(){return G||(G=new he),G}function N(e,t,n=!0){f.useEffect(()=>n?ne().on(e,t):void 0,[e,t,n])}function Se(){const e=m.useInventoryStore(n=>n.getEquipped());return e?m.getItemRegistry().get(e.itemId)?.toolKind??null:null}function ye({position:e,rotationY:t=0,hp:n=3,woodDrop:r=2,regrowMinutes:s=1440,hitRange:o=1.6,trunkColor:a="#6b4a2a",foliageColor:u="#3f8a3a",scale:l=1}){const g=f.useRef(null),[w,i]=f.useState(n),[d,h]=f.useState(!1),S=f.useRef(0),y=f.useRef(-1/0),p=f.useCallback(D=>{if(d)return;const M=D.origin[0]-e[0],x=D.origin[2]-e[2],A=M*M+x*x,T=o+D.range*.5;if(!(A>T*T))return y.current=performance.now(),i(q=>{const B=q-1;return B<=0?(m.useInventoryStore.getState().add("wood",r)>0?m.notify("warn","인벤토리가 가득 찼습니다"):m.notify("reward",`목재 +${r}`),h(!0),S.current=V.useTimeStore.getState().totalMinutes+s,n):B}),!0},[d,e,o,r,s,n]);N("axe",p),f.useEffect(()=>d?V.useTimeStore.subscribe((M,x)=>{M.totalMinutes!==x.totalMinutes&&M.totalMinutes>=S.current&&(h(!1),i(n))}):void 0,[d,n]),W.useFrame((D,M)=>{const x=g.current;if(!x)return;const A=(performance.now()-y.current)/1e3;if(A<.4){const T=A/.4,q=Math.sin(T*Math.PI*6)*(1-T)*.18;x.rotation.z=q}else Math.abs(x.rotation.z)>1e-4&&(x.rotation.z*=Math.max(0,1-M*12))});const b=w<n,R=1.6*l,v=.18*l,E=.95*l,z=f.useMemo(()=>{const D=new P.Color(u);return b&&D.lerp(new P.Color("#a55"),.06*(n-w)),D},[u,b,n,w]);return d?c.jsx("group",{position:e,rotation:[0,t,0],children:c.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,.18*l,0],children:[c.jsx("cylinderGeometry",{args:[v,v*1.15,.36*l,12]}),c.jsx("meshToonMaterial",{color:a})]})}):c.jsxs("group",{ref:g,position:e,rotation:[0,t,0],children:[c.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,R*.5,0],children:[c.jsx("cylinderGeometry",{args:[v*.85,v,R,12]}),c.jsx("meshToonMaterial",{color:a})]}),c.jsxs("mesh",{castShadow:!0,position:[0,R+E*.6,0],children:[c.jsx("coneGeometry",{args:[E,E*1.6,14]}),c.jsx("meshToonMaterial",{color:z})]}),c.jsxs("mesh",{castShadow:!0,position:[0,R+E*1.5,0],children:[c.jsx("coneGeometry",{args:[E*.75,E*1.2,14]}),c.jsx("meshToonMaterial",{color:z})]})]})}const pe=[{itemId:"fish-bass",weight:60},{itemId:"fish-tuna",weight:25},{itemId:"fish-koi",weight:10}];function we(e,t,n){const r=[];for(const a of n)a.startsWith(t)&&r.push(a.slice(t.length));if(r.length===0)return e;const s=new Set(r),o=e.filter(a=>s.has(a.itemId));return o.length>0?o:e}function ve(e){if(e.length===0)return null;const t=e.reduce((r,s)=>r+Math.max(0,s.weight),0);if(t<=0)return null;let n=Math.random()*t;for(const r of e)if(n-=Math.max(0,r.weight),n<=0)return r.itemId;return e[e.length-1].itemId}function be({position:e,radius:t=3,pool:n=pe,cooldownMs:r=600,successChance:s=.6,showRipple:o=!0,rippleColor:a="#9ad9ff"}){const u=f.useRef(-1/0),l=f.useRef(null),g=f.useRef(-1/0),w=f.useCallback(i=>{const d=i.origin[0]-e[0],h=i.origin[2]-e[2];if(d*d+h*h>t*t)return;const S=performance.now();if(S-u.current<r)return!0;u.current=S,g.current=S;const y=C.useWeatherStore.getState().fishingBonus();if(Math.random()>Math.min(.95,s+y))return m.notify("warn","놓쳤다…"),!0;const p=we(n,"fish:",m.useEventsStore.getState().tags),b=ve(p);if(!b)return!0;const R=m.getItemRegistry().get(b);return m.useInventoryStore.getState().add(b,1)>0?m.notify("warn","인벤토리가 가득 찼습니다"):m.notify("reward",`${R?.name??b} 낚음!`),!0},[e,t,r,n,s]);return N("rod",w),W.useFrame(()=>{const i=l.current;if(!i)return;const d=(performance.now()-g.current)/1e3;if(d<.6){const h=d/.6;i.scale.setScalar(.4+h*1.4);const S=i.material;S.opacity=.55*(1-h)}else i.scale.setScalar(0)}),c.jsx("group",{position:e,children:o&&c.jsxs("mesh",{ref:l,rotation:[-Math.PI/2,0,0],position:[0,.04,0],children:[c.jsx("ringGeometry",{args:[.4,.6,32]}),c.jsx("meshBasicMaterial",{color:a,transparent:!0,opacity:0,depthWrite:!1})]})})}const xe=[{itemId:"bug-butterfly",weight:70},{itemId:"bug-beetle",weight:22},{itemId:"bug-stag",weight:8}];function Ie(e,t,n){const r=[];for(const a of n)a.startsWith(t)&&r.push(a.slice(t.length));if(r.length===0)return e;const s=new Set(r),o=e.filter(a=>s.has(a.itemId));return o.length>0?o:e}function Re(e){if(e.length===0)return null;const t=e.reduce((r,s)=>r+Math.max(0,s.weight),0);if(t<=0)return null;let n=Math.random()*t;for(const r of e)if(n-=Math.max(0,r.weight),n<=0)return r.itemId;return e[e.length-1].itemId}function Ee({position:e,radius:t=2.4,pool:n=xe,cooldownMs:r=600,successChance:s=.7,bugColor:o="#ffd0e0",hoverHeight:a=1.2}){const u=f.useRef(-1/0),l=f.useRef(null),[g,w]=f.useState(!0),i=f.useRef(-1/0),d=f.useCallback(h=>{if(!g)return;const S=h.origin[0]-e[0],y=h.origin[2]-e[2];if(S*S+y*y>t*t)return;const p=performance.now();if(p-u.current<r)return!0;u.current=p;const b=C.useWeatherStore.getState().bugBonus();if(Math.random()>Math.min(.95,Math.max(.05,s+b)))return m.notify("warn","날아갔다…"),w(!1),i.current=p+8e3,!0;const R=Ie(n,"bug:",m.useEventsStore.getState().tags),v=Re(R);if(!v)return!0;const E=m.getItemRegistry().get(v);return m.useInventoryStore.getState().add(v,1)>0?m.notify("warn","인벤토리가 가득 찼습니다"):m.notify("reward",`${E?.name??v} 잡았다!`),w(!1),i.current=p+12e3,!0},[e,t,r,n,s,g]);return N("net",d),W.useFrame(({clock:h})=>{const S=performance.now();!g&&S>=i.current&&w(!0);const y=l.current;if(!y||!g)return;const p=h.elapsedTime;y.position.x=Math.sin(p*1.2)*.6,y.position.z=Math.cos(p*.9)*.6,y.position.y=a+Math.sin(p*2.6)*.15,y.rotation.y=p*1.4}),g?c.jsx("group",{position:e,children:c.jsxs("mesh",{ref:l,children:[c.jsx("sphereGeometry",{args:[.12,10,10]}),c.jsx("meshToonMaterial",{color:o})]})}):c.jsx("group",{position:e})}exports.BugSpot=Ee;exports.DEFAULT_RUNTIME_SAVE_DIAGNOSTICS_SERVICE_ID=L;exports.DEFAULT_WORLD_SAVE_ENVIRONMENT=Q;exports.FishSpot=be;exports.RUNTIME_SAVE_DIAGNOSTIC_EVENT=$;exports.TreeObject=ye;exports.createCameraSaveDataFromDomain=X;exports.createGaesupRuntime=fe;exports.createRuntimeSaveDiagnostics=K;exports.createSaveDataFromSaveSystem=ge;exports.createWorldDataFromSaveDomains=Z;exports.formatRuntimeSaveDiagnostic=H;exports.getToolEvents=ne;exports.normalizeSaveMetadata=te;exports.parseWorldSaveId=ee;exports.parseWorldSaveTimestamp=Y;exports.useAutoSave=ae;exports.useEquippedToolKind=Se;exports.useLoadOnMount=ce;exports.useToolUse=N;
1
+ "use strict";const f=require("react"),j=require("./index-DIlYN25q.cjs"),U=require("./runtimeFilter-W6iMw1pL.cjs"),re=require("./assetStore-DVPge_2j.cjs"),se=require("./snapshot-DRqZrbCu.cjs"),c=require("react/jsx-runtime"),W=require("@react-three/fiber"),oe=require("three"),m=require("./eventsStore-Cipkf938.cjs"),V=require("./timeStore-CDN035t4.cjs"),C=require("./weatherStore-1unmwIen.cjs");function ie(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const P=ie(oe);function ae({intervalMs:e=5*60*1e3,slot:t,saveOnUnload:n=!0,saveOnVisibilityChange:r=!0}={}){f.useEffect(()=>{const s=j.getSaveSystem();let o=!1;const a=()=>{o||s.save(t)},u=window.setInterval(a,Math.max(1e3,e)),l=()=>{s.save(t)},g=()=>{document.visibilityState==="hidden"&&s.save(t)};return n&&window.addEventListener("beforeunload",l),r&&document.addEventListener("visibilitychange",g),()=>{o=!0,window.clearInterval(u),n&&window.removeEventListener("beforeunload",l),r&&document.removeEventListener("visibilitychange",g)}},[e,t,n,r])}function ce(e,t){f.useEffect(()=>{const n=j.getSaveSystem();let r=!1;return n.load(e).then(s=>{!r&&t&&t(s)}),()=>{r=!0}},[e,t])}const L="runtime.saveDiagnostics",$="runtime:saveDiagnostic";function K(e={}){const t=Math.max(1,e.maxEntries??50),n=[],r=new Set;let s=1;return{report(o){const a=J(o.error),u={...o,id:s,reportedAt:Date.now(),errorMessage:a,message:H(o,a)};s+=1,n.push(u),n.length>t&&n.splice(0,n.length-t);for(const l of r)l(u);return u},getDiagnostics(){return n.map(o=>({...o}))},getLatest(){const o=n[n.length-1];return o?{...o}:void 0},clear(){n.length=0},subscribe(o){return r.add(o),()=>{r.delete(o)}}}}function H(e,t=J(e.error)){return`Save domain "${e.key}" failed during ${e.phase} for slot "${e.slot}": ${t}`}function J(e){return e instanceof Error?e.message:typeof e=="string"?e:"Unknown save error"}function ue(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.key=="string"&&typeof t.serialize=="function"&&typeof t.hydrate=="function"}function fe(e={}){const t=U.createPluginLogger(e.logger),n=U.createPluginRegistry(e.logger?{logger:e.logger}:{}),r=e.pluginRuntime??"client",s=e.saveSystem??(e.saveOptions?new j.SaveSystem(le(e.saveOptions)):j.getSaveSystem()),o=K(e.saveDiagnostics),a=s.subscribeDiagnostics(i=>{const d=o.report(i);t.warn(d.message,d),n.context.events.emit($,d)}),u=new Map;n.context.services.register(L,o,"gaesup.runtime");for(const i of U.filterPluginsForRuntime(e.plugins??[],r))n.register(i);const l=i=>{if(u.has(i.key))return;const d=s.register({key:i.key,serialize:()=>i.serialize()??null,hydrate:i.hydrate});u.set(i.key,d)};for(const i of e.saveBindings??[])l(i);const g=()=>{for(const i of n.context.save.list())ue(i.value)&&l(i.value)},w=async()=>{const i=e.assets?.source;i&&await re.useAssetStore.getState().loadAssets(i)};return{pluginRuntime:r,plugins:n,save:s,saveDiagnostics:o,loadAssets:w,getService:i=>n.context.services.get(i),requireService:i=>n.context.services.require(i),setup:async()=>{e.assets?.loadOnCreate&&await w(),await n.setupAll(),g()},dispose:async()=>{await n.disposeAll(),a();for(const i of u.values())i();u.clear(),n.context.services.remove(L)}}}function le(e){return{...e}}const Q={lighting:{ambientIntensity:1,directionalIntensity:1,directionalPosition:{x:0,y:10,z:0}}};function I(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function O(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function _(e){return Array.isArray(e)?e.map(t=>O(t)):[]}function k(e,t){const n=e[t];return I(n)?n:void 0}function F(e){if(Array.isArray(e)&&e.length>=3){const[t,n,r]=e;if(typeof t=="number"&&typeof n=="number"&&typeof r=="number")return{x:t,y:n,z:r}}if(I(e)&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number")return{x:e.x,y:e.y,z:e.z}}function de(e){if(!I(e)||typeof e.id!="string")return null;const t=F(e.position)??{x:0,y:0,z:0},n=F(e.rotation)??{x:0,y:0,z:0},r=I(e.metadata)?O(e.metadata):void 0,s=I(e.behavior)?e.behavior:void 0,o=s&&typeof s.mode=="string"?s.mode:void 0;return{id:e.id,name:typeof e.name=="string"?e.name:e.id,position:t,rotation:n,...typeof e.modelUrl=="string"?{modelUrl:e.modelUrl}:{},...o?{behavior:o}:{},...r?{metadata:r}:{}}}function me(e){const t=e?.instances;return Array.isArray(t)?t.map(de).filter(n=>n!==null):[]}function X(e){if(!e)return;const t=I(e.cameraOption)?e.cameraOption:e,n=F(t.position);if(!n)return;const r=F(t.rotation)??{x:0,y:0,z:0},s=I(e.mode)?e.mode:void 0,o=typeof e.mode=="string"?e.mode:s&&typeof s.control=="string"?s.control:"default",a=I(e.settings)?O(e.settings):I(e.cameraOption)?O(e.cameraOption):void 0;return{position:n,rotation:r,mode:o,...a?{settings:a}:{}}}function Z(e,t,n){const r=k(e,"building"),s=X(k(e,"camera"));return{id:t,name:n,buildings:{wallGroups:_(r?.wallGroups),tileGroups:_(r?.tileGroups),blocks:_(r?.blocks),meshes:_(r?.meshes)},npcs:me(k(e,"npc")),environment:Q,...s?{camera:s}:{}}}function Y(e){const t=e.slice(e.lastIndexOf("_")+1),n=Number(t);return Number.isFinite(n)?n:Date.now()}function ee(e){const t=e.lastIndexOf("_");return t>0?e.slice(0,t):e}function te(e,t){if(e)return{...e,createdAt:e.createdAt??t,updatedAt:e.updatedAt??t}}function ge(e,t,n,r){const s=Y(t),o=ee(t),a={version:"1.0.0",timestamp:s,world:Z(se.collectSaveDomains(e),o,n??o)},u=te(r,s);return u?{...a,metadata:u}:a}class he{byKind=new Map;global=new Set;on(t,n){let r=this.byKind.get(t);return r||(r=new Set,this.byKind.set(t,r)),r.add(n),()=>{r.delete(n)}}onAny(t){return this.global.add(t),()=>{this.global.delete(t)}}emit(t){const n=this.byKind.get(t.kind);if(n){for(const r of n)if(r(t)===!0)return}for(const r of this.global)r(t)}clear(){this.byKind.clear(),this.global.clear()}}let G=null;function ne(){return G||(G=new he),G}function N(e,t,n=!0){f.useEffect(()=>n?ne().on(e,t):void 0,[e,t,n])}function Se(){const e=m.useInventoryStore(n=>n.getEquipped());return e?m.getItemRegistry().get(e.itemId)?.toolKind??null:null}function ye({position:e,rotationY:t=0,hp:n=3,woodDrop:r=2,regrowMinutes:s=1440,hitRange:o=1.6,trunkColor:a="#6b4a2a",foliageColor:u="#3f8a3a",scale:l=1}){const g=f.useRef(null),[w,i]=f.useState(n),[d,h]=f.useState(!1),S=f.useRef(0),y=f.useRef(-1/0),p=f.useCallback(D=>{if(d)return;const M=D.origin[0]-e[0],x=D.origin[2]-e[2],A=M*M+x*x,T=o+D.range*.5;if(!(A>T*T))return y.current=performance.now(),i(q=>{const B=q-1;return B<=0?(m.useInventoryStore.getState().add("wood",r)>0?m.notify("warn","인벤토리가 가득 찼습니다"):m.notify("reward",`목재 +${r}`),h(!0),S.current=V.useTimeStore.getState().totalMinutes+s,n):B}),!0},[d,e,o,r,s,n]);N("axe",p),f.useEffect(()=>d?V.useTimeStore.subscribe((M,x)=>{M.totalMinutes!==x.totalMinutes&&M.totalMinutes>=S.current&&(h(!1),i(n))}):void 0,[d,n]),W.useFrame((D,M)=>{const x=g.current;if(!x)return;const A=(performance.now()-y.current)/1e3;if(A<.4){const T=A/.4,q=Math.sin(T*Math.PI*6)*(1-T)*.18;x.rotation.z=q}else Math.abs(x.rotation.z)>1e-4&&(x.rotation.z*=Math.max(0,1-M*12))});const b=w<n,R=1.6*l,v=.18*l,E=.95*l,z=f.useMemo(()=>{const D=new P.Color(u);return b&&D.lerp(new P.Color("#a55"),.06*(n-w)),D},[u,b,n,w]);return d?c.jsx("group",{position:e,rotation:[0,t,0],children:c.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,.18*l,0],children:[c.jsx("cylinderGeometry",{args:[v,v*1.15,.36*l,12]}),c.jsx("meshToonMaterial",{color:a})]})}):c.jsxs("group",{ref:g,position:e,rotation:[0,t,0],children:[c.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,R*.5,0],children:[c.jsx("cylinderGeometry",{args:[v*.85,v,R,12]}),c.jsx("meshToonMaterial",{color:a})]}),c.jsxs("mesh",{castShadow:!0,position:[0,R+E*.6,0],children:[c.jsx("coneGeometry",{args:[E,E*1.6,14]}),c.jsx("meshToonMaterial",{color:z})]}),c.jsxs("mesh",{castShadow:!0,position:[0,R+E*1.5,0],children:[c.jsx("coneGeometry",{args:[E*.75,E*1.2,14]}),c.jsx("meshToonMaterial",{color:z})]})]})}const pe=[{itemId:"fish-bass",weight:60},{itemId:"fish-tuna",weight:25},{itemId:"fish-koi",weight:10}];function we(e,t,n){const r=[];for(const a of n)a.startsWith(t)&&r.push(a.slice(t.length));if(r.length===0)return e;const s=new Set(r),o=e.filter(a=>s.has(a.itemId));return o.length>0?o:e}function ve(e){if(e.length===0)return null;const t=e.reduce((r,s)=>r+Math.max(0,s.weight),0);if(t<=0)return null;let n=Math.random()*t;for(const r of e)if(n-=Math.max(0,r.weight),n<=0)return r.itemId;return e[e.length-1].itemId}function be({position:e,radius:t=3,pool:n=pe,cooldownMs:r=600,successChance:s=.6,showRipple:o=!0,rippleColor:a="#9ad9ff"}){const u=f.useRef(-1/0),l=f.useRef(null),g=f.useRef(-1/0),w=f.useCallback(i=>{const d=i.origin[0]-e[0],h=i.origin[2]-e[2];if(d*d+h*h>t*t)return;const S=performance.now();if(S-u.current<r)return!0;u.current=S,g.current=S;const y=C.useWeatherStore.getState().fishingBonus();if(Math.random()>Math.min(.95,s+y))return m.notify("warn","놓쳤다…"),!0;const p=we(n,"fish:",m.useEventsStore.getState().tags),b=ve(p);if(!b)return!0;const R=m.getItemRegistry().get(b);return m.useInventoryStore.getState().add(b,1)>0?m.notify("warn","인벤토리가 가득 찼습니다"):m.notify("reward",`${R?.name??b} 낚음!`),!0},[e,t,r,n,s]);return N("rod",w),W.useFrame(()=>{const i=l.current;if(!i)return;const d=(performance.now()-g.current)/1e3;if(d<.6){const h=d/.6;i.scale.setScalar(.4+h*1.4);const S=i.material;S.opacity=.55*(1-h)}else i.scale.setScalar(0)}),c.jsx("group",{position:e,children:o&&c.jsxs("mesh",{ref:l,rotation:[-Math.PI/2,0,0],position:[0,.04,0],children:[c.jsx("ringGeometry",{args:[.4,.6,32]}),c.jsx("meshBasicMaterial",{color:a,transparent:!0,opacity:0,depthWrite:!1})]})})}const xe=[{itemId:"bug-butterfly",weight:70},{itemId:"bug-beetle",weight:22},{itemId:"bug-stag",weight:8}];function Ie(e,t,n){const r=[];for(const a of n)a.startsWith(t)&&r.push(a.slice(t.length));if(r.length===0)return e;const s=new Set(r),o=e.filter(a=>s.has(a.itemId));return o.length>0?o:e}function Re(e){if(e.length===0)return null;const t=e.reduce((r,s)=>r+Math.max(0,s.weight),0);if(t<=0)return null;let n=Math.random()*t;for(const r of e)if(n-=Math.max(0,r.weight),n<=0)return r.itemId;return e[e.length-1].itemId}function Ee({position:e,radius:t=2.4,pool:n=xe,cooldownMs:r=600,successChance:s=.7,bugColor:o="#ffd0e0",hoverHeight:a=1.2}){const u=f.useRef(-1/0),l=f.useRef(null),[g,w]=f.useState(!0),i=f.useRef(-1/0),d=f.useCallback(h=>{if(!g)return;const S=h.origin[0]-e[0],y=h.origin[2]-e[2];if(S*S+y*y>t*t)return;const p=performance.now();if(p-u.current<r)return!0;u.current=p;const b=C.useWeatherStore.getState().bugBonus();if(Math.random()>Math.min(.95,Math.max(.05,s+b)))return m.notify("warn","날아갔다…"),w(!1),i.current=p+8e3,!0;const R=Ie(n,"bug:",m.useEventsStore.getState().tags),v=Re(R);if(!v)return!0;const E=m.getItemRegistry().get(v);return m.useInventoryStore.getState().add(v,1)>0?m.notify("warn","인벤토리가 가득 찼습니다"):m.notify("reward",`${E?.name??v} 잡았다!`),w(!1),i.current=p+12e3,!0},[e,t,r,n,s,g]);return N("net",d),W.useFrame(({clock:h})=>{const S=performance.now();!g&&S>=i.current&&w(!0);const y=l.current;if(!y||!g)return;const p=h.elapsedTime;y.position.x=Math.sin(p*1.2)*.6,y.position.z=Math.cos(p*.9)*.6,y.position.y=a+Math.sin(p*2.6)*.15,y.rotation.y=p*1.4}),g?c.jsx("group",{position:e,children:c.jsxs("mesh",{ref:l,children:[c.jsx("sphereGeometry",{args:[.12,10,10]}),c.jsx("meshToonMaterial",{color:o})]})}):c.jsx("group",{position:e})}exports.BugSpot=Ee;exports.DEFAULT_RUNTIME_SAVE_DIAGNOSTICS_SERVICE_ID=L;exports.DEFAULT_WORLD_SAVE_ENVIRONMENT=Q;exports.FishSpot=be;exports.RUNTIME_SAVE_DIAGNOSTIC_EVENT=$;exports.TreeObject=ye;exports.createCameraSaveDataFromDomain=X;exports.createGaesupRuntime=fe;exports.createRuntimeSaveDiagnostics=K;exports.createSaveDataFromSaveSystem=ge;exports.createWorldDataFromSaveDomains=Z;exports.formatRuntimeSaveDiagnostic=H;exports.getToolEvents=ne;exports.normalizeSaveMetadata=te;exports.parseWorldSaveId=ee;exports.parseWorldSaveTimestamp=Y;exports.useAutoSave=ae;exports.useEquippedToolKind=Se;exports.useLoadOnMount=ce;exports.useToolUse=N;
@@ -4123,7 +4123,7 @@ function Qi(t = {}) {
4123
4123
  ...h !== void 0 ? { agentDepth: h } : {},
4124
4124
  ...u !== void 0 ? { clearance: u } : {}
4125
4125
  };
4126
- if (y.y = Math.max(L.sampleHeight(y.x, y.z) + e, n), !L.hasNavigationConstraints()) {
4126
+ if (y.y = Math.max(r !== void 0 ? r + e : L.sampleHeight(y.x, y.z) + e, n), !L.hasNavigationConstraints()) {
4127
4127
  oe([y], s, x), le(f, y, w, x);
4128
4128
  return;
4129
4129
  }
@@ -2,10 +2,10 @@ import { jsx as u, jsxs as R, Fragment as B } from "react/jsx-runtime";
2
2
  import { useRef as K, useMemo as b, useCallback as G, useEffect as A, memo as D, useLayoutEffect as N, useState as z } from "react";
3
3
  import * as E from "three";
4
4
  import { useFrame as O } from "@react-three/fiber";
5
- import { G as U, V as F, W as T, X as I, Y as _, U as Y, Z as q, _ as Z } from "./index-DUzx7X82.js";
5
+ import { G as U, V as F, W as T, X as I, Y as _, U as Y, Z as q, _ as Z } from "./index-CfRfBVRR.js";
6
6
  import { u as p } from "./gaesupStore-x2iiDzsY.js";
7
7
  import { vec3 as j } from "@react-three/rapier";
8
- import { u as V } from "./index-Bz9Gk3DQ.js";
8
+ import { u as V } from "./index-DHdmWNTv.js";
9
9
  const W = {
10
10
  KeyW: "forward",
11
11
  KeyA: "leftward",
@@ -182,7 +182,7 @@ function $() {
182
182
  })
183
183
  ] });
184
184
  }
185
- function J({ clickerOptions: e, clickPlaneHeight: d = 0.16 }) {
185
+ function J({ clickerOptions: e, clickPlaneHeight: d = 0.75 }) {
186
186
  const { onClick: r } = Y({ groundTargetY: 0, ...e ?? {} }), o = (a) => {
187
187
  a.stopPropagation();
188
188
  const { cameraOption: n, setCameraOption: s } = p.getState();