@ifc-lite/wasm 10.5.0 → 10.6.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.
package/README.md CHANGED
@@ -292,3 +292,23 @@ distances and unresolved units, curves or placements fail explicitly. The
292
292
  `approximate` flag identifies supported approximation paths; it must be exposed
293
293
  to precision-sensitive consumers. Whole-source parsing belongs in a disposable
294
294
  worker when used by the viewer, so releasing the tool also releases WASM pages.
295
+
296
+ ## Rust diff bindings
297
+
298
+ After initializing `@ifc-lite/wasm/diff`, `DiffModel` owns fingerprint columns for repeated synchronous comparisons. Its constructor accepts a string dictionary, five string indices per entity (key, IFC class, data hash, geometry hash, container), presence flags, six bounding-box coordinates per entity, volumes, component offsets, and component key/value indices. Column dictionary strings must be well-formed Unicode; the internal TypeScript column adapter explicitly rejects lone surrogates rather than replacing them. Arbitrary UTF-16 entity-key transport remains a requirement for the public facade cutover in #8042; the public TypeScript comparison API continues to accept those keys. An absent optional string uses `0xffffffff`; flag bits 0, 1, and 2 represent a bounding box, volume, and components. Call `.free()` in `finally` for each model.
299
+
300
+ `DiffModel.compare` returns row indices instead of JavaScript references. Keep the original fingerprint arrays and restore those references on the JavaScript side; opaque references never cross into WASM. The model can be reused for more comparisons before freeing it.
301
+
302
+ `diffStableHash` accepts UTF-16 code units, including unpaired surrogates. `diffBuildDataFingerprint` and `diffBuildComponentFingerprints` accept IFC adapter projections directly.
303
+
304
+ In staging PR #8081 these two raw typed boundaries require well-formed UTF-16: they reject unpaired surrogates before conversion to Rust strings, including every typed name, material/classification string, property/quantity object key, and recursively nested value. Literal U+FFFD, valid surrogate pairs, and scalar-only hashes retain the TypeScript semantics. Only known record fields are read; ignored extras (including assigned-type `globalId`) are not validated or hashed. Property-value objects are content, so all their keys and values are validated. The boundary decoder mirrors the Rust input schema and must be kept in sync when that schema changes. This is an explicit staging limitation, consistent with the column and lineage guards, rather than arbitrary UTF-16 support: the public `@ifc-lite/diff` index still uses TypeScript and continues to accept arbitrary UTF-16. The separate final facade must retain lossless `JsString` transport (#8042).
305
+
306
+ `diffCreateSidecar`, `diffValidateSidecar`, and `diffSerializeSidecar` handle the small JSON sidecar documents; date validation uses the host's `Date.parse`. Sidecar serialization includes the trailing newline.
307
+
308
+ `diffLineageConflicts(entries)` returns ordered conflict diagnostics, and `diffKeyAliasesFromLineage(entries)` returns head/base pairs in insertion order for constructing a JavaScript `Map`. `diffRekeyByLineage(keys, entries, deleted, policy)` migrates external keys using `copy-to-all`, `largest-share`, or `orphan-on-split`. These helpers accept lineage objects directly, preserving non-finite share values and the existing TypeScript policy behavior. Deleted keys have no `relation` field in their result. Invalid-share policy changes are tracked separately in #8084. In this staging payload, every raw lineage string (base/head keys, reason, relation, rekey keys, deleted keys, and policy) must be well-formed UTF-16. The bindings reject unpaired surrogates before serde or wasm-bindgen can replace them; literal U+FFFD and valid surrogate pairs remain accepted. This limited scalar domain is temporary: the full lossless `JsString` engine/facade followup removes the rejection before public cutover.
309
+
310
+ These bindings are the staged backend for issue #8042. The public `@ifc-lite/diff` facade has not switched to them yet; existing consumers keep their current initialization contract until integration and performance qualification complete.
311
+
312
+ The Rust diff engine is a separate `@ifc-lite/wasm/diff` payload, built from `rust/diff-wasm` by `scripts/build-wasm.sh`. Its `DiffModel`, canonical fingerprint, sidecar and lineage bindings are loaded by explicit diff initialization; they are excluded from both geometry bundles. The committed `pkg-diff/ifc-lite-diff.d.ts` supports wasm-free typechecking.
313
+
314
+ The real IFC parity runner (`node scripts/diff-real-fixture-parity.mjs`) reports executed/total pairs. Missing fixtures are skipped with a `pnpm fixtures` hint; zero executed pairs exits with status 2 (incomplete), rather than claiming parity.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "IFC-Lite Contributors"
6
6
  ],
7
7
  "description": "WebAssembly bindings for IFC-Lite",
8
- "version": "10.5.0",
8
+ "version": "10.6.0",
9
9
  "license": "MPL-2.0",
10
10
  "repository": {
11
11
  "type": "git",
@@ -18,7 +18,11 @@
18
18
  "pkg/snippets/**",
19
19
  "retained.js",
20
20
  "retained.d.ts",
21
- "pkg-retained/ifc-lite.d.ts"
21
+ "pkg-retained/ifc-lite.d.ts",
22
+ "pkg-diff/ifc-lite-diff.js",
23
+ "pkg-diff/ifc-lite-diff_bg.wasm",
24
+ "pkg-diff/ifc-lite-diff.d.ts",
25
+ "pkg-diff/snippets/**"
22
26
  ],
23
27
  "main": "./pkg/ifc-lite.js",
24
28
  "module": "./pkg/ifc-lite.js",
@@ -34,7 +38,13 @@
34
38
  "types": "./retained.d.ts",
35
39
  "import": "./retained.js",
36
40
  "default": "./retained.js"
37
- }
41
+ },
42
+ "./diff": {
43
+ "types": "./pkg-diff/ifc-lite-diff.d.ts",
44
+ "import": "./pkg-diff/ifc-lite-diff.js",
45
+ "default": "./pkg-diff/ifc-lite-diff.js"
46
+ },
47
+ "./diff_bg.wasm": "./pkg-diff/ifc-lite-diff_bg.wasm"
38
48
  },
39
49
  "sideEffects": false,
40
50
  "keywords": [
@@ -52,6 +62,6 @@
52
62
  "bugs": "https://github.com/LTplus-AG/ifc-lite/issues",
53
63
  "scripts": {
54
64
  "build": "node ../../scripts/run-build-wasm.mjs",
55
- "test": "node --test test/*.test.mjs"
65
+ "test": "node --experimental-strip-types --test test/*.test.mjs"
56
66
  }
57
67
  }
Binary file
@@ -0,0 +1,109 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export class DiffModel {
5
+ free(): void;
6
+ [Symbol.dispose](): void;
7
+ /**
8
+ * Compare this base model with a head model, returning row-index records.
9
+ * No JS reference is serialized, cloned, or retained inside WASM.
10
+ */
11
+ compare(head: DiffModel, options: any): any;
12
+ /**
13
+ * Create an owned model from columnar buffers. Call free() when finished;
14
+ * a model may participate in any number of comparisons before that.
15
+ */
16
+ constructor(strings: any, fields: Uint32Array, flags: Uint8Array, boxes: Float64Array, volumes: Float64Array, component_offsets: Uint32Array, component_pairs: Uint32Array);
17
+ readonly entityCount: number;
18
+ }
19
+
20
+ /**
21
+ * Component hashes share the canonical Rust attribute projection.
22
+ */
23
+ export function diffBuildComponentFingerprints(input: any): any;
24
+
25
+ /**
26
+ * Hash adapter data directly in Rust without a JSON text round trip.
27
+ */
28
+ export function diffBuildDataFingerprint(input: any): string;
29
+
30
+ /**
31
+ * Normalize, deduplicate and validate an identity or lineage sidecar.
32
+ */
33
+ export function diffCreateSidecar(text: string, lineage: boolean): string;
34
+
35
+ /**
36
+ * Return head/base pairs in JavaScript Map insertion order.
37
+ */
38
+ export function diffKeyAliasesFromLineage(value: any): any;
39
+
40
+ /**
41
+ * Return ordered conflict diagnostics for caller-supplied lineage entries.
42
+ */
43
+ export function diffLineageConflicts(value: any): string[];
44
+
45
+ /**
46
+ * Migrate keys using Rust policies, preserving the absence of orphan relations.
47
+ */
48
+ export function diffRekeyByLineage(keys: string[], value: any, deleted: string[], policy: string): any;
49
+
50
+ /**
51
+ * Emit JSON.stringify-compatible pretty bytes and the trailing newline.
52
+ */
53
+ export function diffSerializeSidecar(text: string): string;
54
+
55
+ /**
56
+ * Raw code units preserve JS strings that cannot be represented as Rust UTF-8.
57
+ */
58
+ export function diffStableHash(units: Uint16Array): string;
59
+
60
+ /**
61
+ * Host decoding preserves lone UTF-16 units even inside conflict diagnostics.
62
+ */
63
+ export function diffValidateSidecar(text: string, lineage: boolean): string[];
64
+
65
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
66
+
67
+ export interface InitOutput {
68
+ readonly memory: WebAssembly.Memory;
69
+ readonly __wbg_diffmodel_free: (a: number, b: number) => void;
70
+ readonly diffBuildComponentFingerprints: (a: number, b: number) => void;
71
+ readonly diffBuildDataFingerprint: (a: number, b: number) => void;
72
+ readonly diffCreateSidecar: (a: number, b: number, c: number) => void;
73
+ readonly diffKeyAliasesFromLineage: (a: number, b: number) => void;
74
+ readonly diffLineageConflicts: (a: number, b: number) => void;
75
+ readonly diffRekeyByLineage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
76
+ readonly diffSerializeSidecar: (a: number, b: number) => void;
77
+ readonly diffStableHash: (a: number, b: number, c: number) => void;
78
+ readonly diffValidateSidecar: (a: number, b: number, c: number) => void;
79
+ readonly diffmodel_compare: (a: number, b: number, c: number, d: number) => void;
80
+ readonly diffmodel_entityCount: (a: number) => number;
81
+ readonly diffmodel_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => void;
82
+ readonly __wbindgen_export: (a: number, b: number) => number;
83
+ readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
84
+ readonly __wbindgen_export3: (a: number) => void;
85
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
86
+ readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
87
+ }
88
+
89
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
90
+
91
+ /**
92
+ * Instantiates the given `module`, which can either be bytes or
93
+ * a precompiled `WebAssembly.Module`.
94
+ *
95
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
96
+ *
97
+ * @returns {InitOutput}
98
+ */
99
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
100
+
101
+ /**
102
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
103
+ * for everything else, calls `WebAssembly.instantiate` directly.
104
+ *
105
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
106
+ *
107
+ * @returns {Promise<InitOutput>}
108
+ */
109
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
@@ -0,0 +1,952 @@
1
+ /* @ts-self-types="./ifc-lite-diff.d.ts" */
2
+
3
+ export class DiffModel {
4
+ __destroy_into_raw() {
5
+ const ptr = this.__wbg_ptr;
6
+ this.__wbg_ptr = 0;
7
+ DiffModelFinalization.unregister(this);
8
+ return ptr;
9
+ }
10
+ free() {
11
+ const ptr = this.__destroy_into_raw();
12
+ wasm.__wbg_diffmodel_free(ptr, 0);
13
+ }
14
+ /**
15
+ * Compare this base model with a head model, returning row-index records.
16
+ * No JS reference is serialized, cloned, or retained inside WASM.
17
+ * @param {DiffModel} head
18
+ * @param {any} options
19
+ * @returns {any}
20
+ */
21
+ compare(head, options) {
22
+ try {
23
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
24
+ _assertClass(head, DiffModel);
25
+ wasm.diffmodel_compare(retptr, this.__wbg_ptr, head.__wbg_ptr, addHeapObject(options));
26
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
27
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
28
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
29
+ if (r2) {
30
+ throw takeObject(r1);
31
+ }
32
+ return takeObject(r0);
33
+ } finally {
34
+ wasm.__wbindgen_add_to_stack_pointer(16);
35
+ }
36
+ }
37
+ /**
38
+ * @returns {number}
39
+ */
40
+ get entityCount() {
41
+ const ret = wasm.diffmodel_entityCount(this.__wbg_ptr);
42
+ return ret >>> 0;
43
+ }
44
+ /**
45
+ * Create an owned model from columnar buffers. Call free() when finished;
46
+ * a model may participate in any number of comparisons before that.
47
+ * @param {any} strings
48
+ * @param {Uint32Array} fields
49
+ * @param {Uint8Array} flags
50
+ * @param {Float64Array} boxes
51
+ * @param {Float64Array} volumes
52
+ * @param {Uint32Array} component_offsets
53
+ * @param {Uint32Array} component_pairs
54
+ */
55
+ constructor(strings, fields, flags, boxes, volumes, component_offsets, component_pairs) {
56
+ try {
57
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
58
+ const ptr0 = passArray32ToWasm0(fields, wasm.__wbindgen_export);
59
+ const len0 = WASM_VECTOR_LEN;
60
+ const ptr1 = passArray8ToWasm0(flags, wasm.__wbindgen_export);
61
+ const len1 = WASM_VECTOR_LEN;
62
+ const ptr2 = passArrayF64ToWasm0(boxes, wasm.__wbindgen_export);
63
+ const len2 = WASM_VECTOR_LEN;
64
+ const ptr3 = passArrayF64ToWasm0(volumes, wasm.__wbindgen_export);
65
+ const len3 = WASM_VECTOR_LEN;
66
+ const ptr4 = passArray32ToWasm0(component_offsets, wasm.__wbindgen_export);
67
+ const len4 = WASM_VECTOR_LEN;
68
+ const ptr5 = passArray32ToWasm0(component_pairs, wasm.__wbindgen_export);
69
+ const len5 = WASM_VECTOR_LEN;
70
+ wasm.diffmodel_new(retptr, addHeapObject(strings), ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
71
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
72
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
73
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
74
+ if (r2) {
75
+ throw takeObject(r1);
76
+ }
77
+ this.__wbg_ptr = r0;
78
+ DiffModelFinalization.register(this, this.__wbg_ptr, this);
79
+ return this;
80
+ } finally {
81
+ wasm.__wbindgen_add_to_stack_pointer(16);
82
+ }
83
+ }
84
+ }
85
+ if (Symbol.dispose) DiffModel.prototype[Symbol.dispose] = DiffModel.prototype.free;
86
+
87
+ /**
88
+ * Component hashes share the canonical Rust attribute projection.
89
+ * @param {any} input
90
+ * @returns {any}
91
+ */
92
+ export function diffBuildComponentFingerprints(input) {
93
+ try {
94
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
95
+ wasm.diffBuildComponentFingerprints(retptr, addHeapObject(input));
96
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
97
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
98
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
99
+ if (r2) {
100
+ throw takeObject(r1);
101
+ }
102
+ return takeObject(r0);
103
+ } finally {
104
+ wasm.__wbindgen_add_to_stack_pointer(16);
105
+ }
106
+ }
107
+
108
+ /**
109
+ * Hash adapter data directly in Rust without a JSON text round trip.
110
+ * @param {any} input
111
+ * @returns {string}
112
+ */
113
+ export function diffBuildDataFingerprint(input) {
114
+ let deferred2_0;
115
+ let deferred2_1;
116
+ try {
117
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
118
+ wasm.diffBuildDataFingerprint(retptr, addHeapObject(input));
119
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
120
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
121
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
122
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
123
+ var ptr1 = r0;
124
+ var len1 = r1;
125
+ if (r3) {
126
+ ptr1 = 0; len1 = 0;
127
+ throw takeObject(r2);
128
+ }
129
+ deferred2_0 = ptr1;
130
+ deferred2_1 = len1;
131
+ return getStringFromWasm0(ptr1, len1);
132
+ } finally {
133
+ wasm.__wbindgen_add_to_stack_pointer(16);
134
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
135
+ }
136
+ }
137
+
138
+ /**
139
+ * Normalize, deduplicate and validate an identity or lineage sidecar.
140
+ * @param {string} text
141
+ * @param {boolean} lineage
142
+ * @returns {string}
143
+ */
144
+ export function diffCreateSidecar(text, lineage) {
145
+ let deferred2_0;
146
+ let deferred2_1;
147
+ try {
148
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
149
+ wasm.diffCreateSidecar(retptr, addHeapObject(text), lineage);
150
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
151
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
152
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
153
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
154
+ var ptr1 = r0;
155
+ var len1 = r1;
156
+ if (r3) {
157
+ ptr1 = 0; len1 = 0;
158
+ throw takeObject(r2);
159
+ }
160
+ deferred2_0 = ptr1;
161
+ deferred2_1 = len1;
162
+ return getStringFromWasm0(ptr1, len1);
163
+ } finally {
164
+ wasm.__wbindgen_add_to_stack_pointer(16);
165
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
166
+ }
167
+ }
168
+
169
+ /**
170
+ * Return head/base pairs in JavaScript Map insertion order.
171
+ * @param {any} value
172
+ * @returns {any}
173
+ */
174
+ export function diffKeyAliasesFromLineage(value) {
175
+ try {
176
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
177
+ wasm.diffKeyAliasesFromLineage(retptr, addHeapObject(value));
178
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
179
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
180
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
181
+ if (r2) {
182
+ throw takeObject(r1);
183
+ }
184
+ return takeObject(r0);
185
+ } finally {
186
+ wasm.__wbindgen_add_to_stack_pointer(16);
187
+ }
188
+ }
189
+
190
+ /**
191
+ * Return ordered conflict diagnostics for caller-supplied lineage entries.
192
+ * @param {any} value
193
+ * @returns {string[]}
194
+ */
195
+ export function diffLineageConflicts(value) {
196
+ try {
197
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
198
+ wasm.diffLineageConflicts(retptr, addHeapObject(value));
199
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
200
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
201
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
202
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
203
+ if (r3) {
204
+ throw takeObject(r2);
205
+ }
206
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
207
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
208
+ return v1;
209
+ } finally {
210
+ wasm.__wbindgen_add_to_stack_pointer(16);
211
+ }
212
+ }
213
+
214
+ /**
215
+ * Migrate keys using Rust policies, preserving the absence of orphan relations.
216
+ * @param {string[]} keys
217
+ * @param {any} value
218
+ * @param {string[]} deleted
219
+ * @param {string} policy
220
+ * @returns {any}
221
+ */
222
+ export function diffRekeyByLineage(keys, value, deleted, policy) {
223
+ try {
224
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
225
+ const ptr0 = passArrayJsValueToWasm0(keys, wasm.__wbindgen_export);
226
+ const len0 = WASM_VECTOR_LEN;
227
+ const ptr1 = passArrayJsValueToWasm0(deleted, wasm.__wbindgen_export);
228
+ const len1 = WASM_VECTOR_LEN;
229
+ wasm.diffRekeyByLineage(retptr, ptr0, len0, addHeapObject(value), ptr1, len1, addHeapObject(policy));
230
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
231
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
232
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
233
+ if (r2) {
234
+ throw takeObject(r1);
235
+ }
236
+ return takeObject(r0);
237
+ } finally {
238
+ wasm.__wbindgen_add_to_stack_pointer(16);
239
+ }
240
+ }
241
+
242
+ /**
243
+ * Emit JSON.stringify-compatible pretty bytes and the trailing newline.
244
+ * @param {string} text
245
+ * @returns {string}
246
+ */
247
+ export function diffSerializeSidecar(text) {
248
+ let deferred2_0;
249
+ let deferred2_1;
250
+ try {
251
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
252
+ wasm.diffSerializeSidecar(retptr, addHeapObject(text));
253
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
254
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
255
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
256
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
257
+ var ptr1 = r0;
258
+ var len1 = r1;
259
+ if (r3) {
260
+ ptr1 = 0; len1 = 0;
261
+ throw takeObject(r2);
262
+ }
263
+ deferred2_0 = ptr1;
264
+ deferred2_1 = len1;
265
+ return getStringFromWasm0(ptr1, len1);
266
+ } finally {
267
+ wasm.__wbindgen_add_to_stack_pointer(16);
268
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
269
+ }
270
+ }
271
+
272
+ /**
273
+ * Raw code units preserve JS strings that cannot be represented as Rust UTF-8.
274
+ * @param {Uint16Array} units
275
+ * @returns {string}
276
+ */
277
+ export function diffStableHash(units) {
278
+ let deferred2_0;
279
+ let deferred2_1;
280
+ try {
281
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
282
+ const ptr0 = passArray16ToWasm0(units, wasm.__wbindgen_export);
283
+ const len0 = WASM_VECTOR_LEN;
284
+ wasm.diffStableHash(retptr, ptr0, len0);
285
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
286
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
287
+ deferred2_0 = r0;
288
+ deferred2_1 = r1;
289
+ return getStringFromWasm0(r0, r1);
290
+ } finally {
291
+ wasm.__wbindgen_add_to_stack_pointer(16);
292
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
293
+ }
294
+ }
295
+
296
+ /**
297
+ * Host decoding preserves lone UTF-16 units even inside conflict diagnostics.
298
+ * @param {string} text
299
+ * @param {boolean} lineage
300
+ * @returns {string[]}
301
+ */
302
+ export function diffValidateSidecar(text, lineage) {
303
+ try {
304
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
305
+ wasm.diffValidateSidecar(retptr, addHeapObject(text), lineage);
306
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
307
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
308
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
309
+ if (r2) {
310
+ throw takeObject(r1);
311
+ }
312
+ return takeObject(r0);
313
+ } finally {
314
+ wasm.__wbindgen_add_to_stack_pointer(16);
315
+ }
316
+ }
317
+ function __wbg_get_imports() {
318
+ const import0 = {
319
+ __proto__: null,
320
+ __wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
321
+ const ret = Error(getStringFromWasm0(arg0, arg1));
322
+ return addHeapObject(ret);
323
+ },
324
+ __wbg_Number_9a4e0ecb0fa16705: function(arg0) {
325
+ const ret = Number(getObject(arg0));
326
+ return ret;
327
+ },
328
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
329
+ const ret = String(getObject(arg1));
330
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
331
+ const len1 = WASM_VECTOR_LEN;
332
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
333
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
334
+ },
335
+ __wbg___wbindgen_bigint_get_as_i64_d968e41184ae354f: function(arg0, arg1) {
336
+ const v = getObject(arg1);
337
+ const ret = typeof(v) === 'bigint' ? v : undefined;
338
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
339
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
340
+ },
341
+ __wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
342
+ const v = getObject(arg0);
343
+ const ret = typeof(v) === 'boolean' ? v : undefined;
344
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
345
+ },
346
+ __wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
347
+ const ret = debugString(getObject(arg1));
348
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
349
+ const len1 = WASM_VECTOR_LEN;
350
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
351
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
352
+ },
353
+ __wbg___wbindgen_in_aca499c5de7ff5e5: function(arg0, arg1) {
354
+ const ret = getObject(arg0) in getObject(arg1);
355
+ return ret;
356
+ },
357
+ __wbg___wbindgen_is_bigint_2f76dc55065b4273: function(arg0) {
358
+ const ret = typeof(getObject(arg0)) === 'bigint';
359
+ return ret;
360
+ },
361
+ __wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
362
+ const ret = typeof(getObject(arg0)) === 'function';
363
+ return ret;
364
+ },
365
+ __wbg___wbindgen_is_null_ea9085d691f535d3: function(arg0) {
366
+ const ret = getObject(arg0) === null;
367
+ return ret;
368
+ },
369
+ __wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
370
+ const val = getObject(arg0);
371
+ const ret = typeof(val) === 'object' && val !== null;
372
+ return ret;
373
+ },
374
+ __wbg___wbindgen_is_string_ea5e6cc2e4141dfe: function(arg0) {
375
+ const ret = typeof(getObject(arg0)) === 'string';
376
+ return ret;
377
+ },
378
+ __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
379
+ const ret = getObject(arg0) === undefined;
380
+ return ret;
381
+ },
382
+ __wbg___wbindgen_jsval_eq_e659fcf7b0e32763: function(arg0, arg1) {
383
+ const ret = getObject(arg0) === getObject(arg1);
384
+ return ret;
385
+ },
386
+ __wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function(arg0, arg1) {
387
+ const ret = getObject(arg0) == getObject(arg1);
388
+ return ret;
389
+ },
390
+ __wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) {
391
+ const obj = getObject(arg1);
392
+ const ret = typeof(obj) === 'number' ? obj : undefined;
393
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
394
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
395
+ },
396
+ __wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
397
+ const obj = getObject(arg1);
398
+ const ret = typeof(obj) === 'string' ? obj : undefined;
399
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
400
+ var len1 = WASM_VECTOR_LEN;
401
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
402
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
403
+ },
404
+ __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
405
+ throw new Error(getStringFromWasm0(arg0, arg1));
406
+ },
407
+ __wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
408
+ const ret = getObject(arg0).call(getObject(arg1));
409
+ return addHeapObject(ret);
410
+ }, arguments); },
411
+ __wbg_charCodeAt_2a30bc7c17474cc6: function(arg0, arg1) {
412
+ const ret = getObject(arg0).charCodeAt(arg1 >>> 0);
413
+ return ret;
414
+ },
415
+ __wbg_done_89b2b13e91a60321: function(arg0) {
416
+ const ret = getObject(arg0).done;
417
+ return ret;
418
+ },
419
+ __wbg_entries_015dc610cd81ede0: function(arg0) {
420
+ const ret = Object.entries(getObject(arg0));
421
+ return addHeapObject(ret);
422
+ },
423
+ __wbg_get_507a50627bffa49b: function(arg0, arg1) {
424
+ const ret = getObject(arg0)[arg1 >>> 0];
425
+ return addHeapObject(ret);
426
+ },
427
+ __wbg_get_c7eb1f358a7654df: function() { return handleError(function (arg0, arg1) {
428
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
429
+ return addHeapObject(ret);
430
+ }, arguments); },
431
+ __wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
432
+ const ret = getObject(arg0)[arg1 >>> 0];
433
+ return addHeapObject(ret);
434
+ },
435
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
436
+ const ret = getObject(arg0)[getObject(arg1)];
437
+ return addHeapObject(ret);
438
+ },
439
+ __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
440
+ let result;
441
+ try {
442
+ result = getObject(arg0) instanceof ArrayBuffer;
443
+ } catch (_) {
444
+ result = false;
445
+ }
446
+ const ret = result;
447
+ return ret;
448
+ },
449
+ __wbg_instanceof_Map_e5b5e3db98422fcc: function(arg0) {
450
+ let result;
451
+ try {
452
+ result = getObject(arg0) instanceof Map;
453
+ } catch (_) {
454
+ result = false;
455
+ }
456
+ const ret = result;
457
+ return ret;
458
+ },
459
+ __wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
460
+ let result;
461
+ try {
462
+ result = getObject(arg0) instanceof Uint8Array;
463
+ } catch (_) {
464
+ result = false;
465
+ }
466
+ const ret = result;
467
+ return ret;
468
+ },
469
+ __wbg_isArray_0677c962b281d01a: function(arg0) {
470
+ const ret = Array.isArray(getObject(arg0));
471
+ return ret;
472
+ },
473
+ __wbg_isSafeInteger_04f36e4056f1b851: function(arg0) {
474
+ const ret = Number.isSafeInteger(getObject(arg0));
475
+ return ret;
476
+ },
477
+ __wbg_iterator_6f722e4a93058b71: function() {
478
+ const ret = Symbol.iterator;
479
+ return addHeapObject(ret);
480
+ },
481
+ __wbg_length_02c64e687322fa34: function(arg0) {
482
+ const ret = getObject(arg0).length;
483
+ return ret;
484
+ },
485
+ __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
486
+ const ret = getObject(arg0).length;
487
+ return ret;
488
+ },
489
+ __wbg_length_370319915dc99107: function(arg0) {
490
+ const ret = getObject(arg0).length;
491
+ return ret;
492
+ },
493
+ __wbg_new_32b398fb48b6d94a: function() {
494
+ const ret = new Array();
495
+ return addHeapObject(ret);
496
+ },
497
+ __wbg_new_7796ffc7ed656783: function() {
498
+ const ret = new Map();
499
+ return addHeapObject(ret);
500
+ },
501
+ __wbg_new_cd45aabdf6073e84: function(arg0) {
502
+ const ret = new Uint8Array(getObject(arg0));
503
+ return addHeapObject(ret);
504
+ },
505
+ __wbg_new_da52cf8fe3429cb2: function() {
506
+ const ret = new Object();
507
+ return addHeapObject(ret);
508
+ },
509
+ __wbg_next_6dbf2c0ac8cde20f: function(arg0) {
510
+ const ret = getObject(arg0).next;
511
+ return addHeapObject(ret);
512
+ },
513
+ __wbg_next_71f2aa1cb3d1e37e: function() { return handleError(function (arg0) {
514
+ const ret = getObject(arg0).next();
515
+ return addHeapObject(ret);
516
+ }, arguments); },
517
+ __wbg_parse_1c0d8a8656d7e016: function() { return handleError(function (arg0, arg1) {
518
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
519
+ return addHeapObject(ret);
520
+ }, arguments); },
521
+ __wbg_parse_23ed54371a332e18: function(arg0, arg1) {
522
+ const ret = Date.parse(getStringFromWasm0(arg0, arg1));
523
+ return ret;
524
+ },
525
+ __wbg_parse_2c9249af9a6a61cc: function() { return handleError(function (arg0) {
526
+ const ret = JSON.parse(getObject(arg0));
527
+ return addHeapObject(ret);
528
+ }, arguments); },
529
+ __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
530
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
531
+ },
532
+ __wbg_set_575dd786d51585f8: function(arg0, arg1, arg2) {
533
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
534
+ return addHeapObject(ret);
535
+ },
536
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
537
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
538
+ },
539
+ __wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
540
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
541
+ },
542
+ __wbg_value_a5d5488a9589444a: function(arg0) {
543
+ const ret = getObject(arg0).value;
544
+ return addHeapObject(ret);
545
+ },
546
+ __wbindgen_cast_0000000000000001: function(arg0) {
547
+ // Cast intrinsic for `F64 -> Externref`.
548
+ const ret = arg0;
549
+ return addHeapObject(ret);
550
+ },
551
+ __wbindgen_cast_0000000000000002: function(arg0) {
552
+ // Cast intrinsic for `I64 -> Externref`.
553
+ const ret = arg0;
554
+ return addHeapObject(ret);
555
+ },
556
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
557
+ // Cast intrinsic for `Ref(String) -> Externref`.
558
+ const ret = getStringFromWasm0(arg0, arg1);
559
+ return addHeapObject(ret);
560
+ },
561
+ __wbindgen_cast_0000000000000004: function(arg0) {
562
+ // Cast intrinsic for `U64 -> Externref`.
563
+ const ret = BigInt.asUintN(64, arg0);
564
+ return addHeapObject(ret);
565
+ },
566
+ __wbindgen_object_clone_ref: function(arg0) {
567
+ const ret = getObject(arg0);
568
+ return addHeapObject(ret);
569
+ },
570
+ __wbindgen_object_drop_ref: function(arg0) {
571
+ takeObject(arg0);
572
+ },
573
+ };
574
+ return {
575
+ __proto__: null,
576
+ "./ifc-lite-diff_bg.js": import0,
577
+ };
578
+ }
579
+
580
+ const DiffModelFinalization = (typeof FinalizationRegistry === 'undefined')
581
+ ? { register: () => {}, unregister: () => {} }
582
+ : new FinalizationRegistry(ptr => wasm.__wbg_diffmodel_free(ptr, 1));
583
+
584
+ function addHeapObject(obj) {
585
+ if (heap_next === heap.length) heap.push(heap.length + 1);
586
+ const idx = heap_next;
587
+ heap_next = heap[idx];
588
+
589
+ heap[idx] = obj;
590
+ return idx;
591
+ }
592
+
593
+ function _assertClass(instance, klass) {
594
+ if (!(instance instanceof klass)) {
595
+ throw new Error(`expected instance of ${klass.name}`);
596
+ }
597
+ }
598
+
599
+ function debugString(val) {
600
+ // primitive types
601
+ const type = typeof val;
602
+ if (type == 'number' || type == 'boolean' || val == null) {
603
+ return `${val}`;
604
+ }
605
+ if (type == 'string') {
606
+ return `"${val}"`;
607
+ }
608
+ if (type == 'symbol') {
609
+ const description = val.description;
610
+ if (description == null) {
611
+ return 'Symbol';
612
+ } else {
613
+ return `Symbol(${description})`;
614
+ }
615
+ }
616
+ if (type == 'function') {
617
+ const name = val.name;
618
+ if (typeof name == 'string' && name.length > 0) {
619
+ return `Function(${name})`;
620
+ } else {
621
+ return 'Function';
622
+ }
623
+ }
624
+ // objects
625
+ if (Array.isArray(val)) {
626
+ const length = val.length;
627
+ let debug = '[';
628
+ if (length > 0) {
629
+ debug += debugString(val[0]);
630
+ }
631
+ for(let i = 1; i < length; i++) {
632
+ debug += ', ' + debugString(val[i]);
633
+ }
634
+ debug += ']';
635
+ return debug;
636
+ }
637
+ // Test for built-in
638
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
639
+ let className;
640
+ if (builtInMatches && builtInMatches.length > 1) {
641
+ className = builtInMatches[1];
642
+ } else {
643
+ // Failed to match the standard '[object ClassName]'
644
+ return toString.call(val);
645
+ }
646
+ if (className == 'Object') {
647
+ // we're a user defined class or Object
648
+ // JSON.stringify avoids problems with cycles, and is generally much
649
+ // easier than looping through ownProperties of `val`.
650
+ try {
651
+ return 'Object(' + JSON.stringify(val) + ')';
652
+ } catch (_) {
653
+ return 'Object';
654
+ }
655
+ }
656
+ // errors
657
+ if (val instanceof Error) {
658
+ return `${val.name}: ${val.message}\n${val.stack}`;
659
+ }
660
+ // TODO we could test for more things here, like `Set`s and `Map`s.
661
+ return className;
662
+ }
663
+
664
+ function dropObject(idx) {
665
+ if (idx < 1028) return;
666
+ heap[idx] = heap_next;
667
+ heap_next = idx;
668
+ }
669
+
670
+ function getArrayJsValueFromWasm0(ptr, len) {
671
+ ptr = ptr >>> 0;
672
+ const mem = getDataViewMemory0();
673
+ const result = [];
674
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
675
+ result.push(takeObject(mem.getUint32(i, true)));
676
+ }
677
+ return result;
678
+ }
679
+
680
+ function getArrayU8FromWasm0(ptr, len) {
681
+ ptr = ptr >>> 0;
682
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
683
+ }
684
+
685
+ let cachedDataViewMemory0 = null;
686
+ function getDataViewMemory0() {
687
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
688
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
689
+ }
690
+ return cachedDataViewMemory0;
691
+ }
692
+
693
+ let cachedFloat64ArrayMemory0 = null;
694
+ function getFloat64ArrayMemory0() {
695
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
696
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
697
+ }
698
+ return cachedFloat64ArrayMemory0;
699
+ }
700
+
701
+ function getStringFromWasm0(ptr, len) {
702
+ return decodeText(ptr >>> 0, len);
703
+ }
704
+
705
+ let cachedUint16ArrayMemory0 = null;
706
+ function getUint16ArrayMemory0() {
707
+ if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) {
708
+ cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer);
709
+ }
710
+ return cachedUint16ArrayMemory0;
711
+ }
712
+
713
+ let cachedUint32ArrayMemory0 = null;
714
+ function getUint32ArrayMemory0() {
715
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
716
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
717
+ }
718
+ return cachedUint32ArrayMemory0;
719
+ }
720
+
721
+ let cachedUint8ArrayMemory0 = null;
722
+ function getUint8ArrayMemory0() {
723
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
724
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
725
+ }
726
+ return cachedUint8ArrayMemory0;
727
+ }
728
+
729
+ function getObject(idx) { return heap[idx]; }
730
+
731
+ function handleError(f, args) {
732
+ try {
733
+ return f.apply(this, args);
734
+ } catch (e) {
735
+ wasm.__wbindgen_export3(addHeapObject(e));
736
+ }
737
+ }
738
+
739
+ let heap = new Array(1024).fill(undefined);
740
+ heap.push(undefined, null, true, false);
741
+
742
+ let heap_next = heap.length;
743
+
744
+ function isLikeNone(x) {
745
+ return x === undefined || x === null;
746
+ }
747
+
748
+ function passArray16ToWasm0(arg, malloc) {
749
+ const ptr = malloc(arg.length * 2, 2) >>> 0;
750
+ getUint16ArrayMemory0().set(arg, ptr / 2);
751
+ WASM_VECTOR_LEN = arg.length;
752
+ return ptr;
753
+ }
754
+
755
+ function passArray32ToWasm0(arg, malloc) {
756
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
757
+ getUint32ArrayMemory0().set(arg, ptr / 4);
758
+ WASM_VECTOR_LEN = arg.length;
759
+ return ptr;
760
+ }
761
+
762
+ function passArray8ToWasm0(arg, malloc) {
763
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
764
+ getUint8ArrayMemory0().set(arg, ptr / 1);
765
+ WASM_VECTOR_LEN = arg.length;
766
+ return ptr;
767
+ }
768
+
769
+ function passArrayF64ToWasm0(arg, malloc) {
770
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
771
+ getFloat64ArrayMemory0().set(arg, ptr / 8);
772
+ WASM_VECTOR_LEN = arg.length;
773
+ return ptr;
774
+ }
775
+
776
+ function passArrayJsValueToWasm0(array, malloc) {
777
+ const ptr = malloc(array.length * 4, 4) >>> 0;
778
+ const mem = getDataViewMemory0();
779
+ for (let i = 0; i < array.length; i++) {
780
+ mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
781
+ }
782
+ WASM_VECTOR_LEN = array.length;
783
+ return ptr;
784
+ }
785
+
786
+ function passStringToWasm0(arg, malloc, realloc) {
787
+ if (realloc === undefined) {
788
+ const buf = cachedTextEncoder.encode(arg);
789
+ const ptr = malloc(buf.length, 1) >>> 0;
790
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
791
+ WASM_VECTOR_LEN = buf.length;
792
+ return ptr;
793
+ }
794
+
795
+ let len = arg.length;
796
+ let ptr = malloc(len, 1) >>> 0;
797
+
798
+ const mem = getUint8ArrayMemory0();
799
+
800
+ let offset = 0;
801
+
802
+ for (; offset < len; offset++) {
803
+ const code = arg.charCodeAt(offset);
804
+ if (code > 0x7F) break;
805
+ mem[ptr + offset] = code;
806
+ }
807
+ if (offset !== len) {
808
+ if (offset !== 0) {
809
+ arg = arg.slice(offset);
810
+ }
811
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
812
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
813
+ const ret = cachedTextEncoder.encodeInto(arg, view);
814
+
815
+ offset += ret.written;
816
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
817
+ }
818
+
819
+ WASM_VECTOR_LEN = offset;
820
+ return ptr;
821
+ }
822
+
823
+ function takeObject(idx) {
824
+ const ret = getObject(idx);
825
+ dropObject(idx);
826
+ return ret;
827
+ }
828
+
829
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
830
+ cachedTextDecoder.decode();
831
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
832
+ let numBytesDecoded = 0;
833
+ function decodeText(ptr, len) {
834
+ numBytesDecoded += len;
835
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
836
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
837
+ cachedTextDecoder.decode();
838
+ numBytesDecoded = len;
839
+ }
840
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
841
+ }
842
+
843
+ const cachedTextEncoder = new TextEncoder();
844
+
845
+ if (!('encodeInto' in cachedTextEncoder)) {
846
+ cachedTextEncoder.encodeInto = function (arg, view) {
847
+ const buf = cachedTextEncoder.encode(arg);
848
+ view.set(buf);
849
+ return {
850
+ read: arg.length,
851
+ written: buf.length
852
+ };
853
+ };
854
+ }
855
+
856
+ let WASM_VECTOR_LEN = 0;
857
+
858
+ let wasmModule, wasmInstance, wasm;
859
+ function __wbg_finalize_init(instance, module) {
860
+ wasmInstance = instance;
861
+ wasm = instance.exports;
862
+ wasmModule = module;
863
+ cachedDataViewMemory0 = null;
864
+ cachedFloat64ArrayMemory0 = null;
865
+ cachedUint16ArrayMemory0 = null;
866
+ cachedUint32ArrayMemory0 = null;
867
+ cachedUint8ArrayMemory0 = null;
868
+ return wasm;
869
+ }
870
+
871
+ async function __wbg_load(module, imports) {
872
+ if (typeof Response === 'function' && module instanceof Response) {
873
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
874
+ try {
875
+ return await WebAssembly.instantiateStreaming(module, imports);
876
+ } catch (e) {
877
+ const validResponse = module.ok && expectedResponseType(module.type);
878
+
879
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
880
+ 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);
881
+
882
+ } else { throw e; }
883
+ }
884
+ }
885
+
886
+ const bytes = await module.arrayBuffer();
887
+ return await WebAssembly.instantiate(bytes, imports);
888
+ } else {
889
+ const instance = await WebAssembly.instantiate(module, imports);
890
+
891
+ if (instance instanceof WebAssembly.Instance) {
892
+ return { instance, module };
893
+ } else {
894
+ return instance;
895
+ }
896
+ }
897
+
898
+ function expectedResponseType(type) {
899
+ switch (type) {
900
+ case 'basic': case 'cors': case 'default': return true;
901
+ }
902
+ return false;
903
+ }
904
+ }
905
+
906
+ function initSync(module) {
907
+ if (wasm !== undefined) return wasm;
908
+
909
+
910
+ if (module !== undefined) {
911
+ if (Object.getPrototypeOf(module) === Object.prototype) {
912
+ ({module} = module)
913
+ } else {
914
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
915
+ }
916
+ }
917
+
918
+ const imports = __wbg_get_imports();
919
+ if (!(module instanceof WebAssembly.Module)) {
920
+ module = new WebAssembly.Module(module);
921
+ }
922
+ const instance = new WebAssembly.Instance(module, imports);
923
+ return __wbg_finalize_init(instance, module);
924
+ }
925
+
926
+ async function __wbg_init(module_or_path) {
927
+ if (wasm !== undefined) return wasm;
928
+
929
+
930
+ if (module_or_path !== undefined) {
931
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
932
+ ({module_or_path} = module_or_path)
933
+ } else {
934
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
935
+ }
936
+ }
937
+
938
+ if (module_or_path === undefined) {
939
+ module_or_path = new URL('ifc-lite-diff_bg.wasm', import.meta.url);
940
+ }
941
+ const imports = __wbg_get_imports();
942
+
943
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
944
+ module_or_path = fetch(module_or_path);
945
+ }
946
+
947
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
948
+
949
+ return __wbg_finalize_init(instance, module);
950
+ }
951
+
952
+ export { initSync, __wbg_init as default };
Binary file