geo-polygonize 0.33.1 → 0.35.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.
Files changed (86) hide show
  1. package/README.md +68 -18
  2. package/dist/geo_polygonize.wasm +0 -0
  3. package/dist/geo_polygonize_simd.wasm +0 -0
  4. package/dist/slim/cjs/cfb.d.ts +2 -0
  5. package/dist/slim/cjs/index.d.ts +1 -0
  6. package/dist/slim/cjs/index_slim.d.ts +2 -1
  7. package/dist/slim/cjs/index_slim.js +74 -829
  8. package/dist/slim/cjs/index_threads.d.ts +1 -0
  9. package/dist/slim/es/cfb.d.ts +2 -0
  10. package/dist/slim/es/index.d.ts +1 -0
  11. package/dist/slim/es/index_slim.d.ts +2 -1
  12. package/dist/slim/es/index_slim.js +65 -821
  13. package/dist/slim/es/index_threads.d.ts +1 -0
  14. package/dist/slim/pkg-scalar/geo_polygonize.d.ts +119 -0
  15. package/dist/slim/pkg-scalar/geo_polygonize_bg.wasm.d.ts +37 -0
  16. package/dist/slim/pkg-wrapper/bindings/ContainmentOptions.d.ts +6 -0
  17. package/dist/slim/pkg-wrapper/bindings/DedupPolicy.d.ts +1 -0
  18. package/dist/slim/pkg-wrapper/bindings/DeterminismOptions.d.ts +5 -0
  19. package/dist/slim/pkg-wrapper/bindings/DiagnosticsOptions.d.ts +4 -0
  20. package/dist/slim/pkg-wrapper/bindings/IndexBackend.d.ts +1 -0
  21. package/dist/slim/pkg-wrapper/bindings/NodingBackend.d.ts +1 -0
  22. package/dist/slim/pkg-wrapper/bindings/NodingOptions.d.ts +6 -0
  23. package/dist/slim/pkg-wrapper/bindings/PolygonizerOptions.d.ts +92 -0
  24. package/dist/slim/pkg-wrapper/bindings/ProvenanceOptions.d.ts +4 -0
  25. package/dist/slim/pkg-wrapper/bindings/SnapMode.d.ts +1 -0
  26. package/dist/slim/pkg-wrapper/bindings/SnapStrategy.d.ts +25 -0
  27. package/dist/slim/pkg-wrapper/bindings/TargetProfile.d.ts +1 -0
  28. package/dist/slim/pkg-wrapper/bindings/TileOwnershipPolicy.d.ts +1 -0
  29. package/dist/slim/pkg-wrapper/bindings/TilingOptions.d.ts +6 -0
  30. package/dist/slim/pkg-wrapper/bindings/TouchPolicy.d.ts +1 -0
  31. package/dist/slim/pkg-wrapper/bindings/ZOptions.d.ts +4 -0
  32. package/dist/slim/pkg-wrapper/bindings/ZPolicy.d.ts +5 -0
  33. package/dist/standard/cjs/cfb.d.ts +2 -0
  34. package/dist/standard/cjs/index.d.ts +1 -0
  35. package/dist/standard/cjs/index.js +59 -4
  36. package/dist/standard/cjs/index_slim.d.ts +2 -1
  37. package/dist/standard/cjs/index_threads.d.ts +1 -0
  38. package/dist/standard/es/cfb.d.ts +2 -0
  39. package/dist/standard/es/index.d.ts +1 -0
  40. package/dist/standard/es/index.js +59 -5
  41. package/dist/standard/es/index_slim.d.ts +2 -1
  42. package/dist/standard/es/index_threads.d.ts +1 -0
  43. package/dist/standard/pkg-scalar/geo_polygonize.d.ts +119 -0
  44. package/dist/standard/pkg-scalar/geo_polygonize_bg.wasm.d.ts +37 -0
  45. package/dist/standard/pkg-wrapper/bindings/ContainmentOptions.d.ts +6 -0
  46. package/dist/standard/pkg-wrapper/bindings/DedupPolicy.d.ts +1 -0
  47. package/dist/standard/pkg-wrapper/bindings/DeterminismOptions.d.ts +5 -0
  48. package/dist/standard/pkg-wrapper/bindings/DiagnosticsOptions.d.ts +4 -0
  49. package/dist/standard/pkg-wrapper/bindings/IndexBackend.d.ts +1 -0
  50. package/dist/standard/pkg-wrapper/bindings/NodingBackend.d.ts +1 -0
  51. package/dist/standard/pkg-wrapper/bindings/NodingOptions.d.ts +6 -0
  52. package/dist/standard/pkg-wrapper/bindings/PolygonizerOptions.d.ts +92 -0
  53. package/dist/standard/pkg-wrapper/bindings/ProvenanceOptions.d.ts +4 -0
  54. package/dist/standard/pkg-wrapper/bindings/SnapMode.d.ts +1 -0
  55. package/dist/standard/pkg-wrapper/bindings/SnapStrategy.d.ts +25 -0
  56. package/dist/standard/pkg-wrapper/bindings/TargetProfile.d.ts +1 -0
  57. package/dist/standard/pkg-wrapper/bindings/TileOwnershipPolicy.d.ts +1 -0
  58. package/dist/standard/pkg-wrapper/bindings/TilingOptions.d.ts +6 -0
  59. package/dist/standard/pkg-wrapper/bindings/TouchPolicy.d.ts +1 -0
  60. package/dist/standard/pkg-wrapper/bindings/ZOptions.d.ts +4 -0
  61. package/dist/standard/pkg-wrapper/bindings/ZPolicy.d.ts +5 -0
  62. package/dist/threads/es/cfb.d.ts +2 -0
  63. package/dist/threads/es/index.d.ts +1 -0
  64. package/dist/threads/es/index.js +56 -2
  65. package/dist/threads/es/index_slim.d.ts +2 -1
  66. package/dist/threads/es/index_threads.d.ts +1 -0
  67. package/dist/threads/pkg-threads/geo_polygonize.d.ts +139 -0
  68. package/dist/threads/pkg-threads/geo_polygonize_bg.wasm.d.ts +44 -0
  69. package/dist/threads/pkg-wrapper/bindings/ContainmentOptions.d.ts +6 -0
  70. package/dist/threads/pkg-wrapper/bindings/DedupPolicy.d.ts +1 -0
  71. package/dist/threads/pkg-wrapper/bindings/DeterminismOptions.d.ts +5 -0
  72. package/dist/threads/pkg-wrapper/bindings/DiagnosticsOptions.d.ts +4 -0
  73. package/dist/threads/pkg-wrapper/bindings/IndexBackend.d.ts +1 -0
  74. package/dist/threads/pkg-wrapper/bindings/NodingBackend.d.ts +1 -0
  75. package/dist/threads/pkg-wrapper/bindings/NodingOptions.d.ts +6 -0
  76. package/dist/threads/pkg-wrapper/bindings/PolygonizerOptions.d.ts +92 -0
  77. package/dist/threads/pkg-wrapper/bindings/ProvenanceOptions.d.ts +4 -0
  78. package/dist/threads/pkg-wrapper/bindings/SnapMode.d.ts +1 -0
  79. package/dist/threads/pkg-wrapper/bindings/SnapStrategy.d.ts +25 -0
  80. package/dist/threads/pkg-wrapper/bindings/TargetProfile.d.ts +1 -0
  81. package/dist/threads/pkg-wrapper/bindings/TileOwnershipPolicy.d.ts +1 -0
  82. package/dist/threads/pkg-wrapper/bindings/TilingOptions.d.ts +6 -0
  83. package/dist/threads/pkg-wrapper/bindings/TouchPolicy.d.ts +1 -0
  84. package/dist/threads/pkg-wrapper/bindings/ZOptions.d.ts +4 -0
  85. package/dist/threads/pkg-wrapper/bindings/ZPolicy.d.ts +5 -0
  86. package/package.json +1 -1
@@ -1,815 +1,5 @@
1
1
  /* @ts-self-types="./geo_polygonize.d.ts" */
2
2
 
3
- let PolygonizerWasmError$1 = class PolygonizerWasmError {
4
- static __wrap(ptr) {
5
- ptr = ptr >>> 0;
6
- const obj = Object.create(PolygonizerWasmError.prototype);
7
- obj.__wbg_ptr = ptr;
8
- PolygonizerWasmErrorFinalization$1.register(obj, obj.__wbg_ptr, obj);
9
- return obj;
10
- }
11
- __destroy_into_raw() {
12
- const ptr = this.__wbg_ptr;
13
- this.__wbg_ptr = 0;
14
- PolygonizerWasmErrorFinalization$1.unregister(this);
15
- return ptr;
16
- }
17
- free() {
18
- const ptr = this.__destroy_into_raw();
19
- wasm$1.__wbg_polygonizerwasmerror_free(ptr, 0);
20
- }
21
- /**
22
- * @returns {string}
23
- */
24
- get message() {
25
- let deferred1_0;
26
- let deferred1_1;
27
- try {
28
- const ret = wasm$1.polygonizerwasmerror_message(this.__wbg_ptr);
29
- deferred1_0 = ret[0];
30
- deferred1_1 = ret[1];
31
- return getStringFromWasm0$1(ret[0], ret[1]);
32
- } finally {
33
- wasm$1.__wbindgen_free(deferred1_0, deferred1_1, 1);
34
- }
35
- }
36
- /**
37
- * @returns {string}
38
- */
39
- get name() {
40
- let deferred1_0;
41
- let deferred1_1;
42
- try {
43
- const ret = wasm$1.polygonizerwasmerror_name(this.__wbg_ptr);
44
- deferred1_0 = ret[0];
45
- deferred1_1 = ret[1];
46
- return getStringFromWasm0$1(ret[0], ret[1]);
47
- } finally {
48
- wasm$1.__wbindgen_free(deferred1_0, deferred1_1, 1);
49
- }
50
- }
51
- /**
52
- * @param {string} name
53
- * @param {string} message
54
- */
55
- constructor(name, message) {
56
- const ptr0 = passStringToWasm0$1(name, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
57
- const len0 = WASM_VECTOR_LEN$1;
58
- const ptr1 = passStringToWasm0$1(message, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
59
- const len1 = WASM_VECTOR_LEN$1;
60
- const ret = wasm$1.polygonizerwasmerror_new(ptr0, len0, ptr1, len1);
61
- this.__wbg_ptr = ret >>> 0;
62
- PolygonizerWasmErrorFinalization$1.register(this, this.__wbg_ptr, this);
63
- return this;
64
- }
65
- };
66
- if (Symbol.dispose) PolygonizerWasmError$1.prototype[Symbol.dispose] = PolygonizerWasmError$1.prototype.free;
67
-
68
- let WasmPolygonResult$1 = class WasmPolygonResult {
69
- static __wrap(ptr) {
70
- ptr = ptr >>> 0;
71
- const obj = Object.create(WasmPolygonResult.prototype);
72
- obj.__wbg_ptr = ptr;
73
- WasmPolygonResultFinalization$1.register(obj, obj.__wbg_ptr, obj);
74
- return obj;
75
- }
76
- __destroy_into_raw() {
77
- const ptr = this.__wbg_ptr;
78
- this.__wbg_ptr = 0;
79
- WasmPolygonResultFinalization$1.unregister(this);
80
- return ptr;
81
- }
82
- free() {
83
- const ptr = this.__destroy_into_raw();
84
- wasm$1.__wbg_wasmpolygonresult_free(ptr, 0);
85
- }
86
- /**
87
- * @returns {number}
88
- */
89
- coords_len() {
90
- const ret = wasm$1.wasmpolygonresult_coords_len(this.__wbg_ptr);
91
- return ret >>> 0;
92
- }
93
- /**
94
- * @returns {number}
95
- */
96
- coords_ptr() {
97
- const ret = wasm$1.wasmpolygonresult_coords_ptr(this.__wbg_ptr);
98
- return ret >>> 0;
99
- }
100
- /**
101
- * @returns {any}
102
- */
103
- get diagnostics() {
104
- const ret = wasm$1.wasmpolygonresult_diagnostics(this.__wbg_ptr);
105
- return ret;
106
- }
107
- /**
108
- * @returns {number}
109
- */
110
- flat_line_ids_len() {
111
- const ret = wasm$1.wasmpolygonresult_flat_line_ids_len(this.__wbg_ptr);
112
- return ret >>> 0;
113
- }
114
- /**
115
- * @returns {number}
116
- */
117
- flat_line_ids_ptr() {
118
- const ret = wasm$1.wasmpolygonresult_flat_line_ids_ptr(this.__wbg_ptr);
119
- return ret >>> 0;
120
- }
121
- /**
122
- * @returns {number}
123
- */
124
- polygon_offsets_len() {
125
- const ret = wasm$1.wasmpolygonresult_polygon_offsets_len(this.__wbg_ptr);
126
- return ret >>> 0;
127
- }
128
- /**
129
- * @returns {number}
130
- */
131
- polygon_offsets_ptr() {
132
- const ret = wasm$1.wasmpolygonresult_polygon_offsets_ptr(this.__wbg_ptr);
133
- return ret >>> 0;
134
- }
135
- /**
136
- * @returns {any}
137
- */
138
- get provenance() {
139
- const ret = wasm$1.wasmpolygonresult_provenance(this.__wbg_ptr);
140
- return ret;
141
- }
142
- /**
143
- * @returns {number}
144
- */
145
- ring_offsets_len() {
146
- const ret = wasm$1.wasmpolygonresult_ring_offsets_len(this.__wbg_ptr);
147
- return ret >>> 0;
148
- }
149
- /**
150
- * @returns {number}
151
- */
152
- ring_offsets_ptr() {
153
- const ret = wasm$1.wasmpolygonresult_ring_offsets_ptr(this.__wbg_ptr);
154
- return ret >>> 0;
155
- }
156
- /**
157
- * @returns {number}
158
- */
159
- stride() {
160
- const ret = wasm$1.wasmpolygonresult_stride(this.__wbg_ptr);
161
- return ret;
162
- }
163
- };
164
- if (Symbol.dispose) WasmPolygonResult$1.prototype[Symbol.dispose] = WasmPolygonResult$1.prototype.free;
165
-
166
- /**
167
- * @param {string} geojson_str
168
- * @param {boolean | null} [node_input]
169
- * @param {number | null} [snap_grid_size]
170
- * @param {boolean | null} [extract_only_polygonal]
171
- * @param {boolean | null} [report_mode]
172
- * @returns {string}
173
- */
174
- function polygonize$1(geojson_str, node_input, snap_grid_size, extract_only_polygonal, report_mode) {
175
- let deferred3_0;
176
- let deferred3_1;
177
- try {
178
- const ptr0 = passStringToWasm0$1(geojson_str, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
179
- const len0 = WASM_VECTOR_LEN$1;
180
- const ret = wasm$1.polygonize(ptr0, len0, isLikeNone$1(node_input) ? 0xFFFFFF : node_input ? 1 : 0, !isLikeNone$1(snap_grid_size), isLikeNone$1(snap_grid_size) ? 0 : snap_grid_size, isLikeNone$1(extract_only_polygonal) ? 0xFFFFFF : extract_only_polygonal ? 1 : 0, isLikeNone$1(report_mode) ? 0xFFFFFF : report_mode ? 1 : 0);
181
- var ptr2 = ret[0];
182
- var len2 = ret[1];
183
- if (ret[3]) {
184
- ptr2 = 0; len2 = 0;
185
- throw takeFromExternrefTable0$1(ret[2]);
186
- }
187
- deferred3_0 = ptr2;
188
- deferred3_1 = len2;
189
- return getStringFromWasm0$1(ptr2, len2);
190
- } finally {
191
- wasm$1.__wbindgen_free(deferred3_0, deferred3_1, 1);
192
- }
193
- }
194
-
195
- /**
196
- * Polygonizes an Arrow IPC stream containing a GeoArrow LineString array.
197
- *
198
- * This zero-copy path avoids JSON serialization overhead and returns a binary
199
- * Arrow IPC stream containing a GeoArrow Polygon array. Requires the options
200
- * to be passed as a parsed JS object.
201
- * @param {Uint8Array} ipc_bytes
202
- * @param {any} options_val
203
- * @returns {Uint8Array}
204
- */
205
- function polygonizeGeoArrowWithOptions$1(ipc_bytes, options_val) {
206
- const ptr0 = passArray8ToWasm0$1(ipc_bytes, wasm$1.__wbindgen_malloc);
207
- const len0 = WASM_VECTOR_LEN$1;
208
- const ret = wasm$1.polygonizeGeoArrowWithOptions(ptr0, len0, options_val);
209
- if (ret[3]) {
210
- throw takeFromExternrefTable0$1(ret[2]);
211
- }
212
- var v2 = getArrayU8FromWasm0$1(ret[0], ret[1]).slice();
213
- wasm$1.__wbindgen_free(ret[0], ret[1] * 1, 1);
214
- return v2;
215
- }
216
-
217
- /**
218
- * Polygonizes a GeoJSON FeatureCollection using the canonical `PolygonizerOptions`.
219
- *
220
- * This is the primary entry point for JavaScript users. It accepts a JSON string
221
- * of options and returns a JSON string representing the result, including faces,
222
- * dangles, cut-lines, and (optionally) provenance/diagnostics.
223
- * @param {string} geojson_str
224
- * @param {any} options_val
225
- * @returns {string}
226
- */
227
- function polygonizeWithOptions$1(geojson_str, options_val) {
228
- let deferred3_0;
229
- let deferred3_1;
230
- try {
231
- const ptr0 = passStringToWasm0$1(geojson_str, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
232
- const len0 = WASM_VECTOR_LEN$1;
233
- const ret = wasm$1.polygonizeWithOptions(ptr0, len0, options_val);
234
- var ptr2 = ret[0];
235
- var len2 = ret[1];
236
- if (ret[3]) {
237
- ptr2 = 0; len2 = 0;
238
- throw takeFromExternrefTable0$1(ret[2]);
239
- }
240
- deferred3_0 = ptr2;
241
- deferred3_1 = len2;
242
- return getStringFromWasm0$1(ptr2, len2);
243
- } finally {
244
- wasm$1.__wbindgen_free(deferred3_0, deferred3_1, 1);
245
- }
246
- }
247
-
248
- /**
249
- * @param {Float64Array} coords
250
- * @param {Uint32Array} offsets
251
- * @param {number} stride
252
- * @param {any} options_val
253
- * @param {Uint32Array | null} [line_ids]
254
- * @returns {WasmPolygonResult}
255
- */
256
- function polygonizeWithOptionsBuffer$1(coords, offsets, stride, options_val, line_ids) {
257
- const ptr0 = passArrayF64ToWasm0$1(coords, wasm$1.__wbindgen_malloc);
258
- const len0 = WASM_VECTOR_LEN$1;
259
- const ptr1 = passArray32ToWasm0$1(offsets, wasm$1.__wbindgen_malloc);
260
- const len1 = WASM_VECTOR_LEN$1;
261
- var ptr2 = isLikeNone$1(line_ids) ? 0 : passArray32ToWasm0$1(line_ids, wasm$1.__wbindgen_malloc);
262
- var len2 = WASM_VECTOR_LEN$1;
263
- const ret = wasm$1.polygonizeWithOptionsBuffer(ptr0, len0, ptr1, len1, stride, options_val, ptr2, len2);
264
- if (ret[2]) {
265
- throw takeFromExternrefTable0$1(ret[1]);
266
- }
267
- return WasmPolygonResult$1.__wrap(ret[0]);
268
- }
269
-
270
- /**
271
- * @param {Float64Array} coords
272
- * @param {Uint32Array} offsets
273
- * @param {number} stride
274
- * @param {boolean} node_input
275
- * @param {number} snap_grid_size
276
- * @param {Uint32Array | null} [line_ids]
277
- * @returns {WasmPolygonResult}
278
- */
279
- function polygonize_buffers$1(coords, offsets, stride, node_input, snap_grid_size, line_ids) {
280
- const ptr0 = passArrayF64ToWasm0$1(coords, wasm$1.__wbindgen_malloc);
281
- const len0 = WASM_VECTOR_LEN$1;
282
- const ptr1 = passArray32ToWasm0$1(offsets, wasm$1.__wbindgen_malloc);
283
- const len1 = WASM_VECTOR_LEN$1;
284
- var ptr2 = isLikeNone$1(line_ids) ? 0 : passArray32ToWasm0$1(line_ids, wasm$1.__wbindgen_malloc);
285
- var len2 = WASM_VECTOR_LEN$1;
286
- const ret = wasm$1.polygonize_buffers(ptr0, len0, ptr1, len1, stride, node_input, snap_grid_size, ptr2, len2);
287
- if (ret[2]) {
288
- throw takeFromExternrefTable0$1(ret[1]);
289
- }
290
- return WasmPolygonResult$1.__wrap(ret[0]);
291
- }
292
-
293
- /**
294
- * @param {Uint8Array} ipc_bytes
295
- * @param {boolean} node_input
296
- * @param {number} snap_grid_size
297
- * @param {boolean} extract_only_polygonal
298
- * @returns {Uint8Array}
299
- */
300
- function polygonize_geoarrow$1(ipc_bytes, node_input, snap_grid_size, extract_only_polygonal) {
301
- const ptr0 = passArray8ToWasm0$1(ipc_bytes, wasm$1.__wbindgen_malloc);
302
- const len0 = WASM_VECTOR_LEN$1;
303
- const ret = wasm$1.polygonize_geoarrow(ptr0, len0, node_input, snap_grid_size, extract_only_polygonal);
304
- if (ret[3]) {
305
- throw takeFromExternrefTable0$1(ret[2]);
306
- }
307
- var v2 = getArrayU8FromWasm0$1(ret[0], ret[1]).slice();
308
- wasm$1.__wbindgen_free(ret[0], ret[1] * 1, 1);
309
- return v2;
310
- }
311
-
312
- function __wbg_get_imports$1() {
313
- const import0 = {
314
- __proto__: null,
315
- __wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
316
- const ret = Error(getStringFromWasm0$1(arg0, arg1));
317
- return ret;
318
- },
319
- __wbg_String_8564e559799eccda: function(arg0, arg1) {
320
- const ret = String(arg1);
321
- const ptr1 = passStringToWasm0$1(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
322
- const len1 = WASM_VECTOR_LEN$1;
323
- getDataViewMemory0$1().setInt32(arg0 + 4 * 1, len1, true);
324
- getDataViewMemory0$1().setInt32(arg0 + 4 * 0, ptr1, true);
325
- },
326
- __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
327
- const v = arg0;
328
- const ret = typeof(v) === 'boolean' ? v : undefined;
329
- return isLikeNone$1(ret) ? 0xFFFFFF : ret ? 1 : 0;
330
- },
331
- __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
332
- const ret = debugString$1(arg1);
333
- const ptr1 = passStringToWasm0$1(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
334
- const len1 = WASM_VECTOR_LEN$1;
335
- getDataViewMemory0$1().setInt32(arg0 + 4 * 1, len1, true);
336
- getDataViewMemory0$1().setInt32(arg0 + 4 * 0, ptr1, true);
337
- },
338
- __wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
339
- const ret = arg0 in arg1;
340
- return ret;
341
- },
342
- __wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
343
- const val = arg0;
344
- const ret = typeof(val) === 'object' && val !== null;
345
- return ret;
346
- },
347
- __wbg___wbindgen_is_string_7ef6b97b02428fae: function(arg0) {
348
- const ret = typeof(arg0) === 'string';
349
- return ret;
350
- },
351
- __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
352
- const ret = arg0 === undefined;
353
- return ret;
354
- },
355
- __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
356
- const ret = arg0 == arg1;
357
- return ret;
358
- },
359
- __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
360
- const obj = arg1;
361
- const ret = typeof(obj) === 'number' ? obj : undefined;
362
- getDataViewMemory0$1().setFloat64(arg0 + 8 * 1, isLikeNone$1(ret) ? 0 : ret, true);
363
- getDataViewMemory0$1().setInt32(arg0 + 4 * 0, !isLikeNone$1(ret), true);
364
- },
365
- __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
366
- const obj = arg1;
367
- const ret = typeof(obj) === 'string' ? obj : undefined;
368
- var ptr1 = isLikeNone$1(ret) ? 0 : passStringToWasm0$1(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
369
- var len1 = WASM_VECTOR_LEN$1;
370
- getDataViewMemory0$1().setInt32(arg0 + 4 * 1, len1, true);
371
- getDataViewMemory0$1().setInt32(arg0 + 4 * 0, ptr1, true);
372
- },
373
- __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
374
- throw new Error(getStringFromWasm0$1(arg0, arg1));
375
- },
376
- __wbg_entries_e8a20ff8c9757101: function(arg0) {
377
- const ret = Object.entries(arg0);
378
- return ret;
379
- },
380
- __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
381
- let deferred0_0;
382
- let deferred0_1;
383
- try {
384
- deferred0_0 = arg0;
385
- deferred0_1 = arg1;
386
- console.error(getStringFromWasm0$1(arg0, arg1));
387
- } finally {
388
- wasm$1.__wbindgen_free(deferred0_0, deferred0_1, 1);
389
- }
390
- },
391
- __wbg_get_a8ee5c45dabc1b3b: function(arg0, arg1) {
392
- const ret = arg0[arg1 >>> 0];
393
- return ret;
394
- },
395
- __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
396
- const ret = arg0[arg1];
397
- return ret;
398
- },
399
- __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
400
- let result;
401
- try {
402
- result = arg0 instanceof ArrayBuffer;
403
- } catch (_) {
404
- result = false;
405
- }
406
- const ret = result;
407
- return ret;
408
- },
409
- __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
410
- let result;
411
- try {
412
- result = arg0 instanceof Uint8Array;
413
- } catch (_) {
414
- result = false;
415
- }
416
- const ret = result;
417
- return ret;
418
- },
419
- __wbg_length_b3416cf66a5452c8: function(arg0) {
420
- const ret = arg0.length;
421
- return ret;
422
- },
423
- __wbg_length_ea16607d7b61445b: function(arg0) {
424
- const ret = arg0.length;
425
- return ret;
426
- },
427
- __wbg_new_227d7c05414eb861: function() {
428
- const ret = new Error();
429
- return ret;
430
- },
431
- __wbg_new_5f486cdf45a04d78: function(arg0) {
432
- const ret = new Uint8Array(arg0);
433
- return ret;
434
- },
435
- __wbg_new_a70fbab9066b301f: function() {
436
- const ret = new Array();
437
- return ret;
438
- },
439
- __wbg_new_ab79df5bd7c26067: function() {
440
- const ret = new Object();
441
- return ret;
442
- },
443
- __wbg_polygonizerwasmerror_new: function(arg0) {
444
- const ret = PolygonizerWasmError$1.__wrap(arg0);
445
- return ret;
446
- },
447
- __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
448
- Uint8Array.prototype.set.call(getArrayU8FromWasm0$1(arg0, arg1), arg2);
449
- },
450
- __wbg_set_282384002438957f: function(arg0, arg1, arg2) {
451
- arg0[arg1 >>> 0] = arg2;
452
- },
453
- __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
454
- arg0[arg1] = arg2;
455
- },
456
- __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
457
- const ret = arg1.stack;
458
- const ptr1 = passStringToWasm0$1(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
459
- const len1 = WASM_VECTOR_LEN$1;
460
- getDataViewMemory0$1().setInt32(arg0 + 4 * 1, len1, true);
461
- getDataViewMemory0$1().setInt32(arg0 + 4 * 0, ptr1, true);
462
- },
463
- __wbindgen_cast_0000000000000001: function(arg0) {
464
- // Cast intrinsic for `F64 -> Externref`.
465
- const ret = arg0;
466
- return ret;
467
- },
468
- __wbindgen_cast_0000000000000002: function(arg0, arg1) {
469
- // Cast intrinsic for `Ref(String) -> Externref`.
470
- const ret = getStringFromWasm0$1(arg0, arg1);
471
- return ret;
472
- },
473
- __wbindgen_cast_0000000000000003: function(arg0) {
474
- // Cast intrinsic for `U64 -> Externref`.
475
- const ret = BigInt.asUintN(64, arg0);
476
- return ret;
477
- },
478
- __wbindgen_init_externref_table: function() {
479
- const table = wasm$1.__wbindgen_externrefs;
480
- const offset = table.grow(4);
481
- table.set(0, undefined);
482
- table.set(offset + 0, undefined);
483
- table.set(offset + 1, null);
484
- table.set(offset + 2, true);
485
- table.set(offset + 3, false);
486
- },
487
- };
488
- return {
489
- __proto__: null,
490
- "./geo_polygonize_bg.js": import0,
491
- };
492
- }
493
-
494
- const PolygonizerWasmErrorFinalization$1 = (typeof FinalizationRegistry === 'undefined')
495
- ? { register: () => {}, unregister: () => {} }
496
- : new FinalizationRegistry(ptr => wasm$1.__wbg_polygonizerwasmerror_free(ptr >>> 0, 1));
497
- const WasmPolygonResultFinalization$1 = (typeof FinalizationRegistry === 'undefined')
498
- ? { register: () => {}, unregister: () => {} }
499
- : new FinalizationRegistry(ptr => wasm$1.__wbg_wasmpolygonresult_free(ptr >>> 0, 1));
500
-
501
- function debugString$1(val) {
502
- // primitive types
503
- const type = typeof val;
504
- if (type == 'number' || type == 'boolean' || val == null) {
505
- return `${val}`;
506
- }
507
- if (type == 'string') {
508
- return `"${val}"`;
509
- }
510
- if (type == 'symbol') {
511
- const description = val.description;
512
- if (description == null) {
513
- return 'Symbol';
514
- } else {
515
- return `Symbol(${description})`;
516
- }
517
- }
518
- if (type == 'function') {
519
- const name = val.name;
520
- if (typeof name == 'string' && name.length > 0) {
521
- return `Function(${name})`;
522
- } else {
523
- return 'Function';
524
- }
525
- }
526
- // objects
527
- if (Array.isArray(val)) {
528
- const length = val.length;
529
- let debug = '[';
530
- if (length > 0) {
531
- debug += debugString$1(val[0]);
532
- }
533
- for(let i = 1; i < length; i++) {
534
- debug += ', ' + debugString$1(val[i]);
535
- }
536
- debug += ']';
537
- return debug;
538
- }
539
- // Test for built-in
540
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
541
- let className;
542
- if (builtInMatches && builtInMatches.length > 1) {
543
- className = builtInMatches[1];
544
- } else {
545
- // Failed to match the standard '[object ClassName]'
546
- return toString.call(val);
547
- }
548
- if (className == 'Object') {
549
- // we're a user defined class or Object
550
- // JSON.stringify avoids problems with cycles, and is generally much
551
- // easier than looping through ownProperties of `val`.
552
- try {
553
- return 'Object(' + JSON.stringify(val) + ')';
554
- } catch (_) {
555
- return 'Object';
556
- }
557
- }
558
- // errors
559
- if (val instanceof Error) {
560
- return `${val.name}: ${val.message}\n${val.stack}`;
561
- }
562
- // TODO we could test for more things here, like `Set`s and `Map`s.
563
- return className;
564
- }
565
-
566
- function getArrayU8FromWasm0$1(ptr, len) {
567
- ptr = ptr >>> 0;
568
- return getUint8ArrayMemory0$1().subarray(ptr / 1, ptr / 1 + len);
569
- }
570
-
571
- let cachedDataViewMemory0$1 = null;
572
- function getDataViewMemory0$1() {
573
- if (cachedDataViewMemory0$1 === null || cachedDataViewMemory0$1.buffer.detached === true || (cachedDataViewMemory0$1.buffer.detached === undefined && cachedDataViewMemory0$1.buffer !== wasm$1.memory.buffer)) {
574
- cachedDataViewMemory0$1 = new DataView(wasm$1.memory.buffer);
575
- }
576
- return cachedDataViewMemory0$1;
577
- }
578
-
579
- let cachedFloat64ArrayMemory0$1 = null;
580
- function getFloat64ArrayMemory0$1() {
581
- if (cachedFloat64ArrayMemory0$1 === null || cachedFloat64ArrayMemory0$1.byteLength === 0) {
582
- cachedFloat64ArrayMemory0$1 = new Float64Array(wasm$1.memory.buffer);
583
- }
584
- return cachedFloat64ArrayMemory0$1;
585
- }
586
-
587
- function getStringFromWasm0$1(ptr, len) {
588
- ptr = ptr >>> 0;
589
- return decodeText$1(ptr, len);
590
- }
591
-
592
- let cachedUint32ArrayMemory0$1 = null;
593
- function getUint32ArrayMemory0$1() {
594
- if (cachedUint32ArrayMemory0$1 === null || cachedUint32ArrayMemory0$1.byteLength === 0) {
595
- cachedUint32ArrayMemory0$1 = new Uint32Array(wasm$1.memory.buffer);
596
- }
597
- return cachedUint32ArrayMemory0$1;
598
- }
599
-
600
- let cachedUint8ArrayMemory0$1 = null;
601
- function getUint8ArrayMemory0$1() {
602
- if (cachedUint8ArrayMemory0$1 === null || cachedUint8ArrayMemory0$1.byteLength === 0) {
603
- cachedUint8ArrayMemory0$1 = new Uint8Array(wasm$1.memory.buffer);
604
- }
605
- return cachedUint8ArrayMemory0$1;
606
- }
607
-
608
- function isLikeNone$1(x) {
609
- return x === undefined || x === null;
610
- }
611
-
612
- function passArray32ToWasm0$1(arg, malloc) {
613
- const ptr = malloc(arg.length * 4, 4) >>> 0;
614
- getUint32ArrayMemory0$1().set(arg, ptr / 4);
615
- WASM_VECTOR_LEN$1 = arg.length;
616
- return ptr;
617
- }
618
-
619
- function passArray8ToWasm0$1(arg, malloc) {
620
- const ptr = malloc(arg.length * 1, 1) >>> 0;
621
- getUint8ArrayMemory0$1().set(arg, ptr / 1);
622
- WASM_VECTOR_LEN$1 = arg.length;
623
- return ptr;
624
- }
625
-
626
- function passArrayF64ToWasm0$1(arg, malloc) {
627
- const ptr = malloc(arg.length * 8, 8) >>> 0;
628
- getFloat64ArrayMemory0$1().set(arg, ptr / 8);
629
- WASM_VECTOR_LEN$1 = arg.length;
630
- return ptr;
631
- }
632
-
633
- function passStringToWasm0$1(arg, malloc, realloc) {
634
- if (realloc === undefined) {
635
- const buf = cachedTextEncoder$1.encode(arg);
636
- const ptr = malloc(buf.length, 1) >>> 0;
637
- getUint8ArrayMemory0$1().subarray(ptr, ptr + buf.length).set(buf);
638
- WASM_VECTOR_LEN$1 = buf.length;
639
- return ptr;
640
- }
641
-
642
- let len = arg.length;
643
- let ptr = malloc(len, 1) >>> 0;
644
-
645
- const mem = getUint8ArrayMemory0$1();
646
-
647
- let offset = 0;
648
-
649
- for (; offset < len; offset++) {
650
- const code = arg.charCodeAt(offset);
651
- if (code > 0x7F) break;
652
- mem[ptr + offset] = code;
653
- }
654
- if (offset !== len) {
655
- if (offset !== 0) {
656
- arg = arg.slice(offset);
657
- }
658
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
659
- const view = getUint8ArrayMemory0$1().subarray(ptr + offset, ptr + len);
660
- const ret = cachedTextEncoder$1.encodeInto(arg, view);
661
-
662
- offset += ret.written;
663
- ptr = realloc(ptr, len, offset, 1) >>> 0;
664
- }
665
-
666
- WASM_VECTOR_LEN$1 = offset;
667
- return ptr;
668
- }
669
-
670
- function takeFromExternrefTable0$1(idx) {
671
- const value = wasm$1.__wbindgen_externrefs.get(idx);
672
- wasm$1.__externref_table_dealloc(idx);
673
- return value;
674
- }
675
-
676
- let cachedTextDecoder$1 = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
677
- cachedTextDecoder$1.decode();
678
- const MAX_SAFARI_DECODE_BYTES$1 = 2146435072;
679
- let numBytesDecoded$1 = 0;
680
- function decodeText$1(ptr, len) {
681
- numBytesDecoded$1 += len;
682
- if (numBytesDecoded$1 >= MAX_SAFARI_DECODE_BYTES$1) {
683
- cachedTextDecoder$1 = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
684
- cachedTextDecoder$1.decode();
685
- numBytesDecoded$1 = len;
686
- }
687
- return cachedTextDecoder$1.decode(getUint8ArrayMemory0$1().subarray(ptr, ptr + len));
688
- }
689
-
690
- const cachedTextEncoder$1 = new TextEncoder();
691
-
692
- if (!('encodeInto' in cachedTextEncoder$1)) {
693
- cachedTextEncoder$1.encodeInto = function (arg, view) {
694
- const buf = cachedTextEncoder$1.encode(arg);
695
- view.set(buf);
696
- return {
697
- read: arg.length,
698
- written: buf.length
699
- };
700
- };
701
- }
702
-
703
- let WASM_VECTOR_LEN$1 = 0;
704
-
705
- let wasm$1;
706
- function __wbg_finalize_init$1(instance, module) {
707
- wasm$1 = instance.exports;
708
- cachedDataViewMemory0$1 = null;
709
- cachedFloat64ArrayMemory0$1 = null;
710
- cachedUint32ArrayMemory0$1 = null;
711
- cachedUint8ArrayMemory0$1 = null;
712
- wasm$1.__wbindgen_start();
713
- return wasm$1;
714
- }
715
-
716
- async function __wbg_load$1(module, imports) {
717
- if (typeof Response === 'function' && module instanceof Response) {
718
- if (typeof WebAssembly.instantiateStreaming === 'function') {
719
- try {
720
- return await WebAssembly.instantiateStreaming(module, imports);
721
- } catch (e) {
722
- const validResponse = module.ok && expectedResponseType(module.type);
723
-
724
- if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
725
- 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);
726
-
727
- } else { throw e; }
728
- }
729
- }
730
-
731
- const bytes = await module.arrayBuffer();
732
- return await WebAssembly.instantiate(bytes, imports);
733
- } else {
734
- const instance = await WebAssembly.instantiate(module, imports);
735
-
736
- if (instance instanceof WebAssembly.Instance) {
737
- return { instance, module };
738
- } else {
739
- return instance;
740
- }
741
- }
742
-
743
- function expectedResponseType(type) {
744
- switch (type) {
745
- case 'basic': case 'cors': case 'default': return true;
746
- }
747
- return false;
748
- }
749
- }
750
-
751
- function initSync$1(module) {
752
- if (wasm$1 !== undefined) return wasm$1;
753
-
754
-
755
- if (module !== undefined) {
756
- if (Object.getPrototypeOf(module) === Object.prototype) {
757
- ({module} = module);
758
- } else {
759
- console.warn('using deprecated parameters for `initSync()`; pass a single object instead');
760
- }
761
- }
762
-
763
- const imports = __wbg_get_imports$1();
764
- if (!(module instanceof WebAssembly.Module)) {
765
- module = new WebAssembly.Module(module);
766
- }
767
- const instance = new WebAssembly.Instance(module, imports);
768
- return __wbg_finalize_init$1(instance);
769
- }
770
-
771
- async function __wbg_init$1(module_or_path) {
772
- if (wasm$1 !== undefined) return wasm$1;
773
-
774
-
775
- if (module_or_path !== undefined) {
776
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
777
- ({module_or_path} = module_or_path);
778
- } else {
779
- console.warn('using deprecated parameters for the initialization function; pass a single object instead');
780
- }
781
- }
782
-
783
- if (module_or_path === undefined) {
784
- module_or_path = new URL('geo_polygonize_bg.wasm', import.meta.url);
785
- }
786
- const imports = __wbg_get_imports$1();
787
-
788
- if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
789
- module_or_path = fetch(module_or_path);
790
- }
791
-
792
- const { instance, module } = await __wbg_load$1(await module_or_path, imports);
793
-
794
- return __wbg_finalize_init$1(instance);
795
- }
796
-
797
- var scalarExports = /*#__PURE__*/Object.freeze({
798
- __proto__: null,
799
- PolygonizerWasmError: PolygonizerWasmError$1,
800
- WasmPolygonResult: WasmPolygonResult$1,
801
- default: __wbg_init$1,
802
- initSync: initSync$1,
803
- polygonize: polygonize$1,
804
- polygonizeGeoArrowWithOptions: polygonizeGeoArrowWithOptions$1,
805
- polygonizeWithOptions: polygonizeWithOptions$1,
806
- polygonizeWithOptionsBuffer: polygonizeWithOptionsBuffer$1,
807
- polygonize_buffers: polygonize_buffers$1,
808
- polygonize_geoarrow: polygonize_geoarrow$1
809
- });
810
-
811
- /* @ts-self-types="./geo_polygonize.d.ts" */
812
-
813
3
  class PolygonizerWasmError {
814
4
  static __wrap(ptr) {
815
5
  ptr = ptr >>> 0;
@@ -907,6 +97,20 @@ class WasmPolygonResult {
907
97
  const ret = wasm.wasmpolygonresult_coords_ptr(this.__wbg_ptr);
908
98
  return ret >>> 0;
909
99
  }
100
+ /**
101
+ * @returns {any}
102
+ */
103
+ get cut_edges() {
104
+ const ret = wasm.wasmpolygonresult_cut_edges(this.__wbg_ptr);
105
+ return ret;
106
+ }
107
+ /**
108
+ * @returns {any}
109
+ */
110
+ get dangles() {
111
+ const ret = wasm.wasmpolygonresult_dangles(this.__wbg_ptr);
112
+ return ret;
113
+ }
910
114
  /**
911
115
  * @returns {any}
912
116
  */
@@ -928,6 +132,13 @@ class WasmPolygonResult {
928
132
  const ret = wasm.wasmpolygonresult_flat_line_ids_ptr(this.__wbg_ptr);
929
133
  return ret >>> 0;
930
134
  }
135
+ /**
136
+ * @returns {any}
137
+ */
138
+ get invalid_rings() {
139
+ const ret = wasm.wasmpolygonresult_invalid_rings(this.__wbg_ptr);
140
+ return ret;
141
+ }
931
142
  /**
932
143
  * @returns {number}
933
144
  */
@@ -1591,7 +802,7 @@ async function __wbg_init(module_or_path) {
1591
802
  }
1592
803
 
1593
804
  if (module_or_path === undefined) {
1594
- module_or_path = new URL('geo_polygonize_bg.wasm', import.meta.url);
805
+ module_or_path = new URL(/* @vite-ignore */ 'geo_polygonize_bg.wasm', import.meta.url);
1595
806
  }
1596
807
  const imports = __wbg_get_imports();
1597
808
 
@@ -1604,7 +815,7 @@ async function __wbg_init(module_or_path) {
1604
815
  return __wbg_finalize_init(instance);
1605
816
  }
1606
817
 
1607
- var simdExports = /*#__PURE__*/Object.freeze({
818
+ var scalarExports = /*#__PURE__*/Object.freeze({
1608
819
  __proto__: null,
1609
820
  PolygonizerWasmError: PolygonizerWasmError,
1610
821
  WasmPolygonResult: WasmPolygonResult,
@@ -1618,9 +829,48 @@ var simdExports = /*#__PURE__*/Object.freeze({
1618
829
  polygonize_geoarrow: polygonize_geoarrow
1619
830
  });
1620
831
 
832
+ const cfbRobustOptions = {
833
+ target: "Native",
834
+ node_input: true,
835
+ snap_grid_size: 0.5,
836
+ extract_only_polygonal: false,
837
+ snap_strategy: "GeosCompat",
838
+ noding: {
839
+ backend: "Snap",
840
+ snap_mode: "FloatEpsilonDedup",
841
+ },
842
+ containment: {
843
+ touch_policy: "AllowPointTouchDisallowEdgeShare",
844
+ index_backend: "RStar",
845
+ },
846
+ z: {
847
+ policy: "InterpolateAlongEdge",
848
+ },
849
+ determinism: {
850
+ canonical_sort: true,
851
+ canonical_ring_rotation: true,
852
+ stable_tie_breaks: true,
853
+ },
854
+ diagnostics: {
855
+ enabled: true,
856
+ report_mode: true,
857
+ },
858
+ provenance: {
859
+ enabled: true,
860
+ include_boundary_line_ids: true,
861
+ },
862
+ input_profile_id: "cfb_robust_v1",
863
+ };
864
+
1621
865
  // We provide a helper to choose based on feature detection if the user wants to use it
1622
866
  let isSimdSupported;
1623
867
  const SIMD_TEST_BYTES = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 10, 1, 8, 0, 65, 0, 253, 15, 253, 98, 11]);
868
+ function normalizeInitInput(input) {
869
+ if (input && typeof input === "object" && "module" in input && !("module_or_path" in input)) {
870
+ return { ...input, module_or_path: input.module };
871
+ }
872
+ return input;
873
+ }
1624
874
  async function initBest(scalarModule, simdModule) {
1625
875
  if (isSimdSupported === undefined) {
1626
876
  try {
@@ -1630,14 +880,8 @@ async function initBest(scalarModule, simdModule) {
1630
880
  isSimdSupported = false;
1631
881
  }
1632
882
  }
1633
- if (isSimdSupported && simdModule) {
1634
- await __wbg_init(simdModule);
1635
- return simdExports;
1636
- }
1637
- else {
1638
- await __wbg_init$1(scalarModule);
1639
- return scalarExports;
1640
- }
883
+ await __wbg_init(normalizeInitInput(isSimdSupported && simdModule ? simdModule : scalarModule));
884
+ return scalarExports;
1641
885
  }
1642
886
 
1643
- export { PolygonizerWasmError$1 as PolygonizerWasmError, WasmPolygonResult$1 as WasmPolygonResult, initBest, initSync$1 as initSync, polygonize$1 as polygonize, polygonizeGeoArrowWithOptions$1 as polygonizeGeoArrowWithOptions, polygonizeWithOptions$1 as polygonizeWithOptions, polygonizeWithOptionsBuffer$1 as polygonizeWithOptionsBuffer, polygonize_buffers$1 as polygonize_buffers, polygonize_geoarrow$1 as polygonize_geoarrow };
887
+ export { PolygonizerWasmError, WasmPolygonResult, cfbRobustOptions, initBest, initSync, polygonize, polygonizeGeoArrowWithOptions, polygonizeWithOptions, polygonizeWithOptionsBuffer, polygonize_buffers, polygonize_geoarrow };