gaesup-world 1.0.21 → 1.0.23

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,320 +0,0 @@
1
- import { jsx as m, jsxs as k, Fragment as B } from "react/jsx-runtime";
2
- import { useRef as P, useState as C, useEffect as K, useMemo as x, useCallback as I, memo as z } from "react";
3
- import * as M from "three";
4
- import { Line as L } from "@react-three/drei";
5
- import { V as U, G as T, W as N, X as F, Y as A, Z as V, U as q, _ as W } from "./index-C5agFfBe.js";
6
- import { useFrame as Z } from "@react-three/fiber";
7
- import { B as j, u as S } from "./gaesupStore-DTu0tYBp.js";
8
- import { vec3 as Y } from "@react-three/rapier";
9
- import { u as _ } from "./index-D0Rz5_-J.js";
10
- const H = () => ({
11
- position: new M.Vector3(0, 0, 0),
12
- velocity: new M.Vector3(0, 0, 0),
13
- rotation: new M.Euler(0, 0, 0),
14
- isMoving: !1,
15
- isGrounded: !1,
16
- speed: 0,
17
- height: 2
18
- // Default character height
19
- });
20
- function X(e = {}) {
21
- const { updateInterval: g = 0, entityId: u } = e, c = P(null);
22
- c.current || (c.current = H());
23
- const [, l] = C(0), n = P(0), v = P(0), h = P({ x: 0, y: 0, z: 0 }), y = P(void 0), w = P(null), { activeState: p, gameStates: R } = U(), s = (d) => {
24
- if (u) return u;
25
- if (y.current) return y.current;
26
- const r = d.getActiveEntities();
27
- return y.current = r[0], y.current;
28
- };
29
- return K(() => {
30
- y.current = void 0, w.current = j.getOrCreate("motion");
31
- const d = w.current;
32
- if (!d) return;
33
- const r = d.subscribe((i, f) => {
34
- const a = s(d);
35
- if (!a || f !== a) return;
36
- const t = performance.now();
37
- if (v.current = t, g > 0 && t - n.current < g) return;
38
- n.current = t;
39
- const o = c.current;
40
- o.position.copy(i.position), o.velocity.copy(i.velocity), o.rotation.copy(i.rotation), o.isMoving = i.isMoving, o.isGrounded = i.isGrounded, o.speed = i.speed, o.height = 2, l((b) => b + 1);
41
- });
42
- return () => {
43
- r();
44
- };
45
- }, [u, g]), Z(() => {
46
- const d = performance.now();
47
- if (g > 0 && d - n.current < g) return;
48
- const r = c.current, i = w.current, f = (a) => {
49
- const t = h.current, o = a.x - t.x, b = a.y - t.y, E = a.z - t.z;
50
- return o * o + b * b + E * E > 1e-6 ? (t.x = a.x, t.y = a.y, t.z = a.z, !0) : !1;
51
- };
52
- if (i) {
53
- const a = s(i);
54
- if (!(d - v.current < 16) && a) {
55
- const o = i.snapshot(a);
56
- if (o) {
57
- r.position.copy(o.position), r.velocity.copy(o.velocity), r.rotation.copy(o.rotation), r.isMoving = o.isMoving, r.isGrounded = o.isGrounded, r.speed = o.speed, r.height = 2, n.current = d, f(r.position) && l((b) => b + 1);
58
- return;
59
- }
60
- }
61
- }
62
- p?.position && (r.position.copy(p.position), p.velocity ? r.velocity.copy(p.velocity) : r.velocity.set(0, 0, 0), p.euler ? r.rotation.copy(p.euler) : r.rotation.set(0, 0, 0), r.isMoving = R?.isMoving || !1, r.isGrounded = R?.isOnTheGround || !1, r.speed = p.velocity ? p.velocity.length() : 0, r.height = 2, n.current = d, f(r.position) && l((a) => a + 1));
63
- }), c.current;
64
- }
65
- const $ = {
66
- KeyW: "forward",
67
- KeyA: "leftward",
68
- KeyS: "backward",
69
- KeyD: "rightward",
70
- ShiftLeft: "shift",
71
- Space: "space",
72
- KeyZ: "keyZ",
73
- KeyR: "keyR",
74
- KeyF: "keyF",
75
- KeyE: "keyE",
76
- Escape: "escape"
77
- }, J = (e = !0, g = !0, u) => {
78
- const c = S((s) => s.automation?.queue.isRunning), l = S((s) => s.stopAutomation), n = S((s) => s.interaction?.isActive ?? !0), v = T((s) => s.isInEditMode()), h = N(), y = P(/* @__PURE__ */ new Set()), w = x(() => ({ ...$ }), []), p = I(
79
- (s, d) => {
80
- if (!n) return !1;
81
- try {
82
- return h.updateKeyboard({ [s]: d }), d ? y.current.add(s) : y.current.delete(s), !0;
83
- } catch (r) {
84
- return console.error("Error updating keyboard state:", r), !1;
85
- }
86
- },
87
- [h, n]
88
- ), R = I(() => {
89
- y.current.clear(), h.updateKeyboard({
90
- forward: !1,
91
- backward: !1,
92
- leftward: !1,
93
- rightward: !1,
94
- shift: !1,
95
- space: !1,
96
- keyZ: !1,
97
- keyR: !1,
98
- keyF: !1,
99
- keyE: !1,
100
- escape: !1
101
- });
102
- }, [h]);
103
- return K(() => {
104
- (!n || v) && R();
105
- }, [R, n, v]), K(() => {
106
- const s = (f, a) => {
107
- const t = w[f.code];
108
- if (!t) return;
109
- if (!n || v) {
110
- a && f.preventDefault(), R();
111
- return;
112
- }
113
- const o = y.current.has(f.code);
114
- a && !o ? (y.current.add(f.code), f.code === "Space" && f.preventDefault(), g && c && (t === "forward" || t === "backward" || t === "leftward" || t === "rightward") && (l(), h.updateMouse({ isActive: !1, shouldRun: !1 })), h.updateKeyboard({ [t]: !0 })) : !a && o && (y.current.delete(f.code), h.updateKeyboard({ [t]: !1 }));
115
- }, d = (f) => s(f, !0), r = (f) => s(f, !1), i = () => document.hidden && R();
116
- return window.addEventListener("keydown", d), window.addEventListener("keyup", r), document.addEventListener("visibilitychange", i), () => {
117
- window.removeEventListener("keydown", d), window.removeEventListener("keyup", r), document.removeEventListener("visibilitychange", i);
118
- };
119
- }, [
120
- w,
121
- g,
122
- l,
123
- c,
124
- R,
125
- n,
126
- v,
127
- h
128
- ]), {
129
- pressedKeys: Array.from(y.current),
130
- pushKey: p,
131
- isKeyPressed: (s) => y.current.has(s),
132
- clearAllKeys: R
133
- };
134
- }, D = z(({ points: e, color: g }) => e.length < 2 ? null : /* @__PURE__ */ m(
135
- L,
136
- {
137
- points: e,
138
- color: g,
139
- lineWidth: 2,
140
- dashed: !1
141
- }
142
- ));
143
- D.displayName = "PathLine";
144
- const O = z(() => /* @__PURE__ */ k("group", { children: [
145
- /* @__PURE__ */ k("mesh", { children: [
146
- /* @__PURE__ */ m("sphereGeometry", { args: [0.2, 16, 16] }),
147
- /* @__PURE__ */ m(
148
- "meshStandardMaterial",
149
- {
150
- color: "#00ff88",
151
- emissive: "#00ff88",
152
- emissiveIntensity: 0.5,
153
- transparent: !0,
154
- opacity: 0.9
155
- }
156
- )
157
- ] }),
158
- /* @__PURE__ */ k("mesh", { rotation: [Math.PI / 2, 0, 0], children: [
159
- /* @__PURE__ */ m("ringGeometry", { args: [0.3, 0.5, 8] }),
160
- /* @__PURE__ */ m(
161
- "meshStandardMaterial",
162
- {
163
- color: "#00ff88",
164
- transparent: !0,
165
- opacity: 0.6,
166
- side: M.DoubleSide
167
- }
168
- )
169
- ] })
170
- ] }));
171
- O.displayName = "TargetMarker";
172
- function Q({ lineStartHeight: e } = {}) {
173
- const g = S((t) => t.automation), { position: u } = X(), { mouse: c } = F(), [l, n] = C(() => [...A()]);
174
- K(() => V(() => {
175
- n([...A()]);
176
- }), []);
177
- const v = c?.target || new M.Vector3(), h = c?.isActive || !1, y = g?.queue || { actions: [], currentIndex: 0 }, w = y.actions || [], p = y.currentIndex || 0, s = u.distanceTo(v) < 1, d = h && !s, r = w.map((t) => t.type === "move" && t.target ? new M.Vector3(t.target.x, t.target.y, t.target.z) : null).filter((t) => t !== null), i = u.clone();
178
- e !== void 0 && (i.y += e);
179
- const f = l.length > 0 ? l : [v], a = d ? [i, ...f, ...r] : r.length > 0 ? [i, ...r] : [];
180
- return /* @__PURE__ */ k("group", { children: [
181
- d && /* @__PURE__ */ m("group", { position: v, children: /* @__PURE__ */ m(O, {}) }),
182
- a.length > 1 && /* @__PURE__ */ m(
183
- D,
184
- {
185
- points: a,
186
- color: p >= 0 ? "#00ff88" : "#ffaa00"
187
- }
188
- ),
189
- w.map((t, o) => {
190
- if (t.type === "move" && t.target) {
191
- const b = o === p, E = o < p;
192
- return /* @__PURE__ */ m(
193
- "group",
194
- {
195
- position: [t.target.x, t.target.y, t.target.z],
196
- children: /* @__PURE__ */ k("mesh", { children: [
197
- /* @__PURE__ */ m("sphereGeometry", { args: [0.1, 8, 8] }),
198
- /* @__PURE__ */ m(
199
- "meshStandardMaterial",
200
- {
201
- color: E ? "#888" : b ? "#ff4444" : "#ffaa00",
202
- transparent: !0,
203
- opacity: E ? 0.3 : 0.8
204
- }
205
- )
206
- ] })
207
- },
208
- `action-${o}`
209
- );
210
- }
211
- return null;
212
- })
213
- ] });
214
- }
215
- function ee({ clickerOptions: e }) {
216
- const { onClick: g } = q(e), u = (c) => {
217
- c.stopPropagation();
218
- const { cameraOption: l, setCameraOption: n } = S.getState();
219
- if (l?.focus) {
220
- n({ focus: !1 });
221
- return;
222
- }
223
- g(c);
224
- };
225
- return /* @__PURE__ */ k(
226
- "mesh",
227
- {
228
- position: [0, 0, 0],
229
- rotation: [-Math.PI / 2, 0, 0],
230
- onPointerDown: u,
231
- visible: !0,
232
- userData: { intangible: !0 },
233
- children: [
234
- /* @__PURE__ */ m("planeGeometry", { args: [1e3, 1e3] }),
235
- /* @__PURE__ */ m("meshBasicMaterial", { transparent: !0, opacity: 0 })
236
- ]
237
- }
238
- );
239
- }
240
- function te({ props: e, children: g }) {
241
- const u = S((i) => i.mode), { gameStates: c } = U(), l = S((i) => i.rideable), n = S((i) => i.urls), v = T((i) => i.isInEditMode()), h = _();
242
- if (J(), v || !u || !c || !l || !n || u.type === "character" && !n.characterUrl || u.type === "vehicle" && !n.vehicleUrl || u.type === "airplane" && !n.airplaneUrl) return null;
243
- const { canRide: y, isRiding: w, currentRideable: p } = c, R = p?.id, s = x(
244
- () => (R ? l[R]?.offset : void 0) ?? Y(),
245
- [R, l]
246
- ), r = (() => {
247
- const i = e.rigidBodyRef ?? h.rigidBodyRef, f = e.outerGroupRef ?? h.outerGroupRef, a = e.innerGroupRef ?? h.innerGroupRef, t = e.colliderRef ?? h.colliderRef, o = {
248
- isActive: !0,
249
- componentType: u.type,
250
- enableRiding: y,
251
- isRiderOn: w,
252
- offset: s,
253
- ref: i,
254
- outerGroupRef: f,
255
- innerGroupRef: a,
256
- colliderRef: t,
257
- parts: (e.parts || []).filter((G) => !!G.url).map((G) => ({ ...G, url: G.url })),
258
- ...e.onAnimate ? { onAnimate: e.onAnimate } : {},
259
- ...e.onFrame ? { onFrame: e.onFrame } : {},
260
- ...e.onReady ? { onReady: e.onReady } : {},
261
- ...e.onDestroy ? { onDestroy: e.onDestroy } : {},
262
- ...e.onDestory ? { onDestory: e.onDestory } : {},
263
- ...typeof e.baseColor == "string" && e.baseColor.trim().length > 0 ? { baseColor: e.baseColor } : {},
264
- ...Array.isArray(e.excludeBaseNodes) && e.excludeBaseNodes.length > 0 ? { excludeBaseNodes: e.excludeBaseNodes } : {},
265
- ...e.rigidBodyProps ? { rigidBodyProps: e.rigidBodyProps } : {},
266
- ...e.controllerOptions ? { controllerOptions: e.controllerOptions } : {},
267
- ...e.groundRay ? { groundRay: e.groundRay } : {},
268
- ...e.colliderSize ? { colliderSize: e.colliderSize } : {},
269
- ...e.position ? { position: e.position } : {},
270
- ...e.rotation ? { rotation: e.rotation } : {},
271
- ...e.scale ? { scale: e.scale } : {}
272
- }, b = w && u.type !== "character" ? n.ridingUrl : void 0, E = typeof b == "string" && b.length > 0 ? { ridingUrl: b } : {};
273
- switch (u.type) {
274
- case "character":
275
- return {
276
- ...o,
277
- url: n.characterUrl || ""
278
- };
279
- case "vehicle":
280
- return {
281
- ...o,
282
- ...E,
283
- url: n.vehicleUrl || "",
284
- wheelUrl: n.wheelUrl
285
- };
286
- case "airplane":
287
- return {
288
- ...o,
289
- ...E,
290
- url: n.airplaneUrl || ""
291
- };
292
- default:
293
- return {
294
- ...o,
295
- url: n.characterUrl || ""
296
- };
297
- }
298
- })();
299
- return u.type === "character" && c.isRiding ? null : /* @__PURE__ */ m(W, { ...r, children: g });
300
- }
301
- function ue(e) {
302
- const { clickToMove: g, children: u, clickerOptions: c, ...l } = e, n = l.colliderSize?.height ? l.colliderSize.height * 0.5 : void 0, v = {
303
- ...c ?? {},
304
- ...c?.agentRadius === void 0 && l.colliderSize?.radius !== void 0 ? { agentRadius: l.colliderSize.radius } : {}
305
- };
306
- return /* @__PURE__ */ m(te, { props: l, children: /* @__PURE__ */ k(B, { children: [
307
- g && /* @__PURE__ */ k(B, { children: [
308
- /* @__PURE__ */ m(ee, { clickerOptions: v }),
309
- /* @__PURE__ */ m(Q, { ...n !== void 0 ? { lineStartHeight: n } : {} })
310
- ] }),
311
- u
312
- ] }) });
313
- }
314
- export {
315
- ue as C,
316
- ee as G,
317
- Q as a,
318
- X as b,
319
- J as u
320
- };
@@ -1 +0,0 @@
1
- "use strict";const S=require("react/jsx-runtime"),b=require("react"),O=require("three"),I=require("./index-CJj-Z7Jr.cjs"),C=require("./gaesupStore-2zKBYTYo.cjs");function z(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const v=z(O),_="gaesup-save",j=1,M="slots";function L(){return new Promise((n,e)=>{if(typeof indexedDB>"u"){e(new Error("IndexedDB unavailable"));return}const t=indexedDB.open(_,j);t.onupgradeneeded=()=>{const r=t.result;r.objectStoreNames.contains(M)||r.createObjectStore(M)},t.onsuccess=()=>n(t.result),t.onerror=()=>e(t.error)})}function w(n,e){return L().then(t=>new Promise((r,a)=>{const o=t.transaction(M,n).objectStore(M),c=e(o);if(c instanceof Promise){c.then(r,a);return}c.onsuccess=()=>r(c.result),c.onerror=()=>a(c.error)}))}class R{async read(e){try{return await w("readonly",r=>r.get(e))??null}catch{return null}}async write(e,t){await w("readwrite",r=>r.put(t,e))}async list(){try{return(await w("readonly",t=>t.getAllKeys())).map(String)}catch{return[]}}async remove(e){try{await w("readwrite",t=>t.delete(e))}catch{}}}const y="gaesup:save:";function k(n,e){try{return n()}catch{return e}}class T{async read(e){return typeof localStorage>"u"?null:k(()=>{const t=localStorage.getItem(y+e);return t?JSON.parse(t):null},null)}async write(e,t){typeof localStorage>"u"||k(()=>localStorage.setItem(y+e,JSON.stringify(t)),void 0)}async list(){return typeof localStorage>"u"?[]:k(()=>{const e=[];for(let t=0;t<localStorage.length;t++){const r=localStorage.key(t);r&&r.startsWith(y)&&e.push(r.slice(y.length))}return e},[])}async remove(e){typeof localStorage>"u"||k(()=>localStorage.removeItem(y+e),void 0)}}class B{adapter;bindings=new Map;currentVersion;migrations;defaultSlot;diagnosticListeners=new Set;constructor(e){this.adapter=e.adapter,this.currentVersion=e.currentVersion??1,this.migrations=e.migrations??{},this.defaultSlot=e.defaultSlot??"main",e.onDiagnostic&&this.diagnosticListeners.add(e.onDiagnostic)}register(e){if(this.bindings.has(e.key))throw new E(e.key);const t={key:e.key,serialize:()=>e.serialize(),hydrate:r=>e.hydrate(r)};return this.bindings.set(e.key,t),()=>{this.bindings.get(e.key)===t&&this.bindings.delete(e.key)}}has(e){return this.bindings.has(e)}subscribeDiagnostics(e){return this.diagnosticListeners.add(e),()=>{this.diagnosticListeners.delete(e)}}getBindings(){return this.bindings.values()}createBlob(e=this.defaultSlot){const t={};for(const[r,a]of this.bindings)try{t[r]=a.serialize()}catch(i){t[r]=null,this.reportDiagnostic({phase:"serialize",key:r,slot:e,error:i})}return{version:this.currentVersion,savedAt:Date.now(),domains:t}}hydrateBlob(e,t=this.defaultSlot){let r=e;for(;r.version<this.currentVersion;){const a=this.migrations[r.version];if(!a)break;r=a(r)}for(const[a,i]of this.bindings)try{i.hydrate(r.domains?.[a])}catch(o){this.reportDiagnostic({phase:"hydrate",key:a,slot:t,error:o})}return!0}async save(e=this.defaultSlot){const t=this.createBlob(e);await this.adapter.write(e,t)}async load(e=this.defaultSlot){const t=await this.adapter.read(e);return t?this.hydrateBlob(t,e):!1}async list(){return this.adapter.list()}async remove(e=this.defaultSlot){return this.adapter.remove(e)}reportDiagnostic(e){for(const t of this.diagnosticListeners)t(e)}}class E extends Error{constructor(e){super(`Save domain "${e}" is already registered.`),this.name="DuplicateSaveDomainBindingError"}}let D=null;function A(){const n=typeof indexedDB<"u"?new R:new T;return new B({adapter:n,defaultSlot:"main",currentVersion:1})}function V(){return D||(D=A()),D}var W=Object.defineProperty,N=Object.getOwnPropertyDescriptor,q=(n,e,t)=>e in n?W(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,X=(n,e,t,r)=>{for(var a=r>1?void 0:r?N(e,t):e,i=n.length-1,o;i>=0;i--)(o=n[i])&&(a=o(a)||a);return a},F=(n,e,t)=>q(n,e+"",t);exports.MinimapSystem=class extends C.AbstractSystem{listeners;constructor(){const e={markers:new Map,canvas:null,ctx:null,isDirty:!0,lastPosition:null,lastRotation:null,gradientCache:{background:null,avatar:null},lastUpdate:Date.now()},t={markerCount:0,renderTime:0,frameTime:0};super(e,t),this.listeners=new Set}static getInstance(){return(!exports.MinimapSystem.instance||exports.MinimapSystem.instance.isDisposed)&&(exports.MinimapSystem.instance=new exports.MinimapSystem),exports.MinimapSystem.instance}addMarker(e,t,r,a,i){const o={id:e,type:t,text:r,center:a,size:i};this.state.markers.set(e,o),this.updateMetrics(0),this.notifyListeners()}removeMarker(e){this.state.markers.delete(e),this.updateMetrics(0),this.notifyListeners()}updateMarker(e,t){const r=this.state.markers.get(e);r&&(this.state.markers.set(e,{...r,...t}),this.updateMetrics(0),this.notifyListeners())}getMarkers(){return new Map(this.state.markers)}getMarker(e){return this.state.markers.get(e)}clear(){this.state.markers.clear(),this.updateMetrics(0),this.notifyListeners()}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){const e=this.getMarkers();this.listeners.forEach(t=>t(e))}setCanvas(e){this.state.canvas=e,this.state.ctx=e?e.getContext("2d"):null,this.state.isDirty=!0,this.state.gradientCache={background:null,avatar:null}}checkForUpdates(e,t,r=.1,a=.01){const i=this.state.lastPosition,o=this.state.lastRotation;if(!i||o===null){this.state.isDirty=!0,this.state.lastPosition={x:e.x,z:e.z},this.state.lastRotation=t;return}const c=Math.abs(e.x-i.x)>r||Math.abs(e.z-i.z)>r,l=Math.abs(t-o)>a;(c||l)&&(this.state.isDirty=!0,this.state.lastPosition={x:e.x,z:e.z},this.state.lastRotation=t)}render(e){if(!this.state.canvas||!this.state.ctx||!this.state.isDirty)return;const t=performance.now(),{size:r,scale:a,position:i,rotation:o,blockRotate:c,tileGroups:l,sceneObjects:h}=e,s=this.state.ctx;if(s.clearRect(0,0,r,r),s.save(),s.beginPath(),s.arc(r/2,r/2,r/2,0,Math.PI*2),s.clip(),!this.state.gradientCache.background){const d=s.createRadialGradient(r/2,r/2,0,r/2,r/2,r/2);d.addColorStop(0,"rgba(20, 30, 40, 0.9)"),d.addColorStop(1,"rgba(10, 20, 30, 0.95)"),this.state.gradientCache.background=d}s.fillStyle=this.state.gradientCache.background,s.fillRect(0,0,r,r);const u=o*180/Math.PI;s.translate(r/2,r/2),s.rotate(-u*Math.PI/180),s.translate(-r/2,-r/2),s.save(),s.strokeStyle="rgba(255, 255, 255, 0.1)",s.lineWidth=1;for(let d=0;d<r;d+=20)s.beginPath(),s.moveTo(d,0),s.lineTo(d,r),s.moveTo(0,d),s.lineTo(r,d),s.stroke();s.restore(),this.renderCompass(s,r,u),l&&l.size>0&&this.renderTiles(s,r,a,i,l),h&&h.size>0&&this.renderSceneObjects(s,r,a,i,h),this.renderMarkers(s,r,a,i,u,c),this.renderAvatar(s,r),s.restore(),this.state.isDirty=!1,this.metrics.renderTime=performance.now()-t}renderCompass(e,t,r){e.save(),e.fillStyle="white",e.font="bold 16px sans-serif",e.shadowColor="rgba(0, 0, 0, 0.8)",e.shadowBlur=3,[{text:"N",x:t/2,y:25,color:"#ff6b6b"},{text:"S",x:t/2,y:t-25,color:"#4ecdc4"},{text:"E",x:t-25,y:t/2,color:"#45b7d1"},{text:"W",x:25,y:t/2,color:"#f9ca24"}].forEach(({text:i,x:o,y:c,color:l})=>{e.save(),e.fillStyle=l,e.translate(o,c),e.rotate(r*Math.PI/180),e.textAlign="center",e.textBaseline="middle",e.fillText(i,0,0),e.restore()}),e.restore()}renderTiles(e,t,r,a,i){Array.from(i.values()).forEach(c=>{c&&c.tiles&&Array.isArray(c.tiles)&&c.tiles.forEach(l=>{if(!l||!l.position)return;const h=(l.position.x-a.x)*r,s=(l.position.z-a.z)*r,u=(l.size||1)*4*r;e.save();const d=t/2-h-u/2,f=t/2-s-u/2;l.objectType==="water"?e.fillStyle="rgba(0, 150, 255, 0.6)":l.objectType==="grass"?e.fillStyle="rgba(50, 200, 50, 0.4)":l.objectType==="sand"?e.fillStyle="rgba(210, 180, 120, 0.45)":l.objectType==="snowfield"?e.fillStyle="rgba(225, 240, 255, 0.5)":e.fillStyle="rgba(150, 150, 150, 0.3)",e.fillRect(d,f,u,u),e.strokeStyle="rgba(255, 255, 255, 0.2)",e.lineWidth=.5,e.strokeRect(d,f,u,u),e.restore()})})}renderSceneObjects(e,t,r,a,i){i.forEach(o=>{if(!o?.position||!o?.size)return;const c=(o.position.x-a.x)*r,l=(o.position.z-a.z)*r,h=o.size.x*r,s=o.size.z*r;e.save();const u=t/2-c-h/2,d=t/2-l-s/2;e.fillStyle="rgba(100, 150, 200, 0.4)",e.fillRect(u,d,h,s),e.strokeStyle="rgba(255, 255, 255, 0.4)",e.lineWidth=1,e.strokeRect(u,d,h,s),e.restore()})}renderMarkers(e,t,r,a,i,o){this.state.markers.size!==0&&this.state.markers.forEach(c=>{if(!c?.center||!c?.size)return;const{center:l,size:h,text:s}=c,u=(l.x-a.x)*r,d=(l.z-a.z)*r;e.save();const f=h.x*r,g=h.z*r,m=t/2-u-f/2,p=t/2-d-g/2;e.shadowColor="rgba(0, 0, 0, 0.6)",e.shadowBlur=4,e.shadowOffsetX=2,e.shadowOffsetY=2,e.fillStyle="rgba(0,0,0,0.3)",e.fillRect(m,p,f,g),e.shadowColor="transparent",e.strokeStyle="rgba(255, 255, 255, 0.3)",e.lineWidth=1,e.strokeRect(m,p,f,g),s&&(e.save(),e.fillStyle="white",e.font="bold 12px sans-serif",e.shadowColor="rgba(0, 0, 0, 0.8)",e.shadowBlur=2,e.translate(m+f/2,p+g/2),o||e.rotate(-i*Math.PI/180),e.textAlign="center",e.textBaseline="middle",e.fillText(s,0,0),e.restore()),e.restore()})}renderAvatar(e,t){if(e.save(),!this.state.gradientCache.avatar){const r=e.createRadialGradient(t/2,t/2,0,t/2,t/2,12);r.addColorStop(0,"#01fff7"),r.addColorStop(.7,"#01fff7"),r.addColorStop(1,"transparent"),this.state.gradientCache.avatar=r}e.fillStyle=this.state.gradientCache.avatar,e.beginPath(),e.arc(t/2,t/2,12,0,Math.PI*2),e.fill(),e.fillStyle="#01fff7",e.shadowColor="0 0 10px rgba(1,255,247,0.7)",e.shadowBlur=8,e.beginPath(),e.arc(t/2,t/2,6,0,Math.PI*2),e.fill(),e.shadowColor="transparent",e.strokeStyle="rgba(255, 255, 255, 0.8)",e.lineWidth=2,e.beginPath(),e.moveTo(t/2,t/2),e.lineTo(t/2,t/2-12),e.stroke(),e.restore()}performUpdate(e){}createUpdateArgs(e){return e}updateMetrics(e){this.metrics.markerCount=this.state.markers.size,this.metrics.frameTime=e}onDispose(){this.clear(),this.listeners.clear(),this.state.canvas=null,this.state.ctx=null,exports.MinimapSystem.instance=null}};F(exports.MinimapSystem,"instance",null);exports.MinimapSystem=X([C.RegisterSystem("minimap"),C.ManageRuntime({autoStart:!1})],exports.MinimapSystem);function U({type:n="normal",text:e,position:t,children:r,interactive:a=!0,showMinimap:i=!0}){const o=b.useRef(null),c=I.useClicker(),l=b.useMemo(()=>`world-prop-${Date.now()}-${Math.random()}`,[]),h=b.useRef({center:new v.Vector3,size:new v.Vector3,positionAdd:new v.Vector3});return b.useEffect(()=>{if(!i||!o.current)return;const s=exports.MinimapSystem.getInstance(),d=setTimeout(()=>{const f=o.current;if(!f)return;const g=new v.Box3;if(g.setFromObject(f),!g.isEmpty()){const{center:m,size:p,positionAdd:P}=h.current;g.getCenter(m),g.getSize(p),t&&(P.set(t[0],t[1],t[2]),m.add(P)),s.addMarker(l,n,e||"",m.clone(),p.clone())}},100);return()=>{clearTimeout(d),s.removeMarker(l)}},[t,n,e,i,l]),S.jsxs("group",{ref:o,...t?{position:t}:{},onClick:s=>{a&&(s.stopPropagation(),c.onClick(s))},children:[r,e&&S.jsx("group",{position:[0,2,0],children:S.jsx("sprite",{scale:[2,.5,1],children:S.jsx("spriteMaterial",{color:"#ffffff",transparent:!0,opacity:.8})})})]})}exports.DuplicateSaveDomainBindingError=E;exports.IndexedDBAdapter=R;exports.LocalStorageAdapter=T;exports.SaveSystem=B;exports.WorldProps=U;exports.createDefaultSaveSystem=A;exports.getSaveSystem=V;