@kittycad/kcl-wasm-lib 0.0.1 → 0.1.141

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,3122 @@
1
+ /* @ts-self-types="./kcl_wasm_lib.d.ts" */
2
+
3
+ export class Context {
4
+ __destroy_into_raw() {
5
+ const ptr = this.__wbg_ptr
6
+ this.__wbg_ptr = 0
7
+ ContextFinalization.unregister(this)
8
+ return ptr
9
+ }
10
+ free() {
11
+ const ptr = this.__destroy_into_raw()
12
+ wasm.__wbg_context_free(ptr, 0)
13
+ }
14
+ /**
15
+ * Add a constraint to sketch.
16
+ * @param {string} version_json
17
+ * @param {string} sketch_json
18
+ * @param {string} constraint_json
19
+ * @param {string} settings
20
+ * @param {boolean} create_checkpoint
21
+ * @returns {Promise<any>}
22
+ */
23
+ add_constraint(
24
+ version_json,
25
+ sketch_json,
26
+ constraint_json,
27
+ settings,
28
+ create_checkpoint
29
+ ) {
30
+ const ptr0 = passStringToWasm0(
31
+ version_json,
32
+ wasm.__wbindgen_malloc,
33
+ wasm.__wbindgen_realloc
34
+ )
35
+ const len0 = WASM_VECTOR_LEN
36
+ const ptr1 = passStringToWasm0(
37
+ sketch_json,
38
+ wasm.__wbindgen_malloc,
39
+ wasm.__wbindgen_realloc
40
+ )
41
+ const len1 = WASM_VECTOR_LEN
42
+ const ptr2 = passStringToWasm0(
43
+ constraint_json,
44
+ wasm.__wbindgen_malloc,
45
+ wasm.__wbindgen_realloc
46
+ )
47
+ const len2 = WASM_VECTOR_LEN
48
+ const ptr3 = passStringToWasm0(
49
+ settings,
50
+ wasm.__wbindgen_malloc,
51
+ wasm.__wbindgen_realloc
52
+ )
53
+ const len3 = WASM_VECTOR_LEN
54
+ const ret = wasm.context_add_constraint(
55
+ this.__wbg_ptr,
56
+ ptr0,
57
+ len0,
58
+ ptr1,
59
+ len1,
60
+ ptr2,
61
+ len2,
62
+ ptr3,
63
+ len3,
64
+ create_checkpoint
65
+ )
66
+ return ret
67
+ }
68
+ /**
69
+ * @param {number} project
70
+ * @param {string} file
71
+ * @returns {Promise<void>}
72
+ */
73
+ add_file(project, file) {
74
+ const ptr0 = passStringToWasm0(
75
+ file,
76
+ wasm.__wbindgen_malloc,
77
+ wasm.__wbindgen_realloc
78
+ )
79
+ const len0 = WASM_VECTOR_LEN
80
+ const ret = wasm.context_add_file(this.__wbg_ptr, project, ptr0, len0)
81
+ return ret
82
+ }
83
+ /**
84
+ * Add segment to sketch.
85
+ * @param {string} version_json
86
+ * @param {string} sketch_json
87
+ * @param {string} segment_json
88
+ * @param {string | null | undefined} label
89
+ * @param {string} settings
90
+ * @param {boolean} create_checkpoint
91
+ * @returns {Promise<any>}
92
+ */
93
+ add_segment(
94
+ version_json,
95
+ sketch_json,
96
+ segment_json,
97
+ label,
98
+ settings,
99
+ create_checkpoint
100
+ ) {
101
+ const ptr0 = passStringToWasm0(
102
+ version_json,
103
+ wasm.__wbindgen_malloc,
104
+ wasm.__wbindgen_realloc
105
+ )
106
+ const len0 = WASM_VECTOR_LEN
107
+ const ptr1 = passStringToWasm0(
108
+ sketch_json,
109
+ wasm.__wbindgen_malloc,
110
+ wasm.__wbindgen_realloc
111
+ )
112
+ const len1 = WASM_VECTOR_LEN
113
+ const ptr2 = passStringToWasm0(
114
+ segment_json,
115
+ wasm.__wbindgen_malloc,
116
+ wasm.__wbindgen_realloc
117
+ )
118
+ const len2 = WASM_VECTOR_LEN
119
+ var ptr3 = isLikeNone(label)
120
+ ? 0
121
+ : passStringToWasm0(
122
+ label,
123
+ wasm.__wbindgen_malloc,
124
+ wasm.__wbindgen_realloc
125
+ )
126
+ var len3 = WASM_VECTOR_LEN
127
+ const ptr4 = passStringToWasm0(
128
+ settings,
129
+ wasm.__wbindgen_malloc,
130
+ wasm.__wbindgen_realloc
131
+ )
132
+ const len4 = WASM_VECTOR_LEN
133
+ const ret = wasm.context_add_segment(
134
+ this.__wbg_ptr,
135
+ ptr0,
136
+ len0,
137
+ ptr1,
138
+ len1,
139
+ ptr2,
140
+ len2,
141
+ ptr3,
142
+ len3,
143
+ ptr4,
144
+ len4,
145
+ create_checkpoint
146
+ )
147
+ return ret
148
+ }
149
+ /**
150
+ * Reset the scene and bust the cache.
151
+ * ONLY use this if you absolutely need to reset the scene and bust the cache.
152
+ * @param {string} settings
153
+ * @param {string | null} [path]
154
+ * @returns {Promise<any>}
155
+ */
156
+ bustCacheAndResetScene(settings, path) {
157
+ const ptr0 = passStringToWasm0(
158
+ settings,
159
+ wasm.__wbindgen_malloc,
160
+ wasm.__wbindgen_realloc
161
+ )
162
+ const len0 = WASM_VECTOR_LEN
163
+ var ptr1 = isLikeNone(path)
164
+ ? 0
165
+ : passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc)
166
+ var len1 = WASM_VECTOR_LEN
167
+ const ret = wasm.context_bustCacheAndResetScene(
168
+ this.__wbg_ptr,
169
+ ptr0,
170
+ len0,
171
+ ptr1,
172
+ len1
173
+ )
174
+ return ret
175
+ }
176
+ /**
177
+ * Chain a segment to a previous segment by adding it and creating a coincident constraint.
178
+ * @param {string} version_json
179
+ * @param {string} sketch_json
180
+ * @param {string} previous_segment_end_point_id_json
181
+ * @param {string} segment_json
182
+ * @param {string | null | undefined} label
183
+ * @param {string} settings
184
+ * @param {boolean} create_checkpoint
185
+ * @returns {Promise<any>}
186
+ */
187
+ chain_segment(
188
+ version_json,
189
+ sketch_json,
190
+ previous_segment_end_point_id_json,
191
+ segment_json,
192
+ label,
193
+ settings,
194
+ create_checkpoint
195
+ ) {
196
+ const ptr0 = passStringToWasm0(
197
+ version_json,
198
+ wasm.__wbindgen_malloc,
199
+ wasm.__wbindgen_realloc
200
+ )
201
+ const len0 = WASM_VECTOR_LEN
202
+ const ptr1 = passStringToWasm0(
203
+ sketch_json,
204
+ wasm.__wbindgen_malloc,
205
+ wasm.__wbindgen_realloc
206
+ )
207
+ const len1 = WASM_VECTOR_LEN
208
+ const ptr2 = passStringToWasm0(
209
+ previous_segment_end_point_id_json,
210
+ wasm.__wbindgen_malloc,
211
+ wasm.__wbindgen_realloc
212
+ )
213
+ const len2 = WASM_VECTOR_LEN
214
+ const ptr3 = passStringToWasm0(
215
+ segment_json,
216
+ wasm.__wbindgen_malloc,
217
+ wasm.__wbindgen_realloc
218
+ )
219
+ const len3 = WASM_VECTOR_LEN
220
+ var ptr4 = isLikeNone(label)
221
+ ? 0
222
+ : passStringToWasm0(
223
+ label,
224
+ wasm.__wbindgen_malloc,
225
+ wasm.__wbindgen_realloc
226
+ )
227
+ var len4 = WASM_VECTOR_LEN
228
+ const ptr5 = passStringToWasm0(
229
+ settings,
230
+ wasm.__wbindgen_malloc,
231
+ wasm.__wbindgen_realloc
232
+ )
233
+ const len5 = WASM_VECTOR_LEN
234
+ const ret = wasm.context_chain_segment(
235
+ this.__wbg_ptr,
236
+ ptr0,
237
+ len0,
238
+ ptr1,
239
+ len1,
240
+ ptr2,
241
+ len2,
242
+ ptr3,
243
+ len3,
244
+ ptr4,
245
+ len4,
246
+ ptr5,
247
+ len5,
248
+ create_checkpoint
249
+ )
250
+ return ret
251
+ }
252
+ /**
253
+ * @returns {Promise<void>}
254
+ */
255
+ clear_sketch_checkpoints() {
256
+ const ret = wasm.context_clear_sketch_checkpoints(this.__wbg_ptr)
257
+ return ret
258
+ }
259
+ /**
260
+ * Delete segments and constraints in sketch.
261
+ * @param {string} version_json
262
+ * @param {string} sketch_json
263
+ * @param {string} constraint_ids_json
264
+ * @param {string} segment_ids_json
265
+ * @param {string} settings
266
+ * @param {boolean} create_checkpoint
267
+ * @returns {Promise<any>}
268
+ */
269
+ delete_objects(
270
+ version_json,
271
+ sketch_json,
272
+ constraint_ids_json,
273
+ segment_ids_json,
274
+ settings,
275
+ create_checkpoint
276
+ ) {
277
+ const ptr0 = passStringToWasm0(
278
+ version_json,
279
+ wasm.__wbindgen_malloc,
280
+ wasm.__wbindgen_realloc
281
+ )
282
+ const len0 = WASM_VECTOR_LEN
283
+ const ptr1 = passStringToWasm0(
284
+ sketch_json,
285
+ wasm.__wbindgen_malloc,
286
+ wasm.__wbindgen_realloc
287
+ )
288
+ const len1 = WASM_VECTOR_LEN
289
+ const ptr2 = passStringToWasm0(
290
+ constraint_ids_json,
291
+ wasm.__wbindgen_malloc,
292
+ wasm.__wbindgen_realloc
293
+ )
294
+ const len2 = WASM_VECTOR_LEN
295
+ const ptr3 = passStringToWasm0(
296
+ segment_ids_json,
297
+ wasm.__wbindgen_malloc,
298
+ wasm.__wbindgen_realloc
299
+ )
300
+ const len3 = WASM_VECTOR_LEN
301
+ const ptr4 = passStringToWasm0(
302
+ settings,
303
+ wasm.__wbindgen_malloc,
304
+ wasm.__wbindgen_realloc
305
+ )
306
+ const len4 = WASM_VECTOR_LEN
307
+ const ret = wasm.context_delete_objects(
308
+ this.__wbg_ptr,
309
+ ptr0,
310
+ len0,
311
+ ptr1,
312
+ len1,
313
+ ptr2,
314
+ len2,
315
+ ptr3,
316
+ len3,
317
+ ptr4,
318
+ len4,
319
+ create_checkpoint
320
+ )
321
+ return ret
322
+ }
323
+ /**
324
+ * Delete sketch.
325
+ * @param {string} version_json
326
+ * @param {string} sketch_json
327
+ * @param {string} settings
328
+ * @returns {Promise<any>}
329
+ */
330
+ delete_sketch(version_json, sketch_json, settings) {
331
+ const ptr0 = passStringToWasm0(
332
+ version_json,
333
+ wasm.__wbindgen_malloc,
334
+ wasm.__wbindgen_realloc
335
+ )
336
+ const len0 = WASM_VECTOR_LEN
337
+ const ptr1 = passStringToWasm0(
338
+ sketch_json,
339
+ wasm.__wbindgen_malloc,
340
+ wasm.__wbindgen_realloc
341
+ )
342
+ const len1 = WASM_VECTOR_LEN
343
+ const ptr2 = passStringToWasm0(
344
+ settings,
345
+ wasm.__wbindgen_malloc,
346
+ wasm.__wbindgen_realloc
347
+ )
348
+ const len2 = WASM_VECTOR_LEN
349
+ const ret = wasm.context_delete_sketch(
350
+ this.__wbg_ptr,
351
+ ptr0,
352
+ len0,
353
+ ptr1,
354
+ len1,
355
+ ptr2,
356
+ len2
357
+ )
358
+ return ret
359
+ }
360
+ /**
361
+ * Edit a constraint in a sketch.
362
+ * @param {string} version_json
363
+ * @param {string} sketch_json
364
+ * @param {string} constraint_id_json
365
+ * @param {string} value_expression
366
+ * @param {string} settings
367
+ * @param {boolean} create_checkpoint
368
+ * @returns {Promise<any>}
369
+ */
370
+ edit_constraint(
371
+ version_json,
372
+ sketch_json,
373
+ constraint_id_json,
374
+ value_expression,
375
+ settings,
376
+ create_checkpoint
377
+ ) {
378
+ const ptr0 = passStringToWasm0(
379
+ version_json,
380
+ wasm.__wbindgen_malloc,
381
+ wasm.__wbindgen_realloc
382
+ )
383
+ const len0 = WASM_VECTOR_LEN
384
+ const ptr1 = passStringToWasm0(
385
+ sketch_json,
386
+ wasm.__wbindgen_malloc,
387
+ wasm.__wbindgen_realloc
388
+ )
389
+ const len1 = WASM_VECTOR_LEN
390
+ const ptr2 = passStringToWasm0(
391
+ constraint_id_json,
392
+ wasm.__wbindgen_malloc,
393
+ wasm.__wbindgen_realloc
394
+ )
395
+ const len2 = WASM_VECTOR_LEN
396
+ const ptr3 = passStringToWasm0(
397
+ value_expression,
398
+ wasm.__wbindgen_malloc,
399
+ wasm.__wbindgen_realloc
400
+ )
401
+ const len3 = WASM_VECTOR_LEN
402
+ const ptr4 = passStringToWasm0(
403
+ settings,
404
+ wasm.__wbindgen_malloc,
405
+ wasm.__wbindgen_realloc
406
+ )
407
+ const len4 = WASM_VECTOR_LEN
408
+ const ret = wasm.context_edit_constraint(
409
+ this.__wbg_ptr,
410
+ ptr0,
411
+ len0,
412
+ ptr1,
413
+ len1,
414
+ ptr2,
415
+ len2,
416
+ ptr3,
417
+ len3,
418
+ ptr4,
419
+ len4,
420
+ create_checkpoint
421
+ )
422
+ return ret
423
+ }
424
+ /**
425
+ * Edit segment in sketch.
426
+ * @param {string} version_json
427
+ * @param {string} sketch_json
428
+ * @param {string} segments_json
429
+ * @param {string} settings
430
+ * @param {boolean} create_checkpoint
431
+ * @returns {Promise<any>}
432
+ */
433
+ edit_segments(
434
+ version_json,
435
+ sketch_json,
436
+ segments_json,
437
+ settings,
438
+ create_checkpoint
439
+ ) {
440
+ const ptr0 = passStringToWasm0(
441
+ version_json,
442
+ wasm.__wbindgen_malloc,
443
+ wasm.__wbindgen_realloc
444
+ )
445
+ const len0 = WASM_VECTOR_LEN
446
+ const ptr1 = passStringToWasm0(
447
+ sketch_json,
448
+ wasm.__wbindgen_malloc,
449
+ wasm.__wbindgen_realloc
450
+ )
451
+ const len1 = WASM_VECTOR_LEN
452
+ const ptr2 = passStringToWasm0(
453
+ segments_json,
454
+ wasm.__wbindgen_malloc,
455
+ wasm.__wbindgen_realloc
456
+ )
457
+ const len2 = WASM_VECTOR_LEN
458
+ const ptr3 = passStringToWasm0(
459
+ settings,
460
+ wasm.__wbindgen_malloc,
461
+ wasm.__wbindgen_realloc
462
+ )
463
+ const len3 = WASM_VECTOR_LEN
464
+ const ret = wasm.context_edit_segments(
465
+ this.__wbg_ptr,
466
+ ptr0,
467
+ len0,
468
+ ptr1,
469
+ len1,
470
+ ptr2,
471
+ len2,
472
+ ptr3,
473
+ len3,
474
+ create_checkpoint
475
+ )
476
+ return ret
477
+ }
478
+ /**
479
+ * Enter sketch mode for an existing sketch.
480
+ * @param {string} project_json
481
+ * @param {string} file_json
482
+ * @param {string} version_json
483
+ * @param {string} sketch_json
484
+ * @param {string} settings
485
+ * @returns {Promise<any>}
486
+ */
487
+ edit_sketch(project_json, file_json, version_json, sketch_json, settings) {
488
+ const ptr0 = passStringToWasm0(
489
+ project_json,
490
+ wasm.__wbindgen_malloc,
491
+ wasm.__wbindgen_realloc
492
+ )
493
+ const len0 = WASM_VECTOR_LEN
494
+ const ptr1 = passStringToWasm0(
495
+ file_json,
496
+ wasm.__wbindgen_malloc,
497
+ wasm.__wbindgen_realloc
498
+ )
499
+ const len1 = WASM_VECTOR_LEN
500
+ const ptr2 = passStringToWasm0(
501
+ version_json,
502
+ wasm.__wbindgen_malloc,
503
+ wasm.__wbindgen_realloc
504
+ )
505
+ const len2 = WASM_VECTOR_LEN
506
+ const ptr3 = passStringToWasm0(
507
+ sketch_json,
508
+ wasm.__wbindgen_malloc,
509
+ wasm.__wbindgen_realloc
510
+ )
511
+ const len3 = WASM_VECTOR_LEN
512
+ const ptr4 = passStringToWasm0(
513
+ settings,
514
+ wasm.__wbindgen_malloc,
515
+ wasm.__wbindgen_realloc
516
+ )
517
+ const len4 = WASM_VECTOR_LEN
518
+ const ret = wasm.context_edit_sketch(
519
+ this.__wbg_ptr,
520
+ ptr0,
521
+ len0,
522
+ ptr1,
523
+ len1,
524
+ ptr2,
525
+ len2,
526
+ ptr3,
527
+ len3,
528
+ ptr4,
529
+ len4
530
+ )
531
+ return ret
532
+ }
533
+ /**
534
+ * Execute a program.
535
+ * @param {string} program_ast_json
536
+ * @param {string | null | undefined} path
537
+ * @param {string} settings
538
+ * @returns {Promise<any>}
539
+ */
540
+ execute(program_ast_json, path, settings) {
541
+ const ptr0 = passStringToWasm0(
542
+ program_ast_json,
543
+ wasm.__wbindgen_malloc,
544
+ wasm.__wbindgen_realloc
545
+ )
546
+ const len0 = WASM_VECTOR_LEN
547
+ var ptr1 = isLikeNone(path)
548
+ ? 0
549
+ : passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc)
550
+ var len1 = WASM_VECTOR_LEN
551
+ const ptr2 = passStringToWasm0(
552
+ settings,
553
+ wasm.__wbindgen_malloc,
554
+ wasm.__wbindgen_realloc
555
+ )
556
+ const len2 = WASM_VECTOR_LEN
557
+ const ret = wasm.context_execute(
558
+ this.__wbg_ptr,
559
+ ptr0,
560
+ len0,
561
+ ptr1,
562
+ len1,
563
+ ptr2,
564
+ len2
565
+ )
566
+ return ret
567
+ }
568
+ /**
569
+ * Execute a program in mock mode.
570
+ * @param {string} program_ast_json
571
+ * @param {string | null | undefined} path
572
+ * @param {string} settings
573
+ * @param {boolean} use_prev_memory
574
+ * @returns {Promise<any>}
575
+ */
576
+ executeMock(program_ast_json, path, settings, use_prev_memory) {
577
+ const ptr0 = passStringToWasm0(
578
+ program_ast_json,
579
+ wasm.__wbindgen_malloc,
580
+ wasm.__wbindgen_realloc
581
+ )
582
+ const len0 = WASM_VECTOR_LEN
583
+ var ptr1 = isLikeNone(path)
584
+ ? 0
585
+ : passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc)
586
+ var len1 = WASM_VECTOR_LEN
587
+ const ptr2 = passStringToWasm0(
588
+ settings,
589
+ wasm.__wbindgen_malloc,
590
+ wasm.__wbindgen_realloc
591
+ )
592
+ const len2 = WASM_VECTOR_LEN
593
+ const ret = wasm.context_executeMock(
594
+ this.__wbg_ptr,
595
+ ptr0,
596
+ len0,
597
+ ptr1,
598
+ len1,
599
+ ptr2,
600
+ len2,
601
+ use_prev_memory
602
+ )
603
+ return ret
604
+ }
605
+ /**
606
+ * Execute trim operations on a sketch.
607
+ * This runs the full trim loop internally, executing all trim operations.
608
+ * @param {string} version_json
609
+ * @param {string} sketch_json
610
+ * @param {Float64Array} points
611
+ * @param {string} settings
612
+ * @returns {Promise<any>}
613
+ */
614
+ execute_trim(version_json, sketch_json, points, settings) {
615
+ const ptr0 = passStringToWasm0(
616
+ version_json,
617
+ wasm.__wbindgen_malloc,
618
+ wasm.__wbindgen_realloc
619
+ )
620
+ const len0 = WASM_VECTOR_LEN
621
+ const ptr1 = passStringToWasm0(
622
+ sketch_json,
623
+ wasm.__wbindgen_malloc,
624
+ wasm.__wbindgen_realloc
625
+ )
626
+ const len1 = WASM_VECTOR_LEN
627
+ const ptr2 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc)
628
+ const len2 = WASM_VECTOR_LEN
629
+ const ptr3 = passStringToWasm0(
630
+ settings,
631
+ wasm.__wbindgen_malloc,
632
+ wasm.__wbindgen_realloc
633
+ )
634
+ const len3 = WASM_VECTOR_LEN
635
+ const ret = wasm.context_execute_trim(
636
+ this.__wbg_ptr,
637
+ ptr0,
638
+ len0,
639
+ ptr1,
640
+ len1,
641
+ ptr2,
642
+ len2,
643
+ ptr3,
644
+ len3
645
+ )
646
+ return ret
647
+ }
648
+ /**
649
+ * Exit sketch mode.
650
+ * @param {string} version_json
651
+ * @param {string} sketch_json
652
+ * @param {string} settings
653
+ * @returns {Promise<any>}
654
+ */
655
+ exit_sketch(version_json, sketch_json, settings) {
656
+ const ptr0 = passStringToWasm0(
657
+ version_json,
658
+ wasm.__wbindgen_malloc,
659
+ wasm.__wbindgen_realloc
660
+ )
661
+ const len0 = WASM_VECTOR_LEN
662
+ const ptr1 = passStringToWasm0(
663
+ sketch_json,
664
+ wasm.__wbindgen_malloc,
665
+ wasm.__wbindgen_realloc
666
+ )
667
+ const len1 = WASM_VECTOR_LEN
668
+ const ptr2 = passStringToWasm0(
669
+ settings,
670
+ wasm.__wbindgen_malloc,
671
+ wasm.__wbindgen_realloc
672
+ )
673
+ const len2 = WASM_VECTOR_LEN
674
+ const ret = wasm.context_exit_sketch(
675
+ this.__wbg_ptr,
676
+ ptr0,
677
+ len0,
678
+ ptr1,
679
+ len1,
680
+ ptr2,
681
+ len2
682
+ )
683
+ return ret
684
+ }
685
+ /**
686
+ * Export a scene to a file.
687
+ * @param {string} format_json
688
+ * @param {string} settings
689
+ * @returns {Promise<any>}
690
+ */
691
+ export(format_json, settings) {
692
+ const ptr0 = passStringToWasm0(
693
+ format_json,
694
+ wasm.__wbindgen_malloc,
695
+ wasm.__wbindgen_realloc
696
+ )
697
+ const len0 = WASM_VECTOR_LEN
698
+ const ptr1 = passStringToWasm0(
699
+ settings,
700
+ wasm.__wbindgen_malloc,
701
+ wasm.__wbindgen_realloc
702
+ )
703
+ const len1 = WASM_VECTOR_LEN
704
+ const ret = wasm.context_export(this.__wbg_ptr, ptr0, len0, ptr1, len1)
705
+ return ret
706
+ }
707
+ /**
708
+ * @param {number} project_id
709
+ * @param {number} file_id
710
+ * @returns {Promise<any>}
711
+ */
712
+ get_file(project_id, file_id) {
713
+ const ret = wasm.context_get_file(this.__wbg_ptr, project_id, file_id)
714
+ return ret
715
+ }
716
+ /**
717
+ * @param {number} project_id
718
+ * @returns {Promise<any>}
719
+ */
720
+ get_project(project_id) {
721
+ const ret = wasm.context_get_project(this.__wbg_ptr, project_id)
722
+ return ret
723
+ }
724
+ /**
725
+ * Set the current program AST and execute it. Temporary hack for
726
+ * development purposes only.
727
+ * @param {string} program_ast_json
728
+ * @param {string} settings
729
+ * @returns {Promise<any>}
730
+ */
731
+ hack_set_program(program_ast_json, settings) {
732
+ const ptr0 = passStringToWasm0(
733
+ program_ast_json,
734
+ wasm.__wbindgen_malloc,
735
+ wasm.__wbindgen_realloc
736
+ )
737
+ const len0 = WASM_VECTOR_LEN
738
+ const ptr1 = passStringToWasm0(
739
+ settings,
740
+ wasm.__wbindgen_malloc,
741
+ wasm.__wbindgen_realloc
742
+ )
743
+ const len1 = WASM_VECTOR_LEN
744
+ const ret = wasm.context_hack_set_program(
745
+ this.__wbg_ptr,
746
+ ptr0,
747
+ len0,
748
+ ptr1,
749
+ len1
750
+ )
751
+ return ret
752
+ }
753
+ /**
754
+ * @param {any} engine_manager
755
+ * @param {any} fs_manager
756
+ */
757
+ constructor(engine_manager, fs_manager) {
758
+ const ret = wasm.context_new(engine_manager, fs_manager)
759
+ if (ret[2]) {
760
+ throw takeFromExternrefTable0(ret[1])
761
+ }
762
+ this.__wbg_ptr = ret[0] >>> 0
763
+ ContextFinalization.register(this, this.__wbg_ptr, this)
764
+ return this
765
+ }
766
+ /**
767
+ * Create new sketch and enter sketch mode.
768
+ * @param {string} project_json
769
+ * @param {string} file_json
770
+ * @param {string} version_json
771
+ * @param {string} args_json
772
+ * @param {string} settings
773
+ * @returns {Promise<any>}
774
+ */
775
+ new_sketch(project_json, file_json, version_json, args_json, settings) {
776
+ const ptr0 = passStringToWasm0(
777
+ project_json,
778
+ wasm.__wbindgen_malloc,
779
+ wasm.__wbindgen_realloc
780
+ )
781
+ const len0 = WASM_VECTOR_LEN
782
+ const ptr1 = passStringToWasm0(
783
+ file_json,
784
+ wasm.__wbindgen_malloc,
785
+ wasm.__wbindgen_realloc
786
+ )
787
+ const len1 = WASM_VECTOR_LEN
788
+ const ptr2 = passStringToWasm0(
789
+ version_json,
790
+ wasm.__wbindgen_malloc,
791
+ wasm.__wbindgen_realloc
792
+ )
793
+ const len2 = WASM_VECTOR_LEN
794
+ const ptr3 = passStringToWasm0(
795
+ args_json,
796
+ wasm.__wbindgen_malloc,
797
+ wasm.__wbindgen_realloc
798
+ )
799
+ const len3 = WASM_VECTOR_LEN
800
+ const ptr4 = passStringToWasm0(
801
+ settings,
802
+ wasm.__wbindgen_malloc,
803
+ wasm.__wbindgen_realloc
804
+ )
805
+ const len4 = WASM_VECTOR_LEN
806
+ const ret = wasm.context_new_sketch(
807
+ this.__wbg_ptr,
808
+ ptr0,
809
+ len0,
810
+ ptr1,
811
+ len1,
812
+ ptr2,
813
+ len2,
814
+ ptr3,
815
+ len3,
816
+ ptr4,
817
+ len4
818
+ )
819
+ return ret
820
+ }
821
+ /**
822
+ * @param {number} project
823
+ * @param {string} files
824
+ * @param {number} open_file
825
+ * @returns {Promise<void>}
826
+ */
827
+ open_project(project, files, open_file) {
828
+ const ptr0 = passStringToWasm0(
829
+ files,
830
+ wasm.__wbindgen_malloc,
831
+ wasm.__wbindgen_realloc
832
+ )
833
+ const len0 = WASM_VECTOR_LEN
834
+ const ret = wasm.context_open_project(
835
+ this.__wbg_ptr,
836
+ project,
837
+ ptr0,
838
+ len0,
839
+ open_file
840
+ )
841
+ return ret
842
+ }
843
+ /**
844
+ * @param {number} project
845
+ * @returns {Promise<void>}
846
+ */
847
+ refresh(project) {
848
+ const ret = wasm.context_refresh(this.__wbg_ptr, project)
849
+ return ret
850
+ }
851
+ /**
852
+ * @param {number} project
853
+ * @param {number} file
854
+ * @returns {Promise<void>}
855
+ */
856
+ remove_file(project, file) {
857
+ const ret = wasm.context_remove_file(this.__wbg_ptr, project, file)
858
+ return ret
859
+ }
860
+ /**
861
+ * @param {string} checkpoint_id_json
862
+ * @returns {Promise<any>}
863
+ */
864
+ restore_sketch_checkpoint(checkpoint_id_json) {
865
+ const ptr0 = passStringToWasm0(
866
+ checkpoint_id_json,
867
+ wasm.__wbindgen_malloc,
868
+ wasm.__wbindgen_realloc
869
+ )
870
+ const len0 = WASM_VECTOR_LEN
871
+ const ret = wasm.context_restore_sketch_checkpoint(
872
+ this.__wbg_ptr,
873
+ ptr0,
874
+ len0
875
+ )
876
+ return ret
877
+ }
878
+ /**
879
+ * Send a response to kcl lib's engine.
880
+ * @param {Uint8Array} data
881
+ * @returns {Promise<void>}
882
+ */
883
+ sendResponse(data) {
884
+ const ret = wasm.context_sendResponse(this.__wbg_ptr, data)
885
+ return ret
886
+ }
887
+ /**
888
+ * Execute the sketch in mock mode, without changing anything. This is
889
+ * useful after editing segments, and the user releases the mouse button.
890
+ * @param {string} version_json
891
+ * @param {string} sketch_json
892
+ * @param {string} settings
893
+ * @returns {Promise<any>}
894
+ */
895
+ sketch_execute_mock(version_json, sketch_json, settings) {
896
+ const ptr0 = passStringToWasm0(
897
+ version_json,
898
+ wasm.__wbindgen_malloc,
899
+ wasm.__wbindgen_realloc
900
+ )
901
+ const len0 = WASM_VECTOR_LEN
902
+ const ptr1 = passStringToWasm0(
903
+ sketch_json,
904
+ wasm.__wbindgen_malloc,
905
+ wasm.__wbindgen_realloc
906
+ )
907
+ const len1 = WASM_VECTOR_LEN
908
+ const ptr2 = passStringToWasm0(
909
+ settings,
910
+ wasm.__wbindgen_malloc,
911
+ wasm.__wbindgen_realloc
912
+ )
913
+ const len2 = WASM_VECTOR_LEN
914
+ const ret = wasm.context_sketch_execute_mock(
915
+ this.__wbg_ptr,
916
+ ptr0,
917
+ len0,
918
+ ptr1,
919
+ len1,
920
+ ptr2,
921
+ len2
922
+ )
923
+ return ret
924
+ }
925
+ /**
926
+ * @param {number} project
927
+ * @param {number} file
928
+ * @returns {Promise<void>}
929
+ */
930
+ switch_file(project, file) {
931
+ const ret = wasm.context_switch_file(this.__wbg_ptr, project, file)
932
+ return ret
933
+ }
934
+ /**
935
+ * Transpile old sketch syntax (startProfile in pipe) to new sketch block syntax.
936
+ *
937
+ * This function re-executes the program using the execution cache (which should be very fast
938
+ * if the program hasn't changed), then extracts the sketch and transpiles it.
939
+ *
940
+ * # Arguments
941
+ * * `program_ast_json` - Program AST as JSON string
942
+ * * `variable_name` - Name of the variable containing the old sketch syntax
943
+ * * `path` - Optional file path for execution context
944
+ * * `settings` - Execution settings as JSON string
945
+ *
946
+ * # Returns
947
+ * The transpiled code as a string, or an error if execution or transpilation fails.
948
+ * @param {string} program_ast_json
949
+ * @param {string} variable_name
950
+ * @param {string | null | undefined} path
951
+ * @param {string} settings
952
+ * @returns {Promise<any>}
953
+ */
954
+ transpile_old_sketch(program_ast_json, variable_name, path, settings) {
955
+ const ptr0 = passStringToWasm0(
956
+ program_ast_json,
957
+ wasm.__wbindgen_malloc,
958
+ wasm.__wbindgen_realloc
959
+ )
960
+ const len0 = WASM_VECTOR_LEN
961
+ const ptr1 = passStringToWasm0(
962
+ variable_name,
963
+ wasm.__wbindgen_malloc,
964
+ wasm.__wbindgen_realloc
965
+ )
966
+ const len1 = WASM_VECTOR_LEN
967
+ var ptr2 = isLikeNone(path)
968
+ ? 0
969
+ : passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc)
970
+ var len2 = WASM_VECTOR_LEN
971
+ const ptr3 = passStringToWasm0(
972
+ settings,
973
+ wasm.__wbindgen_malloc,
974
+ wasm.__wbindgen_realloc
975
+ )
976
+ const len3 = WASM_VECTOR_LEN
977
+ const ret = wasm.context_transpile_old_sketch(
978
+ this.__wbg_ptr,
979
+ ptr0,
980
+ len0,
981
+ ptr1,
982
+ len1,
983
+ ptr2,
984
+ len2,
985
+ ptr3,
986
+ len3
987
+ )
988
+ return ret
989
+ }
990
+ /**
991
+ * @param {number} project
992
+ * @param {number} file
993
+ * @param {string} text
994
+ * @returns {Promise<void>}
995
+ */
996
+ update_file(project, file, text) {
997
+ const ptr0 = passStringToWasm0(
998
+ text,
999
+ wasm.__wbindgen_malloc,
1000
+ wasm.__wbindgen_realloc
1001
+ )
1002
+ const len0 = WASM_VECTOR_LEN
1003
+ const ret = wasm.context_update_file(
1004
+ this.__wbg_ptr,
1005
+ project,
1006
+ file,
1007
+ ptr0,
1008
+ len0
1009
+ )
1010
+ return ret
1011
+ }
1012
+ }
1013
+ if (Symbol.dispose) Context.prototype[Symbol.dispose] = Context.prototype.free
1014
+
1015
+ export class IntoUnderlyingByteSource {
1016
+ __destroy_into_raw() {
1017
+ const ptr = this.__wbg_ptr
1018
+ this.__wbg_ptr = 0
1019
+ IntoUnderlyingByteSourceFinalization.unregister(this)
1020
+ return ptr
1021
+ }
1022
+ free() {
1023
+ const ptr = this.__destroy_into_raw()
1024
+ wasm.__wbg_intounderlyingbytesource_free(ptr, 0)
1025
+ }
1026
+ /**
1027
+ * @returns {number}
1028
+ */
1029
+ get autoAllocateChunkSize() {
1030
+ const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(
1031
+ this.__wbg_ptr
1032
+ )
1033
+ return ret >>> 0
1034
+ }
1035
+ cancel() {
1036
+ const ptr = this.__destroy_into_raw()
1037
+ wasm.intounderlyingbytesource_cancel(ptr)
1038
+ }
1039
+ /**
1040
+ * @param {ReadableByteStreamController} controller
1041
+ * @returns {Promise<any>}
1042
+ */
1043
+ pull(controller) {
1044
+ const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, controller)
1045
+ return ret
1046
+ }
1047
+ /**
1048
+ * @param {ReadableByteStreamController} controller
1049
+ */
1050
+ start(controller) {
1051
+ wasm.intounderlyingbytesource_start(this.__wbg_ptr, controller)
1052
+ }
1053
+ /**
1054
+ * @returns {ReadableStreamType}
1055
+ */
1056
+ get type() {
1057
+ const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr)
1058
+ return __wbindgen_enum_ReadableStreamType[ret]
1059
+ }
1060
+ }
1061
+ if (Symbol.dispose)
1062
+ IntoUnderlyingByteSource.prototype[Symbol.dispose] =
1063
+ IntoUnderlyingByteSource.prototype.free
1064
+
1065
+ export class IntoUnderlyingSink {
1066
+ __destroy_into_raw() {
1067
+ const ptr = this.__wbg_ptr
1068
+ this.__wbg_ptr = 0
1069
+ IntoUnderlyingSinkFinalization.unregister(this)
1070
+ return ptr
1071
+ }
1072
+ free() {
1073
+ const ptr = this.__destroy_into_raw()
1074
+ wasm.__wbg_intounderlyingsink_free(ptr, 0)
1075
+ }
1076
+ /**
1077
+ * @param {any} reason
1078
+ * @returns {Promise<any>}
1079
+ */
1080
+ abort(reason) {
1081
+ const ptr = this.__destroy_into_raw()
1082
+ const ret = wasm.intounderlyingsink_abort(ptr, reason)
1083
+ return ret
1084
+ }
1085
+ /**
1086
+ * @returns {Promise<any>}
1087
+ */
1088
+ close() {
1089
+ const ptr = this.__destroy_into_raw()
1090
+ const ret = wasm.intounderlyingsink_close(ptr)
1091
+ return ret
1092
+ }
1093
+ /**
1094
+ * @param {any} chunk
1095
+ * @returns {Promise<any>}
1096
+ */
1097
+ write(chunk) {
1098
+ const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, chunk)
1099
+ return ret
1100
+ }
1101
+ }
1102
+ if (Symbol.dispose)
1103
+ IntoUnderlyingSink.prototype[Symbol.dispose] =
1104
+ IntoUnderlyingSink.prototype.free
1105
+
1106
+ export class IntoUnderlyingSource {
1107
+ __destroy_into_raw() {
1108
+ const ptr = this.__wbg_ptr
1109
+ this.__wbg_ptr = 0
1110
+ IntoUnderlyingSourceFinalization.unregister(this)
1111
+ return ptr
1112
+ }
1113
+ free() {
1114
+ const ptr = this.__destroy_into_raw()
1115
+ wasm.__wbg_intounderlyingsource_free(ptr, 0)
1116
+ }
1117
+ cancel() {
1118
+ const ptr = this.__destroy_into_raw()
1119
+ wasm.intounderlyingsource_cancel(ptr)
1120
+ }
1121
+ /**
1122
+ * @param {ReadableStreamDefaultController} controller
1123
+ * @returns {Promise<any>}
1124
+ */
1125
+ pull(controller) {
1126
+ const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, controller)
1127
+ return ret
1128
+ }
1129
+ }
1130
+ if (Symbol.dispose)
1131
+ IntoUnderlyingSource.prototype[Symbol.dispose] =
1132
+ IntoUnderlyingSource.prototype.free
1133
+
1134
+ export class LspServerConfig {
1135
+ __destroy_into_raw() {
1136
+ const ptr = this.__wbg_ptr
1137
+ this.__wbg_ptr = 0
1138
+ LspServerConfigFinalization.unregister(this)
1139
+ return ptr
1140
+ }
1141
+ free() {
1142
+ const ptr = this.__destroy_into_raw()
1143
+ wasm.__wbg_lspserverconfig_free(ptr, 0)
1144
+ }
1145
+ /**
1146
+ * @param {AsyncIterator<any>} into_server
1147
+ * @param {WritableStream} from_server
1148
+ * @param {any} fs
1149
+ */
1150
+ constructor(into_server, from_server, fs) {
1151
+ const ret = wasm.lspserverconfig_new(into_server, from_server, fs)
1152
+ this.__wbg_ptr = ret >>> 0
1153
+ LspServerConfigFinalization.register(this, this.__wbg_ptr, this)
1154
+ return this
1155
+ }
1156
+ }
1157
+ if (Symbol.dispose)
1158
+ LspServerConfig.prototype[Symbol.dispose] = LspServerConfig.prototype.free
1159
+
1160
+ export class ResponseContext {
1161
+ __destroy_into_raw() {
1162
+ const ptr = this.__wbg_ptr
1163
+ this.__wbg_ptr = 0
1164
+ ResponseContextFinalization.unregister(this)
1165
+ return ptr
1166
+ }
1167
+ free() {
1168
+ const ptr = this.__destroy_into_raw()
1169
+ wasm.__wbg_responsecontext_free(ptr, 0)
1170
+ }
1171
+ constructor() {
1172
+ const ret = wasm.responsecontext_new()
1173
+ this.__wbg_ptr = ret >>> 0
1174
+ ResponseContextFinalization.register(this, this.__wbg_ptr, this)
1175
+ return this
1176
+ }
1177
+ /**
1178
+ * @param {Uint8Array} data
1179
+ * @returns {Promise<void>}
1180
+ */
1181
+ send_response(data) {
1182
+ const ret = wasm.responsecontext_send_response(this.__wbg_ptr, data)
1183
+ return ret
1184
+ }
1185
+ }
1186
+ if (Symbol.dispose)
1187
+ ResponseContext.prototype[Symbol.dispose] = ResponseContext.prototype.free
1188
+
1189
+ export class TangentialArcInfoOutputWasm {
1190
+ static __wrap(ptr) {
1191
+ ptr = ptr >>> 0
1192
+ const obj = Object.create(TangentialArcInfoOutputWasm.prototype)
1193
+ obj.__wbg_ptr = ptr
1194
+ TangentialArcInfoOutputWasmFinalization.register(obj, obj.__wbg_ptr, obj)
1195
+ return obj
1196
+ }
1197
+ __destroy_into_raw() {
1198
+ const ptr = this.__wbg_ptr
1199
+ this.__wbg_ptr = 0
1200
+ TangentialArcInfoOutputWasmFinalization.unregister(this)
1201
+ return ptr
1202
+ }
1203
+ free() {
1204
+ const ptr = this.__destroy_into_raw()
1205
+ wasm.__wbg_tangentialarcinfooutputwasm_free(ptr, 0)
1206
+ }
1207
+ /**
1208
+ * The length of the arc.
1209
+ * @returns {number}
1210
+ */
1211
+ get arc_length() {
1212
+ const ret = wasm.__wbg_get_tangentialarcinfooutputwasm_arc_length(
1213
+ this.__wbg_ptr
1214
+ )
1215
+ return ret
1216
+ }
1217
+ /**
1218
+ * The midpoint of the arc x.
1219
+ * @returns {number}
1220
+ */
1221
+ get arc_mid_point_x() {
1222
+ const ret = wasm.__wbg_get_tangentialarcinfooutputwasm_arc_mid_point_x(
1223
+ this.__wbg_ptr
1224
+ )
1225
+ return ret
1226
+ }
1227
+ /**
1228
+ * The midpoint of the arc y.
1229
+ * @returns {number}
1230
+ */
1231
+ get arc_mid_point_y() {
1232
+ const ret = wasm.__wbg_get_tangentialarcinfooutputwasm_arc_mid_point_y(
1233
+ this.__wbg_ptr
1234
+ )
1235
+ return ret
1236
+ }
1237
+ /**
1238
+ * Flag to determine if the arc is counter clockwise.
1239
+ * @returns {number}
1240
+ */
1241
+ get ccw() {
1242
+ const ret = wasm.__wbg_get_tangentialarcinfooutputwasm_ccw(this.__wbg_ptr)
1243
+ return ret
1244
+ }
1245
+ /**
1246
+ * The geometric center of the arc x.
1247
+ * @returns {number}
1248
+ */
1249
+ get center_x() {
1250
+ const ret = wasm.__wbg_get_tangentialarcinfooutputwasm_center_x(
1251
+ this.__wbg_ptr
1252
+ )
1253
+ return ret
1254
+ }
1255
+ /**
1256
+ * The geometric center of the arc y.
1257
+ * @returns {number}
1258
+ */
1259
+ get center_y() {
1260
+ const ret = wasm.__wbg_get_tangentialarcinfooutputwasm_center_y(
1261
+ this.__wbg_ptr
1262
+ )
1263
+ return ret
1264
+ }
1265
+ /**
1266
+ * End angle of the arc in radians.
1267
+ * @returns {number}
1268
+ */
1269
+ get end_angle() {
1270
+ const ret = wasm.__wbg_get_tangentialarcinfooutputwasm_end_angle(
1271
+ this.__wbg_ptr
1272
+ )
1273
+ return ret
1274
+ }
1275
+ /**
1276
+ * The radius of the arc.
1277
+ * @returns {number}
1278
+ */
1279
+ get radius() {
1280
+ const ret = wasm.__wbg_get_tangentialarcinfooutputwasm_radius(
1281
+ this.__wbg_ptr
1282
+ )
1283
+ return ret
1284
+ }
1285
+ /**
1286
+ * Start angle of the arc in radians.
1287
+ * @returns {number}
1288
+ */
1289
+ get start_angle() {
1290
+ const ret = wasm.__wbg_get_tangentialarcinfooutputwasm_start_angle(
1291
+ this.__wbg_ptr
1292
+ )
1293
+ return ret
1294
+ }
1295
+ /**
1296
+ * The length of the arc.
1297
+ * @param {number} arg0
1298
+ */
1299
+ set arc_length(arg0) {
1300
+ wasm.__wbg_set_tangentialarcinfooutputwasm_arc_length(this.__wbg_ptr, arg0)
1301
+ }
1302
+ /**
1303
+ * The midpoint of the arc x.
1304
+ * @param {number} arg0
1305
+ */
1306
+ set arc_mid_point_x(arg0) {
1307
+ wasm.__wbg_set_tangentialarcinfooutputwasm_arc_mid_point_x(
1308
+ this.__wbg_ptr,
1309
+ arg0
1310
+ )
1311
+ }
1312
+ /**
1313
+ * The midpoint of the arc y.
1314
+ * @param {number} arg0
1315
+ */
1316
+ set arc_mid_point_y(arg0) {
1317
+ wasm.__wbg_set_tangentialarcinfooutputwasm_arc_mid_point_y(
1318
+ this.__wbg_ptr,
1319
+ arg0
1320
+ )
1321
+ }
1322
+ /**
1323
+ * Flag to determine if the arc is counter clockwise.
1324
+ * @param {number} arg0
1325
+ */
1326
+ set ccw(arg0) {
1327
+ wasm.__wbg_set_tangentialarcinfooutputwasm_ccw(this.__wbg_ptr, arg0)
1328
+ }
1329
+ /**
1330
+ * The geometric center of the arc x.
1331
+ * @param {number} arg0
1332
+ */
1333
+ set center_x(arg0) {
1334
+ wasm.__wbg_set_tangentialarcinfooutputwasm_center_x(this.__wbg_ptr, arg0)
1335
+ }
1336
+ /**
1337
+ * The geometric center of the arc y.
1338
+ * @param {number} arg0
1339
+ */
1340
+ set center_y(arg0) {
1341
+ wasm.__wbg_set_tangentialarcinfooutputwasm_center_y(this.__wbg_ptr, arg0)
1342
+ }
1343
+ /**
1344
+ * End angle of the arc in radians.
1345
+ * @param {number} arg0
1346
+ */
1347
+ set end_angle(arg0) {
1348
+ wasm.__wbg_set_tangentialarcinfooutputwasm_end_angle(this.__wbg_ptr, arg0)
1349
+ }
1350
+ /**
1351
+ * The radius of the arc.
1352
+ * @param {number} arg0
1353
+ */
1354
+ set radius(arg0) {
1355
+ wasm.__wbg_set_tangentialarcinfooutputwasm_radius(this.__wbg_ptr, arg0)
1356
+ }
1357
+ /**
1358
+ * Start angle of the arc in radians.
1359
+ * @param {number} arg0
1360
+ */
1361
+ set start_angle(arg0) {
1362
+ wasm.__wbg_set_tangentialarcinfooutputwasm_start_angle(this.__wbg_ptr, arg0)
1363
+ }
1364
+ }
1365
+ if (Symbol.dispose)
1366
+ TangentialArcInfoOutputWasm.prototype[Symbol.dispose] =
1367
+ TangentialArcInfoOutputWasm.prototype.free
1368
+
1369
+ export class WasmCircleParams {
1370
+ static __wrap(ptr) {
1371
+ ptr = ptr >>> 0
1372
+ const obj = Object.create(WasmCircleParams.prototype)
1373
+ obj.__wbg_ptr = ptr
1374
+ WasmCircleParamsFinalization.register(obj, obj.__wbg_ptr, obj)
1375
+ return obj
1376
+ }
1377
+ __destroy_into_raw() {
1378
+ const ptr = this.__wbg_ptr
1379
+ this.__wbg_ptr = 0
1380
+ WasmCircleParamsFinalization.unregister(this)
1381
+ return ptr
1382
+ }
1383
+ free() {
1384
+ const ptr = this.__destroy_into_raw()
1385
+ wasm.__wbg_wasmcircleparams_free(ptr, 0)
1386
+ }
1387
+ /**
1388
+ * @returns {number}
1389
+ */
1390
+ get center_x() {
1391
+ const ret = wasm.__wbg_get_wasmcircleparams_center_x(this.__wbg_ptr)
1392
+ return ret
1393
+ }
1394
+ /**
1395
+ * @returns {number}
1396
+ */
1397
+ get center_y() {
1398
+ const ret = wasm.__wbg_get_wasmcircleparams_center_y(this.__wbg_ptr)
1399
+ return ret
1400
+ }
1401
+ /**
1402
+ * @returns {number}
1403
+ */
1404
+ get radius() {
1405
+ const ret = wasm.__wbg_get_wasmcircleparams_radius(this.__wbg_ptr)
1406
+ return ret
1407
+ }
1408
+ /**
1409
+ * @param {number} arg0
1410
+ */
1411
+ set center_x(arg0) {
1412
+ wasm.__wbg_set_wasmcircleparams_center_x(this.__wbg_ptr, arg0)
1413
+ }
1414
+ /**
1415
+ * @param {number} arg0
1416
+ */
1417
+ set center_y(arg0) {
1418
+ wasm.__wbg_set_wasmcircleparams_center_y(this.__wbg_ptr, arg0)
1419
+ }
1420
+ /**
1421
+ * @param {number} arg0
1422
+ */
1423
+ set radius(arg0) {
1424
+ wasm.__wbg_set_wasmcircleparams_radius(this.__wbg_ptr, arg0)
1425
+ }
1426
+ }
1427
+ if (Symbol.dispose)
1428
+ WasmCircleParams.prototype[Symbol.dispose] = WasmCircleParams.prototype.free
1429
+
1430
+ /**
1431
+ * Base64 decode a string.
1432
+ * @param {string} input
1433
+ * @returns {Uint8Array}
1434
+ */
1435
+ export function base64_decode(input) {
1436
+ const ptr0 = passStringToWasm0(
1437
+ input,
1438
+ wasm.__wbindgen_malloc,
1439
+ wasm.__wbindgen_realloc
1440
+ )
1441
+ const len0 = WASM_VECTOR_LEN
1442
+ const ret = wasm.base64_decode(ptr0, len0)
1443
+ if (ret[3]) {
1444
+ throw takeFromExternrefTable0(ret[2])
1445
+ }
1446
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice()
1447
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1)
1448
+ return v2
1449
+ }
1450
+
1451
+ /**
1452
+ * Calculate a circle from 3 points.
1453
+ * @param {number} ax
1454
+ * @param {number} ay
1455
+ * @param {number} bx
1456
+ * @param {number} by
1457
+ * @param {number} cx
1458
+ * @param {number} cy
1459
+ * @returns {WasmCircleParams}
1460
+ */
1461
+ export function calculate_circle_from_3_points(ax, ay, bx, by, cx, cy) {
1462
+ const ret = wasm.calculate_circle_from_3_points(ax, ay, bx, by, cx, cy)
1463
+ return WasmCircleParams.__wrap(ret)
1464
+ }
1465
+
1466
+ /**
1467
+ * Takes a kcl string and Meta settings and changes the meta settings in the kcl string.
1468
+ * @param {string} code
1469
+ * @param {string} len_str
1470
+ * @returns {string}
1471
+ */
1472
+ export function change_default_units(code, len_str) {
1473
+ let deferred4_0
1474
+ let deferred4_1
1475
+ try {
1476
+ const ptr0 = passStringToWasm0(
1477
+ code,
1478
+ wasm.__wbindgen_malloc,
1479
+ wasm.__wbindgen_realloc
1480
+ )
1481
+ const len0 = WASM_VECTOR_LEN
1482
+ const ptr1 = passStringToWasm0(
1483
+ len_str,
1484
+ wasm.__wbindgen_malloc,
1485
+ wasm.__wbindgen_realloc
1486
+ )
1487
+ const len1 = WASM_VECTOR_LEN
1488
+ const ret = wasm.change_default_units(ptr0, len0, ptr1, len1)
1489
+ var ptr3 = ret[0]
1490
+ var len3 = ret[1]
1491
+ if (ret[3]) {
1492
+ ptr3 = 0
1493
+ len3 = 0
1494
+ throw takeFromExternrefTable0(ret[2])
1495
+ }
1496
+ deferred4_0 = ptr3
1497
+ deferred4_1 = len3
1498
+ return getStringFromWasm0(ptr3, len3)
1499
+ } finally {
1500
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1)
1501
+ }
1502
+ }
1503
+
1504
+ /**
1505
+ * Takes a kcl string and Meta settings and changes the meta settings in the kcl string.
1506
+ * @param {string} code
1507
+ * @param {string} level_str
1508
+ * @returns {string}
1509
+ */
1510
+ export function change_experimental_features(code, level_str) {
1511
+ let deferred4_0
1512
+ let deferred4_1
1513
+ try {
1514
+ const ptr0 = passStringToWasm0(
1515
+ code,
1516
+ wasm.__wbindgen_malloc,
1517
+ wasm.__wbindgen_realloc
1518
+ )
1519
+ const len0 = WASM_VECTOR_LEN
1520
+ const ptr1 = passStringToWasm0(
1521
+ level_str,
1522
+ wasm.__wbindgen_malloc,
1523
+ wasm.__wbindgen_realloc
1524
+ )
1525
+ const len1 = WASM_VECTOR_LEN
1526
+ const ret = wasm.change_experimental_features(ptr0, len0, ptr1, len1)
1527
+ var ptr3 = ret[0]
1528
+ var len3 = ret[1]
1529
+ if (ret[3]) {
1530
+ ptr3 = 0
1531
+ len3 = 0
1532
+ throw takeFromExternrefTable0(ret[2])
1533
+ }
1534
+ deferred4_0 = ptr3
1535
+ deferred4_1 = len3
1536
+ return getStringFromWasm0(ptr3, len3)
1537
+ } finally {
1538
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1)
1539
+ }
1540
+ }
1541
+
1542
+ /**
1543
+ * Get a coredump.
1544
+ * @param {any} core_dump_manager
1545
+ * @returns {Promise<any>}
1546
+ */
1547
+ export function coredump(core_dump_manager) {
1548
+ const ret = wasm.coredump(core_dump_manager)
1549
+ return ret
1550
+ }
1551
+
1552
+ /**
1553
+ * Get the default app settings.
1554
+ * @returns {any}
1555
+ */
1556
+ export function default_app_settings() {
1557
+ const ret = wasm.default_app_settings()
1558
+ if (ret[2]) {
1559
+ throw takeFromExternrefTable0(ret[1])
1560
+ }
1561
+ return takeFromExternrefTable0(ret[0])
1562
+ }
1563
+
1564
+ /**
1565
+ * Get the default project settings.
1566
+ * @returns {any}
1567
+ */
1568
+ export function default_project_settings() {
1569
+ const ret = wasm.default_project_settings()
1570
+ if (ret[2]) {
1571
+ throw takeFromExternrefTable0(ret[1])
1572
+ }
1573
+ return takeFromExternrefTable0(ret[0])
1574
+ }
1575
+
1576
+ /**
1577
+ * @param {number} value
1578
+ * @param {string} suffix_json
1579
+ * @param {number | null} [decimals]
1580
+ * @returns {string}
1581
+ */
1582
+ export function format_number_literal(value, suffix_json, decimals) {
1583
+ let deferred3_0
1584
+ let deferred3_1
1585
+ try {
1586
+ const ptr0 = passStringToWasm0(
1587
+ suffix_json,
1588
+ wasm.__wbindgen_malloc,
1589
+ wasm.__wbindgen_realloc
1590
+ )
1591
+ const len0 = WASM_VECTOR_LEN
1592
+ const ret = wasm.format_number_literal(
1593
+ value,
1594
+ ptr0,
1595
+ len0,
1596
+ isLikeNone(decimals) ? 0x100000001 : decimals >>> 0
1597
+ )
1598
+ var ptr2 = ret[0]
1599
+ var len2 = ret[1]
1600
+ if (ret[3]) {
1601
+ ptr2 = 0
1602
+ len2 = 0
1603
+ throw takeFromExternrefTable0(ret[2])
1604
+ }
1605
+ deferred3_0 = ptr2
1606
+ deferred3_1 = len2
1607
+ return getStringFromWasm0(ptr2, len2)
1608
+ } finally {
1609
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1)
1610
+ }
1611
+ }
1612
+
1613
+ /**
1614
+ * @param {number} value
1615
+ * @param {string} numeric_type_json
1616
+ * @returns {string}
1617
+ */
1618
+ export function format_number_value(value, numeric_type_json) {
1619
+ let deferred3_0
1620
+ let deferred3_1
1621
+ try {
1622
+ const ptr0 = passStringToWasm0(
1623
+ numeric_type_json,
1624
+ wasm.__wbindgen_malloc,
1625
+ wasm.__wbindgen_realloc
1626
+ )
1627
+ const len0 = WASM_VECTOR_LEN
1628
+ const ret = wasm.format_number_value(value, ptr0, len0)
1629
+ var ptr2 = ret[0]
1630
+ var len2 = ret[1]
1631
+ if (ret[3]) {
1632
+ ptr2 = 0
1633
+ len2 = 0
1634
+ throw takeFromExternrefTable0(ret[2])
1635
+ }
1636
+ deferred3_0 = ptr2
1637
+ deferred3_1 = len2
1638
+ return getStringFromWasm0(ptr2, len2)
1639
+ } finally {
1640
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1)
1641
+ }
1642
+ }
1643
+
1644
+ /**
1645
+ * Get the version of the kcl library.
1646
+ * @returns {string}
1647
+ */
1648
+ export function get_kcl_version() {
1649
+ let deferred1_0
1650
+ let deferred1_1
1651
+ try {
1652
+ const ret = wasm.get_kcl_version()
1653
+ deferred1_0 = ret[0]
1654
+ deferred1_1 = ret[1]
1655
+ return getStringFromWasm0(ret[0], ret[1])
1656
+ } finally {
1657
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1)
1658
+ }
1659
+ }
1660
+
1661
+ /**
1662
+ * @param {number} arc_start_point_x
1663
+ * @param {number} arc_start_point_y
1664
+ * @param {number} arc_end_point_x
1665
+ * @param {number} arc_end_point_y
1666
+ * @param {number} tan_previous_point_x
1667
+ * @param {number} tan_previous_point_y
1668
+ * @param {boolean} obtuse
1669
+ * @returns {TangentialArcInfoOutputWasm}
1670
+ */
1671
+ export function get_tangential_arc_to_info(
1672
+ arc_start_point_x,
1673
+ arc_start_point_y,
1674
+ arc_end_point_x,
1675
+ arc_end_point_y,
1676
+ tan_previous_point_x,
1677
+ tan_previous_point_y,
1678
+ obtuse
1679
+ ) {
1680
+ const ret = wasm.get_tangential_arc_to_info(
1681
+ arc_start_point_x,
1682
+ arc_start_point_y,
1683
+ arc_end_point_x,
1684
+ arc_end_point_y,
1685
+ tan_previous_point_x,
1686
+ tan_previous_point_y,
1687
+ obtuse
1688
+ )
1689
+ return TangentialArcInfoOutputWasm.__wrap(ret)
1690
+ }
1691
+
1692
+ /**
1693
+ * @param {number} value
1694
+ * @param {string} ty_json
1695
+ * @returns {string}
1696
+ */
1697
+ export function human_display_number(value, ty_json) {
1698
+ let deferred3_0
1699
+ let deferred3_1
1700
+ try {
1701
+ const ptr0 = passStringToWasm0(
1702
+ ty_json,
1703
+ wasm.__wbindgen_malloc,
1704
+ wasm.__wbindgen_realloc
1705
+ )
1706
+ const len0 = WASM_VECTOR_LEN
1707
+ const ret = wasm.human_display_number(value, ptr0, len0)
1708
+ var ptr2 = ret[0]
1709
+ var len2 = ret[1]
1710
+ if (ret[3]) {
1711
+ ptr2 = 0
1712
+ len2 = 0
1713
+ throw takeFromExternrefTable0(ret[2])
1714
+ }
1715
+ deferred3_0 = ptr2
1716
+ deferred3_1 = len2
1717
+ return getStringFromWasm0(ptr2, len2)
1718
+ } finally {
1719
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1)
1720
+ }
1721
+ }
1722
+
1723
+ /**
1724
+ * Get the allowed import file extensions.
1725
+ * @returns {string[]}
1726
+ */
1727
+ export function import_file_extensions() {
1728
+ const ret = wasm.import_file_extensions()
1729
+ if (ret[3]) {
1730
+ throw takeFromExternrefTable0(ret[2])
1731
+ }
1732
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice()
1733
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4)
1734
+ return v1
1735
+ }
1736
+
1737
+ /**
1738
+ * Returns true if the given KCL is empty or only contains settings that would
1739
+ * be auto-generated.
1740
+ * @param {string} code
1741
+ * @returns {any}
1742
+ */
1743
+ export function is_kcl_empty_or_only_settings(code) {
1744
+ const ptr0 = passStringToWasm0(
1745
+ code,
1746
+ wasm.__wbindgen_malloc,
1747
+ wasm.__wbindgen_realloc
1748
+ )
1749
+ const len0 = WASM_VECTOR_LEN
1750
+ const ret = wasm.is_kcl_empty_or_only_settings(ptr0, len0)
1751
+ if (ret[2]) {
1752
+ throw takeFromExternrefTable0(ret[1])
1753
+ }
1754
+ return takeFromExternrefTable0(ret[0])
1755
+ }
1756
+
1757
+ /**
1758
+ * @param {Float64Array} points
1759
+ * @returns {number}
1760
+ */
1761
+ export function is_points_ccw(points) {
1762
+ const ptr0 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc)
1763
+ const len0 = WASM_VECTOR_LEN
1764
+ const ret = wasm.is_points_ccw(ptr0, len0)
1765
+ return ret
1766
+ }
1767
+
1768
+ /**
1769
+ * @param {string} program_ast_json
1770
+ * @returns {Promise<any>}
1771
+ */
1772
+ export function kcl_lint(program_ast_json) {
1773
+ const ptr0 = passStringToWasm0(
1774
+ program_ast_json,
1775
+ wasm.__wbindgen_malloc,
1776
+ wasm.__wbindgen_realloc
1777
+ )
1778
+ const len0 = WASM_VECTOR_LEN
1779
+ const ret = wasm.kcl_lint(ptr0, len0)
1780
+ return ret
1781
+ }
1782
+
1783
+ /**
1784
+ * Takes a parsed KCL program and returns the Meta settings. If it's not
1785
+ * found, null is returned.
1786
+ * @param {string} program_json
1787
+ * @returns {any}
1788
+ */
1789
+ export function kcl_settings(program_json) {
1790
+ const ptr0 = passStringToWasm0(
1791
+ program_json,
1792
+ wasm.__wbindgen_malloc,
1793
+ wasm.__wbindgen_realloc
1794
+ )
1795
+ const len0 = WASM_VECTOR_LEN
1796
+ const ret = wasm.kcl_settings(ptr0, len0)
1797
+ if (ret[2]) {
1798
+ throw takeFromExternrefTable0(ret[1])
1799
+ }
1800
+ return takeFromExternrefTable0(ret[0])
1801
+ }
1802
+
1803
+ /**
1804
+ * Run the `copilot` lsp server.
1805
+ * @param {LspServerConfig} config
1806
+ * @param {string} token
1807
+ * @param {string} baseurl
1808
+ * @returns {Promise<void>}
1809
+ */
1810
+ export function lsp_run_copilot(config, token, baseurl) {
1811
+ _assertClass(config, LspServerConfig)
1812
+ var ptr0 = config.__destroy_into_raw()
1813
+ const ptr1 = passStringToWasm0(
1814
+ token,
1815
+ wasm.__wbindgen_malloc,
1816
+ wasm.__wbindgen_realloc
1817
+ )
1818
+ const len1 = WASM_VECTOR_LEN
1819
+ const ptr2 = passStringToWasm0(
1820
+ baseurl,
1821
+ wasm.__wbindgen_malloc,
1822
+ wasm.__wbindgen_realloc
1823
+ )
1824
+ const len2 = WASM_VECTOR_LEN
1825
+ const ret = wasm.lsp_run_copilot(ptr0, ptr1, len1, ptr2, len2)
1826
+ return ret
1827
+ }
1828
+
1829
+ /**
1830
+ * Run the `kcl` lsp server.
1831
+ * @param {LspServerConfig} config
1832
+ * @param {string} token
1833
+ * @param {string} baseurl
1834
+ * @returns {Promise<void>}
1835
+ */
1836
+ export function lsp_run_kcl(config, token, baseurl) {
1837
+ _assertClass(config, LspServerConfig)
1838
+ var ptr0 = config.__destroy_into_raw()
1839
+ const ptr1 = passStringToWasm0(
1840
+ token,
1841
+ wasm.__wbindgen_malloc,
1842
+ wasm.__wbindgen_realloc
1843
+ )
1844
+ const len1 = WASM_VECTOR_LEN
1845
+ const ptr2 = passStringToWasm0(
1846
+ baseurl,
1847
+ wasm.__wbindgen_malloc,
1848
+ wasm.__wbindgen_realloc
1849
+ )
1850
+ const len2 = WASM_VECTOR_LEN
1851
+ const ret = wasm.lsp_run_kcl(ptr0, ptr1, len1, ptr2, len2)
1852
+ return ret
1853
+ }
1854
+
1855
+ /**
1856
+ * @param {string} program_ast_json
1857
+ * @param {string} range_json
1858
+ * @returns {Promise<any>}
1859
+ */
1860
+ export function node_path_from_range(program_ast_json, range_json) {
1861
+ const ptr0 = passStringToWasm0(
1862
+ program_ast_json,
1863
+ wasm.__wbindgen_malloc,
1864
+ wasm.__wbindgen_realloc
1865
+ )
1866
+ const len0 = WASM_VECTOR_LEN
1867
+ const ptr1 = passStringToWasm0(
1868
+ range_json,
1869
+ wasm.__wbindgen_malloc,
1870
+ wasm.__wbindgen_realloc
1871
+ )
1872
+ const len1 = WASM_VECTOR_LEN
1873
+ const ret = wasm.node_path_from_range(ptr0, len0, ptr1, len1)
1874
+ return ret
1875
+ }
1876
+
1877
+ /**
1878
+ * Parse the app settings.
1879
+ * @param {string} toml_str
1880
+ * @returns {any}
1881
+ */
1882
+ export function parse_app_settings(toml_str) {
1883
+ const ptr0 = passStringToWasm0(
1884
+ toml_str,
1885
+ wasm.__wbindgen_malloc,
1886
+ wasm.__wbindgen_realloc
1887
+ )
1888
+ const len0 = WASM_VECTOR_LEN
1889
+ const ret = wasm.parse_app_settings(ptr0, len0)
1890
+ if (ret[2]) {
1891
+ throw takeFromExternrefTable0(ret[1])
1892
+ }
1893
+ return takeFromExternrefTable0(ret[0])
1894
+ }
1895
+
1896
+ /**
1897
+ * Parse (deserialize) the project settings.
1898
+ * @param {string} toml_str
1899
+ * @returns {any}
1900
+ */
1901
+ export function parse_project_settings(toml_str) {
1902
+ const ptr0 = passStringToWasm0(
1903
+ toml_str,
1904
+ wasm.__wbindgen_malloc,
1905
+ wasm.__wbindgen_realloc
1906
+ )
1907
+ const len0 = WASM_VECTOR_LEN
1908
+ const ret = wasm.parse_project_settings(ptr0, len0)
1909
+ if (ret[2]) {
1910
+ throw takeFromExternrefTable0(ret[1])
1911
+ }
1912
+ return takeFromExternrefTable0(ret[0])
1913
+ }
1914
+
1915
+ /**
1916
+ * @param {string} kcl_program_source
1917
+ * @returns {any}
1918
+ */
1919
+ export function parse_wasm(kcl_program_source) {
1920
+ const ptr0 = passStringToWasm0(
1921
+ kcl_program_source,
1922
+ wasm.__wbindgen_malloc,
1923
+ wasm.__wbindgen_realloc
1924
+ )
1925
+ const len0 = WASM_VECTOR_LEN
1926
+ const ret = wasm.parse_wasm(ptr0, len0)
1927
+ if (ret[2]) {
1928
+ throw takeFromExternrefTable0(ret[1])
1929
+ }
1930
+ return takeFromExternrefTable0(ret[0])
1931
+ }
1932
+
1933
+ /**
1934
+ * @param {string} point_json
1935
+ * @param {string} from_len_unit_json
1936
+ * @param {string} to_len_unit_json
1937
+ * @returns {Float64Array}
1938
+ */
1939
+ export function point_to_unit(
1940
+ point_json,
1941
+ from_len_unit_json,
1942
+ to_len_unit_json
1943
+ ) {
1944
+ const ptr0 = passStringToWasm0(
1945
+ point_json,
1946
+ wasm.__wbindgen_malloc,
1947
+ wasm.__wbindgen_realloc
1948
+ )
1949
+ const len0 = WASM_VECTOR_LEN
1950
+ const ptr1 = passStringToWasm0(
1951
+ from_len_unit_json,
1952
+ wasm.__wbindgen_malloc,
1953
+ wasm.__wbindgen_realloc
1954
+ )
1955
+ const len1 = WASM_VECTOR_LEN
1956
+ const ptr2 = passStringToWasm0(
1957
+ to_len_unit_json,
1958
+ wasm.__wbindgen_malloc,
1959
+ wasm.__wbindgen_realloc
1960
+ )
1961
+ const len2 = WASM_VECTOR_LEN
1962
+ const ret = wasm.point_to_unit(ptr0, len0, ptr1, len1, ptr2, len2)
1963
+ if (ret[3]) {
1964
+ throw takeFromExternrefTable0(ret[2])
1965
+ }
1966
+ var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice()
1967
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8)
1968
+ return v4
1969
+ }
1970
+
1971
+ /**
1972
+ * @param {string} json_str
1973
+ * @returns {any}
1974
+ */
1975
+ export function recast_wasm(json_str) {
1976
+ const ptr0 = passStringToWasm0(
1977
+ json_str,
1978
+ wasm.__wbindgen_malloc,
1979
+ wasm.__wbindgen_realloc
1980
+ )
1981
+ const len0 = WASM_VECTOR_LEN
1982
+ const ret = wasm.recast_wasm(ptr0, len0)
1983
+ if (ret[2]) {
1984
+ throw takeFromExternrefTable0(ret[1])
1985
+ }
1986
+ return takeFromExternrefTable0(ret[0])
1987
+ }
1988
+
1989
+ /**
1990
+ * Get the allowed relevant file extensions (imports + kcl).
1991
+ * @returns {string[]}
1992
+ */
1993
+ export function relevant_file_extensions() {
1994
+ const ret = wasm.relevant_file_extensions()
1995
+ if (ret[3]) {
1996
+ throw takeFromExternrefTable0(ret[2])
1997
+ }
1998
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice()
1999
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4)
2000
+ return v1
2001
+ }
2002
+
2003
+ /**
2004
+ * Serialize the configuration settings.
2005
+ * @param {any} val
2006
+ * @returns {any}
2007
+ */
2008
+ export function serialize_configuration(val) {
2009
+ const ret = wasm.serialize_configuration(val)
2010
+ if (ret[2]) {
2011
+ throw takeFromExternrefTable0(ret[1])
2012
+ }
2013
+ return takeFromExternrefTable0(ret[0])
2014
+ }
2015
+
2016
+ /**
2017
+ * Serialize the project configuration settings.
2018
+ * @param {any} val
2019
+ * @returns {any}
2020
+ */
2021
+ export function serialize_project_configuration(val) {
2022
+ const ret = wasm.serialize_project_configuration(val)
2023
+ if (ret[2]) {
2024
+ throw takeFromExternrefTable0(ret[1])
2025
+ }
2026
+ return takeFromExternrefTable0(ret[0])
2027
+ }
2028
+
2029
+ /**
2030
+ * @returns {number}
2031
+ */
2032
+ export function sketch_checkpoint_limit() {
2033
+ const ret = wasm.sketch_checkpoint_limit()
2034
+ return ret >>> 0
2035
+ }
2036
+
2037
+ function __wbg_get_imports() {
2038
+ const import0 = {
2039
+ __proto__: null,
2040
+ __wbg_Error_55538483de6e3abe: function (arg0, arg1) {
2041
+ const ret = Error(getStringFromWasm0(arg0, arg1))
2042
+ return ret
2043
+ },
2044
+ __wbg___wbindgen_boolean_get_fe2a24fdfdb4064f: function (arg0) {
2045
+ const v = arg0
2046
+ const ret = typeof v === 'boolean' ? v : undefined
2047
+ return isLikeNone(ret) ? 0xffffff : ret ? 1 : 0
2048
+ },
2049
+ __wbg___wbindgen_debug_string_d89627202d0155b7: function (arg0, arg1) {
2050
+ const ret = debugString(arg1)
2051
+ const ptr1 = passStringToWasm0(
2052
+ ret,
2053
+ wasm.__wbindgen_malloc,
2054
+ wasm.__wbindgen_realloc
2055
+ )
2056
+ const len1 = WASM_VECTOR_LEN
2057
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true)
2058
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true)
2059
+ },
2060
+ __wbg___wbindgen_is_function_2a95406423ea8626: function (arg0) {
2061
+ const ret = typeof arg0 === 'function'
2062
+ return ret
2063
+ },
2064
+ __wbg___wbindgen_is_null_8d90524c9e0af183: function (arg0) {
2065
+ const ret = arg0 === null
2066
+ return ret
2067
+ },
2068
+ __wbg___wbindgen_is_object_59a002e76b059312: function (arg0) {
2069
+ const val = arg0
2070
+ const ret = typeof val === 'object' && val !== null
2071
+ return ret
2072
+ },
2073
+ __wbg___wbindgen_is_undefined_87a3a837f331fef5: function (arg0) {
2074
+ const ret = arg0 === undefined
2075
+ return ret
2076
+ },
2077
+ __wbg___wbindgen_string_get_f1161390414f9b59: function (arg0, arg1) {
2078
+ const obj = arg1
2079
+ const ret = typeof obj === 'string' ? obj : undefined
2080
+ var ptr1 = isLikeNone(ret)
2081
+ ? 0
2082
+ : passStringToWasm0(
2083
+ ret,
2084
+ wasm.__wbindgen_malloc,
2085
+ wasm.__wbindgen_realloc
2086
+ )
2087
+ var len1 = WASM_VECTOR_LEN
2088
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true)
2089
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true)
2090
+ },
2091
+ __wbg___wbindgen_throw_5549492daedad139: function (arg0, arg1) {
2092
+ throw new Error(getStringFromWasm0(arg0, arg1))
2093
+ },
2094
+ __wbg__wbg_cb_unref_fbe69bb076c16bad: function (arg0) {
2095
+ arg0._wbg_cb_unref()
2096
+ },
2097
+ __wbg_buffer_0a57788cdfce21ba: function (arg0) {
2098
+ const ret = arg0.buffer
2099
+ return ret
2100
+ },
2101
+ __wbg_byobRequest_ab0e57f55bf774f2: function (arg0) {
2102
+ const ret = arg0.byobRequest
2103
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret)
2104
+ },
2105
+ __wbg_byteLength_9931db00e5861bf9: function (arg0) {
2106
+ const ret = arg0.byteLength
2107
+ return ret
2108
+ },
2109
+ __wbg_byteOffset_0a985a98f8ffb8d7: function (arg0) {
2110
+ const ret = arg0.byteOffset
2111
+ return ret
2112
+ },
2113
+ __wbg_call_8f5d7bb070283508: function () {
2114
+ return handleError(function (arg0, arg1, arg2) {
2115
+ const ret = arg0.call(arg1, arg2)
2116
+ return ret
2117
+ }, arguments)
2118
+ },
2119
+ __wbg_close_62f6a4eadc94565f: function () {
2120
+ return handleError(function (arg0) {
2121
+ arg0.close()
2122
+ }, arguments)
2123
+ },
2124
+ __wbg_close_871e516a273d15f8: function (arg0) {
2125
+ const ret = arg0.close()
2126
+ return ret
2127
+ },
2128
+ __wbg_close_f287058716088a50: function () {
2129
+ return handleError(function (arg0) {
2130
+ arg0.close()
2131
+ }, arguments)
2132
+ },
2133
+ __wbg_done_19f92cb1f8738aba: function (arg0) {
2134
+ const ret = arg0.done
2135
+ return ret
2136
+ },
2137
+ __wbg_enqueue_ee0593cea9be93bd: function () {
2138
+ return handleError(function (arg0, arg1) {
2139
+ arg0.enqueue(arg1)
2140
+ }, arguments)
2141
+ },
2142
+ __wbg_error_a6fa202b58aa1cd3: function (arg0, arg1) {
2143
+ let deferred0_0
2144
+ let deferred0_1
2145
+ try {
2146
+ deferred0_0 = arg0
2147
+ deferred0_1 = arg1
2148
+ console.error(getStringFromWasm0(arg0, arg1))
2149
+ } finally {
2150
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1)
2151
+ }
2152
+ },
2153
+ __wbg_error_de6b86e598505246: function (arg0) {
2154
+ console.error(arg0)
2155
+ },
2156
+ __wbg_exists_74e2d3956575b7c1: function () {
2157
+ return handleError(function (arg0, arg1, arg2) {
2158
+ let deferred0_0
2159
+ let deferred0_1
2160
+ try {
2161
+ deferred0_0 = arg1
2162
+ deferred0_1 = arg2
2163
+ const ret = arg0.exists(getStringFromWasm0(arg1, arg2))
2164
+ return ret
2165
+ } finally {
2166
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1)
2167
+ }
2168
+ }, arguments)
2169
+ },
2170
+ __wbg_fireModelingCommandFromWasm_390a1bce3a562234: function () {
2171
+ return handleError(function (
2172
+ arg0,
2173
+ arg1,
2174
+ arg2,
2175
+ arg3,
2176
+ arg4,
2177
+ arg5,
2178
+ arg6,
2179
+ arg7,
2180
+ arg8
2181
+ ) {
2182
+ let deferred0_0
2183
+ let deferred0_1
2184
+ let deferred1_0
2185
+ let deferred1_1
2186
+ let deferred2_0
2187
+ let deferred2_1
2188
+ let deferred3_0
2189
+ let deferred3_1
2190
+ try {
2191
+ deferred0_0 = arg1
2192
+ deferred0_1 = arg2
2193
+ deferred1_0 = arg3
2194
+ deferred1_1 = arg4
2195
+ deferred2_0 = arg5
2196
+ deferred2_1 = arg6
2197
+ deferred3_0 = arg7
2198
+ deferred3_1 = arg8
2199
+ arg0.fireModelingCommandFromWasm(
2200
+ getStringFromWasm0(arg1, arg2),
2201
+ getStringFromWasm0(arg3, arg4),
2202
+ getStringFromWasm0(arg5, arg6),
2203
+ getStringFromWasm0(arg7, arg8)
2204
+ )
2205
+ } finally {
2206
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1)
2207
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1)
2208
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1)
2209
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1)
2210
+ }
2211
+ }, arguments)
2212
+ },
2213
+ __wbg_getAllFiles_1cc50beb0cf7fb57: function () {
2214
+ return handleError(function (arg0, arg1, arg2) {
2215
+ let deferred0_0
2216
+ let deferred0_1
2217
+ try {
2218
+ deferred0_0 = arg1
2219
+ deferred0_1 = arg2
2220
+ const ret = arg0.getAllFiles(getStringFromWasm0(arg1, arg2))
2221
+ return ret
2222
+ } finally {
2223
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1)
2224
+ }
2225
+ }, arguments)
2226
+ },
2227
+ __wbg_getClientState_6c1a2978c4ee6709: function () {
2228
+ return handleError(function (arg0) {
2229
+ const ret = arg0.getClientState()
2230
+ return ret
2231
+ }, arguments)
2232
+ },
2233
+ __wbg_getOsInfo_4527b1804efa34eb: function () {
2234
+ return handleError(function (arg0, arg1) {
2235
+ const ret = arg1.getOsInfo()
2236
+ const ptr1 = passStringToWasm0(
2237
+ ret,
2238
+ wasm.__wbindgen_malloc,
2239
+ wasm.__wbindgen_realloc
2240
+ )
2241
+ const len1 = WASM_VECTOR_LEN
2242
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true)
2243
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true)
2244
+ }, arguments)
2245
+ },
2246
+ __wbg_getRandomValues_3f44b700395062e5: function () {
2247
+ return handleError(function (arg0, arg1) {
2248
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1))
2249
+ }, arguments)
2250
+ },
2251
+ __wbg_getRandomValues_d49329ff89a07af1: function () {
2252
+ return handleError(function (arg0, arg1) {
2253
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1))
2254
+ }, arguments)
2255
+ },
2256
+ __wbg_getTime_c3af35594e283356: function (arg0) {
2257
+ const ret = arg0.getTime()
2258
+ return ret
2259
+ },
2260
+ __wbg_getWebrtcStats_e4574f7ddbb47600: function () {
2261
+ return handleError(function (arg0) {
2262
+ const ret = arg0.getWebrtcStats()
2263
+ return ret
2264
+ }, arguments)
2265
+ },
2266
+ __wbg_getWriter_7c953149af273c29: function () {
2267
+ return handleError(function (arg0) {
2268
+ const ret = arg0.getWriter()
2269
+ return ret
2270
+ }, arguments)
2271
+ },
2272
+ __wbg_get_ff5f1fb220233477: function () {
2273
+ return handleError(function (arg0, arg1) {
2274
+ const ret = Reflect.get(arg0, arg1)
2275
+ return ret
2276
+ }, arguments)
2277
+ },
2278
+ __wbg_instanceof_Uint8Array_ce24d58a5f4bdcc3: function (arg0) {
2279
+ let result
2280
+ try {
2281
+ result = arg0 instanceof Uint8Array
2282
+ } catch (_) {
2283
+ result = false
2284
+ }
2285
+ const ret = result
2286
+ return ret
2287
+ },
2288
+ __wbg_instanceof_Window_2fa8d9c2d5b6104a: function (arg0) {
2289
+ let result
2290
+ try {
2291
+ result = arg0 instanceof Window
2292
+ } catch (_) {
2293
+ result = false
2294
+ }
2295
+ const ret = result
2296
+ return ret
2297
+ },
2298
+ __wbg_instanceof_WorkerGlobalScope_a4307c85f73d83c3: function (arg0) {
2299
+ let result
2300
+ try {
2301
+ result = arg0 instanceof WorkerGlobalScope
2302
+ } catch (_) {
2303
+ result = false
2304
+ }
2305
+ const ret = result
2306
+ return ret
2307
+ },
2308
+ __wbg_isDesktop_2c68340769a78561: function () {
2309
+ return handleError(function (arg0) {
2310
+ const ret = arg0.isDesktop()
2311
+ return ret
2312
+ }, arguments)
2313
+ },
2314
+ __wbg_kclCode_03c713fd21a04d99: function () {
2315
+ return handleError(function (arg0, arg1) {
2316
+ const ret = arg1.kclCode()
2317
+ const ptr1 = passStringToWasm0(
2318
+ ret,
2319
+ wasm.__wbindgen_malloc,
2320
+ wasm.__wbindgen_realloc
2321
+ )
2322
+ const len1 = WASM_VECTOR_LEN
2323
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true)
2324
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true)
2325
+ }, arguments)
2326
+ },
2327
+ __wbg_length_e6e1633fbea6cfa9: function (arg0) {
2328
+ const ret = arg0.length
2329
+ return ret
2330
+ },
2331
+ __wbg_log_6a75b71d6316e935: function (arg0) {
2332
+ console.log(arg0)
2333
+ },
2334
+ __wbg_new_0_e649c99e7382313f: function () {
2335
+ const ret = new Date()
2336
+ return ret
2337
+ },
2338
+ __wbg_new_1d96678aaacca32e: function (arg0) {
2339
+ const ret = new Uint8Array(arg0)
2340
+ return ret
2341
+ },
2342
+ __wbg_new_227d7c05414eb861: function () {
2343
+ const ret = new Error()
2344
+ return ret
2345
+ },
2346
+ __wbg_new_4a843fe2ee4082a9: function (arg0, arg1) {
2347
+ const ret = new Error(getStringFromWasm0(arg0, arg1))
2348
+ return ret
2349
+ },
2350
+ __wbg_new_from_slice_0bc58e36f82a1b50: function (arg0, arg1) {
2351
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1))
2352
+ return ret
2353
+ },
2354
+ __wbg_new_typed_25dda2388d7e5e9f: function (arg0, arg1) {
2355
+ try {
2356
+ var state0 = { a: arg0, b: arg1 }
2357
+ var cb0 = (arg0, arg1) => {
2358
+ const a = state0.a
2359
+ state0.a = 0
2360
+ try {
2361
+ return wasm_bindgen__convert__closures_____invoke__h9bcd17f09dc83691(
2362
+ a,
2363
+ state0.b,
2364
+ arg0,
2365
+ arg1
2366
+ )
2367
+ } finally {
2368
+ state0.a = a
2369
+ }
2370
+ }
2371
+ const ret = new Promise(cb0)
2372
+ return ret
2373
+ } finally {
2374
+ state0.a = 0
2375
+ }
2376
+ },
2377
+ __wbg_new_with_byte_offset_and_length_ab1e1002d7a694e4: function (
2378
+ arg0,
2379
+ arg1,
2380
+ arg2
2381
+ ) {
2382
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0)
2383
+ return ret
2384
+ },
2385
+ __wbg_next_1b7b5c007966560f: function () {
2386
+ return handleError(function (arg0) {
2387
+ const ret = arg0.next()
2388
+ return ret
2389
+ }, arguments)
2390
+ },
2391
+ __wbg_now_a9af4554edb7ac78: function (arg0) {
2392
+ const ret = arg0.now()
2393
+ return ret
2394
+ },
2395
+ __wbg_now_e7c6795a7f81e10f: function (arg0) {
2396
+ const ret = arg0.now()
2397
+ return ret
2398
+ },
2399
+ __wbg_parse_e5703fd52211e688: function () {
2400
+ return handleError(function (arg0, arg1) {
2401
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1))
2402
+ return ret
2403
+ }, arguments)
2404
+ },
2405
+ __wbg_performance_3fcf6e32a7e1ed0a: function (arg0) {
2406
+ const ret = arg0.performance
2407
+ return ret
2408
+ },
2409
+ __wbg_prototypesetcall_3875d54d12ef2eec: function (arg0, arg1, arg2) {
2410
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2)
2411
+ },
2412
+ __wbg_queueMicrotask_8868365114fe23b5: function (arg0) {
2413
+ queueMicrotask(arg0)
2414
+ },
2415
+ __wbg_queueMicrotask_cfc5a0e62f9ebdbe: function (arg0) {
2416
+ const ret = arg0.queueMicrotask
2417
+ return ret
2418
+ },
2419
+ __wbg_readFile_3504f4ce1188bd6e: function () {
2420
+ return handleError(function (arg0, arg1, arg2) {
2421
+ let deferred0_0
2422
+ let deferred0_1
2423
+ try {
2424
+ deferred0_0 = arg1
2425
+ deferred0_1 = arg2
2426
+ const ret = arg0.readFile(getStringFromWasm0(arg1, arg2))
2427
+ return ret
2428
+ } finally {
2429
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1)
2430
+ }
2431
+ }, arguments)
2432
+ },
2433
+ __wbg_ready_5856db6f00e3e20a: function (arg0) {
2434
+ const ret = arg0.ready
2435
+ return ret
2436
+ },
2437
+ __wbg_releaseLock_95bbc7cf7b87977d: function (arg0) {
2438
+ arg0.releaseLock()
2439
+ },
2440
+ __wbg_resolve_d8059bc113e215bf: function (arg0) {
2441
+ const ret = Promise.resolve(arg0)
2442
+ return ret
2443
+ },
2444
+ __wbg_respond_1ec29395edbe7fce: function () {
2445
+ return handleError(function (arg0, arg1) {
2446
+ arg0.respond(arg1 >>> 0)
2447
+ }, arguments)
2448
+ },
2449
+ __wbg_sendModelingCommandFromWasm_9bae9dbcedacaae3: function () {
2450
+ return handleError(function (
2451
+ arg0,
2452
+ arg1,
2453
+ arg2,
2454
+ arg3,
2455
+ arg4,
2456
+ arg5,
2457
+ arg6,
2458
+ arg7,
2459
+ arg8
2460
+ ) {
2461
+ let deferred0_0
2462
+ let deferred0_1
2463
+ let deferred1_0
2464
+ let deferred1_1
2465
+ let deferred2_0
2466
+ let deferred2_1
2467
+ let deferred3_0
2468
+ let deferred3_1
2469
+ try {
2470
+ deferred0_0 = arg1
2471
+ deferred0_1 = arg2
2472
+ deferred1_0 = arg3
2473
+ deferred1_1 = arg4
2474
+ deferred2_0 = arg5
2475
+ deferred2_1 = arg6
2476
+ deferred3_0 = arg7
2477
+ deferred3_1 = arg8
2478
+ const ret = arg0.sendModelingCommandFromWasm(
2479
+ getStringFromWasm0(arg1, arg2),
2480
+ getStringFromWasm0(arg3, arg4),
2481
+ getStringFromWasm0(arg5, arg6),
2482
+ getStringFromWasm0(arg7, arg8)
2483
+ )
2484
+ return ret
2485
+ } finally {
2486
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1)
2487
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1)
2488
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1)
2489
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1)
2490
+ }
2491
+ }, arguments)
2492
+ },
2493
+ __wbg_setTimeout_466d50f3512245cb: function () {
2494
+ return handleError(function (arg0, arg1, arg2) {
2495
+ const ret = arg0.setTimeout(arg1, arg2)
2496
+ return ret
2497
+ }, arguments)
2498
+ },
2499
+ __wbg_setTimeout_c1c9a18b6343ebd3: function () {
2500
+ return handleError(function (arg0, arg1, arg2) {
2501
+ const ret = arg0.setTimeout(arg1, arg2)
2502
+ return ret
2503
+ }, arguments)
2504
+ },
2505
+ __wbg_set_295bad3b5ead4e99: function (arg0, arg1, arg2) {
2506
+ arg0.set(getArrayU8FromWasm0(arg1, arg2))
2507
+ },
2508
+ __wbg_stack_3b0d974bbf31e44f: function (arg0, arg1) {
2509
+ const ret = arg1.stack
2510
+ const ptr1 = passStringToWasm0(
2511
+ ret,
2512
+ wasm.__wbindgen_malloc,
2513
+ wasm.__wbindgen_realloc
2514
+ )
2515
+ const len1 = WASM_VECTOR_LEN
2516
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true)
2517
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true)
2518
+ },
2519
+ __wbg_startNewSession_b9d1f26acbcf759d: function () {
2520
+ return handleError(function (arg0) {
2521
+ const ret = arg0.startNewSession()
2522
+ return ret
2523
+ }, arguments)
2524
+ },
2525
+ __wbg_static_accessor_GLOBAL_8dfb7f5e26ebe523: function () {
2526
+ const ret = typeof global === 'undefined' ? null : global
2527
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret)
2528
+ },
2529
+ __wbg_static_accessor_GLOBAL_THIS_941154efc8395cdd: function () {
2530
+ const ret = typeof globalThis === 'undefined' ? null : globalThis
2531
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret)
2532
+ },
2533
+ __wbg_static_accessor_SELF_58dac9af822f561f: function () {
2534
+ const ret = typeof self === 'undefined' ? null : self
2535
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret)
2536
+ },
2537
+ __wbg_static_accessor_WINDOW_ee64f0b3d8354c0b: function () {
2538
+ const ret = typeof window === 'undefined' ? null : window
2539
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret)
2540
+ },
2541
+ __wbg_stringify_b67e2c8c60b93f69: function () {
2542
+ return handleError(function (arg0) {
2543
+ const ret = JSON.stringify(arg0)
2544
+ return ret
2545
+ }, arguments)
2546
+ },
2547
+ __wbg_then_0150352e4ad20344: function (arg0, arg1, arg2) {
2548
+ const ret = arg0.then(arg1, arg2)
2549
+ return ret
2550
+ },
2551
+ __wbg_then_5160486c67ddb98a: function (arg0, arg1) {
2552
+ const ret = arg0.then(arg1)
2553
+ return ret
2554
+ },
2555
+ __wbg_toString_553b5f6e95e3e41b: function (arg0) {
2556
+ const ret = arg0.toString()
2557
+ return ret
2558
+ },
2559
+ __wbg_toString_9e7353a77cb415a2: function (arg0) {
2560
+ const ret = arg0.toString()
2561
+ return ret
2562
+ },
2563
+ __wbg_value_d5b248ce8419bd1b: function (arg0) {
2564
+ const ret = arg0.value
2565
+ return ret
2566
+ },
2567
+ __wbg_version_154c988290643167: function () {
2568
+ return handleError(function (arg0, arg1) {
2569
+ const ret = arg1.version()
2570
+ const ptr1 = passStringToWasm0(
2571
+ ret,
2572
+ wasm.__wbindgen_malloc,
2573
+ wasm.__wbindgen_realloc
2574
+ )
2575
+ const len1 = WASM_VECTOR_LEN
2576
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true)
2577
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true)
2578
+ }, arguments)
2579
+ },
2580
+ __wbg_view_38a930844c964103: function (arg0) {
2581
+ const ret = arg0.view
2582
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret)
2583
+ },
2584
+ __wbg_warn_86ef03db8cfb4dd4: function (arg0) {
2585
+ console.warn(arg0)
2586
+ },
2587
+ __wbg_write_ff3a3de4902aa8bf: function (arg0, arg1) {
2588
+ const ret = arg0.write(arg1)
2589
+ return ret
2590
+ },
2591
+ __wbindgen_cast_0000000000000001: function (arg0, arg1) {
2592
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 7754, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2593
+ const ret = makeMutClosure(
2594
+ arg0,
2595
+ arg1,
2596
+ wasm_bindgen__convert__closures_____invoke__hd41fce227beb919d
2597
+ )
2598
+ return ret
2599
+ },
2600
+ __wbindgen_cast_0000000000000002: function (arg0, arg1) {
2601
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("IteratorResult<any>")], shim_idx: 2280, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2602
+ const ret = makeMutClosure(
2603
+ arg0,
2604
+ arg1,
2605
+ wasm_bindgen__convert__closures_____invoke__hd1cad1d65a58033c
2606
+ )
2607
+ return ret
2608
+ },
2609
+ __wbindgen_cast_0000000000000003: function (arg0, arg1) {
2610
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 6603, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2611
+ const ret = makeMutClosure(
2612
+ arg0,
2613
+ arg1,
2614
+ wasm_bindgen__convert__closures_____invoke__hc85db0809cd3d705
2615
+ )
2616
+ return ret
2617
+ },
2618
+ __wbindgen_cast_0000000000000004: function (arg0, arg1) {
2619
+ // Cast intrinsic for `Ref(String) -> Externref`.
2620
+ const ret = getStringFromWasm0(arg0, arg1)
2621
+ return ret
2622
+ },
2623
+ __wbindgen_init_externref_table: function () {
2624
+ const table = wasm.__wbindgen_externrefs
2625
+ const offset = table.grow(4)
2626
+ table.set(0, undefined)
2627
+ table.set(offset + 0, undefined)
2628
+ table.set(offset + 1, null)
2629
+ table.set(offset + 2, true)
2630
+ table.set(offset + 3, false)
2631
+ },
2632
+ }
2633
+ return {
2634
+ __proto__: null,
2635
+ './kcl_wasm_lib_bg.js': import0,
2636
+ }
2637
+ }
2638
+
2639
+ function wasm_bindgen__convert__closures_____invoke__hc85db0809cd3d705(
2640
+ arg0,
2641
+ arg1
2642
+ ) {
2643
+ wasm.wasm_bindgen__convert__closures_____invoke__hc85db0809cd3d705(arg0, arg1)
2644
+ }
2645
+
2646
+ function wasm_bindgen__convert__closures_____invoke__hd41fce227beb919d(
2647
+ arg0,
2648
+ arg1,
2649
+ arg2
2650
+ ) {
2651
+ const ret =
2652
+ wasm.wasm_bindgen__convert__closures_____invoke__hd41fce227beb919d(
2653
+ arg0,
2654
+ arg1,
2655
+ arg2
2656
+ )
2657
+ if (ret[1]) {
2658
+ throw takeFromExternrefTable0(ret[0])
2659
+ }
2660
+ }
2661
+
2662
+ function wasm_bindgen__convert__closures_____invoke__hd1cad1d65a58033c(
2663
+ arg0,
2664
+ arg1,
2665
+ arg2
2666
+ ) {
2667
+ const ret =
2668
+ wasm.wasm_bindgen__convert__closures_____invoke__hd1cad1d65a58033c(
2669
+ arg0,
2670
+ arg1,
2671
+ arg2
2672
+ )
2673
+ if (ret[1]) {
2674
+ throw takeFromExternrefTable0(ret[0])
2675
+ }
2676
+ }
2677
+
2678
+ function wasm_bindgen__convert__closures_____invoke__h9bcd17f09dc83691(
2679
+ arg0,
2680
+ arg1,
2681
+ arg2,
2682
+ arg3
2683
+ ) {
2684
+ wasm.wasm_bindgen__convert__closures_____invoke__h9bcd17f09dc83691(
2685
+ arg0,
2686
+ arg1,
2687
+ arg2,
2688
+ arg3
2689
+ )
2690
+ }
2691
+
2692
+ const __wbindgen_enum_ReadableStreamType = ['bytes']
2693
+ const ContextFinalization =
2694
+ typeof FinalizationRegistry === 'undefined'
2695
+ ? { register: () => {}, unregister: () => {} }
2696
+ : new FinalizationRegistry((ptr) => wasm.__wbg_context_free(ptr >>> 0, 1))
2697
+ const IntoUnderlyingByteSourceFinalization =
2698
+ typeof FinalizationRegistry === 'undefined'
2699
+ ? { register: () => {}, unregister: () => {} }
2700
+ : new FinalizationRegistry((ptr) =>
2701
+ wasm.__wbg_intounderlyingbytesource_free(ptr >>> 0, 1)
2702
+ )
2703
+ const IntoUnderlyingSinkFinalization =
2704
+ typeof FinalizationRegistry === 'undefined'
2705
+ ? { register: () => {}, unregister: () => {} }
2706
+ : new FinalizationRegistry((ptr) =>
2707
+ wasm.__wbg_intounderlyingsink_free(ptr >>> 0, 1)
2708
+ )
2709
+ const IntoUnderlyingSourceFinalization =
2710
+ typeof FinalizationRegistry === 'undefined'
2711
+ ? { register: () => {}, unregister: () => {} }
2712
+ : new FinalizationRegistry((ptr) =>
2713
+ wasm.__wbg_intounderlyingsource_free(ptr >>> 0, 1)
2714
+ )
2715
+ const LspServerConfigFinalization =
2716
+ typeof FinalizationRegistry === 'undefined'
2717
+ ? { register: () => {}, unregister: () => {} }
2718
+ : new FinalizationRegistry((ptr) =>
2719
+ wasm.__wbg_lspserverconfig_free(ptr >>> 0, 1)
2720
+ )
2721
+ const ResponseContextFinalization =
2722
+ typeof FinalizationRegistry === 'undefined'
2723
+ ? { register: () => {}, unregister: () => {} }
2724
+ : new FinalizationRegistry((ptr) =>
2725
+ wasm.__wbg_responsecontext_free(ptr >>> 0, 1)
2726
+ )
2727
+ const TangentialArcInfoOutputWasmFinalization =
2728
+ typeof FinalizationRegistry === 'undefined'
2729
+ ? { register: () => {}, unregister: () => {} }
2730
+ : new FinalizationRegistry((ptr) =>
2731
+ wasm.__wbg_tangentialarcinfooutputwasm_free(ptr >>> 0, 1)
2732
+ )
2733
+ const WasmCircleParamsFinalization =
2734
+ typeof FinalizationRegistry === 'undefined'
2735
+ ? { register: () => {}, unregister: () => {} }
2736
+ : new FinalizationRegistry((ptr) =>
2737
+ wasm.__wbg_wasmcircleparams_free(ptr >>> 0, 1)
2738
+ )
2739
+
2740
+ function addToExternrefTable0(obj) {
2741
+ const idx = wasm.__externref_table_alloc()
2742
+ wasm.__wbindgen_externrefs.set(idx, obj)
2743
+ return idx
2744
+ }
2745
+
2746
+ function _assertClass(instance, klass) {
2747
+ if (!(instance instanceof klass)) {
2748
+ throw new Error(`expected instance of ${klass.name}`)
2749
+ }
2750
+ }
2751
+
2752
+ const CLOSURE_DTORS =
2753
+ typeof FinalizationRegistry === 'undefined'
2754
+ ? { register: () => {}, unregister: () => {} }
2755
+ : new FinalizationRegistry((state) =>
2756
+ wasm.__wbindgen_destroy_closure(state.a, state.b)
2757
+ )
2758
+
2759
+ function debugString(val) {
2760
+ // primitive types
2761
+ const type = typeof val
2762
+ if (type == 'number' || type == 'boolean' || val == null) {
2763
+ return `${val}`
2764
+ }
2765
+ if (type == 'string') {
2766
+ return `"${val}"`
2767
+ }
2768
+ if (type == 'symbol') {
2769
+ const description = val.description
2770
+ if (description == null) {
2771
+ return 'Symbol'
2772
+ } else {
2773
+ return `Symbol(${description})`
2774
+ }
2775
+ }
2776
+ if (type == 'function') {
2777
+ const name = val.name
2778
+ if (typeof name == 'string' && name.length > 0) {
2779
+ return `Function(${name})`
2780
+ } else {
2781
+ return 'Function'
2782
+ }
2783
+ }
2784
+ // objects
2785
+ if (Array.isArray(val)) {
2786
+ const length = val.length
2787
+ let debug = '['
2788
+ if (length > 0) {
2789
+ debug += debugString(val[0])
2790
+ }
2791
+ for (let i = 1; i < length; i++) {
2792
+ debug += ', ' + debugString(val[i])
2793
+ }
2794
+ debug += ']'
2795
+ return debug
2796
+ }
2797
+ // Test for built-in
2798
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val))
2799
+ let className
2800
+ if (builtInMatches && builtInMatches.length > 1) {
2801
+ className = builtInMatches[1]
2802
+ } else {
2803
+ // Failed to match the standard '[object ClassName]'
2804
+ return toString.call(val)
2805
+ }
2806
+ if (className == 'Object') {
2807
+ // we're a user defined class or Object
2808
+ // JSON.stringify avoids problems with cycles, and is generally much
2809
+ // easier than looping through ownProperties of `val`.
2810
+ try {
2811
+ return 'Object(' + JSON.stringify(val) + ')'
2812
+ } catch (_) {
2813
+ return 'Object'
2814
+ }
2815
+ }
2816
+ // errors
2817
+ if (val instanceof Error) {
2818
+ return `${val.name}: ${val.message}\n${val.stack}`
2819
+ }
2820
+ // TODO we could test for more things here, like `Set`s and `Map`s.
2821
+ return className
2822
+ }
2823
+
2824
+ function getArrayF64FromWasm0(ptr, len) {
2825
+ ptr = ptr >>> 0
2826
+ return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len)
2827
+ }
2828
+
2829
+ function getArrayJsValueFromWasm0(ptr, len) {
2830
+ ptr = ptr >>> 0
2831
+ const mem = getDataViewMemory0()
2832
+ const result = []
2833
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
2834
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)))
2835
+ }
2836
+ wasm.__externref_drop_slice(ptr, len)
2837
+ return result
2838
+ }
2839
+
2840
+ function getArrayU8FromWasm0(ptr, len) {
2841
+ ptr = ptr >>> 0
2842
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len)
2843
+ }
2844
+
2845
+ let cachedDataViewMemory0 = null
2846
+ function getDataViewMemory0() {
2847
+ if (
2848
+ cachedDataViewMemory0 === null ||
2849
+ cachedDataViewMemory0.buffer.detached === true ||
2850
+ (cachedDataViewMemory0.buffer.detached === undefined &&
2851
+ cachedDataViewMemory0.buffer !== wasm.memory.buffer)
2852
+ ) {
2853
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer)
2854
+ }
2855
+ return cachedDataViewMemory0
2856
+ }
2857
+
2858
+ let cachedFloat64ArrayMemory0 = null
2859
+ function getFloat64ArrayMemory0() {
2860
+ if (
2861
+ cachedFloat64ArrayMemory0 === null ||
2862
+ cachedFloat64ArrayMemory0.byteLength === 0
2863
+ ) {
2864
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer)
2865
+ }
2866
+ return cachedFloat64ArrayMemory0
2867
+ }
2868
+
2869
+ function getStringFromWasm0(ptr, len) {
2870
+ ptr = ptr >>> 0
2871
+ return decodeText(ptr, len)
2872
+ }
2873
+
2874
+ let cachedUint8ArrayMemory0 = null
2875
+ function getUint8ArrayMemory0() {
2876
+ if (
2877
+ cachedUint8ArrayMemory0 === null ||
2878
+ cachedUint8ArrayMemory0.byteLength === 0
2879
+ ) {
2880
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer)
2881
+ }
2882
+ return cachedUint8ArrayMemory0
2883
+ }
2884
+
2885
+ function handleError(f, args) {
2886
+ try {
2887
+ return f.apply(this, args)
2888
+ } catch (e) {
2889
+ const idx = addToExternrefTable0(e)
2890
+ wasm.__wbindgen_exn_store(idx)
2891
+ }
2892
+ }
2893
+
2894
+ function isLikeNone(x) {
2895
+ return x === undefined || x === null
2896
+ }
2897
+
2898
+ function makeMutClosure(arg0, arg1, f) {
2899
+ const state = { a: arg0, b: arg1, cnt: 1 }
2900
+ const real = (...args) => {
2901
+ // First up with a closure we increment the internal reference
2902
+ // count. This ensures that the Rust closure environment won't
2903
+ // be deallocated while we're invoking it.
2904
+ state.cnt++
2905
+ const a = state.a
2906
+ state.a = 0
2907
+ try {
2908
+ return f(a, state.b, ...args)
2909
+ } finally {
2910
+ state.a = a
2911
+ real._wbg_cb_unref()
2912
+ }
2913
+ }
2914
+ real._wbg_cb_unref = () => {
2915
+ if (--state.cnt === 0) {
2916
+ wasm.__wbindgen_destroy_closure(state.a, state.b)
2917
+ state.a = 0
2918
+ CLOSURE_DTORS.unregister(state)
2919
+ }
2920
+ }
2921
+ CLOSURE_DTORS.register(real, state, state)
2922
+ return real
2923
+ }
2924
+
2925
+ function passArrayF64ToWasm0(arg, malloc) {
2926
+ const ptr = malloc(arg.length * 8, 8) >>> 0
2927
+ getFloat64ArrayMemory0().set(arg, ptr / 8)
2928
+ WASM_VECTOR_LEN = arg.length
2929
+ return ptr
2930
+ }
2931
+
2932
+ function passStringToWasm0(arg, malloc, realloc) {
2933
+ if (realloc === undefined) {
2934
+ const buf = cachedTextEncoder.encode(arg)
2935
+ const ptr = malloc(buf.length, 1) >>> 0
2936
+ getUint8ArrayMemory0()
2937
+ .subarray(ptr, ptr + buf.length)
2938
+ .set(buf)
2939
+ WASM_VECTOR_LEN = buf.length
2940
+ return ptr
2941
+ }
2942
+
2943
+ let len = arg.length
2944
+ let ptr = malloc(len, 1) >>> 0
2945
+
2946
+ const mem = getUint8ArrayMemory0()
2947
+
2948
+ let offset = 0
2949
+
2950
+ for (; offset < len; offset++) {
2951
+ const code = arg.charCodeAt(offset)
2952
+ if (code > 0x7f) break
2953
+ mem[ptr + offset] = code
2954
+ }
2955
+ if (offset !== len) {
2956
+ if (offset !== 0) {
2957
+ arg = arg.slice(offset)
2958
+ }
2959
+ ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0
2960
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len)
2961
+ const ret = cachedTextEncoder.encodeInto(arg, view)
2962
+
2963
+ offset += ret.written
2964
+ ptr = realloc(ptr, len, offset, 1) >>> 0
2965
+ }
2966
+
2967
+ WASM_VECTOR_LEN = offset
2968
+ return ptr
2969
+ }
2970
+
2971
+ function takeFromExternrefTable0(idx) {
2972
+ const value = wasm.__wbindgen_externrefs.get(idx)
2973
+ wasm.__externref_table_dealloc(idx)
2974
+ return value
2975
+ }
2976
+
2977
+ let cachedTextDecoder = new TextDecoder('utf-8', {
2978
+ ignoreBOM: true,
2979
+ fatal: true,
2980
+ })
2981
+ cachedTextDecoder.decode()
2982
+ const MAX_SAFARI_DECODE_BYTES = 2146435072
2983
+ let numBytesDecoded = 0
2984
+ function decodeText(ptr, len) {
2985
+ numBytesDecoded += len
2986
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
2987
+ cachedTextDecoder = new TextDecoder('utf-8', {
2988
+ ignoreBOM: true,
2989
+ fatal: true,
2990
+ })
2991
+ cachedTextDecoder.decode()
2992
+ numBytesDecoded = len
2993
+ }
2994
+ return cachedTextDecoder.decode(
2995
+ getUint8ArrayMemory0().subarray(ptr, ptr + len)
2996
+ )
2997
+ }
2998
+
2999
+ const cachedTextEncoder = new TextEncoder()
3000
+
3001
+ if (!('encodeInto' in cachedTextEncoder)) {
3002
+ cachedTextEncoder.encodeInto = function (arg, view) {
3003
+ const buf = cachedTextEncoder.encode(arg)
3004
+ view.set(buf)
3005
+ return {
3006
+ read: arg.length,
3007
+ written: buf.length,
3008
+ }
3009
+ }
3010
+ }
3011
+
3012
+ let WASM_VECTOR_LEN = 0
3013
+
3014
+ let wasmModule, wasm
3015
+ function __wbg_finalize_init(instance, module) {
3016
+ wasm = instance.exports
3017
+ wasmModule = module
3018
+ cachedDataViewMemory0 = null
3019
+ cachedFloat64ArrayMemory0 = null
3020
+ cachedUint8ArrayMemory0 = null
3021
+ wasm.__wbindgen_start()
3022
+ return wasm
3023
+ }
3024
+
3025
+ async function __wbg_load(module, imports) {
3026
+ if (typeof Response === 'function' && module instanceof Response) {
3027
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
3028
+ try {
3029
+ return await WebAssembly.instantiateStreaming(module, imports)
3030
+ } catch (e) {
3031
+ const validResponse = module.ok && expectedResponseType(module.type)
3032
+
3033
+ if (
3034
+ validResponse &&
3035
+ module.headers.get('Content-Type') !== 'application/wasm'
3036
+ ) {
3037
+ console.warn(
3038
+ '`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',
3039
+ e
3040
+ )
3041
+ } else {
3042
+ throw e
3043
+ }
3044
+ }
3045
+ }
3046
+
3047
+ const bytes = await module.arrayBuffer()
3048
+ return await WebAssembly.instantiate(bytes, imports)
3049
+ } else {
3050
+ const instance = await WebAssembly.instantiate(module, imports)
3051
+
3052
+ if (instance instanceof WebAssembly.Instance) {
3053
+ return { instance, module }
3054
+ } else {
3055
+ return instance
3056
+ }
3057
+ }
3058
+
3059
+ function expectedResponseType(type) {
3060
+ switch (type) {
3061
+ case 'basic':
3062
+ case 'cors':
3063
+ case 'default':
3064
+ return true
3065
+ }
3066
+ return false
3067
+ }
3068
+ }
3069
+
3070
+ function initSync(module) {
3071
+ if (wasm !== undefined) return wasm
3072
+
3073
+ if (module !== undefined) {
3074
+ if (Object.getPrototypeOf(module) === Object.prototype) {
3075
+ ;({ module } = module)
3076
+ } else {
3077
+ console.warn(
3078
+ 'using deprecated parameters for `initSync()`; pass a single object instead'
3079
+ )
3080
+ }
3081
+ }
3082
+
3083
+ const imports = __wbg_get_imports()
3084
+ if (!(module instanceof WebAssembly.Module)) {
3085
+ module = new WebAssembly.Module(module)
3086
+ }
3087
+ const instance = new WebAssembly.Instance(module, imports)
3088
+ return __wbg_finalize_init(instance, module)
3089
+ }
3090
+
3091
+ async function __wbg_init(module_or_path) {
3092
+ if (wasm !== undefined) return wasm
3093
+
3094
+ if (module_or_path !== undefined) {
3095
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
3096
+ ;({ module_or_path } = module_or_path)
3097
+ } else {
3098
+ console.warn(
3099
+ 'using deprecated parameters for the initialization function; pass a single object instead'
3100
+ )
3101
+ }
3102
+ }
3103
+
3104
+ if (module_or_path === undefined) {
3105
+ module_or_path = new URL('kcl_wasm_lib_bg.wasm', import.meta.url)
3106
+ }
3107
+ const imports = __wbg_get_imports()
3108
+
3109
+ if (
3110
+ typeof module_or_path === 'string' ||
3111
+ (typeof Request === 'function' && module_or_path instanceof Request) ||
3112
+ (typeof URL === 'function' && module_or_path instanceof URL)
3113
+ ) {
3114
+ module_or_path = fetch(module_or_path)
3115
+ }
3116
+
3117
+ const { instance, module } = await __wbg_load(await module_or_path, imports)
3118
+
3119
+ return __wbg_finalize_init(instance, module)
3120
+ }
3121
+
3122
+ export { initSync, __wbg_init as default }