gaussian-splat-lite 1.3.2 → 1.4.0

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.
@@ -0,0 +1,340 @@
1
+ export class RawDecoder {
2
+ __destroy_into_raw() {
3
+ const ptr = this.__wbg_ptr;
4
+ this.__wbg_ptr = 0;
5
+ RawDecoderFinalization.unregister(this);
6
+ return ptr;
7
+ }
8
+ free() {
9
+ const ptr = this.__destroy_into_raw();
10
+ wasm.__wbg_rawdecoder_free(ptr, 0);
11
+ }
12
+ finish() {
13
+ const ret = wasm.rawdecoder_finish(this.__wbg_ptr);
14
+ if (ret[1]) {
15
+ throw takeFromExternrefTable0(ret[0]);
16
+ }
17
+ }
18
+ /**
19
+ * @param {string} path
20
+ * @param {number} size
21
+ * @param {Function} callback
22
+ */
23
+ constructor(path, size, callback) {
24
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
25
+ const len0 = WASM_VECTOR_LEN;
26
+ const ret = wasm.rawdecoder_new(ptr0, len0, size, callback);
27
+ if (ret[2]) {
28
+ throw takeFromExternrefTable0(ret[1]);
29
+ }
30
+ this.__wbg_ptr = ret[0] >>> 0;
31
+ RawDecoderFinalization.register(this, this.__wbg_ptr, this);
32
+ return this;
33
+ }
34
+ /**
35
+ * @param {Uint8Array} bytes
36
+ */
37
+ push(bytes) {
38
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
39
+ const len0 = WASM_VECTOR_LEN;
40
+ const ret = wasm.rawdecoder_push(this.__wbg_ptr, ptr0, len0);
41
+ if (ret[1]) {
42
+ throw takeFromExternrefTable0(ret[0]);
43
+ }
44
+ }
45
+ }
46
+ if (Symbol.dispose) RawDecoder.prototype[Symbol.dispose] = RawDecoder.prototype.free;
47
+
48
+ export function wasm_start() {
49
+ wasm.wasm_start();
50
+ }
51
+
52
+ function __wbg_get_imports() {
53
+ const import0 = {
54
+ __proto__: null,
55
+ __wbg___wbindgen_throw_81fc77679af83bc6: function(arg0, arg1) {
56
+ throw new Error(getStringFromWasm0(arg0, arg1));
57
+ },
58
+ __wbg_call_f2ac1622600b957f: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
59
+ const ret = arg0.call(arg1, arg2, arg3, arg4);
60
+ return ret;
61
+ }, arguments); },
62
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
63
+ let deferred0_0;
64
+ let deferred0_1;
65
+ try {
66
+ deferred0_0 = arg0;
67
+ deferred0_1 = arg1;
68
+ console.error(getStringFromWasm0(arg0, arg1));
69
+ } finally {
70
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
71
+ }
72
+ },
73
+ __wbg_new_227d7c05414eb861: function() {
74
+ const ret = new Error();
75
+ return ret;
76
+ },
77
+ __wbg_new_e3b04b4d53d1b593: function(arg0, arg1) {
78
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
79
+ return ret;
80
+ },
81
+ __wbg_new_from_slice_d85ad974cf8f6f35: function(arg0, arg1) {
82
+ const ret = new Float32Array(getArrayF32FromWasm0(arg0, arg1));
83
+ return ret;
84
+ },
85
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
86
+ const ret = arg1.stack;
87
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
88
+ const len1 = WASM_VECTOR_LEN;
89
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
90
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
91
+ },
92
+ __wbindgen_cast_0000000000000001: function(arg0) {
93
+ // Cast intrinsic for `F64 -> Externref`.
94
+ const ret = arg0;
95
+ return ret;
96
+ },
97
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
98
+ // Cast intrinsic for `Ref(String) -> Externref`.
99
+ const ret = getStringFromWasm0(arg0, arg1);
100
+ return ret;
101
+ },
102
+ __wbindgen_init_externref_table: function() {
103
+ const table = wasm.__wbindgen_externrefs;
104
+ const offset = table.grow(4);
105
+ table.set(0, undefined);
106
+ table.set(offset + 0, undefined);
107
+ table.set(offset + 1, null);
108
+ table.set(offset + 2, true);
109
+ table.set(offset + 3, false);
110
+ },
111
+ };
112
+ return {
113
+ __proto__: null,
114
+ "./decoder_bg.js": import0,
115
+ };
116
+ }
117
+
118
+ const RawDecoderFinalization = (typeof FinalizationRegistry === 'undefined')
119
+ ? { register: () => {}, unregister: () => {} }
120
+ : new FinalizationRegistry(ptr => wasm.__wbg_rawdecoder_free(ptr >>> 0, 1));
121
+
122
+ function addToExternrefTable0(obj) {
123
+ const idx = wasm.__externref_table_alloc();
124
+ wasm.__wbindgen_externrefs.set(idx, obj);
125
+ return idx;
126
+ }
127
+
128
+ function getArrayF32FromWasm0(ptr, len) {
129
+ ptr = ptr >>> 0;
130
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
131
+ }
132
+
133
+ let cachedDataViewMemory0 = null;
134
+ function getDataViewMemory0() {
135
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
136
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
137
+ }
138
+ return cachedDataViewMemory0;
139
+ }
140
+
141
+ let cachedFloat32ArrayMemory0 = null;
142
+ function getFloat32ArrayMemory0() {
143
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
144
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
145
+ }
146
+ return cachedFloat32ArrayMemory0;
147
+ }
148
+
149
+ function getStringFromWasm0(ptr, len) {
150
+ ptr = ptr >>> 0;
151
+ return decodeText(ptr, len);
152
+ }
153
+
154
+ let cachedUint8ArrayMemory0 = null;
155
+ function getUint8ArrayMemory0() {
156
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
157
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
158
+ }
159
+ return cachedUint8ArrayMemory0;
160
+ }
161
+
162
+ function handleError(f, args) {
163
+ try {
164
+ return f.apply(this, args);
165
+ } catch (e) {
166
+ const idx = addToExternrefTable0(e);
167
+ wasm.__wbindgen_exn_store(idx);
168
+ }
169
+ }
170
+
171
+ function passArray8ToWasm0(arg, malloc) {
172
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
173
+ getUint8ArrayMemory0().set(arg, ptr / 1);
174
+ WASM_VECTOR_LEN = arg.length;
175
+ return ptr;
176
+ }
177
+
178
+ function passStringToWasm0(arg, malloc, realloc) {
179
+ if (realloc === undefined) {
180
+ const buf = cachedTextEncoder.encode(arg);
181
+ const ptr = malloc(buf.length, 1) >>> 0;
182
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
183
+ WASM_VECTOR_LEN = buf.length;
184
+ return ptr;
185
+ }
186
+
187
+ let len = arg.length;
188
+ let ptr = malloc(len, 1) >>> 0;
189
+
190
+ const mem = getUint8ArrayMemory0();
191
+
192
+ let offset = 0;
193
+
194
+ for (; offset < len; offset++) {
195
+ const code = arg.charCodeAt(offset);
196
+ if (code > 0x7F) break;
197
+ mem[ptr + offset] = code;
198
+ }
199
+ if (offset !== len) {
200
+ if (offset !== 0) {
201
+ arg = arg.slice(offset);
202
+ }
203
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
204
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
205
+ const ret = cachedTextEncoder.encodeInto(arg, view);
206
+
207
+ offset += ret.written;
208
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
209
+ }
210
+
211
+ WASM_VECTOR_LEN = offset;
212
+ return ptr;
213
+ }
214
+
215
+ function takeFromExternrefTable0(idx) {
216
+ const value = wasm.__wbindgen_externrefs.get(idx);
217
+ wasm.__externref_table_dealloc(idx);
218
+ return value;
219
+ }
220
+
221
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
222
+ cachedTextDecoder.decode();
223
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
224
+ let numBytesDecoded = 0;
225
+ function decodeText(ptr, len) {
226
+ numBytesDecoded += len;
227
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
228
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
229
+ cachedTextDecoder.decode();
230
+ numBytesDecoded = len;
231
+ }
232
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
233
+ }
234
+
235
+ const cachedTextEncoder = new TextEncoder();
236
+
237
+ if (!('encodeInto' in cachedTextEncoder)) {
238
+ cachedTextEncoder.encodeInto = function (arg, view) {
239
+ const buf = cachedTextEncoder.encode(arg);
240
+ view.set(buf);
241
+ return {
242
+ read: arg.length,
243
+ written: buf.length
244
+ };
245
+ };
246
+ }
247
+
248
+ let WASM_VECTOR_LEN = 0;
249
+
250
+ let wasmModule, wasm;
251
+ function __wbg_finalize_init(instance, module) {
252
+ wasm = instance.exports;
253
+ wasmModule = module;
254
+ cachedDataViewMemory0 = null;
255
+ cachedFloat32ArrayMemory0 = null;
256
+ cachedUint8ArrayMemory0 = null;
257
+ wasm.__wbindgen_start();
258
+ return wasm;
259
+ }
260
+
261
+ async function __wbg_load(module, imports) {
262
+ if (typeof Response === 'function' && module instanceof Response) {
263
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
264
+ try {
265
+ return await WebAssembly.instantiateStreaming(module, imports);
266
+ } catch (e) {
267
+ const validResponse = module.ok && expectedResponseType(module.type);
268
+
269
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
270
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
271
+
272
+ } else { throw e; }
273
+ }
274
+ }
275
+
276
+ const bytes = await module.arrayBuffer();
277
+ return await WebAssembly.instantiate(bytes, imports);
278
+ } else {
279
+ const instance = await WebAssembly.instantiate(module, imports);
280
+
281
+ if (instance instanceof WebAssembly.Instance) {
282
+ return { instance, module };
283
+ } else {
284
+ return instance;
285
+ }
286
+ }
287
+
288
+ function expectedResponseType(type) {
289
+ switch (type) {
290
+ case 'basic': case 'cors': case 'default': return true;
291
+ }
292
+ return false;
293
+ }
294
+ }
295
+
296
+ function initSync(module) {
297
+ if (wasm !== undefined) return wasm;
298
+
299
+
300
+ if (module !== undefined) {
301
+ if (Object.getPrototypeOf(module) === Object.prototype) {
302
+ ({module} = module)
303
+ } else {
304
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
305
+ }
306
+ }
307
+
308
+ const imports = __wbg_get_imports();
309
+ if (!(module instanceof WebAssembly.Module)) {
310
+ module = new WebAssembly.Module(module);
311
+ }
312
+ const instance = new WebAssembly.Instance(module, imports);
313
+ return __wbg_finalize_init(instance, module);
314
+ }
315
+
316
+ async function __wbg_init(module_or_path) {
317
+ if (wasm !== undefined) return wasm;
318
+
319
+
320
+ if (module_or_path !== undefined) {
321
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
322
+ ({module_or_path} = module_or_path)
323
+ } else {
324
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
325
+ }
326
+ }
327
+
328
+
329
+ const imports = __wbg_get_imports();
330
+
331
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
332
+ module_or_path = fetch(module_or_path);
333
+ }
334
+
335
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
336
+
337
+ return __wbg_finalize_init(instance, module);
338
+ }
339
+
340
+ export { initSync, __wbg_init as default };
Binary file