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file: /npm/geoai@1.0.7/geoai.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport { RawImage, load_image, pipeline, SamModel, AutoProcessor, Tensor, AutoModel, ImageProcessor, PreTrainedModel, matmul } from \"@huggingface/transformers\";\nfunction count(values, valueof) {\n  let count2 = 0;\n  {\n    for (let value of values) {\n      if (value != null && (value = +value) >= value) {\n        ++count2;\n      }\n    }\n  }\n  return count2;\n}\nfunction extent(values, valueof) {\n  let min;\n  let max;\n  if (valueof === void 0) {\n    for (const value of values) {\n      if (value != null) {\n        if (min === void 0) {\n          if (value >= value) min = max = value;\n        } else {\n          if (min > value) min = value;\n          if (max < value) max = value;\n        }\n      }\n    }\n  } else {\n    let index = -1;\n    for (let value of values) {\n      if ((value = valueof(value, ++index, values)) != null) {\n        if (min === void 0) {\n          if (value >= value) min = max = value;\n        } else {\n          if (min > value) min = value;\n          if (max < value) max = value;\n        }\n      }\n    }\n  }\n  return [min, max];\n}\nconst e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2);\nfunction tickSpec(start, stop, count2) {\n  const step = (stop - start) / Math.max(0, count2), power = Math.floor(Math.log10(step)), error = step / Math.pow(10, power), factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;\n  let i1, i2, inc;\n  if (power < 0) {\n    inc = Math.pow(10, -power) / factor;\n    i1 = Math.round(start * inc);\n    i2 = Math.round(stop * inc);\n    if (i1 / inc < start) ++i1;\n    if (i2 / inc > stop) --i2;\n    inc = -inc;\n  } else {\n    inc = Math.pow(10, power) * factor;\n    i1 = Math.round(start / inc);\n    i2 = Math.round(stop / inc);\n    if (i1 * inc < start) ++i1;\n    if (i2 * inc > stop) --i2;\n  }\n  if (i2 < i1 && 0.5 <= count2 && count2 < 2) return tickSpec(start, stop, count2 * 2);\n  return [i1, i2, inc];\n}\nfunction ticks(start, stop, count2) {\n  stop = +stop, start = +start, count2 = +count2;\n  if (!(count2 > 0)) return [];\n  if (start === stop) return [start];\n  const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count2) : tickSpec(start, stop, count2);\n  if (!(i2 >= i1)) return [];\n  const n = i2 - i1 + 1, ticks2 = new Array(n);\n  if (reverse) {\n    if (inc < 0) for (let i = 0; i < n; ++i) ticks2[i] = (i2 - i) / -inc;\n    else for (let i = 0; i < n; ++i) ticks2[i] = (i2 - i) * inc;\n  } else {\n    if (inc < 0) for (let i = 0; i < n; ++i) ticks2[i] = (i1 + i) / -inc;\n    else for (let i = 0; i < n; ++i) ticks2[i] = (i1 + i) * inc;\n  }\n  return ticks2;\n}\nfunction tickIncrement(start, stop, count2) {\n  stop = +stop, start = +start, count2 = +count2;\n  return tickSpec(start, stop, count2)[2];\n}\nfunction nice(start, stop, count2) {\n  let prestep;\n  while (true) {\n    const step = tickIncrement(start, stop, count2);\n    if (step === prestep || step === 0 || !isFinite(step)) {\n      return [start, stop];\n    } else if (step > 0) {\n      start = Math.floor(start / step) * step;\n      stop = Math.ceil(stop / step) * step;\n    } else if (step < 0) {\n      start = Math.ceil(start * step) / step;\n      stop = Math.floor(stop * step) / step;\n    }\n    prestep = step;\n  }\n}\nfunction thresholdSturges(values) {\n  return Math.max(1, Math.ceil(Math.log(count(values)) / Math.LN2) + 1);\n}\nvar array = Array.prototype;\nvar slice = array.slice;\nfunction ascending(a, b) {\n  return a - b;\n}\nfunction area$1(ring) {\n  var i = 0, n = ring.length, area2 = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1];\n  while (++i < n) area2 += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1];\n  return area2;\n}\nconst constant = (x) => () => x;\nfunction contains(ring, hole) {\n  var i = -1, n = hole.length, c;\n  while (++i < n) if (c = ringContains(ring, hole[i])) return c;\n  return 0;\n}\nfunction ringContains(ring, point) {\n  var x = point[0], y = point[1], contains2 = -1;\n  for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) {\n    var pi = ring[i], xi = pi[0], yi = pi[1], pj = ring[j], xj = pj[0], yj = pj[1];\n    if (segmentContains(pi, pj, point)) return 0;\n    if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) contains2 = -contains2;\n  }\n  return contains2;\n}\nfunction segmentContains(a, b, c) {\n  var i;\n  return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]);\n}\nfunction collinear(a, b, c) {\n  return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]);\n}\nfunction within(p, q, r) {\n  return p <= q && q <= r || r <= q && q <= p;\n}\nfunction noop() {\n}\nvar cases = [\n  [],\n  [[[1, 1.5], [0.5, 1]]],\n  [[[1.5, 1], [1, 1.5]]],\n  [[[1.5, 1], [0.5, 1]]],\n  [[[1, 0.5], [1.5, 1]]],\n  [[[1, 1.5], [0.5, 1]], [[1, 0.5], [1.5, 1]]],\n  [[[1, 0.5], [1, 1.5]]],\n  [[[1, 0.5], [0.5, 1]]],\n  [[[0.5, 1], [1, 0.5]]],\n  [[[1, 1.5], [1, 0.5]]],\n  [[[0.5, 1], [1, 0.5]], [[1.5, 1], [1, 1.5]]],\n  [[[1.5, 1], [1, 0.5]]],\n  [[[0.5, 1], [1.5, 1]]],\n  [[[1, 1.5], [1.5, 1]]],\n  [[[0.5, 1], [1, 1.5]]],\n  []\n];\nfunction contours() {\n  var dx = 1, dy = 1, threshold = thresholdSturges, smooth = smoothLinear;\n  function contours2(values) {\n    var tz = threshold(values);\n    if (!Array.isArray(tz)) {\n      const e = extent(values, finite);\n      tz = ticks(...nice(e[0], e[1], tz), tz);\n      while (tz[tz.length - 1] >= e[1]) tz.pop();\n      while (tz[1] < e[0]) tz.shift();\n    } else {\n      tz = tz.slice().sort(ascending);\n    }\n    return tz.map((value) => contour(values, value));\n  }\n  function contour(values, value) {\n    const v = value == null ? NaN : +value;\n    if (isNaN(v)) throw new Error(`invalid value: ${value}`);\n    var polygons = [], holes = [];\n    isorings(values, v, function(ring) {\n      smooth(ring, values, v);\n      if (area$1(ring) > 0) polygons.push([ring]);\n      else holes.push(ring);\n    });\n    holes.forEach(function(hole) {\n      for (var i = 0, n = polygons.length, polygon2; i < n; ++i) {\n        if (contains((polygon2 = polygons[i])[0], hole) !== -1) {\n          polygon2.push(hole);\n          return;\n        }\n      }\n    });\n    return {\n      type: \"MultiPolygon\",\n      value,\n      coordinates: polygons\n    };\n  }\n  function isorings(values, value, callback) {\n    var fragmentByStart = new Array(), fragmentByEnd = new Array(), x, y, t0, t1, t2, t3;\n    x = y = -1;\n    t1 = above(values[0], value);\n    cases[t1 << 1].forEach(stitch);\n    while (++x < dx - 1) {\n      t0 = t1, t1 = above(values[x + 1], value);\n      cases[t0 | t1 << 1].forEach(stitch);\n    }\n    cases[t1 << 0].forEach(stitch);\n    while (++y < dy - 1) {\n      x = -1;\n      t1 = above(values[y * dx + dx], value);\n      t2 = above(values[y * dx], value);\n      cases[t1 << 1 | t2 << 2].forEach(stitch);\n      while (++x < dx - 1) {\n        t0 = t1, t1 = above(values[y * dx + dx + x + 1], value);\n        t3 = t2, t2 = above(values[y * dx + x + 1], value);\n        cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch);\n      }\n      cases[t1 | t2 << 3].forEach(stitch);\n    }\n    x = -1;\n    t2 = values[y * dx] >= value;\n    cases[t2 << 2].forEach(stitch);\n    while (++x < dx - 1) {\n      t3 = t2, t2 = above(values[y * dx + x + 1], value);\n      cases[t2 << 2 | t3 << 3].forEach(stitch);\n    }\n    cases[t2 << 3].forEach(stitch);\n    function stitch(line) {\n      var start = [line[0][0] + x, line[0][1] + y], end = [line[1][0] + x, line[1][1] + y], startIndex = index(start), endIndex = index(end), f, g;\n      if (f = fragmentByEnd[startIndex]) {\n        if (g = fragmentByStart[endIndex]) {\n          delete fragmentByEnd[f.end];\n          delete fragmentByStart[g.start];\n          if (f === g) {\n            f.ring.push(end);\n            callback(f.ring);\n          } else {\n            fragmentByStart[f.start] = fragmentByEnd[g.end] = { start: f.start, end: g.end, ring: f.ring.concat(g.ring) };\n          }\n        } else {\n          delete fragmentByEnd[f.end];\n          f.ring.push(end);\n          fragmentByEnd[f.end = endIndex] = f;\n        }\n      } else if (f = fragmentByStart[endIndex]) {\n        if (g = fragmentByEnd[startIndex]) {\n          delete fragmentByStart[f.start];\n          delete fragmentByEnd[g.end];\n          if (f === g) {\n            f.ring.push(end);\n            callback(f.ring);\n          } else {\n            fragmentByStart[g.start] = fragmentByEnd[f.end] = { start: g.start, end: f.end, ring: g.ring.concat(f.ring) };\n          }\n        } else {\n          delete fragmentByStart[f.start];\n          f.ring.unshift(start);\n          fragmentByStart[f.start = startIndex] = f;\n        }\n      } else {\n        fragmentByStart[startIndex] = fragmentByEnd[endIndex] = { start: startIndex, end: endIndex, ring: [start, end] };\n      }\n    }\n  }\n  function index(point) {\n    return point[0] * 2 + point[1] * (dx + 1) * 4;\n  }\n  function smoothLinear(ring, values, value) {\n    ring.forEach(function(point) {\n      var x = point[0], y = point[1], xt = x | 0, yt = y | 0, v1 = valid(values[yt * dx + xt]);\n      if (x > 0 && x < dx && xt === x) {\n        point[0] = smooth1(x, valid(values[yt * dx + xt - 1]), v1, value);\n      }\n      if (y > 0 && y < dy && yt === y) {\n        point[1] = smooth1(y, valid(values[(yt - 1) * dx + xt]), v1, value);\n      }\n    });\n  }\n  contours2.contour = contour;\n  contours2.size = function(_) {\n    if (!arguments.length) return [dx, dy];\n    var _0 = Math.floor(_[0]), _1 = Math.floor(_[1]);\n    if (!(_0 >= 0 && _1 >= 0)) throw new Error(\"invalid size\");\n    return dx = _0, dy = _1, contours2;\n  };\n  contours2.thresholds = function(_) {\n    return arguments.length ? (threshold = typeof _ === \"function\" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), contours2) : threshold;\n  };\n  contours2.smooth = function(_) {\n    return arguments.length ? (smooth = _ ? smoothLinear : noop, contours2) : smooth === smoothLinear;\n  };\n  return contours2;\n}\nfunction finite(x) {\n  return isFinite(x) ? x : NaN;\n}\nfunction above(x, value) {\n  return x == null ? false : +x >= value;\n}\nfunction valid(v) {\n  return v == null || isNaN(v = +v) ? -Infinity : v;\n}\nfunction smooth1(x, v0, v1, value) {\n  const a = value - v0;\n  const b = v1 - v0;\n  const d = isFinite(a) || isFinite(b) ? a / b : Math.sign(a) / Math.sign(b);\n  return isNaN(d) ? x : x + d - 0.5;\n}\nfunction polygonArea(polygon2) {\n  var i = -1, n = polygon2.length, a, b = polygon2[n - 1], area2 = 0;\n  while (++i < n) {\n    a = b;\n    b = polygon2[i];\n    area2 += a[1] * b[0] - a[0] * b[1];\n  }\n  return area2 / 2;\n}\nfunction removeDuplicates(detections, iouThreshold) {\n  const filteredDetections = [];\n  for (const detection of detections) {\n    let isDuplicate = false;\n    let duplicateIndex = -1;\n    let maxIoU = 0;\n    for (let i = 0; i < filteredDetections.length; i++) {\n      const iou = calculateIoU(detection, filteredDetections[i]);\n      if (iou > iouThreshold) {\n        isDuplicate = true;\n        if (iou > maxIoU) {\n          maxIoU = iou;\n          duplicateIndex = i;\n        }\n      }\n    }\n    if (!isDuplicate) {\n      filteredDetections.push(detection);\n    } else if (duplicateIndex !== -1 && detection.score > filteredDetections[duplicateIndex].score) {\n      filteredDetections[duplicateIndex] = detection;\n    }\n  }\n  return filteredDetections;\n}\nfunction calculateIoU(det1, det2) {\n  const xOverlap = Math.max(\n    0,\n    Math.min(det1.x2, det2.x2) - Math.max(det1.x1, det2.x1)\n  );\n  const yOverlap = Math.max(\n    0,\n    Math.min(det1.y2, det2.y2) - Math.max(det1.y1, det2.y1)\n  );\n  const overlapArea = xOverlap * yOverlap;\n  const area1 = (det1.x2 - det1.x1) * (det1.y2 - det1.y1);\n  const area2 = (det2.x2 - det2.x1) * (det2.y2 - det2.y1);\n  return overlapArea / (area1 + area2 - overlapArea);\n}\nconst postProcessYoloOutput = (model_outputs, pixel_values, rawImage, id2label) => {\n  const permuted = model_outputs.output0[0].transpose(1, 0);\n  const threshold = 0.5;\n  const [scaledHeight, scaledWidth] = pixel_values.dims.slice(-2);\n  const results = [];\n  for (const [xc, yc, w, h, ...scores] of permuted.tolist()) {\n    const x1 = (xc - w / 2) / scaledWidth * rawImage.width;\n    const y1 = (yc - h / 2) / scaledHeight * rawImage.height;\n    const x2 = (xc + w / 2) / scaledWidth * rawImage.width;\n    const y2 = (yc + h / 2) / scaledHeight * rawImage.height;\n    const argmax = scores.reduce(\n      (maxIndex, val, idx, arr) => val > arr[maxIndex] ? idx : maxIndex,\n      0\n    );\n    const score = scores[argmax];\n    if (score < threshold) continue;\n    results.push({\n      x1,\n      y1,\n      x2,\n      y2,\n      score,\n      label: id2label[argmax],\n      index: argmax\n    });\n  }\n  const iouThreshold = 0.7;\n  const filteredResults = removeDuplicates(results, iouThreshold);\n  const model_output = filteredResults.map((d) => {\n    return {\n      score: d.score,\n      box: [d.x1, d.y1, d.x2, d.y2],\n      label: d.label\n    };\n  });\n  return model_output;\n};\nconst parametersChanged = (instance, model_id, providerParams, modelParams) => {\n  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;\n  if (instance.model_id !== model_id) {\n    return true;\n  }\n  const instanceProvider = (_a = instance.providerParams) == null ? void 0 : _a.provider;\n  const newProvider = providerParams == null ? void 0 : providerParams.provider;\n  if (instanceProvider !== newProvider) {\n    return true;\n  }\n  switch (newProvider) {\n    case \"mapbox\":\n      if (((_b = instance.providerParams) == null ? void 0 : _b.apiKey) !== (providerParams == null ? void 0 : providerParams.apiKey) || ((_c = instance.providerParams) == null ? void 0 : _c.style) !== (providerParams == null ? void 0 : providerParams.style)) {\n        return true;\n      }\n      break;\n    case \"geobase\":\n      if (((_d = instance.providerParams) == null ? void 0 : _d.projectRef) !== (providerParams == null ? void 0 : providerParams.projectRef) || ((_e = instance.providerParams) == null ? void 0 : _e.cogImagery) !== (providerParams == null ? void 0 : providerParams.cogImagery) || ((_f = instance.providerParams) == null ? void 0 : _f.apikey) !== (providerParams == null ? void 0 : providerParams.apikey)) {\n        return true;\n      }\n      break;\n    case \"sentinel\":\n      if (((_g = instance.providerParams) == null ? void 0 : _g.apiKey) !== (providerParams == null ? void 0 : providerParams.apiKey)) {\n        return true;\n      }\n      break;\n    case \"tms\":\n      if (((_h = instance.providerParams) == null ? void 0 : _h.baseUrl) !== (providerParams == null ? void 0 : providerParams.baseUrl)) {\n        return true;\n      }\n      break;\n    case \"wms\":\n      if (((_i = instance.providerParams) == null ? void 0 : _i.baseUrl) !== (providerParams == null ? void 0 : providerParams.baseUrl) || ((_j = instance.providerParams) == null ? void 0 : _j.layers) !== (providerParams == null ? void 0 : providerParams.layers) || ((_k = instance.providerParams) == null ? void 0 : _k.version) !== (providerParams == null ? void 0 : providerParams.version) || ((_l = instance.providerParams) == null ? void 0 : _l.crs) !== (providerParams == null ? void 0 : providerParams.crs)) {\n        return true;\n      }\n      break;\n    case \"oam\":\n      if (((_m = instance.providerParams) == null ? void 0 : _m.stacUrl) !== (providerParams == null ? void 0 : providerParams.stacUrl) || ((_n = instance.providerParams) == null ? void 0 : _n.rasterUrl) !== (providerParams == null ? void 0 : providerParams.rasterUrl) || ((_o = instance.providerParams) == null ? void 0 : _o.collection) !== (providerParams == null ? void 0 : providerParams.collection) || ((_p = instance.providerParams) == null ? void 0 : _p.asset) !== (providerParams == null ? void 0 : providerParams.asset) || ((_q = instance.providerParams) == null ? void 0 : _q.itemId) !== (providerParams == null ? void 0 : providerParams.itemId) || ((_r = instance.providerParams) == null ? void 0 : _r.mosaic) !== (providerParams == null ? void 0 : providerParams.mosaic)) {\n        return true;\n      }\n      break;\n  }\n  if (modelParams) {\n    const instanceModelParams = instance.modelParams || {};\n    const newModelParams = modelParams || {};\n    const keys = Object.keys(newModelParams);\n    for (const key of keys) {\n      if (instanceModelParams[key] !== newModelParams[key]) {\n        return true;\n      }\n    }\n  }\n  return false;\n};\nconst detectionsToGeoJSON = (detections, geoRawImage) => {\n  const features = detections.map((detection) => {\n    let { xmin, ymin, xmax, ymax } = detection.box;\n    if (Array.isArray(detection.box)) {\n      [xmin, ymin, xmax, ymax] = detection.box;\n    }\n    const x1 = xmin;\n    const y1 = ymin;\n    const x2 = xmax;\n    const y2 = ymax;\n    let bbox2 = [\n      [x1, y1],\n      [x2, y1],\n      [x2, y2],\n      [x1, y2],\n      [x1, y1]\n    ];\n    bbox2 = bbox2.map((point) => geoRawImage.pixelToWorld(point[0], point[1]));\n    return {\n      type: \"Feature\",\n      properties: {\n        label: detection.label,\n        score: detection.score\n      },\n      geometry: {\n        type: \"Polygon\",\n        coordinates: [bbox2]\n      }\n    };\n  });\n  return {\n    type: \"FeatureCollection\",\n    features\n  };\n};\nconst maskToGeoJSON = (masks, geoRawImage, thresholds = [128]) => {\n  const featureCollections = [];\n  masks.mask.forEach((mask, index) => {\n    var _a;\n    const contoursGen = contours().size([mask.dims[3], mask.dims[2]]).thresholds(thresholds).smooth(true);\n    const data = Array.from(mask.data);\n    const generatedContours = contoursGen(data);\n    const polygons = [];\n    generatedContours.forEach((contour) => {\n      contour.coordinates.forEach((polygon2) => {\n        const rings = [];\n        polygon2.forEach((ring) => {\n          if (ring.length < 3) return;\n          const area2 = polygonArea(ring);\n          const coordinates = ring.map(\n            (coord) => geoRawImage.pixelToWorld(coord[0], coord[1])\n          );\n          if (area2 > 0) {\n            rings.unshift(coordinates);\n          } else {\n            rings.push(coordinates);\n          }\n        });\n        if (rings.length > 0) {\n          polygons.push(rings);\n        }\n      });\n    });\n    const maskFeature = {\n      type: \"Feature\",\n      properties: {\n        score: (_a = masks.scores) == null ? void 0 : _a[index]\n      },\n      geometry: {\n        type: \"MultiPolygon\",\n        coordinates: polygons\n      }\n    };\n    featureCollections.push({\n      type: \"FeatureCollection\",\n      features: [maskFeature]\n    });\n  });\n  return featureCollections;\n};\nconst polygonsEqual = (polygon1, polygon2) => {\n  if (!polygon1 || !polygon2) return false;\n  if (!polygon1.geometry || !polygon2.geometry) return false;\n  if (polygon1.geometry.type !== polygon2.geometry.type) return false;\n  if (polygon1.geometry.type === \"Polygon\" && polygon2.geometry.type === \"Polygon\") {\n    const poly1 = polygon1.geometry;\n    const poly2 = polygon2.geometry;\n    return JSON.stringify(poly1.coordinates) === JSON.stringify(poly2.coordinates);\n  }\n  return false;\n};\nconst utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n  __proto__: null,\n  detectionsToGeoJSON,\n  maskToGeoJSON,\n  parametersChanged,\n  polygonsEqual,\n  postProcessYoloOutput\n}, Symbol.toStringTag, { value: \"Module\" }));\nfunction feature(geom, properties, options = {}) {\n  const feat = { type: \"Feature\" };\n  if (options.id === 0 || options.id) {\n    feat.id = options.id;\n  }\n  if (options.bbox) {\n    feat.bbox = options.bbox;\n  }\n  feat.properties = properties || {};\n  feat.geometry = geom;\n  return feat;\n}\nfunction polygon(coordinates, properties, options = {}) {\n  for (const ring of coordinates) {\n    if (ring.length < 4) {\n      throw new Error(\n        \"Each LinearRing of a Polygon must have 4 or more Positions.\"\n      );\n    }\n    if (ring[ring.length - 1].length !== ring[0].length) {\n      throw new Error(\"First and last Position are not equivalent.\");\n    }\n    for (let j = 0; j < ring[ring.length - 1].length; j++) {\n      if (ring[ring.length - 1][j] !== ring[0][j]) {\n        throw new Error(\"First and last Position are not equivalent.\");\n      }\n    }\n  }\n  const geom = {\n    type: \"Polygon\",\n    coordinates\n  };\n  return feature(geom, properties, options);\n}\nfunction coordEach(geojson, callback, excludeWrapCoord) {\n  if (geojson === null) return;\n  var j, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === \"FeatureCollection\", isFeature = type === \"Feature\", stop = isFeatureCollection ? geojson.features.length : 1;\n  for (var featureIndex = 0; featureIndex < stop; featureIndex++) {\n    geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;\n    isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === \"GeometryCollection\" : false;\n    stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;\n    for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {\n      var multiFeatureIndex = 0;\n      var geometryIndex = 0;\n      geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;\n      if (geometry === null) continue;\n      coords = geometry.coordinates;\n      var geomType = geometry.type;\n      wrapShrink = 0;\n      switch (geomType) {\n        case null:\n          break;\n        case \"Point\":\n          if (callback(\n            coords,\n            coordIndex,\n            featureIndex,\n            multiFeatureIndex,\n            geometryIndex\n          ) === false)\n            return false;\n          coordIndex++;\n          multiFeatureIndex++;\n          break;\n        case \"LineString\":\n        case \"MultiPoint\":\n          for (j = 0; j < coords.length; j++) {\n            if (callback(\n              coords[j],\n              coordIndex,\n              featureIndex,\n              multiFeatureIndex,\n              geometryIndex\n            ) === false)\n              return false;\n            coordIndex++;\n            if (geomType === \"MultiPoint\") multiFeatureIndex++;\n          }\n          if (geomType === \"LineString\") multiFeatureIndex++;\n          break;\n        case \"Polygon\":\n        case \"MultiLineString\":\n          for (j = 0; j < coords.length; j++) {\n            for (k = 0; k < coords[j].length - wrapShrink; k++) {\n              if (callback(\n                coords[j][k],\n                coordIndex,\n                featureIndex,\n                multiFeatureIndex,\n                geometryIndex\n              ) === false)\n                return false;\n              coordIndex++;\n            }\n            if (geomType === \"MultiLineString\") multiFeatureIndex++;\n            if (geomType === \"Polygon\") geometryIndex++;\n          }\n          if (geomType === \"Polygon\") multiFeatureIndex++;\n          break;\n        case \"MultiPolygon\":\n          for (j = 0; j < coords.length; j++) {\n            geometryIndex = 0;\n            for (k = 0; k < coords[j].length; k++) {\n              for (l = 0; l < coords[j][k].length - wrapShrink; l++) {\n                if (callback(\n                  coords[j][k][l],\n                  coordIndex,\n                  featureIndex,\n                  multiFeatureIndex,\n                  geometryIndex\n                ) === false)\n                  return false;\n                coordIndex++;\n              }\n              geometryIndex++;\n            }\n            multiFeatureIndex++;\n          }\n          break;\n        case \"GeometryCollection\":\n          for (j = 0; j < geometry.geometries.length; j++)\n            if (coordEach(geometry.geometries[j], callback) === false)\n              return false;\n          break;\n        default:\n          throw new Error(\"Unknown Geometry Type\");\n      }\n    }\n  }\n}\nfunction bbox(geojson, options = {}) {\n  if (geojson.bbox != null && true !== options.recompute) {\n    return geojson.bbox;\n  }\n  const result = [Infinity, Infinity, -Infinity, -Infinity];\n  coordEach(geojson, (coord) => {\n    if (result[0] > coord[0]) {\n      result[0] = coord[0];\n    }\n    if (result[1] > coord[1]) {\n      result[1] = coord[1];\n    }\n    if (result[2] < coord[0]) {\n      result[2] = coord[0];\n    }\n    if (result[3] < coord[1]) {\n      result[3] = coord[1];\n    }\n  });\n  return result;\n}\nclass GeoRawImage extends RawImage {\n  constructor(data, width, height, channels, bounds, crs = \"EPSG:4326\") {\n    super(data, width, height, channels);\n    __publicField(this, \"bounds\");\n    __publicField(this, \"transform\");\n    __publicField(this, \"crs\");\n    this.bounds = bounds;\n    this.transform = {\n      a: (bounds.east - bounds.west) / width,\n      b: 0,\n      c: bounds.west,\n      d: 0,\n      e: -(bounds.north - bounds.south) / height,\n      f: bounds.north\n    };\n    this.crs = crs;\n  }\n  /**\n   * Convert the image into patches.\n   */\n  async toPatches(patch_height, patch_width, { padding = true } = {}) {\n    if (this.channels === 2) {\n      throw new Error(\n        \"Splitting into patches is not supported for 2-channel images.\"\n      );\n    }\n    const { height, width } = this;\n    const remainder_h = height % patch_height;\n    const remainder_w = width % patch_width;\n    const pad_h = remainder_h === 0 ? 0 : patch_height - remainder_h;\n    const pad_w = remainder_w === 0 ? 0 : patch_width - remainder_w;\n    let image = this;\n    if (padding && (pad_h > 0 || pad_w > 0)) {\n      image = await image.pad([0, pad_w, 0, pad_h]);\n    }\n    const padded_height = image.height;\n    const padded_width = image.width;\n    const patches = [];\n    for (let h_pixel_start = 0; h_pixel_start < padded_height; h_pixel_start += patch_height) {\n      const rowPatches = [];\n      for (let w_pixel_start = 0; w_pixel_start < padded_width; w_pixel_start += patch_width) {\n        const h_pixel_end = Math.min(h_pixel_start + patch_height, padded_height) - 1;\n        const w_pixel_end = Math.min(w_pixel_start + patch_width, padded_width) - 1;\n        const rawPatch = await image.crop([\n          w_pixel_start,\n          h_pixel_start,\n          w_pixel_end,\n          h_pixel_end\n        ]);\n        const [west, north] = this.pixelToWorld(w_pixel_start, h_pixel_start);\n        const [east, south] = this.pixelToWorld(\n          w_pixel_end + 1,\n          h_pixel_end + 1\n        );\n        const patchBounds = {\n          north,\n          south,\n          east,\n          west\n        };\n        const geoPatch = GeoRawImage.fromRawImage(\n          rawPatch,\n          patchBounds,\n          this.crs\n        );\n        rowPatches.push(geoPatch);\n      }\n      patches.push(rowPatches);\n    }\n    return patches;\n  }\n  /**\n   * Static function to join a 2D array of RawImage patches into a single GeoRawImage.\n   * This function assumes the patches are contiguous and form a complete grid.\n   * @param patches A 2D array of RawImage objects to be joined.\n   * @param bounds The bounds of the final, merged image.\n   * @param crs The Coordinate Reference System of the final, merged image.\n   * @returns A promise that resolves to a single GeoRawImage containing the joined data.\n   */\n  static fromPatches(patches, bounds, crs) {\n    if (!patches || patches.length === 0 || patches[0].length === 0) {\n      throw new Error(\"Input patches must be a non-empty 2D array.\");\n    }\n    const firstPatch = patches[0][0];\n    const channels = firstPatch.channels;\n    patches.forEach((row, i) => {\n      row.forEach((patch, j) => {\n        if (patch.channels !== channels) {\n          if (patch.channels === 4 && channels === 3) {\n            patch = patch.rgb();\n          } else {\n            throw new Error(\n              `All patches must have the same number of channels. Row: ${i}, Column: ${j}`\n            );\n          }\n        }\n      });\n    });\n    let totalWidth = 0;\n    let totalHeight = 0;\n    patches[0].forEach((patch) => totalWidth += patch.width);\n    patches.forEach((row) => totalHeight += row[0].height);\n    const mergedData = new Uint8ClampedArray(\n      totalWidth * totalHeight * channels\n    );\n    let currentHeightOffset = 0;\n    for (let i = 0; i < patches.length; i++) {\n      let currentWidthOffset = 0;\n      for (let j = 0; j < patches[i].length; j++) {\n        const patch = patches[i][j];\n        for (let y = 0; y < patch.height; y++) {\n          for (let x = 0; x < patch.width; x++) {\n            const patchIndex = (y * patch.width + x) * channels;\n            const mergedIndex = ((currentHeightOffset + y) * totalWidth + (currentWidthOffset + x)) * channels;\n            for (let c = 0; c < channels; c++) {\n              mergedData[mergedIndex + c] = patch.data[patchIndex + c];\n            }\n          }\n        }\n        currentWidthOffset += patch.width;\n      }\n      currentHeightOffset += patches[i][0].height;\n    }\n    return new GeoRawImage(\n      mergedData,\n      totalWidth,\n      totalHeight,\n      channels,\n      bounds,\n      crs\n    );\n  }\n  /**\n   * Convert pixel coordinates to world coordinates\n   */\n  pixelToWorld(x, y) {\n    const worldX = this.transform.a * x + this.transform.b * y + this.transform.c;\n    const worldY = this.transform.d * x + this.transform.e * y + this.transform.f;\n    return [worldX, worldY];\n  }\n  /**\n   * Convert world coordinates to pixel coordinates\n   */\n  worldToPixel(lon, lat) {\n    const det = this.transform.a * this.transform.e - this.transform.b * this.transform.d;\n    const x = (this.transform.e * (lon - this.transform.c) - this.transform.b * (lat - this.transform.f)) / det;\n    const y = (-this.transform.d * (lon - this.transform.c) + this.transform.a * (lat - this.transform.f)) / det;\n    return [Math.round(x), Math.round(y)];\n  }\n  /**\n   * Get the bounds of the image\n   */\n  getBounds() {\n    return { ...this.bounds };\n  }\n  /**\n   * Get the CRS of the image\n   */\n  getCRS() {\n    return this.crs;\n  }\n  /**\n   * Create a new GeoRawImage from a RawImage and georeferencing information\n   */\n  static fromRawImage(rawImage, bounds, crs = \"EPSG:4326\") {\n    return new GeoRawImage(\n      rawImage.data,\n      rawImage.width,\n      rawImage.height,\n      rawImage.channels,\n      bounds,\n      crs\n    );\n  }\n  /**\n   * Override the clone method to include georeferencing information\n   */\n  clone() {\n    return new GeoRawImage(\n      this.data.slice(),\n      this.width,\n      this.height,\n      this.channels,\n      { ...this.bounds },\n      this.crs\n    );\n  }\n}\nfunction bboxPolygon(bbox2, options = {}) {\n  const west = Number(bbox2[0]);\n  const south = Number(bbox2[1]);\n  const east = Number(bbox2[2]);\n  const north = Number(bbox2[3]);\n  if (bbox2.length === 6) {\n    throw new Error(\n      \"@turf/bbox-polygon does not support BBox with 6 positions\"\n    );\n  }\n  const lowLeft = [west, south];\n  const topLeft = [west, north];\n  const topRight = [east, north];\n  const lowRight = [east, south];\n  return polygon(\n    [[lowLeft, lowRight, topRight, topLeft, lowLeft]],\n    options.properties,\n    { bbox: bbox2, id: options.id }\n  );\n}\nvar originShift = 2 * Math.PI * 6378137 / 2;\nfunction initialResolution(tileSize) {\n  tileSize = tileSize || 256;\n  return 2 * Math.PI * 6378137 / tileSize;\n}\nfunction metersToLngLat(meters, decimal = 6) {\n  var x = meters[0];\n  var y = meters[1];\n  var lng = x / originShift * 180;\n  var lat = y / originShift * 180;\n  lat = 180 / Math.PI * (2 * Math.atan(Math.exp(lat * Math.PI / 180)) - Math.PI / 2);\n  if (decimal !== void 0 && decimal !== null) {\n    lng = Number(lng.toFixed(decimal));\n    lat = Number(lat.toFixed(decimal));\n  }\n  return [lng, lat];\n}\nfunction pixelsToMeters(pixels, tileSize, decimal = 1) {\n  var px = pixels[0];\n  var py = pixels[1];\n  var zoom = pixels[2];\n  var res = resolution(zoom, tileSize);\n  var mx = px * res - originShift;\n  var my = originShift - py * res;\n  if (decimal !== void 0 && decimal !== null) {\n    mx = Number(mx.toFixed(decimal));\n    my = Number(my.toFixed(decimal));\n  }\n  return [mx, my];\n}\nfunction tileToBBoxMeters(tile, tileSize, validate) {\n  validateTile(tile);\n  tileSize = tileSize || 256;\n  var tx = tile[0];\n  var ty = tile[1];\n  var zoom = tile[2];\n  var min = pixelsToMeters([tx * tileSize, ty * tileSize, zoom]);\n  var max = pixelsToMeters([(tx + 1) * tileSize, (ty + 1) * tileSize, zoom]);\n  return [min[0], min[1], max[0], max[1]];\n}\nfunction tileToBBox(tile, validate) {\n  validateTile(tile);\n  var tx = tile[0];\n  var ty = tile[1];\n  var zoom = tile[2];\n  if (zoom === 0) {\n    return [-180, -85.051129, 180, 85.051129];\n  }\n  var bbox2 = tileToBBoxMeters([tx, ty, zoom]);\n  var mx1 = bbox2[0];\n  var my1 = bbox2[1];\n  var mx2 = bbox2[2];\n  var my2 = bbox2[3];\n  var min = metersToLngLat([mx1, my1, zoom]);\n  var max = metersToLngLat([mx2, my2, zoom]);\n  return [min[0], min[1], max[0], max[1]];\n}\nfunction validateTile(tile, validate) {\n  var tx = tile[0];\n  var ty = tile[1];\n  var zoom = tile[2];\n  if (zoom === void 0 || zoom === null)\n    throw new Error(\"<zoom> is required\");\n  if (tx === void 0 || tx === null) throw new Error(\"<x> is required\");\n  if (ty === void 0 || ty === null) throw new Error(\"<y> is required\");\n  zoom = validateZoom(zoom);\n  tile = wrapTile(tile);\n  return tile;\n}\nfunction wrapTile(tile) {\n  var tx = tile[0];\n  var ty = tile[1];\n  var zoom = tile[2];\n  var maxTile = Math.pow(2, zoom);\n  tx = tx % maxTile;\n  if (tx < 0) tx = tx + maxTile;\n  return [tx, ty, zoom];\n}\nfunction validateZoom(zoom) {\n  if (zoom === false) return zoom;\n  if (zoom === void 0 || zoom === null) {\n    throw new Error(\"<zoom> is required\");\n  }\n  if (zoom < 0) {\n    throw new Error(\"<zoom> cannot be less than 0\");\n  }\n  if (zoom > 32) {\n    throw new Error(\"<zoom> cannot be greater than 32\");\n  }\n  return zoom;\n}\nfunction resolution(zoom, tileSize) {\n  return initialResolution(tileSize) / Math.pow(2, zoom);\n}\nvar ErrorType = /* @__PURE__ */ ((ErrorType2) => {\n  ErrorType2[\"MaximumTileCountExceeded\"] = \"MaximumTileCountExceeded\";\n  ErrorType2[\"UnknownTask\"] = \"UnknownTask\";\n  ErrorType2[\"MissingInputField\"] = \"MissingInputField\";\n  ErrorType2[\"ImageLoadFailed\"] = \"ImageLoadFailed\";\n  return ErrorType2;\n})(ErrorType || {});\nconst ErrorCodes = {\n  [\n    \"MaximumTileCountExceeded\"\n    /* MaximumTileCountExceeded */\n  ]: 1001,\n  [\n    \"UnknownTask\"\n    /* UnknownTask */\n  ]: 1002,\n  [\n    \"MissingInputField\"\n    /* MissingInputField */\n  ]: 1003,\n  [\n    \"ImageLoadFailed\"\n    /* ImageLoadFailed */\n  ]: 1004\n  // Add more error codes here as needed\n};\nclass GeobaseError extends Error {\n  constructor(type, message) {\n    super(message || type);\n    __publicField(this, \"type\");\n    __publicField(this, \"code\");\n    this.type = type;\n    this.code = ErrorCodes[type];\n    this.name = \"GeobaseError\";\n  }\n}\nconst latLngToTileXY = (lat, lng, zoom) => {\n  const n = Math.pow(2, zoom);\n  const x = Math.floor((lng + 180) / 360 * n);\n  const y = Math.floor(\n    (1 - Math.log(\n      Math.tan(lat * Math.PI / 180) + 1 / Math.cos(lat * Math.PI / 180)\n    ) / Math.PI) / 2 * n\n  );\n  return { x, y };\n};\nconst calculateTilesForBbox = (bbox2, mercatorTileURLGetter, zoom, instance, bands, expression, square = false) => {\n  const [minLng, minLat, maxLng, maxLat] = bbox2;\n  const topLeft = latLngToTileXY(maxLat, minLng, zoom);\n  const bottomRight = latLngToTileXY(minLat, maxLng, zoom);\n  const xTilesCount = bottomRight.x - topLeft.x + 1;\n  const yTilesCount = bottomRight.y - topLeft.y + 1;\n  if (square && xTilesCount !== yTilesCount) {\n    if (xTilesCount > yTilesCount) {\n      const yChange = xTilesCount - yTilesCount;\n      topLeft.y = topLeft.y - Math.floor(yChange / 2);\n      bottomRight.y = bottomRight.y + Math.floor(yChange / 2);\n      if (yChange % 2 !== 0) {\n        bottomRight.y = bottomRight.y + 1;\n      }\n    } else if (yTilesCount > xTilesCount) {\n      const xChange = yTilesCount - xTilesCount;\n      topLeft.x = topLeft.x - Math.floor(xChange / 2);\n      bottomRight.x = bottomRight.x + Math.floor(xChange / 2);\n      if (xChange % 2 !== 0) {\n        bottomRight.x = bottomRight.x + 1;\n      }\n    }\n  }\n  const tiles = [];\n  for (let y = topLeft.y; y <= bottomRight.y; y++) {\n    const row = [];\n    for (let x = topLeft.x; x <= bottomRight.x; x++) {\n      row.push({\n        tile: [x, y, zoom],\n        tileUrl: mercatorTileURLGetter(\n          [x, y, zoom],\n          instance,\n          bands,\n          expression\n        ),\n        tileGeoJson: bboxPolygon(tileToBBox([x, y, zoom]))\n      });\n    }\n    tiles.push(row);\n  }\n  return tiles;\n};\nconst getImageFromTiles = async (tilesGrid, stitch = true) => {\n  const MAX_TILE_COUNT = 100;\n  if (tilesGrid.length * tilesGrid[0].length > MAX_TILE_COUNT) {\n    throw new GeobaseError(\n      ErrorType.MaximumTileCountExceeded,\n      `Requested ${tilesGrid.length * tilesGrid[0].length} tiles, which exceeds the maximum allowed (${MAX_TILE_COUNT}).`\n    );\n  }\n  const tileUrlsGrid = tilesGrid.map(\n    (row) => row.map((tile) => tile.tileUrl)\n  );\n  const tileImages = await Promise.all(\n    tileUrlsGrid.map(\n      (row) => Promise.all(row.map(async (url) => await load_image(url)))\n    )\n  );\n  const cornerTiles = [\n    tilesGrid[0][0],\n    // Top-left\n    tilesGrid[0][tilesGrid[0].length - 1],\n    // Top-right\n    tilesGrid[tilesGrid.length - 1][0],\n    // Bottom-left\n    tilesGrid[tilesGrid.length - 1][tilesGrid[0].length - 1]\n    // Bottom-right\n  ];\n  const bounds = {\n    north: Math.max(\n      ...cornerTiles.map((tile) => tile.tileGeoJson.bbox[1])\n    ),\n    south: Math.min(\n      ...cornerTiles.map((tile) => tile.tileGeoJson.bbox[3])\n    ),\n    east: Math.max(...cornerTiles.map((tile) => tile.tileGeoJson.bbox[2])),\n    west: Math.min(...cornerTiles.map((tile) => tile.tileGeoJson.bbox[0]))\n  };\n  if (stitch) {\n    return GeoRawImage.fromPatches(tileImages, bounds, \"EPSG:4326\");\n  }\n  const geoRawImages = tilesGrid.map(\n    (row, rowIndex) => row.map((tile, colIndex) => {\n      const tileBounds = {\n        north: tile.tileGeoJson.bbox[1],\n        south: tile.tileGeoJson.bbox[3],\n        east: tile.tileGeoJson.bbox[2],\n        west: tile.tileGeoJson.bbox[0]\n      };\n      return GeoRawImage.fromRawImage(\n        tileImages[rowIndex][colIndex],\n        tileBounds,\n        \"EPSG:4326\"\n      );\n    })\n  );\n  return geoRawImages;\n};\nconst addChain$1 = (receiver) => Object.defineProperty(receiver.prototype, \"chain\", {\n  value: function(intercept) {\n    let val = this.valueOf ? this.valueOf() : this;\n    return intercept(val);\n  },\n  enumerable: false,\n  configurable: true,\n  writable: true\n});\n[Object, String, Number, Boolean].map((receiver) => {\n  addChain$1(receiver);\n});\nclass MapSource {\n  async getImage(polygon2, bands, expression, zoomLevel, requiresSquare = false, stitch = true) {\n    const bbox$1 = bbox(polygon2);\n    const initialSearchZoom = 22;\n    if (zoomLevel) {\n      const tilesGrid2 = calculateTilesForBbox(\n        bbox$1,\n        this.getTileUrlFromTileCoords,\n        zoomLevel,\n        this,\n        bands,\n        expression,\n        requiresSquare\n      );\n      return await getImageFromTiles(tilesGrid2, stitch);\n    }\n    let zoom = initialSearchZoom;\n    let tilesGrid = calculateTilesForBbox(\n      bbox$1,\n      this.getTileUrlFromTileCoords,\n      zoom,\n      this,\n      bands,\n      expression,\n      requiresSquare\n    );\n    let xTileNum = tilesGrid[0].length;\n    let yTileNum = tilesGrid.length;\n    while (xTileNum > 2 && yTileNum > 2) {\n      zoom--;\n      tilesGrid = calculateTilesForBbox(\n        bbox$1,\n        this.getTileUrlFromTileCoords,\n        zoom,\n        this,\n        bands,\n        expression,\n        requiresSquare\n      );\n      xTileNum = tilesGrid[0].length;\n      yTileNum = tilesGrid.length;\n    }\n    return await getImageFromTiles(tilesGrid, stitch);\n  }\n}\nclass Mapbox extends MapSource {\n  constructor(apiKey, style) {\n    super();\n    __publicField(this, \"apiKey\");\n    __publicField(this, \"style\");\n    this.apiKey = apiKey;\n    this.style = style;\n  }\n  getTileUrlFromTileCoords(tileCoords, instance) {\n    const [x, y, z] = tileCoords;\n    return `https://api.mapbox.com/v4/mapbox.satellite/${z}/${x}/${y}.png?access_token=${instance.apiKey}`;\n  }\n}\nconst addChain = (receiver) => Object.defineProperty(receiver.prototype, \"chain\", {\n  value: function(intercept) {\n    let val = this.valueOf ? this.valueOf() : this;\n    return intercept(val);\n  },\n  enumerable: false,\n  configurable: true,\n  writable: true\n});\n[Object, String, Number, Boolean].map((receiver) => {\n  addChain(receiver);\n});\nclass Geobase extends MapSource {\n  constructor(config) {\n    super();\n    __publicField(this, \"projectRef\");\n    __publicField(this, \"cogImagery\");\n    __publicField(this, \"apikey\");\n    this.projectRef = config.projectRef;\n    this.cogImagery = config.cogImagery;\n    this.apikey = config.apikey;\n  }\n  getTileUrlFromTileCoords(tileCoords, instance, bands, expression) {\n    const [x, y, z] = tileCoords;\n    let baseUrl = `https://${instance.projectRef}.geobase.app/titiler/v1/cog/tiles/WebMercatorQuad/${z}/${x}/${y}?url=${instance.cogImagery}&apikey=${instance.apikey}`;\n    if (bands && Array.isArray(bands) && bands.length > 0) {\n      baseUrl += bands.map((b) => `&bidx=${b}`).join(\"\");\n    }\n    if (expression && typeof expression === \"string\") {\n      expression = encodeURIComponent(expression);\n      baseUrl += `&expression=${expression}`;\n    }\n    return baseUrl;\n  }\n}\nclass Esri extends MapSource {\n  constructor(config) {\n    super();\n    __publicField(this, \"serviceUrl\");\n    __publicField(this, \"serviceName\");\n    __publicField(this, \"tileSize\");\n    __publicField(this, \"attribution\");\n    this.serviceUrl = config.serviceUrl || \"https://server.arcgisonline.com/ArcGIS/rest/services\";\n    this.serviceName = config.serviceName || \"World_Imagery\";\n    this.tileSize = config.tileSize || 256;\n    this.attribution = config.attribution || \"ESRI World Imagery\";\n  }\n  getTileUrlFromTileCoords(tileCoords, instance) {\n    const [x, y, z] = tileCoords;\n    return `${instance.serviceUrl}/${instance.serviceName}/MapServer/tile/${z}/${y}/${x}`;\n  }\n}\nclass Tms extends MapSource {\n  constructor(config) {\n    super();\n    __publicField(this, \"baseUrl\");\n    __publicField(this, \"extension\");\n    __publicField(this, \"apiKey\");\n    __publicField(this, \"attribution\");\n    __publicField(this, \"tileSize\");\n    __publicField(this, \"headers\");\n    __publicField(this, \"scheme\");\n    this.baseUrl = config.baseUrl;\n    this.extension = config.extension || \"png\";\n    this.apiKey = config.apiKey;\n    this.attribution = config.attribution || \"TMS Provider\";\n    this.tileSize = config.tileSize || 256;\n    this.headers = config.headers;\n    this.scheme = config.scheme || \"WebMercator\";\n  }\n  getTileUrlFromTileCoords(tileCoords, instance) {\n    const [x, originalY, z] = tileCoords;\n    const y = instance.scheme === \"TMS\" ? Math.pow(2, z) - 1 - originalY : originalY;\n    let url;\n    if (instance.baseUrl.includes(\"{x}\") || instance.baseUrl.includes(\"{y}\") || instance.baseUrl.includes(\"{z}\")) {\n      url = instance.baseUrl.replaceAll(\"{z}\", z.toString()).replaceAll(\"{x}\", x.toString()).replaceAll(\"{y}\", y.toString());\n    } else {\n      url = `${instance.baseUrl}/${z}/${x}/${y}.${instance.extension}`;\n    }\n    if (instance.apiKey) {\n      url += `?apikey=${instance.apiKey}`;\n    }\n    return url;\n  }\n}\nfunction formatWmsBbox(bbox2, crs, version) {\n  const [minX, minY, maxX, maxY] = bbox2;\n  if (version === \"1.3.0\" && crs === \"EPSG:4326\") {\n    return `${minY},${minX},${maxY},${maxX}`;\n  }\n  return `${minX},${minY},${maxX},${maxY}`;\n}\nfunction getTileBbox(tileCoords, crs, tileSize) {\n  const [x, y, z] = tileCoords;\n  if (crs === \"EPSG:3857\") {\n    const toMeters = pixelsToMeters;\n    const min = toMeters([x * tileSize, y * tileSize, z], tileSize);\n    const max = toMeters([(x + 1) * tileSize, (y + 1) * tileSize, z], tileSize);\n    return [\n      Math.min(min[0], max[0]),\n      Math.min(min[1], max[1]),\n      Math.max(min[0], max[0]),\n      Math.max(min[1], max[1])\n    ];\n  }\n  return tileToBBox(tileCoords);\n}\nfunction buildWmsGetMapUrl(config, tileCoords) {\n  const version = config.version ?? \"1.1.1\";\n  const crs = config.crs ?? \"EPSG:3857\";\n  const tileSize = config.tileSize ?? 256;\n  const bbox2 = getTileBbox(tileCoords, crs, tileSize);\n  const bboxParam = formatWmsBbox(bbox2, crs, version);\n  const params = {\n    SERVICE: \"WMS\",\n    REQUEST: \"GetMap\",\n    VERSION: version,\n    LAYERS: config.layers,\n    STYLES: config.styles ?? \"\",\n    FORMAT: config.format ?? \"image/png\",\n    WIDTH: tileSize.toString(),\n    HEIGHT: tileSize.toString(),\n    BBOX: bboxParam,\n    ...version === \"1.3.0\" ? { CRS: crs } : { SRS: crs },\n    ...config.transparent ? { TRANSPARENT: \"TRUE\" } : {},\n    ...config.extraParams ?? {}\n  };\n  const url = new URL(config.baseUrl);\n  for (const [key, value] of Object.entries(params)) {\n    url.searchParams.set(key, value);\n  }\n  return url.toString();\n}\nclass Wms extends MapSource {\n  constructor(config) {\n    super();\n    __publicField(this, \"baseUrl\");\n    __publicField(this, \"layers\");\n    __publicField(this, \"version\");\n    __publicField(this, \"crs\");\n    __publicField(this, \"format\");\n    __publicField(this, \"styles\");\n    __publicField(this, \"transparent\");\n    __publicField(this, \"attribution\");\n    __publicField(this, \"tileSize\");\n    __publicField(this, \"headers\");\n    __publicField(this, \"extraParams\");\n    this.baseUrl = config.baseUrl;\n    this.layers = config.layers;\n    this.version = config.version ?? \"1.1.1\";\n    this.crs = config.crs ?? \"EPSG:3857\";\n    this.format = config.format ?? \"image/png\";\n    this.styles = config.styles ?? \"\";\n    this.transparent = config.transparent ?? false;\n    this.attribution = config.attribution ?? \"WMS Provider\";\n    this.tileSize = config.tileSize ?? 256;\n    this.headers = config.headers;\n    this.extraParams = config.extraParams;\n  }\n  getTileUrlFromTileCoords(tileCoords, instance) {\n    return buildWmsGetMapUrl(\n      {\n        baseUrl: instance.baseUrl,\n        layers: instance.layers,\n        version: instance.version,\n        crs: instance.crs,\n        format: instance.format,\n        styles: instance.styles,\n        transparent: instance.transparent,\n        tileSize: instance.tileSize,\n        extraParams: instance.extraParams\n      },\n      tileCoords\n    );\n  }\n}\nconst DEFAULT_OAM_STAC_URL = \"https://api.imagery.hotosm.org/stac\";\nconst DEFAULT_OAM_RASTER_URL = \"https://api.imagery.hotosm.org/raster\";\nconst DEFAULT_OAM_COLLECTION = \"openaerialmap\";\nconst DEFAULT_OAM_ASSET = \"visual\";\nfunction buildOamMosaicTileUrlTemplate(rasterUrl = DEFAULT_OAM_RASTER_URL, collection = DEFAULT_OAM_COLLECTION, asset = DEFAULT_OAM_ASSET) {\n  const base = rasterUrl.replace(/\\/$/, \"\");\n  return `${base}/collections/${encodeURIComponent(collection)}/tiles/WebMercatorQuad/{z}/{x}/{y}?assets=${encodeURIComponent(asset)}`;\n}\nfunction buildOamItemTileUrlTemplate(itemId, rasterUrl = DEFAULT_OAM_RASTER_URL, collection = DEFAULT_OAM_COLLECTION, asset = DEFAULT_OAM_ASSET) {\n  const base = rasterUrl.replace(/\\/$/, \"\");\n  return `${base}/collections/${encodeURIComponent(collection)}/items/${encodeURIComponent(itemId)}/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?assets=${encodeURIComponent(asset)}`;\n}\nfunction pickBestOamItem(features) {\n  if (!features.length) return void 0;\n  return features.slice().sort((a, b) => {\n    var _a, _b, _c, _d, _e, _f;\n    const gsdA = typeof ((_a = a.properties) == null ? void 0 : _a.gsd) === \"number\" ? a.properties.gsd : Number.POSITIVE_INFINITY;\n    const gsdB = typeof ((_b = b.properties) == null ? void 0 : _b.gsd) === \"number\" ? b.properties.gsd : Number.POSITIVE_INFINITY;\n    if (gsdA !== gsdB) return gsdA - gsdB;\n    const dateA = Date.parse(\n      String(((_c = a.properties) == null ? void 0 : _c.created) || ((_d = a.properties) == null ? void 0 : _d.datetime) || 0)\n    );\n    const dateB = Date.parse(\n      String(((_e = b.properties) == null ? void 0 : _e.created) || ((_f = b.properties) == null ? void 0 : _f.datetime) || 0)\n    );\n    return dateB - dateA;\n  })[0];\n}\nasync function searchOamItems(bbox2, options = {}) {\n  const stacUrl = (options.stacUrl || DEFAULT_OAM_STAC_URL).replace(/\\/$/, \"\");\n  const collection = options.collection || DEFAULT_OAM_COLLECTION;\n  const limit = options.limit ?? 10;\n  const fetchImpl = options.fetchImpl || fetch;\n  const response = await fetchImpl(`${stacUrl}/search`, {\n    method: \"POST\",\n    headers: {\n      \"Content-Type\": \"application/json\",\n      Accept: \"application/geo+json\",\n      ...options.headers || {}\n    },\n    body: JSON.stringify({\n      collections: [collection],\n      bbox: bbox2,\n      limit\n    })\n  });\n  if (!response.ok) {\n    const body = await response.text().catch(() => \"\");\n    throw new Error(\n      `OAM STAC search failed (${response.status}): ${body || response.statusText}`\n    );\n  }\n  const data = await response.json();\n  return data.features || [];\n}\nclass Oam extends MapSource {\n  constructor(config = {}) {\n    super();\n    __publicField(this, \"stacUrl\");\n    __publicField(this, \"rasterUrl\");\n    __publicField(this, \"collection\");\n    __publicField(this, \"asset\");\n    __publicField(this, \"itemId\");\n    __publicField(this, \"mosaic\");\n    __publicField(this, \"attribution\");\n    __publicField(this, \"tileSize\");\n    __publicField(this, \"headers\");\n    /** Resolved XYZ template with `{z}/{x}/{y}` placeholders. */\n    __publicField(this, \"tileUrlTemplate\");\n    __publicField(this, \"resolvedForBboxKey\");\n    this.stacUrl = (config.stacUrl || DEFAULT_OAM_STAC_URL).replace(/\\/$/, \"\");\n    this.rasterUrl = (config.rasterUrl || DEFAULT_OAM_RASTER_URL).replace(\n      /\\/$/,\n      \"\"\n    );\n    this.collection = config.collection || DEFAULT_OAM_COLLECTION;\n    this.asset = config.asset || DEFAULT_OAM_ASSET;\n    this.itemId = config.itemId;\n    this.mosaic = config.mosaic === true;\n    this.attribution = config.attribution || \"OpenAerialMap / HOT Imagery\";\n    this.tileSize = config.tileSize || 256;\n    this.headers = config.headers;\n    if (this.itemId) {\n      this.tileUrlTemplate = buildOamItemTileUrlTemplate(\n        this.itemId,\n        this.rasterUrl,\n        this.collection,\n        this.asset\n      );\n    } else if (this.mosaic) {\n      this.tileUrlTemplate = buildOamMosaicTileUrlTemplate(\n        this.rasterUrl,\n        this.collection,\n        this.asset\n      );\n    } else {\n      this.tileUrlTemplate = buildOamMosaicTileUrlTemplate(\n        this.rasterUrl,\n        this.collection,\n        this.asset\n      );\n    }\n  }\n  /**\n   * Resolve tile URL template for an AOI via STAC (unless mosaic/itemId pin).\n   */\n  async resolveTileTemplate(polygon2) {\n    if (this.itemId) {\n      this.tileUrlTemplate = buildOamItemTileUrlTemplate(\n        this.itemId,\n        this.rasterUrl,\n        this.collection,\n        this.asset\n      );\n      return this.tileUrlTemplate;\n    }\n    if (this.mosaic) {\n      this.tileUrlTemplate = buildOamMosaicTileUrlTemplate(\n        this.rasterUrl,\n        this.collection,\n        this.asset\n      );\n      return this.tileUrlTemplate;\n    }\n    const bbox$1 = bbox(polygon2);\n    const bboxKey = bbox$1.map((n) => n.toFixed(6)).join(\",\");\n    if (this.resolvedForBboxKey === bboxKey && this.tileUrlTemplate) {\n      return this.tileUrlTemplate;\n    }\n    const features = await searchOamItems(bbox$1, {\n      stacUrl: this.stacUrl,\n      collection: this.collection,\n      headers: this.headers\n    });\n    const best = pickBestOamItem(features);\n    if (best == null ? void 0 : best.id) {\n      this.itemId = best.id;\n      this.tileUrlTemplate = buildOamItemTileUrlTemplate(\n        best.id,\n        this.rasterUrl,\n        this.collection,\n        this.asset\n      );\n    } else {\n      this.tileUrlTemplate = buildOamMosaicTileUrlTemplate(\n        this.rasterUrl,\n        this.collection,\n        this.asset\n      );\n    }\n    this.resolvedForBboxKey = bboxKey;\n    return this.tileUrlTemplate;\n  }\n  async getImage(polygon2, bands, expression, zoomLevel, requiresSquare = false, stitch = true) {\n    await this.resolveTileTemplate(polygon2);\n    return super.getImage(\n      polygon2,\n      bands,\n      expression,\n      zoomLevel,\n      requiresSquare,\n      stitch\n    );\n  }\n  getTileUrlFromTileCoords(tileCoords, instance) {\n    const [x, y, z] = tileCoords;\n    return instance.tileUrlTemplate.replaceAll(\"{z}\", z.toString()).replaceAll(\"{x}\", x.toString()).replaceAll(\"{y}\", y.toString());\n  }\n}\nclass BaseModel {\n  constructor(model_id, providerParams, modelParams) {\n    __publicField(this, \"providerParams\");\n    __publicField(this, \"dataProvider\");\n    __publicField(this, \"model_id\");\n    __publicField(this, \"initialized\", false);\n    __publicField(this, \"modelParams\");\n    this.model_id = model_id;\n    this.providerParams = providerParams;\n    this.modelParams = modelParams;\n  }\n  async initialize() {\n    if (this.initialized) return;\n    this.initializeDataProvider();\n    if (!this.dataProvider) {\n      throw new Error(\"Failed to initialize data provider\");\n    }\n    await this.initializeModel();\n    this.initialized = true;\n  }\n  initializeDataProvider() {\n    switch (this.providerParams.provider) {\n      case \"mapbox\":\n        this.dataProvider = new Mapbox(\n          this.providerParams.apiKey,\n          this.providerParams.style\n        );\n        break;\n      case \"geobase\":\n        this.dataProvider = new Geobase({\n          projectRef: this.providerParams.projectRef,\n          cogImagery: this.providerParams.cogImagery,\n          apikey: this.providerParams.apikey\n        });\n        break;\n      case \"esri\":\n        this.dataProvider = new Esri({\n          serviceUrl: this.providerParams.serviceUrl,\n          serviceName: this.providerParams.serviceName,\n          tileSize: this.providerParams.tileSize,\n          attribution: this.providerParams.attribution\n        });\n        break;\n      case \"tms\":\n        this.dataProvider = new Tms({\n          baseUrl: this.providerParams.baseUrl,\n          extension: this.providerParams.extension,\n          apiKey: this.providerParams.apiKey,\n          attribution: this.providerParams.attribution,\n          tileSize: this.providerParams.tileSize,\n          headers: this.providerParams.headers,\n          scheme: this.providerParams.scheme\n        });\n        break;\n      case \"wms\":\n        this.dataProvider = new Wms({\n          baseUrl: this.providerParams.baseUrl,\n          layers: this.providerParams.layers,\n          version: this.providerParams.version,\n          crs: this.providerParams.crs,\n          format: this.providerParams.format,\n          styles: this.providerParams.styles,\n          transparent: this.providerParams.transparent,\n          attribution: this.providerParams.attribution,\n          tileSize: this.providerParams.tileSize,\n          headers: this.providerParams.headers,\n          extraParams: this.providerParams.extraParams\n        });\n        break;\n      case \"oam\":\n        this.dataProvider = new Oam({\n          stacUrl: this.providerParams.stacUrl,\n          rasterUrl: this.providerParams.rasterUrl,\n          collection: this.providerParams.collection,\n          asset: this.providerParams.asset,\n          itemId: this.providerParams.itemId,\n          mosaic: this.providerParams.mosaic,\n          attribution: this.providerParams.attribution,\n          tileSize: this.providerParams.tileSize,\n          headers: this.providerParams.headers\n        });\n        break;\n      case \"sentinel\":\n        throw new Error(\"Sentinel provider not implemented yet\");\n      default:\n        throw new Error(\n          `Unknown provider: ${this.providerParams.provider}`\n        );\n    }\n  }\n  /**\n   * Converts a GeoJSON polygon feature into a GeoRawImage using the configured data provider.\n   *\n   * @param polygon - The GeoJSON Feature representing the area of interest.\n   * @param zoomLevel - (Optional) The zoom level to use when retrieving the image.\n   * @param bands - (Optional) An array of band indices to select specific bands from the imagery.\n   * @param expression - (Optional) A string expression to apply to the image bands (e.g., for band math).\n   * @param requiresSquare - (default false) Whether to return a square image.\n   * @returns A Promise that resolves to a GeoRawImage corresponding to the input polygon.\n   * @throws {Error} If the data provider is not initialized.\n   */\n  async polygonToImage(polygon2, zoomLevel, bands, expression, requiresSquare = true, stitch = true) {\n    if (!this.dataProvider) {\n      throw new Error(\"Data provider not initialized\");\n    }\n    console.log(\"Converting polygon to image...\");\n    return this.dataProvider.getImage(\n      polygon2,\n      bands,\n      expression,\n      zoomLevel,\n      requiresSquare,\n      stitch\n    );\n  }\n}\n__publicField(BaseModel, \"instance\", null);\nconst _ZeroShotObjectDetection = class _ZeroShotObjectDetection extends BaseModel {\n  constructor(model_id, providerParams, modelParams) {\n    super(model_id, providerParams, modelParams);\n    __publicField(this, \"detector\");\n    __publicField(this, \"rawDetections\", []);\n  }\n  static async getInstance(model_id, providerParams, modelParams) {\n    if (!_ZeroShotObjectDetection.instance || parametersChanged(\n      _ZeroShotObjectDetection.instance,\n      model_id,\n      providerParams,\n      modelParams\n    )) {\n      _ZeroShotObjectDetection.instance = new _ZeroShotObjectDetection(\n        model_id,\n        providerParams,\n        modelParams\n      );\n      await _ZeroShotObjectDetection.instance.initialize();\n    }\n    return { instance: _ZeroShotObjectDetection.instance };\n  }\n  async initializeModel() {\n    this.detector = await pipeline(\n      \"zero-shot-object-detection\",\n      this.model_id,\n      this.modelParams\n    );\n  }\n  /**\n   * Performs object detection on a geographic area using a zero-shot learning model\n   * @param polygon - A GeoJSON Feature representing the geographic area to analyze\n   * @param text - Label or array of labels to detect in the image\n   * @param options - Detection configuration options\n   * @param options.topk - Maximum number of detections to return (default: 4)\n   * @param options.threshold - Confidence threshold for detections (default: 0.2)\n   * @returns Promise resolving to object detection results containing GeoJSON features and raw image data\n   * @throws Error if data provider is not initialized\n   */\n  async inference(params) {\n    const {\n      inputs: { polygon: polygon2, classLabel: text },\n      postProcessingParams: { threshold = 0.2, topk = 4 } = {},\n      mapSourceParams\n    } = params;\n    if (!polygon2) {\n      throw new Error(\"Polygon input is required for segmentation\");\n    }\n    if (!polygon2.geometry || polygon2.geometry.type !== \"Polygon\") {\n      throw new Error(\"Input must be a valid GeoJSON Polygon feature\");\n    }\n    if (!this.initialized) {\n      await this.initialize();\n    }\n    const geoRawImage = await this.polygonToImage(\n      polygon2,\n      mapSourceParams == null ? void 0 : mapSourceParams.zoomLevel,\n      mapSourceParams == null ? void 0 : mapSourceParams.bands,\n      mapSourceParams == null ? void 0 : mapSourceParams.expression\n    );\n    const inferenceStartTime = performance.now();\n    console.log(\"[zero-shot-object-detection] starting inference...\");\n    let outputs;\n    try {\n      const candidate_labels = Array.isArray(text) ? text : [text];\n      outputs = await this.detector(geoRawImage, candidate_labels, {\n        topk,\n        threshold\n      });\n    } catch (error) {\n      console.debug(\"error\", error);\n      throw error;\n    }\n    this.rawDetections = outputs;\n    const detectionsGeoJson = detectionsToGeoJSON(outputs, geoRawImage);\n    const inferenceEndTime = performance.now();\n    console.log(\n      `[zero-shot-object-detection] inference completed. Time taken: ${(inferenceEndTime - inferenceStartTime).toFixed(2)}ms`\n    );\n    return {\n      detections: detectionsGeoJson,\n      geoRawImage\n    };\n  }\n};\n__publicField(_ZeroShotObjectDetection, \"instance\", null);\nlet ZeroShotObjectDetection = _ZeroShotObjectDetection;\nconst getOppositePoints = (coordinates) => {\n  if (!Array.isArray(coordinates) || coordinates.length < 4) {\n    throw new Error(\"Input must be an array of at least 4 coordinate pairs\");\n  }\n  const uniquePoints = coordinates.slice(0, 4);\n  let minLng = uniquePoints[0][0];\n  let maxLng = uniquePoints[0][0];\n  let minLat = uniquePoints[0][1];\n  let maxLat = uniquePoints[0][1];\n  for (let i = 1; i < uniquePoints.length; i++) {\n    const [lng, lat] = uniquePoints[i];\n    minLng = Math.min(minLng, lng);\n    maxLng = Math.max(maxLng, lng);\n    minLat = Math.min(minLat, lat);\n    maxLat = Math.max(maxLat, lat);\n  }\n  return [\n    [minLng, maxLat],\n    // Southwest corner (min longitude, max latitude)\n    [maxLng, minLat]\n    // Northeast corner (max longitude, min latitude)\n  ];\n};\nconst _MaskGeneration = class _MaskGeneration extends BaseModel {\n  constructor(model_id, providerParams, modelParams) {\n    super(model_id, providerParams, modelParams);\n    __publicField(this, \"model\");\n    __publicField(this, \"processor\");\n    // Cache for embeddings to avoid recomputation\n    __publicField(this, \"cachedPolygon\", null);\n    __publicField(this, \"cachedEmbeddings\", null);\n    __publicField(this, \"cachedGeoRawImage\", null);\n  }\n  static async getInstance(model_id, providerParams, modelParams) {\n    if (!_MaskGeneration.instance || parametersChanged(\n      _MaskGeneration.instance,\n      model_id,\n      providerParams,\n      modelParams\n    )) {\n      _MaskGeneration.instance = new _MaskGeneration(\n        model_id,\n        providerParams,\n        modelParams\n      );\n      await _MaskGeneration.instance.initialize();\n    }\n    return { instance: _MaskGeneration.instance };\n  }\n  async initializeModel() {\n    this.model = await SamModel.from_pretrained(\n      this.model_id,\n      this.modelParams\n    );\n    this.processor = await AutoProcessor.from_pretrained(\n      this.model_id,\n      {}\n    );\n  }\n  /**\n   * Gets or computes image embeddings for the given polygon\n   * Uses cached embeddings if polygon hasn't changed\n   */\n  async getOrComputeEmbeddings(polygon2, geoRawImage, zoomLevel, bands, expression) {\n    if (!this.model || !this.processor) {\n      throw new Error(\"Model or processor not initialized\");\n    }\n    if (!this.dataProvider) {\n      throw new Error(\"Data provider not initialized\");\n    }\n    let image_inputs = null;\n    if (this.cachedPolygon && this.cachedEmbeddings && this.cachedGeoRawImage && polygonsEqual(this.cachedPolygon, polygon2)) {\n      image_inputs = await this.processor(this.cachedGeoRawImage);\n      console.log(\"Using cached embeddings for polygon:\", polygon2);\n      return {\n        image_embeddings: this.cachedEmbeddings,\n        geoRawImage: this.cachedGeoRawImage,\n        image_inputs\n      };\n    }\n    console.log(\n      \"Cached embeddings not found or polygon changed, recomputing...\"\n    );\n    if (!geoRawImage) {\n      geoRawImage = await this.polygonToImage(\n        polygon2,\n        zoomLevel,\n        bands,\n        expression\n      );\n    }\n    image_inputs = await this.processor(geoRawImage);\n    const image_embeddings = await this.model.get_image_embeddings(image_inputs);\n    this.cachedPolygon = JSON.parse(JSON.stringify(polygon2));\n    this.cachedEmbeddings = image_embeddings;\n    this.cachedGeoRawImage = geoRawImage;\n    return { image_embeddings, geoRawImage, image_inputs };\n  }\n  /**\n   * Performs segmentation on a geographic area based on the provided input parameters.\n   *\n   * @param params - Inference parameters containing:\n   *                - inputs: Object containing polygon and segmentation input\n   *                - postProcessingParams: Optional parameters for post-processing\n   *                - mapSourceParams: Optional parameters for map source configuration\n   *\n   * @returns Promise<SegmentationResult> containing:\n   *          - masks: GeoJSON representation of the segmentation masks\n   *          - geoRawImage: Raw image data with geographic reference\n   *\n   * @throws {Error} If data provider is not initialized\n   * @throws {Error} If model or processor is not initialized\n   * @throws {Error} If segmentation process fails\n   * @throws {Error} If input type is not supported\n   */\n  async inference(params) {\n    const {\n      inputs: { polygon: polygon2, input },\n      postProcessingParams: { maxMasks = 1 } = {},\n      mapSourceParams\n    } = params;\n    if (!polygon2) {\n      throw new Error(\"Polygon input is required for segmentation\");\n    }\n    if (!polygon2.geometry || polygon2.geometry.type !== \"Polygon\") {\n      throw new Error(\"Input must be a valid GeoJSON Polygon feature\");\n    }\n    const isChained = input.detections !== void 0;\n    if (!this.initialized) {\n      await this.initialize();\n    }\n    if (!this.dataProvider) {\n      throw new Error(\"Data provider not initialized\");\n    }\n    let geoRawImage = isChained ? input.geoRawImage : void 0;\n    const batch_input = isChained ? input.detections.features.map((feature2) => {\n      let coordinates;\n      if (feature2.geometry.type === \"Polygon\" && Array.isArray(feature2.geometry.coordinates)) {\n        coordinates = feature2.geometry.coordinates[0];\n      } else {\n        throw new Error(\"Geometry type must be Polygon with coordinates\");\n      }\n      if (coordinates.length < 2) {\n        throw new Error(\"Invalid coordinates for bounding box\");\n      }\n      const oppositePoints = getOppositePoints(coordinates);\n      const [x1, y1] = [oppositePoints[0][0], oppositePoints[0][1]];\n      const [x2, y2] = [oppositePoints[1][0], oppositePoints[1][1]];\n      return {\n        type: \"boxes\",\n        coordinates: [x1, y1, x2, y2]\n      };\n    }) : [input];\n    let modelInputs;\n    const cachedData = await this.getOrComputeEmbeddings(\n      polygon2,\n      geoRawImage,\n      mapSourceParams == null ? void 0 : mapSourceParams.zoomLevel,\n      mapSourceParams == null ? void 0 : mapSourceParams.bands,\n      mapSourceParams == null ? void 0 : mapSourceParams.expression\n    );\n    if (!cachedData) {\n      throw new Error(\"Failed to get or compute embeddings\");\n    }\n    geoRawImage = cachedData.geoRawImage;\n    const reshaped = cachedData.image_inputs.reshaped_input_sizes[0];\n    const inferenceStartTime = performance.now();\n    console.log(`[mask-generation] starting inference...`);\n    const processedInputs = await Promise.all(\n      batch_input.map(async (input2) => {\n        switch (input2.type) {\n          case \"points\": {\n            const [x, y] = input2.coordinates;\n            const pixelCoord = geoRawImage == null ? void 0 : geoRawImage.worldToPixel(x, y);\n            const pixelReshaped = [\n              [\n                pixelCoord[0] / (geoRawImage == null ? void 0 : geoRawImage.width) * reshaped[1],\n                pixelCoord[1] / (geoRawImage == null ? void 0 : geoRawImage.height) * reshaped[0]\n              ]\n            ];\n            if (!pixelCoord) {\n              throw new Error(\n                \"Failed to convert world coordinates to pixel coordinates.\"\n              );\n            }\n            const input_points = new Tensor(\"float32\", pixelReshaped.flat(), [\n              1,\n              1,\n              pixelReshaped.length,\n              2\n            ]);\n            const labels = [1];\n            const input_labels = new Tensor(\n              \"int64\",\n              labels.map((l) => BigInt(l)),\n              [1, 1, labels.length]\n            );\n            modelInputs = {\n              ...cachedData.image_embeddings,\n              input_points,\n              input_labels\n            };\n            break;\n          }\n          case \"boxes\": {\n            const [x1, y1, x2, y2] = input2.coordinates;\n            const corner1 = geoRawImage == null ? void 0 : geoRawImage.worldToPixel(x1, y1);\n            const corner1Reshaped = [\n              corner1[0] / (geoRawImage == null ? void 0 : geoRawImage.width) * reshaped[1],\n              corner1[1] / (geoRawImage == null ? void 0 : geoRawImage.height) * reshaped[0]\n            ];\n            const corner2 = geoRawImage == null ? void 0 : geoRawImage.worldToPixel(x2, y2);\n            const corner2Reshaped = [\n              corner2[0] / (geoRawImage == null ? void 0 : geoRawImage.width) * reshaped[1],\n              corner2[1] / (geoRawImage == null ? void 0 : geoRawImage.height) * reshaped[0]\n            ];\n            if (!corner1 || !corner2) {\n              throw new Error(\n                \"Failed to convert world coordinates to pixel coordinates.\"\n              );\n            }\n            const input_boxes = new Tensor(\n              \"float32\",\n              [...corner1Reshaped, ...corner2Reshaped],\n              [1, 1, 4]\n            );\n            modelInputs = {\n              ...cachedData.image_embeddings,\n              input_boxes\n            };\n            break;\n          }\n          default:\n            throw new Error(\n              `Unsupported input type: ${input2.type}`\n            );\n        }\n        return {\n          ...modelInputs\n        };\n      })\n    );\n    let outputsArray;\n    try {\n      outputsArray = await Promise.all(\n        processedInputs.map((inputs) => this.model(inputs))\n      );\n    } catch (error) {\n      console.error(\"Error during inference:\", error);\n      throw new Error(`Model inference failed: ${error}`);\n    }\n    const masksArray = await Promise.all(\n      outputsArray.map((outputs) => {\n        return this.processor.post_process_masks(\n          outputs.pred_masks,\n          cachedData.image_inputs.original_sizes,\n          cachedData.image_inputs.reshaped_input_sizes\n        );\n      })\n    );\n    const geoJsonMasks = masksArray.map((_masks, index) => {\n      const numMasks = _masks[0].dims[1];\n      const masks = [];\n      for (let i = 0; i < numMasks; i++) {\n        const maskData = _masks[0].data.slice(\n          i * _masks[0].dims[2] * _masks[0].dims[3],\n          (i + 1) * _masks[0].dims[2] * _masks[0].dims[3]\n        );\n        for (let j = 0; j < maskData.length; j++) {\n          maskData[j] = maskData[j] >= 0.5 ? 255 : 0;\n        }\n        const tensor = new Tensor(\"uint8\", maskData, [\n          1,\n          1,\n          _masks[0].dims[2],\n          _masks[0].dims[3]\n        ]);\n        masks.push(tensor);\n      }\n      const scores = outputsArray[index].iou_scores.data;\n      const sortedMasks = masks.map((mask, i) => ({ mask, score: scores[i] })).sort((a, b) => b.score - a.score).map((item) => item.mask);\n      const maskGeo = maskToGeoJSON(\n        {\n          mask: sortedMasks.slice(0, maxMasks || 1),\n          scores: outputsArray[index].iou_scores.data\n        },\n        geoRawImage,\n        [128]\n      );\n      const combinedFeatures = [];\n      maskGeo.forEach((mc) => {\n        combinedFeatures.push(...mc.features);\n      });\n      const fc = {\n        type: \"FeatureCollection\",\n        features: combinedFeatures\n      };\n      return fc;\n    });\n    const combinedMasks = {\n      type: \"FeatureCollection\",\n      features: geoJsonMasks.flatMap((geoJsonMask) => geoJsonMask.features)\n    };\n    const inferenceEndTime = performance.now();\n    console.log(\n      `[mask-generation] inference completed. Time taken: ${(inferenceEndTime - inferenceStartTime).toFixed(2)}ms`\n    );\n    return {\n      masks: combinedMasks,\n      geoRawImage\n    };\n  }\n  async getImageEmbeddings(params) {\n    var _a, _b, _c;\n    const { inputs } = params;\n    if (!inputs.polygon) {\n      throw new Error(\"Polygon input is required for image embeddings\");\n    }\n    if (!inputs.polygon.geometry || inputs.polygon.geometry.type !== \"Polygon\") {\n      throw new Error(\"Input must be a valid GeoJSON Polygon feature\");\n    }\n    if (!this.dataProvider) {\n      throw new Error(\"Data provider not initialized\");\n    }\n    const geoRawImage = await this.polygonToImage(\n      inputs.polygon,\n      (_a = params.mapSourceParams) == null ? void 0 : _a.zoomLevel,\n      (_b = params.mapSourceParams) == null ? void 0 : _b.bands,\n      (_c = params.mapSourceParams) == null ? void 0 : _c.expression\n    );\n    if (!geoRawImage) {\n      throw new Error(\"Failed to convert polygon to image\");\n    }\n    if (!this.model || !this.processor) {\n      throw new Error(\"Model or processor not initialized\");\n    }\n    const image_inputs = await this.processor(geoRawImage);\n    const image_embeddings = await this.model.get_image_embeddings(image_inputs);\n    return { image_embeddings, geoRawImage };\n  }\n};\n__publicField(_MaskGeneration, \"instance\", null);\nlet MaskGeneration = _MaskGeneration;\nconst _ObjectDetection = class _ObjectDetection extends BaseModel {\n  constructor(model_id, providerParams, modelParams) {\n    super(model_id, providerParams, modelParams);\n    __publicField(this, \"model\");\n    __publicField(this, \"processor\");\n  }\n  static async getInstance(model_id, providerParams, modelParams) {\n    if (!_ObjectDetection.instance || parametersChanged(\n      _ObjectDetection.instance,\n      model_id,\n      providerParams,\n      modelParams\n    )) {\n      _ObjectDetection.instance = new _ObjectDetection(\n        model_id,\n        providerParams,\n        modelParams\n      );\n      await _ObjectDetection.instance.initialize();\n    }\n    return { instance: _ObjectDetection.instance };\n  }\n  async initializeModel() {\n    this.model = await AutoModel.from_pretrained(\n      this.model_id,\n      this.modelParams\n    );\n    this.processor = await AutoProcessor.from_pretrained(this.model_id, {});\n  }\n  /**\n   * Performs object detection on a geographic area specified by a GeoJSON polygon.\n   *\n   * @param polygon - A GeoJSON Feature representing the geographic area to analyze\n   * @param confidence - Detection confidence threshold between 0 and 1. Detections below this threshold will be filtered out. Defaults to 0.9\n   * @returns Promise<ObjectDetectionResults> containing detected objects as GeoJSON features and the raw image used for detection\n   * @throws {Error} If data provider, model or processor are not properly initialized\n   */\n  async inference(params) {\n    const {\n      inputs: { polygon: polygon2 },\n      postProcessingParams: { confidence = 0.9 } = {},\n      mapSourceParams\n    } = params;\n    if (!polygon2) {\n      throw new Error(\"Polygon input is required for segmentation\");\n    }\n    if (!polygon2.geometry || polygon2.geometry.type !== \"Polygon\") {\n      throw new Error(\"Input must be a valid GeoJSON Polygon feature\");\n    }\n    if (!this.initialized) {\n      await this.initialize();\n    }\n    const geoRawImage = await this.polygonToImage(\n      polygon2,\n      mapSourceParams == null ? void 0 : mapSourceParams.zoomLevel,\n      mapSourceParams == null ? void 0 : mapSourceParams.bands,\n      mapSourceParams == null ? void 0 : mapSourceParams.expression\n    );\n    const inferenceStartTime = performance.now();\n    console.log(\"[oriented-object-detection] starting inference...\");\n    let outputs;\n    let inputs;\n    try {\n      if (!this.processor || !this.model) {\n        throw new Error(\"Model or processor not initialized\");\n      }\n      inputs = await this.processor(geoRawImage);\n      outputs = await this.model({\n        images: inputs.pixel_values,\n        confidence\n      });\n    } catch (error) {\n      console.debug(\"error\", error);\n      throw error;\n    }\n    const results = postProcessYoloOutput(\n      outputs,\n      inputs.pixel_values,\n      geoRawImage,\n      this.model.config.id2label\n    );\n    const detectionsGeoJson = detectionsToGeoJSON(results, geoRawImage);\n    const inferenceEndTime = performance.now();\n    console.log(\n      `[oriented-object-detection] inference completed. Time taken: ${(inferenceEndTime - inferenceStartTime).toFixed(2)}ms`\n    );\n    return {\n      detections: detectionsGeoJson,\n      geoRawImage\n    };\n  }\n};\n__publicField(_ObjectDetection, \"instance\", null);\nlet ObjectDetection = _ObjectDetection;\nconst eps = 1e-8;\nfunction sig(d) {\n  return d > eps ? 1 : d < -eps ? -1 : 0;\n}\nfunction cross(o, a, b) {\n  return (a.x - o.x) * (b.y - o.y) - (b.x - o.x) * (a.y - o.y);\n}\nfunction area(ps, n) {\n  let res = 0;\n  for (let i = 0; i < n; i++) {\n    const j = (i + 1) % n;\n    res += ps[i].x * ps[j].y - ps[j].x * ps[i].y;\n  }\n  return Math.abs(res) / 2;\n}\nfunction lineCross(a, b, c, d, p) {\n  const s1 = cross(a, b, c);\n  const s2 = cross(a, b, d);\n  if (sig(s1) === 0 && sig(s2) === 0) return 2;\n  if (sig(s2 - s1) === 0) return 0;\n  p.x = (c.x * s2 - d.x * s1) / (s2 - s1);\n  p.y = (c.y * s2 - d.y * s1) / (s2 - s1);\n  return 1;\n}\nfunction polygonCut(p, n, a, b, pp) {\n  let m = 0;\n  for (let i = 0; i < n; i++) {\n    const j = (i + 1) % n;\n    if (sig(cross(a, b, p[i])) > 0) pp[m++] = p[i];\n    if (sig(cross(a, b, p[i])) !== sig(cross(a, b, p[j]))) {\n      const intersection = { x: 0, y: 0 };\n      lineCross(a, b, p[i], p[j], intersection);\n      pp[m++] = intersection;\n    }\n  }\n  n = m;\n  for (let i = 0; i < m; i++) {\n    p[i] = pp[i];\n  }\n}\nfunction intersectAreaPoly(ps1, n1, ps2, n2) {\n  let clippedPolygon = ps1.slice();\n  let clippedCount = n1;\n  for (let i = 0; i < n2; i++) {\n    const a = ps2[i];\n    const b = ps2[(i + 1) % n2];\n    const tempPolygon = [];\n    polygonCut(clippedPolygon, clippedCount, a, b, tempPolygon);\n    clippedPolygon = tempPolygon;\n    clippedCount = tempPolygon.length;\n  }\n  return area(clippedPolygon, clippedCount);\n}\nfunction iouPoly(p, q) {\n  const ps1 = [];\n  const ps2 = [];\n  const n1 = 4;\n  const n2 = 4;\n  for (let i = 0; i < 4; i++) {\n    ps1.push({ x: p[i * 2], y: p[i * 2 + 1] });\n    ps2.push({ x: q[i * 2], y: q[i * 2 + 1] });\n  }\n  const interArea = intersectAreaPoly(ps1, n1, ps2, n2);\n  const area1 = area(ps1, n1);\n  const area2 = area(ps2, n2);\n  const unionArea = area1 + area2 - interArea;\n  if (unionArea < 1e-6) {\n    return 0;\n  }\n  const iou = interArea / unionArea;\n  return iou;\n}\nconst _OrientedObjectDetection = class _OrientedObjectDetection extends BaseModel {\n  constructor(model_id, providerParams, modelParams) {\n    super(model_id, providerParams, modelParams);\n    __publicField(this, \"model\");\n    __publicField(this, \"initialized\", false);\n    __publicField(this, \"processor\");\n    __publicField(this, \"classes\");\n  }\n  static async getInstance(model_id, providerParams, modelParams) {\n    if (!_OrientedObjectDetection.instance || parametersChanged(\n      _OrientedObjectDetection.instance,\n      model_id,\n      providerParams,\n      modelParams\n    )) {\n      _OrientedObjectDetection.instance = new _OrientedObjectDetection(\n        model_id,\n        providerParams,\n        modelParams\n      );\n      await _OrientedObjectDetection.instance.initialize();\n    }\n    return { instance: _OrientedObjectDetection.instance };\n  }\n  async initializeModel() {\n    if (this.model) return;\n    this.processor = await ImageProcessor.from_pretrained(this.model_id);\n    const pretrainedModel = await PreTrainedModel.from_pretrained(\n      this.model_id,\n      this.modelParams\n    );\n    this.model = pretrainedModel.sessions.model;\n    const config = pretrainedModel.config;\n    if (config.classes === void 0) {\n      throw new Error(\n        \"Model config must include 'classes' property for oriented object detection.\"\n      );\n    }\n    this.classes = config.classes;\n  }\n  /**\n   * Performs object detection on a given geographic polygon.\n   * @param polygon - A GeoJSON Feature representing the area for detection\n   * @param options - Optional NMS (Non-Maximum Suppression) configuration options\n   * @param {NMSOptions} [options={}] - Configuration options for NMS post-processing\n   * @returns {Promise<ObjectDetectionResults>} A promise that resolves to the detection results, including the detections array and raw image\n   * @throws {Error} If the data provider or model is not properly initialized\n   */\n  async inference(params) {\n    const {\n      inputs: { polygon: polygon2 },\n      postProcessingParams,\n      mapSourceParams\n    } = params;\n    if (!polygon2) {\n      throw new Error(\"Polygon input is required for segmentation\");\n    }\n    if (!polygon2.geometry || polygon2.geometry.type !== \"Polygon\") {\n      throw new Error(\"Input must be a valid GeoJSON Polygon feature\");\n    }\n    if (!this.initialized) {\n      await this.initialize();\n    }\n    if (!this.dataProvider) {\n      throw new Error(\"Data provider not initialized\");\n    }\n    const geoRawImage = await this.polygonToImage(\n      polygon2,\n      mapSourceParams == null ? void 0 : mapSourceParams.zoomLevel,\n      mapSourceParams == null ? void 0 : mapSourceParams.bands,\n      mapSourceParams == null ? void 0 : mapSourceParams.expression\n    );\n    if (!this.processor) {\n      throw new Error(\"Processor not initialized\");\n    }\n    const inputs = await this.processor(geoRawImage);\n    let outputs;\n    const inferenceStartTime = performance.now();\n    console.log(\"[oriented-object-detection] starting inference...\");\n    try {\n      if (!this.model) {\n        throw new Error(\"Model or processor not initialized\");\n      }\n      outputs = await this.model.run({ input: inputs.pixel_values });\n    } catch (error) {\n      console.debug(\"error\", error);\n      throw error;\n    }\n    outputs = await this.postProcessor(\n      outputs,\n      geoRawImage,\n      postProcessingParams\n    );\n    const inferenceEndTime = performance.now();\n    console.log(\n      `[oriented-object-detection] inference completed. Time taken: ${(inferenceEndTime - inferenceStartTime).toFixed(2)}ms`\n    );\n    return {\n      detections: outputs,\n      geoRawImage\n    };\n  }\n  convertPred({\n    pred_bbox,\n    org_img_shape,\n    valid_scale,\n    conf_thresh\n  }) {\n    const [org_w, org_h] = org_img_shape;\n    const xywh = pred_bbox.map((bbox2) => bbox2.slice(0, 4));\n    const xyxy = xywh.map((box) => {\n      const [x, y, w, h] = box;\n      return [x - w / 2, y - h / 2, x + w / 2, y + h / 2];\n    });\n    const pred_s = pred_bbox.map((bbox2) => bbox2.slice(4, 8));\n    const pred_r = pred_bbox.map((bbox2) => bbox2[8]);\n    const pred_conf = pred_bbox.map((bbox2) => bbox2[13]);\n    const pred_prob = pred_bbox.map((bbox2) => bbox2.slice(14));\n    const zero = pred_s.map(() => [0, 0, 0, 0]);\n    const pred_s_adjusted = pred_s.map((s, i) => {\n      return pred_r[i] > 0.9 ? zero[i] : s;\n    });\n    const clipped_xyxy = xyxy.map((box) => {\n      return [\n        Math.max(0, box[0]),\n        Math.max(0, box[1]),\n        Math.min(org_w - 1, box[2]),\n        Math.min(org_h - 1, box[3])\n      ];\n    });\n    const invalid_mask = clipped_xyxy.map(\n      (box) => box[0] > box[2] || box[1] > box[3]\n    );\n    const final_xyxy = clipped_xyxy.map((box, i) => {\n      return invalid_mask[i] ? [0, 0, 0, 0] : box;\n    });\n    const final_pred_s = pred_s_adjusted.map((s, i) => {\n      return invalid_mask[i] ? [0, 0, 0, 0] : s;\n    });\n    const bboxes_scale = final_xyxy.map(\n      (box) => Math.sqrt((box[2] - box[0]) * (box[3] - box[1]))\n    );\n    const scale_mask = bboxes_scale.map(\n      (scale) => valid_scale[0] < scale && scale < valid_scale[1]\n    );\n    const classes = pred_prob.map((prob) => prob.indexOf(Math.max(...prob)));\n    const scores = pred_conf.map((conf, i) => conf * pred_prob[i][classes[i]]);\n    const score_mask = scores.map((score) => score > conf_thresh);\n    const mask = scale_mask.map((scale, i) => scale && score_mask[i]);\n    const filtered_xyxy = final_xyxy.filter((_, i) => mask[i]);\n    const filtered_pred_s = final_pred_s.filter((_, i) => mask[i]);\n    const filtered_pred_conf = pred_conf.filter((_, i) => mask[i]);\n    const filtered_pred_prob = pred_prob.filter((_, i) => mask[i]);\n    const coor4points = filtered_pred_s.map((s, i) => {\n      const [x1, y1, x2, y2] = filtered_xyxy[i];\n      const width = x2 - x1;\n      const height = y2 - y1;\n      return [\n        s[0] * width + x1,\n        // x1\n        y1,\n        // y1\n        x2,\n        // x2\n        s[1] * height + y1,\n        // y2\n        x2 - s[2] * width,\n        // x3\n        y2,\n        // y3\n        x1,\n        // x4\n        y2 - s[3] * height\n        // y4\n      ];\n    });\n    const bboxes = coor4points.map((points, i) => {\n      return [...points, filtered_pred_conf[i], ...filtered_pred_prob[i]];\n    });\n    return bboxes;\n  }\n  /**\n   * Performs Rotate-Non-Maximum Suppression (RNMS) on inference results.\n   * @param prediction Array of predictions with shape (batch_size, num_boxes, [xywh, score, num_classes, num_angles]).\n   * @param conf_thres Confidence threshold.\n   * @param iou_thres IoU threshold.\n   * @param classes Array of class indices to filter by.\n   * @param without_iouthres Whether to skip IoU thresholding.\n   * @returns Array of filtered boxes after NMS.\n   */\n  nonMaxSuppression4Points(prediction, {\n    conf_thres = 0.4,\n    iou_thres = 0.45,\n    classes = void 0,\n    multi_label = true,\n    without_iouthres = false\n  } = {}) {\n    const batchSize = prediction.length;\n    const numClasses = prediction[0][0].length - 9;\n    const output = Array.from({ length: batchSize }, () => []);\n    for (let xi = 0; xi < batchSize; xi++) {\n      const x = prediction[xi];\n      const filteredBoxes = x.filter((box) => box[8] > conf_thres);\n      if (filteredBoxes.length === 0) {\n        continue;\n      }\n      const boxesWithScores = [];\n      if (multi_label && numClasses > 1) {\n        filteredBoxes.forEach((box) => {\n          box.slice(9).forEach((score, j) => {\n            const confScore = score * box[8];\n            if (confScore > conf_thres) {\n              boxesWithScores.push([\n                ...box.slice(0, 8),\n                // xywhθ\n                confScore,\n                // Confidence score\n                j\n                // Class index\n              ]);\n            }\n          });\n        });\n      } else {\n        filteredBoxes.forEach((box) => {\n          const maxConf = Math.max(\n            ...box.slice(9).map((score) => score * box[8])\n          );\n          const classIndex = box.slice(9).map((score) => score * box[8]).indexOf(maxConf);\n          if (maxConf > conf_thres) {\n            boxesWithScores.push([\n              ...box.slice(0, 8),\n              // xywhθ\n              maxConf,\n              // Confidence score\n              classIndex\n              // Class index\n            ]);\n          }\n        });\n      }\n      if (without_iouthres) {\n        output[xi] = boxesWithScores;\n        continue;\n      }\n      const filteredByClass = classes ? boxesWithScores.filter((box) => classes.includes(box[box.length - 1])) : boxesWithScores;\n      if (filteredByClass.length === 0) {\n        continue;\n      }\n      filteredByClass.sort((a, b) => b[8] - a[8]);\n      const boxes4Points = filteredByClass.map((box) => box.slice(0, 8));\n      const scores = filteredByClass.map((box) => box[8]);\n      const keepIndices = this.pyCpuNmsPolyFast(\n        boxes4Points,\n        scores,\n        iou_thres\n      );\n      const maxDet = 500;\n      const finalIndices = keepIndices.slice(0, maxDet);\n      output[xi] = finalIndices.map((i) => filteredByClass[i]);\n    }\n    return output;\n  }\n  /**\n   * Polygonal NMS implementation.\n   * @param dets Array of polygons with shape (num_detections, [poly]).\n   * @param scores Array of confidence scores with shape (num_detections, 1).\n   * @param thresh IoU threshold.\n   * @returns Array of indices to keep after NMS.\n   */\n  pyCpuNmsPolyFast(dets, scores, thresh) {\n    const obbs = dets.map((det) => det.slice(0, 8));\n    const x1 = obbs.map((obb) => Math.min(...obb.filter((_, i) => i % 2 === 0)));\n    const y1 = obbs.map((obb) => Math.min(...obb.filter((_, i) => i % 2 === 1)));\n    const x2 = obbs.map((obb) => Math.max(...obb.filter((_, i) => i % 2 === 0)));\n    const y2 = obbs.map((obb) => Math.max(...obb.filter((_, i) => i % 2 === 1)));\n    const areas = x1.map((_, i) => (x2[i] - x1[i] + 1) * (y2[i] - y1[i] + 1));\n    const polys = dets.map((det) => [\n      det[0],\n      det[1],\n      det[2],\n      det[3],\n      det[4],\n      det[5],\n      det[6],\n      det[7]\n    ]);\n    let order = scores.map((score, index) => ({ score, index })).sort((a, b) => b.score - a.score).map((item) => item.index);\n    const keep = [];\n    while (order.length > 0) {\n      const i = order.shift();\n      keep.push(i);\n      const xx1 = x1.map((val) => Math.max(x1[i], val));\n      const yy1 = y1.map((val) => Math.max(y1[i], val));\n      const xx2 = x2.map((val) => Math.min(x2[i], val));\n      const yy2 = y2.map((val) => Math.min(y2[i], val));\n      const w = xx2.map((val, idx) => Math.max(0, val - xx1[idx]));\n      const h = yy2.map((val, idx) => Math.max(0, val - yy1[idx]));\n      const hbbInter = w.map((val, idx) => val * h[idx]);\n      const hbbOvr = hbbInter.map(\n        (val, idx) => val / (areas[i] + areas[idx] - val)\n      );\n      const h_inds = hbbOvr.map((val, idx) => val > 0 ? idx : -1).filter((idx) => idx !== -1 && idx !== i);\n      const tmp_order = order.filter((j) => h_inds.includes(j));\n      for (let j = 0; j < tmp_order.length; j++) {\n        const iou = iouPoly(polys[i], polys[tmp_order[j]]);\n        hbbOvr[tmp_order[j]] = iou;\n      }\n      const inds = order.filter((j) => hbbOvr[j] < thresh);\n      order = inds;\n    }\n    return keep;\n  }\n  async postProcessor(outputs, geoRawImage, options = {}) {\n    var _a;\n    const dimsensions = outputs.output.dims;\n    const data = outputs.output.data;\n    const pred_bbox = [];\n    for (let i = 0; i < dimsensions[0]; i++) {\n      pred_bbox.push(data.slice(i * dimsensions[1], (i + 1) * dimsensions[1]));\n    }\n    const valid_scale = [0, Infinity];\n    let predbboxes = this.convertPred({\n      pred_bbox,\n      org_img_shape: [geoRawImage.width, geoRawImage.height],\n      valid_scale,\n      conf_thresh: options.conf_thres || 0.4\n    });\n    if (predbboxes.length === 0) {\n      return {\n        type: \"FeatureCollection\",\n        features: []\n      };\n    }\n    predbboxes = this.nonMaxSuppression4Points([predbboxes], options)[0];\n    const featureCollection = {\n      type: \"FeatureCollection\",\n      features: []\n    };\n    for (const bbox2 of predbboxes) {\n      const [x1, y1, x2, y2, x3, y3, x4, y4, score, class_ind] = bbox2;\n      const class_name = (_a = this.classes) == null ? void 0 : _a[class_ind];\n      const points = [\n        [x1, y1],\n        [x2, y2],\n        [x3, y3],\n        [x4, y4],\n        [x1, y1]\n      ].map((point) => {\n        point = point.map(Math.round);\n        return geoRawImage.pixelToWorld(point[0], point[1]);\n      });\n      const feature2 = {\n        type: \"Feature\",\n        geometry: {\n          type: \"Polygon\",\n          coordinates: [points]\n        },\n        properties: {\n          score,\n          class_name\n        }\n      };\n      featureCollection.features.push(feature2);\n    }\n    return featureCollection;\n  }\n};\n__publicField(_OrientedObjectDetection, \"instance\", null);\nlet OrientedObjectDetection = _OrientedObjectDetection;\nconst _LandCoverClassification = class _LandCoverClassification extends BaseModel {\n  constructor(model_id, providerParams, modelParams) {\n    super(model_id, providerParams, modelParams);\n    __publicField(this, \"model\");\n    __publicField(this, \"classes\");\n    __publicField(this, \"colors\");\n    __publicField(this, \"processor\");\n  }\n  static async getInstance(model_id, providerParams, modelParams) {\n    if (!_LandCoverClassification.instance || parametersChanged(\n      _LandCoverClassification.instance,\n      model_id,\n      providerParams,\n      modelParams\n    )) {\n      _LandCoverClassification.instance = new _LandCoverClassification(\n        model_id,\n        providerParams,\n        modelParams\n      );\n      await _LandCoverClassification.instance.initialize();\n    }\n    return { instance: _LandCoverClassification.instance };\n  }\n  async initializeModel() {\n    if (this.model) return;\n    this.processor = await ImageProcessor.from_pretrained(this.model_id);\n    const pretrainedModel = await PreTrainedModel.from_pretrained(\n      this.model_id,\n      this.modelParams\n    );\n    this.model = pretrainedModel.sessions.model;\n    const config = pretrainedModel.config;\n    if (config.classes === void 0 || config.colors === void 0) {\n      throw new Error(\n        \"Model config must include both 'classes' and 'colors' properties for land cover classification.\"\n      );\n    }\n    this.classes = config.classes;\n    this.colors = config.colors;\n  }\n  async inference(params) {\n    var _a, _b, _c;\n    const {\n      inputs: { polygon: polygon2 },\n      mapSourceParams\n    } = params;\n    if (!polygon2) {\n      throw new Error(\"Polygon input is required for segmentation\");\n    }\n    if (!polygon2.geometry || polygon2.geometry.type !== \"Polygon\") {\n      throw new Error(\"Input must be a valid GeoJSON Polygon feature\");\n    }\n    await this.initialize();\n    if (!this.dataProvider) {\n      throw new Error(\"Data provider not initialized\");\n    }\n    const geoRawImage = await this.polygonToImage(\n      polygon2,\n      mapSourceParams == null ? void 0 : mapSourceParams.zoomLevel,\n      mapSourceParams == null ? void 0 : mapSourceParams.bands,\n      mapSourceParams == null ? void 0 : mapSourceParams.expression\n    );\n    const inferenceStartTime = performance.now();\n    console.log(\"[land-cover-classification] starting inference...\");\n    if (!this.processor) {\n      throw new Error(\"Processor not initialized\");\n    }\n    const inputs = await this.processor(geoRawImage);\n    let outputs;\n    try {\n      if (!this.model) {\n        throw new Error(\"Model or processor not initialized\");\n      }\n      outputs = await this.model.run({ input: inputs.pixel_values });\n    } catch (error) {\n      console.debug(\"error\", error);\n      throw error;\n    }\n    const output = outputs.output;\n    const squeezedOutput = output.data;\n    const [batch, channels, height, width] = output.dims;\n    if (batch !== 1) throw new Error(\"Unexpected batch size\");\n    const argmaxOutput = new Uint8Array(height * width);\n    for (let i = 0; i < height * width; i++) {\n      let maxIndex = 0;\n      let maxValue = squeezedOutput[i];\n      for (let j = 1; j < channels; j++) {\n        const value = squeezedOutput[j * height * width + i];\n        if (value > maxValue) {\n          maxValue = value;\n          maxIndex = j;\n        }\n      }\n      argmaxOutput[i] = maxIndex;\n    }\n    const outputImage = new Uint8Array(height * width * 3);\n    const binaryMasks = [];\n    for (let i = 0; i < (((_a = this.classes) == null ? void 0 : _a.length) || 0); i++) {\n      binaryMasks.push(new Uint8Array(height * width));\n    }\n    for (let i = 0; i < height * width; i++) {\n      const classIndex = argmaxOutput[i];\n      const color = (_b = this.colors) == null ? void 0 : _b[classIndex];\n      const offset = i * 3;\n      if (color) {\n        outputImage[offset] = color[0];\n        outputImage[offset + 1] = color[1];\n        outputImage[offset + 2] = color[2];\n        binaryMasks[classIndex][i] = 255;\n      } else {\n        outputImage[offset] = 0;\n        outputImage[offset + 1] = 0;\n        outputImage[offset + 2] = 0;\n      }\n    }\n    const masksToKeep = [];\n    const binaryTensors = [];\n    for (let i = 0; i < (((_c = this.classes) == null ? void 0 : _c.length) || 0); i++) {\n      if (binaryMasks[i].every((v) => v === 0)) {\n        continue;\n      }\n      masksToKeep.push(i);\n      binaryTensors.push(\n        new Tensor(\"uint8\", binaryMasks[i], [1, 1, height, width])\n      );\n    }\n    const outputRawImage = new GeoRawImage(\n      outputImage,\n      height,\n      width,\n      3,\n      geoRawImage.getBounds()\n    );\n    const maskToFC = maskToGeoJSON({ mask: binaryTensors }, outputRawImage);\n    const features = [];\n    maskToFC.forEach((fc, idx) => {\n      fc.features.forEach((feature2) => {\n        feature2.properties = {\n          class: this.classes ? this.classes[masksToKeep[idx]] : \"unknown\"\n        };\n        features.push(feature2);\n      });\n    });\n    const featureCollection = {\n      type: \"FeatureCollection\",\n      features\n    };\n    const inferenceEndTime = performance.now();\n    console.log(\n      `[land-cover-classification] inference completed. Time taken: ${(inferenceEndTime - inferenceStartTime).toFixed(2)}ms`\n    );\n    return {\n      detections: featureCollection,\n      outputImage: outputRawImage,\n      geoRawImage\n    };\n  }\n};\n__publicField(_LandCoverClassification, \"instance\", null);\nlet LandCoverClassification = _LandCoverClassification;\nclass BaseDetectionModel extends BaseModel {\n  constructor(model_id, providerParams, modelParams) {\n    super(model_id, providerParams, modelParams);\n    __publicField(this, \"model\");\n    __publicField(this, \"zoom\");\n    __publicField(this, \"processor\");\n  }\n  async initializeModel() {\n    this.processor = await ImageProcessor.from_pretrained(this.model_id);\n    const pretrainedModel = await PreTrainedModel.from_pretrained(\n      this.model_id,\n      this.modelParams\n    );\n    this.model = pretrainedModel.sessions.model;\n  }\n  async postProcessor(outputs, geoRawImage) {\n    const { masks } = outputs;\n    const maskData = masks.data;\n    const maskDims = masks.dims;\n    const maskHeight = maskDims[2];\n    const maskWidth = maskDims[3];\n    const masksArray = [];\n    for (let idx = 0; idx < maskDims[0]; idx++) {\n      const maskArray = new Uint8Array(maskHeight * maskWidth);\n      const startIdx = idx * maskHeight * maskWidth;\n      for (let i = 0; i < maskHeight * maskWidth; i++) {\n        maskArray[i] = maskData[startIdx + i] > 0.5 ? 255 : 0;\n      }\n      const tensor = new Tensor(\"uint8\", maskArray, [\n        1,\n        1,\n        maskHeight,\n        maskWidth\n      ]);\n      masksArray.push(tensor);\n    }\n    const features = [];\n    const masksToFC = maskToGeoJSON({ mask: masksArray }, geoRawImage);\n    if (masksToFC.length > 0) {\n      masksToFC.forEach((fc) => {\n        fc.features.forEach((feature2) => {\n          features.push(feature2);\n        });\n      });\n    }\n    return {\n      type: \"FeatureCollection\",\n      features\n    };\n  }\n  async inference(params) {\n    var _a;\n    const {\n      inputs: { polygon: polygon2 },\n      mapSourceParams\n    } = params;\n    if (!polygon2) {\n      throw new Error(\"Polygon input is required for segmentation\");\n    }\n    if (!polygon2.geometry || polygon2.geometry.type !== \"Polygon\") {\n      throw new Error(\"Input must be a valid GeoJSON Polygon feature\");\n    }\n    if (!this.initialized) {\n      await this.initialize();\n    }\n    if (!this.dataProvider) {\n      throw new Error(\"Data provider not initialized\");\n    }\n    const geoRawImage = await this.polygonToImage(\n      polygon2,\n      mapSourceParams == null ? void 0 : mapSourceParams.zoomLevel,\n      mapSourceParams == null ? void 0 : mapSourceParams.bands,\n      mapSourceParams == null ? void 0 : mapSourceParams.expression\n    );\n    const task = (_a = this.model_id.split(\"/\").pop()) == null ? void 0 : _a.split(\".\")[0].split(\"_\")[0];\n    const inferenceStartTime = performance.now();\n    console.log(`[${task}] starting inference...`);\n    if (!this.processor) {\n      throw new Error(\"Processor not initialized\");\n    }\n    const inputs = await this.processor(geoRawImage);\n    let outputs;\n    try {\n      if (!this.model) {\n        throw new Error(\"Model not initialized\");\n      }\n      outputs = await this.model.run({ image: inputs.pixel_values });\n    } catch (error) {\n      console.debug(\"error\", error);\n      throw error;\n    }\n    outputs = await this.postProcessor(outputs, geoRawImage);\n    const inferenceEndTime = performance.now();\n    console.log(\n      `[${task}] inference completed. Time taken: ${(inferenceEndTime - inferenceStartTime).toFixed(2)}ms`\n    );\n    return {\n      detections: outputs,\n      geoRawImage\n    };\n  }\n}\nconst _SolarPanelDetection = class _SolarPanelDetection extends BaseDetectionModel {\n  constructor(model_id, providerParams, modelParams) {\n    super(model_id, providerParams, modelParams);\n  }\n  static async getInstance(model_id, providerParams, modelParams) {\n    if (!_SolarPanelDetection.instanceRef || parametersChanged(\n      _SolarPanelDetection.instanceRef,\n      model_id,\n      providerParams,\n      modelParams\n    )) {\n      _SolarPanelDetection.instanceRef = new _SolarPanelDetection(\n        model_id,\n        providerParams,\n        modelParams\n      );\n      await _SolarPanelDetection.instanceRef.initialize();\n    }\n    return { instance: _SolarPanelDetection.instanceRef };\n  }\n};\n__publicField(_SolarPanelDetection, \"instanceRef\", null);\nlet SolarPanelDetection = _SolarPanelDetection;\nconst _ShipDetection = class _ShipDetection extends BaseDetectionModel {\n  constructor(model_id, providerParams, modelParams) {\n    super(model_id, providerParams, modelParams);\n    this.zoom = 21;\n  }\n  static async getInstance(model_id, providerParams, modelParams) {\n    if (!_ShipDetection.instanceRef || parametersChanged(\n      _ShipDetection.instanceRef,\n      model_id,\n      providerParams,\n      modelParams\n    )) {\n      _ShipDetection.instanceRef = new _ShipDetection(\n        model_id,\n        providerParams,\n        modelParams\n      );\n      await _ShipDetection.instanceRef.initialize();\n    }\n    return { instance: _ShipDetection.instanceRef };\n  }\n};\n__publicField(_ShipDetection, \"instanceRef\", null);\nlet ShipDetection = _ShipDetection;\nconst _CarDetection = class _CarDetection extends BaseDetectionModel {\n  constructor(model_id, providerParams, modelParams) {\n    super(model_id, providerParams, modelParams);\n  }\n  static async getInstance(model_id, providerParams, modelParams) {\n    if (!_CarDetection.instanceRef || parametersChanged(\n      _CarDetection.instanceRef,\n      model_id,\n      providerParams,\n      modelParams\n    )) {\n      _CarDetection.instanceRef = new _CarDetection(\n        model_id,\n        providerParams,\n        modelParams\n      );\n      await _CarDetection.instanceRef.initialize();\n    }\n    return { instance: _CarDetection.instanceRef };\n  }\n};\n__publicField(_CarDetection, \"instanceRef\", null);\nlet CarDetection = _CarDetection;\nconst _BuildingDetection = class _BuildingDetection extends BaseDetectionModel {\n  constructor(model_id, providerParams, modelParams) {\n    super(model_id, providerParams, modelParams);\n  }\n  static async getInstance(model_id, providerParams, modelParams) {\n    if (!_BuildingDetection.instanceRef || parametersChanged(\n      _BuildingDetection.instanceRef,\n      model_id,\n      providerParams,\n      modelParams\n    )) {\n      _BuildingDetection.instanceRef = new _BuildingDetection(\n        model_id,\n        providerParams,\n        modelParams\n      );\n      await _BuildingDetection.instanceRef.initialize();\n    }\n    return { instance: _BuildingDetection.instanceRef };\n  }\n};\n__publicField(_BuildingDetection, \"instanceRef\", null);\nlet BuildingDetection = _BuildingDetection;\nconst _WetLandSegmentation = class _WetLandSegmentation extends BaseModel {\n  constructor(model_id, providerParams, modelParams) {\n    super(model_id, providerParams, modelParams);\n    __publicField(this, \"model\");\n    __publicField(this, \"processor\");\n  }\n  static async getInstance(model_id, providerParams, modelParams) {\n    if (!_WetLandSegmentation.instance || parametersChanged(\n      _WetLandSegmentation.instance,\n      model_id,\n      providerParams,\n      modelParams\n    )) {\n      _WetLandSegmentation.instance = new _WetLandSegmentation(\n        model_id,\n        providerParams,\n        modelParams\n      );\n      await _WetLandSegmentation.instance.initialize();\n    }\n    return { instance: _WetLandSegmentation.instance };\n  }\n  async initializeModel() {\n    this.processor = await ImageProcessor.from_pretrained(this.model_id);\n    const pretrainedModel = await PreTrainedModel.from_pretrained(\n      this.model_id,\n      this.modelParams\n    );\n    this.model = pretrainedModel.sessions.model;\n  }\n  async inference(params) {\n    const {\n      inputs: { polygon: polygon2 },\n      mapSourceParams\n    } = params;\n    if (!polygon2) {\n      throw new Error(\"Polygon input is required for segmentation\");\n    }\n    if (!polygon2.geometry || polygon2.geometry.type !== \"Polygon\") {\n      throw new Error(\"Input must be a valid GeoJSON Polygon feature\");\n    }\n    if (!this.initialized) {\n      await this.initialize();\n    }\n    if (!this.dataProvider) {\n      throw new Error(\"Data provider not initialized\");\n    }\n    const geoRawImage = await this.polygonToImage(\n      polygon2,\n      mapSourceParams == null ? void 0 : mapSourceParams.zoomLevel,\n      mapSourceParams == null ? void 0 : mapSourceParams.bands,\n      mapSourceParams == null ? void 0 : mapSourceParams.expression\n    );\n    const inferenceStartTime = performance.now();\n    console.log(\"[wetland-segmentation] starting inference...\");\n    if (!this.processor) {\n      throw new Error(\"Processor not initialized\");\n    }\n    const inputs = await this.processor(geoRawImage);\n    let outputs;\n    try {\n      if (!this.model) {\n        throw new Error(\"Model or processor not initialized\");\n      }\n      outputs = await this.model.run({ input: inputs.pixel_values });\n    } catch (error) {\n      console.debug(\"error\", error);\n      throw error;\n    }\n    outputs = await this.postProcessor(outputs, geoRawImage);\n    const inferenceEndTime = performance.now();\n    console.log(\n      `[wetland-segmentation] inference completed. Time taken: ${(inferenceEndTime - inferenceStartTime).toFixed(2)}ms`\n    );\n    return {\n      detections: outputs,\n      geoRawImage\n    };\n  }\n  async postProcessor(outputs, geoRawImage) {\n    outputs = Object.values(outputs);\n    const masks = outputs[1];\n    if (!masks || !masks.data || !masks.dims) {\n      throw new Error(\"Invalid output format: masks not found.\");\n    }\n    const maskData = masks.data;\n    const maskDims = masks.dims;\n    const maskHeight = maskDims[2];\n    const maskWidth = maskDims[3];\n    const numMasks = maskDims[0];\n    const masksArray = [];\n    for (let idx = 0; idx < numMasks; idx++) {\n      const maskArray = new Uint8Array(maskHeight * maskWidth);\n      const startIdx = idx * maskHeight * maskWidth;\n      for (let i = 0; i < maskHeight * maskWidth; i++) {\n        maskArray[i] = maskData[startIdx + i] > 0.5 ? 255 : 0;\n      }\n      const tensor = new Tensor(\"uint8\", maskArray, [\n        1,\n        1,\n        maskHeight,\n        maskWidth\n      ]);\n      masksArray.push(tensor);\n    }\n    const features = [];\n    const masksToFC = maskToGeoJSON({ mask: masksArray }, geoRawImage);\n    if (masksToFC.length > 0) {\n      masksToFC.forEach((fc) => {\n        fc.features.forEach((feature2) => {\n          features.push(feature2);\n        });\n      });\n    }\n    return {\n      type: \"FeatureCollection\",\n      features\n    };\n  }\n};\n__publicField(_WetLandSegmentation, \"instance\", null);\nlet WetLandSegmentation = _WetLandSegmentation;\nconst _OilStorageTankDetection = class _OilStorageTankDetection extends BaseModel {\n  constructor(model_id, providerParams, modelParams) {\n    super(model_id, providerParams, modelParams);\n    __publicField(this, \"model\");\n    __publicField(this, \"processor\");\n  }\n  static async getInstance(model_id, providerParams, modelParams) {\n    if (!_OilStorageTankDetection.instance || parametersChanged(\n      _OilStorageTankDetection.instance,\n      model_id,\n      providerParams,\n      modelParams\n    )) {\n      _OilStorageTankDetection.instance = new _OilStorageTankDetection(\n        model_id,\n        providerParams,\n        modelParams\n      );\n      await _OilStorageTankDetection.instance.initialize();\n    }\n    return { instance: _OilStorageTankDetection.instance };\n  }\n  async initializeModel() {\n    if (this.model) return;\n    this.processor = await ImageProcessor.from_pretrained(this.model_id);\n    const pretrainedModel = await PreTrainedModel.from_pretrained(\n      this.model_id,\n      this.modelParams\n    );\n    this.model = pretrainedModel.sessions.model;\n  }\n  async inference(params) {\n    const {\n      inputs: { polygon: polygon2 },\n      postProcessingParams: {\n        confidenceThreshold = 0.5,\n        nmsThreshold = 0.3\n      } = {},\n      mapSourceParams\n    } = params;\n    if (!polygon2) {\n      throw new Error(\"Polygon input is required for segmentation\");\n    }\n    if (!polygon2.geometry || polygon2.geometry.type !== \"Polygon\") {\n      throw new Error(\"Input must be a valid GeoJSON Polygon feature\");\n    }\n    await this.initialize();\n    if (!this.dataProvider) {\n      throw new Error(\"Data provider not initialized\");\n    }\n    const geoRawImage = await this.polygonToImage(\n      polygon2,\n      mapSourceParams == null ? void 0 : mapSourceParams.zoomLevel,\n      mapSourceParams == null ? void 0 : mapSourceParams.bands,\n      mapSourceParams == null ? void 0 : mapSourceParams.expression\n    );\n    if (!this.processor) {\n      throw new Error(\"Processor not initialized\");\n    }\n    const inputs = await this.processor(geoRawImage);\n    const inferenceStartTime = performance.now();\n    console.log(\"[oil-storage-tank-detection] starting inference...\");\n    let outputs;\n    try {\n      if (!this.model) {\n        throw new Error(\"Model not initialized\");\n      }\n      outputs = await this.model.run({ images: inputs.pixel_values });\n    } catch (error) {\n      console.debug(\"error\", error);\n      throw error;\n    }\n    outputs = await this.postProcessor(\n      outputs.output,\n      geoRawImage,\n      confidenceThreshold,\n      nmsThreshold\n    );\n    const inferenceEndTime = performance.now();\n    console.log(\n      `[oil-storage-tank-detection] inference completed. Time taken: ${(inferenceEndTime - inferenceStartTime).toFixed(2)}ms`\n    );\n    return {\n      detections: outputs,\n      geoRawImage\n    };\n  }\n  async postProcessor(outputs, geoRawImage, CONFIDENCE_THRESHOLD = 0.5, NMS_THRESHOLD = 0.3) {\n    const outputData = outputs.data;\n    const [_, boxes, dims] = outputs.dims;\n    const predictions = [];\n    for (let i = 0; i < boxes; i++) {\n      const box = {\n        center_x: outputData[i * dims],\n        center_y: outputData[i * dims + 1],\n        width: outputData[i * dims + 2],\n        height: outputData[i * dims + 3],\n        confidence: outputData[i * dims + 4],\n        class_score: outputData[i * dims + 5]\n      };\n      predictions.push(box);\n    }\n    const filteredPredictions = predictions.filter(\n      (box) => box.confidence > CONFIDENCE_THRESHOLD\n    );\n    const finalPredictions = [];\n    const sorted = filteredPredictions.sort(\n      (a, b) => b.confidence - a.confidence\n    );\n    for (const pred of sorted) {\n      let keep = true;\n      for (const final of finalPredictions) {\n        const iou = calculateIOU(pred, final);\n        if (iou > NMS_THRESHOLD) {\n          keep = false;\n          break;\n        }\n      }\n      if (keep) {\n        finalPredictions.push(pred);\n      }\n    }\n    function calculateIOU(box1, box2) {\n      const x1 = Math.max(\n        box1.center_x - box1.width / 2,\n        box2.center_x - box2.width / 2\n      );\n      const y1 = Math.max(\n        box1.center_y - box1.height / 2,\n        box2.center_y - box2.height / 2\n      );\n      const x2 = Math.min(\n        box1.center_x + box1.width / 2,\n        box2.center_x + box2.width / 2\n      );\n      const y2 = Math.min(\n        box1.center_y + box1.height / 2,\n        box2.center_y + box2.height / 2\n      );\n      const intersection = Math.max(0, x2 - x1) * Math.max(0, y2 - y1);\n      const area1 = box1.width * box1.height;\n      const area2 = box2.width * box2.height;\n      return intersection / (area1 + area2 - intersection);\n    }\n    const features = finalPredictions.map((box) => {\n      const x1 = box.center_x - box.width / 2;\n      const y1 = box.center_y - box.height / 2;\n      const x2 = box.center_x + box.width / 2;\n      const y2 = box.center_y + box.height / 2;\n      const imageWidth = geoRawImage.width;\n      const imageHeight = geoRawImage.height;\n      const coords = [\n        [x1 * (imageWidth / 1024), y1 * (imageHeight / 1024)],\n        [x2 * (imageWidth / 1024), y1 * (imageHeight / 1024)],\n        [x2 * (imageWidth / 1024), y2 * (imageHeight / 1024)],\n        [x1 * (imageWidth / 1024), y2 * (imageHeight / 1024)],\n        [x1 * (imageWidth / 1024), y1 * (imageHeight / 1024)]\n        // Close the polygon\n      ];\n      const geoCoords = coords.map(\n        (coord) => geoRawImage.pixelToWorld(coord[0], coord[1])\n      );\n      return {\n        type: \"Feature\",\n        properties: {\n          confidence: box.class_score\n        },\n        geometry: {\n          type: \"Polygon\",\n          coordinates: [geoCoords]\n        }\n      };\n    });\n    return {\n      type: \"FeatureCollection\",\n      features\n    };\n  }\n};\n__publicField(_OilStorageTankDetection, \"instance\", null);\nlet OilStorageTankDetection = _OilStorageTankDetection;\nclass BaseDenseSegmentationModel extends BaseModel {\n  constructor(model_id, providerParams, modelParams) {\n    super(model_id, providerParams, modelParams);\n    __publicField(this, \"model\");\n    __publicField(this, \"processor\");\n    /** Tile edge length in pixels. */\n    __publicField(this, \"tileSize\", 1024);\n    /** Overlap between adjacent tiles for feather blending. */\n    __publicField(this, \"tileOverlap\", 64);\n    /** Default probability threshold for binarization. */\n    __publicField(this, \"defaultThreshold\", 0.5);\n  }\n  async initializeModel() {\n    if (this.model) return;\n    this.processor = await ImageProcessor.from_pretrained(this.model_id);\n    const pretrainedModel = await PreTrainedModel.from_pretrained(\n      this.model_id,\n      this.modelParams\n    );\n    this.model = pretrainedModel.sessions.model;\n  }\n  resolveProbabilityOutput(outputs) {\n    const tensor = outputs[this.outputName];\n    if (!tensor) {\n      throw new Error(\n        `Model output \"${this.outputName}\" not found; got [${Object.keys(outputs).join(\", \")}]`\n      );\n    }\n    const dims = tensor.dims;\n    const raw = tensor.data ?? tensor.cpuData;\n    return {\n      type: tensor.type,\n      dims,\n      size: tensor.size,\n      data: raw\n    };\n  }\n  featherWeight(size, overlap) {\n    const ramp = new Float32Array(size);\n    ramp.fill(1);\n    if (overlap > 0) {\n      for (let i = 0; i < overlap; i++) {\n        const t = i / (overlap - 1 || 1);\n        ramp[i] = t;\n        ramp[size - 1 - i] = t;\n      }\n    }\n    const weights = new Float32Array(size * size);\n    for (let y = 0; y < size; y++) {\n      for (let x = 0; x < size; x++) {\n        weights[y * size + x] = ramp[y] * ramp[x];\n      }\n    }\n    return weights;\n  }\n  async runTile(tileImage) {\n    if (!this.processor || !this.model) {\n      throw new Error(\"Model or processor not initialized\");\n    }\n    const inputs = await this.processor(tileImage);\n    const pixelValues = inputs.pixel_values;\n    const dataCopy = pixelValues.data instanceof Float32Array ? new Float32Array(pixelValues.data) : Float32Array.from(pixelValues.data);\n    const feed = new Tensor(\"float32\", dataCopy, pixelValues.dims);\n    let outputs;\n    try {\n      outputs = await this.model.run({\n        [this.inputName]: feed\n      });\n    } catch (err) {\n      const detail = err instanceof Error ? err.message : typeof err === \"number\" ? `ONNX Runtime abort (${err}) — often WASM out-of-memory for this ${this.tileSize}px fp32 model. Try WebGPU (Chrome/Edge) or a smaller AOI.` : String(err);\n      throw new Error(`Dense segmentation tile inference failed: ${detail}`);\n    }\n    const { data } = this.resolveProbabilityOutput(outputs);\n    return {\n      data,\n      height: this.tileSize,\n      width: this.tileSize\n    };\n  }\n  /**\n   * Overlapped tiled inference with feather blending, matching the\n   * ChangeStar pipeline (tile_size / overlap / threshold).\n   */\n  async inferDenseMask(geoRawImage, threshold) {\n    const { height, width } = geoRawImage;\n    const tileSize = this.tileSize;\n    const overlap = Math.min(this.tileOverlap, tileSize - 1);\n    const stride = tileSize - overlap;\n    const feather = this.featherWeight(tileSize, overlap);\n    const accum = new Float32Array(height * width);\n    const weightSum = new Float32Array(height * width);\n    for (let rowOff = 0; rowOff < height; rowOff += stride) {\n      for (let colOff = 0; colOff < width; colOff += stride) {\n        const winH = Math.min(tileSize, height - rowOff);\n        const winW = Math.min(tileSize, width - colOff);\n        const croppedRaw = await geoRawImage.crop([\n          colOff,\n          rowOff,\n          colOff + winW - 1,\n          rowOff + winH - 1\n        ]);\n        const padH = tileSize - winH;\n        const padW = tileSize - winW;\n        const paddedRaw = padH > 0 || padW > 0 ? await croppedRaw.pad([0, padW, 0, padH]) : croppedRaw;\n        const tileImage = GeoRawImage.fromRawImage(\n          paddedRaw,\n          geoRawImage.getBounds(),\n          geoRawImage.getCRS()\n        );\n        const { data: prob } = await this.runTile(tileImage);\n        for (let y = 0; y < winH; y++) {\n          for (let x = 0; x < winW; x++) {\n            const srcIdx = y * tileSize + x;\n            const dstIdx = (rowOff + y) * width + (colOff + x);\n            const w = feather[y * tileSize + x];\n            accum[dstIdx] += prob[srcIdx] * w;\n            weightSum[dstIdx] += w;\n          }\n        }\n      }\n    }\n    const binary = new Uint8Array(height * width);\n    for (let i = 0; i < height * width; i++) {\n      const w = weightSum[i] === 0 ? 1 : weightSum[i];\n      binary[i] = accum[i] / w > threshold ? 255 : 0;\n    }\n    const scale = height > 512 || width > 512 ? 2 : 1;\n    const contourH = Math.max(1, Math.floor(height / scale));\n    const contourW = Math.max(1, Math.floor(width / scale));\n    let contourBinary = binary;\n    let contourImage = geoRawImage;\n    if (scale > 1) {\n      contourBinary = new Uint8Array(contourH * contourW);\n      for (let y = 0; y < contourH; y++) {\n        for (let x = 0; x < contourW; x++) {\n          contourBinary[y * contourW + x] = binary[y * scale * width + x * scale];\n        }\n      }\n      contourImage = new GeoRawImage(\n        contourBinary,\n        contourW,\n        contourH,\n        1,\n        geoRawImage.getBounds(),\n        geoRawImage.getCRS()\n      );\n    }\n    const maskTensor = new Tensor(\"uint8\", contourBinary, [\n      1,\n      1,\n      contourH,\n      contourW\n    ]);\n    const masksToFC = maskToGeoJSON({ mask: [maskTensor] }, contourImage);\n    const features = [];\n    masksToFC.forEach((fc) => {\n      fc.features.forEach((feature2) => {\n        feature2.properties = {\n          ...feature2.properties || {},\n          class: \"building\"\n        };\n        features.push(feature2);\n      });\n    });\n    return {\n      type: \"FeatureCollection\",\n      features\n    };\n  }\n  async inference(params) {\n    const {\n      inputs: { polygon: polygon2 },\n      postProcessingParams: { confidenceThreshold } = {},\n      mapSourceParams\n    } = params;\n    if (!polygon2) {\n      throw new Error(\"Polygon input is required for dense segmentation\");\n    }\n    if (!polygon2.geometry || polygon2.geometry.type !== \"Polygon\") {\n      throw new Error(\"Input must be a valid GeoJSON Polygon feature\");\n    }\n    if (!this.initialized) {\n      await this.initialize();\n    }\n    if (!this.model || !this.processor || !this.dataProvider) {\n      throw new Error(\"Model or data provider not initialized\");\n    }\n    const geoRawImage = await this.polygonToImage(\n      polygon2,\n      mapSourceParams == null ? void 0 : mapSourceParams.zoomLevel,\n      mapSourceParams == null ? void 0 : mapSourceParams.bands,\n      mapSourceParams == null ? void 0 : mapSourceParams.expression\n    );\n    const threshold = typeof confidenceThreshold === \"number\" ? confidenceThreshold : this.defaultThreshold;\n    const taskName = this.model_id.split(\"/\").pop() ?? \"dense-segmentation\";\n    const inferenceStartTime = performance.now();\n    console.log(`[${taskName}] starting dense segmentation inference...`);\n    const detections = await this.inferDenseMask(geoRawImage, threshold);\n    const inferenceEndTime = performance.now();\n    console.log(\n      `[${taskName}] inference completed. Time taken: ${(inferenceEndTime - inferenceStartTime).toFixed(2)}ms`\n    );\n    return {\n      detections,\n      geoRawImage\n    };\n  }\n}\nconst _ChangeStarBuildingSegmentation = class _ChangeStarBuildingSegmentation extends BaseDenseSegmentationModel {\n  constructor(model_id, providerParams, modelParams) {\n    super(model_id, providerParams, modelParams);\n    __publicField(this, \"inputName\", \"image\");\n    __publicField(this, \"outputName\", \"building_prob\");\n    __publicField(this, \"tileSize\", 1024);\n    __publicField(this, \"tileOverlap\", 64);\n    __publicField(this, \"defaultThreshold\", 0.5);\n  }\n  static async getInstance(model_id, providerParams, modelParams) {\n    if (!_ChangeStarBuildingSegmentation.instanceRef || parametersChanged(\n      _ChangeStarBuildingSegmentation.instanceRef,\n      model_id,\n      providerParams,\n      modelParams\n    )) {\n      _ChangeStarBuildingSegmentation.instanceRef = new _ChangeStarBuildingSegmentation(\n        model_id,\n        providerParams,\n        modelParams\n      );\n      await _ChangeStarBuildingSegmentation.instanceRef.initialize();\n    }\n    return { instance: _ChangeStarBuildingSegmentation.instanceRef };\n  }\n};\n__publicField(_ChangeStarBuildingSegmentation, \"instanceRef\", null);\n__publicField(_ChangeStarBuildingSegmentation, \"default_huggingface_id\", \"geobase/changestar-building-segmentation-vitb\");\nlet ChangeStarBuildingSegmentation = _ChangeStarBuildingSegmentation;\nconst _ImageFeatureExtraction = class _ImageFeatureExtraction extends BaseModel {\n  constructor(model_id, providerParams, modelParams) {\n    super(model_id, providerParams, modelParams);\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    __publicField(this, \"extractor\");\n    __publicField(this, \"patchSize\");\n  }\n  static async getInstance(model_id, providerParams, modelParams) {\n    if (!_ImageFeatureExtraction.instance || parametersChanged(\n      _ImageFeatureExtraction.instance,\n      model_id,\n      providerParams,\n      modelParams\n    )) {\n      _ImageFeatureExtraction.instance = new _ImageFeatureExtraction(\n        model_id,\n        providerParams,\n        modelParams\n      );\n      await _ImageFeatureExtraction.instance.initialize();\n    }\n    return { instance: _ImageFeatureExtraction.instance };\n  }\n  async initializeModel() {\n    this.extractor = await pipeline(\n      \"image-feature-extraction\",\n      this.model_id,\n      this.modelParams\n    );\n    this.extractor.processor.image_processor.do_resize = false;\n    this.patchSize = this.extractor.model.config.patch_size;\n  }\n  /**\n   * Performs image feature extraction on a geographic area specified by a GeoJSON polygon.\n   * Extracts dense feature representations using DINOv3 and computes patch-to-patch similarities.\n   *\n   * @param params - Inference parameters containing polygon and processing options\n   * @returns Promise<ImageFeatureExtractionResults> containing feature vectors, similarity matrix, and metadata\n   * @throws {Error} If data provider, model or processor are not properly initialized\n   */\n  async inference(params) {\n    var _a, _b;\n    const {\n      inputs: { polygon: polygon2 },\n      postProcessingParams: { similarityThreshold = 0.5 } = {},\n      mapSourceParams\n    } = params;\n    if (!polygon2) {\n      throw new Error(\"Polygon input is required for feature extraction\");\n    }\n    if (!polygon2.geometry || polygon2.geometry.type !== \"Polygon\") {\n      throw new Error(\"Input must be a valid GeoJSON Polygon feature\");\n    }\n    if (!this.initialized) {\n      await this.initialize();\n    }\n    if (!this.extractor || !this.patchSize) {\n      throw new Error(\"Feature extractor not properly initialized\");\n    }\n    const geoRawImage = await this.polygonToImage(\n      polygon2,\n      mapSourceParams == null ? void 0 : mapSourceParams.zoomLevel,\n      mapSourceParams == null ? void 0 : mapSourceParams.bands,\n      mapSourceParams == null ? void 0 : mapSourceParams.expression\n    );\n    const inferenceStartTime = performance.now();\n    console.log(\"[image-feature-extraction] starting inference...\");\n    try {\n      const features = await this.extractor(geoRawImage, {\n        pooling: \"none\"\n      });\n      const numRegisterTokens = this.extractor.model.config.num_register_tokens ?? 0;\n      const startIndex = 1 + numRegisterTokens;\n      const patchFeatures = features.slice(null, [startIndex, null]);\n      const normalizedFeatures = patchFeatures.normalize(2, -1);\n      const scores = await matmul(\n        normalizedFeatures,\n        normalizedFeatures.permute(0, 2, 1)\n      );\n      const similarityMatrix = (await scores.tolist())[0];\n      const featureVectors = (await patchFeatures.tolist())[0];\n      let filteredFeatures = featureVectors;\n      let filteredSimilarityMatrix = similarityMatrix;\n      if (similarityThreshold > 0) {\n        const highSimilarityPatches = /* @__PURE__ */ new Set();\n        for (let i = 0; i < similarityMatrix.length; i++) {\n          for (let j = 0; j < similarityMatrix[i].length; j++) {\n            if (i !== j && similarityMatrix[i][j] >= similarityThreshold) {\n              highSimilarityPatches.add(i);\n              highSimilarityPatches.add(j);\n            }\n          }\n        }\n        const patchIndices = Array.from(highSimilarityPatches).sort(\n          (a, b) => a - b\n        );\n        filteredFeatures = patchIndices.map((i) => featureVectors[i]);\n        filteredSimilarityMatrix = patchIndices.map(\n          (i) => patchIndices.map((j) => similarityMatrix[i][j])\n        );\n      }\n      const inferenceEndTime = performance.now();\n      console.log(\n        `[image-feature-extraction] inference completed. Time taken: ${(inferenceEndTime - inferenceStartTime).toFixed(2)}ms`\n      );\n      const result = {\n        features: filteredFeatures,\n        similarityMatrix: filteredSimilarityMatrix,\n        patchSize: this.patchSize,\n        geoRawImage,\n        metadata: {\n          numPatches: filteredFeatures.length,\n          featureDimensions: ((_a = filteredFeatures[0]) == null ? void 0 : _a.length) || 0,\n          modelId: this.model_id\n        }\n      };\n      console.log(\"[image-feature-extraction] Result structure:\", {\n        featuresLength: result.features.length,\n        similarityMatrixLength: result.similarityMatrix.length,\n        patchSize: result.patchSize,\n        geoRawImageBounds: (_b = result.geoRawImage) == null ? void 0 : _b.getBounds(),\n        metadata: result.metadata\n      });\n      return result;\n    } catch (error) {\n      console.error(\"Feature extraction error:\", error);\n      throw new Error(\n        `Feature extraction failed: ${error instanceof Error ? error.message : \"Unknown error\"}`\n      );\n    }\n  }\n};\n__publicField(_ImageFeatureExtraction, \"instance\", null);\nlet ImageFeatureExtraction = _ImageFeatureExtraction;\nconst _BuildingFootPrintSegmentation = class _BuildingFootPrintSegmentation extends BaseModel {\n  constructor(model_id, providerParams, modelParams) {\n    super(model_id, providerParams, modelParams);\n    __publicField(this, \"model\");\n    __publicField(this, \"processor\");\n  }\n  static async getInstance(model_id, providerParams, modelParams) {\n    if (!_BuildingFootPrintSegmentation.instance || parametersChanged(\n      _BuildingFootPrintSegmentation.instance,\n      model_id,\n      providerParams,\n      modelParams\n    )) {\n      _BuildingFootPrintSegmentation.instance = new _BuildingFootPrintSegmentation(\n        model_id,\n        providerParams,\n        modelParams\n      );\n      await _BuildingFootPrintSegmentation.instance.initialize();\n    }\n    return { instance: _BuildingFootPrintSegmentation.instance };\n  }\n  async initializeModel() {\n    if (this.model) return;\n    this.processor = await ImageProcessor.from_pretrained(\n      this.model_id,\n      this.modelParams\n    );\n    const pretrainedModel = await PreTrainedModel.from_pretrained(\n      this.model_id,\n      this.modelParams\n    );\n    this.model = pretrainedModel.sessions.model;\n  }\n  async inference(params) {\n    const {\n      inputs: { polygon: polygon2 },\n      postProcessingParams: { confidenceThreshold = 0.3, minArea = 20 } = {},\n      mapSourceParams\n    } = params;\n    if (!polygon2) {\n      throw new Error(\n        \"Polygon input is required for building footprint segmentation\"\n      );\n    }\n    if (!polygon2.geometry || polygon2.geometry.type !== \"Polygon\") {\n      throw new Error(\"Input must be a valid GeoJSON Polygon feature\");\n    }\n    await this.initialize();\n    if (!this.dataProvider) {\n      throw new Error(\"Data provider not initialized\");\n    }\n    const patchSize = 256;\n    const geoRawImage = await this.polygonToImage(\n      polygon2,\n      mapSourceParams == null ? void 0 : mapSourceParams.zoomLevel,\n      mapSourceParams == null ? void 0 : mapSourceParams.bands,\n      mapSourceParams == null ? void 0 : mapSourceParams.expression\n    );\n    const geoPatches = await geoRawImage.toPatches(patchSize, patchSize);\n    const geoPatchesFlat = geoPatches.flat();\n    console.log(`Inferencing on ${geoPatchesFlat.length} patches`);\n    const inferenceStartTime = performance.now();\n    console.log(\"[building-footprint-segmentation] starting inference...\");\n    try {\n      if (!this.model) {\n        throw new Error(\"Model not initialized\");\n      }\n      if (!this.processor) {\n        throw new Error(\"Processor not initialized\");\n      }\n      const inputsAll = await this.processor(geoPatchesFlat);\n      const pixelValues = inputsAll.pixel_values.permute(0, 2, 3, 1);\n      const resultAll = await this.model.run({ input_1: pixelValues });\n      const uint8Data = new Uint8Array(resultAll.conv2d_12.data.length);\n      for (let i = 0; i < resultAll.conv2d_12.data.length; i++) {\n        uint8Data[i] = Math.min(\n          255,\n          Math.max(0, resultAll.conv2d_12.data[i] * 255)\n        );\n      }\n      const predictionRawImages = [];\n      const rowSize = geoPatches[0].length;\n      const total = resultAll.conv2d_12.dims[0];\n      for (let i = 0; i < total; i++) {\n        const batchData = uint8Data.subarray(\n          i * resultAll.conv2d_12.dims[1] * resultAll.conv2d_12.dims[2],\n          (i + 1) * resultAll.conv2d_12.dims[1] * resultAll.conv2d_12.dims[2]\n        );\n        const rawImage = new RawImage(\n          batchData,\n          resultAll.conv2d_12.dims[2],\n          resultAll.conv2d_12.dims[1],\n          1\n        );\n        const row = Math.floor(i / rowSize);\n        if (!predictionRawImages[row]) {\n          predictionRawImages[row] = [];\n        }\n        predictionRawImages[row].push(rawImage);\n      }\n      const stitchedPrediction = GeoRawImage.fromPatches(\n        predictionRawImages,\n        geoRawImage.getBounds(),\n        geoRawImage.getCRS()\n      );\n      const results = await this.postProcessor(\n        stitchedPrediction,\n        confidenceThreshold,\n        minArea\n      );\n      const inferenceEndTime = performance.now();\n      console.log(\n        `[building-footprint-segmentagtion] inference completed. Time taken: ${(inferenceEndTime - inferenceStartTime).toFixed(2)}ms`\n      );\n      return {\n        detections: results,\n        geoRawImage\n      };\n    } catch (error) {\n      throw error;\n    }\n  }\n  async postProcessor(output, CONFIDENCE_THRESHOLD = 0.1, minArea = 20) {\n    try {\n      if (CONFIDENCE_THRESHOLD > 0 && CONFIDENCE_THRESHOLD < 1) {\n        CONFIDENCE_THRESHOLD = Math.floor(CONFIDENCE_THRESHOLD * 255);\n      }\n      const contourGen = contours().size([output.width, output.height]).thresholds([CONFIDENCE_THRESHOLD]);\n      const data = [];\n      output.data.forEach((v) => {\n        data.push(v);\n      });\n      const generatedContours = contourGen(data);\n      const features = [];\n      generatedContours.forEach((contour) => {\n        contour.coordinates.forEach((polygon2) => {\n          polygon2.forEach((ring) => {\n            if (ring.length < 3) return;\n            const area2 = Math.abs(polygonArea(ring));\n            if (area2 < minArea) return;\n            const coordinates = ring.map(\n              (coord) => output.pixelToWorld(coord[0], coord[1])\n            );\n            features.push({\n              type: \"Feature\",\n              properties: {\n                // confidence: 1.0,\n              },\n              geometry: {\n                type: \"Polygon\",\n                coordinates: [coordinates]\n              }\n            });\n          });\n        });\n      });\n      const geojson = {\n        type: \"FeatureCollection\",\n        features\n      };\n      return geojson;\n    } catch (error) {\n      console.error(\"Error processing contours:\", error);\n      throw error;\n    }\n  }\n};\n__publicField(_BuildingFootPrintSegmentation, \"instance\", null);\n__publicField(_BuildingFootPrintSegmentation, \"default_huggingface_id\", \"geobase/building-footprint-segmentation\");\nlet BuildingFootPrintSegmentation = _BuildingFootPrintSegmentation;\nconst buildingFootprintFactory = (params, modelId, modelParams) => BuildingFootPrintSegmentation.getInstance(modelId, params, modelParams);\nconst changeStarFactory = (params, modelId, modelParams) => ChangeStarBuildingSegmentation.getInstance(\n  modelId,\n  params,\n  modelParams ?? { dtype: \"fp32\" }\n);\nconst buildingSegmentationFactories = {\n  [BuildingFootPrintSegmentation.default_huggingface_id]: buildingFootprintFactory,\n  [ChangeStarBuildingSegmentation.default_huggingface_id]: changeStarFactory\n};\nconst BuildingSegmentationFactory = {\n  get knownModelIds() {\n    return Object.keys(buildingSegmentationFactories);\n  },\n  getInstance(params, modelId, modelParams) {\n    const resolvedId = modelId == null ? void 0 : modelId.trim();\n    if (!resolvedId) {\n      return Promise.reject(\n        new Error(\n          `Building segmentation modelId is required. Known ids: ${this.knownModelIds.join(\", \")}`\n        )\n      );\n    }\n    const create = buildingSegmentationFactories[resolvedId];\n    if (!create) {\n      return Promise.reject(\n        new Error(\n          `Unknown building segmentation modelId \"${resolvedId}\". Known ids: ${this.knownModelIds.join(\", \")}`\n        )\n      );\n    }\n    return create(params, resolvedId, modelParams);\n  }\n};\nconst modelRegistry = [\n  {\n    task: \"zero-shot-object-detection\",\n    library: \"@huggingface/transformers\",\n    description: \"This model can detect objects given a label. If a label falls outside of the categories that a more specialised model can handle, this model should be used. Prefer not to use this model if the label is a specific object that is one of the ones from this list: LightVehicle, Person, Building, Utility Pole, Boat, Bike, Container, Truck, Gastank, Digger, SolarPanels, Bus.\",\n    examples: [\n      \"Find all aircraft in this satellite image.\",\n      \"Locate wind turbines in this region.\",\n      \"Identify train stations along this railway.\",\n      \"Detect oil rigs in this offshore area.\",\n      \"Find helipads on rooftops.\"\n    ],\n    chainableTasks: [\"mask-generation\"],\n    ioConfig: {},\n    geobase_ai_pipeline: (params, modelId = \"onnx-community/grounding-dino-tiny-ONNX\", modelParams) => {\n      return ZeroShotObjectDetection.getInstance(modelId, params, modelParams);\n    }\n  },\n  {\n    task: \"mask-generation\",\n    library: \"@huggingface/transformers\",\n    description: \"Useful when user wants to find things that are best represented as contiguous areas like roads, farms, car-parks, lakes, arrays of solar panels or even mountain ranges. Not useful for finding individual items.\",\n    examples: [\n      \"Segment all forests in this region.\",\n      \"Identify all lakes in this satellite image.\",\n      \"Detect all agricultural fields in this farmland.\",\n      \"Locate urban parks in this cityscape.\"\n    ],\n    ioConfig: {},\n    geobase_ai_pipeline: (params, modelId = \"Xenova/slimsam-77-uniform\", modelParams) => {\n      return MaskGeneration.getInstance(modelId, params, modelParams);\n    }\n  },\n  {\n    task: \"object-detection\",\n    library: \"@huggingface/transformers\",\n    description: \"This model is trained to detect objects belonging to these classes: LightVehicle, Person, Building, Utility Pole, Boat, Bike, Container, Truck, Gastank, Digger, SolarPanels, Bus. It should be used for finding individual items in a drone or satellite image that fall into these categories. It should not be used for detecting areas or regions for example: a field, a forest or a body of water.\",\n    examples: [\n      \"Detect all trucks in this urban area.\",\n      \"Find cars and motorcycles in this highway image.\",\n      \"Identify buildings in this industrial zone.\",\n      \"Locate all boats in this coastal image.\",\n      \"Spot utility poles in this rural road image.\"\n    ],\n    chainableTasks: [\"mask-generation\"],\n    ioConfig: {},\n    geobase_ai_pipeline: (params, modelId = \"geobase/WALDO30-yolov8m-640x640\", modelParams) => {\n      return ObjectDetection.getInstance(modelId, params, modelParams);\n    }\n  },\n  {\n    task: \"oriented-object-detection\",\n    library: \"@huggingface/transformers\",\n    description: \"Detects objects with orientation (rotated bounding boxes) in satellite or aerial imagery. Useful for scenarios where objects are not axis-aligned, such as ships, airplanes, or vehicles in arbitrary directions.\",\n    examples: [\n      \"Detect oriented objects in this industrial area.\",\n      \"Find rotated bounding boxes for vehicles in this image.\",\n      \"Identify ships with their orientation in this port.\",\n      \"Detect airplanes on a runway regardless of direction.\"\n    ],\n    ioConfig: {},\n    geobase_ai_pipeline: (params, modelId = \"geobase/gghl-oriented-object-detection\", modelParams = {\n      dtype: \"q8\"\n    }) => {\n      return OrientedObjectDetection.getInstance(modelId, params, modelParams);\n    }\n  },\n  {\n    task: \"land-cover-classification\",\n    library: \"geoai\",\n    description: \"Classifies land cover types in a given region. Useful for mapping vegetation, urban areas, water, and other land use categories.\",\n    examples: [\n      \"Categorize this area by land use.\",\n      \"What are the green areas on this map?\",\n      \"Find residential and commercial zones.\",\n      \"Identify agricultural fields and forests.\"\n    ],\n    ioConfig: {},\n    geobase_ai_pipeline: (params, modelId = \"geobase/sparsemask\", modelParams = {\n      dtype: \"fp32\"\n    }) => {\n      return LandCoverClassification.getInstance(modelId, params, modelParams);\n    }\n  },\n  {\n    task: \"solar-panel-detection\",\n    library: \"geoai\",\n    description: \"Detects and locates solar panels in satellite or aerial imagery. Useful for identifying solar farms, rooftop solar installations, or tracking renewable energy infrastructure.\",\n    examples: [\n      \"Find all solar panels in this industrial area.\",\n      \"Locate solar farms in this desert region.\",\n      \"Identify rooftop solar installations in this city.\"\n    ],\n    ioConfig: {},\n    geobase_ai_pipeline: (params, modelId = \"geobase/solar-panel-detection\", modelParams = {\n      dtype: \"q8\"\n    }) => {\n      return SolarPanelDetection.getInstance(modelId, params, modelParams);\n    }\n  },\n  {\n    task: \"ship-detection\",\n    library: \"geoai\",\n    description: \"Detects ships and large boats in maritime or coastal satellite imagery. Useful for monitoring shipping lanes, ports, or maritime activity.\",\n    examples: [\n      \"Detect all ships in this harbor.\",\n      \"Find boats in this coastal image.\",\n      \"Identify vessels in open water.\"\n    ],\n    ioConfig: {},\n    geobase_ai_pipeline: (params, modelId = \"geobase/ship-detection\", modelParams = {\n      dtype: \"q8\"\n    }) => {\n      return ShipDetection.getInstance(modelId, params, modelParams);\n    }\n  },\n  {\n    task: \"car-detection\",\n    library: \"geoai\",\n    description: \"Detects cars and other small vehicles in urban, suburban, or rural imagery. Useful for traffic analysis, parking lot monitoring, or urban planning.\",\n    examples: [\n      \"Find all cars in this parking lot.\",\n      \"Detect vehicles on this highway.\",\n      \"Identify cars in this city block.\"\n    ],\n    ioConfig: {},\n    geobase_ai_pipeline: (params, modelId = \"geobase/car-detection\", modelParams = {\n      dtype: \"q8\"\n    }) => {\n      return CarDetection.getInstance(modelId, params, modelParams);\n    }\n  },\n  {\n    task: \"wetland-segmentation\",\n    library: \"geoai\",\n    description: \"Segments and identifies wetland areas in satellite imagery. Useful for environmental monitoring, conservation, and land use planning.\",\n    examples: [\n      \"Segment all wetlands in this region.\",\n      \"Identify marsh areas in this satellite image.\",\n      \"Find wetland zones near this river.\",\n      \"Find water bodies\"\n    ],\n    ioConfig: {},\n    geobase_ai_pipeline: (params, modelId = \"geobase/wetland-segmentation\", modelParams = {\n      dtype: \"q8\"\n    }) => {\n      return WetLandSegmentation.getInstance(modelId, params, modelParams);\n    }\n  },\n  {\n    task: \"building-detection\",\n    library: \"geoai\",\n    description: \"Detects buildings and built structures in satellite or aerial imagery. Useful for urban development, disaster response, or infrastructure mapping.\",\n    examples: [\n      \"Detect all buildings in this urban area.\",\n      \"Find houses in this rural region.\",\n      \"Identify structures in this industrial zone.\"\n    ],\n    ioConfig: {},\n    geobase_ai_pipeline: (params, modelId = \"geobase/building-detection\", modelParams = {\n      dtype: \"q8\"\n    }) => {\n      return BuildingDetection.getInstance(modelId, params, modelParams);\n    }\n  },\n  {\n    task: \"oil-storage-tank-detection\",\n    library: \"geoai\",\n    description: \"Detects oil storage tanks in industrial or port areas. Useful for monitoring energy infrastructure, compliance, or risk assessment.\",\n    examples: [\n      \"Find all oil storage tanks in this refinery.\",\n      \"Detect tanks in this port facility.\",\n      \"Identify oil tanks in this industrial area.\"\n    ],\n    ioConfig: {},\n    geobase_ai_pipeline: (params, modelId = \"geobase/oil-storage-tank-detection\", modelParams = {\n      dtype: \"q8\"\n    }) => {\n      return OilStorageTankDetection.getInstance(modelId, params, modelParams);\n    }\n  },\n  {\n    task: \"building-footprint-segmentation\",\n    library: \"geoai\",\n    description: \"Segments the precise outlines (footprints) of buildings in imagery. Defaults to ChangeStar ViT-B; pass modelId for the lighter footprint model. Useful for mapping, urban planning, or disaster assessment.\",\n    examples: [\n      \"Segment building footprints in this city block.\",\n      \"Identify the outlines of all buildings in this image.\",\n      \"Find building perimeters in this urban area.\"\n    ],\n    ioConfig: {},\n    geobase_ai_pipeline: (params, modelId = ChangeStarBuildingSegmentation.default_huggingface_id, modelParams) => BuildingSegmentationFactory.getInstance(params, modelId, modelParams)\n  },\n  {\n    task: \"image-feature-extraction\",\n    library: \"@huggingface/transformers\",\n    description: \"Extracts dense feature representations from satellite or aerial imagery using DINOv3. Useful for visual similarity analysis, feature-based image search, and semantic feature exploration. Provides patch-level features and similarity matrices for advanced image understanding.\",\n    examples: [\n      \"Extract visual features from this satellite image for similarity analysis.\",\n      \"Find regions with similar visual characteristics in this aerial photo.\",\n      \"Analyze the feature patterns in this urban area.\",\n      \"Extract semantic features for content-aware image processing.\",\n      \"Generate feature vectors for machine learning applications.\"\n    ],\n    chainableTasks: [\"object-detection\", \"mask-generation\"],\n    ioConfig: {},\n    geobase_ai_pipeline: (params, modelId = \"onnx-community/dinov3-vits16-pretrain-lvd1689m-ONNX\", modelParams = {\n      dtype: \"q8\"\n    }) => {\n      return ImageFeatureExtraction.getInstance(modelId, params, modelParams);\n    }\n  }\n];\nclass Pipeline {\n  /**\n   * Builds a dependency graph from modelRegistry chainableTasks\n   */\n  static buildTaskGraph() {\n    const graph = {};\n    for (const model of modelRegistry) {\n      graph[model.task] = new Set(model.chainableTasks || []);\n    }\n    return graph;\n  }\n  /**\n   * Finds all valid task chains using BFS\n   */\n  static findValidChains(tasks) {\n    var _a;\n    const graph = Pipeline.buildTaskGraph();\n    const validChains = [];\n    const queue = tasks.map(\n      (task) => ({\n        chain: [task],\n        remaining: new Set(tasks.filter((t) => t !== task))\n      })\n    );\n    while (queue.length > 0) {\n      const current = queue.shift();\n      if (current.remaining.size === 0) {\n        validChains.push(current.chain);\n        continue;\n      }\n      const lastTask = current.chain[current.chain.length - 1];\n      for (const nextTask of current.remaining) {\n        if ((_a = graph[lastTask]) == null ? void 0 : _a.has(nextTask)) {\n          queue.push({\n            chain: [...current.chain, nextTask],\n            remaining: new Set(\n              [...current.remaining].filter((t) => t !== nextTask)\n            )\n          });\n        }\n      }\n    }\n    return validChains;\n  }\n  /**\n   * Orders tasks in a valid chainable sequence\n   */\n  static orderChainTasks(tasks) {\n    const validChains = this.findValidChains(tasks);\n    if (validChains.length === 0) {\n      throw new Error(\n        `Cannot find a valid order for tasks: ${tasks.join(\", \")}`\n      );\n    }\n    return validChains[0];\n  }\n  /**\n   * Validates and reorders tasks array in-place\n   */\n  static validateChainCompatibility(tasks) {\n    const ordered = this.orderChainTasks(tasks);\n    return tasks.splice(0, tasks.length, ...ordered);\n  }\n  /**\n   * Validates input for a specific task\n   */\n  static validateTaskInput(task, input) {\n    var _a;\n    const ioConfig = (_a = modelRegistry.find((model) => model.task === task)) == null ? void 0 : _a.ioConfig;\n    if (!(ioConfig == null ? void 0 : ioConfig.inputs)) return;\n    for (const field of ioConfig.inputs) {\n      if (!(field in input)) {\n        throw new GeobaseError(\n          ErrorType.MissingInputField,\n          `Task ${task} requires input field '${field}' but it was not provided`\n        );\n      }\n    }\n  }\n  /**\n   * Creates a pipeline for a single task or a chain of tasks\n   * @param taskOrTasks Single task or list of tasks to chain\n   * @param providerParams Provider parameters\n   * @returns A function that takes inputs and returns the output of the last task in the chain\n   */\n  static async pipeline(taskOrTasks, providerParams) {\n    if (taskOrTasks.length === 1) {\n      const config = modelRegistry.find(\n        (model) => model.task === taskOrTasks[0].task\n      );\n      if (!config) {\n        throw new Error(`Model for task ${taskOrTasks} not found`);\n      }\n      const instance = await config.geobase_ai_pipeline(\n        providerParams,\n        taskOrTasks[0].modelId,\n        taskOrTasks[0].modelParams || config.modelParams\n      );\n      return instance == null ? void 0 : instance.instance;\n    }\n    if (taskOrTasks.length === 0) {\n      throw new Error(\"At least one task must be specified for chaining\");\n    }\n    const taskNames = taskOrTasks.map((taskObj) => taskObj.task);\n    for (const task of taskNames) {\n      const config = modelRegistry.find((model) => model.task === task);\n      if (!config) {\n        throw new Error(`Model for task ${task} not found`);\n      }\n    }\n    const validChain = Pipeline.validateChainCompatibility(taskNames);\n    const validTaskList = validChain.map(\n      (task) => taskOrTasks.find((taskObj) => taskObj.task === task)\n    );\n    const pipelines = [];\n    for (const taskObj of validTaskList) {\n      if (!taskObj) {\n        throw new Error(`Task not found in tasksList`);\n      }\n      const pipeline2 = await Pipeline.pipeline(\n        [\n          {\n            task: taskObj.task,\n            modelId: taskObj.modelId,\n            modelParams: taskObj.modelParams\n          }\n        ],\n        providerParams\n      );\n      pipelines.push({\n        instance: pipeline2,\n        task: taskObj.task\n      });\n    }\n    return {\n      async inference(params) {\n        var _a, _b, _c, _d;\n        let currentInput = {\n          // inferenceInputs: {\n          //   inputs: {},\n          //   postProcessingParams: {},\n          //   mapSourceParams: {},\n          // } as InferenceParams,\n        };\n        for (let i = 0; i < pipelines.length; i++) {\n          const { instance, task } = pipelines[i];\n          currentInput.inferenceInputs = { ...params };\n          try {\n            Pipeline.validateTaskInput(task, currentInput);\n            switch (task) {\n              case \"zero-shot-object-detection\":\n                currentInput = await instance.inference({\n                  inputs: currentInput.inferenceInputs.inputs,\n                  postProcessingParams: {\n                    threshold: (_a = currentInput.inferenceInputs.postProcessingParams) == null ? void 0 : _a.threshold,\n                    topk: (_b = currentInput.inferenceInputs.postProcessingParams) == null ? void 0 : _b.topk\n                  },\n                  mapSourceParams: currentInput.inferenceInputs.mapSourceParams\n                });\n                break;\n              case \"mask-generation\":\n                currentInput = await instance.inference({\n                  inputs: {\n                    ...currentInput.inferenceInputs.inputs,\n                    input: currentInput\n                  },\n                  postProcessingParams: {\n                    maxMasks: (_c = currentInput.inferenceInputs.postProcessingParams) == null ? void 0 : _c.maxMasks\n                  },\n                  mapSourceParams: currentInput.inferenceInputs.mapSourceParams\n                });\n                break;\n              case \"object-detection\":\n                currentInput = await instance.inference({\n                  inputs: currentInput.inferenceInputs.inputs,\n                  postProcessingParams: {\n                    confidence: ((_d = currentInput.inferenceInputs.postProcessingParams) == null ? void 0 : _d.confidence) || 0.9\n                  },\n                  mapSourceParams: currentInput.inferenceInputs.mapSourceParams\n                });\n                break;\n              default:\n                break;\n            }\n          } catch (error) {\n            throw new Error(\n              `Failed to run ${task}: ${(error == null ? void 0 : error.message) || \"Unknown error\"}`\n            );\n          }\n        }\n        return currentInput;\n      }\n    };\n  }\n  static listTasks() {\n    return modelRegistry.map((model) => model.task);\n  }\n  static listModels() {\n    return modelRegistry;\n  }\n}\nconst geoai = {\n  pipeline: Pipeline.pipeline,\n  tasks: Pipeline.listTasks,\n  models: Pipeline.listModels,\n  validateChain: Pipeline.findValidChains\n};\nexport {\n  geoai,\n  utils\n};\n"]}