@loaders.gl/geotiff 4.3.0-alpha.7 → 4.3.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.dev.js CHANGED
@@ -8564,6 +8564,31 @@ var __exports__ = (() => {
8564
8564
  }
8565
8565
  });
8566
8566
 
8567
+ // ../../node_modules/fast-xml-parser/src/ignoreAttributes.js
8568
+ var require_ignoreAttributes = __commonJS({
8569
+ "../../node_modules/fast-xml-parser/src/ignoreAttributes.js"(exports, module) {
8570
+ function getIgnoreAttributesFn(ignoreAttributes) {
8571
+ if (typeof ignoreAttributes === "function") {
8572
+ return ignoreAttributes;
8573
+ }
8574
+ if (Array.isArray(ignoreAttributes)) {
8575
+ return (attrName) => {
8576
+ for (const pattern of ignoreAttributes) {
8577
+ if (typeof pattern === "string" && attrName === pattern) {
8578
+ return true;
8579
+ }
8580
+ if (pattern instanceof RegExp && pattern.test(attrName)) {
8581
+ return true;
8582
+ }
8583
+ }
8584
+ };
8585
+ }
8586
+ return () => false;
8587
+ }
8588
+ module.exports = getIgnoreAttributesFn;
8589
+ }
8590
+ });
8591
+
8567
8592
  // ../../node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
8568
8593
  var require_OrderedObjParser = __commonJS({
8569
8594
  "../../node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js"(exports, module) {
@@ -8572,6 +8597,7 @@ var __exports__ = (() => {
8572
8597
  var xmlNode = require_xmlNode();
8573
8598
  var readDocType = require_DocTypeReader();
8574
8599
  var toNumber = require_strnum();
8600
+ var getIgnoreAttributesFn = require_ignoreAttributes();
8575
8601
  var OrderedObjParser = class {
8576
8602
  constructor(options) {
8577
8603
  this.options = options;
@@ -8612,6 +8638,7 @@ var __exports__ = (() => {
8612
8638
  this.readStopNodeData = readStopNodeData;
8613
8639
  this.saveTextToParentTag = saveTextToParentTag;
8614
8640
  this.addChild = addChild;
8641
+ this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
8615
8642
  }
8616
8643
  };
8617
8644
  function addExternalEntities(externalEntities) {
@@ -8665,12 +8692,15 @@ var __exports__ = (() => {
8665
8692
  }
8666
8693
  var attrsRegx = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
8667
8694
  function buildAttributesMap(attrStr, jPath, tagName) {
8668
- if (!this.options.ignoreAttributes && typeof attrStr === "string") {
8695
+ if (this.options.ignoreAttributes !== true && typeof attrStr === "string") {
8669
8696
  const matches = util.getAllMatches(attrStr, attrsRegx);
8670
8697
  const len = matches.length;
8671
8698
  const attrs = {};
8672
8699
  for (let i = 0; i < len; i++) {
8673
8700
  const attrName = this.resolveNameSpace(matches[i][1]);
8701
+ if (this.ignoreAttributesFn(attrName, jPath)) {
8702
+ continue;
8703
+ }
8674
8704
  let oldVal = matches[i][4];
8675
8705
  let aName = this.options.attributeNamePrefix + attrName;
8676
8706
  if (attrName.length) {
@@ -9362,6 +9392,7 @@ var __exports__ = (() => {
9362
9392
  "../../node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js"(exports, module) {
9363
9393
  "use strict";
9364
9394
  var buildFromOrderedJs = require_orderedJs2Xml();
9395
+ var getIgnoreAttributesFn = require_ignoreAttributes();
9365
9396
  var defaultOptions = {
9366
9397
  attributeNamePrefix: "@_",
9367
9398
  attributesGroupName: false,
@@ -9398,11 +9429,12 @@ var __exports__ = (() => {
9398
9429
  };
9399
9430
  function Builder(options) {
9400
9431
  this.options = Object.assign({}, defaultOptions, options);
9401
- if (this.options.ignoreAttributes || this.options.attributesGroupName) {
9432
+ if (this.options.ignoreAttributes === true || this.options.attributesGroupName) {
9402
9433
  this.isAttribute = function() {
9403
9434
  return false;
9404
9435
  };
9405
9436
  } else {
9437
+ this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
9406
9438
  this.attrPrefixLen = this.options.attributeNamePrefix.length;
9407
9439
  this.isAttribute = isAttribute;
9408
9440
  }
@@ -9428,12 +9460,13 @@ var __exports__ = (() => {
9428
9460
  [this.options.arrayNodeName]: jObj
9429
9461
  };
9430
9462
  }
9431
- return this.j2x(jObj, 0).val;
9463
+ return this.j2x(jObj, 0, []).val;
9432
9464
  }
9433
9465
  };
9434
- Builder.prototype.j2x = function(jObj, level) {
9466
+ Builder.prototype.j2x = function(jObj, level, ajPath) {
9435
9467
  let attrStr = "";
9436
9468
  let val2 = "";
9469
+ const jPath = ajPath.join(".");
9437
9470
  for (let key in jObj) {
9438
9471
  if (!Object.prototype.hasOwnProperty.call(jObj, key))
9439
9472
  continue;
@@ -9453,9 +9486,9 @@ var __exports__ = (() => {
9453
9486
  val2 += this.buildTextValNode(jObj[key], key, "", level);
9454
9487
  } else if (typeof jObj[key] !== "object") {
9455
9488
  const attr = this.isAttribute(key);
9456
- if (attr) {
9489
+ if (attr && !this.ignoreAttributesFn(attr, jPath)) {
9457
9490
  attrStr += this.buildAttrPairStr(attr, "" + jObj[key]);
9458
- } else {
9491
+ } else if (!attr) {
9459
9492
  if (key === this.options.textNodeName) {
9460
9493
  let newval = this.options.tagValueProcessor(key, "" + jObj[key]);
9461
9494
  val2 += this.replaceEntitiesValue(newval);
@@ -9477,13 +9510,13 @@ var __exports__ = (() => {
9477
9510
  val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar;
9478
9511
  } else if (typeof item === "object") {
9479
9512
  if (this.options.oneListGroup) {
9480
- const result = this.j2x(item, level + 1);
9513
+ const result = this.j2x(item, level + 1, ajPath.concat(key));
9481
9514
  listTagVal += result.val;
9482
9515
  if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) {
9483
9516
  listTagAttr += result.attrStr;
9484
9517
  }
9485
9518
  } else {
9486
- listTagVal += this.processTextOrObjNode(item, key, level);
9519
+ listTagVal += this.processTextOrObjNode(item, key, level, ajPath);
9487
9520
  }
9488
9521
  } else {
9489
9522
  if (this.options.oneListGroup) {
@@ -9507,7 +9540,7 @@ var __exports__ = (() => {
9507
9540
  attrStr += this.buildAttrPairStr(Ks[j], "" + jObj[key][Ks[j]]);
9508
9541
  }
9509
9542
  } else {
9510
- val2 += this.processTextOrObjNode(jObj[key], key, level);
9543
+ val2 += this.processTextOrObjNode(jObj[key], key, level, ajPath);
9511
9544
  }
9512
9545
  }
9513
9546
  }
@@ -9521,8 +9554,8 @@ var __exports__ = (() => {
9521
9554
  } else
9522
9555
  return " " + attrName + '="' + val2 + '"';
9523
9556
  };
9524
- function processTextOrObjNode(object, key, level) {
9525
- const result = this.j2x(object, level + 1);
9557
+ function processTextOrObjNode(object, key, level, ajPath) {
9558
+ const result = this.j2x(object, level + 1, ajPath.concat(key));
9526
9559
  if (object[this.options.textNodeName] !== void 0 && Object.keys(object).length === 1) {
9527
9560
  return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level);
9528
9561
  } else {
@@ -9658,6 +9691,7 @@ var __exports__ = (() => {
9658
9691
  setPrototypeOf: ReflectSetPrototypeOf
9659
9692
  } = Reflect;
9660
9693
  var {
9694
+ EPSILON,
9661
9695
  MAX_SAFE_INTEGER,
9662
9696
  isFinite: NumberIsFinite,
9663
9697
  isNaN: NumberIsNaN
@@ -9713,6 +9747,10 @@ var __exports__ = (() => {
9713
9747
  );
9714
9748
  var NativeArrayPrototypeSymbolIterator = ArrayPrototype[SymbolIterator];
9715
9749
  var ArrayPrototypeSymbolIterator = uncurryThis(NativeArrayPrototypeSymbolIterator);
9750
+ var {
9751
+ abs: MathAbs,
9752
+ trunc: MathTrunc
9753
+ } = Math;
9716
9754
  var NativeArrayBuffer = ArrayBuffer;
9717
9755
  var ArrayBufferIsView = NativeArrayBuffer.isView;
9718
9756
  var ArrayBufferPrototype = NativeArrayBuffer.prototype;
@@ -9760,6 +9798,8 @@ var __exports__ = (() => {
9760
9798
  TypedArrayPrototype,
9761
9799
  SymbolToStringTag
9762
9800
  );
9801
+ var NativeUint8Array = Uint8Array;
9802
+ var NativeUint16Array = Uint16Array;
9763
9803
  var NativeUint32Array = Uint32Array;
9764
9804
  var NativeFloat32Array = Float32Array;
9765
9805
  var ArrayIteratorPrototype = ReflectGetPrototypeOf([][SymbolIterator]());
@@ -9827,14 +9867,19 @@ var __exports__ = (() => {
9827
9867
  }
9828
9868
 
9829
9869
  // ../../node_modules/@petamoriken/float16/src/_util/converter.mjs
9870
+ var INVERSE_OF_EPSILON = 1 / EPSILON;
9871
+ var FLOAT16_MIN_VALUE = 6103515625e-14;
9872
+ var FLOAT16_EPSILON = 9765625e-10;
9873
+ var FLOAT16_EPSILON_MULTIPLIED_BY_FLOAT16_MIN_VALUE = FLOAT16_EPSILON * FLOAT16_MIN_VALUE;
9874
+ var FLOAT16_EPSILON_DEVIDED_BY_EPSILON = FLOAT16_EPSILON * INVERSE_OF_EPSILON;
9830
9875
  var buffer = new NativeArrayBuffer(4);
9831
9876
  var floatView = new NativeFloat32Array(buffer);
9832
9877
  var uint32View = new NativeUint32Array(buffer);
9833
- var baseTable = new NativeUint32Array(512);
9834
- var shiftTable = new NativeUint32Array(512);
9878
+ var baseTable = new NativeUint16Array(512);
9879
+ var shiftTable = new NativeUint8Array(512);
9835
9880
  for (let i = 0; i < 256; ++i) {
9836
9881
  const e = i - 127;
9837
- if (e < -27) {
9882
+ if (e < -24) {
9838
9883
  baseTable[i] = 0;
9839
9884
  baseTable[i | 256] = 32768;
9840
9885
  shiftTable[i] = 24;
@@ -9862,8 +9907,6 @@ var __exports__ = (() => {
9862
9907
  }
9863
9908
  }
9864
9909
  var mantissaTable = new NativeUint32Array(2048);
9865
- var exponentTable = new NativeUint32Array(64);
9866
- var offsetTable = new NativeUint32Array(64);
9867
9910
  for (let i = 1; i < 1024; ++i) {
9868
9911
  let m = i << 13;
9869
9912
  let e = 0;
@@ -9878,6 +9921,7 @@ var __exports__ = (() => {
9878
9921
  for (let i = 1024; i < 2048; ++i) {
9879
9922
  mantissaTable[i] = 939524096 + (i - 1024 << 13);
9880
9923
  }
9924
+ var exponentTable = new NativeUint32Array(64);
9881
9925
  for (let i = 1; i < 31; ++i) {
9882
9926
  exponentTable[i] = i << 23;
9883
9927
  }
@@ -9887,14 +9931,15 @@ var __exports__ = (() => {
9887
9931
  exponentTable[i] = 2147483648 + (i - 32 << 23);
9888
9932
  }
9889
9933
  exponentTable[63] = 3347054592;
9934
+ var offsetTable = new NativeUint16Array(64);
9890
9935
  for (let i = 1; i < 64; ++i) {
9891
9936
  if (i !== 32) {
9892
9937
  offsetTable[i] = 1024;
9893
9938
  }
9894
9939
  }
9895
9940
  function convertToNumber(float16bits) {
9896
- const m = float16bits >> 10;
9897
- uint32View[0] = mantissaTable[offsetTable[m] + (float16bits & 1023)] + exponentTable[m];
9941
+ const i = float16bits >> 10;
9942
+ uint32View[0] = mantissaTable[offsetTable[i] + (float16bits & 1023)] + exponentTable[i];
9898
9943
  return floatView[0];
9899
9944
  }
9900
9945
 
@@ -10908,9 +10953,16 @@ var __exports__ = (() => {
10908
10953
  ];
10909
10954
  }
10910
10955
  if (modelTransformation) {
10956
+ if (modelTransformation[1] === 0 && modelTransformation[4] === 0) {
10957
+ return [
10958
+ modelTransformation[0],
10959
+ -modelTransformation[5],
10960
+ modelTransformation[10]
10961
+ ];
10962
+ }
10911
10963
  return [
10912
- modelTransformation[0],
10913
- -modelTransformation[5],
10964
+ Math.sqrt(modelTransformation[0] * modelTransformation[0] + modelTransformation[4] * modelTransformation[4]),
10965
+ -Math.sqrt(modelTransformation[1] * modelTransformation[1] + modelTransformation[5] * modelTransformation[5]),
10914
10966
  modelTransformation[10]
10915
10967
  ];
10916
10968
  }
@@ -10935,12 +10987,14 @@ var __exports__ = (() => {
10935
10987
  * Returns the image bounding box as an array of 4 values: min-x, min-y,
10936
10988
  * max-x and max-y. When the image has no affine transformation, then an
10937
10989
  * exception is thrown.
10990
+ * @param {boolean} [tilegrid=false] If true return extent for a tilegrid
10991
+ * without adjustment for ModelTransformation.
10938
10992
  * @returns {Array<number>} The bounding box
10939
10993
  */
10940
- getBoundingBox() {
10994
+ getBoundingBox(tilegrid = false) {
10941
10995
  const height = this.getHeight();
10942
10996
  const width = this.getWidth();
10943
- if (this.fileDirectory.ModelTransformation) {
10997
+ if (this.fileDirectory.ModelTransformation && !tilegrid) {
10944
10998
  const [a, b, c, d, e, f, g, h] = this.fileDirectory.ModelTransformation;
10945
10999
  const corners = [
10946
11000
  [0, 0],
@@ -10965,8 +11019,8 @@ var __exports__ = (() => {
10965
11019
  const resolution = this.getResolution();
10966
11020
  const x1 = origin[0];
10967
11021
  const y1 = origin[1];
10968
- const x2 = x1 + resolution[0] * this.getWidth();
10969
- const y2 = y1 + resolution[1] * this.getHeight();
11022
+ const x2 = x1 + resolution[0] * width;
11023
+ const y2 = y1 + resolution[1] * height;
10970
11024
  return [
10971
11025
  Math.min(x1, x2),
10972
11026
  Math.min(y1, y2),
@@ -11844,9 +11898,10 @@ var __exports__ = (() => {
11844
11898
  }
11845
11899
  /**
11846
11900
  * Send a request with the options
11847
- * @param {object} [options]
11901
+ * @param {{headers: HeadersInit, signal: AbortSignal}} [options={}]
11902
+ * @returns {Promise<BaseResponse>}
11848
11903
  */
11849
- async request({ headers, credentials, signal } = {}) {
11904
+ async request({ headers, signal } = {}) {
11850
11905
  throw new Error("request is not implemented");
11851
11906
  }
11852
11907
  };
@@ -11877,10 +11932,14 @@ var __exports__ = (() => {
11877
11932
  super(url);
11878
11933
  this.credentials = credentials;
11879
11934
  }
11880
- async request({ headers, credentials, signal } = {}) {
11935
+ /**
11936
+ * @param {{headers: HeadersInit, signal: AbortSignal}} [options={}]
11937
+ * @returns {Promise<FetchResponse>}
11938
+ */
11939
+ async request({ headers, signal } = {}) {
11881
11940
  const response = await fetch(this.url, {
11882
11941
  headers,
11883
- credentials,
11942
+ credentials: this.credentials,
11884
11943
  signal
11885
11944
  });
11886
11945
  return new FetchResponse(response);