@vsleem-realsee-viewer/shared 2.0.30 → 2.0.31

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.
package/dist/index.d.ts CHANGED
@@ -93,6 +93,13 @@ declare abstract class BaseElement {
93
93
  */
94
94
  declare function bindCoordinate(data: CoordinateModel[], options?: RequestOptions): Promise<CoordinateModel[]>;
95
95
 
96
+ declare function buildShortUUID(prefix?: string): string;
97
+
98
+ /**
99
+ * 改进版UUID生成器(符合RFC 4122 v4标准)
100
+ */
101
+ declare function buildUUID(): string;
102
+
96
103
  export declare class CanvasElement {
97
104
  canvas: HTMLCanvasElement;
98
105
  ctx: CanvasRenderingContext2D;
@@ -1088,7 +1095,9 @@ declare namespace utils {
1088
1095
  getMapProvider,
1089
1096
  getImageTransform,
1090
1097
  toCanvasCoord,
1091
- toModelCoord
1098
+ toModelCoord,
1099
+ buildUUID,
1100
+ buildShortUUID
1092
1101
  }
1093
1102
  }
1094
1103
  export { utils }
package/dist/index.mjs CHANGED
@@ -1,16 +1,16 @@
1
- var P = /* @__PURE__ */ ((s) => (s[s.CADModel = 5] = "CADModel", s[s.BIMModel = 6] = "BIMModel", s[s.ForgeModel = 7] = "ForgeModel", s[s.ThreeDModel = 8] = "ThreeDModel", s[s.GeoModel = 9] = "GeoModel", s[s.ScaleModel = 101] = "ScaleModel", s))(P || {}), rt = /* @__PURE__ */ ((s) => (s[s.Global = 0] = "Global", s))(rt || {}), v = /* @__PURE__ */ ((s) => (s[s.Space = 0] = "Space", s[s.Model = 1] = "Model", s[s.Data = 2] = "Data", s))(v || {}), G = /* @__PURE__ */ ((s) => (s[s.Used = 0] = "Used", s[s.Enabled = 1] = "Enabled", s[s.Disabled = 2] = "Disabled", s))(G || {}), F = /* @__PURE__ */ ((s) => (s[s.SUCCESS = 200] = "SUCCESS", s[s.ERROR = -1] = "ERROR", s[s.TIMEOUT = 401] = "TIMEOUT", s))(F || {}), M = /* @__PURE__ */ ((s) => (s.GET = "GET", s.POST = "POST", s))(M || {}), L = /* @__PURE__ */ ((s) => (s.JSON = "application/json", s.FORM_URLENCODED = "application/x-www-form-urlencoded;charset=UTF-8", s.FORM_DATA = "multipart/form-data;charset=UTF-8", s.OCTET_STREAM = "'application/octet-stream", s))(L || {}), at = /* @__PURE__ */ ((s) => (s.Hw = "huawei", s.Ali = "aliyun", s.Hs = "hs", s.Aws = "amazon", s.Minio = "minio", s))(at || {}), Y = /* @__PURE__ */ ((s) => (s.en_US = "en-US", s.zh_CN = "zh-CN", s.ja_JP = "ja-JP", s))(Y || {}), g = /* @__PURE__ */ ((s) => (s.WGS84 = "WGS84", s.WGS1984 = "WGS84", s.EPSG4326 = "WGS84", s.GCJ02 = "GCJ02", s.AMap = "GCJ02", s.BD09 = "BD09", s.BD09LL = "BD09", s.Baidu = "BD09", s.BMap = "BD09", s.BD09MC = "BD09MC", s.BD09Meter = "BD09MC", s.EPSG3857 = "EPSG3857", s.EPSG900913 = "EPSG3857", s.EPSG102100 = "EPSG3857", s.WebMercator = "EPSG3857", s.WM = "EPSG3857", s))(g || {}), p = /* @__PURE__ */ ((s) => (s[s.GeoPointNoPlane = 9e3] = "GeoPointNoPlane", s[s.PointUnmappedGIS = 9010] = "PointUnmappedGIS", s[s.PointNoXYZ = 9011] = "PointNoXYZ", s[s.PointNoPlane = 9012] = "PointNoPlane", s[s.RelativePlaneUnmatch = 9020] = "RelativePlaneUnmatch", s[s.RelativeNoPlane = 9021] = "RelativeNoPlane", s[s.RelativeJsonError = 9022] = "RelativeJsonError", s[s.RequestCodeError = 9030] = "RequestCodeError", s[s.RequestResultError = 9031] = "RequestResultError", s[s.RequestUnknownError = 9032] = "RequestUnknownError", s))(p || {});
2
- const ht = {
1
+ var P = /* @__PURE__ */ ((s) => (s[s.CADModel = 5] = "CADModel", s[s.BIMModel = 6] = "BIMModel", s[s.ForgeModel = 7] = "ForgeModel", s[s.ThreeDModel = 8] = "ThreeDModel", s[s.GeoModel = 9] = "GeoModel", s[s.ScaleModel = 101] = "ScaleModel", s))(P || {}), ct = /* @__PURE__ */ ((s) => (s[s.Global = 0] = "Global", s))(ct || {}), v = /* @__PURE__ */ ((s) => (s[s.Space = 0] = "Space", s[s.Model = 1] = "Model", s[s.Data = 2] = "Data", s))(v || {}), A = /* @__PURE__ */ ((s) => (s[s.Used = 0] = "Used", s[s.Enabled = 1] = "Enabled", s[s.Disabled = 2] = "Disabled", s))(A || {}), $ = /* @__PURE__ */ ((s) => (s[s.SUCCESS = 200] = "SUCCESS", s[s.ERROR = -1] = "ERROR", s[s.TIMEOUT = 401] = "TIMEOUT", s))($ || {}), M = /* @__PURE__ */ ((s) => (s.GET = "GET", s.POST = "POST", s))(M || {}), L = /* @__PURE__ */ ((s) => (s.JSON = "application/json", s.FORM_URLENCODED = "application/x-www-form-urlencoded;charset=UTF-8", s.FORM_DATA = "multipart/form-data;charset=UTF-8", s.OCTET_STREAM = "'application/octet-stream", s))(L || {}), ht = /* @__PURE__ */ ((s) => (s.Hw = "huawei", s.Ali = "aliyun", s.Hs = "hs", s.Aws = "amazon", s.Minio = "minio", s))(ht || {}), _ = /* @__PURE__ */ ((s) => (s.en_US = "en-US", s.zh_CN = "zh-CN", s.ja_JP = "ja-JP", s))(_ || {}), g = /* @__PURE__ */ ((s) => (s.WGS84 = "WGS84", s.WGS1984 = "WGS84", s.EPSG4326 = "WGS84", s.GCJ02 = "GCJ02", s.AMap = "GCJ02", s.BD09 = "BD09", s.BD09LL = "BD09", s.Baidu = "BD09", s.BMap = "BD09", s.BD09MC = "BD09MC", s.BD09Meter = "BD09MC", s.EPSG3857 = "EPSG3857", s.EPSG900913 = "EPSG3857", s.EPSG102100 = "EPSG3857", s.WebMercator = "EPSG3857", s.WM = "EPSG3857", s))(g || {}), p = /* @__PURE__ */ ((s) => (s[s.GeoPointNoPlane = 9e3] = "GeoPointNoPlane", s[s.PointUnmappedGIS = 9010] = "PointUnmappedGIS", s[s.PointNoXYZ = 9011] = "PointNoXYZ", s[s.PointNoPlane = 9012] = "PointNoPlane", s[s.RelativePlaneUnmatch = 9020] = "RelativePlaneUnmatch", s[s.RelativeNoPlane = 9021] = "RelativeNoPlane", s[s.RelativeJsonError = 9022] = "RelativeJsonError", s[s.RequestCodeError = 9030] = "RequestCodeError", s[s.RequestResultError = 9031] = "RequestResultError", s[s.RequestUnknownError = 9032] = "RequestUnknownError", s))(p || {});
2
+ const lt = {
3
3
  baseUrl: "https://vsleem.com/api",
4
4
  authorizeCode: ""
5
- }, ct = {
5
+ }, ut = {
6
6
  isTransformResponse: !0,
7
7
  joinBaseUrl: !0,
8
8
  withAuthorize: !0
9
- }, lt = {
9
+ }, dt = {
10
10
  url: "",
11
11
  method: M.GET,
12
12
  headers: {}
13
- }, ut = [
13
+ }, ft = [
14
14
  {
15
15
  name: "GAODE",
16
16
  patterns: ["amap", "amap.com", "autonavi.com", "restapi.amap.com", "tiles.amap.com"],
@@ -56,59 +56,59 @@ class w extends Error {
56
56
  };
57
57
  }
58
58
  }
59
- const _ = { ...ht };
60
- function dt(s) {
59
+ const J = { ...lt };
60
+ function mt(s) {
61
61
  const { baseUrl: t, authorizeCode: e, locale: i } = s;
62
- Object.assign(_, { baseUrl: t, authorizeCode: e, locale: i });
62
+ Object.assign(J, { baseUrl: t, authorizeCode: e, locale: i });
63
63
  }
64
64
  async function T(s, t) {
65
- const e = { ...ct, ...t }, i = { ...lt, ...s };
65
+ const e = { ...ut, ...t }, i = { ...dt, ...s };
66
66
  try {
67
- const n = ft(i, e), { url: o, ...r } = n, h = await (await window.fetch(o, r)).json();
68
- return mt(h, e);
67
+ const n = yt(i, e), { url: o, ...r } = n, c = await (await window.fetch(o, r)).json();
68
+ return wt(c, e);
69
69
  } catch (n) {
70
- return yt(n);
70
+ return pt(n);
71
71
  }
72
72
  }
73
- function ft(s, t) {
74
- const { baseUrl: e, authorizeCode: i, locale: n = Y.zh_CN } = _, { joinBaseUrl: o, withAuthorize: r } = t;
75
- let { url: a, method: h, headers: l = {}, params: c, data: u } = s;
76
- o && e && (a = `${e}${a}`), h = h?.toUpperCase();
73
+ function yt(s, t) {
74
+ const { baseUrl: e, authorizeCode: i, locale: n = _.zh_CN } = J, { joinBaseUrl: o, withAuthorize: r } = t;
75
+ let { url: a, method: c, headers: l = {}, params: h, data: u } = s;
76
+ o && e && (a = `${e}${a}`), c = c?.toUpperCase();
77
77
  const d = { ...l };
78
- if (/^https?:\/\/.+$/i.test(e ?? "") ? d.PlatForm = new URL(e ?? "").host : d.PlatForm = new URL(window.location.href).host, r && i && (d.AuthorizationCode = i), h === M.POST && !d["Content-Type"] && (d["Content-Type"] = L.JSON), n && (d["Accept-Language"] = n), h === M.GET && c) {
79
- const S = new URLSearchParams(c), ot = a.includes("?") ? "&" : "?";
80
- a += ot + `${S.toString()}`;
78
+ if (/^https?:\/\/.+$/i.test(e ?? "") ? d.PlatForm = new URL(e ?? "").host : d.PlatForm = new URL(window.location.href).host, r && i && (d.AuthorizationCode = i), c === M.POST && !d["Content-Type"] && (d["Content-Type"] = L.JSON), n && (d["Accept-Language"] = n), c === M.GET && h) {
79
+ const S = new URLSearchParams(h), at = a.includes("?") ? "&" : "?";
80
+ a += at + `${S.toString()}`;
81
81
  }
82
82
  let b;
83
- return h === M.POST && (b = d["Content-Type"] === L.JSON ? JSON.stringify(u || {}) : u), {
83
+ return c === M.POST && (b = d["Content-Type"] === L.JSON ? JSON.stringify(u || {}) : u), {
84
84
  url: a,
85
- method: h,
85
+ method: c,
86
86
  headers: d,
87
87
  body: b
88
88
  };
89
89
  }
90
- function mt(s, t) {
90
+ function wt(s, t) {
91
91
  if (!t.isTransformResponse)
92
92
  return s;
93
93
  if (!s)
94
94
  throw new w(p.RequestResultError, "请求返回的结果错误");
95
95
  const { code: e, data: i, msg: n } = s;
96
- if (e === F.SUCCESS)
96
+ if (e === $.SUCCESS)
97
97
  return i;
98
98
  throw new w(p.RequestCodeError, n || "请求返回的Code错误");
99
99
  }
100
- function yt(s) {
100
+ function pt(s) {
101
101
  throw s instanceof Error ? s : new w(
102
102
  p.RequestUnknownError,
103
103
  typeof s == "string" ? s : "未知的请求错误"
104
104
  );
105
105
  }
106
- const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
106
+ const _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
107
107
  __proto__: null,
108
108
  request: T,
109
- setRequestGlobalConfig: dt
109
+ setRequestGlobalConfig: mt
110
110
  }, Symbol.toStringTag, { value: "Module" }));
111
- function $(s, t) {
111
+ function q(s, t) {
112
112
  return T(
113
113
  {
114
114
  url: "/project/jssdk/cs/list",
@@ -118,7 +118,7 @@ function $(s, t) {
118
118
  t
119
119
  );
120
120
  }
121
- function J(s, t) {
121
+ function W(s, t) {
122
122
  return T(
123
123
  {
124
124
  url: "/project/jssdk/cs/bind",
@@ -128,7 +128,7 @@ function J(s, t) {
128
128
  t
129
129
  );
130
130
  }
131
- function A(s, t) {
131
+ function j(s, t) {
132
132
  return T(
133
133
  {
134
134
  url: "/project/jssdk/cs/save",
@@ -138,7 +138,7 @@ function A(s, t) {
138
138
  t
139
139
  );
140
140
  }
141
- function q(s, t) {
141
+ function Z(s, t) {
142
142
  return T(
143
143
  {
144
144
  url: "/project/jssdk/cs/delete",
@@ -148,7 +148,7 @@ function q(s, t) {
148
148
  t
149
149
  );
150
150
  }
151
- function W(s, t) {
151
+ function V(s, t) {
152
152
  return T(
153
153
  {
154
154
  url: "/project/jssdk/cs/mapping",
@@ -158,7 +158,7 @@ function W(s, t) {
158
158
  t
159
159
  );
160
160
  }
161
- function Z(s, t) {
161
+ function H(s, t) {
162
162
  return T(
163
163
  {
164
164
  url: "/project/jssdk/cs/mapping/query",
@@ -168,7 +168,7 @@ function Z(s, t) {
168
168
  t
169
169
  );
170
170
  }
171
- function V(s, t) {
171
+ function Q(s, t) {
172
172
  return T(
173
173
  {
174
174
  url: "/project/jssdk/project/detail",
@@ -178,7 +178,7 @@ function V(s, t) {
178
178
  t
179
179
  );
180
180
  }
181
- function wt(s, t = {
181
+ function gt(s, t = {
182
182
  isTransformResponse: !1,
183
183
  joinBaseUrl: !1,
184
184
  withAuthorize: !1
@@ -191,72 +191,72 @@ function wt(s, t = {
191
191
  t
192
192
  );
193
193
  }
194
- const Ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
194
+ const Jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
195
195
  __proto__: null,
196
- bindCoordinate: J,
197
- getCoordinateList: $,
198
- getImageInfo: wt,
199
- getMappingRelation: Z,
200
- getProjectDetail: V,
201
- mapingCoordinate: W,
202
- removeCoordinate: q,
203
- saveCoordinate: A
204
- }, Symbol.toStringTag, { value: "Module" })), pt = typeof window < "u", gt = Object.prototype.toString;
196
+ bindCoordinate: W,
197
+ getCoordinateList: q,
198
+ getImageInfo: gt,
199
+ getMappingRelation: H,
200
+ getProjectDetail: Q,
201
+ mapingCoordinate: V,
202
+ removeCoordinate: Z,
203
+ saveCoordinate: j
204
+ }, Symbol.toStringTag, { value: "Module" })), Mt = typeof window < "u", xt = Object.prototype.toString;
205
205
  function D(s, t) {
206
- return gt.call(s) === `[object ${t}]`;
206
+ return xt.call(s) === `[object ${t}]`;
207
207
  }
208
- function H(s) {
208
+ function K(s) {
209
209
  return typeof s < "u";
210
210
  }
211
- function Q(s) {
212
- return !H(s);
211
+ function tt(s) {
212
+ return !K(s);
213
213
  }
214
214
  function E(s) {
215
215
  return s !== null && D(s, "Object");
216
216
  }
217
- function K(s) {
217
+ function et(s) {
218
218
  return s === null;
219
219
  }
220
- function Mt(s) {
220
+ function vt(s) {
221
221
  return D(s, "Date");
222
222
  }
223
- function xt(s) {
223
+ function St(s) {
224
224
  return D(s, "String");
225
225
  }
226
- function j(s) {
226
+ function k(s) {
227
227
  return typeof s == "function";
228
228
  }
229
- function vt(s) {
229
+ function bt(s) {
230
230
  return D(s, "Boolean");
231
231
  }
232
- function St(s) {
232
+ function Pt(s) {
233
233
  return D(s, "RegExp");
234
234
  }
235
235
  function x(s) {
236
236
  return s && Array.isArray(s);
237
237
  }
238
- function bt(s) {
238
+ function Tt(s) {
239
239
  return typeof window < "u" && D(s, "Window");
240
240
  }
241
- function Pt(s) {
241
+ function Et(s) {
242
242
  return E(s) && !!s.tagName;
243
243
  }
244
244
  function O(s) {
245
245
  return typeof s == "number" ? !0 : typeof s != "string" ? !1 : /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/.test(s);
246
246
  }
247
- function Tt(s, t) {
247
+ function Dt(s, t) {
248
248
  return JSON.stringify(s) === JSON.stringify(t);
249
249
  }
250
- function Et(s) {
251
- return Q(s) || K(s);
250
+ function zt(s) {
251
+ return tt(s) || et(s);
252
252
  }
253
- function Dt(s) {
254
- return D(s, "Promise") && E(s) && j(s.then) && j(s.catch);
253
+ function Nt(s) {
254
+ return D(s, "Promise") && E(s) && k(s.then) && k(s.catch);
255
255
  }
256
- function zt(s, t = {}) {
256
+ function Ct(s, t = {}) {
257
257
  return new Promise((e, i) => {
258
258
  const n = N(s);
259
- if (Nt(n)) {
259
+ if (It(n)) {
260
260
  e(!0);
261
261
  return;
262
262
  }
@@ -270,14 +270,14 @@ function zt(s, t = {}) {
270
270
  }, document.head.appendChild(o);
271
271
  });
272
272
  }
273
- function Nt(s) {
273
+ function It(s) {
274
274
  const t = N(s);
275
275
  return Array.from(document.scripts).some((e) => N(e.src) === t);
276
276
  }
277
- function Ct(s) {
277
+ function Ot(s) {
278
278
  return new Promise((t, e) => {
279
279
  const i = N(s);
280
- if (It(i)) {
280
+ if (Rt(i)) {
281
281
  t(!0);
282
282
  return;
283
283
  }
@@ -289,7 +289,7 @@ function Ct(s) {
289
289
  }, document.head.appendChild(n);
290
290
  });
291
291
  }
292
- function It(s) {
292
+ function Rt(s) {
293
293
  const t = N(s);
294
294
  return Array.from(document.querySelectorAll('link[rel="stylesheet"]')).some(
295
295
  (e) => N(e.href) === t
@@ -303,7 +303,7 @@ function N(s) {
303
303
  return s;
304
304
  }
305
305
  }
306
- function tt(s) {
306
+ function st(s) {
307
307
  return z(s, /* @__PURE__ */ new WeakMap());
308
308
  }
309
309
  function z(s, t) {
@@ -346,7 +346,7 @@ function z(s, t) {
346
346
  Object.prototype.propertyIsEnumerable.call(s, n) && (e[n] = z(s[n], t));
347
347
  return e;
348
348
  }
349
- function Ot(s, t, e = !1) {
349
+ function Gt(s, t, e = !1) {
350
350
  let i;
351
351
  const n = function(...o) {
352
352
  const r = this, a = e && !i;
@@ -358,7 +358,7 @@ function Ot(s, t, e = !1) {
358
358
  i && clearTimeout(i), i = void 0;
359
359
  }, n;
360
360
  }
361
- function Rt(s, t, e = !1) {
361
+ function At(s, t, e = !1) {
362
362
  let i, n;
363
363
  const o = function(...r) {
364
364
  const a = this;
@@ -373,27 +373,27 @@ function Rt(s, t, e = !1) {
373
373
  clearTimeout(i), i = void 0, n = void 0;
374
374
  }, o;
375
375
  }
376
- function k(s, ...t) {
376
+ function U(s, ...t) {
377
377
  if (!t.length) return s;
378
378
  const e = t.shift();
379
379
  return e === void 0 ? s : (I(s) && I(e) && Object.keys(e).forEach((i) => {
380
380
  const n = s[i], o = e[i];
381
- Array.isArray(n) && Array.isArray(o) ? s[i] = [...n, ...o] : I(n) && I(o) ? s[i] = k({ ...n }, o) : o !== void 0 && (s[i] = o);
382
- }), k(s, ...t));
381
+ Array.isArray(n) && Array.isArray(o) ? s[i] = [...n, ...o] : I(n) && I(o) ? s[i] = U({ ...n }, o) : o !== void 0 && (s[i] = o);
382
+ }), U(s, ...t));
383
383
  }
384
384
  function I(s) {
385
385
  return s !== null && typeof s == "object" && !Array.isArray(s);
386
386
  }
387
- function et(s, ...t) {
387
+ function it(s, ...t) {
388
388
  if (!t.length) return s;
389
389
  for (const e of t)
390
390
  e != null && typeof e == "object" && Object.keys(e).forEach((i) => {
391
391
  const n = e[i], o = s[i];
392
- n !== null && typeof n == "object" && !Array.isArray(n) ? ((!o || typeof o != "object") && (s[i] = {}), et(s[i], n)) : s[i] = n;
392
+ n !== null && typeof n == "object" && !Array.isArray(n) ? ((!o || typeof o != "object") && (s[i] = {}), it(s[i], n)) : s[i] = n;
393
393
  });
394
394
  return s;
395
395
  }
396
- function st(s, t) {
396
+ function nt(s, t) {
397
397
  const e = {};
398
398
  if (E(s) && !x(s)) {
399
399
  for (const i in s)
@@ -404,7 +404,7 @@ function st(s, t) {
404
404
  else if (x(n) && x(o))
405
405
  JSON.stringify(n) !== JSON.stringify(o) && (e[i] = n);
406
406
  else if (E(n) && E(o)) {
407
- const r = st(n, o);
407
+ const r = nt(n, o);
408
408
  r && Object.keys(r).length > 0 && (e[i] = r);
409
409
  } else n !== o && (e[i] = n);
410
410
  }
@@ -414,19 +414,19 @@ function st(s, t) {
414
414
  Object.prototype.hasOwnProperty.call(t, i) && !(i in (s || {})) && (e[i] = void 0);
415
415
  return e;
416
416
  }
417
- function Gt(s) {
417
+ function Lt(s) {
418
418
  console.warn(`[warn]:${s}`);
419
419
  }
420
- function Lt(s) {
420
+ function jt(s) {
421
421
  throw new Error(`[error]:${s}`);
422
422
  }
423
- function At(s) {
423
+ function kt(s) {
424
424
  if (s)
425
- return ut.find(
425
+ return ft.find(
426
426
  (t) => t?.patterns?.some((e) => s.includes(e))
427
427
  );
428
428
  }
429
- function jt(s, t, e, i) {
429
+ function Ut(s, t, e, i) {
430
430
  const n = Math.min(s / e, t / i), o = e * n, r = i * n;
431
431
  return {
432
432
  scale: n,
@@ -438,54 +438,76 @@ function jt(s, t, e, i) {
438
438
  sh: r
439
439
  };
440
440
  }
441
- function kt(s, t, e) {
441
+ function Xt(s, t, e) {
442
442
  return {
443
443
  x: s * e.scale + e.x,
444
444
  // 缩放后加上偏移量
445
445
  y: t * e.scale + e.y
446
446
  };
447
447
  }
448
- function Xt(s, t, e) {
448
+ function Bt(s, t, e) {
449
449
  return {
450
450
  x: (s - e.x) / e.scale,
451
451
  // 减去偏移量后缩放到模型尺寸
452
452
  y: (t - e.y) / e.scale
453
453
  };
454
454
  }
455
- const Ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
455
+ const X = "0123456789abcdef";
456
+ function Ft() {
457
+ let s = "";
458
+ const t = new Uint8Array(16);
459
+ if (typeof crypto < "u" && "getRandomValues" in crypto)
460
+ crypto.getRandomValues(t);
461
+ else
462
+ for (let e = 0; e < 16; e++)
463
+ t[e] = Math.floor(Math.random() * 256);
464
+ t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128;
465
+ for (let e = 0; e < 16; e++)
466
+ (e === 4 || e === 6 || e === 8 || e === 10) && (s += "-"), s += X[t[e] >>> 4], s += X[t[e] & 15];
467
+ return s;
468
+ }
469
+ let R = 0;
470
+ const Yt = 9999;
471
+ function $t(s = "") {
472
+ const t = Date.now(), e = Math.floor(Math.random() * 1e6);
473
+ return R = (R + 1) % Yt, `${s}${s ? "_" : ""}${t}_${R.toString().padStart(4, "0")}_${e.toString().padStart(6, "0")}`;
474
+ }
475
+ const qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
456
476
  __proto__: null,
457
- cloneDeep: tt,
458
- debounce: Ot,
459
- deepMerge: k,
460
- deepMergeProps: et,
461
- error: Lt,
462
- getDiffProps: st,
463
- getImageTransform: jt,
464
- getMapProvider: At,
465
- inBrowser: pt,
477
+ buildShortUUID: $t,
478
+ buildUUID: Ft,
479
+ cloneDeep: st,
480
+ debounce: Gt,
481
+ deepMerge: U,
482
+ deepMergeProps: it,
483
+ error: jt,
484
+ getDiffProps: nt,
485
+ getImageTransform: Ut,
486
+ getMapProvider: kt,
487
+ inBrowser: Mt,
466
488
  is: D,
467
489
  isArray: x,
468
- isBoolean: vt,
469
- isDate: Mt,
470
- isDef: H,
471
- isElement: Pt,
472
- isFunction: j,
473
- isNull: K,
474
- isNullOrUnDef: Et,
490
+ isBoolean: bt,
491
+ isDate: vt,
492
+ isDef: K,
493
+ isElement: Et,
494
+ isFunction: k,
495
+ isNull: et,
496
+ isNullOrUnDef: zt,
475
497
  isNumeric: O,
476
498
  isObject: E,
477
- isPromise: Dt,
478
- isRegExp: St,
479
- isSameValue: Tt,
480
- isString: xt,
481
- isUnDef: Q,
482
- isWindow: bt,
483
- loadCss: Ct,
484
- loadScript: zt,
485
- throttle: Rt,
486
- toCanvasCoord: kt,
487
- toModelCoord: Xt,
488
- warn: Gt
499
+ isPromise: Nt,
500
+ isRegExp: Pt,
501
+ isSameValue: Dt,
502
+ isString: St,
503
+ isUnDef: tt,
504
+ isWindow: Tt,
505
+ loadCss: Ot,
506
+ loadScript: Ct,
507
+ throttle: At,
508
+ toCanvasCoord: Xt,
509
+ toModelCoord: Bt,
510
+ warn: Lt
489
511
  }, Symbol.toStringTag, { value: "Module" }));
490
512
  class f {
491
513
  /** 直角坐标系坐标 */
@@ -516,8 +538,8 @@ class f {
516
538
  plane = "xy";
517
539
  /** 默认平面 ('xy' 或 'xz') */
518
540
  constructor(t) {
519
- const { x: e, y: i, z: n, lat: o, lon: r, alt: a, yaw: h, pitch: l, roll: c, plane: u = "xy" } = t || {};
520
- this.x = Number(e) || 0, this.y = Number(i) || 0, this.z = Number(n) || 0, (this.x !== 0 || this.y !== 0 || this.z !== 0) && (this.plane = u, this.hasXYZ = !0), this.lat = Number(o) || 0, this.lon = Number(r) || 0, this.alt = Number(a) || 0, (this.lat !== 0 || this.lon !== 0 || this.alt !== 0) && (this.hasGeo = !0), this.yaw = Number(h) || 0, this.pitch = Number(l) || 0, this.roll = Number(c) || 0, (O(h) || O(l) || O(c)) && (this.hasAngle = !0);
541
+ const { x: e, y: i, z: n, lat: o, lon: r, alt: a, yaw: c, pitch: l, roll: h, plane: u = "xy" } = t || {};
542
+ this.x = Number(e) || 0, this.y = Number(i) || 0, this.z = Number(n) || 0, (this.x !== 0 || this.y !== 0 || this.z !== 0) && (this.plane = u, this.hasXYZ = !0), this.lat = Number(o) || 0, this.lon = Number(r) || 0, this.alt = Number(a) || 0, (this.lat !== 0 || this.lon !== 0 || this.alt !== 0) && (this.hasGeo = !0), this.yaw = Number(c) || 0, this.pitch = Number(l) || 0, this.roll = Number(h) || 0, (O(c) || O(l) || O(h)) && (this.hasAngle = !0);
521
543
  }
522
544
  /**
523
545
  * 计算两点之间的三维距离
@@ -570,7 +592,7 @@ class f {
570
592
  * @returns 夹角角度 (0-180度)
571
593
  */
572
594
  static angleXZ(t, e, i) {
573
- const n = { x: t.x - e.x, z: t.z - e.z }, o = { x: i.x - e.x, z: i.z - e.z }, r = n.x * o.x + n.z * o.z, a = Math.sqrt(n.x ** 2 + n.z ** 2), h = Math.sqrt(o.x ** 2 + o.z ** 2), l = Math.max(-1, Math.min(1, r / (a * h))), u = Math.acos(l) * 180 / Math.PI;
595
+ const n = { x: t.x - e.x, z: t.z - e.z }, o = { x: i.x - e.x, z: i.z - e.z }, r = n.x * o.x + n.z * o.z, a = Math.sqrt(n.x ** 2 + n.z ** 2), c = Math.sqrt(o.x ** 2 + o.z ** 2), l = Math.max(-1, Math.min(1, r / (a * c))), u = Math.acos(l) * 180 / Math.PI;
574
596
  return Math.min(u, 360 - u);
575
597
  }
576
598
  /**
@@ -677,33 +699,33 @@ class C {
677
699
  }
678
700
  static XYZToLLH(t, e) {
679
701
  const n = 0.0033528106647474805, o = n * (2 - n), r = f.toRadians(e.lat), a = 6378137 / Math.sqrt(1 - o * Math.sin(r) ** 2) + e.alt;
680
- let h, l, c;
702
+ let c, l, h;
681
703
  if (t.plane === "xz") {
682
704
  const u = t.x / 1e3 / (a * Math.cos(r)), d = t.z / 1e3 / a;
683
- h = e.lon + f.toDegrees(u), l = e.lat - f.toDegrees(d), c = e.alt + t.y / 1e3;
705
+ c = e.lon + f.toDegrees(u), l = e.lat - f.toDegrees(d), h = e.alt + t.y / 1e3;
684
706
  } else if (t.plane === "xy") {
685
707
  const u = t.x / 1e3 / (a * Math.cos(r)), d = t.y / 1e3 / a;
686
- h = e.lon + f.toDegrees(u), l = e.lat - f.toDegrees(d), c = e.alt + t.z / 1e3;
708
+ c = e.lon + f.toDegrees(u), l = e.lat - f.toDegrees(d), h = e.alt + t.z / 1e3;
687
709
  } else
688
710
  throw new w(p.GeoPointNoPlane, "点的plane应为xz或xy");
689
711
  return new C({
690
712
  lat: l,
691
- lon: h,
692
- alt: c
713
+ lon: c,
714
+ alt: h
693
715
  });
694
716
  }
695
717
  static LLHToXYZ(t, e) {
696
- const n = 0.0033528106647474805, o = n * (2 - n), r = f.toRadians(e.lat), a = 6378137 / Math.sqrt(1 - o * Math.sin(r) ** 2) + e.alt, h = f.toRadians(t.lon - e.lon), l = f.toRadians(e.lat - t.lat), c = a * h * Math.cos(r), u = a * l;
718
+ const n = 0.0033528106647474805, o = n * (2 - n), r = f.toRadians(e.lat), a = 6378137 / Math.sqrt(1 - o * Math.sin(r) ** 2) + e.alt, c = f.toRadians(t.lon - e.lon), l = f.toRadians(e.lat - t.lat), h = a * c * Math.cos(r), u = a * l;
697
719
  if (t.plane === "xz")
698
720
  return new f({
699
- x: c * 1e3,
721
+ x: h * 1e3,
700
722
  y: t.alt * 1e3,
701
723
  z: u * 1e3,
702
724
  plane: "xz"
703
725
  });
704
726
  if (t.plane === "xy")
705
727
  return new f({
706
- x: c * 1e3,
728
+ x: h * 1e3,
707
729
  y: u * 1e3,
708
730
  z: t.alt * 1e3,
709
731
  plane: "xy"
@@ -736,20 +758,20 @@ class y {
736
758
  if (t.plane !== e.plane)
737
759
  throw new w(p.RelativePlaneUnmatch, "两个映射关系的plane应该相同");
738
760
  const i = t.scale * e.scale, n = t.yaw + e.yaw, o = Math.cos(e.yaw), r = Math.sin(e.yaw);
739
- let a = 0, h = 0, l = 0;
761
+ let a = 0, c = 0, l = 0;
740
762
  if (t.plane === "xz") {
741
- const c = t.x * o - t.z * r, u = t.y, d = t.x * r + t.z * o;
742
- a = e.x + c * e.scale, h = e.y + u * e.scale, l = e.z + d * e.scale;
763
+ const h = t.x * o - t.z * r, u = t.y, d = t.x * r + t.z * o;
764
+ a = e.x + h * e.scale, c = e.y + u * e.scale, l = e.z + d * e.scale;
743
765
  } else if (t.plane === "xy") {
744
- const c = t.x * o - t.y * r, u = t.x * r + t.y * o, d = t.z;
745
- a = e.x + c * e.scale, h = e.y + u * e.scale, l = e.z + d * e.scale;
766
+ const h = t.x * o - t.y * r, u = t.x * r + t.y * o, d = t.z;
767
+ a = e.x + h * e.scale, c = e.y + u * e.scale, l = e.z + d * e.scale;
746
768
  } else
747
769
  throw new w(p.RelativeNoPlane, "映射关系的plane应为xz或xy");
748
770
  return new y({
749
771
  scale: i,
750
772
  yaw: n,
751
773
  x: a,
752
- y: h,
774
+ y: c,
753
775
  z: l,
754
776
  start: t.start,
755
777
  end: t.end,
@@ -763,11 +785,11 @@ class y {
763
785
  */
764
786
  static inverseRelativeMap(t) {
765
787
  const e = 1 / t.scale, i = -t.yaw, n = Math.cos(-i), o = Math.sin(-i);
766
- let r = 0, a = 0, h = 0;
788
+ let r = 0, a = 0, c = 0;
767
789
  if (t.plane === "xz")
768
- r = -(t.x * n + t.z * o) * e, a = -t.y * e, h = -(t.z * n - t.x * o) * e;
790
+ r = -(t.x * n + t.z * o) * e, a = -t.y * e, c = -(t.z * n - t.x * o) * e;
769
791
  else if (t.plane === "xy")
770
- r = -(t.x * n + t.y * o) * e, a = -(t.y * n - t.x * o) * e, h = -t.z * e;
792
+ r = -(t.x * n + t.y * o) * e, a = -(t.y * n - t.x * o) * e, c = -t.z * e;
771
793
  else
772
794
  throw new w(p.RelativeNoPlane, "映射关系的plane应为xz或xy");
773
795
  return new y({
@@ -775,7 +797,7 @@ class y {
775
797
  yaw: i,
776
798
  x: r,
777
799
  y: a,
778
- z: h,
800
+ z: c,
779
801
  start: t.start,
780
802
  end: t.end,
781
803
  plane: t.plane
@@ -803,7 +825,7 @@ class m {
803
825
  * @param projectId
804
826
  */
805
827
  static async getProjectDetail(t) {
806
- return await V({ projectId: t });
828
+ return await Q({ projectId: t });
807
829
  }
808
830
  /**
809
831
  * 获取坐标系树
@@ -811,7 +833,7 @@ class m {
811
833
  * @returns
812
834
  */
813
835
  static async getCoordinateTree(t) {
814
- const e = await $({ projectId: t });
836
+ const e = await q({ projectId: t });
815
837
  if (e.length) {
816
838
  const i = m.handleCoordinateList(e);
817
839
  return m.buildCoordinateTree(i, 0);
@@ -834,16 +856,16 @@ class m {
834
856
  */
835
857
  static async addCoordinate(t, e) {
836
858
  const { projectId: i, id: n } = t, o = e.map((a) => {
837
- const { type: h, modelType: l, relativeMap: c, level: u, ...d } = a, b = c ? JSON.stringify(c) : void 0;
859
+ const { type: c, modelType: l, relativeMap: h, level: u, ...d } = a, b = h ? JSON.stringify(h) : void 0;
838
860
  return {
839
861
  ...d,
840
862
  projectId: i,
841
863
  parentId: n,
842
- coordinateType: h,
864
+ coordinateType: c,
843
865
  renderType: l,
844
866
  relativePosition: b
845
867
  };
846
- }), r = await A(o);
868
+ }), r = await j(o);
847
869
  return m.handleCoordinateList(r);
848
870
  }
849
871
  /**
@@ -854,7 +876,7 @@ class m {
854
876
  */
855
877
  static async removeCoordinate(t, e) {
856
878
  const i = e.map((n) => n.id ?? -1);
857
- return await q(i);
879
+ return await Z(i);
858
880
  }
859
881
  /**
860
882
  * 更新坐标系
@@ -864,9 +886,9 @@ class m {
864
886
  */
865
887
  static async updateCoordinate(t, e) {
866
888
  const { projectId: i, id: n } = t, o = e.map((a) => {
867
- const { type: h, relativeMap: l, level: c, ...u } = a, d = y.toStringify(l);
889
+ const { type: c, relativeMap: l, level: h, ...u } = a, d = y.toStringify(l);
868
890
  return { ...u, relativePosition: d, projectId: i, parentId: n };
869
- }), r = await A(o);
891
+ }), r = await j(o);
870
892
  return m.handleCoordinateList(r);
871
893
  }
872
894
  /**
@@ -877,9 +899,9 @@ class m {
877
899
  */
878
900
  static async bindCoordinate(t, e) {
879
901
  const { projectId: i, id: n } = t, o = e.map((a) => {
880
- const { modelId: h } = a;
881
- return { modelId: h, parentId: n, projectId: i };
882
- }), r = await J(o);
902
+ const { modelId: c } = a;
903
+ return { modelId: c, parentId: n, projectId: i };
904
+ }), r = await W(o);
883
905
  return m.handleCoordinateList(r);
884
906
  }
885
907
  /**
@@ -895,13 +917,13 @@ class m {
895
917
  renderType: o,
896
918
  relativePosition: r,
897
919
  ...a
898
- } = e, h = o === P.GeoModel ? new y(y.toParse(r)) : y.toParse(r);
899
- return new R({
920
+ } = e, c = o === P.GeoModel ? new y(y.toParse(r)) : y.toParse(r);
921
+ return new G({
900
922
  ...a,
901
923
  type: i,
902
924
  modelType: o,
903
925
  modelValue: n,
904
- relativeMap: h
926
+ relativeMap: c
905
927
  });
906
928
  });
907
929
  }
@@ -914,8 +936,8 @@ class m {
914
936
  const e = Array.isArray(t) ? t : [t], i = [];
915
937
  function n(o) {
916
938
  for (const r of o) {
917
- const { level: a, parent: h, relativeMap: l, ...c } = r, u = new R({
918
- ...c,
939
+ const { level: a, parent: c, relativeMap: l, ...h } = r, u = new G({
940
+ ...h,
919
941
  relativeMap: new y(l)
920
942
  });
921
943
  i.push(u), r.children && r.children.length > 0 && n(r.children);
@@ -965,14 +987,14 @@ class m {
965
987
  static filterSpaceTree(t, e) {
966
988
  const i = [];
967
989
  return t.forEach((n) => {
968
- const o = new R(n);
990
+ const o = new G(n);
969
991
  e && (o.parent = e);
970
992
  const r = m.filterSpaceTree(o.children, o);
971
993
  o.children = r, o.disabled = o.disabled ?? !1, o.type !== v.Model && i.push(o);
972
994
  }), i;
973
995
  }
974
996
  }
975
- class R {
997
+ class G {
976
998
  id = 0;
977
999
  /** id */
978
1000
  type = 0;
@@ -1057,26 +1079,26 @@ class R {
1057
1079
  t?.length && t.forEach((e) => {
1058
1080
  const i = this.children.find((n) => n.id === e.id);
1059
1081
  if (i) {
1060
- const { relativeMap: n, no: o, name: r, shortName: a, status: h, modelId: l, modelValue: c } = e;
1082
+ const { relativeMap: n, no: o, name: r, shortName: a, status: c, modelId: l, modelValue: h } = e;
1061
1083
  Object.assign(i, {
1062
1084
  relativeMap: n,
1063
1085
  no: o,
1064
1086
  name: r,
1065
1087
  shortName: a,
1066
- status: h,
1088
+ status: c,
1067
1089
  modelId: l,
1068
- modelValue: c
1090
+ modelValue: h
1069
1091
  });
1070
1092
  } else this.id === e.parentId && (e.parent = this, this.children.unshift(e));
1071
1093
  });
1072
1094
  }
1073
1095
  /** 映射到(模型映射到空间,空间映射到空间) */
1074
1096
  async mappingTo(t) {
1075
- await W(t);
1097
+ await V(t);
1076
1098
  }
1077
1099
  /** 来自映射(被映射过的源坐标系关系) */
1078
1100
  async getMapping() {
1079
- return (await Z({ srcCsId: this.id }))[0];
1101
+ return (await H({ srcCsId: this.id }))[0];
1080
1102
  }
1081
1103
  /**
1082
1104
  * 递归寻找到根坐标系
@@ -1096,7 +1118,7 @@ class R {
1096
1118
  */
1097
1119
  findChildModel(t, e = !0) {
1098
1120
  const i = x(t) ? t : [t];
1099
- return i.includes(this.modelType ?? -1) && this.status !== G.Disabled ? this : ([v.Data, v.Model].includes(this.type) ? this.findParentSpace() : this)?.modelList?.filter((a) => i.includes(a.modelType ?? -1) ? e ? !!a.relativeMap : !0 : !1)?.sort((a, h) => Number(a.status) - Number(h.status))?.[0];
1121
+ return i.includes(this.modelType ?? -1) && this.status !== A.Disabled ? this : ([v.Data, v.Model].includes(this.type) ? this.findParentSpace() : this)?.modelList?.filter((a) => i.includes(a.modelType ?? -1) ? e ? !!a.relativeMap : !0 : !1)?.sort((a, c) => Number(a.status) - Number(c.status))?.[0];
1100
1122
  }
1101
1123
  /**
1102
1124
  * 寻找与当前节点最近的一个模型节点,从当前节点遍历到根节点-广度优先遍历
@@ -1112,31 +1134,31 @@ class R {
1112
1134
  P.GeoModel
1113
1135
  ], e) {
1114
1136
  const i = x(t) ? t : [t], n = /* @__PURE__ */ new Set();
1115
- e?.forEach((c) => {
1116
- n.add(String(c.id));
1137
+ e?.forEach((h) => {
1138
+ n.add(String(h.id));
1117
1139
  });
1118
1140
  const o = [{ node: this, distance: 0 }], r = /* @__PURE__ */ new Set(), a = [];
1119
1141
  for (; o.length > 0; ) {
1120
- const { node: c, distance: u } = o.shift();
1121
- if (n.has(String(c.id)) || r.has(c))
1142
+ const { node: h, distance: u } = o.shift();
1143
+ if (n.has(String(h.id)) || r.has(h))
1122
1144
  continue;
1123
- const d = c.modelType ?? -1;
1124
- i.includes(d) && a.push({ node: c, distance: u, modelType: d }), r.add(c);
1145
+ const d = h.modelType ?? -1;
1146
+ i.includes(d) && a.push({ node: h, distance: u, modelType: d }), r.add(h);
1125
1147
  const b = [];
1126
- if (c.children)
1127
- for (const S of c.children)
1148
+ if (h.children)
1149
+ for (const S of h.children)
1128
1150
  r.has(S) || b.push(S);
1129
- if (c.parent?.children)
1130
- for (const S of c.parent.children)
1131
- S !== c && !r.has(S) && b.push(S);
1132
- c.parent && !r.has(c.parent) && b.push(c.parent);
1151
+ if (h.parent?.children)
1152
+ for (const S of h.parent.children)
1153
+ S !== h && !r.has(S) && b.push(S);
1154
+ h.parent && !r.has(h.parent) && b.push(h.parent);
1133
1155
  for (const S of b)
1134
1156
  o.push({ node: S, distance: u + 1 });
1135
1157
  }
1136
1158
  if (a.length === 0)
1137
1159
  return;
1138
- const h = Math.min(...a.map((c) => c.distance)), l = a.filter((c) => c.distance === h);
1139
- return l.sort((c, u) => c.modelType - u.modelType), l[0]?.node;
1160
+ const c = Math.min(...a.map((h) => h.distance)), l = a.filter((h) => h.distance === c);
1161
+ return l.sort((h, u) => h.modelType - u.modelType), l[0]?.node;
1140
1162
  }
1141
1163
  /**
1142
1164
  *向上寻找到子节点的空间坐标系
@@ -1212,9 +1234,9 @@ class R {
1212
1234
  */
1213
1235
  getMappedCsTree() {
1214
1236
  function t(n) {
1215
- return n.children?.length && (n.children = n.children.filter((o) => !!o?.relativeMap && o.status !== G.Disabled).map((o) => t(o))), n;
1237
+ return n.children?.length && (n.children = n.children.filter((o) => !!o?.relativeMap && o.status !== A.Disabled).map((o) => t(o))), n;
1216
1238
  }
1217
- const e = tt(this.findRoot(!0)), i = t(e);
1239
+ const e = st(this.findRoot(!0)), i = t(e);
1218
1240
  return i.parentId = 0, i.parent = void 0, i;
1219
1241
  }
1220
1242
  /**
@@ -1292,7 +1314,7 @@ class R {
1292
1314
  } else return !1;
1293
1315
  }
1294
1316
  }
1295
- class it {
1317
+ class ot {
1296
1318
  yaw = 0;
1297
1319
  /** 偏航角 */
1298
1320
  pitch = 0;
@@ -1306,14 +1328,14 @@ class it {
1306
1328
  static toParse(t) {
1307
1329
  if (t) {
1308
1330
  const e = t?.split(",").map((i) => Number(i) || 0);
1309
- return new it({ yaw: e[0], pitch: e[1], roll: e[2] });
1331
+ return new ot({ yaw: e[0], pitch: e[1], roll: e[2] });
1310
1332
  }
1311
1333
  }
1312
1334
  static toStringify(t) {
1313
1335
  return t ? `${t.yaw},${t.pitch},${t.roll}` : "";
1314
1336
  }
1315
1337
  }
1316
- class nt {
1338
+ class rt {
1317
1339
  x = 0;
1318
1340
  /** x轴 */
1319
1341
  y = 0;
@@ -1327,14 +1349,14 @@ class nt {
1327
1349
  static toParse(t) {
1328
1350
  if (t) {
1329
1351
  const e = t?.split(",").map((i) => Number(i) || 0);
1330
- return new nt({ x: e[0], y: e[1], z: e[2] });
1352
+ return new rt({ x: e[0], y: e[1], z: e[2] });
1331
1353
  }
1332
1354
  }
1333
1355
  static toStringify(t) {
1334
1356
  return t ? `${t.x},${t.y},${t.z}` : "";
1335
1357
  }
1336
1358
  }
1337
- class Yt {
1359
+ class Wt {
1338
1360
  /**
1339
1361
  * 将源坐标系中的点转换到目标坐标系中
1340
1362
  * @param points 需要转换的点数组
@@ -1353,7 +1375,7 @@ class Yt {
1353
1375
  }), o;
1354
1376
  }
1355
1377
  }
1356
- class _t {
1378
+ class Zt {
1357
1379
  canvas;
1358
1380
  ctx;
1359
1381
  options;
@@ -1405,11 +1427,11 @@ class _t {
1405
1427
  isBindEvent: o = !0,
1406
1428
  isDrawAssist: r = !1,
1407
1429
  isMoveRedrawing: a,
1408
- customDrawAssist: h,
1430
+ customDrawAssist: c,
1409
1431
  afterDraw: l,
1410
- ...c
1432
+ ...h
1411
1433
  } = t;
1412
- this.canvas = e, this.ctx = this.canvas.getContext("2d"), this.width = i, this.height = n, this.canvas.width = i, this.canvas.height = n, this.isBindEvent = o, this.isDrawAssist = r, this.customDrawAssist = h, this.isMoveRedrawing = a ?? r, this.options = c, this.onMousedown = this.onMousedown.bind(this), this.onMousemove = this.onMousemove.bind(this), this.onMousemoveTemp = this.onMousemoveTemp.bind(this), this.onMouseup = this.onMouseup.bind(this), this.onMousewheel = this.onMousewheel.bind(this), this.onDblclick = this.onDblclick.bind(this), this.onTouchstart = this.onTouchstart.bind(this), this.onTouchmove = this.onTouchmove.bind(this), this.onTouchend = this.onTouchend.bind(this), this.onMouseout = this.onMouseout.bind(this), this.afterDraw = this.afterDraw, o && (this.canvas.addEventListener("DOMMouseScroll", this.onMousewheel), this.canvas.addEventListener("mousewheel", this.onMousewheel), this.canvas.addEventListener("mousedown", this.onMousedown), this.canvas.addEventListener("mousemove", this.onMousemove), this.canvas.addEventListener("mouseout", this.onMouseout), this.canvas.addEventListener("dblclick", this.onDblclick), this.canvas.addEventListener("touchstart", this.onTouchstart));
1434
+ this.canvas = e, this.ctx = this.canvas.getContext("2d"), this.width = i, this.height = n, this.canvas.width = i, this.canvas.height = n, this.isBindEvent = o, this.isDrawAssist = r, this.customDrawAssist = c, this.isMoveRedrawing = a ?? r, this.options = h, this.onMousedown = this.onMousedown.bind(this), this.onMousemove = this.onMousemove.bind(this), this.onMousemoveTemp = this.onMousemoveTemp.bind(this), this.onMouseup = this.onMouseup.bind(this), this.onMousewheel = this.onMousewheel.bind(this), this.onDblclick = this.onDblclick.bind(this), this.onTouchstart = this.onTouchstart.bind(this), this.onTouchmove = this.onTouchmove.bind(this), this.onTouchend = this.onTouchend.bind(this), this.onMouseout = this.onMouseout.bind(this), this.afterDraw = this.afterDraw, o && (this.canvas.addEventListener("DOMMouseScroll", this.onMousewheel), this.canvas.addEventListener("mousewheel", this.onMousewheel), this.canvas.addEventListener("mousedown", this.onMousedown), this.canvas.addEventListener("mousemove", this.onMousemove), this.canvas.addEventListener("mouseout", this.onMouseout), this.canvas.addEventListener("dblclick", this.onDblclick), this.canvas.addEventListener("touchstart", this.onTouchstart));
1413
1435
  }
1414
1436
  onClick(t) {
1415
1437
  const { screenX: e, screenY: i } = t;
@@ -1538,8 +1560,8 @@ class _t {
1538
1560
  this.isBindEvent && (this.canvas.removeEventListener("mousemove", this.onMousemove), this.canvas.removeEventListener("DOMMouseScroll", this.onMousewheel), this.canvas.removeEventListener("mousewheel", this.onMousewheel), this.canvas.removeEventListener("mousedown", this.onMousedown), this.canvas.removeEventListener("mouseout", this.onMouseout), this.canvas.removeEventListener("dblclick", this.onDblclick));
1539
1561
  }
1540
1562
  }
1541
- const X = {};
1542
- class $t {
1563
+ const B = {};
1564
+ class Vt {
1543
1565
  type = "image";
1544
1566
  // 修改为更通用的名称
1545
1567
  x;
@@ -1553,7 +1575,7 @@ class $t {
1553
1575
  this.x = t.x || 0, this.y = t.y || 0, this.width = t.width || 0, this.height = t.height || 0, this.src = t.src, this.redraw = t.redraw, this.img = this.loadImage(t.onload);
1554
1576
  }
1555
1577
  loadImage(t) {
1556
- const e = X[this.src];
1578
+ const e = B[this.src];
1557
1579
  if (e)
1558
1580
  return queueMicrotask(() => {
1559
1581
  t?.(e), this.redraw?.();
@@ -1561,7 +1583,7 @@ class $t {
1561
1583
  {
1562
1584
  const i = new Image();
1563
1585
  return i.crossOrigin = "anonymous", i.src = this.src, i.onload = () => {
1564
- X[this.src] = i, t?.(i), this.redraw?.();
1586
+ B[this.src] = i, t?.(i), this.redraw?.();
1565
1587
  }, i;
1566
1588
  }
1567
1589
  }
@@ -1574,7 +1596,7 @@ class $t {
1574
1596
  }
1575
1597
  }
1576
1598
  }
1577
- class Jt {
1599
+ class Ht {
1578
1600
  id = "";
1579
1601
  type = "point";
1580
1602
  x;
@@ -1594,8 +1616,8 @@ class Jt {
1594
1616
  t.beginPath(), t.arc(this.x, this.y, this.r * i, 0, 2 * Math.PI), t.fillStyle = this.backgroundColor, t.fill(), t.font = `${this.r * i}px Microsoft YaHei`, t.textAlign = "center", t.fillStyle = "#FFFFFF", t.fillText(this.text, this.x, this.y + this.r * i / 3), t.restore();
1595
1617
  }
1596
1618
  }
1597
- const B = {};
1598
- class qt {
1619
+ const F = {};
1620
+ class Qt {
1599
1621
  id = "";
1600
1622
  type = "issue";
1601
1623
  //轨迹点上的事件
@@ -1615,7 +1637,7 @@ class qt {
1615
1637
  this.id = t.id, this.x = t.x, this.y = t.y, this.width = t.width || 0, this.height = t.height || 0, this.index = t.index, this.pIndex = t.pIndex, this.parentId = t.parentId, this.count = t.count || 0, this.badgeR = 3, this.src = t.src, this.redraw = t.redraw, this.img = this.loadImage(t.onload);
1616
1638
  }
1617
1639
  loadImage(t) {
1618
- const e = B[this.src];
1640
+ const e = F[this.src];
1619
1641
  if (e)
1620
1642
  return queueMicrotask(() => {
1621
1643
  t?.(e), this.redraw?.();
@@ -1623,18 +1645,18 @@ class qt {
1623
1645
  {
1624
1646
  const i = new Image();
1625
1647
  return i.src = this.src, i.crossOrigin = "anonymous", i.onload = () => {
1626
- B[this.src] = i, t?.(i), this.redraw?.();
1648
+ F[this.src] = i, t?.(i), this.redraw?.();
1627
1649
  }, i;
1628
1650
  }
1629
1651
  }
1630
1652
  draw(t, e) {
1631
1653
  if (!this.img.complete) return;
1632
- const i = 1 / e.scale, n = this.width * i, o = this.height * i, r = this.x - n / 2, a = this.y - o, h = this.badgeR * i, l = h * 1.5;
1633
- t.save(), t.drawImage(this.img, r, a, n, o), t.beginPath(), this.count > 1 && (t.arc(this.x + n * 0.3, this.y - o * 0.8, h, 0, 2 * Math.PI), t.fillStyle = "red", t.fill(), t.font = `${l}px Microsoft YaHei`, t.textAlign = "center", t.fillStyle = "#FFFFFF", t.fillText(this.count.toString(), this.x + n * 0.3, this.y - o * 0.8 + h / 2)), t.restore();
1654
+ const i = 1 / e.scale, n = this.width * i, o = this.height * i, r = this.x - n / 2, a = this.y - o, c = this.badgeR * i, l = c * 1.5;
1655
+ t.save(), t.drawImage(this.img, r, a, n, o), t.beginPath(), this.count > 1 && (t.arc(this.x + n * 0.3, this.y - o * 0.8, c, 0, 2 * Math.PI), t.fillStyle = "red", t.fill(), t.font = `${l}px Microsoft YaHei`, t.textAlign = "center", t.fillStyle = "#FFFFFF", t.fillText(this.count.toString(), this.x + n * 0.3, this.y - o * 0.8 + c / 2)), t.restore();
1634
1656
  }
1635
1657
  }
1636
- const U = {};
1637
- class Wt {
1658
+ const Y = {};
1659
+ class Kt {
1638
1660
  type = "marker";
1639
1661
  x;
1640
1662
  y;
@@ -1650,7 +1672,7 @@ class Wt {
1650
1672
  this.x = t.x, this.y = t.y, this.url = t.url, this.width = t.width ?? 0, this.height = t.height ?? 0, this.anchor = t.anchor, this.scale = t.scale ?? 1, t.redraw && (this.redraw = t.redraw), t.beforeDraw && (this.beforeDraw = t.beforeDraw), this.img = this.loadImage(t.onload);
1651
1673
  }
1652
1674
  loadImage(t) {
1653
- const e = U[this.url];
1675
+ const e = Y[this.url];
1654
1676
  if (e)
1655
1677
  return queueMicrotask(() => {
1656
1678
  t?.(e), this.redraw?.();
@@ -1658,7 +1680,7 @@ class Wt {
1658
1680
  {
1659
1681
  const i = new Image();
1660
1682
  return i.src = this.url, i.crossOrigin = "anonymous", i.onload = () => {
1661
- U[this.url] = i, t?.(i), this.redraw?.();
1683
+ Y[this.url] = i, t?.(i), this.redraw?.();
1662
1684
  }, i;
1663
1685
  }
1664
1686
  }
@@ -1688,7 +1710,7 @@ class Wt {
1688
1710
  }
1689
1711
  }
1690
1712
  }
1691
- class Zt {
1713
+ class te {
1692
1714
  type = "radar";
1693
1715
  x;
1694
1716
  y;
@@ -1718,7 +1740,7 @@ class Zt {
1718
1740
  r.addColorStop(0, "rgba(180, 42, 42, 1)"), r.addColorStop(1, "rgba(180, 42, 42, 0.5)"), t.beginPath(), t.moveTo(this.x, this.y), t.arc(this.x, this.y, this.r * i, n, o), t.closePath(), t.fillStyle = r, t.fill(), t.restore();
1719
1741
  }
1720
1742
  }
1721
- class Vt {
1743
+ class ee {
1722
1744
  type = "region";
1723
1745
  x;
1724
1746
  y;
@@ -1739,8 +1761,8 @@ class Vt {
1739
1761
  }
1740
1762
  draw(t, e) {
1741
1763
  if (t.save(), t.beginPath(), t.globalAlpha = 0.3, t.fillStyle = this.backgroundColor, this.shape === "circle") {
1742
- const [{ x: i, y: n }, {}, { x: o, y: r }] = this.areaPoints, a = Math.abs(o - i) / 2, h = i + (o - i) / 2, l = n + (r - n) / 2;
1743
- t.arc(h, l, a, 0, 2 * Math.PI);
1764
+ const [{ x: i, y: n }, {}, { x: o, y: r }] = this.areaPoints, a = Math.abs(o - i) / 2, c = i + (o - i) / 2, l = n + (r - n) / 2;
1765
+ t.arc(c, l, a, 0, 2 * Math.PI);
1744
1766
  } else
1745
1767
  this.areaPoints.forEach((i, n) => {
1746
1768
  const { x: o, y: r } = i;
@@ -1750,38 +1772,38 @@ class Vt {
1750
1772
  }
1751
1773
  }
1752
1774
  export {
1753
- ht as APP_SETTING,
1775
+ lt as APP_SETTING,
1754
1776
  w as AppError,
1755
1777
  p as AppErrorCode,
1756
- at as AppObsType,
1778
+ ht as AppObsType,
1757
1779
  g as CRSTypes,
1758
- _t as CanvasElement,
1759
- $t as CanvasImageElement,
1760
- qt as CanvasIssueElement,
1761
- Wt as CanvasMarkerElement,
1762
- Jt as CanvasPointElement,
1763
- Zt as CanvasRadarElement,
1764
- Vt as CanvasRegionElement,
1765
- R as Coordinate,
1766
- rt as CoordinateLevel,
1780
+ Zt as CanvasElement,
1781
+ Vt as CanvasImageElement,
1782
+ Qt as CanvasIssueElement,
1783
+ Kt as CanvasMarkerElement,
1784
+ Ht as CanvasPointElement,
1785
+ te as CanvasRadarElement,
1786
+ ee as CanvasRegionElement,
1787
+ G as Coordinate,
1788
+ ct as CoordinateLevel,
1767
1789
  P as CoordinateModelType,
1768
- G as CoordinateStatus,
1790
+ A as CoordinateStatus,
1769
1791
  v as CoordinateType,
1770
- Yt as DataHelper,
1792
+ Wt as DataHelper,
1771
1793
  m as DataSource,
1772
1794
  C as GeoPoint,
1773
- Y as LocaleType,
1774
- ut as MAP_PROVIDERS,
1795
+ _ as LocaleType,
1796
+ ft as MAP_PROVIDERS,
1775
1797
  f as Point,
1776
- it as Position,
1777
- lt as REQUEST_CONFIG,
1778
- ct as REQUEST_OPTIONS,
1798
+ ot as Position,
1799
+ dt as REQUEST_CONFIG,
1800
+ ut as REQUEST_OPTIONS,
1779
1801
  y as RelativeMap,
1780
1802
  L as RequestContentType,
1781
1803
  M as RequestMethod,
1782
- F as RequestResultCode,
1783
- nt as Vector3,
1784
- Ut as api,
1785
- Bt as http,
1786
- Ft as utils
1804
+ $ as RequestResultCode,
1805
+ rt as Vector3,
1806
+ Jt as api,
1807
+ _t as http,
1808
+ qt as utils
1787
1809
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(l,M){typeof exports=="object"&&typeof module<"u"?M(exports):typeof define=="function"&&define.amd?define(["exports"],M):(l=typeof globalThis<"u"?globalThis:l||self,M(l.Shared={}))})(this,(function(l){"use strict";var M=(s=>(s[s.CADModel=5]="CADModel",s[s.BIMModel=6]="BIMModel",s[s.ForgeModel=7]="ForgeModel",s[s.ThreeDModel=8]="ThreeDModel",s[s.GeoModel=9]="GeoModel",s[s.ScaleModel=101]="ScaleModel",s))(M||{}),_=(s=>(s[s.Global=0]="Global",s))(_||{}),S=(s=>(s[s.Space=0]="Space",s[s.Model=1]="Model",s[s.Data=2]="Data",s))(S||{}),R=(s=>(s[s.Used=0]="Used",s[s.Enabled=1]="Enabled",s[s.Disabled=2]="Disabled",s))(R||{}),j=(s=>(s[s.SUCCESS=200]="SUCCESS",s[s.ERROR=-1]="ERROR",s[s.TIMEOUT=401]="TIMEOUT",s))(j||{}),v=(s=>(s.GET="GET",s.POST="POST",s))(v||{}),O=(s=>(s.JSON="application/json",s.FORM_URLENCODED="application/x-www-form-urlencoded;charset=UTF-8",s.FORM_DATA="multipart/form-data;charset=UTF-8",s.OCTET_STREAM="'application/octet-stream",s))(O||{}),$=(s=>(s.Hw="huawei",s.Ali="aliyun",s.Hs="hs",s.Aws="amazon",s.Minio="minio",s))($||{}),k=(s=>(s.en_US="en-US",s.zh_CN="zh-CN",s.ja_JP="ja-JP",s))(k||{}),x=(s=>(s.WGS84="WGS84",s.WGS1984="WGS84",s.EPSG4326="WGS84",s.GCJ02="GCJ02",s.AMap="GCJ02",s.BD09="BD09",s.BD09LL="BD09",s.Baidu="BD09",s.BMap="BD09",s.BD09MC="BD09MC",s.BD09Meter="BD09MC",s.EPSG3857="EPSG3857",s.EPSG900913="EPSG3857",s.EPSG102100="EPSG3857",s.WebMercator="EPSG3857",s.WM="EPSG3857",s))(x||{}),g=(s=>(s[s.GeoPointNoPlane=9e3]="GeoPointNoPlane",s[s.PointUnmappedGIS=9010]="PointUnmappedGIS",s[s.PointNoXYZ=9011]="PointNoXYZ",s[s.PointNoPlane=9012]="PointNoPlane",s[s.RelativePlaneUnmatch=9020]="RelativePlaneUnmatch",s[s.RelativeNoPlane=9021]="RelativeNoPlane",s[s.RelativeJsonError=9022]="RelativeJsonError",s[s.RequestCodeError=9030]="RequestCodeError",s[s.RequestResultError=9031]="RequestResultError",s[s.RequestUnknownError=9032]="RequestUnknownError",s))(g||{});const q={baseUrl:"https://vsleem.com/api",authorizeCode:""},J={isTransformResponse:!0,joinBaseUrl:!0,withAuthorize:!0},W={url:"",method:v.GET,headers:{}},Z=[{name:"GAODE",patterns:["amap","amap.com","autonavi.com","restapi.amap.com","tiles.amap.com"],CRSTypes:[x.GCJ02,x.WGS84]},{name:"BAIDU",patterns:["baidu","baidu.com","bdimg.com"],CRSTypes:[x.BD09,x.WGS84]},{name:"TENCENT",patterns:["qq.com","map.qq.com","map.gtimg.com"],CRSTypes:[x.GCJ02,x.WGS84]},{name:"TIANDITU",patterns:["tianditu","tianditu.gov.cn"],CRSTypes:[x.WGS84,x.WGS84]},{name:"GOOGLE",patterns:["google","googleapis","google.com"],CRSTypes:[x.GCJ02,x.WGS84]},{name:"OPENSTREET",patterns:["openstreetmap","openstreetmap.org"],CRSTypes:[x.WGS84,x.WGS84]}];class m extends Error{constructor(t,e,i){super(e),this.code=t,this.message=e,this.details=i,this.name="Apprror",Object.setPrototypeOf(this,m.prototype)}toJSON(){return{code:this.code,message:this.message,details:this.details,timestamp:new Date().toISOString()}}}const V={...q};function dt(s){const{baseUrl:t,authorizeCode:e,locale:i}=s;Object.assign(V,{baseUrl:t,authorizeCode:e,locale:i})}async function P(s,t){const e={...J,...t},i={...W,...s};try{const n=ft(i,e),{url:o,...r}=n,h=await(await window.fetch(o,r)).json();return mt(h,e)}catch(n){return yt(n)}}function ft(s,t){const{baseUrl:e,authorizeCode:i,locale:n=k.zh_CN}=V,{joinBaseUrl:o,withAuthorize:r}=t;let{url:a,method:h,headers:u={},params:c,data:d}=s;o&&e&&(a=`${e}${a}`),h=h?.toUpperCase();const f={...u};if(/^https?:\/\/.+$/i.test(e??"")?f.PlatForm=new URL(e??"").host:f.PlatForm=new URL(window.location.href).host,r&&i&&(f.AuthorizationCode=i),h===v.POST&&!f["Content-Type"]&&(f["Content-Type"]=O.JSON),n&&(f["Accept-Language"]=n),h===v.GET&&c){const T=new URLSearchParams(c),Ht=a.includes("?")?"&":"?";a+=Ht+`${T.toString()}`}let E;return h===v.POST&&(E=f["Content-Type"]===O.JSON?JSON.stringify(d||{}):d),{url:a,method:h,headers:f,body:E}}function mt(s,t){if(!t.isTransformResponse)return s;if(!s)throw new m(g.RequestResultError,"请求返回的结果错误");const{code:e,data:i,msg:n}=s;if(e===j.SUCCESS)return i;throw new m(g.RequestCodeError,n||"请求返回的Code错误")}function yt(s){throw s instanceof Error?s:new m(g.RequestUnknownError,typeof s=="string"?s:"未知的请求错误")}const wt=Object.freeze(Object.defineProperty({__proto__:null,request:P,setRequestGlobalConfig:dt},Symbol.toStringTag,{value:"Module"}));function H(s,t){return P({url:"/project/jssdk/cs/list",method:v.GET,params:s},t)}function Q(s,t){return P({url:"/project/jssdk/cs/bind",method:v.POST,data:s},t)}function U(s,t){return P({url:"/project/jssdk/cs/save",method:v.POST,data:s},t)}function K(s,t){return P({url:"/project/jssdk/cs/delete",method:v.POST,data:s},t)}function tt(s,t){return P({url:"/project/jssdk/cs/mapping",method:v.POST,data:s},t)}function et(s,t){return P({url:"/project/jssdk/cs/mapping/query",method:v.GET,params:s},t)}function st(s,t){return P({url:"/project/jssdk/project/detail",method:v.GET,params:s},t)}function pt(s,t={isTransformResponse:!1,joinBaseUrl:!1,withAuthorize:!1}){return P({url:s,method:v.GET},t)}const gt=Object.freeze(Object.defineProperty({__proto__:null,bindCoordinate:Q,getCoordinateList:H,getImageInfo:pt,getMappingRelation:et,getProjectDetail:st,mapingCoordinate:tt,removeCoordinate:K,saveCoordinate:U},Symbol.toStringTag,{value:"Module"})),Mt=typeof window<"u",vt=Object.prototype.toString;function D(s,t){return vt.call(s)===`[object ${t}]`}function it(s){return typeof s<"u"}function nt(s){return!it(s)}function C(s){return s!==null&&D(s,"Object")}function ot(s){return s===null}function xt(s){return D(s,"Date")}function St(s){return D(s,"String")}function X(s){return typeof s=="function"}function bt(s){return D(s,"Boolean")}function Tt(s){return D(s,"RegExp")}function b(s){return s&&Array.isArray(s)}function Pt(s){return typeof window<"u"&&D(s,"Window")}function Et(s){return C(s)&&!!s.tagName}function G(s){return typeof s=="number"?!0:typeof s!="string"?!1:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/.test(s)}function Dt(s,t){return JSON.stringify(s)===JSON.stringify(t)}function Ct(s){return nt(s)||ot(s)}function Nt(s){return D(s,"Promise")&&C(s)&&X(s.then)&&X(s.catch)}function zt(s,t={}){return new Promise((e,i)=>{const n=N(s);if(It(n)){e(!0);return}const o=document.createElement("script");o.src=s,Object.entries(t).forEach(([r,a])=>{a!==!1&&o.setAttribute(r,a===!0?"":String(a))}),o.onload=()=>{e(!0)},o.onerror=()=>{document.head.removeChild(o),i(new Error(`Failed to load script: ${s}`))},document.head.appendChild(o)})}function It(s){const t=N(s);return Array.from(document.scripts).some(e=>N(e.src)===t)}function Rt(s){return new Promise((t,e)=>{const i=N(s);if(Ot(i)){t(!0);return}const n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=s,n.onload=()=>{t(!0)},n.onerror=()=>{document.head.removeChild(n),e(new Error(`Failed to load link: ${s}`))},document.head.appendChild(n)})}function Ot(s){const t=N(s);return Array.from(document.querySelectorAll('link[rel="stylesheet"]')).some(e=>N(e.href)===t)}function N(s){try{const t=new URL(s,window.location.href);return`${t.origin}${t.pathname}`}catch{return s}}function rt(s){return z(s,new WeakMap)}function z(s,t){if(typeof s!="object"||s===null)return s;if(t.has(s))return t.get(s);let e;if(s instanceof Date)return e=new Date(s),t.set(s,e),e;if(s instanceof RegExp)return e=new RegExp(s),t.set(s,e),e;if(s instanceof Map)return e=new Map,t.set(s,e),s.forEach((n,o)=>{e.set(o,z(n,t))}),e;if(s instanceof Set)return e=new Set,t.set(s,e),s.forEach(n=>{e.add(z(n,t))}),e;if(ArrayBuffer.isView(s))return e=new s.constructor(s.buffer.slice(0),s.byteOffset,s.byteLength),t.set(s,e),e;if(s instanceof ArrayBuffer)return e=s.slice(0),t.set(s,e),e;if(Array.isArray(s)){e=[],t.set(s,e);for(let n=0;n<s.length;n++)n in s&&(e[n]=z(s[n],t));return e}e=Object.create(Object.getPrototypeOf(s)),t.set(s,e);for(const n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=z(s[n],t));const i=Object.getOwnPropertySymbols(s);for(const n of i)Object.prototype.propertyIsEnumerable.call(s,n)&&(e[n]=z(s[n],t));return e}function Gt(s,t,e=!1){let i;const n=function(...o){const r=this,a=e&&!i;i&&clearTimeout(i),i=setTimeout(()=>{i=void 0,e||s.apply(r,o)},t),a&&s.apply(r,o)};return n.cancel=()=>{i&&clearTimeout(i),i=void 0},n}function At(s,t,e=!1){let i,n;const o=function(...r){const a=this;n?(clearTimeout(i),i=setTimeout(()=>{Date.now()-n>=t&&(s.apply(a,r),n=Date.now())},t-(Date.now()-n))):(e&&s.apply(a,r),n=Date.now())};return o.cancel=()=>{clearTimeout(i),i=void 0,n=void 0},o}function B(s,...t){if(!t.length)return s;const e=t.shift();return e===void 0?s:(A(s)&&A(e)&&Object.keys(e).forEach(i=>{const n=s[i],o=e[i];Array.isArray(n)&&Array.isArray(o)?s[i]=[...n,...o]:A(n)&&A(o)?s[i]=B({...n},o):o!==void 0&&(s[i]=o)}),B(s,...t))}function A(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function at(s,...t){if(!t.length)return s;for(const e of t)e!=null&&typeof e=="object"&&Object.keys(e).forEach(i=>{const n=e[i],o=s[i];n!==null&&typeof n=="object"&&!Array.isArray(n)?((!o||typeof o!="object")&&(s[i]={}),at(s[i],n)):s[i]=n});return s}function ht(s,t){const e={};if(C(s)&&!b(s)){for(const i in s)if(Object.prototype.hasOwnProperty.call(s,i)){const n=s[i],o=C(t)&&!b(t)?t[i]:void 0;if(!(i in(t||{})))e[i]=n;else if(b(n)&&b(o))JSON.stringify(n)!==JSON.stringify(o)&&(e[i]=n);else if(C(n)&&C(o)){const r=ht(n,o);r&&Object.keys(r).length>0&&(e[i]=r)}else n!==o&&(e[i]=n)}}if(C(t)&&b(t))for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&!(i in(s||{}))&&(e[i]=void 0);return e}function Lt(s){console.warn(`[warn]:${s}`)}function jt(s){throw new Error(`[error]:${s}`)}function kt(s){if(s)return Z.find(t=>t?.patterns?.some(e=>s.includes(e)))}function Ut(s,t,e,i){const n=Math.min(s/e,t/i),o=e*n,r=i*n;return{scale:n,x:(s-o)/2,y:(t-r)/2,sw:o,sh:r}}function Xt(s,t,e){return{x:s*e.scale+e.x,y:t*e.scale+e.y}}function Bt(s,t,e){return{x:(s-e.x)/e.scale,y:(t-e.y)/e.scale}}const Ft=Object.freeze(Object.defineProperty({__proto__:null,cloneDeep:rt,debounce:Gt,deepMerge:B,deepMergeProps:at,error:jt,getDiffProps:ht,getImageTransform:Ut,getMapProvider:kt,inBrowser:Mt,is:D,isArray:b,isBoolean:bt,isDate:xt,isDef:it,isElement:Et,isFunction:X,isNull:ot,isNullOrUnDef:Ct,isNumeric:G,isObject:C,isPromise:Nt,isRegExp:Tt,isSameValue:Dt,isString:St,isUnDef:nt,isWindow:Pt,loadCss:Rt,loadScript:zt,throttle:At,toCanvasCoord:Xt,toModelCoord:Bt,warn:Lt},Symbol.toStringTag,{value:"Module"}));class y{x=0;y=0;z=0;lat=0;lon=0;alt=0;yaw=0;pitch=0;roll=0;hasXYZ=!1;hasGeo=!1;hasAngle=!1;plane="xy";constructor(t){const{x:e,y:i,z:n,lat:o,lon:r,alt:a,yaw:h,pitch:u,roll:c,plane:d="xy"}=t||{};this.x=Number(e)||0,this.y=Number(i)||0,this.z=Number(n)||0,(this.x!==0||this.y!==0||this.z!==0)&&(this.plane=d,this.hasXYZ=!0),this.lat=Number(o)||0,this.lon=Number(r)||0,this.alt=Number(a)||0,(this.lat!==0||this.lon!==0||this.alt!==0)&&(this.hasGeo=!0),this.yaw=Number(h)||0,this.pitch=Number(u)||0,this.roll=Number(c)||0,(G(h)||G(u)||G(c))&&(this.hasAngle=!0)}static dist(t,e){return Math.hypot(t.x-e.x,t.y-e.y,t.z-e.z)}static distXZ(t,e){return Math.hypot(t.x-e.x,t.z-e.z)}static distXY(t,e){return Math.hypot(t.x-e.x,t.y-e.y)}static toRadians(t){return(Number(t)||0)*Math.PI/180}static toDegrees(t){return(Number(t)||0)*180/Math.PI}static angleXZ(t,e,i){const n={x:t.x-e.x,z:t.z-e.z},o={x:i.x-e.x,z:i.z-e.z},r=n.x*o.x+n.z*o.z,a=Math.sqrt(n.x**2+n.z**2),h=Math.sqrt(o.x**2+o.z**2),u=Math.max(-1,Math.min(1,r/(a*h))),d=Math.acos(u)*180/Math.PI;return Math.min(d,360-d)}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new y({x:e[0],y:e[1],z:e[2]})}}static toStringify(t){return t?`${t.x},${t.y},${t.z}`:""}projection(t,e,i){try{if(e?.id===i?.id)return new y(this);if(e?.modelType===M.GeoModel){const{refPoint:n}=e?.relativeMap||{};if(this.hasGeo&&n){const o=I.LLHToXYZ(this,n);return this.x=o.x,this.y=o.y,this.z=o.z,this.hasXYZ=!0,this.project(t)}throw new m(g.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}if(i?.modelType===M.GeoModel){const{refPoint:n}=i?.relativeMap||{},o=this.project(t);if(o?.hasXYZ&&n){const r=I.XYZToLLH(o,n);return o.lat=r.lat,o.lon=r.lon,o.alt=r.alt,o.hasGeo=!0,o}throw new m(g.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}return this.project(t)}catch(n){console.error(n);return}}project(t){if(!this.hasXYZ)throw new m(g.PointNoXYZ,"点没有xxz坐标信息");if(this.plane==="xz")return this.projectXZ(t);if(this.plane==="xy")return this.projectXY(t);throw new m(g.PointNoPlane,"点的plane应为xz或xy")}projectXZ(t){const e=new y(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const i=e.x*Math.cos(t.yaw)-e.z*Math.sin(t.yaw),n=e.x*Math.sin(t.yaw)+e.z*Math.cos(t.yaw);return e.x=i+t.x,e.y+=t.y,e.z=n+t.z,e}projectXY(t){const e=new y(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const i=e.x*Math.cos(t.yaw)-e.y*Math.sin(t.yaw),n=e.x*Math.sin(t.yaw)+e.y*Math.cos(t.yaw);return e.x=i+t.x,e.y=n+t.y,e.z+=t.z,e}}class I{lat=0;lon=0;alt=0;constructor(t){const{lat:e=0,lon:i=0,alt:n=0}=t||{};this.lat=Number(e)||0,this.lon=Number(i)||0,this.alt=Number(n)||0}static XYZToLLH(t,e){const n=.0033528106647474805,o=n*(2-n),r=y.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt;let h,u,c;if(t.plane==="xz"){const d=t.x/1e3/(a*Math.cos(r)),f=t.z/1e3/a;h=e.lon+y.toDegrees(d),u=e.lat-y.toDegrees(f),c=e.alt+t.y/1e3}else if(t.plane==="xy"){const d=t.x/1e3/(a*Math.cos(r)),f=t.y/1e3/a;h=e.lon+y.toDegrees(d),u=e.lat-y.toDegrees(f),c=e.alt+t.z/1e3}else throw new m(g.GeoPointNoPlane,"点的plane应为xz或xy");return new I({lat:u,lon:h,alt:c})}static LLHToXYZ(t,e){const n=.0033528106647474805,o=n*(2-n),r=y.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt,h=y.toRadians(t.lon-e.lon),u=y.toRadians(e.lat-t.lat),c=a*h*Math.cos(r),d=a*u;if(t.plane==="xz")return new y({x:c*1e3,y:t.alt*1e3,z:d*1e3,plane:"xz"});if(t.plane==="xy")return new y({x:c*1e3,y:d*1e3,z:t.alt*1e3,plane:"xy"});throw new m(g.GeoPointNoPlane,"点的plane应为xz或xy")}}class w{scale=1;yaw=0;x=0;y=0;z=0;start=0;end=-1;plane="xy";refPoint;constructor(t){const{refPoint:e,...i}=t||{};e&&(this.refPoint=new I(e)),Object.assign(this,i)}static addRelativeMap(t,e){if(t.plane!==e.plane)throw new m(g.RelativePlaneUnmatch,"两个映射关系的plane应该相同");const i=t.scale*e.scale,n=t.yaw+e.yaw,o=Math.cos(e.yaw),r=Math.sin(e.yaw);let a=0,h=0,u=0;if(t.plane==="xz"){const c=t.x*o-t.z*r,d=t.y,f=t.x*r+t.z*o;a=e.x+c*e.scale,h=e.y+d*e.scale,u=e.z+f*e.scale}else if(t.plane==="xy"){const c=t.x*o-t.y*r,d=t.x*r+t.y*o,f=t.z;a=e.x+c*e.scale,h=e.y+d*e.scale,u=e.z+f*e.scale}else throw new m(g.RelativeNoPlane,"映射关系的plane应为xz或xy");return new w({scale:i,yaw:n,x:a,y:h,z:u,start:t.start,end:t.end,plane:t.plane})}static inverseRelativeMap(t){const e=1/t.scale,i=-t.yaw,n=Math.cos(-i),o=Math.sin(-i);let r=0,a=0,h=0;if(t.plane==="xz")r=-(t.x*n+t.z*o)*e,a=-t.y*e,h=-(t.z*n-t.x*o)*e;else if(t.plane==="xy")r=-(t.x*n+t.y*o)*e,a=-(t.y*n-t.x*o)*e,h=-t.z*e;else throw new m(g.RelativeNoPlane,"映射关系的plane应为xz或xy");return new w({scale:e,yaw:i,x:r,y:a,z:h,start:t.start,end:t.end,plane:t.plane})}static toParse(t){try{let e=t?JSON.parse(t):void 0;const{reference_point:i}=e||{};return i&&(e={refPoint:i}),e?new w(e):void 0}catch{throw new m(g.RelativeJsonError,"relativeMap格式化失败")}}static toStringify(t){return t?JSON.stringify(t):void 0}static isValid(t){return t&&t!=='{"scale":1.0, "yaw":0.0, "x":0.0, "y":0.0, "z":0.0}'}}class p{static async getProjectDetail(t){return await st({projectId:t})}static async getCoordinateTree(t){const e=await H({projectId:t});if(e.length){const i=p.handleCoordinateList(e);return p.buildCoordinateTree(i,0)}}static parsedCoordinateTree(t){const e=p.flattenCoordinateTree(t);return p.buildCoordinateTree(e,0)}static async addCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:h,modelType:u,relativeMap:c,level:d,...f}=a,E=c?JSON.stringify(c):void 0;return{...f,projectId:i,parentId:n,coordinateType:h,renderType:u,relativePosition:E}}),r=await U(o);return p.handleCoordinateList(r)}static async removeCoordinate(t,e){const i=e.map(n=>n.id??-1);return await K(i)}static async updateCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:h,relativeMap:u,level:c,...d}=a,f=w.toStringify(u);return{...d,relativePosition:f,projectId:i,parentId:n}}),r=await U(o);return p.handleCoordinateList(r)}static async bindCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{modelId:h}=a;return{modelId:h,parentId:n,projectId:i}}),r=await Q(o);return p.handleCoordinateList(r)}static handleCoordinateList(t){return t?.map(e=>{const{coordinateType:i,modelKey:n,renderType:o,relativePosition:r,...a}=e,h=o===M.GeoModel?new w(w.toParse(r)):w.toParse(r);return new L({...a,type:i,modelType:o,modelValue:n,relativeMap:h})})}static flattenCoordinateTree(t){const e=Array.isArray(t)?t:[t],i=[];function n(o){for(const r of o){const{level:a,parent:h,relativeMap:u,...c}=r,d=new L({...c,relativeMap:new w(u)});i.push(d),r.children&&r.children.length>0&&n(r.children)}}return n(e),i}static buildCoordinateTree(t,e=0){const i=new Map,n=[];return t.forEach(o=>{i.set(String(o.id),o)}),t.forEach(o=>{const r=i.get(String(o.id));if(r)if(o.parentId===e)r.level=0,n.push(r);else{const a=i.get(String(o.parentId??-1));a&&(r.type===S.Space&&(r.level=(Number(a.level)||0)+1),r.parent=a,a.children?.push(r))}}),n.forEach(p.sortCoordinateTree),n[0]}static sortCoordinateTree(t){t.children&&(t.children.sort((e,i)=>{if(e.type===S.Space){const n=Number(i?.relativeMap?.z)-Number(e?.relativeMap?.z);return n!==0?n:Number(i.createTime)-Number(e.createTime)}else return e.status===0&&i.status!==0?-1:i.status===0&&e.status!==0?1:Number(i.createTime)-Number(e.createTime)}),t.children.forEach(p.sortCoordinateTree))}static filterSpaceTree(t,e){const i=[];return t.forEach(n=>{const o=new L(n);e&&(o.parent=e);const r=p.filterSpaceTree(o.children,o);o.children=r,o.disabled=o.disabled??!1,o.type!==S.Model&&i.push(o)}),i}}class L{id=0;type=0;children=[];level;relativeMap;no;name;shortName;status;modelId;modelType;modelValue;projectId;parentId;parent;groupUuid;z;createTime;disabled;constructor(t){this.setOptions(t)}get spaceList(){return this.children.filter(t=>t.type===S.Space)}get modelList(){return this.children.filter(t=>t.type===S.Model)}get fullName(){const t=this.name?`(${this.name})`:"";return this.shortName?`${this.shortName}${t}`:this.name??""}setOptions(t){const{relativeMap:e,parent:i,children:n,...o}=t||{};e&&(this.relativeMap=new w(e)),i&&(this.parent=i),n?.length&&(this.children=n),Object.assign(this,o)}async addChild(t){const e=b(t)?t:[t],i=await p.addCoordinate(this,e);return this.mergeChild(i),i}async removeChild(t){const e=b(t)?t:[t];await p.removeCoordinate(this,e);for(const i of e){const n=this.children.findIndex(o=>o.id===i.id);n!==-1&&this.children.splice(n,1)}}async updateChild(t){const e=b(t)?t:[t],i=await p.updateCoordinate(this,e);return this.mergeChild(i),i}async bindChild(t){const e=b(t)?t:[t],i=await p.bindCoordinate(this,e);return this.mergeChild(i),i}async mergeChild(t){t?.length&&t.forEach(e=>{const i=this.children.find(n=>n.id===e.id);if(i){const{relativeMap:n,no:o,name:r,shortName:a,status:h,modelId:u,modelValue:c}=e;Object.assign(i,{relativeMap:n,no:o,name:r,shortName:a,status:h,modelId:u,modelValue:c})}else this.id===e.parentId&&(e.parent=this,this.children.unshift(e))})}async mappingTo(t){await tt(t)}async getMapping(){return(await et({srcCsId:this.id}))[0]}findRoot(t=!1){let e=this;for(;e.parent&&!(t&&!e.relativeMap);)e=e.parent;return e}findChildModel(t,e=!0){const i=b(t)?t:[t];return i.includes(this.modelType??-1)&&this.status!==R.Disabled?this:([S.Data,S.Model].includes(this.type)?this.findParentSpace():this)?.modelList?.filter(a=>i.includes(a.modelType??-1)?e?!!a.relativeMap:!0:!1)?.sort((a,h)=>Number(a.status)-Number(h.status))?.[0]}findClosestModel(t=[M.CADModel,M.BIMModel,M.ForgeModel,M.ThreeDModel,M.GeoModel],e){const i=b(t)?t:[t],n=new Set;e?.forEach(c=>{n.add(String(c.id))});const o=[{node:this,distance:0}],r=new Set,a=[];for(;o.length>0;){const{node:c,distance:d}=o.shift();if(n.has(String(c.id))||r.has(c))continue;const f=c.modelType??-1;i.includes(f)&&a.push({node:c,distance:d,modelType:f}),r.add(c);const E=[];if(c.children)for(const T of c.children)r.has(T)||E.push(T);if(c.parent?.children)for(const T of c.parent.children)T!==c&&!r.has(T)&&E.push(T);c.parent&&!r.has(c.parent)&&E.push(c.parent);for(const T of E)o.push({node:T,distance:d+1})}if(a.length===0)return;const h=Math.min(...a.map(c=>c.distance)),u=a.filter(c=>c.distance===h);return u.sort((c,d)=>c.modelType-d.modelType),u[0]?.node}findParentSpace(){let t=this;for(;t&&t.type!==S.Space;)t=t.parent;return t}findParentSpaceNames(t=2){const e=[];let i=this;for(;i&&t>0;)i.type===S.Space&&(e.unshift(i.fullName),t--),i=i.parent;return e}findCsGroup(){const{groupUuid:t,parent:e}=this;return t?e?.children?.filter(i=>i.groupUuid===t)||[]:[]}findCsByLevel(t){if(this.level===t)return this;if(this.children.length)for(const e of this.children){const i=e.findCsByLevel(t);if(i)return i}}findCsById(t){if(t){if(this.id===t)return this;for(const e of this.children){const i=e.findCsById(t);if(i)return i}}}getCsRoutes(t=!1){let e=this;const i=[e];for(;e?.parent&&!(t&&!e.relativeMap);)e=e.parent,e&&i.push(e);return i}getMappedCsTree(){function t(n){return n.children?.length&&(n.children=n.children.filter(o=>!!o?.relativeMap&&o.status!==R.Disabled).map(o=>t(o))),n}const e=rt(this.findRoot(!0)),i=t(e);return i.parentId=0,i.parent=void 0,i}getDestRelativeMap(t){if(this.id===t.id)return new w;const e=this.getRelativeMaps(),i=t.getRelativeMaps();let n=new w;return e?.forEach(o=>{n=w.addRelativeMap(n,o)}),i?.reverse()?.forEach(o=>{n=w.addRelativeMap(n,w.inverseRelativeMap(o))}),n}getRelativeMaps(){let t=this;const e=[];for(;t?.parent&&t.relativeMap;)e.push(t.relativeMap),t=t.parent;return e}static filterCoordinateTree(t,e=[],i=[]){if(i.includes(t.id)||e.includes(t.type))return;const n=t.children?.map(o=>this.filterCoordinateTree(o,e,i)).filter(o=>o!==void 0);return{...t,children:n}}static getCommonCoordinate(t){let e;const i=t.map(n=>n.getCsRoutes(!0).filter(r=>r.id&&r.type===S.Space));for(;this.checkSameCoordinate(i);){const o=i.shift();o?.length&&(e=o[0])}return e}static checkSameCoordinate(t){if(t.length){if(t.length===1)return!0;for(let e=0;e<t.length-1;e++){const i=t[e];if(!i?.length)return!1;const n=t[e+1];if(!n?.length||i[0].id!==n[0].id)return!1}return!0}else return!1}}class F{yaw=0;pitch=0;roll=0;constructor(t){const{yaw:e=0,pitch:i=0,roll:n=0}=t||{};this.yaw=Number(e)||0,this.pitch=Number(i)||0,this.roll=Number(n)||0}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new F({yaw:e[0],pitch:e[1],roll:e[2]})}}static toStringify(t){return t?`${t.yaw},${t.pitch},${t.roll}`:""}}class Y{x=0;y=0;z=0;constructor(t){const{x:e=0,y:i=0,z:n=0}=t||{};this.x=Number(e)||0,this.y=Number(i)||0,this.z=Number(n)||0}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new Y({x:e[0],y:e[1],z:e[2]})}}static toStringify(t){return t?`${t.x},${t.y},${t.z}`:""}}class Yt{static srcPointToDstPoint(t,e,i){if(!e||!i||!t?.length)return[];const n=e?.getDestRelativeMap(i);if(!n)return[];const o=[];return t.forEach(r=>{const a=r.projection(n,e,i);a&&o.push(a)}),o}}class _t{canvas;ctx;options;offset={x:0,y:0};curOffset={x:0,y:0};mousePosition={x:-1,y:-1};MAX_SCALE=60;MIN_SCALE=1;STEP_SCALE=.5;scale=1;preScale=1;width=0;height=0;x=0;y=0;timeout=0;lastTouch;initialDistance=0;touchMode=0;isMouseover=!1;isBindEvent=!0;isDrawAssist=!1;customDrawAssist;isMoveRedrawing;afterDraw;screenPos={screenX:0,screenY:0};constructor(t){const{container:e,width:i=300,height:n=300,isBindEvent:o=!0,isDrawAssist:r=!1,isMoveRedrawing:a,customDrawAssist:h,afterDraw:u,...c}=t;this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.width=i,this.height=n,this.canvas.width=i,this.canvas.height=n,this.isBindEvent=o,this.isDrawAssist=r,this.customDrawAssist=h,this.isMoveRedrawing=a??r,this.options=c,this.onMousedown=this.onMousedown.bind(this),this.onMousemove=this.onMousemove.bind(this),this.onMousemoveTemp=this.onMousemoveTemp.bind(this),this.onMouseup=this.onMouseup.bind(this),this.onMousewheel=this.onMousewheel.bind(this),this.onDblclick=this.onDblclick.bind(this),this.onTouchstart=this.onTouchstart.bind(this),this.onTouchmove=this.onTouchmove.bind(this),this.onTouchend=this.onTouchend.bind(this),this.onMouseout=this.onMouseout.bind(this),this.afterDraw=this.afterDraw,o&&(this.canvas.addEventListener("DOMMouseScroll",this.onMousewheel),this.canvas.addEventListener("mousewheel",this.onMousewheel),this.canvas.addEventListener("mousedown",this.onMousedown),this.canvas.addEventListener("mousemove",this.onMousemove),this.canvas.addEventListener("mouseout",this.onMouseout),this.canvas.addEventListener("dblclick",this.onDblclick),this.canvas.addEventListener("touchstart",this.onTouchstart))}onClick(t){const{screenX:e,screenY:i}=t;this.timeout&&clearTimeout(this.timeout);const n=this.getPos(t);this.x=n.x,this.y=n.y,this.screenPos={screenX:e,screenY:i},this.options.onClick&&(this.timeout=setTimeout(()=>{const o=parseFloat(((this.x-this.offset.x)/this.scale).toFixed(2)),r=parseFloat(((this.y-this.offset.y)/this.scale).toFixed(2));this.options.onClick(o,r)},200))}onMouseout(t){this.isMouseover=!1,this.draw()}onTouchstart(t){t.preventDefault(),t.touches.length==1?this.touchMode===0&&(this.touchMode=1):t.touches.length>=2&&this.touchMode<2&&(this.touchMode=2),this.touchMode==1&&t.touches.length==1?this.onTouch(t.touches[0]):this.touchMode==2&&t.touches.length==2&&this.onBothTouchstart(t),this.canvas.addEventListener("touchmove",this.onTouchmove),this.canvas.addEventListener("touchend",this.onTouchend)}onMousedown(t){this.onClick(t),this.canvas.addEventListener("mousemove",this.onMousemoveTemp),this.canvas.addEventListener("mouseup",this.onMouseup)}onBothTouchstart(t){t.preventDefault();const e={x:t.touches[0].clientX,y:t.touches[0].clientY},i={x:t.touches[1].clientX,y:t.touches[1].clientY},n=this.getPos({clientX:(e.x+i.x)/2,clientY:(e.y+i.y)/2});this.x=n.x,this.y=n.y,this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y,this.initialDistance=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2))}onTouchmove(t){t.preventDefault(),this.touchMode==1&&t.touches.length==1?(this.onMousemoveTemp(t.touches[0]),this.onMousemove(t.touches[0])):this.touchMode==2&&t.touches.length==2&&this.onBothTouchmove(t)}onMousemove(t){const e=this.getPos(t);this.mousePosition.x=e.x,this.mousePosition.y=e.y,this.isMouseover=!0,this.isMoveRedrawing&&this.draw()}onMousemoveTemp(t){const{screenX:e,screenY:i}=this.screenPos;(Math.abs(e-t.screenX)>10||Math.abs(i-t.screenY)>10)&&(this.timeout&&clearTimeout(this.timeout),this.offset.x=this.curOffset.x+(this.mousePosition.x-this.x),this.offset.y=this.curOffset.y+(this.mousePosition.y-this.y),!this.isMoveRedrawing&&this.draw())}onBothTouchmove(t){if(t.preventDefault(),this.initialDistance){const e={x:t.touches[0].clientX,y:t.touches[0].clientY},i={x:t.touches[1].clientX,y:t.touches[1].clientY},n=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2));if(this.scale+=(n-this.initialDistance)/30*this.STEP_SCALE,this.initialDistance=n,this.scale>this.MAX_SCALE){this.scale=this.MAX_SCALE;return}if(this.scale<this.MIN_SCALE){this.scale=this.MIN_SCALE;return}this.zoom()}}onTouchend(){this.touchMode=0,this.onMouseup()}onMouseup(){this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y,this.canvas.removeEventListener("mousemove",this.onMousemoveTemp),this.canvas.removeEventListener("mouseup",this.onMouseup),this.canvas.removeEventListener("touchmove",this.onTouchmove),this.canvas.removeEventListener("touchend",this.onTouchend)}onMousewheel(t){this.timeout&&clearTimeout(this.timeout),t.preventDefault();const e=this.getPos(t);this.x=e.x,this.y=e.y;const i=t.wheelDelta>0||t.detail<0?this.STEP_SCALE:-this.STEP_SCALE;if(this.scale=parseFloat((this.scale+i).toFixed(2)),this.scale>this.MAX_SCALE){this.scale=this.MAX_SCALE;return}if(this.scale<this.MIN_SCALE){this.scale=this.MIN_SCALE;return}this.zoom()}onTouch(t){const e=Date.now(),{lastTouchTime:i=0,lastTouchX:n=0,lastTouchY:o=0}=this.lastTouch||{};e-i<300&&Math.abs(t.clientX-n)<30&&Math.abs(t.clientY-o)<30?(this.onDblclick(t),this.lastTouch={lastTouchTime:0,lastTouchX:0,lastTouchY:0}):(this.onClick(t),this.lastTouch={lastTouchTime:e,lastTouchX:t.clientX,lastTouchY:t.clientY})}onDblclick(t){this.timeout&&clearTimeout(this.timeout),this.reset(),this.draw()}zoom(){this.offset.x=this.x-(this.x-this.offset.x)*this.scale/this.preScale,this.offset.y=this.y-(this.y-this.offset.y)*this.scale/this.preScale,this.draw(),this.preScale=this.scale,this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y}reset(t){const{width:e=this.width,height:i=this.height,scale:n=1,preScale:o=1,offset:r={x:0,y:0},curOffset:a={x:0,y:0}}=t||{};this.width=e,this.height=i,this.canvas.width=e,this.canvas.height=i,this.scale=n,this.preScale=o,this.offset=r,this.curOffset=a}drawAssist(){const t=this.ctx;t.save(),t.beginPath(),t.lineWidth=1,t.strokeStyle="#C656D5",t.moveTo(0,this.mousePosition.y),t.lineTo(this.width,this.mousePosition.y),t.closePath(),t.stroke(),t.beginPath(),t.moveTo(this.mousePosition.x,0),t.lineTo(this.mousePosition.x,this.height),t.closePath(),t.stroke(),t.restore()}draw(){this.ctx.clearRect(0,0,this.width,this.height),this.ctx.save(),this.ctx.translate(this.offset.x,this.offset.y),this.ctx.scale(this.scale,this.scale),this.options.draw(this.ctx,this),this.ctx.restore(),this.isDrawAssist&&this.isMouseover&&(this.customDrawAssist?this.customDrawAssist():this.drawAssist()),this.afterDraw?.(this.ctx,this)}getPos(t){const e=this.canvas.getBoundingClientRect();let i=parseFloat((t.clientX-e.left).toFixed(2)),n=parseFloat((t.clientY-e.top).toFixed(2));return i=i<0?0:i,n=n<0?0:n,{x:i,y:n}}unBindEvent(){this.isBindEvent&&(this.canvas.removeEventListener("mousemove",this.onMousemove),this.canvas.removeEventListener("DOMMouseScroll",this.onMousewheel),this.canvas.removeEventListener("mousewheel",this.onMousewheel),this.canvas.removeEventListener("mousedown",this.onMousedown),this.canvas.removeEventListener("mouseout",this.onMouseout),this.canvas.removeEventListener("dblclick",this.onDblclick))}}const ct={};class $t{type="image";x;y;width;height;img;src;redraw;constructor(t){this.x=t.x||0,this.y=t.y||0,this.width=t.width||0,this.height=t.height||0,this.src=t.src,this.redraw=t.redraw,this.img=this.loadImage(t.onload)}loadImage(t){const e=ct[this.src];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.crossOrigin="anonymous",i.src=this.src,i.onload=()=>{ct[this.src]=i,t?.(i),this.redraw?.()},i}}draw(t){try{if(!this.img.complete)return;t.save(),t.drawImage(this.img,this.x,this.y,this.width,this.height),t.restore()}catch(e){console.error(e)}}}class qt{id="";type="point";x;y;r;text;backgroundColor;index;pIndex;parentId;constructor(t){this.id=t.id,this.x=t.x,this.y=t.y,this.r=t.r||15,this.text=t.text||"",this.index=t.index,this.pIndex=t.pIndex,this.parentId=t.parentId,this.backgroundColor=t.backgroundColor||"rgba(91, 179, 111, 0.8)"}draw(t,e){t.save();const i=1/e.scale;t.beginPath(),t.arc(this.x,this.y,this.r*i,0,2*Math.PI),t.fillStyle=this.backgroundColor,t.fill(),t.font=`${this.r*i}px Microsoft YaHei`,t.textAlign="center",t.fillStyle="#FFFFFF",t.fillText(this.text,this.x,this.y+this.r*i/3),t.restore()}}const lt={};class Jt{id="";type="issue";x;y;width;height;src;img;index;pIndex;parentId;count;badgeR;redraw;constructor(t){this.id=t.id,this.x=t.x,this.y=t.y,this.width=t.width||0,this.height=t.height||0,this.index=t.index,this.pIndex=t.pIndex,this.parentId=t.parentId,this.count=t.count||0,this.badgeR=3,this.src=t.src,this.redraw=t.redraw,this.img=this.loadImage(t.onload)}loadImage(t){const e=lt[this.src];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.src=this.src,i.crossOrigin="anonymous",i.onload=()=>{lt[this.src]=i,t?.(i),this.redraw?.()},i}}draw(t,e){if(!this.img.complete)return;const i=1/e.scale,n=this.width*i,o=this.height*i,r=this.x-n/2,a=this.y-o,h=this.badgeR*i,u=h*1.5;t.save(),t.drawImage(this.img,r,a,n,o),t.beginPath(),this.count>1&&(t.arc(this.x+n*.3,this.y-o*.8,h,0,2*Math.PI),t.fillStyle="red",t.fill(),t.font=`${u}px Microsoft YaHei`,t.textAlign="center",t.fillStyle="#FFFFFF",t.fillText(this.count.toString(),this.x+n*.3,this.y-o*.8+h/2)),t.restore()}}const ut={};class Wt{type="marker";x;y;url;width;height;anchor;img;scale;redraw;beforeDraw;constructor(t){this.x=t.x,this.y=t.y,this.url=t.url,this.width=t.width??0,this.height=t.height??0,this.anchor=t.anchor,this.scale=t.scale??1,t.redraw&&(this.redraw=t.redraw),t.beforeDraw&&(this.beforeDraw=t.beforeDraw),this.img=this.loadImage(t.onload)}loadImage(t){const e=ut[this.url];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.src=this.url,i.crossOrigin="anonymous",i.onload=()=>{ut[this.url]=i,t?.(i),this.redraw?.()},i}}calculateIconPosition(){const t=this.anchor?.x??this.width/2,e=this.anchor?.y??this.height/2;return{iconStartX:this.x-t*this.scale,iconStartY:this.y-e*this.scale}}draw(t,e){if(this.beforeDraw?.(t,e),!this.img?.complete)return;const{iconStartX:i,iconStartY:n}=this.calculateIconPosition();t.save();try{t.drawImage(this.img,i,n,this.width*this.scale,this.height*this.scale)}catch(o){console.error("绘制标记时出错:",o)}finally{t.restore()}}}class Zt{type="radar";x;y;r;angle;text;hFov=90;beforeDraw;constructor(t){this.x=t.x,this.y=t.y,this.r=t.r||15,this.angle=t.angle||0,this.text=t.text||"",this.hFov=t.fovh||90,this.beforeDraw=t.beforeDraw}draw(t,e){this.beforeDraw?.(t,e);const i=1/e.scale,[n,o]=[(this.angle-this.hFov/2)/180*Math.PI,(this.angle+this.hFov/2)/180*Math.PI];t.save();const r=t.createRadialGradient(this.x,this.y,0,this.x,this.y,this.r*i);r.addColorStop(0,"rgba(180, 42, 42, 1)"),r.addColorStop(1,"rgba(180, 42, 42, 0.5)"),t.beginPath(),t.moveTo(this.x,this.y),t.arc(this.x,this.y,this.r*i,n,o),t.closePath(),t.fillStyle=r,t.fill(),t.restore()}}class Vt{type="region";x;y;shape;areaPoints;backgroundColor;constructor(t){if(this.x=t.x,this.y=t.y,this.shape=t.shape||"",this.backgroundColor=t.backgroundColor,t.areaPoints.length===2){const[{x:e,y:i},{},{x:n,y:o}]=t.areaPoints;this.areaPoints=[{x:Math.min(e,n),y:Math.min(i,o)},{x:Math.max(e,n),y:Math.min(i,o)},{x:Math.max(e,n),y:Math.max(i,o)},{x:Math.min(e,n),y:Math.max(i,o)}]}else this.areaPoints=t.areaPoints}draw(t,e){if(t.save(),t.beginPath(),t.globalAlpha=.3,t.fillStyle=this.backgroundColor,this.shape==="circle"){const[{x:i,y:n},{},{x:o,y:r}]=this.areaPoints,a=Math.abs(o-i)/2,h=i+(o-i)/2,u=n+(r-n)/2;t.arc(h,u,a,0,2*Math.PI)}else this.areaPoints.forEach((i,n)=>{const{x:o,y:r}=i;n===0?t.moveTo(o,r):t.lineTo(o,r)});t.fill(),t.restore()}}l.APP_SETTING=q,l.AppError=m,l.AppErrorCode=g,l.AppObsType=$,l.CRSTypes=x,l.CanvasElement=_t,l.CanvasImageElement=$t,l.CanvasIssueElement=Jt,l.CanvasMarkerElement=Wt,l.CanvasPointElement=qt,l.CanvasRadarElement=Zt,l.CanvasRegionElement=Vt,l.Coordinate=L,l.CoordinateLevel=_,l.CoordinateModelType=M,l.CoordinateStatus=R,l.CoordinateType=S,l.DataHelper=Yt,l.DataSource=p,l.GeoPoint=I,l.LocaleType=k,l.MAP_PROVIDERS=Z,l.Point=y,l.Position=F,l.REQUEST_CONFIG=W,l.REQUEST_OPTIONS=J,l.RelativeMap=w,l.RequestContentType=O,l.RequestMethod=v,l.RequestResultCode=j,l.Vector3=Y,l.api=gt,l.http=wt,l.utils=Ft,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(l,M){typeof exports=="object"&&typeof module<"u"?M(exports):typeof define=="function"&&define.amd?define(["exports"],M):(l=typeof globalThis<"u"?globalThis:l||self,M(l.Shared={}))})(this,(function(l){"use strict";var M=(s=>(s[s.CADModel=5]="CADModel",s[s.BIMModel=6]="BIMModel",s[s.ForgeModel=7]="ForgeModel",s[s.ThreeDModel=8]="ThreeDModel",s[s.GeoModel=9]="GeoModel",s[s.ScaleModel=101]="ScaleModel",s))(M||{}),$=(s=>(s[s.Global=0]="Global",s))($||{}),S=(s=>(s[s.Space=0]="Space",s[s.Model=1]="Model",s[s.Data=2]="Data",s))(S||{}),R=(s=>(s[s.Used=0]="Used",s[s.Enabled=1]="Enabled",s[s.Disabled=2]="Disabled",s))(R||{}),j=(s=>(s[s.SUCCESS=200]="SUCCESS",s[s.ERROR=-1]="ERROR",s[s.TIMEOUT=401]="TIMEOUT",s))(j||{}),v=(s=>(s.GET="GET",s.POST="POST",s))(v||{}),O=(s=>(s.JSON="application/json",s.FORM_URLENCODED="application/x-www-form-urlencoded;charset=UTF-8",s.FORM_DATA="multipart/form-data;charset=UTF-8",s.OCTET_STREAM="'application/octet-stream",s))(O||{}),q=(s=>(s.Hw="huawei",s.Ali="aliyun",s.Hs="hs",s.Aws="amazon",s.Minio="minio",s))(q||{}),k=(s=>(s.en_US="en-US",s.zh_CN="zh-CN",s.ja_JP="ja-JP",s))(k||{}),x=(s=>(s.WGS84="WGS84",s.WGS1984="WGS84",s.EPSG4326="WGS84",s.GCJ02="GCJ02",s.AMap="GCJ02",s.BD09="BD09",s.BD09LL="BD09",s.Baidu="BD09",s.BMap="BD09",s.BD09MC="BD09MC",s.BD09Meter="BD09MC",s.EPSG3857="EPSG3857",s.EPSG900913="EPSG3857",s.EPSG102100="EPSG3857",s.WebMercator="EPSG3857",s.WM="EPSG3857",s))(x||{}),g=(s=>(s[s.GeoPointNoPlane=9e3]="GeoPointNoPlane",s[s.PointUnmappedGIS=9010]="PointUnmappedGIS",s[s.PointNoXYZ=9011]="PointNoXYZ",s[s.PointNoPlane=9012]="PointNoPlane",s[s.RelativePlaneUnmatch=9020]="RelativePlaneUnmatch",s[s.RelativeNoPlane=9021]="RelativeNoPlane",s[s.RelativeJsonError=9022]="RelativeJsonError",s[s.RequestCodeError=9030]="RequestCodeError",s[s.RequestResultError=9031]="RequestResultError",s[s.RequestUnknownError=9032]="RequestUnknownError",s))(g||{});const J={baseUrl:"https://vsleem.com/api",authorizeCode:""},W={isTransformResponse:!0,joinBaseUrl:!0,withAuthorize:!0},V={url:"",method:v.GET,headers:{}},Z=[{name:"GAODE",patterns:["amap","amap.com","autonavi.com","restapi.amap.com","tiles.amap.com"],CRSTypes:[x.GCJ02,x.WGS84]},{name:"BAIDU",patterns:["baidu","baidu.com","bdimg.com"],CRSTypes:[x.BD09,x.WGS84]},{name:"TENCENT",patterns:["qq.com","map.qq.com","map.gtimg.com"],CRSTypes:[x.GCJ02,x.WGS84]},{name:"TIANDITU",patterns:["tianditu","tianditu.gov.cn"],CRSTypes:[x.WGS84,x.WGS84]},{name:"GOOGLE",patterns:["google","googleapis","google.com"],CRSTypes:[x.GCJ02,x.WGS84]},{name:"OPENSTREET",patterns:["openstreetmap","openstreetmap.org"],CRSTypes:[x.WGS84,x.WGS84]}];class m extends Error{constructor(t,e,i){super(e),this.code=t,this.message=e,this.details=i,this.name="Apprror",Object.setPrototypeOf(this,m.prototype)}toJSON(){return{code:this.code,message:this.message,details:this.details,timestamp:new Date().toISOString()}}}const H={...J};function mt(s){const{baseUrl:t,authorizeCode:e,locale:i}=s;Object.assign(H,{baseUrl:t,authorizeCode:e,locale:i})}async function P(s,t){const e={...W,...t},i={...V,...s};try{const n=yt(i,e),{url:o,...r}=n,c=await(await window.fetch(o,r)).json();return wt(c,e)}catch(n){return pt(n)}}function yt(s,t){const{baseUrl:e,authorizeCode:i,locale:n=k.zh_CN}=H,{joinBaseUrl:o,withAuthorize:r}=t;let{url:a,method:c,headers:u={},params:h,data:d}=s;o&&e&&(a=`${e}${a}`),c=c?.toUpperCase();const f={...u};if(/^https?:\/\/.+$/i.test(e??"")?f.PlatForm=new URL(e??"").host:f.PlatForm=new URL(window.location.href).host,r&&i&&(f.AuthorizationCode=i),c===v.POST&&!f["Content-Type"]&&(f["Content-Type"]=O.JSON),n&&(f["Accept-Language"]=n),c===v.GET&&h){const T=new URLSearchParams(h),se=a.includes("?")?"&":"?";a+=se+`${T.toString()}`}let E;return c===v.POST&&(E=f["Content-Type"]===O.JSON?JSON.stringify(d||{}):d),{url:a,method:c,headers:f,body:E}}function wt(s,t){if(!t.isTransformResponse)return s;if(!s)throw new m(g.RequestResultError,"请求返回的结果错误");const{code:e,data:i,msg:n}=s;if(e===j.SUCCESS)return i;throw new m(g.RequestCodeError,n||"请求返回的Code错误")}function pt(s){throw s instanceof Error?s:new m(g.RequestUnknownError,typeof s=="string"?s:"未知的请求错误")}const gt=Object.freeze(Object.defineProperty({__proto__:null,request:P,setRequestGlobalConfig:mt},Symbol.toStringTag,{value:"Module"}));function Q(s,t){return P({url:"/project/jssdk/cs/list",method:v.GET,params:s},t)}function K(s,t){return P({url:"/project/jssdk/cs/bind",method:v.POST,data:s},t)}function U(s,t){return P({url:"/project/jssdk/cs/save",method:v.POST,data:s},t)}function tt(s,t){return P({url:"/project/jssdk/cs/delete",method:v.POST,data:s},t)}function et(s,t){return P({url:"/project/jssdk/cs/mapping",method:v.POST,data:s},t)}function st(s,t){return P({url:"/project/jssdk/cs/mapping/query",method:v.GET,params:s},t)}function it(s,t){return P({url:"/project/jssdk/project/detail",method:v.GET,params:s},t)}function Mt(s,t={isTransformResponse:!1,joinBaseUrl:!1,withAuthorize:!1}){return P({url:s,method:v.GET},t)}const vt=Object.freeze(Object.defineProperty({__proto__:null,bindCoordinate:K,getCoordinateList:Q,getImageInfo:Mt,getMappingRelation:st,getProjectDetail:it,mapingCoordinate:et,removeCoordinate:tt,saveCoordinate:U},Symbol.toStringTag,{value:"Module"})),xt=typeof window<"u",St=Object.prototype.toString;function D(s,t){return St.call(s)===`[object ${t}]`}function nt(s){return typeof s<"u"}function ot(s){return!nt(s)}function C(s){return s!==null&&D(s,"Object")}function rt(s){return s===null}function bt(s){return D(s,"Date")}function Tt(s){return D(s,"String")}function X(s){return typeof s=="function"}function Pt(s){return D(s,"Boolean")}function Et(s){return D(s,"RegExp")}function b(s){return s&&Array.isArray(s)}function Dt(s){return typeof window<"u"&&D(s,"Window")}function Ct(s){return C(s)&&!!s.tagName}function A(s){return typeof s=="number"?!0:typeof s!="string"?!1:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/.test(s)}function Nt(s,t){return JSON.stringify(s)===JSON.stringify(t)}function It(s){return ot(s)||rt(s)}function zt(s){return D(s,"Promise")&&C(s)&&X(s.then)&&X(s.catch)}function Rt(s,t={}){return new Promise((e,i)=>{const n=N(s);if(Ot(n)){e(!0);return}const o=document.createElement("script");o.src=s,Object.entries(t).forEach(([r,a])=>{a!==!1&&o.setAttribute(r,a===!0?"":String(a))}),o.onload=()=>{e(!0)},o.onerror=()=>{document.head.removeChild(o),i(new Error(`Failed to load script: ${s}`))},document.head.appendChild(o)})}function Ot(s){const t=N(s);return Array.from(document.scripts).some(e=>N(e.src)===t)}function At(s){return new Promise((t,e)=>{const i=N(s);if(Gt(i)){t(!0);return}const n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=s,n.onload=()=>{t(!0)},n.onerror=()=>{document.head.removeChild(n),e(new Error(`Failed to load link: ${s}`))},document.head.appendChild(n)})}function Gt(s){const t=N(s);return Array.from(document.querySelectorAll('link[rel="stylesheet"]')).some(e=>N(e.href)===t)}function N(s){try{const t=new URL(s,window.location.href);return`${t.origin}${t.pathname}`}catch{return s}}function at(s){return I(s,new WeakMap)}function I(s,t){if(typeof s!="object"||s===null)return s;if(t.has(s))return t.get(s);let e;if(s instanceof Date)return e=new Date(s),t.set(s,e),e;if(s instanceof RegExp)return e=new RegExp(s),t.set(s,e),e;if(s instanceof Map)return e=new Map,t.set(s,e),s.forEach((n,o)=>{e.set(o,I(n,t))}),e;if(s instanceof Set)return e=new Set,t.set(s,e),s.forEach(n=>{e.add(I(n,t))}),e;if(ArrayBuffer.isView(s))return e=new s.constructor(s.buffer.slice(0),s.byteOffset,s.byteLength),t.set(s,e),e;if(s instanceof ArrayBuffer)return e=s.slice(0),t.set(s,e),e;if(Array.isArray(s)){e=[],t.set(s,e);for(let n=0;n<s.length;n++)n in s&&(e[n]=I(s[n],t));return e}e=Object.create(Object.getPrototypeOf(s)),t.set(s,e);for(const n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=I(s[n],t));const i=Object.getOwnPropertySymbols(s);for(const n of i)Object.prototype.propertyIsEnumerable.call(s,n)&&(e[n]=I(s[n],t));return e}function Lt(s,t,e=!1){let i;const n=function(...o){const r=this,a=e&&!i;i&&clearTimeout(i),i=setTimeout(()=>{i=void 0,e||s.apply(r,o)},t),a&&s.apply(r,o)};return n.cancel=()=>{i&&clearTimeout(i),i=void 0},n}function jt(s,t,e=!1){let i,n;const o=function(...r){const a=this;n?(clearTimeout(i),i=setTimeout(()=>{Date.now()-n>=t&&(s.apply(a,r),n=Date.now())},t-(Date.now()-n))):(e&&s.apply(a,r),n=Date.now())};return o.cancel=()=>{clearTimeout(i),i=void 0,n=void 0},o}function B(s,...t){if(!t.length)return s;const e=t.shift();return e===void 0?s:(G(s)&&G(e)&&Object.keys(e).forEach(i=>{const n=s[i],o=e[i];Array.isArray(n)&&Array.isArray(o)?s[i]=[...n,...o]:G(n)&&G(o)?s[i]=B({...n},o):o!==void 0&&(s[i]=o)}),B(s,...t))}function G(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function ct(s,...t){if(!t.length)return s;for(const e of t)e!=null&&typeof e=="object"&&Object.keys(e).forEach(i=>{const n=e[i],o=s[i];n!==null&&typeof n=="object"&&!Array.isArray(n)?((!o||typeof o!="object")&&(s[i]={}),ct(s[i],n)):s[i]=n});return s}function ht(s,t){const e={};if(C(s)&&!b(s)){for(const i in s)if(Object.prototype.hasOwnProperty.call(s,i)){const n=s[i],o=C(t)&&!b(t)?t[i]:void 0;if(!(i in(t||{})))e[i]=n;else if(b(n)&&b(o))JSON.stringify(n)!==JSON.stringify(o)&&(e[i]=n);else if(C(n)&&C(o)){const r=ht(n,o);r&&Object.keys(r).length>0&&(e[i]=r)}else n!==o&&(e[i]=n)}}if(C(t)&&b(t))for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&!(i in(s||{}))&&(e[i]=void 0);return e}function kt(s){console.warn(`[warn]:${s}`)}function Ut(s){throw new Error(`[error]:${s}`)}function Xt(s){if(s)return Z.find(t=>t?.patterns?.some(e=>s.includes(e)))}function Bt(s,t,e,i){const n=Math.min(s/e,t/i),o=e*n,r=i*n;return{scale:n,x:(s-o)/2,y:(t-r)/2,sw:o,sh:r}}function Ft(s,t,e){return{x:s*e.scale+e.x,y:t*e.scale+e.y}}function Yt(s,t,e){return{x:(s-e.x)/e.scale,y:(t-e.y)/e.scale}}const lt="0123456789abcdef";function _t(){let s="";const t=new Uint8Array(16);if(typeof crypto<"u"&&"getRandomValues"in crypto)crypto.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;for(let e=0;e<16;e++)(e===4||e===6||e===8||e===10)&&(s+="-"),s+=lt[t[e]>>>4],s+=lt[t[e]&15];return s}let F=0;const $t=9999;function qt(s=""){const t=Date.now(),e=Math.floor(Math.random()*1e6);return F=(F+1)%$t,`${s}${s?"_":""}${t}_${F.toString().padStart(4,"0")}_${e.toString().padStart(6,"0")}`}const Jt=Object.freeze(Object.defineProperty({__proto__:null,buildShortUUID:qt,buildUUID:_t,cloneDeep:at,debounce:Lt,deepMerge:B,deepMergeProps:ct,error:Ut,getDiffProps:ht,getImageTransform:Bt,getMapProvider:Xt,inBrowser:xt,is:D,isArray:b,isBoolean:Pt,isDate:bt,isDef:nt,isElement:Ct,isFunction:X,isNull:rt,isNullOrUnDef:It,isNumeric:A,isObject:C,isPromise:zt,isRegExp:Et,isSameValue:Nt,isString:Tt,isUnDef:ot,isWindow:Dt,loadCss:At,loadScript:Rt,throttle:jt,toCanvasCoord:Ft,toModelCoord:Yt,warn:kt},Symbol.toStringTag,{value:"Module"}));class y{x=0;y=0;z=0;lat=0;lon=0;alt=0;yaw=0;pitch=0;roll=0;hasXYZ=!1;hasGeo=!1;hasAngle=!1;plane="xy";constructor(t){const{x:e,y:i,z:n,lat:o,lon:r,alt:a,yaw:c,pitch:u,roll:h,plane:d="xy"}=t||{};this.x=Number(e)||0,this.y=Number(i)||0,this.z=Number(n)||0,(this.x!==0||this.y!==0||this.z!==0)&&(this.plane=d,this.hasXYZ=!0),this.lat=Number(o)||0,this.lon=Number(r)||0,this.alt=Number(a)||0,(this.lat!==0||this.lon!==0||this.alt!==0)&&(this.hasGeo=!0),this.yaw=Number(c)||0,this.pitch=Number(u)||0,this.roll=Number(h)||0,(A(c)||A(u)||A(h))&&(this.hasAngle=!0)}static dist(t,e){return Math.hypot(t.x-e.x,t.y-e.y,t.z-e.z)}static distXZ(t,e){return Math.hypot(t.x-e.x,t.z-e.z)}static distXY(t,e){return Math.hypot(t.x-e.x,t.y-e.y)}static toRadians(t){return(Number(t)||0)*Math.PI/180}static toDegrees(t){return(Number(t)||0)*180/Math.PI}static angleXZ(t,e,i){const n={x:t.x-e.x,z:t.z-e.z},o={x:i.x-e.x,z:i.z-e.z},r=n.x*o.x+n.z*o.z,a=Math.sqrt(n.x**2+n.z**2),c=Math.sqrt(o.x**2+o.z**2),u=Math.max(-1,Math.min(1,r/(a*c))),d=Math.acos(u)*180/Math.PI;return Math.min(d,360-d)}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new y({x:e[0],y:e[1],z:e[2]})}}static toStringify(t){return t?`${t.x},${t.y},${t.z}`:""}projection(t,e,i){try{if(e?.id===i?.id)return new y(this);if(e?.modelType===M.GeoModel){const{refPoint:n}=e?.relativeMap||{};if(this.hasGeo&&n){const o=z.LLHToXYZ(this,n);return this.x=o.x,this.y=o.y,this.z=o.z,this.hasXYZ=!0,this.project(t)}throw new m(g.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}if(i?.modelType===M.GeoModel){const{refPoint:n}=i?.relativeMap||{},o=this.project(t);if(o?.hasXYZ&&n){const r=z.XYZToLLH(o,n);return o.lat=r.lat,o.lon=r.lon,o.alt=r.alt,o.hasGeo=!0,o}throw new m(g.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}return this.project(t)}catch(n){console.error(n);return}}project(t){if(!this.hasXYZ)throw new m(g.PointNoXYZ,"点没有xxz坐标信息");if(this.plane==="xz")return this.projectXZ(t);if(this.plane==="xy")return this.projectXY(t);throw new m(g.PointNoPlane,"点的plane应为xz或xy")}projectXZ(t){const e=new y(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const i=e.x*Math.cos(t.yaw)-e.z*Math.sin(t.yaw),n=e.x*Math.sin(t.yaw)+e.z*Math.cos(t.yaw);return e.x=i+t.x,e.y+=t.y,e.z=n+t.z,e}projectXY(t){const e=new y(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const i=e.x*Math.cos(t.yaw)-e.y*Math.sin(t.yaw),n=e.x*Math.sin(t.yaw)+e.y*Math.cos(t.yaw);return e.x=i+t.x,e.y=n+t.y,e.z+=t.z,e}}class z{lat=0;lon=0;alt=0;constructor(t){const{lat:e=0,lon:i=0,alt:n=0}=t||{};this.lat=Number(e)||0,this.lon=Number(i)||0,this.alt=Number(n)||0}static XYZToLLH(t,e){const n=.0033528106647474805,o=n*(2-n),r=y.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt;let c,u,h;if(t.plane==="xz"){const d=t.x/1e3/(a*Math.cos(r)),f=t.z/1e3/a;c=e.lon+y.toDegrees(d),u=e.lat-y.toDegrees(f),h=e.alt+t.y/1e3}else if(t.plane==="xy"){const d=t.x/1e3/(a*Math.cos(r)),f=t.y/1e3/a;c=e.lon+y.toDegrees(d),u=e.lat-y.toDegrees(f),h=e.alt+t.z/1e3}else throw new m(g.GeoPointNoPlane,"点的plane应为xz或xy");return new z({lat:u,lon:c,alt:h})}static LLHToXYZ(t,e){const n=.0033528106647474805,o=n*(2-n),r=y.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt,c=y.toRadians(t.lon-e.lon),u=y.toRadians(e.lat-t.lat),h=a*c*Math.cos(r),d=a*u;if(t.plane==="xz")return new y({x:h*1e3,y:t.alt*1e3,z:d*1e3,plane:"xz"});if(t.plane==="xy")return new y({x:h*1e3,y:d*1e3,z:t.alt*1e3,plane:"xy"});throw new m(g.GeoPointNoPlane,"点的plane应为xz或xy")}}class w{scale=1;yaw=0;x=0;y=0;z=0;start=0;end=-1;plane="xy";refPoint;constructor(t){const{refPoint:e,...i}=t||{};e&&(this.refPoint=new z(e)),Object.assign(this,i)}static addRelativeMap(t,e){if(t.plane!==e.plane)throw new m(g.RelativePlaneUnmatch,"两个映射关系的plane应该相同");const i=t.scale*e.scale,n=t.yaw+e.yaw,o=Math.cos(e.yaw),r=Math.sin(e.yaw);let a=0,c=0,u=0;if(t.plane==="xz"){const h=t.x*o-t.z*r,d=t.y,f=t.x*r+t.z*o;a=e.x+h*e.scale,c=e.y+d*e.scale,u=e.z+f*e.scale}else if(t.plane==="xy"){const h=t.x*o-t.y*r,d=t.x*r+t.y*o,f=t.z;a=e.x+h*e.scale,c=e.y+d*e.scale,u=e.z+f*e.scale}else throw new m(g.RelativeNoPlane,"映射关系的plane应为xz或xy");return new w({scale:i,yaw:n,x:a,y:c,z:u,start:t.start,end:t.end,plane:t.plane})}static inverseRelativeMap(t){const e=1/t.scale,i=-t.yaw,n=Math.cos(-i),o=Math.sin(-i);let r=0,a=0,c=0;if(t.plane==="xz")r=-(t.x*n+t.z*o)*e,a=-t.y*e,c=-(t.z*n-t.x*o)*e;else if(t.plane==="xy")r=-(t.x*n+t.y*o)*e,a=-(t.y*n-t.x*o)*e,c=-t.z*e;else throw new m(g.RelativeNoPlane,"映射关系的plane应为xz或xy");return new w({scale:e,yaw:i,x:r,y:a,z:c,start:t.start,end:t.end,plane:t.plane})}static toParse(t){try{let e=t?JSON.parse(t):void 0;const{reference_point:i}=e||{};return i&&(e={refPoint:i}),e?new w(e):void 0}catch{throw new m(g.RelativeJsonError,"relativeMap格式化失败")}}static toStringify(t){return t?JSON.stringify(t):void 0}static isValid(t){return t&&t!=='{"scale":1.0, "yaw":0.0, "x":0.0, "y":0.0, "z":0.0}'}}class p{static async getProjectDetail(t){return await it({projectId:t})}static async getCoordinateTree(t){const e=await Q({projectId:t});if(e.length){const i=p.handleCoordinateList(e);return p.buildCoordinateTree(i,0)}}static parsedCoordinateTree(t){const e=p.flattenCoordinateTree(t);return p.buildCoordinateTree(e,0)}static async addCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:c,modelType:u,relativeMap:h,level:d,...f}=a,E=h?JSON.stringify(h):void 0;return{...f,projectId:i,parentId:n,coordinateType:c,renderType:u,relativePosition:E}}),r=await U(o);return p.handleCoordinateList(r)}static async removeCoordinate(t,e){const i=e.map(n=>n.id??-1);return await tt(i)}static async updateCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:c,relativeMap:u,level:h,...d}=a,f=w.toStringify(u);return{...d,relativePosition:f,projectId:i,parentId:n}}),r=await U(o);return p.handleCoordinateList(r)}static async bindCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{modelId:c}=a;return{modelId:c,parentId:n,projectId:i}}),r=await K(o);return p.handleCoordinateList(r)}static handleCoordinateList(t){return t?.map(e=>{const{coordinateType:i,modelKey:n,renderType:o,relativePosition:r,...a}=e,c=o===M.GeoModel?new w(w.toParse(r)):w.toParse(r);return new L({...a,type:i,modelType:o,modelValue:n,relativeMap:c})})}static flattenCoordinateTree(t){const e=Array.isArray(t)?t:[t],i=[];function n(o){for(const r of o){const{level:a,parent:c,relativeMap:u,...h}=r,d=new L({...h,relativeMap:new w(u)});i.push(d),r.children&&r.children.length>0&&n(r.children)}}return n(e),i}static buildCoordinateTree(t,e=0){const i=new Map,n=[];return t.forEach(o=>{i.set(String(o.id),o)}),t.forEach(o=>{const r=i.get(String(o.id));if(r)if(o.parentId===e)r.level=0,n.push(r);else{const a=i.get(String(o.parentId??-1));a&&(r.type===S.Space&&(r.level=(Number(a.level)||0)+1),r.parent=a,a.children?.push(r))}}),n.forEach(p.sortCoordinateTree),n[0]}static sortCoordinateTree(t){t.children&&(t.children.sort((e,i)=>{if(e.type===S.Space){const n=Number(i?.relativeMap?.z)-Number(e?.relativeMap?.z);return n!==0?n:Number(i.createTime)-Number(e.createTime)}else return e.status===0&&i.status!==0?-1:i.status===0&&e.status!==0?1:Number(i.createTime)-Number(e.createTime)}),t.children.forEach(p.sortCoordinateTree))}static filterSpaceTree(t,e){const i=[];return t.forEach(n=>{const o=new L(n);e&&(o.parent=e);const r=p.filterSpaceTree(o.children,o);o.children=r,o.disabled=o.disabled??!1,o.type!==S.Model&&i.push(o)}),i}}class L{id=0;type=0;children=[];level;relativeMap;no;name;shortName;status;modelId;modelType;modelValue;projectId;parentId;parent;groupUuid;z;createTime;disabled;constructor(t){this.setOptions(t)}get spaceList(){return this.children.filter(t=>t.type===S.Space)}get modelList(){return this.children.filter(t=>t.type===S.Model)}get fullName(){const t=this.name?`(${this.name})`:"";return this.shortName?`${this.shortName}${t}`:this.name??""}setOptions(t){const{relativeMap:e,parent:i,children:n,...o}=t||{};e&&(this.relativeMap=new w(e)),i&&(this.parent=i),n?.length&&(this.children=n),Object.assign(this,o)}async addChild(t){const e=b(t)?t:[t],i=await p.addCoordinate(this,e);return this.mergeChild(i),i}async removeChild(t){const e=b(t)?t:[t];await p.removeCoordinate(this,e);for(const i of e){const n=this.children.findIndex(o=>o.id===i.id);n!==-1&&this.children.splice(n,1)}}async updateChild(t){const e=b(t)?t:[t],i=await p.updateCoordinate(this,e);return this.mergeChild(i),i}async bindChild(t){const e=b(t)?t:[t],i=await p.bindCoordinate(this,e);return this.mergeChild(i),i}async mergeChild(t){t?.length&&t.forEach(e=>{const i=this.children.find(n=>n.id===e.id);if(i){const{relativeMap:n,no:o,name:r,shortName:a,status:c,modelId:u,modelValue:h}=e;Object.assign(i,{relativeMap:n,no:o,name:r,shortName:a,status:c,modelId:u,modelValue:h})}else this.id===e.parentId&&(e.parent=this,this.children.unshift(e))})}async mappingTo(t){await et(t)}async getMapping(){return(await st({srcCsId:this.id}))[0]}findRoot(t=!1){let e=this;for(;e.parent&&!(t&&!e.relativeMap);)e=e.parent;return e}findChildModel(t,e=!0){const i=b(t)?t:[t];return i.includes(this.modelType??-1)&&this.status!==R.Disabled?this:([S.Data,S.Model].includes(this.type)?this.findParentSpace():this)?.modelList?.filter(a=>i.includes(a.modelType??-1)?e?!!a.relativeMap:!0:!1)?.sort((a,c)=>Number(a.status)-Number(c.status))?.[0]}findClosestModel(t=[M.CADModel,M.BIMModel,M.ForgeModel,M.ThreeDModel,M.GeoModel],e){const i=b(t)?t:[t],n=new Set;e?.forEach(h=>{n.add(String(h.id))});const o=[{node:this,distance:0}],r=new Set,a=[];for(;o.length>0;){const{node:h,distance:d}=o.shift();if(n.has(String(h.id))||r.has(h))continue;const f=h.modelType??-1;i.includes(f)&&a.push({node:h,distance:d,modelType:f}),r.add(h);const E=[];if(h.children)for(const T of h.children)r.has(T)||E.push(T);if(h.parent?.children)for(const T of h.parent.children)T!==h&&!r.has(T)&&E.push(T);h.parent&&!r.has(h.parent)&&E.push(h.parent);for(const T of E)o.push({node:T,distance:d+1})}if(a.length===0)return;const c=Math.min(...a.map(h=>h.distance)),u=a.filter(h=>h.distance===c);return u.sort((h,d)=>h.modelType-d.modelType),u[0]?.node}findParentSpace(){let t=this;for(;t&&t.type!==S.Space;)t=t.parent;return t}findParentSpaceNames(t=2){const e=[];let i=this;for(;i&&t>0;)i.type===S.Space&&(e.unshift(i.fullName),t--),i=i.parent;return e}findCsGroup(){const{groupUuid:t,parent:e}=this;return t?e?.children?.filter(i=>i.groupUuid===t)||[]:[]}findCsByLevel(t){if(this.level===t)return this;if(this.children.length)for(const e of this.children){const i=e.findCsByLevel(t);if(i)return i}}findCsById(t){if(t){if(this.id===t)return this;for(const e of this.children){const i=e.findCsById(t);if(i)return i}}}getCsRoutes(t=!1){let e=this;const i=[e];for(;e?.parent&&!(t&&!e.relativeMap);)e=e.parent,e&&i.push(e);return i}getMappedCsTree(){function t(n){return n.children?.length&&(n.children=n.children.filter(o=>!!o?.relativeMap&&o.status!==R.Disabled).map(o=>t(o))),n}const e=at(this.findRoot(!0)),i=t(e);return i.parentId=0,i.parent=void 0,i}getDestRelativeMap(t){if(this.id===t.id)return new w;const e=this.getRelativeMaps(),i=t.getRelativeMaps();let n=new w;return e?.forEach(o=>{n=w.addRelativeMap(n,o)}),i?.reverse()?.forEach(o=>{n=w.addRelativeMap(n,w.inverseRelativeMap(o))}),n}getRelativeMaps(){let t=this;const e=[];for(;t?.parent&&t.relativeMap;)e.push(t.relativeMap),t=t.parent;return e}static filterCoordinateTree(t,e=[],i=[]){if(i.includes(t.id)||e.includes(t.type))return;const n=t.children?.map(o=>this.filterCoordinateTree(o,e,i)).filter(o=>o!==void 0);return{...t,children:n}}static getCommonCoordinate(t){let e;const i=t.map(n=>n.getCsRoutes(!0).filter(r=>r.id&&r.type===S.Space));for(;this.checkSameCoordinate(i);){const o=i.shift();o?.length&&(e=o[0])}return e}static checkSameCoordinate(t){if(t.length){if(t.length===1)return!0;for(let e=0;e<t.length-1;e++){const i=t[e];if(!i?.length)return!1;const n=t[e+1];if(!n?.length||i[0].id!==n[0].id)return!1}return!0}else return!1}}class Y{yaw=0;pitch=0;roll=0;constructor(t){const{yaw:e=0,pitch:i=0,roll:n=0}=t||{};this.yaw=Number(e)||0,this.pitch=Number(i)||0,this.roll=Number(n)||0}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new Y({yaw:e[0],pitch:e[1],roll:e[2]})}}static toStringify(t){return t?`${t.yaw},${t.pitch},${t.roll}`:""}}class _{x=0;y=0;z=0;constructor(t){const{x:e=0,y:i=0,z:n=0}=t||{};this.x=Number(e)||0,this.y=Number(i)||0,this.z=Number(n)||0}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new _({x:e[0],y:e[1],z:e[2]})}}static toStringify(t){return t?`${t.x},${t.y},${t.z}`:""}}class Wt{static srcPointToDstPoint(t,e,i){if(!e||!i||!t?.length)return[];const n=e?.getDestRelativeMap(i);if(!n)return[];const o=[];return t.forEach(r=>{const a=r.projection(n,e,i);a&&o.push(a)}),o}}class Vt{canvas;ctx;options;offset={x:0,y:0};curOffset={x:0,y:0};mousePosition={x:-1,y:-1};MAX_SCALE=60;MIN_SCALE=1;STEP_SCALE=.5;scale=1;preScale=1;width=0;height=0;x=0;y=0;timeout=0;lastTouch;initialDistance=0;touchMode=0;isMouseover=!1;isBindEvent=!0;isDrawAssist=!1;customDrawAssist;isMoveRedrawing;afterDraw;screenPos={screenX:0,screenY:0};constructor(t){const{container:e,width:i=300,height:n=300,isBindEvent:o=!0,isDrawAssist:r=!1,isMoveRedrawing:a,customDrawAssist:c,afterDraw:u,...h}=t;this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.width=i,this.height=n,this.canvas.width=i,this.canvas.height=n,this.isBindEvent=o,this.isDrawAssist=r,this.customDrawAssist=c,this.isMoveRedrawing=a??r,this.options=h,this.onMousedown=this.onMousedown.bind(this),this.onMousemove=this.onMousemove.bind(this),this.onMousemoveTemp=this.onMousemoveTemp.bind(this),this.onMouseup=this.onMouseup.bind(this),this.onMousewheel=this.onMousewheel.bind(this),this.onDblclick=this.onDblclick.bind(this),this.onTouchstart=this.onTouchstart.bind(this),this.onTouchmove=this.onTouchmove.bind(this),this.onTouchend=this.onTouchend.bind(this),this.onMouseout=this.onMouseout.bind(this),this.afterDraw=this.afterDraw,o&&(this.canvas.addEventListener("DOMMouseScroll",this.onMousewheel),this.canvas.addEventListener("mousewheel",this.onMousewheel),this.canvas.addEventListener("mousedown",this.onMousedown),this.canvas.addEventListener("mousemove",this.onMousemove),this.canvas.addEventListener("mouseout",this.onMouseout),this.canvas.addEventListener("dblclick",this.onDblclick),this.canvas.addEventListener("touchstart",this.onTouchstart))}onClick(t){const{screenX:e,screenY:i}=t;this.timeout&&clearTimeout(this.timeout);const n=this.getPos(t);this.x=n.x,this.y=n.y,this.screenPos={screenX:e,screenY:i},this.options.onClick&&(this.timeout=setTimeout(()=>{const o=parseFloat(((this.x-this.offset.x)/this.scale).toFixed(2)),r=parseFloat(((this.y-this.offset.y)/this.scale).toFixed(2));this.options.onClick(o,r)},200))}onMouseout(t){this.isMouseover=!1,this.draw()}onTouchstart(t){t.preventDefault(),t.touches.length==1?this.touchMode===0&&(this.touchMode=1):t.touches.length>=2&&this.touchMode<2&&(this.touchMode=2),this.touchMode==1&&t.touches.length==1?this.onTouch(t.touches[0]):this.touchMode==2&&t.touches.length==2&&this.onBothTouchstart(t),this.canvas.addEventListener("touchmove",this.onTouchmove),this.canvas.addEventListener("touchend",this.onTouchend)}onMousedown(t){this.onClick(t),this.canvas.addEventListener("mousemove",this.onMousemoveTemp),this.canvas.addEventListener("mouseup",this.onMouseup)}onBothTouchstart(t){t.preventDefault();const e={x:t.touches[0].clientX,y:t.touches[0].clientY},i={x:t.touches[1].clientX,y:t.touches[1].clientY},n=this.getPos({clientX:(e.x+i.x)/2,clientY:(e.y+i.y)/2});this.x=n.x,this.y=n.y,this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y,this.initialDistance=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2))}onTouchmove(t){t.preventDefault(),this.touchMode==1&&t.touches.length==1?(this.onMousemoveTemp(t.touches[0]),this.onMousemove(t.touches[0])):this.touchMode==2&&t.touches.length==2&&this.onBothTouchmove(t)}onMousemove(t){const e=this.getPos(t);this.mousePosition.x=e.x,this.mousePosition.y=e.y,this.isMouseover=!0,this.isMoveRedrawing&&this.draw()}onMousemoveTemp(t){const{screenX:e,screenY:i}=this.screenPos;(Math.abs(e-t.screenX)>10||Math.abs(i-t.screenY)>10)&&(this.timeout&&clearTimeout(this.timeout),this.offset.x=this.curOffset.x+(this.mousePosition.x-this.x),this.offset.y=this.curOffset.y+(this.mousePosition.y-this.y),!this.isMoveRedrawing&&this.draw())}onBothTouchmove(t){if(t.preventDefault(),this.initialDistance){const e={x:t.touches[0].clientX,y:t.touches[0].clientY},i={x:t.touches[1].clientX,y:t.touches[1].clientY},n=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2));if(this.scale+=(n-this.initialDistance)/30*this.STEP_SCALE,this.initialDistance=n,this.scale>this.MAX_SCALE){this.scale=this.MAX_SCALE;return}if(this.scale<this.MIN_SCALE){this.scale=this.MIN_SCALE;return}this.zoom()}}onTouchend(){this.touchMode=0,this.onMouseup()}onMouseup(){this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y,this.canvas.removeEventListener("mousemove",this.onMousemoveTemp),this.canvas.removeEventListener("mouseup",this.onMouseup),this.canvas.removeEventListener("touchmove",this.onTouchmove),this.canvas.removeEventListener("touchend",this.onTouchend)}onMousewheel(t){this.timeout&&clearTimeout(this.timeout),t.preventDefault();const e=this.getPos(t);this.x=e.x,this.y=e.y;const i=t.wheelDelta>0||t.detail<0?this.STEP_SCALE:-this.STEP_SCALE;if(this.scale=parseFloat((this.scale+i).toFixed(2)),this.scale>this.MAX_SCALE){this.scale=this.MAX_SCALE;return}if(this.scale<this.MIN_SCALE){this.scale=this.MIN_SCALE;return}this.zoom()}onTouch(t){const e=Date.now(),{lastTouchTime:i=0,lastTouchX:n=0,lastTouchY:o=0}=this.lastTouch||{};e-i<300&&Math.abs(t.clientX-n)<30&&Math.abs(t.clientY-o)<30?(this.onDblclick(t),this.lastTouch={lastTouchTime:0,lastTouchX:0,lastTouchY:0}):(this.onClick(t),this.lastTouch={lastTouchTime:e,lastTouchX:t.clientX,lastTouchY:t.clientY})}onDblclick(t){this.timeout&&clearTimeout(this.timeout),this.reset(),this.draw()}zoom(){this.offset.x=this.x-(this.x-this.offset.x)*this.scale/this.preScale,this.offset.y=this.y-(this.y-this.offset.y)*this.scale/this.preScale,this.draw(),this.preScale=this.scale,this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y}reset(t){const{width:e=this.width,height:i=this.height,scale:n=1,preScale:o=1,offset:r={x:0,y:0},curOffset:a={x:0,y:0}}=t||{};this.width=e,this.height=i,this.canvas.width=e,this.canvas.height=i,this.scale=n,this.preScale=o,this.offset=r,this.curOffset=a}drawAssist(){const t=this.ctx;t.save(),t.beginPath(),t.lineWidth=1,t.strokeStyle="#C656D5",t.moveTo(0,this.mousePosition.y),t.lineTo(this.width,this.mousePosition.y),t.closePath(),t.stroke(),t.beginPath(),t.moveTo(this.mousePosition.x,0),t.lineTo(this.mousePosition.x,this.height),t.closePath(),t.stroke(),t.restore()}draw(){this.ctx.clearRect(0,0,this.width,this.height),this.ctx.save(),this.ctx.translate(this.offset.x,this.offset.y),this.ctx.scale(this.scale,this.scale),this.options.draw(this.ctx,this),this.ctx.restore(),this.isDrawAssist&&this.isMouseover&&(this.customDrawAssist?this.customDrawAssist():this.drawAssist()),this.afterDraw?.(this.ctx,this)}getPos(t){const e=this.canvas.getBoundingClientRect();let i=parseFloat((t.clientX-e.left).toFixed(2)),n=parseFloat((t.clientY-e.top).toFixed(2));return i=i<0?0:i,n=n<0?0:n,{x:i,y:n}}unBindEvent(){this.isBindEvent&&(this.canvas.removeEventListener("mousemove",this.onMousemove),this.canvas.removeEventListener("DOMMouseScroll",this.onMousewheel),this.canvas.removeEventListener("mousewheel",this.onMousewheel),this.canvas.removeEventListener("mousedown",this.onMousedown),this.canvas.removeEventListener("mouseout",this.onMouseout),this.canvas.removeEventListener("dblclick",this.onDblclick))}}const ut={};class Zt{type="image";x;y;width;height;img;src;redraw;constructor(t){this.x=t.x||0,this.y=t.y||0,this.width=t.width||0,this.height=t.height||0,this.src=t.src,this.redraw=t.redraw,this.img=this.loadImage(t.onload)}loadImage(t){const e=ut[this.src];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.crossOrigin="anonymous",i.src=this.src,i.onload=()=>{ut[this.src]=i,t?.(i),this.redraw?.()},i}}draw(t){try{if(!this.img.complete)return;t.save(),t.drawImage(this.img,this.x,this.y,this.width,this.height),t.restore()}catch(e){console.error(e)}}}class Ht{id="";type="point";x;y;r;text;backgroundColor;index;pIndex;parentId;constructor(t){this.id=t.id,this.x=t.x,this.y=t.y,this.r=t.r||15,this.text=t.text||"",this.index=t.index,this.pIndex=t.pIndex,this.parentId=t.parentId,this.backgroundColor=t.backgroundColor||"rgba(91, 179, 111, 0.8)"}draw(t,e){t.save();const i=1/e.scale;t.beginPath(),t.arc(this.x,this.y,this.r*i,0,2*Math.PI),t.fillStyle=this.backgroundColor,t.fill(),t.font=`${this.r*i}px Microsoft YaHei`,t.textAlign="center",t.fillStyle="#FFFFFF",t.fillText(this.text,this.x,this.y+this.r*i/3),t.restore()}}const dt={};class Qt{id="";type="issue";x;y;width;height;src;img;index;pIndex;parentId;count;badgeR;redraw;constructor(t){this.id=t.id,this.x=t.x,this.y=t.y,this.width=t.width||0,this.height=t.height||0,this.index=t.index,this.pIndex=t.pIndex,this.parentId=t.parentId,this.count=t.count||0,this.badgeR=3,this.src=t.src,this.redraw=t.redraw,this.img=this.loadImage(t.onload)}loadImage(t){const e=dt[this.src];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.src=this.src,i.crossOrigin="anonymous",i.onload=()=>{dt[this.src]=i,t?.(i),this.redraw?.()},i}}draw(t,e){if(!this.img.complete)return;const i=1/e.scale,n=this.width*i,o=this.height*i,r=this.x-n/2,a=this.y-o,c=this.badgeR*i,u=c*1.5;t.save(),t.drawImage(this.img,r,a,n,o),t.beginPath(),this.count>1&&(t.arc(this.x+n*.3,this.y-o*.8,c,0,2*Math.PI),t.fillStyle="red",t.fill(),t.font=`${u}px Microsoft YaHei`,t.textAlign="center",t.fillStyle="#FFFFFF",t.fillText(this.count.toString(),this.x+n*.3,this.y-o*.8+c/2)),t.restore()}}const ft={};class Kt{type="marker";x;y;url;width;height;anchor;img;scale;redraw;beforeDraw;constructor(t){this.x=t.x,this.y=t.y,this.url=t.url,this.width=t.width??0,this.height=t.height??0,this.anchor=t.anchor,this.scale=t.scale??1,t.redraw&&(this.redraw=t.redraw),t.beforeDraw&&(this.beforeDraw=t.beforeDraw),this.img=this.loadImage(t.onload)}loadImage(t){const e=ft[this.url];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.src=this.url,i.crossOrigin="anonymous",i.onload=()=>{ft[this.url]=i,t?.(i),this.redraw?.()},i}}calculateIconPosition(){const t=this.anchor?.x??this.width/2,e=this.anchor?.y??this.height/2;return{iconStartX:this.x-t*this.scale,iconStartY:this.y-e*this.scale}}draw(t,e){if(this.beforeDraw?.(t,e),!this.img?.complete)return;const{iconStartX:i,iconStartY:n}=this.calculateIconPosition();t.save();try{t.drawImage(this.img,i,n,this.width*this.scale,this.height*this.scale)}catch(o){console.error("绘制标记时出错:",o)}finally{t.restore()}}}class te{type="radar";x;y;r;angle;text;hFov=90;beforeDraw;constructor(t){this.x=t.x,this.y=t.y,this.r=t.r||15,this.angle=t.angle||0,this.text=t.text||"",this.hFov=t.fovh||90,this.beforeDraw=t.beforeDraw}draw(t,e){this.beforeDraw?.(t,e);const i=1/e.scale,[n,o]=[(this.angle-this.hFov/2)/180*Math.PI,(this.angle+this.hFov/2)/180*Math.PI];t.save();const r=t.createRadialGradient(this.x,this.y,0,this.x,this.y,this.r*i);r.addColorStop(0,"rgba(180, 42, 42, 1)"),r.addColorStop(1,"rgba(180, 42, 42, 0.5)"),t.beginPath(),t.moveTo(this.x,this.y),t.arc(this.x,this.y,this.r*i,n,o),t.closePath(),t.fillStyle=r,t.fill(),t.restore()}}class ee{type="region";x;y;shape;areaPoints;backgroundColor;constructor(t){if(this.x=t.x,this.y=t.y,this.shape=t.shape||"",this.backgroundColor=t.backgroundColor,t.areaPoints.length===2){const[{x:e,y:i},{},{x:n,y:o}]=t.areaPoints;this.areaPoints=[{x:Math.min(e,n),y:Math.min(i,o)},{x:Math.max(e,n),y:Math.min(i,o)},{x:Math.max(e,n),y:Math.max(i,o)},{x:Math.min(e,n),y:Math.max(i,o)}]}else this.areaPoints=t.areaPoints}draw(t,e){if(t.save(),t.beginPath(),t.globalAlpha=.3,t.fillStyle=this.backgroundColor,this.shape==="circle"){const[{x:i,y:n},{},{x:o,y:r}]=this.areaPoints,a=Math.abs(o-i)/2,c=i+(o-i)/2,u=n+(r-n)/2;t.arc(c,u,a,0,2*Math.PI)}else this.areaPoints.forEach((i,n)=>{const{x:o,y:r}=i;n===0?t.moveTo(o,r):t.lineTo(o,r)});t.fill(),t.restore()}}l.APP_SETTING=J,l.AppError=m,l.AppErrorCode=g,l.AppObsType=q,l.CRSTypes=x,l.CanvasElement=Vt,l.CanvasImageElement=Zt,l.CanvasIssueElement=Qt,l.CanvasMarkerElement=Kt,l.CanvasPointElement=Ht,l.CanvasRadarElement=te,l.CanvasRegionElement=ee,l.Coordinate=L,l.CoordinateLevel=$,l.CoordinateModelType=M,l.CoordinateStatus=R,l.CoordinateType=S,l.DataHelper=Wt,l.DataSource=p,l.GeoPoint=z,l.LocaleType=k,l.MAP_PROVIDERS=Z,l.Point=y,l.Position=Y,l.REQUEST_CONFIG=V,l.REQUEST_OPTIONS=W,l.RelativeMap=w,l.RequestContentType=O,l.RequestMethod=v,l.RequestResultCode=j,l.Vector3=_,l.api=vt,l.http=gt,l.utils=Jt,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vsleem-realsee-viewer/shared",
3
- "version": "2.0.30",
3
+ "version": "2.0.31",
4
4
  "private": false,
5
5
  "description": "Shared utilities for VSLeem RealSee Viewer",
6
6
  "main": "./dist/index.umd.js",