@loaders.gl/raster 5.0.0-beta.4 → 5.0.0-beta.6

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 (60) hide show
  1. package/README.md +1 -1
  2. package/dist/geotiff/advanced.cjs +4 -4
  3. package/dist/geotiff/geotiff-loader-types.js +1 -1
  4. package/dist/geotiff/geotiff-raster-loader-types.js +1 -1
  5. package/dist/geotiff/geotiff-source-loader.js +1 -1
  6. package/dist/geotiff/loaders.js +1 -1
  7. package/dist/geotiff/ometiff-source-loader.js +1 -1
  8. package/dist/index.cjs +4 -4
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.ts +1 -2
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/lerc/lerc-loader-types.js +1 -1
  14. package/dist/quantized-mesh-worker.js +3684 -3505
  15. package/dist/terrain/heightmap.cjs +2 -333
  16. package/dist/terrain/heightmap.cjs.map +4 -4
  17. package/dist/terrain/heightmap.d.ts +1 -5
  18. package/dist/terrain/heightmap.d.ts.map +1 -1
  19. package/dist/terrain/heightmap.js +0 -3
  20. package/dist/terrain/heightmap.js.map +1 -1
  21. package/dist/terrain/index.cjs +41 -82
  22. package/dist/terrain/index.cjs.map +3 -3
  23. package/dist/terrain/index.d.ts +1 -2
  24. package/dist/terrain/index.d.ts.map +1 -1
  25. package/dist/terrain/index.js.map +1 -1
  26. package/dist/terrain/lib/helpers/skirt.d.ts +2 -9
  27. package/dist/terrain/lib/helpers/skirt.d.ts.map +1 -1
  28. package/dist/terrain/lib/helpers/skirt.js +30 -114
  29. package/dist/terrain/lib/helpers/skirt.js.map +1 -1
  30. package/dist/terrain/lib/terrain-contracts.d.ts +0 -15
  31. package/dist/terrain/lib/terrain-contracts.d.ts.map +1 -1
  32. package/dist/terrain/lib/utils/version.js +1 -1
  33. package/dist/terrain/quantized-mesh-loader.js +1 -1
  34. package/dist/terrain/quantized-mesh-loader.js.map +1 -1
  35. package/dist/terrain/terrain-loader.js +1 -1
  36. package/dist/terrain/terrain-loader.js.map +1 -1
  37. package/dist/terrain-worker.js +788 -457
  38. package/package.json +5 -17
  39. package/src/index.ts +0 -7
  40. package/src/terrain/heightmap.ts +0 -10
  41. package/src/terrain/index.ts +0 -7
  42. package/src/terrain/lib/helpers/skirt.ts +41 -151
  43. package/src/terrain/lib/terrain-contracts.ts +0 -19
  44. package/src/terrain/quantized-mesh-loader.ts +1 -1
  45. package/src/terrain/terrain-loader.ts +1 -1
  46. package/dist/terrain/lib/terrain-height-field.d.ts +0 -51
  47. package/dist/terrain/lib/terrain-height-field.d.ts.map +0 -1
  48. package/dist/terrain/lib/terrain-height-field.js +0 -260
  49. package/dist/terrain/lib/terrain-height-field.js.map +0 -1
  50. package/dist/terrain/lib/terrain-height-grid.d.ts +0 -14
  51. package/dist/terrain/lib/terrain-height-grid.d.ts.map +0 -1
  52. package/dist/terrain/lib/terrain-height-grid.js +0 -104
  53. package/dist/terrain/lib/terrain-height-grid.js.map +0 -1
  54. package/dist/terrain/lib/terrain-neighborhood.d.ts +0 -15
  55. package/dist/terrain/lib/terrain-neighborhood.d.ts.map +0 -1
  56. package/dist/terrain/lib/terrain-neighborhood.js +0 -58
  57. package/dist/terrain/lib/terrain-neighborhood.js.map +0 -1
  58. package/src/terrain/lib/terrain-height-field.ts +0 -355
  59. package/src/terrain/lib/terrain-height-grid.ts +0 -157
  60. package/src/terrain/lib/terrain-neighborhood.ts +0 -69
@@ -59,15 +59,15 @@
59
59
  }
60
60
  });
61
61
 
62
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/node/worker_threads-browser.js
62
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js
63
63
  var parentPort;
64
64
  var init_worker_threads_browser = __esm({
65
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/node/worker_threads-browser.js"() {
65
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js"() {
66
66
  parentPort = globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort ?? null;
67
67
  }
68
68
  });
69
69
 
70
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-utils/get-transfer-list.js
70
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js
71
71
  function getTransferList(object, recursive = true, transfers) {
72
72
  const transfersSet = transfers || /* @__PURE__ */ new Set();
73
73
  const seen = /* @__PURE__ */ new Set();
@@ -118,11 +118,11 @@
118
118
  return false;
119
119
  }
120
120
  var init_get_transfer_list = __esm({
121
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
121
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
122
122
  }
123
123
  });
124
124
 
125
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-farm/worker-body.js
125
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js
126
126
  async function getParentPort() {
127
127
  return parentPort;
128
128
  }
@@ -135,7 +135,7 @@
135
135
  }
136
136
  var onMessageWrapperMap, WorkerBody;
137
137
  var init_worker_body = __esm({
138
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-farm/worker-body.js"() {
138
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js"() {
139
139
  init_get_transfer_list();
140
140
  init_worker_threads_browser();
141
141
  onMessageWrapperMap = /* @__PURE__ */ new Map();
@@ -216,10 +216,10 @@
216
216
  }
217
217
  });
218
218
 
219
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/async-queue/async-queue.js
219
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js
220
220
  var AsyncQueue;
221
221
  var init_async_queue = __esm({
222
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/async-queue/async-queue.js"() {
222
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js"() {
223
223
  AsyncQueue = class {
224
224
  constructor() {
225
225
  this._values = [];
@@ -288,10 +288,10 @@
288
288
  }
289
289
  });
290
290
 
291
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/shared-state.js
291
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js
292
292
  var SharedWorkerState;
293
293
  var init_shared_state = __esm({
294
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/shared-state.js"() {
294
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js"() {
295
295
  SharedWorkerState = class {
296
296
  constructor(buffer) {
297
297
  if (typeof SharedArrayBuffer === "undefined" || !(buffer instanceof SharedArrayBuffer) || buffer.byteLength !== 16)
@@ -332,18 +332,18 @@
332
332
  }
333
333
  });
334
334
 
335
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/validate-output-ownership.js
335
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js
336
336
  function validateOutputOwnership(ownership) {
337
337
  if (ownership !== void 0 && ownership !== "copy" && ownership !== "transfer") {
338
338
  throw new Error("Invalid worker output ownership");
339
339
  }
340
340
  }
341
341
  var init_validate_output_ownership = __esm({
342
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/validate-output-ownership.js"() {
342
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js"() {
343
343
  }
344
344
  });
345
345
 
346
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/create-worker.js
346
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js
347
347
  async function createWorker(process2, processInBatches, preload2) {
348
348
  if (!await WorkerBody.inWorkerThread()) {
349
349
  return;
@@ -548,7 +548,7 @@
548
548
  }
549
549
  var requestId, activeController, activeInputBatches, activeOutputAcknowledgements;
550
550
  var init_create_worker = __esm({
551
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/create-worker.js"() {
551
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js"() {
552
552
  init_shared_state();
553
553
  init_async_queue();
554
554
  init_worker_body();
@@ -560,19 +560,20 @@
560
560
  }
561
561
  });
562
562
 
563
- // ../../node_modules/@math.gl/core/dist/worker-utils/index.js
563
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/index.js
564
564
  var import_meta, path, moduleUrl;
565
565
  var init_worker_utils = __esm({
566
- "../../node_modules/@math.gl/core/dist/worker-utils/index.js"() {
566
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/index.js"() {
567
567
  init_worker_body();
568
568
  init_create_worker();
569
+ init_get_transfer_list();
569
570
  import_meta = {};
570
571
  path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
571
572
  moduleUrl = path ? `file://${path.startsWith("/") ? "" : "/"}${encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta.url;
572
573
  }
573
574
  });
574
575
 
575
- // ../../node_modules/@math.gl/core/dist/tasks/task-preload.js
576
+ // ../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js
576
577
  function preloadTaskCode(task, signal) {
577
578
  if (!task.preload)
578
579
  return Promise.resolve();
@@ -608,23 +609,193 @@
608
609
  }
609
610
  var pending, loaded;
610
611
  var init_task_preload = __esm({
611
- "../../node_modules/@math.gl/core/dist/tasks/task-preload.js"() {
612
+ "../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js"() {
612
613
  pending = /* @__PURE__ */ new WeakMap();
613
614
  loaded = /* @__PURE__ */ new WeakSet();
614
615
  }
615
616
  });
616
617
 
617
- // ../../node_modules/@math.gl/core/dist/tasks/task-runtime.js
618
+ // ../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js
619
+ var TaskRequestError, TaskChannel;
620
+ var init_task_channel = __esm({
621
+ "../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js"() {
622
+ TaskRequestError = class extends Error {
623
+ };
624
+ TaskChannel = class {
625
+ constructor(options) {
626
+ this.options = options;
627
+ this.nextId = 1;
628
+ this.pending = /* @__PURE__ */ new Map();
629
+ this.incoming = /* @__PURE__ */ new Map();
630
+ }
631
+ /** Send a request without serializing other in-flight requests. */
632
+ request(operation, value, signal, transfer = []) {
633
+ if (this.failure)
634
+ return Promise.reject(this.failure.reason);
635
+ if (signal?.aborted)
636
+ return Promise.reject(signal.reason);
637
+ const id = this.nextId++;
638
+ return new Promise((resolve, reject) => {
639
+ const abort = () => {
640
+ const pending2 = this.pending.get(id);
641
+ if (!pending2)
642
+ return;
643
+ this.pending.delete(id);
644
+ pending2.cleanup();
645
+ reject(signal?.reason);
646
+ this.send({ source: "math.gl/tasks", kind: "cancel", id });
647
+ };
648
+ this.pending.set(id, {
649
+ resolve,
650
+ reject,
651
+ cleanup: () => signal?.removeEventListener("abort", abort)
652
+ });
653
+ signal?.addEventListener("abort", abort, { once: true });
654
+ this.send({ source: "math.gl/tasks", kind: "request", id, operation, value }, transfer);
655
+ });
656
+ }
657
+ /** Send a one-way notification. */
658
+ emit(operation, value, transfer = []) {
659
+ if (this.failure)
660
+ throw this.failure.reason;
661
+ this.send({ source: "math.gl/tasks", kind: "event", id: 0, operation, value }, transfer);
662
+ }
663
+ /** Dispatch a transport message; unrelated protocols are ignored. */
664
+ receive(message) {
665
+ if (this.failure || message?.source !== "math.gl/tasks")
666
+ return;
667
+ if (message.kind === "failure") {
668
+ const reason = new Error(message.error?.message ?? "Task channel failed");
669
+ this.close(reason);
670
+ this.options.onFailure?.(reason);
671
+ } else if (message.kind === "result" || message.kind === "error") {
672
+ const pending2 = this.pending.get(message.id);
673
+ if (!pending2)
674
+ return;
675
+ this.pending.delete(message.id);
676
+ pending2.cleanup();
677
+ if (message.kind === "result")
678
+ pending2.resolve(message.value);
679
+ else {
680
+ const error = new TaskRequestError(message.error?.message ?? "Task request failed");
681
+ error.name = message.error?.name ?? "Error";
682
+ pending2.reject(error);
683
+ }
684
+ } else if (message.kind === "cancel") {
685
+ this.incoming.get(message.id)?.abort(new DOMException("Task request cancelled", "AbortError"));
686
+ } else if (message.kind === "event") {
687
+ try {
688
+ this.options.handleEvent?.(message.operation, message.value);
689
+ } catch (error) {
690
+ this.fail(error);
691
+ }
692
+ } else if (message.kind === "request") {
693
+ if (this.incoming.has(message.id)) {
694
+ this.fail(new Error("Duplicate task request identifier"));
695
+ return;
696
+ }
697
+ const controller = new AbortController();
698
+ this.incoming.set(message.id, controller);
699
+ void Promise.resolve().then(() => {
700
+ controller.signal.throwIfAborted();
701
+ return this.options.handleRequest(message.operation, message.value, controller.signal);
702
+ }).then((value) => {
703
+ if (!controller.signal.aborted && !this.failure) {
704
+ this.send({ source: "math.gl/tasks", kind: "result", id: message.id, value }, this.options.getResultTransferList?.(value, message.value));
705
+ }
706
+ }).catch((reason) => {
707
+ if (!controller.signal.aborted && !this.failure) {
708
+ this.send({
709
+ source: "math.gl/tasks",
710
+ kind: "error",
711
+ id: message.id,
712
+ error: {
713
+ name: reason instanceof Error ? reason.name : "Error",
714
+ message: reason instanceof Error ? reason.message : String(reason)
715
+ }
716
+ });
717
+ }
718
+ }).finally(() => this.incoming.delete(message.id));
719
+ }
720
+ }
721
+ /** Reject all outstanding calls with a common cause and abort incoming callbacks. */
722
+ close(reason = new Error("Task channel closed")) {
723
+ if (this.failure)
724
+ return;
725
+ this.failure = { reason };
726
+ for (const pending2 of this.pending.values()) {
727
+ pending2.cleanup();
728
+ pending2.reject(reason);
729
+ }
730
+ this.pending.clear();
731
+ for (const controller of this.incoming.values())
732
+ controller.abort(reason);
733
+ this.incoming.clear();
734
+ }
735
+ send(message, transfer = []) {
736
+ if (this.failure)
737
+ return;
738
+ try {
739
+ this.options.send(message, transfer);
740
+ } catch (error) {
741
+ this.fail(error);
742
+ }
743
+ }
744
+ /** Invalidate the channel and notify the peer when the transport still works. */
745
+ fail(reason) {
746
+ if (this.failure)
747
+ return;
748
+ this.close(reason);
749
+ try {
750
+ this.options.send({
751
+ source: "math.gl/tasks",
752
+ kind: "failure",
753
+ id: 0,
754
+ error: {
755
+ name: reason instanceof Error ? reason.name : "Error",
756
+ message: reason instanceof Error ? reason.message : String(reason)
757
+ }
758
+ }, []);
759
+ } catch {
760
+ }
761
+ this.options.onFailure?.(reason);
762
+ }
763
+ };
764
+ }
765
+ });
766
+
767
+ // ../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js
618
768
  function assertPayload(value) {
619
769
  if (!value || typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype) {
620
770
  throw new TypeError("Task payloads must be plain objects with named fields");
621
771
  }
622
772
  }
773
+ function clonePayload(value, ownership = "copy") {
774
+ assertPayload(value);
775
+ if (!["copy", "transfer", "share"].includes(ownership))
776
+ throw new TypeError("Invalid input ownership");
777
+ const transfer = getTransferList(value);
778
+ if (ownership === "share" && transfer.length)
779
+ throw new TypeError("Share requires shared storage");
780
+ return structuredClone(value, {
781
+ transfer: ownership === "transfer" ? transfer : []
782
+ });
783
+ }
623
784
  function taskContext(state, context = {}) {
624
785
  const signal = context.signal ?? new AbortController().signal;
625
786
  return {
626
787
  state,
627
788
  signal,
789
+ requestHost: async (operation, payload, controls) => {
790
+ signal.throwIfAborted();
791
+ if (!context.requestHost)
792
+ throw new Error("No host request handler configured");
793
+ return context.requestHost(operation, payload, controls);
794
+ },
795
+ emitHost: (operation, payload) => {
796
+ signal.throwIfAborted();
797
+ context.emitHost?.(operation, payload);
798
+ },
628
799
  throwIfAborted: () => {
629
800
  signal.throwIfAborted();
630
801
  context.throwIfAborted?.();
@@ -643,6 +814,69 @@
643
814
  throw new Error("A task is already installed in this worker");
644
815
  installed = true;
645
816
  const runtime = new TaskRuntime(task);
817
+ let channelStream;
818
+ const channel = new TaskChannel({
819
+ getResultTransferList: (value, request) => request.outputOwnership === "transfer" ? getTransferList(value) : [],
820
+ send: (message, transfer) => {
821
+ const snapshot = structuredClone(message, { transfer });
822
+ void WorkerBody.postMessage("task-channel", snapshot).catch((reason) => channel.fail(reason));
823
+ },
824
+ handleRequest: async (operation, value, signal) => {
825
+ const request = value;
826
+ const context = {
827
+ signal,
828
+ reportProgress: (progress) => channel.emit("task:progress", { id: request.progressId, progress }),
829
+ requestHost: (operation2, payload, controls = {}) => {
830
+ const request2 = {
831
+ operation: operation2,
832
+ payload: clonePayload(payload, controls.inputOwnership),
833
+ outputOwnership: controls.outputOwnership ?? "copy"
834
+ };
835
+ return channel.request("task:host-request", request2, signal, getTransferList(request2));
836
+ },
837
+ emitHost: (operation2, payload) => channel.emit("task:host-event", { operation: operation2, payload, id: request.progressId })
838
+ };
839
+ switch (operation) {
840
+ case "initialize":
841
+ return runtime.initialize(request.input, context);
842
+ case "process":
843
+ return runtime.process(request.input, request.options, context);
844
+ case "stream-open": {
845
+ if (channelStream)
846
+ throw new Error("A task stream is already open");
847
+ async function* inputs() {
848
+ while (true) {
849
+ const result = await channel.request("task:next-input", { outputOwnership: "transfer" }, signal);
850
+ if (result.done)
851
+ return;
852
+ yield result.value;
853
+ }
854
+ }
855
+ channelStream = runtime.stream(inputs(), request.options, context)[Symbol.asyncIterator]();
856
+ return {};
857
+ }
858
+ case "stream-next":
859
+ if (!channelStream)
860
+ throw new Error("No active task stream");
861
+ return channelStream.next();
862
+ case "stream-close":
863
+ try {
864
+ await channelStream?.return?.();
865
+ } finally {
866
+ channelStream = void 0;
867
+ }
868
+ return {};
869
+ case "destroy":
870
+ return runtime.destroy();
871
+ default:
872
+ throw new Error("Unknown task channel operation");
873
+ }
874
+ }
875
+ });
876
+ await WorkerBody.addEventListener((type, payload) => {
877
+ if (type === "task-channel")
878
+ channel.receive(payload);
879
+ });
646
880
  let streamOptions = {};
647
881
  return createWorker(async (request, _options, context) => {
648
882
  switch (request.operation) {
@@ -674,9 +908,10 @@
674
908
  }
675
909
  var TaskRuntime, installed;
676
910
  var init_task_runtime = __esm({
677
- "../../node_modules/@math.gl/core/dist/tasks/task-runtime.js"() {
911
+ "../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js"() {
678
912
  init_worker_utils();
679
913
  init_task_preload();
914
+ init_task_channel();
680
915
  TaskRuntime = class {
681
916
  constructor(task) {
682
917
  this.task = task;
@@ -727,13 +962,20 @@
727
962
  }
728
963
  });
729
964
 
730
- // ../../node_modules/@math.gl/core/dist/tasks/index.js
965
+ // ../../node_modules/@math.gl/tasks/dist/tasks/index.js
731
966
  var init_tasks = __esm({
732
- "../../node_modules/@math.gl/core/dist/tasks/index.js"() {
967
+ "../../node_modules/@math.gl/tasks/dist/tasks/index.js"() {
733
968
  init_task_runtime();
734
969
  }
735
970
  });
736
971
 
972
+ // ../../node_modules/@math.gl/tasks/dist/index.js
973
+ var init_dist = __esm({
974
+ "../../node_modules/@math.gl/tasks/dist/index.js"() {
975
+ init_tasks();
976
+ }
977
+ });
978
+
737
979
  // ../core/src/worker-utils/lib/node/worker_threads-browser.ts
738
980
  var worker_threads_browser_exports = {};
739
981
  __export(worker_threads_browser_exports, {
@@ -778,7 +1020,7 @@
778
1020
  var init_task_runtime2 = __esm({
779
1021
  "../core/src/worker-utils/lib/worker-api/task-runtime.ts"() {
780
1022
  "use strict";
781
- init_tasks();
1023
+ init_dist();
782
1024
  initializeTaskWorker2 = initializeTaskWorker;
783
1025
  }
784
1026
  });
@@ -1056,30 +1298,6 @@
1056
1298
  }
1057
1299
  });
1058
1300
 
1059
- // ../core/src/loader-utils/lib/binary-utils/array-buffer-utils.ts
1060
- function concatenateTypedArrays(...typedArrays) {
1061
- const arrays = typedArrays;
1062
- const TypedArrayConstructor = arrays && arrays.length > 1 && arrays[0].constructor || null;
1063
- if (!TypedArrayConstructor) {
1064
- throw new Error(
1065
- '"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types'
1066
- );
1067
- }
1068
- const sumLength = arrays.reduce((acc, value) => acc + value.length, 0);
1069
- const result = new TypedArrayConstructor(sumLength);
1070
- let offset = 0;
1071
- for (const array of arrays) {
1072
- result.set(array, offset);
1073
- offset += array.length;
1074
- }
1075
- return result;
1076
- }
1077
- var init_array_buffer_utils = __esm({
1078
- "../core/src/loader-utils/lib/binary-utils/array-buffer-utils.ts"() {
1079
- "use strict";
1080
- }
1081
- });
1082
-
1083
1301
  // ../../node_modules/@math.gl/core/dist/lib/math-utils.js
1084
1302
  var PI_OVER_TWO, PI_OVER_FOUR, PI_OVER_SIX, TWO_PI;
1085
1303
  var init_math_utils = __esm({
@@ -1195,7 +1413,7 @@
1195
1413
  });
1196
1414
 
1197
1415
  // ../../node_modules/@math.gl/core/dist/index.js
1198
- var init_dist = __esm({
1416
+ var init_dist2 = __esm({
1199
1417
  "../../node_modules/@math.gl/core/dist/index.js"() {
1200
1418
  init_math_utils();
1201
1419
  init_types2();
@@ -1371,6 +1589,12 @@
1371
1589
  if (interpolation !== "nearest" && interpolation !== "bilinear" && interpolation !== "triangle") {
1372
1590
  throw new Error("Unknown terrain interpolation");
1373
1591
  }
1592
+ const domain = options?.domain ?? "samples";
1593
+ const noData = options?.noData ?? "cell";
1594
+ if (domain !== "samples" && domain !== "footprint")
1595
+ throw new Error("Unknown terrain sample domain");
1596
+ if (noData !== "cell" && noData !== "support")
1597
+ throw new Error("Unknown terrain nodata policy");
1374
1598
  if (!Number.isFinite(x) || !Number.isFinite(y))
1375
1599
  return result;
1376
1600
  const dx = x - this.origin[0];
@@ -1385,11 +1609,23 @@
1385
1609
  const errorY = 4 * Number.EPSILON * Math.abs(y) + 4 * Number.EPSILON * Math.abs(this.origin[1]);
1386
1610
  const toleranceU = tolerance + Math.abs(this.inverse[0]) * errorX + Math.abs(this.inverse[1]) * errorY;
1387
1611
  const toleranceV = tolerance + Math.abs(this.inverse[2]) * errorX + Math.abs(this.inverse[3]) * errorY;
1388
- if (u < -toleranceU || v < -toleranceV || u > this.width - 1 + toleranceU || v > this.height - 1 + toleranceV) {
1612
+ const margin = domain === "footprint" && this.registration === "cell" ? 0.5 : 0;
1613
+ if (u < -margin - toleranceU || v < -margin - toleranceV || u > this.width - 1 + margin + toleranceU || v > this.height - 1 + margin + toleranceV) {
1389
1614
  return resetSample(result, TerrainSampleStatus.OUTSIDE_DOMAIN);
1390
1615
  }
1616
+ const edgeToleranceU = Math.min(1e-6, toleranceU);
1617
+ const edgeToleranceV = Math.min(1e-6, toleranceV);
1618
+ const clampedColumn = margin > 0 && (u < -edgeToleranceU || u > this.width - 1 + edgeToleranceU);
1619
+ const clampedRow = margin > 0 && (v < -edgeToleranceV || v > this.height - 1 + edgeToleranceV);
1391
1620
  u = Math.max(0, Math.min(this.width - 1, u));
1392
1621
  v = Math.max(0, Math.min(this.height - 1, v));
1622
+ if (noData === "support" && interpolation === "bilinear") {
1623
+ const column2 = Math.round(u), row2 = Math.round(v);
1624
+ if (Math.abs(u - column2) <= Math.min(1e-6, toleranceU))
1625
+ u = column2;
1626
+ if (Math.abs(v - row2) <= Math.min(1e-6, toleranceV))
1627
+ v = row2;
1628
+ }
1393
1629
  if (interpolation === "nearest") {
1394
1630
  const value = this.getHeight(Math.floor(u + 0.5), Math.floor(v + 0.5));
1395
1631
  if (value === void 0)
@@ -1415,7 +1651,21 @@
1415
1651
  let dv;
1416
1652
  if (interpolation === "bilinear") {
1417
1653
  if (!this.validity[a] || !this.validity[b] || !this.validity[c] || !this.validity[d]) {
1418
- return resetSample(result, TerrainSampleStatus.NO_DATA);
1654
+ if (noData === "cell")
1655
+ return resetSample(result, TerrainSampleStatus.NO_DATA);
1656
+ const weightA = (1 - u) * (1 - v);
1657
+ const weightB = u * (1 - v);
1658
+ const weightC = (1 - u) * v;
1659
+ const weightD = u * v;
1660
+ if (weightA > 0 && !this.validity[a] || weightB > 0 && !this.validity[b] || weightC > 0 && !this.validity[c] || weightD > 0 && !this.validity[d])
1661
+ return resetSample(result, TerrainSampleStatus.NO_DATA);
1662
+ const height = weightA * za + weightB * zb + weightC * zc + weightD * zd;
1663
+ if (!Number.isFinite(height))
1664
+ return resetSample(result, TerrainSampleStatus.NUMERIC_ERROR);
1665
+ result.status = TerrainSampleStatus.VALID;
1666
+ result.height = height;
1667
+ result.gradientStatus = TerrainSampleStatus.NO_DATA;
1668
+ return result;
1419
1669
  }
1420
1670
  result.height = (1 - v) * ((1 - u) * za + u * zb) + v * ((1 - u) * zc + u * zd);
1421
1671
  du = (1 - v) * (zb - za) + v * (zd - zc);
@@ -1440,6 +1690,10 @@
1440
1690
  if (!Number.isFinite(result.height))
1441
1691
  return resetSample(result, TerrainSampleStatus.NUMERIC_ERROR);
1442
1692
  result.status = TerrainSampleStatus.VALID;
1693
+ if (clampedColumn)
1694
+ du = 0;
1695
+ if (clampedRow)
1696
+ dv = 0;
1443
1697
  const gx = du * this.inverse[0] + dv * this.inverse[2];
1444
1698
  const gy = du * this.inverse[1] + dv * this.inverse[3];
1445
1699
  if (!Number.isFinite(gx) || !Number.isFinite(gy)) {
@@ -1493,6 +1747,97 @@
1493
1747
  }
1494
1748
  });
1495
1749
 
1750
+ // ../../node_modules/@math.gl/geospatial/dist/terrain/mesh-skirts.js
1751
+ function createTerrainSkirt(mesh, options) {
1752
+ const { positions, indices } = mesh, { height, edges } = options;
1753
+ const maxVertices = options.maxVertices ?? 2e6, maxTriangles = options.maxTriangles ?? 4e6;
1754
+ if (!Number.isFinite(height) || height <= 0 || !Number.isSafeInteger(maxVertices) || maxVertices < 0 || maxVertices > 4294967295 || !Number.isSafeInteger(maxTriangles) || maxTriangles < 0 || maxTriangles > 4294967295)
1755
+ throw new Error("Invalid terrain skirt height or capacity");
1756
+ if (!(positions instanceof Float32Array || positions instanceof Float64Array) || positions.length < 3 || positions.length % 3 || !positions.every(Number.isFinite) || !(indices instanceof Uint16Array || indices instanceof Uint32Array) || indices.length % 3 || positions.length / 3 > maxVertices || indices.length / 3 > maxTriangles)
1757
+ throw new Error("Invalid terrain skirt mesh or capacity");
1758
+ if (edges !== void 0 && (!(edges instanceof Uint16Array || edges instanceof Uint32Array) || edges.length % 2))
1759
+ throw new Error("Invalid terrain skirt edge pairs");
1760
+ const vertexCount = positions.length / 3, triangleCount = indices.length / 3;
1761
+ const boundary = /* @__PURE__ */ new Map();
1762
+ for (let i = 0; i < indices.length; i += 3) {
1763
+ const ids = [indices[i], indices[i + 1], indices[i + 2]];
1764
+ if (ids.some((id) => id >= vertexCount))
1765
+ throw new Error("Terrain skirt index out of range");
1766
+ const [a, b, c] = ids.map((id) => id * 3);
1767
+ const area = (positions[b] - positions[a]) * (positions[c + 1] - positions[a + 1]) - (positions[b + 1] - positions[a + 1]) * (positions[c] - positions[a]);
1768
+ if (!Number.isFinite(area) || area <= 0)
1769
+ throw new Error("Terrain skirt requires upward nondegenerate XY triangles");
1770
+ for (let j = 0; j < 3; j++) {
1771
+ const u = ids[j], v = ids[(j + 1) % 3], key = edgeKey(u, v), prior = boundary.get(key);
1772
+ if (!prior)
1773
+ boundary.set(key, { a: u, b: v, count: 1 });
1774
+ else {
1775
+ if (prior.count !== 1 || prior.a !== v || prior.b !== u)
1776
+ throw new Error("Terrain skirt mesh has nonmanifold or inconsistent edges");
1777
+ prior.count++;
1778
+ }
1779
+ }
1780
+ }
1781
+ let selected;
1782
+ if (edges) {
1783
+ selected = [];
1784
+ const used = /* @__PURE__ */ new Set();
1785
+ for (let i = 0; i < edges.length; i += 2) {
1786
+ const key = edgeKey(edges[i], edges[i + 1]), edge = boundary.get(key);
1787
+ if (!edge || edge.count !== 1 || used.has(key))
1788
+ throw new Error("Terrain skirt selection must contain unique boundary edges");
1789
+ used.add(key);
1790
+ selected.push(edge);
1791
+ }
1792
+ } else
1793
+ selected = [...boundary.values()].filter((edge) => edge.count === 1);
1794
+ const outputVertices = vertexCount + selected.length * 2, outputTriangles = triangleCount + selected.length * 2;
1795
+ if (!Number.isSafeInteger(outputVertices) || outputVertices > maxVertices || outputVertices > 4294967295 || !Number.isSafeInteger(outputTriangles) || outputTriangles > maxTriangles)
1796
+ throw new Error("Terrain skirt output capacity exceeded");
1797
+ const resultPositions = positions instanceof Float32Array ? new Float32Array(outputVertices * 3) : new Float64Array(outputVertices * 3);
1798
+ resultPositions.set(positions);
1799
+ const resultIndices = indices instanceof Uint16Array && outputVertices <= 65536 ? new Uint16Array(outputTriangles * 3) : new Uint32Array(outputTriangles * 3);
1800
+ resultIndices.set(indices);
1801
+ const sourceVertexIndices = new Uint32Array(selected.length * 2), triangleValidity = new Uint8Array(outputTriangles);
1802
+ triangleValidity.fill(1, 0, triangleCount);
1803
+ for (let i = 0; i < selected.length; i++) {
1804
+ const { a, b } = selected[i], lowerA = vertexCount + 2 * i, lowerB = lowerA + 1;
1805
+ for (const [source, target] of [
1806
+ [a, lowerA],
1807
+ [b, lowerB]
1808
+ ]) {
1809
+ resultPositions.set(positions.subarray(3 * source, 3 * source + 3), 3 * target);
1810
+ resultPositions[3 * target + 2] = positions[3 * source + 2] - height;
1811
+ if (!Number.isFinite(resultPositions[3 * target + 2]) || resultPositions[3 * target + 2] >= positions[3 * source + 2])
1812
+ throw new Error("Terrain skirt height cannot be represented in position precision");
1813
+ sourceVertexIndices[target - vertexCount] = source;
1814
+ }
1815
+ resultIndices.set([a, lowerB, b, lowerB, a, lowerA], indices.length + i * 6);
1816
+ }
1817
+ const min = [Infinity, Infinity, Infinity], max = [-Infinity, -Infinity, -Infinity];
1818
+ for (let i = 0; i < resultPositions.length; i++) {
1819
+ const axis = i % 3;
1820
+ min[axis] = Math.min(min[axis], resultPositions[i]);
1821
+ max[axis] = Math.max(max[axis], resultPositions[i]);
1822
+ }
1823
+ return {
1824
+ positions: resultPositions,
1825
+ indices: resultIndices,
1826
+ sourceVertexIndices,
1827
+ skirtVertexOffset: vertexCount,
1828
+ skirtTriangleOffset: triangleCount,
1829
+ triangleValidity,
1830
+ bounds: [min, max]
1831
+ };
1832
+ }
1833
+ function edgeKey(a, b) {
1834
+ return a < b ? `${a},${b}` : `${b},${a}`;
1835
+ }
1836
+ var init_mesh_skirts = __esm({
1837
+ "../../node_modules/@math.gl/geospatial/dist/terrain/mesh-skirts.js"() {
1838
+ }
1839
+ });
1840
+
1496
1841
  // ../../node_modules/@math.gl/geospatial/dist/terrain/mesh-data.js
1497
1842
  function assembleTerrainMesh(field, gridCoordinates, indices, options) {
1498
1843
  const origin = options.origin ?? [field.origin[0], field.origin[1], 0];
@@ -1598,7 +1943,8 @@
1598
1943
  const x = mesh.gridCoordinates[i * 2] + shift, y = mesh.gridCoordinates[i * 2 + 1] + shift;
1599
1944
  for (let axis = 0; axis < 2; axis++) {
1600
1945
  const expected = field.origin[axis] - mesh.origin[axis] + x * field.columnStep[axis] + y * field.rowStep[axis];
1601
- if (!Number.isFinite(expected) || mesh.positions[i * 3 + axis] !== expected)
1946
+ const tolerance = Math.min(16 * Number.EPSILON * (Math.abs(field.origin[axis] - mesh.origin[axis]) + Math.abs(x * field.columnStep[axis]) + Math.abs(y * field.rowStep[axis])), 1e-9 * Math.max(Math.abs(field.columnStep[axis]), Math.abs(field.rowStep[axis])));
1947
+ if (!Number.isFinite(expected) || Math.abs(mesh.positions[i * 3 + axis] - expected) > tolerance)
1602
1948
  throw new Error("Terrain mesh XY does not match the source grid frame");
1603
1949
  }
1604
1950
  }
@@ -2316,6 +2662,7 @@
2316
2662
  var init_terrain = __esm({
2317
2663
  "../../node_modules/@math.gl/geospatial/dist/terrain/index.js"() {
2318
2664
  init_height_field();
2665
+ init_mesh_skirts();
2319
2666
  init_martini2();
2320
2667
  init_delatin2();
2321
2668
  }
@@ -2329,7 +2676,6 @@
2329
2676
  init_assert();
2330
2677
  init_globals();
2331
2678
  init_create_loader_worker();
2332
- init_array_buffer_utils();
2333
2679
  }
2334
2680
  });
2335
2681
 
@@ -17233,76 +17579,369 @@ return true;`);
17233
17579
  }
17234
17580
  });
17235
17581
 
17236
- // ../core/src/schema-utils/lib/schema/convert-arrow-schema.ts
17237
- function serializeArrowSchema(arrowSchema) {
17238
- return {
17239
- fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
17240
- metadata: serializeArrowMetadata(arrowSchema.metadata)
17241
- };
17582
+ // ../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js
17583
+ function getArrowVariadicBuffers(data) {
17584
+ return data.variadicBuffers ?? [];
17585
+ }
17586
+ function createArrowData(type, offset, length, nullCount, buffers, children, dictionary, variadicBuffers) {
17587
+ return Reflect.construct(Data, [
17588
+ type,
17589
+ offset,
17590
+ length,
17591
+ nullCount,
17592
+ buffers,
17593
+ children,
17594
+ dictionary,
17595
+ variadicBuffers
17596
+ ]);
17597
+ }
17598
+ var init_arrow_data = __esm({
17599
+ "../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js"() {
17600
+ init_Arrow_dom();
17601
+ }
17602
+ });
17603
+
17604
+ // ../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js
17605
+ function splitArrowBuffers(input, options = {}) {
17606
+ const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
17607
+ if (isArrowTable2(input)) {
17608
+ return splitArrowTableBuffersInternal(input, context);
17609
+ }
17610
+ if (isArrowRecordBatch2(input)) {
17611
+ return splitArrowRecordBatchBuffers(input, context);
17612
+ }
17613
+ if (isArrowVector2(input)) {
17614
+ return splitArrowVectorBuffers(input, context);
17615
+ }
17616
+ return splitArrowDataBuffers(input, context);
17617
+ }
17618
+ function isArrowTable2(input) {
17619
+ return "batches" in input;
17620
+ }
17621
+ function isArrowRecordBatch2(input) {
17622
+ return "schema" in input && "data" in input && !Array.isArray(input.data);
17623
+ }
17624
+ function isArrowVector2(input) {
17625
+ return "data" in input && Array.isArray(input.data);
17626
+ }
17627
+ function splitArrowTableBuffersInternal(arrowTable, options) {
17628
+ const recordBatches = arrowTable.batches.map((recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options));
17629
+ return new Table(arrowTable.schema, recordBatches);
17242
17630
  }
17243
- function deserializeArrowSchema(schema, options) {
17244
- return new Schema2(
17245
- schema.fields.map((field) => deserializeArrowField(field, options)),
17246
- deserializeArrowMetadata(schema.metadata)
17631
+ function splitArrowRecordBatchBuffers(recordBatch, options) {
17632
+ return new RecordBatch3(recordBatch.schema, splitArrowDataBuffers(recordBatch.data, options));
17633
+ }
17634
+ function splitArrowDataBuffers(data, options) {
17635
+ const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
17636
+ const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
17637
+ const buffers = {
17638
+ [BufferType.OFFSET]: splitArrowBuffer(data.buffers[BufferType.OFFSET], options),
17639
+ [BufferType.DATA]: splitArrowBuffer(data.buffers[BufferType.DATA], options),
17640
+ [BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
17641
+ [BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
17642
+ };
17643
+ return createArrowData(
17644
+ data.type,
17645
+ data.offset,
17646
+ data.length,
17647
+ // @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
17648
+ data._nullCount,
17649
+ buffers,
17650
+ children,
17651
+ dictionary,
17652
+ getArrowVariadicBuffers(data).map((buffer) => splitArrowBuffer(buffer, options))
17247
17653
  );
17248
17654
  }
17249
- function serializeArrowMetadata(arrowMetadata) {
17250
- return Object.fromEntries(arrowMetadata);
17655
+ function splitArrowVectorBuffers(vector, options) {
17656
+ return new Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
17251
17657
  }
17252
- function deserializeArrowMetadata(metadata) {
17253
- return metadata ? new Map(Object.entries(metadata)) : /* @__PURE__ */ new Map();
17658
+ function splitArrowBuffer(array, options) {
17659
+ if (!isArrowTypedArray(array)) {
17660
+ return array;
17661
+ }
17662
+ if (options.copy === "none") {
17663
+ return array;
17664
+ }
17665
+ if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
17666
+ return array;
17667
+ }
17668
+ let copy = options.copies.get(array);
17669
+ if (!copy) {
17670
+ copy = array instanceof Uint8Array ? new Uint8Array(array) : array.slice();
17671
+ options.copies.set(array, copy);
17672
+ }
17673
+ return copy;
17254
17674
  }
17255
- function serializeArrowField(field) {
17675
+ function isArrowTypedArray(value) {
17676
+ return ArrayBuffer.isView(value) && !(value instanceof DataView);
17677
+ }
17678
+ var init_split_arrow_buffers = __esm({
17679
+ "../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js"() {
17680
+ init_Arrow_dom();
17681
+ init_arrow_data();
17682
+ }
17683
+ });
17684
+
17685
+ // ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js
17686
+ var init_indexed_arrow_vector = __esm({
17687
+ "../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js"() {
17688
+ }
17689
+ });
17690
+
17691
+ // ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js
17692
+ var init_indexed_arrow_table = __esm({
17693
+ "../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js"() {
17694
+ }
17695
+ });
17696
+
17697
+ // ../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js
17698
+ var init_mapped_arrow_table = __esm({
17699
+ "../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js"() {
17700
+ }
17701
+ });
17702
+
17703
+ // ../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js
17704
+ var init_rename_arrow_columns = __esm({
17705
+ "../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js"() {
17706
+ }
17707
+ });
17708
+
17709
+ // ../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js
17710
+ function dehydrateArrowTable(arrowTable, options) {
17711
+ const splitTable = splitArrowBuffers(arrowTable, options);
17256
17712
  return {
17257
- name: field.name,
17258
- type: serializeArrowType(field.type),
17259
- nullable: field.nullable,
17260
- metadata: serializeArrowMetadata(field.metadata)
17713
+ transport: "arrow-js",
17714
+ version: 1,
17715
+ schema: tableToIPC(new Table(splitTable.schema, [])),
17716
+ metadataVersion: splitTable.schema.metadataVersion,
17717
+ batches: splitTable.batches.map((batch) => dehydrateArrowData(batch.data))
17261
17718
  };
17262
17719
  }
17263
- function deserializeArrowField(field, options) {
17264
- return new Field2(
17265
- field.name,
17266
- deserializeArrowType(field.type, options),
17267
- field.nullable,
17268
- deserializeArrowMetadata(field.metadata)
17269
- );
17720
+ function hydrateArrowTable(table) {
17721
+ if (table.transport !== "arrow-js" || table.version !== 1) {
17722
+ throw new Error("Unsupported Arrow column-buffer transport protocol.");
17723
+ }
17724
+ const decodedSchema = tableFromIPC(table.schema).schema;
17725
+ const schema = new Schema2(decodedSchema.fields, decodedSchema.metadata, decodedSchema.dictionaries, table.metadataVersion);
17726
+ const type = new Struct(schema.fields);
17727
+ const batches = table.batches.map((data) => new RecordBatch3(schema, hydrateArrowData(data, type)));
17728
+ return new Table(schema, batches);
17270
17729
  }
17271
- function serializeArrowType(arrowType) {
17272
- if (isArrowViewType(arrowType, "BinaryView")) {
17273
- return "binary-view";
17730
+ function dehydrateArrowData(data) {
17731
+ return {
17732
+ offset: data.offset,
17733
+ length: data.length,
17734
+ nullCount: data.nullCount,
17735
+ buffers: {
17736
+ [BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
17737
+ [BufferType.DATA]: data.buffers[BufferType.DATA],
17738
+ [BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
17739
+ [BufferType.TYPE]: data.buffers[BufferType.TYPE]
17740
+ },
17741
+ children: data.children.map((child) => dehydrateArrowData(child)),
17742
+ variadicBuffers: getArrowVariadicBuffers(data),
17743
+ dictionary: data.dictionary?.data.map((chunk) => dehydrateArrowData(chunk))
17744
+ };
17745
+ }
17746
+ function hydrateArrowData(data, type) {
17747
+ const children = data.children.map((child, index) => hydrateArrowData(child, type.children[index].type));
17748
+ const dictionary = data.dictionary && DataType.isDictionary(type) ? new Vector(data.dictionary.map((chunk) => hydrateArrowData(chunk, type.dictionary))) : void 0;
17749
+ return createArrowData(type, data.offset, data.length, data.nullCount, data.buffers, children, dictionary, data.variadicBuffers);
17750
+ }
17751
+ var init_arrow_table_transport = __esm({
17752
+ "../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js"() {
17753
+ init_Arrow_dom();
17754
+ init_arrow_data();
17755
+ init_split_arrow_buffers();
17274
17756
  }
17275
- if (isArrowViewType(arrowType, "Utf8View")) {
17276
- return "utf8-view";
17757
+ });
17758
+
17759
+ // ../../node_modules/@math.gl/arrow/dist/arrow/index.js
17760
+ var init_arrow = __esm({
17761
+ "../../node_modules/@math.gl/arrow/dist/arrow/index.js"() {
17762
+ init_indexed_arrow_table();
17763
+ init_indexed_arrow_vector();
17764
+ init_mapped_arrow_table();
17765
+ init_rename_arrow_columns();
17766
+ init_split_arrow_buffers();
17767
+ init_arrow_table_transport();
17277
17768
  }
17278
- if (isOptionalArrowType(arrowType, "LargeList")) {
17279
- const largeListType = arrowType;
17280
- return {
17281
- type: "large-list",
17282
- children: [serializeArrowField(largeListType.valueField)]
17283
- };
17769
+ });
17770
+
17771
+ // ../../node_modules/@math.gl/arrow/dist/index.js
17772
+ var init_dist3 = __esm({
17773
+ "../../node_modules/@math.gl/arrow/dist/index.js"() {
17774
+ init_arrow();
17284
17775
  }
17285
- switch (arrowType.constructor) {
17286
- case Null2:
17287
- return "null";
17288
- case Binary2:
17289
- return "binary";
17290
- case FixedSizeBinary2:
17291
- return {
17292
- type: "fixed-size-binary",
17293
- byteWidth: arrowType.byteWidth
17294
- };
17295
- case Bool2:
17296
- return "bool";
17297
- case Int_:
17298
- const intType = arrowType;
17299
- return `${intType.isSigned ? "" : "u"}int${intType.bitWidth}`;
17300
- case Int8:
17301
- return "int8";
17302
- case Int16:
17303
- return "int16";
17304
- case Int32:
17305
- return "int32";
17776
+ });
17777
+
17778
+ // ../core/src/arrow-worker-transport.ts
17779
+ function serializeArrowWorkerResult(result, options) {
17780
+ if (!isArrowTableWrapper(result)) {
17781
+ return result;
17782
+ }
17783
+ const workerOptions = options;
17784
+ const bufferCopyMode = workerOptions?.core?.workerTransferBufferCopy ?? workerOptions?.workerTransferBufferCopy;
17785
+ return {
17786
+ ...result,
17787
+ data: dehydrateArrowTable(result.data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
17788
+ };
17789
+ }
17790
+ function deserializeArrowWorkerResult(result) {
17791
+ if (!isDehydratedArrowTableWrapper(result)) {
17792
+ return result;
17793
+ }
17794
+ return { ...result, data: hydrateArrowTable(result.data) };
17795
+ }
17796
+ function isArrowTableWrapper(value) {
17797
+ const table = value;
17798
+ return Boolean(
17799
+ table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
17800
+ );
17801
+ }
17802
+ function isDehydratedArrowTableWrapper(value) {
17803
+ const table = value;
17804
+ return Boolean(
17805
+ table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
17806
+ );
17807
+ }
17808
+ var init_arrow_worker_transport = __esm({
17809
+ "../core/src/arrow-worker-transport.ts"() {
17810
+ "use strict";
17811
+ init_dist3();
17812
+ }
17813
+ });
17814
+
17815
+ // ../core/src/schema-utils/lib/schema/data-type.ts
17816
+ function getDataTypeFromValue(value, defaultNumberType = "float32") {
17817
+ if (value instanceof Date) {
17818
+ return "date-millisecond";
17819
+ }
17820
+ if (typeof value === "number") {
17821
+ return defaultNumberType;
17822
+ }
17823
+ if (typeof value === "boolean") {
17824
+ return "bool";
17825
+ }
17826
+ if (typeof value === "string") {
17827
+ return "utf8";
17828
+ }
17829
+ if (value === null || value === "undefined") {
17830
+ return "null";
17831
+ }
17832
+ return "null";
17833
+ }
17834
+ function getDataTypeFromArray(array) {
17835
+ let type = getDataTypeFromTypedArray(array);
17836
+ if (type !== "null") {
17837
+ return { type, nullable: false };
17838
+ }
17839
+ if (array.length > 0) {
17840
+ type = getDataTypeFromValue(array[0]);
17841
+ return { type, nullable: true };
17842
+ }
17843
+ return { type: "null", nullable: true };
17844
+ }
17845
+ function getDataTypeFromTypedArray(array) {
17846
+ if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
17847
+ return "float16";
17848
+ }
17849
+ switch (array.constructor) {
17850
+ case Int8Array:
17851
+ return "int8";
17852
+ case Uint8Array:
17853
+ case Uint8ClampedArray:
17854
+ return "uint8";
17855
+ case Int16Array:
17856
+ return "int16";
17857
+ case Uint16Array:
17858
+ return "uint16";
17859
+ case Int32Array:
17860
+ return "int32";
17861
+ case Uint32Array:
17862
+ return "uint32";
17863
+ case BigInt64Array:
17864
+ return "int64";
17865
+ case BigUint64Array:
17866
+ return "uint64";
17867
+ case Float32Array:
17868
+ return "float32";
17869
+ case Float64Array:
17870
+ return "float64";
17871
+ default:
17872
+ return "null";
17873
+ }
17874
+ }
17875
+ var init_data_type = __esm({
17876
+ "../core/src/schema-utils/lib/schema/data-type.ts"() {
17877
+ "use strict";
17878
+ }
17879
+ });
17880
+
17881
+ // ../core/src/schema-utils/lib/schema/convert-arrow-schema.ts
17882
+ function serializeArrowSchema(arrowSchema) {
17883
+ return {
17884
+ fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
17885
+ metadata: serializeArrowMetadata(arrowSchema.metadata)
17886
+ };
17887
+ }
17888
+ function serializeArrowMetadata(arrowMetadata) {
17889
+ return Object.fromEntries(arrowMetadata);
17890
+ }
17891
+ function deserializeArrowMetadata(metadata) {
17892
+ return metadata ? new Map(Object.entries(metadata)) : /* @__PURE__ */ new Map();
17893
+ }
17894
+ function serializeArrowField(field) {
17895
+ return {
17896
+ name: field.name,
17897
+ type: serializeArrowType(field.type),
17898
+ nullable: field.nullable,
17899
+ metadata: serializeArrowMetadata(field.metadata)
17900
+ };
17901
+ }
17902
+ function deserializeArrowField(field, options) {
17903
+ return new Field2(
17904
+ field.name,
17905
+ deserializeArrowType(field.type, options),
17906
+ field.nullable,
17907
+ deserializeArrowMetadata(field.metadata)
17908
+ );
17909
+ }
17910
+ function serializeArrowType(arrowType) {
17911
+ if (isArrowViewType(arrowType, "BinaryView")) {
17912
+ return "binary-view";
17913
+ }
17914
+ if (isArrowViewType(arrowType, "Utf8View")) {
17915
+ return "utf8-view";
17916
+ }
17917
+ if (isOptionalArrowType(arrowType, "LargeList")) {
17918
+ const largeListType = arrowType;
17919
+ return {
17920
+ type: "large-list",
17921
+ children: [serializeArrowField(largeListType.valueField)]
17922
+ };
17923
+ }
17924
+ switch (arrowType.constructor) {
17925
+ case Null2:
17926
+ return "null";
17927
+ case Binary2:
17928
+ return "binary";
17929
+ case FixedSizeBinary2:
17930
+ return {
17931
+ type: "fixed-size-binary",
17932
+ byteWidth: arrowType.byteWidth
17933
+ };
17934
+ case Bool2:
17935
+ return "bool";
17936
+ case Int_:
17937
+ const intType = arrowType;
17938
+ return `${intType.isSigned ? "" : "u"}int${intType.bitWidth}`;
17939
+ case Int8:
17940
+ return "int8";
17941
+ case Int16:
17942
+ return "int16";
17943
+ case Int32:
17944
+ return "int32";
17306
17945
  case Int64:
17307
17946
  return "int64";
17308
17947
  case Uint8:
@@ -17668,260 +18307,6 @@ return true;`);
17668
18307
  }
17669
18308
  });
17670
18309
 
17671
- // ../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts
17672
- function splitArrowBuffers(input, options = {}) {
17673
- const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
17674
- if (isArrowTable2(input)) {
17675
- return splitArrowTableBuffersInternal(input, context);
17676
- }
17677
- if (isArrowRecordBatch2(input)) {
17678
- return splitArrowRecordBatchBuffers(input, context);
17679
- }
17680
- if (isArrowVector2(input)) {
17681
- return splitArrowVectorBuffers(input, context);
17682
- }
17683
- return splitArrowDataBuffers(input, context);
17684
- }
17685
- function isArrowTable2(input) {
17686
- return "batches" in input;
17687
- }
17688
- function isArrowRecordBatch2(input) {
17689
- return "schema" in input && "data" in input && !Array.isArray(input.data);
17690
- }
17691
- function isArrowVector2(input) {
17692
- return "data" in input && Array.isArray(input.data);
17693
- }
17694
- function splitArrowTableBuffersInternal(table, options) {
17695
- const recordBatches = table.batches.map(
17696
- (recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options)
17697
- );
17698
- return new Table(table.schema, recordBatches);
17699
- }
17700
- function splitArrowRecordBatchBuffers(recordBatch, options) {
17701
- return new RecordBatch3(
17702
- recordBatch.schema,
17703
- splitArrowDataBuffers(recordBatch.data, options)
17704
- );
17705
- }
17706
- function splitArrowDataBuffers(data, options) {
17707
- const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
17708
- const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
17709
- const buffers = {
17710
- [BufferType.OFFSET]: splitArrowBuffer(data.buffers[BufferType.OFFSET], options),
17711
- [BufferType.DATA]: splitArrowBuffer(data.buffers[BufferType.DATA], options),
17712
- [BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
17713
- [BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
17714
- };
17715
- return new Data(
17716
- data.type,
17717
- data.offset,
17718
- data.length,
17719
- // @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
17720
- data._nullCount,
17721
- buffers,
17722
- children,
17723
- dictionary
17724
- );
17725
- }
17726
- function splitArrowVectorBuffers(vector, options) {
17727
- return new Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
17728
- }
17729
- function splitArrowBuffer(array, options) {
17730
- if (!isArrowTypedArray(array)) {
17731
- return array;
17732
- }
17733
- if (options.copy === "none") {
17734
- return array;
17735
- }
17736
- if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
17737
- return array;
17738
- }
17739
- let copy = options.copies.get(array);
17740
- if (!copy) {
17741
- copy = array.slice();
17742
- options.copies.set(array, copy);
17743
- }
17744
- return copy;
17745
- }
17746
- function isArrowTypedArray(value) {
17747
- return ArrayBuffer.isView(value) && !(value instanceof DataView);
17748
- }
17749
- var init_split_arrow_buffers = __esm({
17750
- "../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts"() {
17751
- "use strict";
17752
- init_Arrow_dom();
17753
- }
17754
- });
17755
-
17756
- // ../core/src/schema-utils/lib/arrow/arrow-table-transport.ts
17757
- function dehydrateArrowTable(table, options) {
17758
- const splitTable = splitArrowBuffers(table, options);
17759
- return {
17760
- shape: "arrow-table",
17761
- transport: "arrow-js",
17762
- schema: serializeArrowSchema(splitTable.schema),
17763
- batches: splitTable.batches.map((recordBatch) => dehydrateArrowRecordBatch(recordBatch))
17764
- };
17765
- }
17766
- function hydrateArrowTable(table) {
17767
- const schema = deserializeArrowSchema(table.schema);
17768
- const recordBatches = table.batches.map(
17769
- (recordBatch) => new RecordBatch3(schema, hydrateArrowData(recordBatch.data))
17770
- );
17771
- return new Table(schema, recordBatches);
17772
- }
17773
- function serializeArrowWorkerResult(result, options) {
17774
- if (!isArrowTableWrapper(result)) {
17775
- return result;
17776
- }
17777
- const workerOptions = options;
17778
- const bufferCopyMode = workerOptions?.core?.workerTransferBufferCopy ?? workerOptions?.workerTransferBufferCopy;
17779
- return {
17780
- ...result,
17781
- data: dehydrateArrowTable(result.data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
17782
- };
17783
- }
17784
- function deserializeArrowWorkerResult(result) {
17785
- if (!isDehydratedArrowTableWrapper(result)) {
17786
- return result;
17787
- }
17788
- return { ...result, data: hydrateArrowTable(result.data) };
17789
- }
17790
- function isArrowTableWrapper(value) {
17791
- const table = value;
17792
- return Boolean(
17793
- table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
17794
- );
17795
- }
17796
- function isDehydratedArrowTableWrapper(value) {
17797
- const table = value;
17798
- return Boolean(
17799
- table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
17800
- );
17801
- }
17802
- function dehydrateArrowRecordBatch(recordBatch) {
17803
- return { data: dehydrateArrowData(recordBatch.data) };
17804
- }
17805
- function dehydrateArrowData(data) {
17806
- return {
17807
- type: serializeArrowType(data.type),
17808
- offset: data.offset,
17809
- length: data.length,
17810
- // @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
17811
- nullCount: data._nullCount,
17812
- buffers: {
17813
- [BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
17814
- [BufferType.DATA]: data.buffers[BufferType.DATA],
17815
- [BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
17816
- [BufferType.TYPE]: data.buffers[BufferType.TYPE]
17817
- },
17818
- children: data.children.map((childData) => dehydrateArrowData(childData)),
17819
- dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
17820
- };
17821
- }
17822
- function dehydrateArrowVector(vector) {
17823
- return { data: vector.data.map((data) => dehydrateArrowData(data)) };
17824
- }
17825
- function hydrateArrowData(data) {
17826
- const children = data.children.map((childData) => hydrateArrowData(childData));
17827
- const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
17828
- return new Data(
17829
- deserializeArrowType(data.type),
17830
- data.offset,
17831
- data.length,
17832
- data.nullCount,
17833
- data.buffers,
17834
- children,
17835
- dictionary
17836
- );
17837
- }
17838
- function hydrateArrowVector(vector) {
17839
- return new Vector(vector.data.map((data) => hydrateArrowData(data)));
17840
- }
17841
- var init_arrow_table_transport = __esm({
17842
- "../core/src/schema-utils/lib/arrow/arrow-table-transport.ts"() {
17843
- "use strict";
17844
- init_Arrow_dom();
17845
- init_convert_arrow_schema();
17846
- init_split_arrow_buffers();
17847
- }
17848
- });
17849
-
17850
- // ../core/src/schema-utils/arrow-transport.ts
17851
- var init_arrow_transport = __esm({
17852
- "../core/src/schema-utils/arrow-transport.ts"() {
17853
- "use strict";
17854
- init_arrow_table_transport();
17855
- init_split_arrow_buffers();
17856
- }
17857
- });
17858
-
17859
- // ../core/src/schema-utils/lib/schema/data-type.ts
17860
- function getDataTypeFromValue(value, defaultNumberType = "float32") {
17861
- if (value instanceof Date) {
17862
- return "date-millisecond";
17863
- }
17864
- if (typeof value === "number") {
17865
- return defaultNumberType;
17866
- }
17867
- if (typeof value === "boolean") {
17868
- return "bool";
17869
- }
17870
- if (typeof value === "string") {
17871
- return "utf8";
17872
- }
17873
- if (value === null || value === "undefined") {
17874
- return "null";
17875
- }
17876
- return "null";
17877
- }
17878
- function getDataTypeFromArray(array) {
17879
- let type = getDataTypeFromTypedArray(array);
17880
- if (type !== "null") {
17881
- return { type, nullable: false };
17882
- }
17883
- if (array.length > 0) {
17884
- type = getDataTypeFromValue(array[0]);
17885
- return { type, nullable: true };
17886
- }
17887
- return { type: "null", nullable: true };
17888
- }
17889
- function getDataTypeFromTypedArray(array) {
17890
- if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
17891
- return "float16";
17892
- }
17893
- switch (array.constructor) {
17894
- case Int8Array:
17895
- return "int8";
17896
- case Uint8Array:
17897
- case Uint8ClampedArray:
17898
- return "uint8";
17899
- case Int16Array:
17900
- return "int16";
17901
- case Uint16Array:
17902
- return "uint16";
17903
- case Int32Array:
17904
- return "int32";
17905
- case Uint32Array:
17906
- return "uint32";
17907
- case BigInt64Array:
17908
- return "int64";
17909
- case BigUint64Array:
17910
- return "uint64";
17911
- case Float32Array:
17912
- return "float32";
17913
- case Float64Array:
17914
- return "float64";
17915
- default:
17916
- return "null";
17917
- }
17918
- }
17919
- var init_data_type = __esm({
17920
- "../core/src/schema-utils/lib/schema/data-type.ts"() {
17921
- "use strict";
17922
- }
17923
- });
17924
-
17925
18310
  // ../core/src/schema-utils/lib/mesh/mesh-utils.ts
17926
18311
  function getMeshBoundingBox(attributes) {
17927
18312
  const positionAttribute = attributes?.POSITION;
@@ -18023,7 +18408,7 @@ return true;`);
18023
18408
  var init_float162 = __esm({
18024
18409
  "../core/src/schema/float16.ts"() {
18025
18410
  "use strict";
18026
- init_dist();
18411
+ init_dist2();
18027
18412
  }
18028
18413
  });
18029
18414
 
@@ -18731,7 +19116,7 @@ return true;`);
18731
19116
  var init_version = __esm({
18732
19117
  "../images/src/lib/utils/version.ts"() {
18733
19118
  "use strict";
18734
- VERSION = true ? "5.0.0-beta.4" : "latest";
19119
+ VERSION = true ? "5.0.0-beta.6" : "latest";
18735
19120
  }
18736
19121
  });
18737
19122
 
@@ -19062,106 +19447,52 @@ return true;`);
19062
19447
 
19063
19448
  // src/terrain/lib/helpers/skirt.ts
19064
19449
  function addSkirt(attributes, triangles, skirtHeight, outsideIndices) {
19065
- const outsideEdges = outsideIndices ? getOutsideEdgesFromIndices(outsideIndices, attributes.POSITION.value) : getOutsideEdgesFromTriangles(triangles);
19066
- const newPosition = new attributes.POSITION.value.constructor(outsideEdges.length * 6);
19067
- const newTexcoord0 = new attributes.TEXCOORD_0.value.constructor(outsideEdges.length * 4);
19068
- const newTriangles = new triangles.constructor(outsideEdges.length * 6);
19069
- for (let i = 0; i < outsideEdges.length; i++) {
19070
- const edge = outsideEdges[i];
19071
- updateAttributesForNewEdge({
19072
- edge,
19073
- edgeIndex: i,
19074
- attributes,
19075
- skirtHeight,
19076
- newPosition,
19077
- newTexcoord0,
19078
- newTriangles
19079
- });
19450
+ const positions = attributes.POSITION.value;
19451
+ const sourceIndices = Array.isArray(triangles) ? Uint32Array.from(triangles) : triangles;
19452
+ const edges = outsideIndices ? getBoundaryEdges(outsideIndices, positions) : void 0;
19453
+ const skirt = createTerrainSkirt(
19454
+ { positions, indices: sourceIndices },
19455
+ { height: skirtHeight, edges }
19456
+ );
19457
+ const textureCoordinates = attributes.TEXCOORD_0.value;
19458
+ const outputTextureCoordinates = new textureCoordinates.constructor(
19459
+ skirt.positions.length / 3 * 2
19460
+ );
19461
+ outputTextureCoordinates.set(textureCoordinates);
19462
+ for (let i = 0; i < skirt.sourceVertexIndices.length; i++) {
19463
+ const source = skirt.sourceVertexIndices[i];
19464
+ outputTextureCoordinates.set(
19465
+ textureCoordinates.subarray(source * 2, source * 2 + 2),
19466
+ (skirt.skirtVertexOffset + i) * 2
19467
+ );
19080
19468
  }
19081
- attributes.POSITION.value = concatenateTypedArrays(attributes.POSITION.value, newPosition);
19082
- attributes.TEXCOORD_0.value = concatenateTypedArrays(attributes.TEXCOORD_0.value, newTexcoord0);
19083
- const resultTriangles = triangles instanceof Array ? triangles.concat(newTriangles) : concatenateTypedArrays(triangles, newTriangles);
19469
+ attributes.POSITION.value = skirt.positions;
19470
+ attributes.TEXCOORD_0.value = outputTextureCoordinates;
19084
19471
  return {
19085
19472
  attributes,
19086
- triangles: resultTriangles
19473
+ triangles: Array.isArray(triangles) ? Array.from(skirt.indices) : skirt.indices
19087
19474
  };
19088
19475
  }
19089
- function getOutsideEdgesFromTriangles(triangles) {
19090
- const edges = [];
19091
- for (let i = 0; i < triangles.length; i += 3) {
19092
- edges.push([triangles[i], triangles[i + 1]]);
19093
- edges.push([triangles[i + 1], triangles[i + 2]]);
19094
- edges.push([triangles[i + 2], triangles[i]]);
19095
- }
19096
- edges.sort((a, b) => Math.min(...a) - Math.min(...b) || Math.max(...a) - Math.max(...b));
19097
- const outsideEdges = [];
19098
- let index = 0;
19099
- while (index < edges.length) {
19100
- if (edges[index][0] === edges[index + 1]?.[1] && edges[index][1] === edges[index + 1]?.[0]) {
19101
- index += 2;
19102
- } else {
19103
- outsideEdges.push(edges[index]);
19104
- index++;
19105
- }
19106
- }
19107
- return outsideEdges;
19108
- }
19109
- function getOutsideEdgesFromIndices(indices, position) {
19110
- indices.westIndices.sort((a, b) => position[3 * a + 1] - position[3 * b + 1]);
19111
- indices.eastIndices.sort((a, b) => position[3 * b + 1] - position[3 * a + 1]);
19112
- indices.southIndices.sort((a, b) => position[3 * b] - position[3 * a]);
19113
- indices.northIndices.sort((a, b) => position[3 * a] - position[3 * b]);
19476
+ function getBoundaryEdges(indices, positions) {
19477
+ indices.westIndices.sort((a, b) => positions[3 * a + 1] - positions[3 * b + 1]);
19478
+ indices.eastIndices.sort((a, b) => positions[3 * b + 1] - positions[3 * a + 1]);
19479
+ indices.southIndices.sort((a, b) => positions[3 * b] - positions[3 * a]);
19480
+ indices.northIndices.sort((a, b) => positions[3 * a] - positions[3 * b]);
19114
19481
  const edges = [];
19115
- for (const index in indices) {
19116
- const indexGroup = indices[index];
19117
- for (let i = 0; i < indexGroup.length - 1; i++) {
19118
- edges.push([indexGroup[i], indexGroup[i + 1]]);
19119
- }
19482
+ for (const side of [
19483
+ indices.westIndices,
19484
+ indices.northIndices,
19485
+ indices.eastIndices,
19486
+ indices.southIndices
19487
+ ]) {
19488
+ for (let i = 1; i < side.length; i++) edges.push(side[i - 1], side[i]);
19120
19489
  }
19121
- return edges;
19122
- }
19123
- function updateAttributesForNewEdge({
19124
- edge,
19125
- edgeIndex,
19126
- attributes,
19127
- skirtHeight,
19128
- newPosition,
19129
- newTexcoord0,
19130
- newTriangles
19131
- }) {
19132
- const positionsLength = attributes.POSITION.value.length;
19133
- const vertex1Offset = edgeIndex * 2;
19134
- const vertex2Offset = edgeIndex * 2 + 1;
19135
- newPosition.set(
19136
- attributes.POSITION.value.subarray(edge[0] * 3, edge[0] * 3 + 3),
19137
- vertex1Offset * 3
19138
- );
19139
- newPosition[vertex1Offset * 3 + 2] = newPosition[vertex1Offset * 3 + 2] - skirtHeight;
19140
- newPosition.set(
19141
- attributes.POSITION.value.subarray(edge[1] * 3, edge[1] * 3 + 3),
19142
- vertex2Offset * 3
19143
- );
19144
- newPosition[vertex2Offset * 3 + 2] = newPosition[vertex2Offset * 3 + 2] - skirtHeight;
19145
- newTexcoord0.set(
19146
- attributes.TEXCOORD_0.value.subarray(edge[0] * 2, edge[0] * 2 + 2),
19147
- vertex1Offset * 2
19148
- );
19149
- newTexcoord0.set(
19150
- attributes.TEXCOORD_0.value.subarray(edge[1] * 2, edge[1] * 2 + 2),
19151
- vertex2Offset * 2
19152
- );
19153
- const triangle1Offset = edgeIndex * 2 * 3;
19154
- newTriangles[triangle1Offset] = edge[0];
19155
- newTriangles[triangle1Offset + 1] = positionsLength / 3 + vertex2Offset;
19156
- newTriangles[triangle1Offset + 2] = edge[1];
19157
- newTriangles[triangle1Offset + 3] = positionsLength / 3 + vertex2Offset;
19158
- newTriangles[triangle1Offset + 4] = edge[0];
19159
- newTriangles[triangle1Offset + 5] = positionsLength / 3 + vertex1Offset;
19490
+ return Uint32Array.from(edges);
19160
19491
  }
19161
19492
  var init_skirt = __esm({
19162
19493
  "src/terrain/lib/helpers/skirt.ts"() {
19163
19494
  "use strict";
19164
- init_loader_utils();
19495
+ init_terrain();
19165
19496
  }
19166
19497
  });
19167
19498
 
@@ -19322,7 +19653,7 @@ return true;`);
19322
19653
  var init_version2 = __esm({
19323
19654
  "src/terrain/lib/utils/version.ts"() {
19324
19655
  "use strict";
19325
- VERSION2 = true ? "5.0.0-beta.4" : "latest";
19656
+ VERSION2 = true ? "5.0.0-beta.6" : "latest";
19326
19657
  }
19327
19658
  });
19328
19659
 
@@ -19426,7 +19757,7 @@ return true;`);
19426
19757
  var init_terrain_loader2 = __esm({
19427
19758
  "src/terrain/terrain-loader.ts"() {
19428
19759
  "use strict";
19429
- init_arrow_transport();
19760
+ init_arrow_worker_transport();
19430
19761
  init_loader_utils();
19431
19762
  init_schema_utils();
19432
19763
  init_src();