@india-boundary-corrector/openlayers-layer 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12052,13 +12052,13 @@ var IndiaBoundaryCorrector = (() => {
12052
12052
  var ImageTile_default2 = ImageTileSource;
12053
12053
 
12054
12054
  // ../data/version.js
12055
- var packageVersion = "0.1.0";
12055
+ var packageVersion = "0.2.0";
12056
12056
 
12057
12057
  // ../data/index.js
12058
12058
  var import_meta = {};
12059
12059
  var PACKAGE_NAME = "@india-boundary-corrector/data";
12060
12060
  var PMTILES_FILENAME = "india_boundary_corrections.pmtiles.gz";
12061
- var FALLBACK_CDNS = /* @__PURE__ */ new Set(["esm.sh", "skypack.dev", "cdn.skypack.dev"]);
12061
+ var FALLBACK_CDNS = /* @__PURE__ */ new Set(["esm.sh", "skypack.dev", "cdn.skypack.dev", "unpkg.com"]);
12062
12062
  var DEFAULT_CDN_URL = `https://cdn.jsdelivr.net/npm/${PACKAGE_NAME}@${packageVersion}/${PMTILES_FILENAME}`;
12063
12063
  var CURRENT_SCRIPT_URL = typeof document !== "undefined" && document.currentScript && document.currentScript.src || null;
12064
12064
  function detectPmtilesUrl() {
@@ -12096,6 +12096,26 @@ var IndiaBoundaryCorrector = (() => {
12096
12096
  var configs_default = [
12097
12097
  {
12098
12098
  id: "cartodb-dark",
12099
+ tileUrlTemplates: [
12100
+ "https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png",
12101
+ "https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png",
12102
+ "https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png",
12103
+ "https://{s}.basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}.png",
12104
+ "https://basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}.png",
12105
+ "https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_nolabels/{z}/{x}/{y}.png"
12106
+ ],
12107
+ lineWidthStops: { "0": 1, "2": 1, "3": 1, "10": 2, "12": 2 },
12108
+ lineStyles: [
12109
+ { color: "rgb(40, 40, 40)", layerSuffix: "ne", endZoom: 4 },
12110
+ { color: "rgb(40, 40, 40)", layerSuffix: "ne-disp", endZoom: 4 },
12111
+ { color: "rgb(40, 40, 40)", layerSuffix: "osm", startZoom: 5 },
12112
+ { color: "rgb(40, 40, 40)", layerSuffix: "osm-disp", startZoom: 5 },
12113
+ { color: "rgb(40, 40, 40)", layerSuffix: "osm-internal", startZoom: 5, widthFraction: 0.3, dashArray: [2, 2], delWidthFactor: 2 },
12114
+ { color: "rgb(40, 40, 40)", layerSuffix: "ne-internal", startZoom: 4, endZoom: 4, widthFraction: 0.3, dashArray: [2, 2], delWidthFactor: 3 }
12115
+ ]
12116
+ },
12117
+ {
12118
+ id: "cartodb-dark-retina",
12099
12119
  tileUrlTemplates: [
12100
12120
  "https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",
12101
12121
  "https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",
@@ -12104,17 +12124,46 @@ var IndiaBoundaryCorrector = (() => {
12104
12124
  "https://basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}{r}.png",
12105
12125
  "https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_nolabels/{z}/{x}/{y}{r}.png"
12106
12126
  ],
12107
- lineWidthStops: { "0": 1, "2": 1, "3": 1, "10": 2.5 },
12127
+ lineWidthStops: { "0": 1.5, "2": 1.5, "3": 1.5, "6": 2.5, "10": 3 },
12108
12128
  lineStyles: [
12109
12129
  { color: "rgb(40, 40, 40)", layerSuffix: "ne", endZoom: 4 },
12110
12130
  { color: "rgb(40, 40, 40)", layerSuffix: "ne-disp", endZoom: 4 },
12111
12131
  { color: "rgb(40, 40, 40)", layerSuffix: "osm", startZoom: 5 },
12112
12132
  { color: "rgb(40, 40, 40)", layerSuffix: "osm-disp", startZoom: 5 },
12113
- { color: "rgb(40, 40, 40)", layerSuffix: "osm-internal", startZoom: 4, widthFraction: 0.3, dashArray: [2, 2] }
12133
+ { color: "rgb(40, 40, 40)", layerSuffix: "osm-internal", startZoom: 5, widthFraction: 0.3, dashArray: [4, 4], delWidthFactor: 2 },
12134
+ { color: "rgb(40, 40, 40)", layerSuffix: "ne-internal", startZoom: 4, endZoom: 4, widthFraction: 0.3, dashArray: [4, 4], delWidthFactor: 3 }
12114
12135
  ]
12115
12136
  },
12116
12137
  {
12117
12138
  id: "cartodb-light",
12139
+ tileUrlTemplates: [
12140
+ "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",
12141
+ "https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",
12142
+ "https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",
12143
+ "https://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png",
12144
+ "https://basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png",
12145
+ "https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_nolabels/{z}/{x}/{y}.png",
12146
+ "https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png",
12147
+ "https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png",
12148
+ "https://{s}.basemaps.cartocdn.com/rastertiles/voyager_nolabels/{z}/{x}/{y}.png",
12149
+ "https://basemaps.cartocdn.com/rastertiles/voyager_nolabels/{z}/{x}/{y}.png",
12150
+ "https://{s}.basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}.png",
12151
+ "https://basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}.png"
12152
+ ],
12153
+ lineWidthStops: { "1": 0.5, "2": 0.75, "3": 0.75, "4": 1, "5": 1, "7": 1.5, "16": 2.5 },
12154
+ lineStyles: [
12155
+ { color: "rgb(235, 214, 214)", layerSuffix: "ne", endZoom: 4, lineExtensionFactor: 0.1, delWidthFactor: 2.5 },
12156
+ { color: "rgb(235, 214, 214)", layerSuffix: "ne-disp", endZoom: 4, delWidthFactor: 0 },
12157
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm", alpha: 0.2, startZoom: 6, endZoom: 11, widthFraction: 5, lineExtensionFactor: 0.1 },
12158
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm", alpha: 0.2, startZoom: 12, widthFraction: 4, lineExtensionFactor: 0.1 },
12159
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm", startZoom: 5, lineExtensionFactor: 0.1 },
12160
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm-disp", startZoom: 5, delWidthFactor: 0 },
12161
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm-internal", startZoom: 5, widthFraction: 0.5, dashArray: [2, 2], delWidthFactor: 2 },
12162
+ { color: "rgb(235, 214, 214)", layerSuffix: "ne-internal", startZoom: 4, endZoom: 4, widthFraction: 0.5, dashArray: [2, 2], delWidthFactor: 2.5 }
12163
+ ]
12164
+ },
12165
+ {
12166
+ id: "cartodb-light-retina",
12118
12167
  tileUrlTemplates: [
12119
12168
  "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png",
12120
12169
  "https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png",
@@ -12129,15 +12178,16 @@ var IndiaBoundaryCorrector = (() => {
12129
12178
  "https://{s}.basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}{r}.png",
12130
12179
  "https://basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}{r}.png"
12131
12180
  ],
12132
- lineWidthStops: { "1": 0.5, "2": 0.5, "3": 0.5, "4": 1, "5": 1.25, "7": 1.5, "16": 2.5 },
12181
+ lineWidthStops: { "1": 0.75, "2": 0.75, "3": 0.75, "4": 1, "5": 1, "7": 1.5, "11": 2 },
12133
12182
  lineStyles: [
12134
- { color: "rgb(235, 214, 214)", layerSuffix: "ne", endZoom: 4, lineExtensionFactor: 0.1, delWidthFactor: 2 },
12135
- { color: "rgb(235, 214, 214)", layerSuffix: "ne-disp", endZoom: 4, lineExtensionFactor: 0 },
12136
- { color: "rgb(235, 214, 214)", layerSuffix: "osm", alpha: 0.2, startZoom: 6, widthFraction: 3, lineExtensionFactor: 0.1 },
12183
+ { color: "rgb(235, 214, 214)", layerSuffix: "ne", endZoom: 4, lineExtensionFactor: 0.1, delWidthFactor: 2.5 },
12184
+ { color: "rgb(235, 214, 214)", layerSuffix: "ne-disp", endZoom: 4, delWidthFactor: 0 },
12185
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm", alpha: 0.1, startZoom: 6, endZoom: 11, widthFraction: 5, lineExtensionFactor: 0.1 },
12186
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm", alpha: 0.1, startZoom: 12, widthFraction: 4, lineExtensionFactor: 0.1 },
12137
12187
  { color: "rgb(235, 214, 214)", layerSuffix: "osm", startZoom: 5, lineExtensionFactor: 0.1 },
12138
- { color: "rgb(235, 214, 214)", layerSuffix: "osm-disp", alpha: 0.2, startZoom: 6, widthFraction: 3, lineExtensionFactor: 0 },
12139
- { color: "rgb(235, 214, 214)", layerSuffix: "osm-disp", startZoom: 5, lineExtensionFactor: 0 },
12140
- { color: "rgb(235, 214, 214)", layerSuffix: "osm-internal", startZoom: 4, widthFraction: 0.75, dashArray: [2, 2], delWidthFactor: 2 }
12188
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm-disp", startZoom: 5, delWidthFactor: 0 },
12189
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm-internal", startZoom: 5, widthFraction: 0.5, dashArray: [4, 4], delWidthFactor: 2 },
12190
+ { color: "rgb(235, 214, 214)", layerSuffix: "ne-internal", startZoom: 4, endZoom: 4, widthFraction: 0.5, dashArray: [4, 4], delWidthFactor: 2.5 }
12141
12191
  ]
12142
12192
  },
12143
12193
  {
@@ -12164,10 +12214,10 @@ var IndiaBoundaryCorrector = (() => {
12164
12214
  lineWidthStops: { "1": 0.5, "2": 0.6, "3": 0.7, "4": 1, "10": 3.75 },
12165
12215
  lineStyles: [
12166
12216
  { color: "rgb(200, 180, 200)", layerSuffix: "osm", startZoom: 1, endZoom: 3, delWidthFactor: 2.5, widthFraction: 1.5 },
12167
- { color: "rgb(200, 180, 200)", layerSuffix: "osm", startZoom: 4 },
12168
- { color: "rgb(160, 120, 160)", layerSuffix: "osm", startZoom: 4, widthFraction: 0.333, dashArray: [30, 2, 8, 2] },
12217
+ { color: "rgb(200, 180, 200)", layerSuffix: "osm", startZoom: 4, delWidthFactor: 1.5 },
12218
+ { color: "rgb(160, 120, 160)", layerSuffix: "osm", startZoom: 4, widthFraction: 0.333, dashArray: [30, 2, 8, 2], delWidthFactor: 0 },
12169
12219
  { color: "rgb(200, 180, 200)", layerSuffix: "osm-internal", startZoom: 4, widthFraction: 0.45 },
12170
- { color: "rgb(160, 120, 160)", layerSuffix: "osm-internal", startZoom: 4, widthFraction: 0.15, dashArray: [4, 2, 10] }
12220
+ { color: "rgb(160, 120, 160)", layerSuffix: "osm-internal", startZoom: 4, widthFraction: 0.15, dashArray: [10, 4, 2] }
12171
12221
  ]
12172
12222
  },
12173
12223
  {
@@ -12180,13 +12230,17 @@ var IndiaBoundaryCorrector = (() => {
12180
12230
  lineStyles: [
12181
12231
  { color: "rgb(149, 175, 180)", layerSuffix: "osm", lineExtensionFactor: 0.25, startZoom: 2 },
12182
12232
  { color: "rgb(89, 117, 123)", layerSuffix: "osm", widthFraction: 0.33, lineExtensionFactor: 0.25, startZoom: 2 },
12183
- { color: "rgb(172, 163, 163)", layerSuffix: "osm-internal", widthFraction: 0.33, startZoom: 4, dashArray: [7, 7, 7] }
12233
+ { color: "rgb(172, 163, 163)", layerSuffix: "osm-internal", widthFraction: 0.33, startZoom: 4, dashArray: [7, 7] }
12184
12234
  ]
12185
12235
  }
12186
12236
  ];
12187
12237
  var INFINITY = -1;
12238
+ var MIN_LINE_WIDTH = 0.1;
12239
+ var DEFAULT_LINE_WIDTH = 1;
12188
12240
  function templateToRegex(template) {
12189
12241
  const groups = [];
12242
+ const hasRetina = template.includes("{r}");
12243
+ const hasExtension = /\.(png|jpg|jpeg|webp|gif)$/i.test(template);
12190
12244
  let pattern = template.replace(/[.*+?^${}()|[\]\\]/g, (char) => {
12191
12245
  if (char === "{" || char === "}") return char;
12192
12246
  return "\\" + char;
@@ -12200,13 +12254,22 @@ var IndiaBoundaryCorrector = (() => {
12200
12254
  return "([a-z0-9]+)";
12201
12255
  }
12202
12256
  if (lowerName === "r") {
12203
- return "(@\\d+x)?";
12257
+ return "(@\\d+x)";
12204
12258
  }
12205
12259
  return "(\\d+)";
12206
12260
  });
12261
+ if (!hasRetina) {
12262
+ if (hasExtension) {
12263
+ pattern = pattern.replace(/(\\\.(png|jpg|jpeg|webp|gif))/, "(?!@\\d+x)$1");
12264
+ } else {
12265
+ pattern = pattern + "(?!@\\d+x)";
12266
+ }
12267
+ }
12207
12268
  return { pattern: new RegExp("^" + pattern + "(\\?.*)?$", "i"), groups };
12208
12269
  }
12209
12270
  function templateToTemplateRegex(template) {
12271
+ const hasRetina = template.includes("{r}");
12272
+ const hasExtension = /\.(png|jpg|jpeg|webp|gif)$/i.test(template);
12210
12273
  let pattern = template.replace(/[.*+?^${}()|[\]\\]/g, (char) => {
12211
12274
  if (char === "{" || char === "}") return char;
12212
12275
  return "\\" + char;
@@ -12216,10 +12279,17 @@ var IndiaBoundaryCorrector = (() => {
12216
12279
  return "(\\{s\\}|\\{[a-z0-9]-[a-z0-9]\\}|[a-z0-9]+)";
12217
12280
  }
12218
12281
  if (lowerName === "r") {
12219
- return "(\\{r\\}|@\\d+x)?";
12282
+ return "(\\{r\\}|@\\d+x)";
12220
12283
  }
12221
12284
  return `\\{${lowerName}\\}`;
12222
12285
  });
12286
+ if (!hasRetina) {
12287
+ if (hasExtension) {
12288
+ pattern = pattern.replace(/(\\\.(png|jpg|jpeg|webp|gif))/, "(?!@\\d+x|\\{r\\})$1");
12289
+ } else {
12290
+ pattern = pattern + "(?!@\\d+x|\\{r\\})";
12291
+ }
12292
+ }
12223
12293
  return new RegExp("^" + pattern + "(\\?.*)?$", "i");
12224
12294
  }
12225
12295
  function isValidColor(color) {
@@ -12288,7 +12358,7 @@ var IndiaBoundaryCorrector = (() => {
12288
12358
  * @param {number} [options.lineExtensionFactor=0.5] - Factor to extend lines by (multiplied by deletion line width)
12289
12359
  * @param {number} [options.delWidthFactor=1.5] - Factor to multiply line width for deletion blur
12290
12360
  */
12291
- constructor({ color, layerSuffix, widthFraction = 1, dashArray, alpha = 1, startZoom = 0, endZoom = INFINITY, lineExtensionFactor = 0.5, delWidthFactor = 1.5 }) {
12361
+ constructor({ color, layerSuffix, widthFraction = 1, dashArray, alpha = 1, startZoom = 0, endZoom = INFINITY, lineExtensionFactor = 0, delWidthFactor = 1.5 }) {
12292
12362
  this.color = color;
12293
12363
  this.layerSuffix = layerSuffix;
12294
12364
  this.widthFraction = widthFraction;
@@ -12418,6 +12488,45 @@ var IndiaBoundaryCorrector = (() => {
12418
12488
  const activeStyles = this.getLineStylesForZoom(z2);
12419
12489
  return [...new Set(activeStyles.map((s) => s.layerSuffix))];
12420
12490
  }
12491
+ /**
12492
+ * Interpolate or extrapolate line width for a given zoom level.
12493
+ * Uses the lineWidthStops map to calculate the appropriate width.
12494
+ * @param {number} zoom - Zoom level
12495
+ * @returns {number}
12496
+ */
12497
+ getLineWidth(zoom) {
12498
+ const zooms = Object.keys(this.lineWidthStops).map(Number).sort((a, b2) => a - b2);
12499
+ if (this.lineWidthStops[zoom] !== void 0) {
12500
+ return this.lineWidthStops[zoom];
12501
+ }
12502
+ if (zoom < zooms[0]) {
12503
+ const z1 = zooms[0];
12504
+ const z2 = zooms[1];
12505
+ const w1 = this.lineWidthStops[z1];
12506
+ const w2 = this.lineWidthStops[z2];
12507
+ const slope = (w2 - w1) / (z2 - z1);
12508
+ return Math.max(MIN_LINE_WIDTH, w1 + slope * (zoom - z1));
12509
+ }
12510
+ if (zoom > zooms[zooms.length - 1]) {
12511
+ const z1 = zooms[zooms.length - 2];
12512
+ const z2 = zooms[zooms.length - 1];
12513
+ const w1 = this.lineWidthStops[z1];
12514
+ const w2 = this.lineWidthStops[z2];
12515
+ const slope = (w2 - w1) / (z2 - z1);
12516
+ return Math.max(MIN_LINE_WIDTH, w2 + slope * (zoom - z2));
12517
+ }
12518
+ for (let i2 = 0; i2 < zooms.length - 1; i2++) {
12519
+ if (zoom > zooms[i2] && zoom < zooms[i2 + 1]) {
12520
+ const z1 = zooms[i2];
12521
+ const z2 = zooms[i2 + 1];
12522
+ const w1 = this.lineWidthStops[z1];
12523
+ const w2 = this.lineWidthStops[z2];
12524
+ const t = (zoom - z1) / (z2 - z1);
12525
+ return w1 + t * (w2 - w1);
12526
+ }
12527
+ }
12528
+ return DEFAULT_LINE_WIDTH;
12529
+ }
12421
12530
  /**
12422
12531
  * Check if this config matches the given template URLs (with {z}/{x}/{y} placeholders)
12423
12532
  * @param {string | string[]} templates - Single template URL or array of template URLs
@@ -14817,6 +14926,26 @@ var IndiaBoundaryCorrector = (() => {
14817
14926
  var configs_default2 = [
14818
14927
  {
14819
14928
  id: "cartodb-dark",
14929
+ tileUrlTemplates: [
14930
+ "https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png",
14931
+ "https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png",
14932
+ "https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png",
14933
+ "https://{s}.basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}.png",
14934
+ "https://basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}.png",
14935
+ "https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_nolabels/{z}/{x}/{y}.png"
14936
+ ],
14937
+ lineWidthStops: { "0": 1, "2": 1, "3": 1, "10": 2, "12": 2 },
14938
+ lineStyles: [
14939
+ { color: "rgb(40, 40, 40)", layerSuffix: "ne", endZoom: 4 },
14940
+ { color: "rgb(40, 40, 40)", layerSuffix: "ne-disp", endZoom: 4 },
14941
+ { color: "rgb(40, 40, 40)", layerSuffix: "osm", startZoom: 5 },
14942
+ { color: "rgb(40, 40, 40)", layerSuffix: "osm-disp", startZoom: 5 },
14943
+ { color: "rgb(40, 40, 40)", layerSuffix: "osm-internal", startZoom: 5, widthFraction: 0.3, dashArray: [2, 2], delWidthFactor: 2 },
14944
+ { color: "rgb(40, 40, 40)", layerSuffix: "ne-internal", startZoom: 4, endZoom: 4, widthFraction: 0.3, dashArray: [2, 2], delWidthFactor: 3 }
14945
+ ]
14946
+ },
14947
+ {
14948
+ id: "cartodb-dark-retina",
14820
14949
  tileUrlTemplates: [
14821
14950
  "https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",
14822
14951
  "https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",
@@ -14825,17 +14954,46 @@ var IndiaBoundaryCorrector = (() => {
14825
14954
  "https://basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}{r}.png",
14826
14955
  "https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_nolabels/{z}/{x}/{y}{r}.png"
14827
14956
  ],
14828
- lineWidthStops: { "0": 1, "2": 1, "3": 1, "10": 2.5 },
14957
+ lineWidthStops: { "0": 1.5, "2": 1.5, "3": 1.5, "6": 2.5, "10": 3 },
14829
14958
  lineStyles: [
14830
14959
  { color: "rgb(40, 40, 40)", layerSuffix: "ne", endZoom: 4 },
14831
14960
  { color: "rgb(40, 40, 40)", layerSuffix: "ne-disp", endZoom: 4 },
14832
14961
  { color: "rgb(40, 40, 40)", layerSuffix: "osm", startZoom: 5 },
14833
14962
  { color: "rgb(40, 40, 40)", layerSuffix: "osm-disp", startZoom: 5 },
14834
- { color: "rgb(40, 40, 40)", layerSuffix: "osm-internal", startZoom: 4, widthFraction: 0.3, dashArray: [2, 2] }
14963
+ { color: "rgb(40, 40, 40)", layerSuffix: "osm-internal", startZoom: 5, widthFraction: 0.3, dashArray: [4, 4], delWidthFactor: 2 },
14964
+ { color: "rgb(40, 40, 40)", layerSuffix: "ne-internal", startZoom: 4, endZoom: 4, widthFraction: 0.3, dashArray: [4, 4], delWidthFactor: 3 }
14835
14965
  ]
14836
14966
  },
14837
14967
  {
14838
14968
  id: "cartodb-light",
14969
+ tileUrlTemplates: [
14970
+ "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",
14971
+ "https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",
14972
+ "https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",
14973
+ "https://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png",
14974
+ "https://basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png",
14975
+ "https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_nolabels/{z}/{x}/{y}.png",
14976
+ "https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png",
14977
+ "https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png",
14978
+ "https://{s}.basemaps.cartocdn.com/rastertiles/voyager_nolabels/{z}/{x}/{y}.png",
14979
+ "https://basemaps.cartocdn.com/rastertiles/voyager_nolabels/{z}/{x}/{y}.png",
14980
+ "https://{s}.basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}.png",
14981
+ "https://basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}.png"
14982
+ ],
14983
+ lineWidthStops: { "1": 0.5, "2": 0.75, "3": 0.75, "4": 1, "5": 1, "7": 1.5, "16": 2.5 },
14984
+ lineStyles: [
14985
+ { color: "rgb(235, 214, 214)", layerSuffix: "ne", endZoom: 4, lineExtensionFactor: 0.1, delWidthFactor: 2.5 },
14986
+ { color: "rgb(235, 214, 214)", layerSuffix: "ne-disp", endZoom: 4, delWidthFactor: 0 },
14987
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm", alpha: 0.2, startZoom: 6, endZoom: 11, widthFraction: 5, lineExtensionFactor: 0.1 },
14988
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm", alpha: 0.2, startZoom: 12, widthFraction: 4, lineExtensionFactor: 0.1 },
14989
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm", startZoom: 5, lineExtensionFactor: 0.1 },
14990
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm-disp", startZoom: 5, delWidthFactor: 0 },
14991
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm-internal", startZoom: 5, widthFraction: 0.5, dashArray: [2, 2], delWidthFactor: 2 },
14992
+ { color: "rgb(235, 214, 214)", layerSuffix: "ne-internal", startZoom: 4, endZoom: 4, widthFraction: 0.5, dashArray: [2, 2], delWidthFactor: 2.5 }
14993
+ ]
14994
+ },
14995
+ {
14996
+ id: "cartodb-light-retina",
14839
14997
  tileUrlTemplates: [
14840
14998
  "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png",
14841
14999
  "https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png",
@@ -14850,15 +15008,16 @@ var IndiaBoundaryCorrector = (() => {
14850
15008
  "https://{s}.basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}{r}.png",
14851
15009
  "https://basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}{r}.png"
14852
15010
  ],
14853
- lineWidthStops: { "1": 0.5, "2": 0.5, "3": 0.5, "4": 1, "5": 1.25, "7": 1.5, "16": 2.5 },
15011
+ lineWidthStops: { "1": 0.75, "2": 0.75, "3": 0.75, "4": 1, "5": 1, "7": 1.5, "11": 2 },
14854
15012
  lineStyles: [
14855
- { color: "rgb(235, 214, 214)", layerSuffix: "ne", endZoom: 4, lineExtensionFactor: 0.1, delWidthFactor: 2 },
14856
- { color: "rgb(235, 214, 214)", layerSuffix: "ne-disp", endZoom: 4, lineExtensionFactor: 0 },
14857
- { color: "rgb(235, 214, 214)", layerSuffix: "osm", alpha: 0.2, startZoom: 6, widthFraction: 3, lineExtensionFactor: 0.1 },
15013
+ { color: "rgb(235, 214, 214)", layerSuffix: "ne", endZoom: 4, lineExtensionFactor: 0.1, delWidthFactor: 2.5 },
15014
+ { color: "rgb(235, 214, 214)", layerSuffix: "ne-disp", endZoom: 4, delWidthFactor: 0 },
15015
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm", alpha: 0.1, startZoom: 6, endZoom: 11, widthFraction: 5, lineExtensionFactor: 0.1 },
15016
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm", alpha: 0.1, startZoom: 12, widthFraction: 4, lineExtensionFactor: 0.1 },
14858
15017
  { color: "rgb(235, 214, 214)", layerSuffix: "osm", startZoom: 5, lineExtensionFactor: 0.1 },
14859
- { color: "rgb(235, 214, 214)", layerSuffix: "osm-disp", alpha: 0.2, startZoom: 6, widthFraction: 3, lineExtensionFactor: 0 },
14860
- { color: "rgb(235, 214, 214)", layerSuffix: "osm-disp", startZoom: 5, lineExtensionFactor: 0 },
14861
- { color: "rgb(235, 214, 214)", layerSuffix: "osm-internal", startZoom: 4, widthFraction: 0.75, dashArray: [2, 2], delWidthFactor: 2 }
15018
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm-disp", startZoom: 5, delWidthFactor: 0 },
15019
+ { color: "rgb(235, 214, 214)", layerSuffix: "osm-internal", startZoom: 5, widthFraction: 0.5, dashArray: [4, 4], delWidthFactor: 2 },
15020
+ { color: "rgb(235, 214, 214)", layerSuffix: "ne-internal", startZoom: 4, endZoom: 4, widthFraction: 0.5, dashArray: [4, 4], delWidthFactor: 2.5 }
14862
15021
  ]
14863
15022
  },
14864
15023
  {
@@ -14885,10 +15044,10 @@ var IndiaBoundaryCorrector = (() => {
14885
15044
  lineWidthStops: { "1": 0.5, "2": 0.6, "3": 0.7, "4": 1, "10": 3.75 },
14886
15045
  lineStyles: [
14887
15046
  { color: "rgb(200, 180, 200)", layerSuffix: "osm", startZoom: 1, endZoom: 3, delWidthFactor: 2.5, widthFraction: 1.5 },
14888
- { color: "rgb(200, 180, 200)", layerSuffix: "osm", startZoom: 4 },
14889
- { color: "rgb(160, 120, 160)", layerSuffix: "osm", startZoom: 4, widthFraction: 0.333, dashArray: [30, 2, 8, 2] },
15047
+ { color: "rgb(200, 180, 200)", layerSuffix: "osm", startZoom: 4, delWidthFactor: 1.5 },
15048
+ { color: "rgb(160, 120, 160)", layerSuffix: "osm", startZoom: 4, widthFraction: 0.333, dashArray: [30, 2, 8, 2], delWidthFactor: 0 },
14890
15049
  { color: "rgb(200, 180, 200)", layerSuffix: "osm-internal", startZoom: 4, widthFraction: 0.45 },
14891
- { color: "rgb(160, 120, 160)", layerSuffix: "osm-internal", startZoom: 4, widthFraction: 0.15, dashArray: [4, 2, 10] }
15050
+ { color: "rgb(160, 120, 160)", layerSuffix: "osm-internal", startZoom: 4, widthFraction: 0.15, dashArray: [10, 4, 2] }
14892
15051
  ]
14893
15052
  },
14894
15053
  {
@@ -14901,13 +15060,17 @@ var IndiaBoundaryCorrector = (() => {
14901
15060
  lineStyles: [
14902
15061
  { color: "rgb(149, 175, 180)", layerSuffix: "osm", lineExtensionFactor: 0.25, startZoom: 2 },
14903
15062
  { color: "rgb(89, 117, 123)", layerSuffix: "osm", widthFraction: 0.33, lineExtensionFactor: 0.25, startZoom: 2 },
14904
- { color: "rgb(172, 163, 163)", layerSuffix: "osm-internal", widthFraction: 0.33, startZoom: 4, dashArray: [7, 7, 7] }
15063
+ { color: "rgb(172, 163, 163)", layerSuffix: "osm-internal", widthFraction: 0.33, startZoom: 4, dashArray: [7, 7] }
14905
15064
  ]
14906
15065
  }
14907
15066
  ];
14908
15067
  var INFINITY2 = -1;
15068
+ var MIN_LINE_WIDTH2 = 0.1;
15069
+ var DEFAULT_LINE_WIDTH2 = 1;
14909
15070
  function templateToRegex2(template) {
14910
15071
  const groups = [];
15072
+ const hasRetina = template.includes("{r}");
15073
+ const hasExtension = /\.(png|jpg|jpeg|webp|gif)$/i.test(template);
14911
15074
  let pattern = template.replace(/[.*+?^${}()|[\]\\]/g, (char) => {
14912
15075
  if (char === "{" || char === "}") return char;
14913
15076
  return "\\" + char;
@@ -14921,13 +15084,22 @@ var IndiaBoundaryCorrector = (() => {
14921
15084
  return "([a-z0-9]+)";
14922
15085
  }
14923
15086
  if (lowerName === "r") {
14924
- return "(@\\d+x)?";
15087
+ return "(@\\d+x)";
14925
15088
  }
14926
15089
  return "(\\d+)";
14927
15090
  });
15091
+ if (!hasRetina) {
15092
+ if (hasExtension) {
15093
+ pattern = pattern.replace(/(\\\.(png|jpg|jpeg|webp|gif))/, "(?!@\\d+x)$1");
15094
+ } else {
15095
+ pattern = pattern + "(?!@\\d+x)";
15096
+ }
15097
+ }
14928
15098
  return { pattern: new RegExp("^" + pattern + "(\\?.*)?$", "i"), groups };
14929
15099
  }
14930
15100
  function templateToTemplateRegex2(template) {
15101
+ const hasRetina = template.includes("{r}");
15102
+ const hasExtension = /\.(png|jpg|jpeg|webp|gif)$/i.test(template);
14931
15103
  let pattern = template.replace(/[.*+?^${}()|[\]\\]/g, (char) => {
14932
15104
  if (char === "{" || char === "}") return char;
14933
15105
  return "\\" + char;
@@ -14937,10 +15109,17 @@ var IndiaBoundaryCorrector = (() => {
14937
15109
  return "(\\{s\\}|\\{[a-z0-9]-[a-z0-9]\\}|[a-z0-9]+)";
14938
15110
  }
14939
15111
  if (lowerName === "r") {
14940
- return "(\\{r\\}|@\\d+x)?";
15112
+ return "(\\{r\\}|@\\d+x)";
14941
15113
  }
14942
15114
  return `\\{${lowerName}\\}`;
14943
15115
  });
15116
+ if (!hasRetina) {
15117
+ if (hasExtension) {
15118
+ pattern = pattern.replace(/(\\\.(png|jpg|jpeg|webp|gif))/, "(?!@\\d+x|\\{r\\})$1");
15119
+ } else {
15120
+ pattern = pattern + "(?!@\\d+x|\\{r\\})";
15121
+ }
15122
+ }
14944
15123
  return new RegExp("^" + pattern + "(\\?.*)?$", "i");
14945
15124
  }
14946
15125
  function isValidColor2(color) {
@@ -15009,7 +15188,7 @@ var IndiaBoundaryCorrector = (() => {
15009
15188
  * @param {number} [options.lineExtensionFactor=0.5] - Factor to extend lines by (multiplied by deletion line width)
15010
15189
  * @param {number} [options.delWidthFactor=1.5] - Factor to multiply line width for deletion blur
15011
15190
  */
15012
- constructor({ color, layerSuffix, widthFraction = 1, dashArray, alpha = 1, startZoom = 0, endZoom = INFINITY2, lineExtensionFactor = 0.5, delWidthFactor = 1.5 }) {
15191
+ constructor({ color, layerSuffix, widthFraction = 1, dashArray, alpha = 1, startZoom = 0, endZoom = INFINITY2, lineExtensionFactor = 0, delWidthFactor = 1.5 }) {
15013
15192
  this.color = color;
15014
15193
  this.layerSuffix = layerSuffix;
15015
15194
  this.widthFraction = widthFraction;
@@ -15139,6 +15318,45 @@ var IndiaBoundaryCorrector = (() => {
15139
15318
  const activeStyles = this.getLineStylesForZoom(z2);
15140
15319
  return [...new Set(activeStyles.map((s) => s.layerSuffix))];
15141
15320
  }
15321
+ /**
15322
+ * Interpolate or extrapolate line width for a given zoom level.
15323
+ * Uses the lineWidthStops map to calculate the appropriate width.
15324
+ * @param {number} zoom - Zoom level
15325
+ * @returns {number}
15326
+ */
15327
+ getLineWidth(zoom) {
15328
+ const zooms = Object.keys(this.lineWidthStops).map(Number).sort((a, b2) => a - b2);
15329
+ if (this.lineWidthStops[zoom] !== void 0) {
15330
+ return this.lineWidthStops[zoom];
15331
+ }
15332
+ if (zoom < zooms[0]) {
15333
+ const z1 = zooms[0];
15334
+ const z2 = zooms[1];
15335
+ const w1 = this.lineWidthStops[z1];
15336
+ const w2 = this.lineWidthStops[z2];
15337
+ const slope = (w2 - w1) / (z2 - z1);
15338
+ return Math.max(MIN_LINE_WIDTH2, w1 + slope * (zoom - z1));
15339
+ }
15340
+ if (zoom > zooms[zooms.length - 1]) {
15341
+ const z1 = zooms[zooms.length - 2];
15342
+ const z2 = zooms[zooms.length - 1];
15343
+ const w1 = this.lineWidthStops[z1];
15344
+ const w2 = this.lineWidthStops[z2];
15345
+ const slope = (w2 - w1) / (z2 - z1);
15346
+ return Math.max(MIN_LINE_WIDTH2, w2 + slope * (zoom - z2));
15347
+ }
15348
+ for (let i2 = 0; i2 < zooms.length - 1; i2++) {
15349
+ if (zoom > zooms[i2] && zoom < zooms[i2 + 1]) {
15350
+ const z1 = zooms[i2];
15351
+ const z2 = zooms[i2 + 1];
15352
+ const w1 = this.lineWidthStops[z1];
15353
+ const w2 = this.lineWidthStops[z2];
15354
+ const t = (zoom - z1) / (z2 - z1);
15355
+ return w1 + t * (w2 - w1);
15356
+ }
15357
+ }
15358
+ return DEFAULT_LINE_WIDTH2;
15359
+ }
15142
15360
  /**
15143
15361
  * Check if this config matches the given template URLs (with {z}/{x}/{y} placeholders)
15144
15362
  * @param {string | string[]} templates - Single template URL or array of template URLs
@@ -15329,9 +15547,7 @@ var IndiaBoundaryCorrector = (() => {
15329
15547
  return new _TileFetchError(response.status, response.url, body);
15330
15548
  }
15331
15549
  };
15332
- var MIN_LINE_WIDTH = 0.1;
15333
15550
  var DEFAULT_TILE_EXTENT = 4096;
15334
- var DEFAULT_LINE_WIDTH = 1;
15335
15551
  function buildFetchOptions(crossOrigin, referrerPolicy) {
15336
15552
  const options = {};
15337
15553
  if (crossOrigin === "use-credentials") {
@@ -15349,39 +15565,6 @@ var IndiaBoundaryCorrector = (() => {
15349
15565
  }
15350
15566
  return options;
15351
15567
  }
15352
- function getLineWidth(zoom, lineWidthStops) {
15353
- const zooms = Object.keys(lineWidthStops).map(Number).sort((a, b2) => a - b2);
15354
- if (lineWidthStops[zoom] !== void 0) {
15355
- return lineWidthStops[zoom];
15356
- }
15357
- if (zoom < zooms[0]) {
15358
- const z1 = zooms[0];
15359
- const z2 = zooms[1];
15360
- const w1 = lineWidthStops[z1];
15361
- const w2 = lineWidthStops[z2];
15362
- const slope = (w2 - w1) / (z2 - z1);
15363
- return Math.max(MIN_LINE_WIDTH, w1 + slope * (zoom - z1));
15364
- }
15365
- if (zoom > zooms[zooms.length - 1]) {
15366
- const z1 = zooms[zooms.length - 2];
15367
- const z2 = zooms[zooms.length - 1];
15368
- const w1 = lineWidthStops[z1];
15369
- const w2 = lineWidthStops[z2];
15370
- const slope = (w2 - w1) / (z2 - z1);
15371
- return Math.max(MIN_LINE_WIDTH, w2 + slope * (zoom - z2));
15372
- }
15373
- for (let i2 = 0; i2 < zooms.length - 1; i2++) {
15374
- if (zoom > zooms[i2] && zoom < zooms[i2 + 1]) {
15375
- const z1 = zooms[i2];
15376
- const z2 = zooms[i2 + 1];
15377
- const w1 = lineWidthStops[z1];
15378
- const w2 = lineWidthStops[z2];
15379
- const t = (zoom - z1) / (z2 - z1);
15380
- return w1 + t * (w2 - w1);
15381
- }
15382
- }
15383
- return DEFAULT_LINE_WIDTH;
15384
- }
15385
15568
  function getFeaturesBoundingBox(features, tileSize, padding = 0) {
15386
15569
  let minX = Infinity, minY = Infinity;
15387
15570
  let maxX = -Infinity, maxY = -Infinity;
@@ -15642,7 +15825,6 @@ var IndiaBoundaryCorrector = (() => {
15642
15825
  * @returns {Promise<ArrayBuffer>} The corrected tile as ArrayBuffer (PNG)
15643
15826
  */
15644
15827
  async fixTile(corrections, rasterTile, layerConfig, zoom) {
15645
- const { lineWidthStops } = layerConfig;
15646
15828
  let activeLineStyles;
15647
15829
  if (layerConfig.getLineStylesForZoom) {
15648
15830
  activeLineStyles = layerConfig.getLineStylesForZoom(zoom);
@@ -15667,7 +15849,7 @@ var IndiaBoundaryCorrector = (() => {
15667
15849
  const canvas = this._canvas;
15668
15850
  const ctx = canvas.getContext("2d", { willReadFrequently: true });
15669
15851
  ctx.drawImage(imageBitmap, 0, 0, tileSize, tileSize);
15670
- const baseLineWidth = getLineWidth(zoom, lineWidthStops);
15852
+ const baseLineWidth = layerConfig.getLineWidth(zoom);
15671
15853
  const delLineWidthBySuffix = {};
15672
15854
  for (const suffix of layerSuffixes) {
15673
15855
  const stylesForSuffix = activeLineStyles.filter((s) => s.layerSuffix === suffix);