@loaders.gl/geospatial 5.0.0-beta.2 → 5.0.0-beta.4

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 (46) hide show
  1. package/dist/dbf-loader-types.cjs +1 -1
  2. package/dist/dbf-worker.js +393 -57
  3. package/dist/flatgeobuf/flatgeobuf-loader-types.cjs +1 -1
  4. package/dist/flatgeobuf/flatgeobuf-loader-types.js +1 -1
  5. package/dist/flatgeobuf/flatgeobuf-source-loader.cjs +1 -1
  6. package/dist/flatgeobuf/flatgeobuf-source-loader.js +1 -1
  7. package/dist/flatgeobuf-loader-types.cjs +1 -1
  8. package/dist/flatgeobuf-source-loader.cjs +1 -1
  9. package/dist/flatgeobuf-worker.js +393 -57
  10. package/dist/geopackage/geopackage-source-loader.cjs +1 -1
  11. package/dist/geopackage/geopackage-source-loader.js +1 -1
  12. package/dist/geopackage-source-loader.cjs +1 -1
  13. package/dist/gpx-loader-types.cjs +1 -1
  14. package/dist/kml/gpx-loader-types.cjs +1 -1
  15. package/dist/kml/gpx-loader-types.js +1 -1
  16. package/dist/kml/kml-loader-types.cjs +1 -1
  17. package/dist/kml/kml-loader-types.js +1 -1
  18. package/dist/kml/kml-writer.cjs +1 -1
  19. package/dist/kml/kml-writer.js +1 -1
  20. package/dist/kml/kmz-loader-types.cjs +1 -1
  21. package/dist/kml/kmz-loader-types.js +1 -1
  22. package/dist/kml/kmz-source.cjs +1 -1
  23. package/dist/kml/kmz-source.js +1 -1
  24. package/dist/kml/tcx-loader-types.cjs +1 -1
  25. package/dist/kml/tcx-loader-types.js +1 -1
  26. package/dist/kml-loader-types.cjs +1 -1
  27. package/dist/kml-writer.cjs +1 -1
  28. package/dist/kmz-loader-types.cjs +1 -1
  29. package/dist/kmz-source.cjs +1 -1
  30. package/dist/shapefile/dbf-loader-types.cjs +1 -1
  31. package/dist/shapefile/dbf-loader-types.js +1 -1
  32. package/dist/shapefile/dbf-loader.d.ts +1 -1
  33. package/dist/shapefile/shapefile-loader-types.cjs +1 -1
  34. package/dist/shapefile/shapefile-loader-types.js +1 -1
  35. package/dist/shapefile/shp-loader-types.cjs +1 -1
  36. package/dist/shapefile/shp-loader-types.js +1 -1
  37. package/dist/shapefile/shp-loader.d.ts +1 -1
  38. package/dist/shapefile-loader-types.cjs +1 -1
  39. package/dist/shapefile-worker.js +395 -59
  40. package/dist/shp-loader-types.cjs +1 -1
  41. package/dist/shp-worker.js +393 -57
  42. package/dist/tcx-loader-types.cjs +1 -1
  43. package/dist/wkt/lib/version.cjs +1 -1
  44. package/dist/wkt/lib/version.js +1 -1
  45. package/dist/wkt-worker.js +339 -32
  46. package/package.json +5 -5
@@ -35,7 +35,7 @@
35
35
  var parentPort;
36
36
  var init_worker_threads_browser = __esm({
37
37
  "../../node_modules/@math.gl/core/dist/worker-utils/lib/node/worker_threads-browser.js"() {
38
- parentPort = null;
38
+ parentPort = globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort ?? null;
39
39
  }
40
40
  });
41
41
 
@@ -52,6 +52,9 @@
52
52
  else if (ArrayBuffer.isView(value2)) {
53
53
  if (isTransferable(value2.buffer))
54
54
  transfersSet.add(value2.buffer);
55
+ } else if (recursive && typeof MessageChannel !== "undefined" && value2 instanceof MessageChannel) {
56
+ visit(value2.port1);
57
+ visit(value2.port2);
55
58
  } else if (recursive && value2 instanceof Map) {
56
59
  for (const [key2, item] of value2) {
57
60
  visit(key2);
@@ -119,16 +122,16 @@
119
122
  */
120
123
  static set onmessage(onMessage) {
121
124
  async function handleMessage(message) {
122
- const parentPort2 = await getParentPort();
123
- const { type, payload } = parentPort2 ? message : message.data;
125
+ const parentPort3 = await getParentPort();
126
+ const { type, payload } = parentPort3 ? message : message.data;
124
127
  onMessage(type, payload);
125
128
  }
126
- getParentPort().then((parentPort2) => {
127
- if (parentPort2) {
128
- parentPort2.on("message", (message) => {
129
+ getParentPort().then((parentPort3) => {
130
+ if (parentPort3) {
131
+ parentPort3.on("message", (message) => {
129
132
  handleMessage(message);
130
133
  });
131
- parentPort2.on("exit", () => console.debug("Node worker closing"));
134
+ parentPort3.on("exit", () => console.debug("Node worker closing"));
132
135
  } else {
133
136
  globalThis.onmessage = handleMessage;
134
137
  }
@@ -146,9 +149,9 @@
146
149
  };
147
150
  onMessageWrapperMap.set(onMessage, onMessageWrapper);
148
151
  }
149
- const parentPort2 = await getParentPort();
150
- if (parentPort2) {
151
- parentPort2.on("message", onMessageWrapper);
152
+ const parentPort3 = await getParentPort();
153
+ if (parentPort3) {
154
+ parentPort3.on("message", onMessageWrapper);
152
155
  } else {
153
156
  globalThis.addEventListener("message", onMessageWrapper);
154
157
  }
@@ -159,9 +162,9 @@
159
162
  if (!onMessageWrapper) {
160
163
  return;
161
164
  }
162
- const parentPort2 = await getParentPort();
163
- if (parentPort2) {
164
- parentPort2.off("message", onMessageWrapper);
165
+ const parentPort3 = await getParentPort();
166
+ if (parentPort3) {
167
+ parentPort3.off("message", onMessageWrapper);
165
168
  } else {
166
169
  globalThis.removeEventListener("message", onMessageWrapper);
167
170
  }
@@ -171,12 +174,12 @@
171
174
  * @param type
172
175
  * @param payload
173
176
  */
174
- static async postMessage(type, payload) {
177
+ static async postMessage(type, payload, copy = false) {
175
178
  const data = { source: "loaders.gl", type, payload };
176
- const transferList = getTransferList(payload);
177
- const parentPort2 = await getParentPort();
178
- if (parentPort2) {
179
- parentPort2.postMessage(data, transferList);
179
+ const transferList = copy ? [] : getTransferList(payload);
180
+ const parentPort3 = await getParentPort();
181
+ if (parentPort3) {
182
+ parentPort3.postMessage(data, transferList);
180
183
  } else {
181
184
  globalThis.postMessage(data, transferList);
182
185
  }
@@ -301,8 +304,19 @@
301
304
  }
302
305
  });
303
306
 
307
+ // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/validate-output-ownership.js
308
+ function validateOutputOwnership(ownership) {
309
+ if (ownership !== void 0 && ownership !== "copy" && ownership !== "transfer") {
310
+ throw new Error("Invalid worker output ownership");
311
+ }
312
+ }
313
+ var init_validate_output_ownership = __esm({
314
+ "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/validate-output-ownership.js"() {
315
+ }
316
+ });
317
+
304
318
  // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/create-worker.js
305
- async function createWorker(process, processInBatches) {
319
+ async function createWorker(process2, processInBatches, preload) {
306
320
  if (!await WorkerBody.inWorkerThread()) {
307
321
  return;
308
322
  }
@@ -343,23 +357,26 @@
343
357
  }
344
358
  switch (type) {
345
359
  case "preload":
360
+ await preload?.();
346
361
  WorkerBody.postMessage("done", {});
347
362
  break;
348
363
  case "process":
349
364
  throwIfAborted();
350
- if (!process) {
365
+ validateOutputOwnership(payload.options?.["outputOwnership"]);
366
+ if (!process2) {
351
367
  throw new Error("Worker does not support atomic processing");
352
368
  }
353
- const result = await process(payload.input, payload.options || {}, jobContext, payload.context || {});
369
+ const result = await process2(payload.input, payload.options || {}, jobContext, payload.context || {});
354
370
  throwIfAborted();
355
371
  reporter?.finish();
356
372
  await WorkerBody.postMessage("done", {
357
373
  result,
358
374
  executionMs: performance.now() - startedAt
359
- });
375
+ }, payload.options?.["outputOwnership"] === "copy");
360
376
  break;
361
377
  case "process-in-batches":
362
378
  throwIfAborted();
379
+ validateOutputOwnership(payload.options?.["outputOwnership"]);
363
380
  if (!processInBatches) {
364
381
  throw new Error("Worker does not support batched processing");
365
382
  }
@@ -371,7 +388,7 @@
371
388
  const resultIterator = processInBatches(createDemandDrivenIterator(inputBatches), payload.options || {}, jobContext, payload.context || {});
372
389
  for await (const batch of resultIterator) {
373
390
  throwIfAborted();
374
- await WorkerBody.postMessage("output-batch", { result: batch });
391
+ await WorkerBody.postMessage("output-batch", { result: batch }, payload.options?.["outputOwnership"] === "copy");
375
392
  await outputAcknowledgements.next();
376
393
  }
377
394
  throwIfAborted();
@@ -469,14 +486,14 @@
469
486
  });
470
487
  }
471
488
  function createProgressReporter() {
472
- let pending;
489
+ let pending2;
473
490
  let finished = false;
474
491
  let scheduled = false;
475
492
  const flush = () => {
476
493
  scheduled = false;
477
- if (pending) {
478
- WorkerBody.postMessage("progress", { progress: pending });
479
- pending = void 0;
494
+ if (pending2) {
495
+ WorkerBody.postMessage("progress", { progress: pending2 });
496
+ pending2 = void 0;
480
497
  }
481
498
  };
482
499
  return {
@@ -484,9 +501,9 @@
484
501
  report(progress) {
485
502
  if (finished)
486
503
  return;
487
- if (pending && pending.phase !== progress.phase)
504
+ if (pending2 && pending2.phase !== progress.phase)
488
505
  flush();
489
- pending = { ...progress };
506
+ pending2 = { ...progress };
490
507
  if (!scheduled) {
491
508
  scheduled = true;
492
509
  setTimeout(flush, 0);
@@ -495,7 +512,7 @@
495
512
  /** Flushes final progress and suppresses reports from stale callbacks. */
496
513
  finish(discard = false) {
497
514
  if (discard)
498
- pending = void 0;
515
+ pending2 = void 0;
499
516
  flush();
500
517
  finished = true;
501
518
  }
@@ -507,6 +524,7 @@
507
524
  init_shared_state();
508
525
  init_async_queue();
509
526
  init_worker_body();
527
+ init_validate_output_ownership();
510
528
  requestId = 0;
511
529
  activeController = null;
512
530
  activeInputBatches = null;
@@ -518,6 +536,7 @@
518
536
  var import_meta, path, moduleUrl;
519
537
  var init_worker_utils = __esm({
520
538
  "../../node_modules/@math.gl/core/dist/worker-utils/index.js"() {
539
+ init_worker_body();
521
540
  init_create_worker();
522
541
  import_meta = {};
523
542
  path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
@@ -525,18 +544,335 @@
525
544
  }
526
545
  });
527
546
 
547
+ // ../../node_modules/@math.gl/core/dist/tasks/task-preload.js
548
+ function preloadTaskCode(task, signal) {
549
+ if (!task.preload)
550
+ return Promise.resolve();
551
+ let promise = pending.get(task);
552
+ if (!promise) {
553
+ promise = Promise.resolve().then(() => task.preload()).then(() => {
554
+ loaded.add(task);
555
+ });
556
+ pending.set(task, promise);
557
+ void promise.catch(() => pending.delete(task));
558
+ }
559
+ return withSignal(promise, signal);
560
+ }
561
+ function withSignal(operation2, signal) {
562
+ if (!signal)
563
+ return operation2;
564
+ return new Promise((resolve, reject) => {
565
+ const abort = () => {
566
+ signal.removeEventListener("abort", abort);
567
+ reject(signal.reason);
568
+ };
569
+ signal.addEventListener("abort", abort, { once: true });
570
+ if (signal.aborted)
571
+ abort();
572
+ operation2.then((value2) => {
573
+ signal.removeEventListener("abort", abort);
574
+ resolve(value2);
575
+ }, (error) => {
576
+ signal.removeEventListener("abort", abort);
577
+ reject(error);
578
+ });
579
+ });
580
+ }
581
+ var pending, loaded;
582
+ var init_task_preload = __esm({
583
+ "../../node_modules/@math.gl/core/dist/tasks/task-preload.js"() {
584
+ pending = /* @__PURE__ */ new WeakMap();
585
+ loaded = /* @__PURE__ */ new WeakSet();
586
+ }
587
+ });
588
+
589
+ // ../../node_modules/@math.gl/core/dist/tasks/task-runtime.js
590
+ function assertPayload(value2) {
591
+ if (!value2 || typeof value2 !== "object" || Object.getPrototypeOf(value2) !== Object.prototype) {
592
+ throw new TypeError("Task payloads must be plain objects with named fields");
593
+ }
594
+ }
595
+ function taskContext(state, context = {}) {
596
+ const signal = context.signal ?? new AbortController().signal;
597
+ return {
598
+ state,
599
+ signal,
600
+ throwIfAborted: () => {
601
+ signal.throwIfAborted();
602
+ context.throwIfAborted?.();
603
+ },
604
+ reportProgress: (progress) => context.reportProgress?.({
605
+ ...progress,
606
+ phase: progress.phase ?? "process",
607
+ unit: progress.unit ?? "items"
608
+ })
609
+ };
610
+ }
611
+ async function initializeTaskWorker(task) {
612
+ if (!await WorkerBody.inWorkerThread())
613
+ throw new Error("initializeTaskWorker must run inside a worker");
614
+ if (installed)
615
+ throw new Error("A task is already installed in this worker");
616
+ installed = true;
617
+ const runtime = new TaskRuntime(task);
618
+ let streamOptions = {};
619
+ return createWorker(async (request, _options, context) => {
620
+ switch (request.operation) {
621
+ case "initialize":
622
+ return runtime.initialize(request.input, context);
623
+ case "destroy":
624
+ return runtime.destroy();
625
+ case "stream-options":
626
+ streamOptions = request.options;
627
+ return {};
628
+ case "process":
629
+ return runtime.process(request.input, request.options, context);
630
+ default:
631
+ throw new Error("Unknown task operation");
632
+ }
633
+ }, async function* (inputs, _options, context) {
634
+ async function* batches() {
635
+ for await (const input of inputs) {
636
+ assertPayload(input);
637
+ yield input;
638
+ }
639
+ }
640
+ try {
641
+ yield* runtime.stream(batches(), streamOptions, context);
642
+ } finally {
643
+ streamOptions = {};
644
+ }
645
+ }, () => preloadTaskCode(task));
646
+ }
647
+ var TaskRuntime, installed;
648
+ var init_task_runtime = __esm({
649
+ "../../node_modules/@math.gl/core/dist/tasks/task-runtime.js"() {
650
+ init_worker_utils();
651
+ init_task_preload();
652
+ TaskRuntime = class {
653
+ constructor(task) {
654
+ this.task = task;
655
+ this.initialized = false;
656
+ }
657
+ async initialize(input, context = {}) {
658
+ if (this.initialized)
659
+ throw new Error("Task is already initialized");
660
+ assertPayload(input);
661
+ await preloadTaskCode(this.task, context.signal);
662
+ context.signal?.throwIfAborted();
663
+ this.state = await this.task.initialize?.(input, taskContext(void 0, context));
664
+ this.initialized = true;
665
+ return {};
666
+ }
667
+ async destroy() {
668
+ if (this.initialized) {
669
+ this.initialized = false;
670
+ const state = this.state;
671
+ this.state = void 0;
672
+ if (this.task.initialize)
673
+ await this.task.destroy?.(state);
674
+ }
675
+ return {};
676
+ }
677
+ async process(input, options, context = {}) {
678
+ if (!this.initialized)
679
+ throw new Error("Task is not initialized");
680
+ if (!this.task.process)
681
+ throw new Error("Task has no atomic processor");
682
+ assertPayload(input);
683
+ const result = await this.task.process(input, options, taskContext(this.state, context));
684
+ assertPayload(result);
685
+ return result;
686
+ }
687
+ async *stream(inputs, options, context = {}) {
688
+ if (!this.initialized)
689
+ throw new Error("Task is not initialized");
690
+ if (!this.task.processInBatches)
691
+ throw new Error("Task has no streaming processor");
692
+ for await (const output of this.task.processInBatches(inputs, options, taskContext(this.state, context))) {
693
+ assertPayload(output);
694
+ yield output;
695
+ }
696
+ }
697
+ };
698
+ installed = false;
699
+ }
700
+ });
701
+
528
702
  // ../../node_modules/@math.gl/core/dist/tasks/index.js
529
703
  var init_tasks = __esm({
530
704
  "../../node_modules/@math.gl/core/dist/tasks/index.js"() {
531
- init_worker_utils();
705
+ init_task_runtime();
706
+ }
707
+ });
708
+
709
+ // ../core/src/worker-utils/lib/node/worker_threads-browser.ts
710
+ var worker_threads_browser_exports = {};
711
+ __export(worker_threads_browser_exports, {
712
+ NodeWorker: () => NodeWorker,
713
+ parentPort: () => parentPort2
714
+ });
715
+ var NodeWorker, parentPort2;
716
+ var init_worker_threads_browser2 = __esm({
717
+ "../core/src/worker-utils/lib/node/worker_threads-browser.ts"() {
718
+ "use strict";
719
+ NodeWorker = class {
720
+ /** Restores the native worker constructor when this browser shim is embedded in a Node bundle. */
721
+ constructor(...arguments_) {
722
+ const runtimeProcess = globalThis.process;
723
+ const WorkerConstructor = runtimeProcess?.getBuiltinModule?.("node:worker_threads").Worker;
724
+ if (WorkerConstructor) {
725
+ return new WorkerConstructor(...arguments_);
726
+ }
727
+ }
728
+ /** No-op browser fallback matching the native Worker API. */
729
+ terminate() {
730
+ }
731
+ };
732
+ parentPort2 = null;
733
+ }
734
+ });
735
+
736
+ // ../core/src/worker-utils/lib/worker-api/task-runtime.ts
737
+ function normalizeTaskProgress(progress) {
738
+ return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
739
+ }
740
+ async function isWorkerThread() {
741
+ if (typeof self !== "undefined" && typeof document === "undefined" && typeof self.postMessage === "function")
742
+ return true;
743
+ if (typeof process !== "undefined" && process.versions?.node) {
744
+ const { isMainThread } = await Promise.resolve().then(() => (init_worker_threads_browser2(), worker_threads_browser_exports));
745
+ return !isMainThread;
746
+ }
747
+ return false;
748
+ }
749
+ var initializeTaskWorker2;
750
+ var init_task_runtime2 = __esm({
751
+ "../core/src/worker-utils/lib/worker-api/task-runtime.ts"() {
752
+ "use strict";
753
+ init_tasks();
754
+ initializeTaskWorker2 = initializeTaskWorker;
755
+ }
756
+ });
757
+
758
+ // ../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts
759
+ function getTransferList2(object2, recursive = true, transfers) {
760
+ const transfersSet = transfers || /* @__PURE__ */ new Set();
761
+ if (!object2) {
762
+ } else if (isTransferable2(object2)) {
763
+ transfersSet.add(object2);
764
+ } else if (isTransferable2(object2.buffer)) {
765
+ transfersSet.add(object2.buffer);
766
+ } else if (ArrayBuffer.isView(object2)) {
767
+ } else if (recursive && typeof object2 === "object") {
768
+ for (const key2 in object2) {
769
+ getTransferList2(object2[key2], recursive, transfersSet);
770
+ }
771
+ }
772
+ return transfers === void 0 ? Array.from(transfersSet) : [];
773
+ }
774
+ function isTransferable2(object2) {
775
+ if (!object2) {
776
+ return false;
777
+ }
778
+ if (object2 instanceof ArrayBuffer) {
779
+ return true;
780
+ }
781
+ if (typeof MessagePort !== "undefined" && object2 instanceof MessagePort) {
782
+ return true;
783
+ }
784
+ if (typeof ImageBitmap !== "undefined" && object2 instanceof ImageBitmap) {
785
+ return true;
786
+ }
787
+ if (typeof OffscreenCanvas !== "undefined" && object2 instanceof OffscreenCanvas) {
788
+ return true;
789
+ }
790
+ return false;
791
+ }
792
+ var init_get_transfer_list2 = __esm({
793
+ "../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts"() {
794
+ "use strict";
532
795
  }
533
796
  });
534
797
 
535
798
  // ../core/src/worker-utils/lib/worker-api/create-worker.ts
799
+ async function createWorker2(process2, processInBatches) {
800
+ if (!await isWorkerThread()) return;
801
+ await initializeTaskWorker2(createWorkerTask(process2, processInBatches));
802
+ }
803
+ function createWorkerTask(process2, processInBatches) {
804
+ return {
805
+ id: "loaders.gl",
806
+ initialize: (state) => state,
807
+ destroy: (state) => state.port?.close(),
808
+ process: async ({ value: value2 }, options, context) => {
809
+ if (!process2) throw new Error("Worker does not support atomic processing");
810
+ return { value: await process2(value2, options, createContext(context), context.state.context) };
811
+ },
812
+ ...processInBatches ? {
813
+ processInBatches: async function* (inputs, options, context) {
814
+ async function* values() {
815
+ for await (const input of inputs) yield input.value;
816
+ }
817
+ for await (const value2 of processInBatches(
818
+ values(),
819
+ options,
820
+ createContext(context),
821
+ context.state.context
822
+ )) {
823
+ yield { value: value2 };
824
+ }
825
+ }
826
+ } : {}
827
+ };
828
+ }
829
+ function createContext(context) {
830
+ let requestIdentifier = 0;
831
+ const port = context.state.port;
832
+ return {
833
+ signal: context.signal,
834
+ throwIfAborted: () => context.throwIfAborted(),
835
+ reportProgress: (progress) => context.reportProgress(normalizeTaskProgress(progress)),
836
+ process: port ? (input, options = {}, jobContext = {}) => {
837
+ context.throwIfAborted();
838
+ const identifier = ++requestIdentifier;
839
+ return new Promise((resolve, reject) => {
840
+ const onMessage = (event) => {
841
+ if (event.data.identifier !== identifier) return;
842
+ cleanup();
843
+ if (event.data.error) {
844
+ const error = new Error(event.data.error.message);
845
+ error.name = event.data.error.name;
846
+ reject(error);
847
+ } else resolve(event.data.value);
848
+ };
849
+ const onAbort = () => {
850
+ cleanup();
851
+ reject(context.signal.reason);
852
+ };
853
+ const cleanup = () => {
854
+ port.removeEventListener("message", onMessage);
855
+ context.signal.removeEventListener("abort", onAbort);
856
+ };
857
+ port.addEventListener("message", onMessage);
858
+ context.signal.addEventListener("abort", onAbort, { once: true });
859
+ port.start();
860
+ try {
861
+ const request = { identifier, input, options, context: jobContext };
862
+ port.postMessage(request, getTransferList2(request));
863
+ } catch (error) {
864
+ cleanup();
865
+ reject(error);
866
+ }
867
+ });
868
+ } : void 0
869
+ };
870
+ }
536
871
  var init_create_worker2 = __esm({
537
872
  "../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
538
873
  "use strict";
539
- init_tasks();
874
+ init_task_runtime2();
875
+ init_get_transfer_list2();
540
876
  }
541
877
  });
542
878
 
@@ -550,7 +886,7 @@
550
886
 
551
887
  // ../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts
552
888
  async function createLoaderWorker(loader, selectLoader = () => loader) {
553
- await createWorker(
889
+ await createWorker2(
554
890
  (input, options, workerContext, loaderContext) => processLoaderWorkerData(
555
891
  selectLoader(options || {}),
556
892
  input,
@@ -22998,11 +23334,11 @@ return true;`);
22998
23334
  this._offsets = new OffsetsBufferBuilder(opts.type);
22999
23335
  }
23000
23336
  setValue(index, value2) {
23001
- const pending = this._pending || (this._pending = /* @__PURE__ */ new Map());
23002
- const current = pending.get(index);
23337
+ const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
23338
+ const current = pending2.get(index);
23003
23339
  current && (this._pendingLength -= current.length);
23004
23340
  this._pendingLength += value2 instanceof MapRow ? value2[kKeys].length : value2.length;
23005
- pending.set(index, value2);
23341
+ pending2.set(index, value2);
23006
23342
  }
23007
23343
  setValid(index, isValid) {
23008
23344
  if (!super.setValid(index, isValid)) {
@@ -23025,12 +23361,12 @@ return true;`);
23025
23361
  return super.finish();
23026
23362
  }
23027
23363
  _flush() {
23028
- const pending = this._pending;
23364
+ const pending2 = this._pending;
23029
23365
  const pendingLength = this._pendingLength;
23030
23366
  this._pendingLength = 0;
23031
23367
  this._pending = void 0;
23032
- if (pending && pending.size > 0) {
23033
- this._flushPending(pending, pendingLength);
23368
+ if (pending2 && pending2.size > 0) {
23369
+ this._flushPending(pending2, pendingLength);
23034
23370
  }
23035
23371
  return this;
23036
23372
  }
@@ -25616,11 +25952,11 @@ return true;`);
25616
25952
  setValue(index, value2) {
25617
25953
  return super.setValue(index, toUint8Array(value2));
25618
25954
  }
25619
- _flushPending(pending, pendingLength) {
25955
+ _flushPending(pending2, pendingLength) {
25620
25956
  const offsets = this._offsets;
25621
25957
  const data = this._values.reserve(pendingLength).buffer;
25622
25958
  let offset = 0;
25623
- for (const [index, value2] of pending) {
25959
+ for (const [index, value2] of pending2) {
25624
25960
  if (value2 === void 0) {
25625
25961
  offsets.set(index, 0);
25626
25962
  } else {
@@ -25657,11 +25993,11 @@ return true;`);
25657
25993
  setValue(index, value2) {
25658
25994
  return super.setValue(index, toUint8Array(value2));
25659
25995
  }
25660
- _flushPending(pending, pendingLength) {
25996
+ _flushPending(pending2, pendingLength) {
25661
25997
  const offsets = this._offsets;
25662
25998
  const data = this._values.reserve(pendingLength).buffer;
25663
25999
  let offset = 0;
25664
- for (const [index, value2] of pending) {
26000
+ for (const [index, value2] of pending2) {
25665
26001
  if (value2 === void 0) {
25666
26002
  offsets.set(index, BigInt(0));
25667
26003
  } else {
@@ -25972,10 +26308,10 @@ return true;`);
25972
26308
  this.type = new List2(new Field2(name, child2.type, true));
25973
26309
  return this.numChildren - 1;
25974
26310
  }
25975
- _flushPending(pending) {
26311
+ _flushPending(pending2) {
25976
26312
  const offsets = this._offsets;
25977
26313
  const [child2] = this.children;
25978
- for (const [index, value2] of pending) {
26314
+ for (const [index, value2] of pending2) {
25979
26315
  if (typeof value2 === "undefined") {
25980
26316
  offsets.set(index, 0);
25981
26317
  } else {
@@ -26014,10 +26350,10 @@ return true;`);
26014
26350
  this.type = new LargeList2(new Field2(name, child2.type, true));
26015
26351
  return this.numChildren - 1;
26016
26352
  }
26017
- _flushPending(pending) {
26353
+ _flushPending(pending2) {
26018
26354
  const offsets = this._offsets;
26019
26355
  const [child2] = this.children;
26020
- for (const [index, value2] of pending) {
26356
+ for (const [index, value2] of pending2) {
26021
26357
  if (typeof value2 === "undefined") {
26022
26358
  offsets.set(index, BigInt(0));
26023
26359
  } else {
@@ -26047,11 +26383,11 @@ return true;`);
26047
26383
  }
26048
26384
  setValue(index, value2) {
26049
26385
  const row = value2 instanceof Map ? value2 : new Map(Object.entries(value2));
26050
- const pending = this._pending || (this._pending = /* @__PURE__ */ new Map());
26051
- const current = pending.get(index);
26386
+ const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
26387
+ const current = pending2.get(index);
26052
26388
  current && (this._pendingLength -= current.size);
26053
26389
  this._pendingLength += row.size;
26054
- pending.set(index, row);
26390
+ pending2.set(index, row);
26055
26391
  }
26056
26392
  addChild(child2, name = `${this.numChildren}`) {
26057
26393
  if (this.numChildren > 0) {
@@ -26061,10 +26397,10 @@ return true;`);
26061
26397
  this.type = new Map_(new Field2(name, child2.type, true), this.type.keysSorted);
26062
26398
  return this.numChildren - 1;
26063
26399
  }
26064
- _flushPending(pending) {
26400
+ _flushPending(pending2) {
26065
26401
  const offsets = this._offsets;
26066
26402
  const [child2] = this.children;
26067
- for (const [index, value2] of pending) {
26403
+ for (const [index, value2] of pending2) {
26068
26404
  if (value2 === void 0) {
26069
26405
  offsets.set(index, 0);
26070
26406
  } else {
@@ -26273,7 +26609,7 @@ return true;`);
26273
26609
  return super.setValue(index, encodeUtf8(value2));
26274
26610
  }
26275
26611
  // @ts-ignore
26276
- _flushPending(pending, pendingLength) {
26612
+ _flushPending(pending2, pendingLength) {
26277
26613
  }
26278
26614
  };
26279
26615
  Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;
@@ -26304,7 +26640,7 @@ return true;`);
26304
26640
  return super.setValue(index, encodeUtf8(value2));
26305
26641
  }
26306
26642
  // @ts-ignore
26307
- _flushPending(pending, pendingLength) {
26643
+ _flushPending(pending2, pendingLength) {
26308
26644
  }
26309
26645
  };
26310
26646
  LargeUtf8Builder.prototype._flushPending = LargeBinaryBuilder.prototype._flushPending;
@@ -28016,8 +28352,8 @@ return true;`);
28016
28352
  });
28017
28353
 
28018
28354
  // ../../node_modules/apache-arrow/ipc/reader.mjs
28019
- function shouldAutoDestroy(self, options) {
28020
- return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] : self["autoDestroy"];
28355
+ function shouldAutoDestroy(self2, options) {
28356
+ return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] : self2["autoDestroy"];
28021
28357
  }
28022
28358
  function* readAllSync(source) {
28023
28359
  const reader = RecordBatchReader.from(source);
@@ -33553,7 +33889,7 @@ return true;`);
33553
33889
  "src/shapefile/shp-loader-types.ts"() {
33554
33890
  "use strict";
33555
33891
  init_shp_format();
33556
- VERSION = true ? "5.0.0-beta.2" : "latest";
33892
+ VERSION = true ? "5.0.0-beta.4" : "latest";
33557
33893
  SHPLoader = {
33558
33894
  dataType: null,
33559
33895
  batchType: null,
@@ -34397,7 +34733,7 @@ return true;`);
34397
34733
  var init_dbf_loader_types = __esm({
34398
34734
  "src/shapefile/dbf-loader-types.ts"() {
34399
34735
  "use strict";
34400
- VERSION2 = true ? "5.0.0-beta.2" : "latest";
34736
+ VERSION2 = true ? "5.0.0-beta.4" : "latest";
34401
34737
  DBFLoader = {
34402
34738
  name: "DBF",
34403
34739
  dataType: null,
@@ -35078,7 +35414,7 @@ return true;`);
35078
35414
  "src/shapefile/shapefile-loader-types.ts"() {
35079
35415
  "use strict";
35080
35416
  init_shp_format();
35081
- VERSION3 = true ? "5.0.0-beta.2" : "latest";
35417
+ VERSION3 = true ? "5.0.0-beta.4" : "latest";
35082
35418
  ShapefileLoader = {
35083
35419
  dataType: null,
35084
35420
  batchType: null,