vis-core 0.33.16 → 0.33.18

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/io.d.ts CHANGED
@@ -1,9 +1,27 @@
1
+ export declare function assertMapNavigationTarget(catalog: RuntimeAssetCatalog | undefined, adcode: number, sceneId?: string): void;
2
+
3
+ export declare function assertMediaAssets(value: unknown): asserts value is MediaAssetManifest | undefined;
4
+
5
+ export declare function assetDigest(bytes: Uint8Array): Promise<string>;
6
+
7
+ export declare const cityJsonName: (key: string, data: string) => string;
8
+
9
+ export declare function decodeAssetBytes(data: string | ArrayBuffer): Uint8Array;
10
+
1
11
  declare type DownloadProgress = {
2
12
  percent: number;
3
13
  transferredBytes: number;
4
14
  totalBytes: number;
5
15
  };
6
16
 
17
+ export declare function encodeAssetBytes(bytes: Uint8Array): string;
18
+
19
+ declare type FileEntry = {
20
+ path: string;
21
+ info: MediaAssetInfo;
22
+ file: MediaAssetFile;
23
+ };
24
+
7
25
  export declare const isGzip: (url: string) => boolean;
8
26
 
9
27
  export declare const jsonFetch: <T = any>(url: string, onDownloadProgress?: (progress: DownloadProgress) => void, gzip?: (url: string) => boolean, options?: JsonFetchOptions) => Promise<{
@@ -19,6 +37,241 @@ export declare type JsonFetchCacheOptions = {
19
37
 
20
38
  export declare type JsonFetchOptions = {
21
39
  cache?: boolean | JsonFetchCacheOptions;
40
+ resolveURL?: (url: string) => string;
41
+ };
42
+
43
+ export declare interface MapExportScope {
44
+ rootAdcode: number;
45
+ maxLevel: 'province' | 'city' | 'district';
46
+ }
47
+
48
+ export declare type MapNavigation = {
49
+ mode: 'static';
50
+ } | {
51
+ mode: 'dynamic';
52
+ scope: MapExportScope;
53
+ templates: Partial<Record<MapExportScope['maxLevel'], string>>;
22
54
  };
23
55
 
56
+ declare interface MapRegionBackInteraction {
57
+ trigger: 'click' | 'clickOutside';
58
+ objectId: string;
59
+ filter?: SceneInteractionFilter;
60
+ action: {
61
+ type: 'backMapRegion';
62
+ };
63
+ }
64
+
65
+ declare interface MapRegionSwitchInteraction {
66
+ trigger: 'click';
67
+ objectId: string;
68
+ filter?: SceneInteractionFilter;
69
+ action: {
70
+ /** 先恢复目标层级模板,再把其中的地图切换到命中的行政区。 */
71
+ type: 'switchMapRegion';
72
+ sceneId: string;
73
+ adcode: 'clicked' | number;
74
+ };
75
+ }
76
+
77
+ /** Retained catalog entries are keyed by the native scene material UUID. */
78
+ declare interface MaterialAlias {
79
+ assetId: string;
80
+ locked?: boolean;
81
+ }
82
+
83
+ declare interface MaterialAsset {
84
+ id: string;
85
+ revision: number;
86
+ scope: MaterialScope;
87
+ name: string;
88
+ /** Complete Material.toJSON(); schema 6 exports may pool image/texture payloads. */
89
+ material: Record<string, any>;
90
+ locked?: boolean;
91
+ /** Keep this definition and its dependencies in exports for later business use. Does not prevent editing or deletion. */
92
+ alwaysExport?: boolean;
93
+ }
94
+
95
+ /** Serializable project data. This deliberately contains no THREE instances or GPU ownership. */
96
+ declare type MaterialScope = {
97
+ kind: 'project';
98
+ } | {
99
+ kind: 'scene';
100
+ sceneId: string;
101
+ };
102
+
103
+ export declare interface MediaAssetFile {
104
+ data: Uint8Array;
105
+ mimeType: string;
106
+ }
107
+
108
+ /** File metadata belongs to the manifest, never to a Three image URL. */
109
+ export declare interface MediaAssetInfo {
110
+ sha256: string;
111
+ bytes: number;
112
+ mimeType: string;
113
+ kind: 'image' | 'hdr' | 'tga' | 'video' | 'pixels';
114
+ pixels?: {
115
+ type: string;
116
+ width: number;
117
+ height: number;
118
+ depth?: number;
119
+ };
120
+ }
121
+
122
+ export declare type MediaAssetManifest = Record<string, MediaAssetInfo>;
123
+
124
+ /** Private decoder input; only the manifest and native URL strings are persisted. */
125
+ export declare function mediaAssetPayload(info: MediaAssetInfo, data: ArrayBuffer | string): any;
126
+
127
+ /** COW projection preserves unchanged geometry/object graphs and cached file
128
+ * bytes. Owned history snapshots are never rewritten with deployment paths. */
129
+ export declare class MediaAssetWriter {
130
+ private payloads;
131
+ private graphs;
132
+ private rows;
133
+ private row;
134
+ writePayload(value: any): FileEntry | undefined;
135
+ prepare<T extends Record<string, any>>(document: T): {
136
+ document: T;
137
+ assets: MediaAssetManifest;
138
+ files: Record<string, MediaAssetFile>;
139
+ };
140
+ }
141
+
142
+ export declare function mergeRuntimeAssets(previous?: RuntimeAssetCatalog, incoming?: RuntimeAssetCatalog): RuntimeAssetCatalog | undefined;
143
+
144
+ declare interface PrefabAsset {
145
+ id: string;
146
+ name: string;
147
+ revision: number;
148
+ /** Stable public SDK identifier. Omit for assets used only by the editor. */
149
+ sdkKey?: string;
150
+ /** Legacy business templates own complete material snapshots, without promoting scene assets. */
151
+ materialMode?: 'embedded';
152
+ snapshot: Record<string, any>;
153
+ }
154
+
155
+ /** Read a self-contained ZIP into a document with persistent image payloads. */
156
+ export declare function readSceneBundleZip(input: SceneBundleBinary, name?: string): Promise<VisSceneDocument>;
157
+
158
+ /** Resolve declared URLs only. Repeated calls leave already hydrated data alone. */
159
+ export declare function resolveMediaAssets(value: any, assets: MediaAssetManifest | undefined, read: (path: string, info: MediaAssetInfo) => ArrayBuffer | string): void;
160
+
161
+ /** Static dependencies owned by a project. Source URLs are lookup keys, never fallbacks. */
162
+ export declare interface RuntimeAsset {
163
+ id: string;
164
+ path: string;
165
+ sources: string[];
166
+ mimeType: string;
167
+ encoding: 'identity' | 'gzip';
168
+ bytes: number;
169
+ sha256: string;
170
+ /** Owned file bytes; legacy encoded catalogs must be imported by the platform. */
171
+ data?: ArrayBuffer;
172
+ }
173
+
174
+ export declare interface RuntimeAssetCatalog {
175
+ version: 1;
176
+ entries: RuntimeAsset[];
177
+ scope?: MapExportScope;
178
+ /** Explicit delivery contract; omitted only in older packages. */
179
+ mapNavigation?: MapNavigation;
180
+ /** Enumerated interaction targets, including regions never opened in the editor. */
181
+ regions?: Record<string, number[]>;
182
+ declaredSources?: string[];
183
+ /** Explicitly deployed shared files; these sources are not stored inside the ZIP. */
184
+ externalSources?: string[];
185
+ mapDataMode?: 'bundled' | 'external';
186
+ /** Signed authorization restricted to the exported map interaction targets. */
187
+ mapSwitchKey?: string;
188
+ projectId?: string;
189
+ /** Runtime-only base for an unpacked deployment. ZIP imports contain data instead. */
190
+ baseUrl?: string;
191
+ }
192
+
193
+ /** One resolver per scene; no global URL aliases or cross-project caches. */
194
+ export declare class RuntimeAssetResolver {
195
+ private sources;
196
+ private resolved;
197
+ private externals;
198
+ readonly catalog: RuntimeAssetCatalog;
199
+ private strict;
200
+ constructor(catalog: RuntimeAssetCatalog, prefix?: string, strict?: boolean);
201
+ resolve: (source: string) => string;
202
+ dispose(): void;
203
+ }
204
+
205
+ declare const SCENE_DOCUMENT_FORMAT: "vis-scene";
206
+
207
+ declare interface SceneBackInteraction {
208
+ trigger: 'click' | 'clickOutside';
209
+ objectId: string;
210
+ filter?: SceneInteractionFilter;
211
+ action: {
212
+ type: 'back';
213
+ };
214
+ }
215
+
216
+ export declare type SceneBundleBinary = Blob | ArrayBuffer | Uint8Array;
217
+
218
+ declare interface SceneDocumentMarker {
219
+ format: typeof SCENE_DOCUMENT_FORMAT;
220
+ schemaVersion: number;
221
+ }
222
+
223
+ declare type SceneInteraction = SceneSwitchInteraction | SceneBackInteraction | MapRegionSwitchInteraction | MapRegionBackInteraction;
224
+
225
+ declare interface SceneInteractionFilter {
226
+ mode: 'include' | 'exclude';
227
+ objectIds?: string[];
228
+ baseObjectTypes?: string[];
229
+ }
230
+
231
+ declare interface SceneSwitchInteraction {
232
+ trigger: 'click' | 'clickOutside';
233
+ objectId: string;
234
+ filter?: SceneInteractionFilter;
235
+ action: {
236
+ type: 'switchScene';
237
+ sceneId: string;
238
+ };
239
+ }
240
+
241
+ declare interface SceneViewportDocument {
242
+ id: string;
243
+ name: string;
244
+ interactions?: SceneInteraction[];
245
+ cs?: Record<string, number[]>;
246
+ csa?: string;
247
+ vis: {
248
+ type: string;
249
+ options: Record<string, any>;
250
+ };
251
+ scene: Record<string, any>;
252
+ /** Scene-local SceneResources aliases. Locked means retained on export, not GPU residency. */
253
+ materialAliases?: Record<string, MaterialAlias>;
254
+ }
255
+
256
+ export declare function verifyAssetBytes(asset: RuntimeAsset, bytes: Uint8Array): Promise<void>;
257
+
258
+ export declare function verifySwitchKey(adcode: number, key: string): Promise<boolean>;
259
+
260
+ /** Exported keys must authorize exactly these targets, never a wildcard or province prefix. */
261
+ export declare function verifySwitchKeyScope(adcodes: readonly number[], key: string, projectId?: string): Promise<boolean>;
262
+
263
+ declare interface VisSceneDocument extends SceneDocumentMarker {
264
+ runtimeAssets?: RuntimeAssetCatalog;
265
+ entrySceneId: string;
266
+ scenes: SceneViewportDocument[];
267
+ /** Schema 4: serializable definitions shared by explicit asset identity. */
268
+ materialLibrary?: MaterialAsset[];
269
+ /** Reusable definitions. SDK-enabled assets are retained in deployment exports. */
270
+ prefabLibrary?: PrefabAsset[];
271
+ c?: Record<string, any>;
272
+ d?: Record<string, any>;
273
+ h?: Record<string, any>;
274
+ s?: string;
275
+ }
276
+
24
277
  export { }
package/dist/io.js CHANGED
@@ -1 +1 @@
1
- import{n as o,t as s}from"./jsonFetch-BQr9Uqag.js";export{s as isGzip,o as jsonFetch};
1
+ import{_ as s,a,c as o,d as m,g as r,h as t,i as e,m as i,n as p,o as c,p as n,r as y,s as d,t as f,u as g,v as h,y as j}from"./e-DpK8xI-B.js";export{e as MediaAssetWriter,g as RuntimeAssetResolver,m as assertMapNavigationTarget,a as assertMediaAssets,n as assetDigest,f as cityJsonName,i as decodeAssetBytes,t as encodeAssetBytes,h as isGzip,j as jsonFetch,c as mediaAssetPayload,r as mergeRuntimeAssets,o as readSceneBundleZip,d as resolveMediaAssets,s as verifyAssetBytes,p as verifySwitchKey,y as verifySwitchKeyScope};
@@ -0,0 +1 @@
1
+ import{A as e,Nt as t,k as s}from"./dist-CurDDdRW.js";import{i as a}from"./sha2-DroCzeNH.js";import{i as r,s as o}from"./e-DpK8xI-B.js";var i=/* @__PURE__ */t({externalizeRuntimeImages:()=>n,resolveRuntimeAssetImages:()=>f,resolveRuntimeImages:()=>u,restoreRuntimeImageFiles:()=>d});function n(e){const t=(new r).prepare(e);return Object.assign(e,t.document,{assets:t.assets}),t.files}function u(e,t,a){o(e,t,e=>{const t=a(e);return s(t)?t.data:t})}function d(t,s,a){u(t,s,t=>{const s=a[t];if(!s)throw Error(`Missing texture resource: ${t}`);return e(s.data.buffer.slice(s.data.byteOffset,s.data.byteOffset+s.data.byteLength),s.mimeType)})}function f(e,t,r){var o,i,n,u;const d=new Set(t),f=e=>Array.isArray(e)?e.map(f):"string"==typeof e?d.has(e)?r(e):e:s(e)&&"string"==typeof e.data&&d.has(e.data)?a(a({},e),{},{data:r(e.data)}):e,l=e=>{var t,s,a;for(const r of null!==(t=null==e?void 0:e.images)&&void 0!==t?t:[])r.url=f(r.url);for(const r of null!==(s=null==e?void 0:e.textures)&&void 0!==s?s:[])void 0!==(null===(a=r.userData)||void 0===a?void 0:a._videoSrc)&&(r.userData._videoSrc=f(r.userData._videoSrc))};l(e.scene);for(const s of null!==(o=e.scenes)&&void 0!==o?o:[])l(s.scene);for(const s of null!==(i=e.materialLibrary)&&void 0!==i?i:[])l(s.material);for(const s of null!==(n=e.prefabLibrary)&&void 0!==n?n:[])l(s.snapshot);(null===(u=e.d)||void 0===u?void 0:u.chartBg)&&l({images:e.d.chartBg.images,textures:[e.d.chartBg]})}export{i as a,d as i,f as n,u as r,n as t};
@@ -0,0 +1 @@
1
+ import{Nt as e}from"./dist-CurDDdRW.js";var s=/* @__PURE__ */e({SCENE_DOCUMENT_FORMAT:()=>n,SCENE_DOCUMENT_SCHEMA_VERSION:()=>6,SCENE_MANIFEST_FORMAT:()=>o,SCENE_MANIFEST_SCHEMA_VERSION:()=>5,assertSupportedSceneDocument:()=>c,isSceneDocument:()=>i,isSceneManifest:()=>a}),n="vis-scene",r=6,o="vis-scene-manifest",t=5;function i(e){if(!e||"object"!=typeof e)return!1;const s=e;return"vis-scene"===s.format&&Number.isInteger(s.schemaVersion)&&s.schemaVersion>=1}function a(e){return!(!e||"object"!=typeof e)&&e.format===o}function c(e){if(i(e)&&6!==e.schemaVersion)throw new Error(`Unsupported scene schema version: ${e.schemaVersion}. Import older documents in editor-platform. Required version: 6`)}export{c as a,s as c,t as i,r as n,i as o,o as r,a as s,n as t};
@@ -0,0 +1 @@
1
+ function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,r||"default");if("object"!=t(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}function r(t,r,n){return(r=e(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?n(Object(i),!0).forEach(function(e){r(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function o(t,e,r,n,i,o,s){try{var h=t[o](s),u=h.value}catch(t){return void r(t)}h.done?e(u):Promise.resolve(u).then(n,i)}function s(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function h(t){o(s,n,i,h,u,"next",t)}function u(t){o(s,n,i,h,u,"throw",t)}h(void 0)})}}function h(t,e,r=""){const n=(i=t)instanceof Uint8Array||ArrayBuffer.isView(i)&&"Uint8Array"===i.constructor.name&&"BYTES_PER_ELEMENT"in i&&1===i.BYTES_PER_ELEMENT;var i;const o=null==t?void 0:t.length,s=void 0!==e;if(!n||s&&o!==e){const i=(r&&`"${r}" `)+"expected Uint8Array"+(s?` of length ${e}`:"")+", got "+(n?`length=${o}`:"type="+typeof t);if(!n)throw new TypeError(i);throw new RangeError(i)}return t}function u(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function f(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function c(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function a(t,e){return t<<32-e|t>>>e}var l=/* @__PURE__ */(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),p=/* @__PURE__ */Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function b(t){if(h(t),l)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=p[t[r]];return e}var d;d=s(function*(){});function y(t,e={}){const r=(e,r)=>t(r).update(e).digest(),n=t(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=e=>t(e),Object.assign(r,e),Object.freeze(r)}var g=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});function v(t,e,r){return t&e^~t&r}function w(t,e,r){return t&e^t&r^e&r}var m=class{constructor(t,e,n,i){r(this,"blockLen",void 0),r(this,"outputLen",void 0),r(this,"canXOF",!1),r(this,"padOffset",void 0),r(this,"isLE",void 0),r(this,"buffer",void 0),r(this,"view",void 0),r(this,"finished",!1),r(this,"length",0),r(this,"pos",0),r(this,"destroyed",!1),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(t),this.view=c(this.buffer)}update(t){u(this),h(t);const{view:e,buffer:r,blockLen:n}=this,i=t.length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s===n){const e=c(t);for(;n<=i-o;o+=n)this.process(e,o);continue}r.set(t.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){u(this),function(t,e){h(t,void 0,"digestInto() output");const r=e.outputLen;if(t.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;e[o++]=128,f(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let h=o;h<n;h++)e[h]=0;r.setBigUint64(n-8,BigInt(8*this.length),i),this.process(r,0);const s=c(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const l=a/4,p=this.get();if(l>p.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<l;h++)s.setUint32(4*h,p[h],i)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return t.destroyed=o,t.finished=i,t.length=n,t.pos=s,n%e&&t.buffer.set(r),t}clone(){return this._cloneInto()}},E=/* @__PURE__ */Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),O=/* @__PURE__ */Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),L=/* @__PURE__ */new Uint32Array(64),A=class extends m{constructor(t){super(64,t,8,!1)}get(){const{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:h}=this;return[t,e,r,n,i,o,s,h]}set(t,e,r,n,i,o,s,h){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|h}process(t,e){for(let c=0;c<16;c++,e+=4)L[c]=t.getUint32(e,!1);for(let c=16;c<64;c++){const t=L[c-15],e=L[c-2],r=a(t,7)^a(t,18)^t>>>3;L[c]=(a(e,17)^a(e,19)^e>>>10)+L[c-7]+r+L[c-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:h,G:u,H:f}=this;for(let c=0;c<64;c++){const t=f+(a(s,6)^a(s,11)^a(s,25))+v(s,h,u)+O[c]+L[c]|0,e=(a(r,2)^a(r,13)^a(r,22))+w(r,n,i)|0;f=u,u=h,h=s,s=o+t|0,o=i,i=n,n=r,r=t+e|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,h=h+this.F|0,u=u+this.G|0,f=f+this.H|0,this.set(r,n,i,o,s,h,u,f)}roundClean(){f(L)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),f(this.buffer)}},j=class extends A{constructor(){super(32),r(this,"A",0|E[0]),r(this,"B",0|E[1]),r(this,"C",0|E[2]),r(this,"D",0|E[3]),r(this,"E",0|E[4]),r(this,"F",0|E[5]),r(this,"G",0|E[6]),r(this,"H",0|E[7])}},P=/* @__PURE__ */y(()=>new j,/* @__PURE__ */g(1));export{r as a,i,b as n,s as r,P as t};
@@ -0,0 +1 @@
1
+ import{Nt as e,Z as t,m as r,o as i}from"./dist-CurDDdRW.js";import{i as a}from"./sha2-DroCzeNH.js";import{a as o,i as n,n as s,o as d,s as l}from"./schema-B2o51seO.js";import{a as u,f as c,x as f}from"./e-DpK8xI-B.js";var v=["scenes","materialLibrary","prefabLibrary"],m=()=>{throw Error("Legacy resource pools must be imported in editor-platform before runtime loading")};function p(e){var t,r;const i=e.scene;void 0!==(null==i?void 0:i._texDataPool)&&m();const a=e=>{Array.isArray(e)?e.forEach(a):e&&"object"==typeof e&&("_documentResource"in e||"base64"===e.encoding)&&m()};for(const d of null!==(t=null==i?void 0:i.images)&&void 0!==t?t:[])a(d.url);for(const d of null!==(r=null==i?void 0:i.textures)&&void 0!==r?r:[]){var o,n,s;void 0===(null===(o=d.userData)||void 0===o?void 0:o._dataTexBase64)&&"number"!=typeof(null===(n=d.userData)||void 0===n?void 0:n._videoSrc)||m(),a(null===(s=d.userData)||void 0===s?void 0:s._videoSrc)}}function y(e){void 0===e._resourcePool&&void 0===e.imageAssets||m();for(const t of Array.isArray(e.scenes)?e.scenes:[])p(t);for(const t of Array.isArray(e.materialLibrary)?e.materialLibrary:[])p({scene:t.material});for(const t of Array.isArray(e.prefabLibrary)?e.prefabLibrary:[])p({scene:t.snapshot})}function w(e){return o(e),y(e),e}function b(e){w(e);const{scenes:t,materialLibrary:r,prefabLibrary:i}=e,a=f(e,v),o=structuredClone(a);return o.scenes=t.map(e=>structuredClone(e)),r&&(o.materialLibrary=r.map(e=>structuredClone(e))),i&&(o.prefabLibrary=i.map(e=>structuredClone(e))),o}function h(e,t,r){const i=JSON.stringify([e,t,r]),a=[2166136261,2654435769,2246822507,3266489909].map(e=>{let t=e;for(let r=0;r<i.length;r++)t=Math.imul(t^i.charCodeAt(r),16777619);return t^=t>>>16,t=Math.imul(t,2246822507),(t^t>>>13)>>>0}).map(e=>e.toString(16).padStart(8,"0")).join("");return`${a.slice(0,8)}-${a.slice(8,12)}-8${a.slice(13,16)}-${(3&parseInt(a[16],16)|8).toString(16)}${a.slice(17,20)}-${a.slice(20)}`}var g="_resourceSource",I="_materialAssetId",E="_materialAssetRevision",$="_materialRuntimeProperties",j=e=>structuredClone(e),D=e=>!!e&&"object"==typeof e&&!Array.isArray(e),A=e=>"map"===e||"matcap"===e||e.endsWith("Map");function O(e,t){var r;if(D(e)){t(e);for(const i of null!==(r=e.children)&&void 0!==r?r:[])O(i,t)}}function k(e,t){if("string"==typeof e)return t(e);if(Array.isArray(e))return e.map(e=>k(e,t));if(D(e))for(const r of Object.keys(e))e[r]=k(e[r],t);return e}function M(e,t){var i;const a=/* @__PURE__ */new Set;r(e,(e,t)=>{"PMREM_PLACEHOLDER"!==e[t]&&a.add(e[t])});for(const[r,d]of Object.entries(e))A(r)&&"string"==typeof d&&"PMREM_PLACEHOLDER"!==d&&a.add(d);const o=/* @__PURE__ */new Set,n=e=>{if("string"!=typeof e){if(e&&"object"==typeof e&&!o.has(e)){o.add(e);for(const t of Object.values(e))n(t)}}else t.has(e)&&a.add(e)};n(e.uniforms);for(const r of Object.values(null!==(i=e.uniforms)&&void 0!==i?i:{})){var s;if("t"===(null==r?void 0:r.type)&&"string"==typeof r.value&&"PMREM_PLACEHOLDER"!==r.value&&a.add(r.value),"tv"===(null==r?void 0:r.type))for(const e of null!==(s=r.value)&&void 0!==s?s:[])"string"==typeof e&&"PMREM_PLACEHOLDER"!==e&&a.add(e)}return a}function S(e,t){r(e,(e,r)=>{var i;e[r]=null!==(i=t.get(e[r]))&&void 0!==i?i:e[r]});for(const r of Object.keys(e)){var i;A(r)&&"string"==typeof e[r]&&(e[r]=null!==(i=t.get(e[r]))&&void 0!==i?i:e[r])}e.uniforms&&(e.uniforms=k(e.uniforms,e=>{var r;return null!==(r=t.get(e))&&void 0!==r?r:e}))}function _(e,t){let r=e,i=1;for(;t.has(r);)r=`${e}~${i++}`;return t.add(r),r}function L(e){const t=j(e);return t.userData&&(delete t.userData[I],delete t.userData[E],delete t.userData._materialAssetOverrideHash,delete t.userData._materialDynamic,delete t.userData[$],Object.keys(t.userData).length||delete t.userData),t}function x(e,t,r={}){var i,o,n,s,d,l;const u=new Set(null!==(i=r.editedProperties)&&void 0!==i?i:[]),c=null===(o=t.userData)||void 0===o?void 0:o[$],f=Array.isArray(c)?c.filter(e=>"string"==typeof e&&A(e)&&!u.has(e)):[],v=L(t);if(!f.length)return v;const m=L(e),p=null!==(n=v.textures)&&void 0!==n?n:[],y=null!==(s=v.images)&&void 0!==s?s:[],w=new Set(p.map(e=>e.uuid)),b=new Set(y.map(e=>e.uuid)),h=/* @__PURE__ */new Map,g=/* @__PURE__ */new Map;for(const $ of null!==(d=m.images)&&void 0!==d?d:[]){const e=y.find(e=>e.uuid===$.uuid),t=e&&JSON.stringify(e)!==JSON.stringify($)?_(`${$.uuid}:authored`,b):$.uuid;h.set($.uuid,t),b.add(t),y.some(e=>e.uuid===t)||y.push(a(a({},$),{},{uuid:t}))}for(const $ of null!==(l=m.textures)&&void 0!==l?l:[]){void 0!==$.image&&($.image=k($.image,e=>{var t;return null!==(t=h.get(e))&&void 0!==t?t:e}));const e=p.find(e=>e.uuid===$.uuid),t=e&&JSON.stringify(e)!==JSON.stringify($)?_(`${$.uuid}:authored`,w):$.uuid;g.set($.uuid,t),w.add(t),p.some(e=>e.uuid===t)||p.push(a(a({},$),{},{uuid:t}))}S(m,g);for(const a of f){var I,E;const e=v[a];if(!Object.hasOwn(m,a)){delete v[a];continue}v[a]=m[a];const t=p.find(e=>e.uuid===m[a]),r=p.find(t=>t.uuid===e);if(!t||!r)continue;const i=j(r);i.uuid=t.uuid,void 0===t.image?delete i.image:i.image=j(t.image);const o=null!==(I=i.userData)&&void 0!==I?I:i.userData={};for(const a of Object.keys(o))("_videoSrc"===a||a.startsWith("_dataTex"))&&delete o[a];for(const[a,n]of Object.entries(null!==(E=t.userData)&&void 0!==E?E:{}))("_videoSrc"===a||a.startsWith("_dataTex"))&&(o[a]=j(n));Object.keys(o).length||delete i.userData,JSON.stringify(i)!==JSON.stringify(t)&&(i.uuid=_(`${t.uuid}:sampler`,w),p.push(i),v[a]=i.uuid)}return U({id:"authored-material",name:"",vis:{type:"base",options:{}},scene:{materials:[v],textures:p,images:y}},v.uuid)}function P(e){const t=e.scene,r=r=>{var i;const a=/* @__PURE__ */new Map;for(const o of null!==(i=t[r])&&void 0!==i?i:[]){if("string"!=typeof(null==o?void 0:o.uuid)||!o.uuid||a.has(o.uuid))throw new Error(`Invalid ${r} identity in scene ${e.id}`);a.set(o.uuid,o)}return a},i=r("materials"),a=r("textures");return{scene:e,materials:i,textures:a,images:r("images"),textureIds:new Set(a.keys())}}function C(e,t){const{scene:r,materials:i,textures:a,images:o,textureIds:n}=e;r.scene;const s=i.get(t);if(!s)throw new Error(`Missing material ${t} in scene ${r.id}`);const d=L(s);delete d.textures,delete d.images;const l=M(d,n),u=[],c=/* @__PURE__ */new Set;for(const v of l){const e=a.get(v);if(!e)throw new Error(`Missing texture ${v} for material ${t} in scene ${r.id}`);const i=j(e);u.push(i);for(const t of[i.image].flat()){var f;if("string"==typeof t)if(o.has(t))c.add(t);else if(!(null===(f=i.userData)||void 0===f?void 0:f._videoSrc))throw new Error(`Missing image ${t} for texture ${v} in scene ${r.id}`)}}return u.length&&(d.textures=u),c.size&&(d.images=[...c].map(e=>j(o.get(e)))),d}function U(e,t){return K(e)(t)}function K(e){const t=P(e);return e=>C(t,e)}function R(e,t=h(e.id,"material",e.material.uuid)){var r,i;const o=L(e.material),n=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map;for(const a of null!==(r=o.images)&&void 0!==r?r:[]){const t=a.uuid;a.uuid=h(e.id,"image",t),n.set(t,a.uuid)}for(const d of null!==(i=o.textures)&&void 0!==i?i:[]){const t=d.uuid;d.uuid=h(e.id,"texture",t),s.set(t,d.uuid),d.userData=a(a({},d.userData),{},{[g]:{assetId:e.id,textureUuid:t,imageUuids:[d.image].flat().filter(e=>"string"==typeof e)}}),void 0!==d.image&&(d.image=k(d.image,e=>{var t;return null!==(t=n.get(e))&&void 0!==t?t:e}))}return S(o,s),o.uuid=t,o.name=e.name,o.userData=a(a({},o.userData),{},{[I]:e.id,[E]:e.revision,[g]:{assetId:e.id,materialUuid:e.material.uuid}}),o}function T(e,t){return N(e,t).filter(e=>!e.optionPath)}function N(e,t){const r=[];for(const n of e.scenes){var a,o;const e=new Map((null!==(a=n.scene.materials)&&void 0!==a?a:[]).filter(e=>{var t;return null===(t=e.userData)||void 0===t?void 0:t[I]}).map(e=>[e.uuid,e.userData[I]]));O(n.scene.object,a=>{const o=new Set([a.material].flat());[a.material].flat().forEach((i,o)=>{const s=e.get(i);!s||void 0!==t&&s!==t||r.push({assetId:s,sceneId:n.id,objectId:a.uuid||"",slot:o})}),i(a.userData,(i,s,d)=>{const l=i[s],u=e.get(l);!u||o.has(l)||void 0!==t&&u!==t||(o.add(l),r.push({assetId:u,sceneId:n.id,objectId:a.uuid||"",slot:0,optionPath:d}))},n.scene._sharedOptionsPool)});for(const[i,a]of Object.entries(null!==(o=n.materialAliases)&&void 0!==o?o:{}))void 0!==t&&t!==a.assetId||r.push({assetId:a.assetId,sceneId:n.id,objectId:"",slot:0,alias:i})}return r}function J(e,t){var r;return(null!==(r=e.prefabLibrary)&&void 0!==r?r:[]).filter(e=>{var r;return null===(r=e.snapshot.materials)||void 0===r?void 0:r.some(e=>{var r;return(null===(r=e.userData)||void 0===r?void 0:r[I])===t})})}function z(e,t=[],r=[]){return V(e,t,r).map(e=>j(e))}function V(e,t=[],r=[]){var i,a,o;const n=new Set((null!==(i=e.scene.materials)&&void 0!==i?i:[]).map(e=>{var t;return null===(t=e.userData)||void 0===t?void 0:t[I]}).filter(Boolean));for(const d of r)for(const e of null!==(a=d.snapshot.materials)&&void 0!==a?a:[]){var s;const t=null===(s=e.userData)||void 0===s?void 0:s[I];t&&n.add(t)}for(const d of Object.values(null!==(o=e.materialAliases)&&void 0!==o?o:{}))n.add(d.assetId);return t.filter(t=>n.has(t.id)||"scene"===t.scope.kind&&t.scope.sceneId===e.id)}function H(e){if(void 0!==e&&!Array.isArray(e))throw new Error("Invalid project material library");const t=/* @__PURE__ */new Map;for(const l of null!=e?e:[]){var r,i,a,o,n;if(!D(l)||"string"!=typeof l.id||!l.id||t.has(l.id)||!Number.isInteger(l.revision)||l.revision<1||"string"!=typeof l.name||!D(l.material)||"string"!=typeof l.material.type||!l.material.type||"string"!=typeof l.material.uuid||!l.material.uuid||void 0!==l.locked&&"boolean"!=typeof l.locked||void 0!==l.alwaysExport&&"boolean"!=typeof l.alwaysExport||!D(l.scope)||!["project","scene"].includes(l.scope.kind)||"scene"===l.scope.kind&&("string"!=typeof l.scope.sceneId||!l.scope.sceneId))throw new Error(`Invalid or duplicate material asset ${null!==(n=null==l?void 0:l.id)&&void 0!==n?n:""}`);if(void 0!==(null===(r=l.material.userData)||void 0===r?void 0:r._materialAssetId)||void 0!==(null===(i=l.material.userData)||void 0===i?void 0:i._materialAssetRevision))throw new Error(`Material asset ${l.id} must not contain its own binding`);for(const t of["textures","images"]){var s;if(void 0!==l.material[t]&&!Array.isArray(l.material[t]))throw new Error(`Invalid ${t} in material asset ${l.id}`);const e=/* @__PURE__ */new Set;for(const r of null!==(s=l.material[t])&&void 0!==s?s:[]){if(!D(r)||"string"!=typeof r.uuid||!r.uuid||e.has(r.uuid))throw new Error(`Invalid ${t} identity in material asset ${l.id}`);e.add(r.uuid)}}p({scene:l.material});const e=new Map((null!==(a=l.material.textures)&&void 0!==a?a:[]).map(e=>[e.uuid,e])),u=new Set((null!==(o=l.material.images)&&void 0!==o?o:[]).map(e=>e.uuid));for(const t of M(l.material,new Set(e.keys()))){const r=e.get(t);if(!r)throw new Error(`Missing texture ${t} for material ${l.material.uuid} in scene ${l.id}`);for(const e of[r.image].flat()){var d;if("string"==typeof e&&!u.has(e)&&!(null===(d=r.userData)||void 0===d?void 0:d._videoSrc))throw new Error(`Missing image ${e} for texture ${t} in scene ${l.id}`)}}t.set(l.id,l)}return t}function q(e){G(e,H(e.materialLibrary))}function G(e,t){var r;if(void 0!==e.materialLibrary&&e.schemaVersion<4)throw new Error("Project material library requires schema 4");const i=new Set(e.scenes.map(e=>null==e?void 0:e.id));for(const f of t.values())if("scene"===f.scope.kind&&!i.has(f.scope.sceneId))throw new Error(`Material asset ${f.id} belongs to missing scene ${f.scope.sceneId}`);if(void 0!==e.prefabLibrary&&!Array.isArray(e.prefabLibrary))throw new Error("Invalid prefab library");for(const f of null!==(r=e.prefabLibrary)&&void 0!==r?r:[]){var a;if(!D(f)||!D(f.snapshot)||void 0!==f.snapshot.materials&&!Array.isArray(f.snapshot.materials))throw new Error("Invalid prefab material definitions");for(const e of null!==(a=f.snapshot.materials)&&void 0!==a?a:[]){var o,n;if(!D(e))throw new Error("Invalid prefab material definition");const r=null===(o=e.userData)||void 0===o?void 0:o[I];if(void 0===r)continue;const i=t.get(r);if(!i)throw new Error(`Missing material asset ${r} in prefab ${f.name}`);if("project"!==i.scope.kind)throw new Error(`Prefab ${f.name} requires project material ${r}`);const a=null===(n=e.userData)||void 0===n?void 0:n[E];if(void 0!==a&&(!Number.isInteger(a)||a<1||a>i.revision))throw new Error(`Invalid material asset revision in prefab ${f.name}`)}}for(const f of e.scenes){var s,d,l;if(!f)throw new Error("Invalid material scene");if(void 0!==f.materialAliases&&!D(f.materialAliases))throw new Error(`Invalid material catalog in scene ${f.id}`);for(const[e,r]of Object.entries(null!==(s=f.materialAliases)&&void 0!==s?s:{})){if(!e||!D(r)||!t.has(r.assetId)||void 0!==r.locked&&"boolean"!=typeof r.locked)throw new Error(`Invalid material catalog entry ${e} in scene ${f.id}`);W(t.get(r.assetId),f.id)}for(const e of null!==(d=null===(l=f.scene)||void 0===l?void 0:l.materials)&&void 0!==d?d:[]){var u,c;const r=null===(u=e.userData)||void 0===u?void 0:u[I];if(void 0===r)continue;const i=t.get(r);if(!i)throw new Error(`Missing material asset ${r} in scene ${f.id}`);W(i,f.id);const a=null===(c=e.userData)||void 0===c?void 0:c[E];if(void 0!==a&&(!Number.isInteger(a)||a<1||a>i.revision))throw new Error(`Invalid material asset revision in scene ${f.id}`)}}}function W(e,t){if("scene"===e.scope.kind&&e.scope.sceneId!==t)throw new Error(`Material asset ${e.id} belongs to scene ${e.scope.sceneId}, not ${t}`)}function B(e){const t=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map,a=e=>{var a;const o=null===(a=e.userData)||void 0===a?void 0:a[I];t.has(e.uuid)||t.set(e.uuid,e),r.has(o)||r.set(o,e);let n=i.get(e.uuid);n||i.set(e.uuid,n=/* @__PURE__ */new Map),n.has(o)||n.set(o,e)};for(const o of e)a(o);return{byUuid:t,add:a,bound:(e,t)=>{var r;return null===(r=i.get(e))||void 0===r?void 0:r.get(t)},resolve:(e,t)=>{var a,o;return null!==(a=null===(o=i.get(e))||void 0===o?void 0:o.get(t))&&void 0!==a?a:r.get(t)}}}function F(e){const t=/* @__PURE__ */new Map;return e.forEach((e,r)=>{t.has(e.uuid)||t.set(e.uuid,r)}),t}function Z(e,r){var i,a,o;const n=e.scene,s=null!==(i=n.materials)&&void 0!==i?i:[];let d=B(s);for(const[t,y]of Object.entries(null!==(a=e.materialAliases)&&void 0!==a?a:{})){var l,u,c,f,v;const i=r.get(y.assetId);if(!i)throw new Error(`Missing material asset ${y.assetId} in scene ${e.id}`);let a=d.resolve(t,y.assetId);a||(a={uuid:t,type:i.material.type,userData:{[I]:i.id,[E]:i.revision}},s.push(a),d.add(a),n.materials=s);const o=null!==(l=n.materialAliases)&&void 0!==l?l:n.materialAliases={};if(o[t]&&o[t].materialUuid!==a.uuid)throw new Error(`Conflicting material catalog ${t}`);o[t]={materialUuid:a.uuid,locked:!(!(null===(u=o[t])||void 0===u?void 0:u.locked)&&!y.locked),roles:[.../* @__PURE__ */new Set([...null!==(c=null===(f=o[t])||void 0===f?void 0:f.roles)&&void 0!==c?c:[],...null!==(v=y.roles)&&void 0!==v?v:[]])]}}t(n,e.vis.options),d=B(s);const m={};for(const[t,y]of Object.entries(null!==(o=n.materialAliases)&&void 0!==o?o:{})){var p;const e=d.byUuid.get(y.materialUuid),r=null==e||null===(p=e.userData)||void 0===p?void 0:p[I];r&&(m[t]={assetId:r,locked:!!y.locked})}Object.keys(m).length?e.materialAliases=m:delete e.materialAliases}function Q(e){return o(e),X(b(e))}function X(e){var t;const r=w(e),i=H(r.materialLibrary),o=new Set(i.keys()),n=null!==(t=r.materialLibrary)&&void 0!==t?t:[];for(const f of r.scenes){var s,d,l;let e;Z(f,i);const t=/* @__PURE__ */new Map;for(const d of null!==(s=f.scene.materials)&&void 0!==s?s:[]){var u;if(t.has(d.uuid))throw new Error(`Duplicate material ${d.uuid} in scene ${f.id}`);t.set(d.uuid,d);let r=null===(u=d.userData)||void 0===u?void 0:u[I];if(void 0===r){var c;r=h(f.id,"material-asset",d.uuid);let t=0;for(;o.has(r);)r=h(f.id,"material-asset",`${d.uuid}:${++t}`);o.add(r);const s={id:r,revision:1,name:d.name||d.uuid,scope:{kind:"scene",sceneId:f.id},material:C(null!==(c=e)&&void 0!==c?c:e=P(f),d.uuid)};n.push(s),i.set(r,s),d.userData=a(a({},d.userData),{},{[I]:r,[E]:1})}if(!i.has(r))throw new Error(`Missing material asset ${r} in scene ${f.id}`);W(i.get(r),f.id)}const r={},v=(e,a,o)=>{var n,s,d;const l=i.get(a.assetId);if(!l)throw new Error(`Missing material asset ${a.assetId} in scene ${f.id}`);const u=t.get(null!=o?o:e),c=(null==u||null===(n=u.userData)||void 0===n?void 0:n._materialAssetId)===a.assetId?u.uuid:null!==(s=null===(d=[...t.values()].find(e=>{var t;return(null===(t=e.userData)||void 0===t?void 0:t._materialAssetId)===a.assetId}))||void 0===d?void 0:d.uuid)&&void 0!==s?s:h(l.id,"material",l.material.uuid),v=r[c];if(v&&v.assetId!==a.assetId)throw new Error(`Conflicting material UUID ${c} in scene ${f.id}`);r[c]={assetId:a.assetId,locked:!(!(null==v?void 0:v.locked)&&!a.locked)},a.locked&&(l.locked=!0)};for(const[i,a]of Object.entries(null!==(d=f.materialAliases)&&void 0!==d?d:{}))v(i,a);for(const[i,a]of Object.entries(null!==(l=f.scene.materialAliases)&&void 0!==l?l:{})){const e=t.get(null==a?void 0:a.materialUuid);if(!i||!e||void 0!==a.locked&&"boolean"!=typeof a.locked)throw new Error(`Invalid runtime material alias ${i} in scene ${f.id}`);v(i,{assetId:e.userData[I],locked:!!a.locked},e.uuid)}Object.keys(r).length?f.materialAliases=r:delete f.materialAliases,delete f.scene.materialAliases}return r.schemaVersion=Math.max(r.schemaVersion,4),r.materialLibrary=n,q(r),r}function Y(e,t=[]){return ae(e,H(t))}function ee(e,t=[]){return oe(e,H(t))}function te(e,t=[]){const r=H(t);return e.map(e=>ae(e,r))}function re(e,t){if(Object.is(e,t))return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t||Array.isArray(e)!==Array.isArray(t))return!1;const r=Object.keys(e);return r.length===Object.keys(t).length&&r.every(r=>Object.hasOwn(t,r)&&re(e[r],t[r]))}function ie(e,t,r,i){const o=H(t),n=H(r);if(o.size!==n.size)throw new Error("Material definition patches cannot add or remove assets");const s=function(e,t){if(void 0===e)return;const r=e=>Array.isArray(e)&&e.every(e=>"string"==typeof e&&!!e)&&new Set(e).size===e.length;if(!e||!r(e.assetIds)||!r(e.properties))throw new Error("Invalid material definition scope");const i=new Set(e.assetIds);if(i.size!==t.length||t.some(e=>!i.has(e)))throw new Error("Material definition scope must match the patched assets");return new Set(e.properties)}(i,[...n.keys()]),d=/* @__PURE__ */new Map,l=/* @__PURE__ */new Set(["uuid","type","metadata","textures","images","nodes","inputNodes","uniforms","userData","name"]),u=e=>null==e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e&&Number.isFinite(e);for(const[a,c]of n){const e=o.get(a);if(!e||!re(e.scope,c.scope)||e.locked!==c.locked)throw new Error("Material definition patches cannot change asset identity, scope or lock");if(e.name!==c.name&&s&&!s.has("name"))throw new Error("Material definition patch exceeds declared properties: name");const t=[];for(const r of/* @__PURE__ */new Set([...Object.keys(e.material),...Object.keys(c.material)]))if(!re(e.material[r],c.material[r])||Object.hasOwn(e.material,r)!==Object.hasOwn(c.material,r)){if(l.has(r)||A(r)||!u(e.material[r])||!u(c.material[r]))throw new Error(`Material definition patch requires full materialization: ${r}`);if(s&&!s.has(r))throw new Error(`Material definition patch exceeds declared properties: ${r}`);t.push(r)}d.set(a,{asset:c,properties:t})}return e.map(e=>{var t;let r=!1;const i=(null!==(t=e.scene.materials)&&void 0!==t?t:[]).map(t=>{var i;const o=d.get(null===(i=t.userData)||void 0===i?void 0:i[I]);if(!o)return t;if(W(o.asset,e.id),"string"!=typeof t.uuid||!t.uuid||t.type!==o.asset.material.type)throw new Error("Material definition patches require normalized scene bindings");r=!0;const n=a(a({},t),{},{name:o.asset.name,userData:a(a({},t.userData),{},{[E]:o.asset.revision})});for(const e of o.properties)Object.hasOwn(o.asset.material,e)?n[e]=o.asset.material[e]:delete n[e];return n});return r?a(a({},e),{},{scene:a(a({},e.scene),{},{materials:i})}):e})}function ae(e,t){return oe(j(e),t)}function oe(e,t){var r,i,o,n,s,d,l;const u=e;Z(e,t);const c=e.scene;delete c.materialAliases;const f=null!==(r=c.materials)&&void 0!==r?r:[],v=B(f),m={};for(const[a,I]of Object.entries(null!==(i=e.materialAliases)&&void 0!==i?i:{})){var p;const e=t.get(I.assetId);if(!e)throw new Error(`Missing material asset ${I.assetId} in scene ${u.id}`);const r=v.resolve(a,I.assetId),i=null!==(p=null==r?void 0:r.uuid)&&void 0!==p?p:h(e.id,"material",e.material.uuid),o=m[i];m[i]={assetId:I.assetId,locked:!(!(null==o?void 0:o.locked)&&!I.locked)}}Object.keys(m).length?e.materialAliases=m:delete e.materialAliases;for(const[a,h]of Object.entries(null!==(o=e.materialAliases)&&void 0!==o?o:{})){if(v.bound(a,h.assetId))continue;const e=t.get(h.assetId);if(!e)throw new Error(`Missing material asset ${h.assetId} in scene ${u.id}`);const r={uuid:a,type:e.material.type,userData:{[I]:e.id,[E]:e.revision}};f.push(r),v.add(r)}f.length&&(c.materials=f);const y=null!==(n=c.textures)&&void 0!==n?n:[],w=null!==(s=c.images)&&void 0!==s?s:[],b=F(y),g=F(w),$=new Set(y.map(e=>e.uuid)),D=/* @__PURE__ */new Map,A=/* @__PURE__ */new Set;for(const a of null!==(d=c.materials)&&void 0!==d?d:[]){var k,S,_;const e=null===(k=a.userData)||void 0===k?void 0:k[I];if(void 0===e)continue;const r=t.get(e);if(!r)throw new Error(`Missing material asset ${e} in scene ${u.id}`);W(r,u.id);for(const t of M(a,$))A.add(t);if(D.has(e))continue;const i=R(r);for(const t of null!==(S=i.images)&&void 0!==S?S:[]){const e=g.get(t.uuid);void 0!==e?w[e]=t:(g.set(t.uuid,w.length),w.push(t))}for(const t of null!==(_=i.textures)&&void 0!==_?_:[]){const e=b.get(t.uuid);$.add(t.uuid),void 0!==e?y[e]=t:(b.set(t.uuid,y.length),y.push(t))}delete i.textures,delete i.images,delete i.metadata,D.set(e,i)}c.materials&&(c.materials=c.materials.map(e=>{var t;const r=D.get(null===(t=e.userData)||void 0===t?void 0:t[I]);return r?a(a({},j(r)),{},{uuid:e.uuid}):e}));const L=/* @__PURE__ */new Set;for(const a of null!==(l=c.materials)&&void 0!==l?l:[])for(const e of M(a,$))L.add(e);O(c.object,e=>{for(const t of["background","environment"])"string"==typeof e[t]&&L.add(e[t])});const x=/* @__PURE__ */new Set,P=y.filter(e=>{if(!A.has(e.uuid)||L.has(e.uuid))return!0;for(const t of[e.image].flat())"string"==typeof t&&x.add(t);return!1}),C=new Set(P.flatMap(e=>[e.image].flat()));return(c.textures||P.length)&&(c.textures=P),(c.images||w.length)&&(c.images=w.filter(e=>!x.has(e.uuid)||C.has(e.uuid))),e}function ne(e){const t=b(e),r=H(t.materialLibrary);return G(t,r),t.scenes=t.scenes.map(e=>ae(e,r)),t}function se(e){const t=w(e),r=H(t.materialLibrary);return G(t,r),t.scenes=t.scenes.map(e=>oe(e,r)),t}function de(e,r={}){var i,o,n;const s=r.consumeInput?e.scene:j(e.scene);if(r.omitPrefabPreviews){const e=t=>{var r,i,a,o,n;return!t||!((null===(r=t.userData)||void 0===r?void 0:r._prefabPreview)||(null===(i=t.userData)||void 0===i||null===(i=i._baseObjectUserData)||void 0===i?void 0:i._prefabPreview)||(null===(a=t.userData)||void 0===a?void 0:a._templatePreviewContainer)||(null===(o=t.userData)||void 0===o||null===(o=o._baseObjectUserData)||void 0===o?void 0:o._templatePreviewContainer)||"@TemplatePreview"===(null===(n=t.userData)||void 0===n?void 0:n._baseObjectKeyType))&&(t.children&&(t.children=t.children.filter(e)),!0)};if(!e(s.object))throw new Error("A scene root cannot be a prefab preview")}const d=new Map((null!==(i=s.materials)&&void 0!==i?i:[]).map(e=>{var t;return[null===(t=e.userData)||void 0===t?void 0:t[I],e.uuid]})),l=new Map((null!==(o=s.materials)&&void 0!==o?o:[]).map(e=>[e.uuid,e])),u=a({},s.materialAliases);for(const[t,a]of Object.entries(null!==(n=e.materialAliases)&&void 0!==n?n:{})){var c,f,v,m,p;const r=(null===(c=l.get(t))||void 0===c||null===(c=c.userData)||void 0===c?void 0:c._materialAssetId)===a.assetId?t:d.get(a.assetId);if(!r)throw new Error(`Missing material for alias ${t} in scene ${e.id}`);if(u[t]&&u[t].materialUuid!==r)throw new Error(`Conflicting material catalog ${t}`);u[t]={materialUuid:r,locked:!(!(null===(f=u[t])||void 0===f?void 0:f.locked)&&!a.locked),roles:[.../* @__PURE__ */new Set([...null!==(v=null===(m=u[t])||void 0===m?void 0:m.roles)&&void 0!==v?v:[],...null!==(p=a.roles)&&void 0!==p?p:[]])]}}return Object.keys(u).length&&(s.materialAliases=u),t(s),s}var le=["scenes","materialLibrary","prefabLibrary"];function ue(e,t=e.entrySceneId,r={}){const i=e.scenes.find(e=>e.id===t);if(!i)throw Error(`Scene ${t} was not found`);if(!r.resolveResources)return i;p(i);const a=structuredClone(i);return e.materialLibrary&&ee(a,e.materialLibrary),a}function ce(e,t){const r=ue(e,t,{resolveResources:!0}),{scenes:i,materialLibrary:o,prefabLibrary:n}=e,s=f(e,le);return a(a(a(a({},structuredClone(s)),n?{prefabLibrary:structuredClone(n)}:{}),o?{materialLibrary:z(r,o,n)}:{}),{},{entrySceneId:r.id,scenes:[a(a({},r),{},{interactions:void 0})]})}var fe=/* @__PURE__ */e({assertRuntimeSceneDocument:()=>we,assertSceneManifest:()=>pe});function ve(e,t){if(void 0===e)return;if(!Array.isArray(e))throw new Error("Invalid prefab library");const r=/* @__PURE__ */new Set,i=/* @__PURE__ */new Set;for(const n of e){var a,o;if(!n||"string"!=typeof n.id||!n.id||r.has(n.id)||"string"!=typeof n.name||!Number.isInteger(n.revision)||n.revision<1||!(null===(a=n.snapshot)||void 0===a?void 0:a.object))throw new Error("Invalid prefab definition");if(r.add(n.id),void 0!==n.sdkKey){if("string"!=typeof n.sdkKey||!n.sdkKey.trim()||n.sdkKey!==n.sdkKey.trim()||i.has(n.sdkKey))throw new Error("Invalid or duplicate prefab SDK key");i.add(n.sdkKey)}if(void 0!==n.materialMode&&"embedded"!==n.materialMode)throw new Error("Invalid prefab material mode");if("embedded"===n.materialMode&&(null!==(o=n.snapshot.materials)&&void 0!==o?o:[]).some(e=>{var t;return void 0!==(null==e||null===(t=e.userData)||void 0===t?void 0:t._materialAssetId)}))throw new Error("Embedded prefab materials must not reference the project material library");me(n.snapshot.object),t&&ye(n.snapshot,`prefab ${n.id}`)}for(const n of e)if(void 0!==n.sdkKey&&n.sdkKey!==n.id&&r.has(n.sdkKey))throw new Error("Prefab SDK key conflicts with another asset id")}function me(e){var t;if(e){if(["@Group","@PrefabGroup"].some(t=>{var r,i;return(null===(r=e.userData)||void 0===r?void 0:r._baseObjectKeyType)===t||(null===(i=e.userData)||void 0===i?void 0:i._baseObjectKey)===t}))throw new Error("Legacy object or prefab groups must be imported in editor-platform before runtime loading or export");for(const r of null!==(t=e.children)&&void 0!==t?t:[])me(r)}}function pe(e){if(!l(e))throw new Error("Invalid scene manifest format");if(5!==e.schemaVersion)throw new Error(`Unsupported scene manifest version: ${e.schemaVersion}`);if(!Array.isArray(e.scenes)||0===e.scenes.length)throw new Error("Invalid scene manifest: scenes must not be empty");c(e.runtimeAssets),u(e.assets),y(e),ve(e.prefabLibrary,!0);const t=/* @__PURE__ */new Set;for(const i of e.scenes){var r;if("string"!=typeof(null==i?void 0:i.id)||!i.id||t.has(i.id)||"string"!=typeof i.name||!i.name||"string"!=typeof(null===(r=i.vis)||void 0===r?void 0:r.type)||!i.vis.type||"string"!=typeof i.source||!i.source)throw new Error("Invalid scene manifest entry");t.add(i.id)}if(!t.has(e.entrySceneId))throw new Error(`Invalid scene manifest: entry scene ${e.entrySceneId} was not found`);q({schemaVersion:6,materialLibrary:e.materialLibrary,prefabLibrary:e.prefabLibrary,scenes:e.scenes.map(e=>a(a({},e),{},{scene:{}}))});for(const i of e.scenes)for(const e of i.interactions||[]){const r="switchScene"===e.action.type||"switchMapRegion"===e.action.type?e.action.sceneId:void 0;if(r&&!t.has(r))throw new Error(`Invalid interaction target ${r} in scene ${i.id}`)}}function ye(e,t){const r=e=>{var i;if(!e)return;const a=e.userData;if(void 0!==(null==a?void 0:a._baseObjectKey)||void 0!==(null==a?void 0:a._baseObjectUuid))throw new Error(`Legacy wrapper identity in ${t}; import it in editor-platform before exporting schema 5`);if(void 0!==(null==a?void 0:a._baseObjectObjectType)&&(1!==a._baseObjectIdentityVersion||"string"!=typeof e.uuid||!e.uuid))throw new Error(`Invalid canonical wrapper identity in ${t}`);for(const t of null!==(i=e.children)&&void 0!==i?i:[])r(t)};r(null==e?void 0:e.object)}function we(e){if(!d(e))throw new Error("Unsupported legacy JSON. Import it in editor-platform and export a vis-scene document first.");if(o(e),c(e.runtimeAssets),!Array.isArray(e.scenes)||0===e.scenes.length)throw new Error("Invalid vis-scene document: scenes must not be empty");y(e),q(e),ve(e.prefabLibrary,!0);const t=/* @__PURE__ */new Set;for(const o of e.scenes){var r;if(void 0!==(null==o?void 0:o.eo))throw new Error("Legacy eo must be migrated in editor-platform before runtime loading");if(void 0!==(null==o?void 0:o.set))throw new Error("Legacy set must be migrated to vis.options.controls in editor-platform before runtime loading");if(!(null==o?void 0:o.id)||t.has(o.id))throw new Error("Invalid vis-scene document: duplicate or empty scene id");if(!(null===(r=o.vis)||void 0===r?void 0:r.type)||!o.scene)throw new Error(`Invalid scene ${o.id}: missing vis or scene graph`);const e=t=>{var r,i,a,o,n,s;if(t){if(!0===(null===(r=t.userData)||void 0===r?void 0:r.prefab)||!0===(null===(i=t.userData)||void 0===i||null===(i=i._baseObjectUserData)||void 0===i?void 0:i.prefab))throw new Error("Legacy prefab sources must be imported in editor-platform before runtime loading or export");if(["@Group","@PrefabGroup"].some(e=>{var r,i;return(null===(r=t.userData)||void 0===r?void 0:r._baseObjectKeyType)===e||(null===(i=t.userData)||void 0===i?void 0:i._baseObjectKey)===e}))throw new Error("Legacy object or prefab groups must be imported in editor-platform before runtime loading or export");var d;if((null===(a=t.userData)||void 0===a?void 0:a._templatePreviewContainer)||(null===(o=t.userData)||void 0===o||null===(o=o._baseObjectUserData)||void 0===o?void 0:o._templatePreviewContainer)||"@TemplatePreview"===(null===(n=t.userData)||void 0===n?void 0:n._baseObjectKeyType))for(const e of null!==(d=t.children)&&void 0!==d?d:[]){var l,u,c,f;if(!(null===(l=e.userData)||void 0===l?void 0:l._prefabPreview)&&!(null===(u=e.userData)||void 0===u||null===(u=u._baseObjectUserData)||void 0===u?void 0:u._prefabPreview)&&!(null===(c=e.userData)||void 0===c?void 0:c._templatePreviewContainer)&&"@TemplatePreview"!==(null===(f=e.userData)||void 0===f?void 0:f._baseObjectKeyType))throw new Error("Template preview containers cannot contain ordinary scene instances")}for(const r of null!==(s=t.children)&&void 0!==s?s:[])e(r)}};e(o.scene.object),ye(o.scene,`scene ${o.id}`),t.add(o.id)}if(!t.has(e.entrySceneId))throw new Error(`Invalid vis-scene document: entry scene ${e.entrySceneId} was not found`);for(const o of e.scenes){if(void 0!==o.interactions&&!Array.isArray(o.interactions))throw new Error(`Invalid scene ${o.id}: interactions must be an array`);const r=/* @__PURE__ */new Set;for(const d of o.interactions||[]){var i,a,n,s,l,u,f;const c="back"===(null==d||null===(i=d.action)||void 0===i?void 0:i.type)||"backMapRegion"===(null==d||null===(a=d.action)||void 0===a?void 0:a.type)&&"map"===o.vis.type||"switchScene"===(null==d||null===(n=d.action)||void 0===n?void 0:n.type)&&t.has(d.action.sceneId)||"switchMapRegion"===(null==d||null===(s=d.action)||void 0===s?void 0:s.type)&&"map"===o.vis.type&&t.has(d.action.sceneId)&&"map"===ue(e,d.action.sceneId).vis.type&&("clicked"===d.action.adcode||Number.isInteger(d.action.adcode)&&d.action.adcode>=0);if("click"!==(null==d?void 0:d.trigger)&&"clickOutside"!==(null==d?void 0:d.trigger)||"switchMapRegion"===(null==d||null===(l=d.action)||void 0===l?void 0:l.type)&&"click"!==d.trigger||!d.objectId||"clickOutside"===d.trigger&&void 0!==d.filter||void 0!==d.filter&&("include"!==d.filter.mode&&"exclude"!==d.filter.mode||void 0!==d.filter.objectIds&&(!Array.isArray(d.filter.objectIds)||d.filter.objectIds.some(e=>"string"!=typeof e||!e))||void 0!==d.filter.baseObjectTypes&&(!Array.isArray(d.filter.baseObjectTypes)||d.filter.baseObjectTypes.some(e=>"string"!=typeof e||!e))||!(null===(u=d.filter.objectIds)||void 0===u?void 0:u.length)&&!(null===(f=d.filter.baseObjectTypes)||void 0===f?void 0:f.length))||!c||r.has(`${d.trigger}:${d.objectId}`))throw new Error(`Invalid interaction in scene ${o.id}`);r.add(`${d.trigger}:${d.objectId}`)}}}export{L as A,E as C,U as D,K as E,y as F,p as I,b as L,O as M,g as N,R as O,h as P,w as R,I as S,j as T,N as _,ce as a,V as b,ee as c,Y as d,te as f,q as g,W as h,ue as i,_ as j,x as k,ne as l,Q as m,pe as n,de as o,X as p,fe as r,se as s,we as t,ie as u,T as v,$ as w,z as x,J as y};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vis-core",
3
- "version": "0.33.16",
3
+ "version": "0.33.18",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "prettier": "fe-stack/prettier.json",
@@ -36,6 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@noble/curves": "^2.0.1",
39
+ "@noble/hashes": "^2.2.0",
39
40
  "@turf/turf": "^6.5.0",
40
41
  "@types/d3-geo": "^3.0.2",
41
42
  "@types/events": "^3.0.0",
@@ -43,12 +44,13 @@
43
44
  "@types/three": "0.186.0",
44
45
  "esus-lite": "^0.2.8",
45
46
  "events": "^3.3.0",
46
- "geojson-cn": "^0.2.5"
47
+ "geojson-cn": "^0.2.5",
48
+ "jszip": "^3.10.1"
47
49
  },
48
50
  "devDependencies": {
49
51
  "@types/node": "^25.0.6",
50
52
  "fe-stack": "0.2.0",
51
- "gl-draw": "0.19.14",
53
+ "gl-draw": "0.19.16",
52
54
  "terser": "^5.46.1",
53
55
  "three": "0.186.1",
54
56
  "vite": "^8.1.0",
@@ -1 +0,0 @@
1
- function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var r=s.call(t,n||"default");if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==e(n)?n:n+""}function n(e,n,s){return(n=t(n))in e?Object.defineProperty(e,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[n]=s,e}function s(e,t,n,s,r,i,o){try{var a=e[i](o),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function r(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){s(o,r,i,a,l,"next",e)}function l(e){s(o,r,i,a,l,"throw",e)}a(void 0)})}}var i,o,a,l=new class{constructor(e=32,t=67108864){n(this,"pending",/* @__PURE__ */new Map),n(this,"values",/* @__PURE__ */new Map),n(this,"bytes",0),n(this,"maxEntries",void 0),n(this,"maxBytes",void 0),this.maxEntries=e,this.maxBytes=t}load(e,t){const n=this.values.get(e);if(n)return this.values.delete(e),this.values.set(e,n),Promise.resolve(n);const s=this.pending.get(e);if(s)return s;const r=Promise.resolve().then(t).then(t=>{if(this.pending.get(e)===r&&(this.pending.delete(e),this.maxEntries>0&&t.bytes<=this.maxBytes))for(this.values.set(e,t),this.bytes+=t.bytes;this.values.size>this.maxEntries||this.bytes>this.maxBytes;)this.deleteValue(this.values.keys().next().value);return t},t=>{throw this.pending.get(e)===r&&this.pending.delete(e),t});return this.pending.set(e,r),r}deleteValue(e){const t=this.values.get(e);t&&(this.bytes-=t.bytes),this.values.delete(e)}clear(e){void 0!==e?(this.pending.delete(e),this.deleteValue(e)):(this.pending.clear(),this.values.clear(),this.bytes=0)}},u=e=>!(!e.endsWith(".gzip")&&!e.endsWith(".gz")),c=(i=r(function*(e,t,n=u){const s=yield window.fetch(e);if(!s.ok){try{var r;yield null===(r=s.body)||void 0===r?void 0:r.cancel()}catch(l){}throw new Error("Network response was not ok.")}let i=s;if(t)try{i=((e,t)=>{const n=Number(e.headers.get("content-length"))||0;let s=0;return e.body?new globalThis.Response(e.body.pipeThrough(new globalThis.TransformStream({start(){t({percent:0,transferredBytes:0,totalBytes:n})},transform(e,r){s+=e.byteLength,t({percent:0===n?0:s/n,transferredBytes:s,totalBytes:n}),r.enqueue(e)},flush(){t({percent:1,transferredBytes:s,totalBytes:n})}})),{status:e.status,statusText:e.statusText,headers:e.headers}):(t({percent:1,totalBytes:n,transferredBytes:s}),new globalThis.Response(null,{status:e.status,statusText:e.statusText,headers:e.headers}))})(i,t)}catch(c){try{var o;yield null===(o=s.body)||void 0===o?void 0:o.cancel(c)}catch(h){}throw c}if(n(e)&&"gzip"!==i.headers.get("content-encoding")){const e=new DecompressionStream("gzip"),t=i.body.pipeThrough(e);i=new Response(t)}const a=yield i.text();return{json:JSON.parse(a),bytes:2*a.length}}),function(e,t){return i.apply(this,arguments)}),h=(o=r(function*(e,t,n=u,s){const r=((e,t)=>{const n=null==t?void 0:t.cache;if(!1===n)return{enabled:!1,key:e,clone:!1};if(!0===n)return{enabled:!0,key:e,clone:!0};if(n&&"object"==typeof n){var s,r,i;const t=null===(s=n.enabled)||void 0===s||s;return{enabled:t,key:null!==(r=n.key)&&void 0!==r?r:e,clone:!!t&&(null===(i=n.clone)||void 0===i||i)}}return{enabled:!1,key:e,clone:!1}})(e,s),i=()=>c(e,t,n),o=r.enabled?l.load(r.key,i):i();try{const e=(yield o).json;return{res:r.enabled&&r.clone?structuredClone(e):e,err:void 0}}catch(a){return{res:void 0,err:a}}}),function(e,t){return o.apply(this,arguments)}),d=/^(?:[a-z]+:)?\/\//i,y=(a=r(function*(e,t){const{res:n,err:s}=yield h(((e,t="")=>d.test(e)?e:`${t.endsWith("/")?t.slice(0,-1):t}${e.startsWith("/")?e:`/${e}`}`)(e,null==t?void 0:t.assetsPrefix),void 0,void 0,(null==t?void 0:t.fetchOptions)||{cache:!0});if(s)throw s;return n}),function(e,t){return a.apply(this,arguments)});export{n as a,r as i,h as n,y as r,u as t};