@basemaps/cli-vector 8.3.0 → 8.5.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.
package/dist/index.cjs CHANGED
@@ -44838,7 +44838,7 @@ var require_GetObjectCommand = __commonJS({
44838
44838
  var types_1 = require_dist_cjs();
44839
44839
  var models_0_1 = require_models_0();
44840
44840
  var Aws_restXml_1 = require_Aws_restXml();
44841
- var GetObjectCommand3 = class _GetObjectCommand extends smithy_client_1.Command {
44841
+ var GetObjectCommand4 = class _GetObjectCommand extends smithy_client_1.Command {
44842
44842
  static getEndpointParameterInstructions() {
44843
44843
  return {
44844
44844
  Bucket: { type: "contextParams", name: "Bucket" },
@@ -44894,7 +44894,7 @@ var require_GetObjectCommand = __commonJS({
44894
44894
  return (0, Aws_restXml_1.de_GetObjectCommand)(output, context);
44895
44895
  }
44896
44896
  };
44897
- exports.GetObjectCommand = GetObjectCommand3;
44897
+ exports.GetObjectCommand = GetObjectCommand4;
44898
44898
  }
44899
44899
  });
44900
44900
 
@@ -49117,6 +49117,204 @@ var require_dist_cjs69 = __commonJS({
49117
49117
  }
49118
49118
  });
49119
49119
 
49120
+ // ../shared/node_modules/@aws-sdk/util-format-url/dist-cjs/index.js
49121
+ var require_dist_cjs70 = __commonJS({
49122
+ "../shared/node_modules/@aws-sdk/util-format-url/dist-cjs/index.js"(exports) {
49123
+ "use strict";
49124
+ Object.defineProperty(exports, "__esModule", { value: true });
49125
+ exports.formatUrl = void 0;
49126
+ var querystring_builder_1 = require_dist_cjs13();
49127
+ function formatUrl(request) {
49128
+ var _a2, _b;
49129
+ const { port, query } = request;
49130
+ let { protocol, path: path4, hostname } = request;
49131
+ if (protocol && protocol.slice(-1) !== ":") {
49132
+ protocol += ":";
49133
+ }
49134
+ if (port) {
49135
+ hostname += `:${port}`;
49136
+ }
49137
+ if (path4 && path4.charAt(0) !== "/") {
49138
+ path4 = `/${path4}`;
49139
+ }
49140
+ let queryString = query ? (0, querystring_builder_1.buildQueryString)(query) : "";
49141
+ if (queryString && queryString[0] !== "?") {
49142
+ queryString = `?${queryString}`;
49143
+ }
49144
+ let auth = "";
49145
+ if (request.username != null || request.password != null) {
49146
+ const username = (_a2 = request.username) !== null && _a2 !== void 0 ? _a2 : "";
49147
+ const password = (_b = request.password) !== null && _b !== void 0 ? _b : "";
49148
+ auth = `${username}:${password}@`;
49149
+ }
49150
+ let fragment = "";
49151
+ if (request.fragment) {
49152
+ fragment = `#${request.fragment}`;
49153
+ }
49154
+ return `${protocol}//${auth}${hostname}${path4}${queryString}${fragment}`;
49155
+ }
49156
+ exports.formatUrl = formatUrl;
49157
+ }
49158
+ });
49159
+
49160
+ // ../shared/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/constants.js
49161
+ var require_constants11 = __commonJS({
49162
+ "../shared/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/constants.js"(exports) {
49163
+ "use strict";
49164
+ Object.defineProperty(exports, "__esModule", { value: true });
49165
+ exports.ALGORITHM_IDENTIFIER = exports.HOST_HEADER = exports.EXPIRES_QUERY_PARAM = exports.SIGNED_HEADERS_QUERY_PARAM = exports.AMZ_DATE_QUERY_PARAM = exports.CREDENTIAL_QUERY_PARAM = exports.ALGORITHM_QUERY_PARAM = exports.SHA256_HEADER = exports.UNSIGNED_PAYLOAD = void 0;
49166
+ exports.UNSIGNED_PAYLOAD = "UNSIGNED-PAYLOAD";
49167
+ exports.SHA256_HEADER = "X-Amz-Content-Sha256";
49168
+ exports.ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm";
49169
+ exports.CREDENTIAL_QUERY_PARAM = "X-Amz-Credential";
49170
+ exports.AMZ_DATE_QUERY_PARAM = "X-Amz-Date";
49171
+ exports.SIGNED_HEADERS_QUERY_PARAM = "X-Amz-SignedHeaders";
49172
+ exports.EXPIRES_QUERY_PARAM = "X-Amz-Expires";
49173
+ exports.HOST_HEADER = "host";
49174
+ exports.ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256";
49175
+ }
49176
+ });
49177
+
49178
+ // ../shared/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/presigner.js
49179
+ var require_presigner = __commonJS({
49180
+ "../shared/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/presigner.js"(exports) {
49181
+ "use strict";
49182
+ Object.defineProperty(exports, "__esModule", { value: true });
49183
+ exports.S3RequestPresigner = void 0;
49184
+ var signature_v4_multi_region_1 = require_dist_cjs64();
49185
+ var constants_1 = require_constants11();
49186
+ var S3RequestPresigner = class {
49187
+ constructor(options) {
49188
+ const resolvedOptions = {
49189
+ service: options.signingName || options.service || "s3",
49190
+ uriEscapePath: options.uriEscapePath || false,
49191
+ applyChecksum: options.applyChecksum || false,
49192
+ ...options
49193
+ };
49194
+ this.signer = new signature_v4_multi_region_1.SignatureV4MultiRegion(resolvedOptions);
49195
+ }
49196
+ presign(requestToSign, { unsignableHeaders = /* @__PURE__ */ new Set(), unhoistableHeaders = /* @__PURE__ */ new Set(), ...options } = {}) {
49197
+ this.prepareRequest(requestToSign, {
49198
+ unsignableHeaders,
49199
+ unhoistableHeaders
49200
+ });
49201
+ return this.signer.presign(requestToSign, {
49202
+ expiresIn: 900,
49203
+ unsignableHeaders,
49204
+ unhoistableHeaders,
49205
+ ...options
49206
+ });
49207
+ }
49208
+ presignWithCredentials(requestToSign, credentials2, { unsignableHeaders = /* @__PURE__ */ new Set(), unhoistableHeaders = /* @__PURE__ */ new Set(), ...options } = {}) {
49209
+ this.prepareRequest(requestToSign, {
49210
+ unsignableHeaders,
49211
+ unhoistableHeaders
49212
+ });
49213
+ return this.signer.presignWithCredentials(requestToSign, credentials2, {
49214
+ expiresIn: 900,
49215
+ unsignableHeaders,
49216
+ unhoistableHeaders,
49217
+ ...options
49218
+ });
49219
+ }
49220
+ prepareRequest(requestToSign, { unsignableHeaders = /* @__PURE__ */ new Set(), unhoistableHeaders = /* @__PURE__ */ new Set() } = {}) {
49221
+ unsignableHeaders.add("content-type");
49222
+ Object.keys(requestToSign.headers).map((header) => header.toLowerCase()).filter((header) => header.startsWith("x-amz-server-side-encryption")).forEach((header) => {
49223
+ unhoistableHeaders.add(header);
49224
+ });
49225
+ requestToSign.headers[constants_1.SHA256_HEADER] = constants_1.UNSIGNED_PAYLOAD;
49226
+ const currentHostHeader = requestToSign.headers.host;
49227
+ const port = requestToSign.port;
49228
+ const expectedHostHeader = `${requestToSign.hostname}${requestToSign.port != null ? ":" + port : ""}`;
49229
+ if (!currentHostHeader || currentHostHeader === requestToSign.hostname && requestToSign.port != null) {
49230
+ requestToSign.headers.host = expectedHostHeader;
49231
+ }
49232
+ }
49233
+ };
49234
+ exports.S3RequestPresigner = S3RequestPresigner;
49235
+ }
49236
+ });
49237
+
49238
+ // ../shared/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/getSignedUrl.js
49239
+ var require_getSignedUrl = __commonJS({
49240
+ "../shared/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/getSignedUrl.js"(exports) {
49241
+ "use strict";
49242
+ Object.defineProperty(exports, "__esModule", { value: true });
49243
+ exports.getSignedUrl = void 0;
49244
+ var util_format_url_1 = require_dist_cjs70();
49245
+ var middleware_endpoint_1 = require_dist_cjs38();
49246
+ var protocol_http_1 = require_dist_cjs2();
49247
+ var presigner_1 = require_presigner();
49248
+ var getSignedUrl2 = async (client, command5, options = {}) => {
49249
+ var _a2, _b;
49250
+ let s3Presigner;
49251
+ if (typeof client.config.endpointProvider === "function") {
49252
+ const endpointV2 = await (0, middleware_endpoint_1.getEndpointFromInstructions)(command5.input, command5.constructor, client.config);
49253
+ const authScheme = (_b = (_a2 = endpointV2.properties) === null || _a2 === void 0 ? void 0 : _a2.authSchemes) === null || _b === void 0 ? void 0 : _b[0];
49254
+ s3Presigner = new presigner_1.S3RequestPresigner({
49255
+ ...client.config,
49256
+ signingName: authScheme === null || authScheme === void 0 ? void 0 : authScheme.signingName,
49257
+ region: async () => authScheme === null || authScheme === void 0 ? void 0 : authScheme.signingRegion
49258
+ });
49259
+ } else {
49260
+ s3Presigner = new presigner_1.S3RequestPresigner(client.config);
49261
+ }
49262
+ const presignInterceptMiddleware = (next, context) => async (args) => {
49263
+ var _a3, _b2;
49264
+ const { request } = args;
49265
+ if (!protocol_http_1.HttpRequest.isInstance(request)) {
49266
+ throw new Error("Request to be presigned is not an valid HTTP request.");
49267
+ }
49268
+ delete request.headers["amz-sdk-invocation-id"];
49269
+ delete request.headers["amz-sdk-request"];
49270
+ delete request.headers["x-amz-user-agent"];
49271
+ let presigned2;
49272
+ const presignerOptions = {
49273
+ ...options,
49274
+ signingRegion: (_a3 = options.signingRegion) !== null && _a3 !== void 0 ? _a3 : context["signing_region"],
49275
+ signingService: (_b2 = options.signingService) !== null && _b2 !== void 0 ? _b2 : context["signing_service"]
49276
+ };
49277
+ if (context.s3ExpressIdentity) {
49278
+ presigned2 = await s3Presigner.presignWithCredentials(request, context.s3ExpressIdentity, presignerOptions);
49279
+ } else {
49280
+ presigned2 = await s3Presigner.presign(request, presignerOptions);
49281
+ }
49282
+ return {
49283
+ response: {},
49284
+ output: {
49285
+ $metadata: { httpStatusCode: 200 },
49286
+ presigned: presigned2
49287
+ }
49288
+ };
49289
+ };
49290
+ const middlewareName = "presignInterceptMiddleware";
49291
+ const clientStack = client.middlewareStack.clone();
49292
+ clientStack.addRelativeTo(presignInterceptMiddleware, {
49293
+ name: middlewareName,
49294
+ relation: "before",
49295
+ toMiddleware: "awsAuthMiddleware",
49296
+ override: true
49297
+ });
49298
+ const handler = command5.resolveMiddleware(clientStack, client.config, {});
49299
+ const { output } = await handler({ input: command5.input });
49300
+ const { presigned } = output;
49301
+ return (0, util_format_url_1.formatUrl)(presigned);
49302
+ };
49303
+ exports.getSignedUrl = getSignedUrl2;
49304
+ }
49305
+ });
49306
+
49307
+ // ../shared/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/index.js
49308
+ var require_dist_cjs71 = __commonJS({
49309
+ "../shared/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/index.js"(exports) {
49310
+ "use strict";
49311
+ Object.defineProperty(exports, "__esModule", { value: true });
49312
+ var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
49313
+ tslib_1.__exportStar(require_getSignedUrl(), exports);
49314
+ tslib_1.__exportStar(require_presigner(), exports);
49315
+ }
49316
+ });
49317
+
49120
49318
  // ../../node_modules/@aws-sdk/client-cognito-identity/dist-cjs/endpoint/EndpointParameters.js
49121
49319
  var require_EndpointParameters4 = __commonJS({
49122
49320
  "../../node_modules/@aws-sdk/client-cognito-identity/dist-cjs/endpoint/EndpointParameters.js"(exports) {
@@ -52666,7 +52864,7 @@ var require_models4 = __commonJS({
52666
52864
  });
52667
52865
 
52668
52866
  // ../../node_modules/@aws-sdk/client-cognito-identity/dist-cjs/index.js
52669
- var require_dist_cjs70 = __commonJS({
52867
+ var require_dist_cjs72 = __commonJS({
52670
52868
  "../../node_modules/@aws-sdk/client-cognito-identity/dist-cjs/index.js"(exports) {
52671
52869
  "use strict";
52672
52870
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -52739,7 +52937,7 @@ var require_fromCognitoIdentity = __commonJS({
52739
52937
  "use strict";
52740
52938
  Object.defineProperty(exports, "__esModule", { value: true });
52741
52939
  exports.fromCognitoIdentity = void 0;
52742
- var client_cognito_identity_1 = require_dist_cjs70();
52940
+ var client_cognito_identity_1 = require_dist_cjs72();
52743
52941
  var property_provider_1 = require_dist_cjs25();
52744
52942
  var resolveLogins_1 = require_resolveLogins();
52745
52943
  function fromCognitoIdentity(parameters) {
@@ -52903,7 +53101,7 @@ var require_fromCognitoIdentityPool = __commonJS({
52903
53101
  "use strict";
52904
53102
  Object.defineProperty(exports, "__esModule", { value: true });
52905
53103
  exports.fromCognitoIdentityPool = void 0;
52906
- var client_cognito_identity_1 = require_dist_cjs70();
53104
+ var client_cognito_identity_1 = require_dist_cjs72();
52907
53105
  var property_provider_1 = require_dist_cjs25();
52908
53106
  var fromCognitoIdentity_1 = require_fromCognitoIdentity();
52909
53107
  var localStorage_1 = require_localStorage();
@@ -52948,7 +53146,7 @@ var require_fromCognitoIdentityPool = __commonJS({
52948
53146
  });
52949
53147
 
52950
53148
  // ../../node_modules/@aws-sdk/credential-provider-cognito-identity/dist-cjs/index.js
52951
- var require_dist_cjs71 = __commonJS({
53149
+ var require_dist_cjs73 = __commonJS({
52952
53150
  "../../node_modules/@aws-sdk/credential-provider-cognito-identity/dist-cjs/index.js"(exports) {
52953
53151
  "use strict";
52954
53152
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -52967,8 +53165,8 @@ var require_fromCognitoIdentity2 = __commonJS({
52967
53165
  "use strict";
52968
53166
  Object.defineProperty(exports, "__esModule", { value: true });
52969
53167
  exports.fromCognitoIdentity = void 0;
52970
- var client_cognito_identity_1 = require_dist_cjs70();
52971
- var credential_provider_cognito_identity_1 = require_dist_cjs71();
53168
+ var client_cognito_identity_1 = require_dist_cjs72();
53169
+ var credential_provider_cognito_identity_1 = require_dist_cjs73();
52972
53170
  var fromCognitoIdentity = (options) => {
52973
53171
  var _a2;
52974
53172
  return (0, credential_provider_cognito_identity_1.fromCognitoIdentity)({
@@ -52986,8 +53184,8 @@ var require_fromCognitoIdentityPool2 = __commonJS({
52986
53184
  "use strict";
52987
53185
  Object.defineProperty(exports, "__esModule", { value: true });
52988
53186
  exports.fromCognitoIdentityPool = void 0;
52989
- var client_cognito_identity_1 = require_dist_cjs70();
52990
- var credential_provider_cognito_identity_1 = require_dist_cjs71();
53187
+ var client_cognito_identity_1 = require_dist_cjs72();
53188
+ var credential_provider_cognito_identity_1 = require_dist_cjs73();
52991
53189
  var fromCognitoIdentityPool = (options) => {
52992
53190
  var _a2;
52993
53191
  return (0, credential_provider_cognito_identity_1.fromCognitoIdentityPool)({
@@ -53208,7 +53406,7 @@ var require_fromHttp = __commonJS({
53208
53406
  });
53209
53407
 
53210
53408
  // ../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.js
53211
- var require_dist_cjs72 = __commonJS({
53409
+ var require_dist_cjs74 = __commonJS({
53212
53410
  "../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.js"(exports) {
53213
53411
  "use strict";
53214
53412
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -53378,7 +53576,7 @@ var require_fromWebToken2 = __commonJS({
53378
53576
  });
53379
53577
 
53380
53578
  // ../../node_modules/@aws-sdk/credential-providers/dist-cjs/index.js
53381
- var require_dist_cjs73 = __commonJS({
53579
+ var require_dist_cjs75 = __commonJS({
53382
53580
  "../../node_modules/@aws-sdk/credential-providers/dist-cjs/index.js"(exports) {
53383
53581
  "use strict";
53384
53582
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -53388,7 +53586,7 @@ var require_dist_cjs73 = __commonJS({
53388
53586
  tslib_1.__exportStar(require_fromCognitoIdentityPool2(), exports);
53389
53587
  tslib_1.__exportStar(require_fromContainerMetadata2(), exports);
53390
53588
  tslib_1.__exportStar(require_fromEnv3(), exports);
53391
- var credential_provider_http_1 = require_dist_cjs72();
53589
+ var credential_provider_http_1 = require_dist_cjs74();
53392
53590
  Object.defineProperty(exports, "fromHttp", { enumerable: true, get: function() {
53393
53591
  return credential_provider_http_1.fromHttp;
53394
53592
  } });
@@ -53453,7 +53651,7 @@ var require_AbortController = __commonJS({
53453
53651
  });
53454
53652
 
53455
53653
  // ../../node_modules/@smithy/abort-controller/dist-cjs/index.js
53456
- var require_dist_cjs74 = __commonJS({
53654
+ var require_dist_cjs76 = __commonJS({
53457
53655
  "../../node_modules/@smithy/abort-controller/dist-cjs/index.js"(exports) {
53458
53656
  "use strict";
53459
53657
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -53667,7 +53865,7 @@ var require_Upload = __commonJS({
53667
53865
  Object.defineProperty(exports, "__esModule", { value: true });
53668
53866
  exports.Upload = void 0;
53669
53867
  var client_s3_1 = require_dist_cjs69();
53670
- var abort_controller_1 = require_dist_cjs74();
53868
+ var abort_controller_1 = require_dist_cjs76();
53671
53869
  var middleware_endpoint_1 = require_dist_cjs38();
53672
53870
  var smithy_client_1 = require_dist_cjs16();
53673
53871
  var events_1 = require("events");
@@ -53940,7 +54138,7 @@ var require_types11 = __commonJS({
53940
54138
  });
53941
54139
 
53942
54140
  // ../../node_modules/@aws-sdk/lib-storage/dist-cjs/index.js
53943
- var require_dist_cjs75 = __commonJS({
54141
+ var require_dist_cjs77 = __commonJS({
53944
54142
  "../../node_modules/@aws-sdk/lib-storage/dist-cjs/index.js"(exports) {
53945
54143
  "use strict";
53946
54144
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -54701,7 +54899,7 @@ var require_EndpointCache = __commonJS({
54701
54899
  });
54702
54900
 
54703
54901
  // ../../node_modules/@aws-sdk/endpoint-cache/dist-cjs/index.js
54704
- var require_dist_cjs76 = __commonJS({
54902
+ var require_dist_cjs78 = __commonJS({
54705
54903
  "../../node_modules/@aws-sdk/endpoint-cache/dist-cjs/index.js"(exports) {
54706
54904
  "use strict";
54707
54905
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -54717,7 +54915,7 @@ var require_resolveEndpointDiscoveryConfig = __commonJS({
54717
54915
  "use strict";
54718
54916
  Object.defineProperty(exports, "__esModule", { value: true });
54719
54917
  exports.resolveEndpointDiscoveryConfig = void 0;
54720
- var endpoint_cache_1 = require_dist_cjs76();
54918
+ var endpoint_cache_1 = require_dist_cjs78();
54721
54919
  var resolveEndpointDiscoveryConfig = (input, { endpointDiscoveryCommandCtor }) => {
54722
54920
  var _a2;
54723
54921
  return {
@@ -54733,7 +54931,7 @@ var require_resolveEndpointDiscoveryConfig = __commonJS({
54733
54931
  });
54734
54932
 
54735
54933
  // ../../node_modules/@aws-sdk/middleware-endpoint-discovery/dist-cjs/index.js
54736
- var require_dist_cjs77 = __commonJS({
54934
+ var require_dist_cjs79 = __commonJS({
54737
54935
  "../../node_modules/@aws-sdk/middleware-endpoint-discovery/dist-cjs/index.js"(exports) {
54738
54936
  "use strict";
54739
54937
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -60213,7 +60411,7 @@ var require_runtimeConfig6 = __commonJS({
60213
60411
  var client_sts_1 = require_dist_cjs59();
60214
60412
  var core_1 = require_dist_cjs44();
60215
60413
  var credential_provider_node_1 = require_dist_cjs58();
60216
- var middleware_endpoint_discovery_1 = require_dist_cjs77();
60414
+ var middleware_endpoint_discovery_1 = require_dist_cjs79();
60217
60415
  var util_user_agent_node_1 = require_dist_cjs48();
60218
60416
  var config_resolver_1 = require_dist_cjs30();
60219
60417
  var hash_node_1 = require_dist_cjs49();
@@ -60292,7 +60490,7 @@ var require_DynamoDBClient = __commonJS({
60292
60490
  "use strict";
60293
60491
  Object.defineProperty(exports, "__esModule", { value: true });
60294
60492
  exports.DynamoDBClient = exports.__Client = void 0;
60295
- var middleware_endpoint_discovery_1 = require_dist_cjs77();
60493
+ var middleware_endpoint_discovery_1 = require_dist_cjs79();
60296
60494
  var middleware_host_header_1 = require_dist_cjs4();
60297
60495
  var middleware_logger_1 = require_dist_cjs5();
60298
60496
  var middleware_recursion_detection_1 = require_dist_cjs6();
@@ -63924,7 +64122,7 @@ var require_models5 = __commonJS({
63924
64122
  });
63925
64123
 
63926
64124
  // ../../node_modules/@aws-sdk/client-dynamodb/dist-cjs/index.js
63927
- var require_dist_cjs78 = __commonJS({
64125
+ var require_dist_cjs80 = __commonJS({
63928
64126
  "../../node_modules/@aws-sdk/client-dynamodb/dist-cjs/index.js"(exports) {
63929
64127
  "use strict";
63930
64128
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -64260,7 +64458,7 @@ var require_unmarshall = __commonJS({
64260
64458
  });
64261
64459
 
64262
64460
  // ../../node_modules/@aws-sdk/util-dynamodb/dist-cjs/index.js
64263
- var require_dist_cjs79 = __commonJS({
64461
+ var require_dist_cjs81 = __commonJS({
64264
64462
  "../../node_modules/@aws-sdk/util-dynamodb/dist-cjs/index.js"(exports) {
64265
64463
  "use strict";
64266
64464
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -65691,14 +65889,14 @@ var require_polygon_clipping_cjs = __commonJS({
65691
65889
  if (windingsAfter[_i] === 0)
65692
65890
  continue;
65693
65891
  var _ring = ringsAfter[_i];
65694
- var poly = _ring.poly;
65695
- if (polysExclude.indexOf(poly) !== -1)
65892
+ var poly2 = _ring.poly;
65893
+ if (polysExclude.indexOf(poly2) !== -1)
65696
65894
  continue;
65697
65895
  if (_ring.isExterior)
65698
- polysAfter.push(poly);
65896
+ polysAfter.push(poly2);
65699
65897
  else {
65700
- if (polysExclude.indexOf(poly) === -1)
65701
- polysExclude.push(poly);
65898
+ if (polysExclude.indexOf(poly2) === -1)
65899
+ polysExclude.push(poly2);
65702
65900
  var _index = polysAfter.indexOf(_ring.poly);
65703
65901
  if (_index !== -1)
65704
65902
  polysAfter.splice(_index, 1);
@@ -65781,12 +65979,12 @@ var require_polygon_clipping_cjs = __commonJS({
65781
65979
  return Segment2;
65782
65980
  }();
65783
65981
  var RingIn = /* @__PURE__ */ function() {
65784
- function RingIn2(geomRing, poly, isExterior) {
65982
+ function RingIn2(geomRing, poly2, isExterior) {
65785
65983
  _classCallCheck(this, RingIn2);
65786
65984
  if (!Array.isArray(geomRing) || geomRing.length === 0) {
65787
65985
  throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
65788
65986
  }
65789
- this.poly = poly;
65987
+ this.poly = poly2;
65790
65988
  this.isExterior = isExterior;
65791
65989
  this.segments = [];
65792
65990
  if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
@@ -65910,16 +66108,16 @@ var require_polygon_clipping_cjs = __commonJS({
65910
66108
  }
65911
66109
  };
65912
66110
  for (var i = 0, iMax = geom.length; i < iMax; i++) {
65913
- var poly = new PolyIn(geom[i], this);
65914
- if (poly.bbox.ll.x < this.bbox.ll.x)
65915
- this.bbox.ll.x = poly.bbox.ll.x;
65916
- if (poly.bbox.ll.y < this.bbox.ll.y)
65917
- this.bbox.ll.y = poly.bbox.ll.y;
65918
- if (poly.bbox.ur.x > this.bbox.ur.x)
65919
- this.bbox.ur.x = poly.bbox.ur.x;
65920
- if (poly.bbox.ur.y > this.bbox.ur.y)
65921
- this.bbox.ur.y = poly.bbox.ur.y;
65922
- this.polys.push(poly);
66111
+ var poly2 = new PolyIn(geom[i], this);
66112
+ if (poly2.bbox.ll.x < this.bbox.ll.x)
66113
+ this.bbox.ll.x = poly2.bbox.ll.x;
66114
+ if (poly2.bbox.ll.y < this.bbox.ll.y)
66115
+ this.bbox.ll.y = poly2.bbox.ll.y;
66116
+ if (poly2.bbox.ur.x > this.bbox.ur.x)
66117
+ this.bbox.ur.x = poly2.bbox.ur.x;
66118
+ if (poly2.bbox.ur.y > this.bbox.ur.y)
66119
+ this.bbox.ur.y = poly2.bbox.ur.y;
66120
+ this.polys.push(poly2);
65923
66121
  }
65924
66122
  this.isSubject = isSubject;
65925
66123
  }
@@ -70677,7 +70875,7 @@ var require_proj4_src = __commonJS({
70677
70875
  return p;
70678
70876
  }
70679
70877
  var names$19 = ["Polyconic", "poly"];
70680
- var poly = {
70878
+ var poly2 = {
70681
70879
  init: init$18,
70682
70880
  forward: forward$17,
70683
70881
  inverse: inverse$17,
@@ -72157,7 +72355,7 @@ var require_proj4_src = __commonJS({
72157
72355
  proj4.Proj.projections.add(gnom);
72158
72356
  proj4.Proj.projections.add(cea);
72159
72357
  proj4.Proj.projections.add(eqc);
72160
- proj4.Proj.projections.add(poly);
72358
+ proj4.Proj.projections.add(poly2);
72161
72359
  proj4.Proj.projections.add(nzmg);
72162
72360
  proj4.Proj.projections.add(mill);
72163
72361
  proj4.Proj.projections.add(sinu);
@@ -72643,6 +72841,225 @@ var require_src3 = __commonJS({
72643
72841
  }
72644
72842
  });
72645
72843
 
72844
+ // node_modules/tinyqueue/tinyqueue.js
72845
+ var require_tinyqueue = __commonJS({
72846
+ "node_modules/tinyqueue/tinyqueue.js"(exports, module2) {
72847
+ (function(global2, factory) {
72848
+ typeof exports === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global2 = global2 || self, global2.TinyQueue = factory());
72849
+ })(exports, function() {
72850
+ "use strict";
72851
+ var TinyQueue = function TinyQueue2(data, compare) {
72852
+ if (data === void 0)
72853
+ data = [];
72854
+ if (compare === void 0)
72855
+ compare = defaultCompare;
72856
+ this.data = data;
72857
+ this.length = this.data.length;
72858
+ this.compare = compare;
72859
+ if (this.length > 0) {
72860
+ for (var i = (this.length >> 1) - 1; i >= 0; i--) {
72861
+ this._down(i);
72862
+ }
72863
+ }
72864
+ };
72865
+ TinyQueue.prototype.push = function push2(item) {
72866
+ this.data.push(item);
72867
+ this.length++;
72868
+ this._up(this.length - 1);
72869
+ };
72870
+ TinyQueue.prototype.pop = function pop() {
72871
+ if (this.length === 0) {
72872
+ return void 0;
72873
+ }
72874
+ var top = this.data[0];
72875
+ var bottom = this.data.pop();
72876
+ this.length--;
72877
+ if (this.length > 0) {
72878
+ this.data[0] = bottom;
72879
+ this._down(0);
72880
+ }
72881
+ return top;
72882
+ };
72883
+ TinyQueue.prototype.peek = function peek() {
72884
+ return this.data[0];
72885
+ };
72886
+ TinyQueue.prototype._up = function _up(pos) {
72887
+ var ref = this;
72888
+ var data = ref.data;
72889
+ var compare = ref.compare;
72890
+ var item = data[pos];
72891
+ while (pos > 0) {
72892
+ var parent = pos - 1 >> 1;
72893
+ var current = data[parent];
72894
+ if (compare(item, current) >= 0) {
72895
+ break;
72896
+ }
72897
+ data[pos] = current;
72898
+ pos = parent;
72899
+ }
72900
+ data[pos] = item;
72901
+ };
72902
+ TinyQueue.prototype._down = function _down(pos) {
72903
+ var ref = this;
72904
+ var data = ref.data;
72905
+ var compare = ref.compare;
72906
+ var halfLength = this.length >> 1;
72907
+ var item = data[pos];
72908
+ while (pos < halfLength) {
72909
+ var left = (pos << 1) + 1;
72910
+ var best = data[left];
72911
+ var right = left + 1;
72912
+ if (right < this.length && compare(data[right], best) < 0) {
72913
+ left = right;
72914
+ best = data[right];
72915
+ }
72916
+ if (compare(best, item) >= 0) {
72917
+ break;
72918
+ }
72919
+ data[pos] = best;
72920
+ pos = left;
72921
+ }
72922
+ data[pos] = item;
72923
+ };
72924
+ function defaultCompare(a, b) {
72925
+ return a < b ? -1 : a > b ? 1 : 0;
72926
+ }
72927
+ return TinyQueue;
72928
+ });
72929
+ }
72930
+ });
72931
+
72932
+ // node_modules/polylabel/polylabel.js
72933
+ var require_polylabel = __commonJS({
72934
+ "node_modules/polylabel/polylabel.js"(exports, module2) {
72935
+ "use strict";
72936
+ var Queue2 = require_tinyqueue();
72937
+ if (Queue2.default)
72938
+ Queue2 = Queue2.default;
72939
+ module2.exports = polylabel2;
72940
+ module2.exports.default = polylabel2;
72941
+ function polylabel2(polygon, precision, debug) {
72942
+ precision = precision || 1;
72943
+ var minX, minY, maxX, maxY;
72944
+ for (var i = 0; i < polygon[0].length; i++) {
72945
+ var p = polygon[0][i];
72946
+ if (!i || p[0] < minX)
72947
+ minX = p[0];
72948
+ if (!i || p[1] < minY)
72949
+ minY = p[1];
72950
+ if (!i || p[0] > maxX)
72951
+ maxX = p[0];
72952
+ if (!i || p[1] > maxY)
72953
+ maxY = p[1];
72954
+ }
72955
+ var width = maxX - minX;
72956
+ var height = maxY - minY;
72957
+ var cellSize = Math.min(width, height);
72958
+ var h = cellSize / 2;
72959
+ if (cellSize === 0) {
72960
+ var degeneratePoleOfInaccessibility = [minX, minY];
72961
+ degeneratePoleOfInaccessibility.distance = 0;
72962
+ return degeneratePoleOfInaccessibility;
72963
+ }
72964
+ var cellQueue = new Queue2(void 0, compareMax);
72965
+ for (var x = minX; x < maxX; x += cellSize) {
72966
+ for (var y = minY; y < maxY; y += cellSize) {
72967
+ cellQueue.push(new Cell(x + h, y + h, h, polygon));
72968
+ }
72969
+ }
72970
+ var bestCell = getCentroidCell(polygon);
72971
+ var bboxCell = new Cell(minX + width / 2, minY + height / 2, 0, polygon);
72972
+ if (bboxCell.d > bestCell.d)
72973
+ bestCell = bboxCell;
72974
+ var numProbes = cellQueue.length;
72975
+ while (cellQueue.length) {
72976
+ var cell = cellQueue.pop();
72977
+ if (cell.d > bestCell.d) {
72978
+ bestCell = cell;
72979
+ if (debug)
72980
+ console.log("found best %d after %d probes", Math.round(1e4 * cell.d) / 1e4, numProbes);
72981
+ }
72982
+ if (cell.max - bestCell.d <= precision)
72983
+ continue;
72984
+ h = cell.h / 2;
72985
+ cellQueue.push(new Cell(cell.x - h, cell.y - h, h, polygon));
72986
+ cellQueue.push(new Cell(cell.x + h, cell.y - h, h, polygon));
72987
+ cellQueue.push(new Cell(cell.x - h, cell.y + h, h, polygon));
72988
+ cellQueue.push(new Cell(cell.x + h, cell.y + h, h, polygon));
72989
+ numProbes += 4;
72990
+ }
72991
+ if (debug) {
72992
+ console.log("num probes: " + numProbes);
72993
+ console.log("best distance: " + bestCell.d);
72994
+ }
72995
+ var poleOfInaccessibility = [bestCell.x, bestCell.y];
72996
+ poleOfInaccessibility.distance = bestCell.d;
72997
+ return poleOfInaccessibility;
72998
+ }
72999
+ function compareMax(a, b) {
73000
+ return b.max - a.max;
73001
+ }
73002
+ function Cell(x, y, h, polygon) {
73003
+ this.x = x;
73004
+ this.y = y;
73005
+ this.h = h;
73006
+ this.d = pointToPolygonDist(x, y, polygon);
73007
+ this.max = this.d + this.h * Math.SQRT2;
73008
+ }
73009
+ function pointToPolygonDist(x, y, polygon) {
73010
+ var inside = false;
73011
+ var minDistSq = Infinity;
73012
+ for (var k = 0; k < polygon.length; k++) {
73013
+ var ring = polygon[k];
73014
+ for (var i = 0, len = ring.length, j = len - 1; i < len; j = i++) {
73015
+ var a = ring[i];
73016
+ var b = ring[j];
73017
+ if (a[1] > y !== b[1] > y && x < (b[0] - a[0]) * (y - a[1]) / (b[1] - a[1]) + a[0])
73018
+ inside = !inside;
73019
+ minDistSq = Math.min(minDistSq, getSegDistSq(x, y, a, b));
73020
+ }
73021
+ }
73022
+ return minDistSq === 0 ? 0 : (inside ? 1 : -1) * Math.sqrt(minDistSq);
73023
+ }
73024
+ function getCentroidCell(polygon) {
73025
+ var area = 0;
73026
+ var x = 0;
73027
+ var y = 0;
73028
+ var points = polygon[0];
73029
+ for (var i = 0, len = points.length, j = len - 1; i < len; j = i++) {
73030
+ var a = points[i];
73031
+ var b = points[j];
73032
+ var f = a[0] * b[1] - b[0] * a[1];
73033
+ x += (a[0] + b[0]) * f;
73034
+ y += (a[1] + b[1]) * f;
73035
+ area += f * 3;
73036
+ }
73037
+ if (area === 0)
73038
+ return new Cell(points[0][0], points[0][1], 0, polygon);
73039
+ return new Cell(x / area, y / area, 0, polygon);
73040
+ }
73041
+ function getSegDistSq(px, py, a, b) {
73042
+ var x = a[0];
73043
+ var y = a[1];
73044
+ var dx = b[0] - x;
73045
+ var dy = b[1] - y;
73046
+ if (dx !== 0 || dy !== 0) {
73047
+ var t = ((px - x) * dx + (py - y) * dy) / (dx * dx + dy * dy);
73048
+ if (t > 1) {
73049
+ x = b[0];
73050
+ y = b[1];
73051
+ } else if (t > 0) {
73052
+ x += dx * t;
73053
+ y += dy * t;
73054
+ }
73055
+ }
73056
+ dx = px - x;
73057
+ dy = py - y;
73058
+ return dx * dx + dy * dy;
73059
+ }
73060
+ }
73061
+ });
73062
+
72646
73063
  // ../../node_modules/readable-stream/lib/internal/streams/stream.js
72647
73064
  var require_stream2 = __commonJS({
72648
73065
  "../../node_modules/readable-stream/lib/internal/streams/stream.js"(exports, module2) {
@@ -80329,9 +80746,9 @@ var ulid2 = __toESM(require_index_umd(), 1);
80329
80746
  var CliInfo = {
80330
80747
  // Detect unlinked packages looks for this string since its a package name, slightly work around it
80331
80748
  package: "@basemaps/cli",
80332
- version: "v8.3.0",
80333
- hash: "fe8bbf9d0a3ca2f590505924f227a6d9da0ea5a8",
80334
- buildId: "15719849199-1"
80749
+ version: "v8.5.0",
80750
+ hash: "4f6f3929b9117c3e112f7d156ab185cb98821796",
80751
+ buildId: "16305730095-1"
80335
80752
  };
80336
80753
  var CliDate = (/* @__PURE__ */ new Date()).toISOString();
80337
80754
  var CliId = ulid2.ulid();
@@ -84629,6 +85046,7 @@ var import_ulid2 = __toESM(require_index_umd(), 1);
84629
85046
  // ../shared/build/file.system.js
84630
85047
  var import_node_url3 = require("url");
84631
85048
  var import_client_s34 = __toESM(require_dist_cjs69(), 1);
85049
+ var import_s3_request_presigner = __toESM(require_dist_cjs71(), 1);
84632
85050
 
84633
85051
  // ../../node_modules/@chunkd/source/build/src/error.js
84634
85052
  var SourceError = class _SourceError extends Error {
@@ -85354,12 +85772,12 @@ var FsHttp = class {
85354
85772
 
85355
85773
  // ../../node_modules/@chunkd/fs-aws/build/src/credentials.js
85356
85774
  var import_client_s33 = __toESM(require_dist_cjs69(), 1);
85357
- var import_credential_providers = __toESM(require_dist_cjs73(), 1);
85775
+ var import_credential_providers = __toESM(require_dist_cjs75(), 1);
85358
85776
 
85359
85777
  // ../../node_modules/@chunkd/fs-aws/build/src/fs.s3.js
85360
85778
  var import_node_stream = require("stream");
85361
85779
  var import_client_s32 = __toESM(require_dist_cjs69(), 1);
85362
- var import_lib_storage = __toESM(require_dist_cjs75(), 1);
85780
+ var import_lib_storage = __toESM(require_dist_cjs77(), 1);
85363
85781
 
85364
85782
  // ../../node_modules/@chunkd/source-aws/build/src/index.js
85365
85783
  var import_client_s3 = __toESM(require_dist_cjs69(), 1);
@@ -86083,14 +86501,15 @@ function hasHostName(x) {
86083
86501
  }
86084
86502
 
86085
86503
  // ../shared/build/file.system.js
86086
- var s3Fs = new FsAwsS3(new import_client_s34.S3Client({
86504
+ var s3Client = new import_client_s34.S3Client({
86087
86505
  /**
86088
- * We buckets in multiple regions we do not know ahead of time which bucket is in what region
86506
+ * We have buckets in multiple regions. We don’t know ahead of time which region each bucket is in
86089
86507
  *
86090
- * So the S3 Client will have to follow the endpoints, this adds a bit of extra latency as requests have to be retried
86508
+ * So, the S3 Client will have to follow the endpoints. This adds a bit of extra latency as requests have to be retried
86091
86509
  */
86092
86510
  followRegionRedirects: true
86093
- }));
86511
+ });
86512
+ var s3Fs = new FsAwsS3(s3Client);
86094
86513
  var s3FsPublic = new FsAwsS3(new import_client_s34.S3Client({
86095
86514
  followRegionRedirects: true,
86096
86515
  signer: {
@@ -86197,12 +86616,12 @@ var UrlArrayJsonFile = {
86197
86616
  };
86198
86617
 
86199
86618
  // ../shared/build/dynamo/dynamo.config.js
86200
- var import_client_dynamodb2 = __toESM(require_dist_cjs78(), 1);
86619
+ var import_client_dynamodb2 = __toESM(require_dist_cjs80(), 1);
86201
86620
  var import_util_retry = __toESM(require_dist_cjs40(), 1);
86202
86621
 
86203
86622
  // ../shared/build/dynamo/dynamo.config.base.js
86204
- var import_client_dynamodb = __toESM(require_dist_cjs78(), 1);
86205
- var import_util_dynamodb = __toESM(require_dist_cjs79(), 1);
86623
+ var import_client_dynamodb = __toESM(require_dist_cjs80(), 1);
86624
+ var import_util_dynamodb = __toESM(require_dist_cjs81(), 1);
86206
86625
  function toId(id) {
86207
86626
  return { id: { S: id } };
86208
86627
  }
@@ -86582,8 +87001,8 @@ var Bounds = class _Bounds {
86582
87001
  let minY = multipoly[0][0][0][1];
86583
87002
  let maxX = minX;
86584
87003
  let maxY = minY;
86585
- for (const [poly] of multipoly) {
86586
- for (const [x, y] of poly) {
87004
+ for (const [poly2] of multipoly) {
87005
+ for (const [x, y] of poly2) {
86587
87006
  if (x < minX)
86588
87007
  minX = x;
86589
87008
  else if (x > maxX)
@@ -86807,8 +87226,8 @@ function removeDegenerateEdges(polygons, bbox) {
86807
87226
  }
86808
87227
  function clipMultipolygon(polygons, bbox) {
86809
87228
  const result = [];
86810
- for (const poly of polygons) {
86811
- const clipped = import_lineclip.default.polygon(poly[0], bbox);
87229
+ for (const poly2 of polygons) {
87230
+ const clipped = import_lineclip.default.polygon(poly2[0], bbox);
86812
87231
  if (clipped.length !== 0) {
86813
87232
  if (!samePoint(clipped[0], clipped[clipped.length - 1]))
86814
87233
  clipped.push(clipped[0]);
@@ -86965,10 +87384,10 @@ var Wgs84 = {
86965
87384
  */
86966
87385
  multiPolygonToBbox(multipolygon) {
86967
87386
  let ans = null;
86968
- for (const poly of multipolygon) {
86969
- if (poly.length === 0)
87387
+ for (const poly2 of multipolygon) {
87388
+ if (poly2.length === 0)
86970
87389
  continue;
86971
- const ring = poly[0];
87390
+ const ring = poly2[0];
86972
87391
  if (ring.length < 3)
86973
87392
  continue;
86974
87393
  const bbox = this.ringToBbox(ring);
@@ -87004,11 +87423,11 @@ function pointAtFrac(frac, a, b) {
87004
87423
  }
87005
87424
  function splitWgs84MultiPolygon(multipoly) {
87006
87425
  const result = [];
87007
- for (const poly of clipMultipolygon(multipoly, WorldBounds)) {
87008
- result.push(poly);
87426
+ for (const poly2 of clipMultipolygon(multipoly, WorldBounds)) {
87427
+ result.push(poly2);
87009
87428
  }
87010
- for (const poly of clipMultipolygon(multipoly, NextWorldBounds)) {
87011
- result.push(poly.map((ring) => ring.map((point) => [point[0] - 360, point[1]])));
87429
+ for (const poly2 of clipMultipolygon(multipoly, NextWorldBounds)) {
87430
+ result.push(poly2.map((ring) => ring.map((point) => [point[0] - 360, point[1]])));
87012
87431
  }
87013
87432
  return result;
87014
87433
  }
@@ -87199,7 +87618,7 @@ var Projection = class _Projection {
87199
87618
  return multipoly;
87200
87619
  const { toWgs84 } = this;
87201
87620
  const { fromWgs84 } = targetProjection;
87202
- return multipoly.map((poly) => poly.map((ring) => ring.map((p) => fromWgs84(toWgs84(p)))));
87621
+ return multipoly.map((poly2) => poly2.map((ring) => ring.map((p) => fromWgs84(toWgs84(p)))));
87203
87622
  }
87204
87623
  /**
87205
87624
  * Convert source `[x, y]` coordinates to `[lon, lat]`
@@ -87920,8 +88339,8 @@ function locationTransform(location, tileMatrix, targetTileMatrix) {
87920
88339
  }
87921
88340
  function projectFeature(f, targetTileMatrix) {
87922
88341
  if (f.geometry.type === "Polygon") {
87923
- for (const poly of f.geometry.coordinates) {
87924
- for (const coord of poly) {
88342
+ for (const poly2 of f.geometry.coordinates) {
88343
+ for (const coord of poly2) {
87925
88344
  const output = locationTransform({ lat: coord[1], lon: coord[0], zoom: targetTileMatrix.maxZoom }, targetTileMatrix, GoogleTms);
87926
88345
  coord[0] = output.lon;
87927
88346
  coord[1] = output.lat;
@@ -87929,8 +88348,8 @@ function projectFeature(f, targetTileMatrix) {
87929
88348
  }
87930
88349
  } else if (f.geometry.type === "MultiPolygon") {
87931
88350
  for (const multiPoly of f.geometry.coordinates) {
87932
- for (const poly of multiPoly) {
87933
- for (const coord of poly) {
88351
+ for (const poly2 of multiPoly) {
88352
+ for (const coord of poly2) {
87934
88353
  const output = locationTransform({ lat: coord[1], lon: coord[0], zoom: targetTileMatrix.maxZoom }, targetTileMatrix, GoogleTms);
87935
88354
  coord[0] = output.lon;
87936
88355
  coord[1] = output.lat;
@@ -90558,7 +90977,10 @@ var VectorStac = class {
90558
90977
  collection: CliId,
90559
90978
  stac_version: "1.0.0",
90560
90979
  stac_extensions: [],
90561
- geometry: null,
90980
+ geometry: {
90981
+ type: "Polygon",
90982
+ coordinates: tileMatrix.extent.toPolygon()
90983
+ },
90562
90984
  bbox: tileMatrix.extent.toBbox(),
90563
90985
  links: [
90564
90986
  { href: `./${filename}.json`, rel: "self" },
@@ -90567,6 +90989,7 @@ var VectorStac = class {
90567
90989
  ...layers
90568
90990
  ],
90569
90991
  properties: {
90992
+ datetime: CliDate,
90570
90993
  "proj:epsg": tileMatrix.projection.code,
90571
90994
  "linz_basemaps:generated": {
90572
90995
  package: CliInfo.package,
@@ -90649,7 +91072,7 @@ async function createStacFiles(filePaths, targetPath, filename, tileMatrix, titl
90649
91072
  };
90650
91073
  const stacCollection = vectorStac.createStacCollection(unionBbox, layers, filename, title);
90651
91074
  let stacCatalog = vectorStac.createStacCatalog();
90652
- const catalogPath = new URL("catalog.json", targetPath);
91075
+ const catalogPath = new URL("topographic/catalog.json", targetPath);
90653
91076
  if (await Fsa.exists(catalogPath))
90654
91077
  stacCatalog = await Fsa.readJson(catalogPath);
90655
91078
  stacCatalog.links.push({
@@ -90713,6 +91136,7 @@ var ExtractCommand = (0, import_cmd_ts2.command)({
90713
91136
  const schemas = await schemaLoader.load();
90714
91137
  const smallLayers = [];
90715
91138
  const largeLayers = [];
91139
+ const collectionLinks = [];
90716
91140
  let total = 0;
90717
91141
  const allFiles = [];
90718
91142
  const vectorStac = new VectorStac(logger);
@@ -90726,7 +91150,7 @@ var ExtractCommand = (0, import_cmd_ts2.command)({
90726
91150
  continue;
90727
91151
  }
90728
91152
  logger.info({ layer: schema.name, id: layer.id }, "Extract: StacItem");
90729
- const stacFile = new URL(layer.cache.path.href.replace(/\.mbtiles$/, ".json"));
91153
+ const stacItemFile = new URL(layer.cache.path.href.replace(/\.mbtiles$/, ".json"));
90730
91154
  const stacLink = await vectorStac.createStacLink(schema.name, layer);
90731
91155
  const options = {
90732
91156
  name: schema.name,
@@ -90734,17 +91158,55 @@ var ExtractCommand = (0, import_cmd_ts2.command)({
90734
91158
  tileMatrix: tileMatrix.identifier,
90735
91159
  layer
90736
91160
  };
90737
- const stacItem = vectorStac.createStacItem([stacLink], layer.cache.fileName, tileMatrix, options);
90738
- await Fsa.write(stacFile, JSON.stringify(stacItem, null, 2));
91161
+ const itemfileName = layer.cache.fileName.replace(/\.mbtiles$/, "");
91162
+ const stacItem = vectorStac.createStacItem([stacLink], itemfileName, tileMatrix, options);
91163
+ const ldsStacItem = await Fsa.readJson(new URL(layer.source.replace(/\.gpkg$/, ".json")));
91164
+ if (ldsStacItem != null) {
91165
+ stacItem.bbox = ldsStacItem.bbox;
91166
+ stacItem.geometry = ldsStacItem.geometry;
91167
+ }
91168
+ await Fsa.write(stacItemFile, JSON.stringify(stacItem, null, 2));
91169
+ const stacCollectionFile = new URL(layer.cache.path.href.replace(layer.cache.fileName, "collection.json"));
91170
+ if (await Fsa.exists(stacCollectionFile)) {
91171
+ const collection = await Fsa.readJson(stacCollectionFile);
91172
+ if (collection.links.find((l) => l.href === `./${itemfileName}.json`) == null) {
91173
+ collection.links.push({ rel: "item", href: `./${itemfileName}.json` });
91174
+ }
91175
+ await Fsa.write(stacCollectionFile, JSON.stringify(collection, null, 2));
91176
+ } else {
91177
+ const title = `Mbtiles cache for ${layer.name}`;
91178
+ const collection = vectorStac.createStacCollection(stacItem.bbox, [], itemfileName, title);
91179
+ await Fsa.write(stacCollectionFile, JSON.stringify(collection, null, 2));
91180
+ }
91181
+ collectionLinks.push({
91182
+ href: `./${layer.id}/collection.json`,
91183
+ title: layer.name,
91184
+ type: "application/json",
91185
+ rel: "child"
91186
+ });
90739
91187
  logger.info({ layer: schema.name, id: layer.id }, "Extract: ToProcess");
90740
91188
  if (layer.largeLayer) {
90741
- largeLayers.push({ path: stacFile.href });
91189
+ largeLayers.push({ path: stacItemFile.href });
90742
91190
  } else {
90743
- smallLayers.push({ path: stacFile.href });
91191
+ smallLayers.push({ path: stacItemFile.href });
90744
91192
  }
90745
91193
  total++;
90746
91194
  }
90747
91195
  }
91196
+ const stacCatalogFile = new URL(`${tileMatrix.projection.code}/catalog.json`, cache);
91197
+ if (await Fsa.exists(stacCatalogFile)) {
91198
+ const catalog = await Fsa.readJson(stacCatalogFile);
91199
+ for (const link of collectionLinks) {
91200
+ if (catalog.links.find((l) => l.href === link.href) == null) {
91201
+ catalog.links.push(link);
91202
+ }
91203
+ }
91204
+ await Fsa.write(stacCatalogFile, JSON.stringify(catalog, null, 2));
91205
+ } else {
91206
+ const catalog = vectorStac.createStacCatalog();
91207
+ catalog.links.push(...collectionLinks);
91208
+ await Fsa.write(stacCatalogFile, JSON.stringify(catalog, null, 2));
91209
+ }
90748
91210
  logger.info({ ToProcess: total }, "CheckUpdate: Finish");
90749
91211
  await Fsa.write(Fsa.toUrl("/tmp/extract/allCaches.json"), JSON.stringify(allFiles, null, 2));
90750
91212
  await Fsa.write(Fsa.toUrl("/tmp/extract/smallLayers.json"), JSON.stringify(smallLayers, null, 2));
@@ -90961,93 +91423,79 @@ function handleKindPeak(feature, logger) {
90961
91423
  }
90962
91424
 
90963
91425
  // src/modify/parser.ts
91426
+ var optionalString = z.preprocess((value) => {
91427
+ if (value === "0" || value === null) {
91428
+ return void 0;
91429
+ } else {
91430
+ return value;
91431
+ }
91432
+ }, z.string().optional());
90964
91433
  var zPlaceLabelsProperties = z.object({
90965
91434
  /** @example "Kaitaia" */
90966
91435
  label: z.string(),
91436
+ /** @example 8 */
91437
+ zoom_level: z.number(),
90967
91438
  /** @example "TWN1" */
90968
91439
  style: z.string(),
91440
+ /** @example "cape" */
91441
+ natural: optionalString,
90969
91442
  /** @example "city" */
90970
- place: z.string(),
90971
- /** @example 7 */
90972
- adminlevel: z.number(),
90973
- /** @example "0" */
90974
- natural: z.string(),
90975
- /** @example "0" */
90976
- water: z.string()
90977
- });
90978
- var zPlaceLabelsTippecanoe = z.object({
90979
- /** @example "place_labels" */
90980
- layer: z.string(),
90981
- /** @example 8 */
90982
- minzoom: z.number(),
90983
- /** @example 8 */
90984
- maxzoom: z.number()
91443
+ place: optionalString,
91444
+ /** @example "bay" */
91445
+ water: optionalString
90985
91446
  });
90986
91447
 
90987
91448
  // src/modify/layers/place_labels.ts
90988
91449
  var PlaceLabelsFeatures = /* @__PURE__ */ new Map();
90989
91450
  function handleLayerPlaceLabels(feature, logger) {
90990
91451
  logger.trace({}, "HandlePlaceLabels:Start");
90991
- feature = structuredClone(feature);
90992
- const label = feature.properties["label"];
90993
- if (typeof label !== "string")
90994
- throw new Error("Label property is not a string");
90995
- const zoomLevel = feature.properties["zoom_level"];
90996
- if (typeof zoomLevel !== "number")
90997
- throw new Error("Zoom level is not a number");
90998
- const storedFeature = PlaceLabelsFeatures.get(label);
91452
+ const newFeature = createNewFeature(feature, logger);
91453
+ const name = newFeature.properties.name;
91454
+ const storedFeature = PlaceLabelsFeatures.get(name);
90999
91455
  if (storedFeature == null) {
91000
- const newFeature = createNewFeature(feature, label, zoomLevel, logger);
91001
- if (newFeature == null)
91002
- return null;
91003
- PlaceLabelsFeatures.set(label, newFeature);
91456
+ PlaceLabelsFeatures.set(name, newFeature);
91004
91457
  logger.trace({}, "HandlePlaceLabels:End");
91005
91458
  return newFeature;
91006
91459
  }
91007
- storedFeature.tippecanoe.minzoom = zoomLevel;
91008
- storedFeature.tippecanoe.maxzoom = zoomLevel;
91460
+ storedFeature.tippecanoe.minzoom = newFeature.tippecanoe.minzoom;
91461
+ storedFeature.tippecanoe.maxzoom = newFeature.tippecanoe.minzoom;
91009
91462
  logger.trace({}, "HandlePlaceLabels:End");
91010
- return storedFeature;
91463
+ return structuredClone(storedFeature);
91011
91464
  }
91012
- function createNewFeature(feature, label, zoomLevel, logger) {
91013
- let properties;
91014
- let tippecanoe2;
91465
+ function createNewFeature(feature, logger) {
91015
91466
  try {
91016
- properties = zPlaceLabelsProperties.parse({
91017
- label,
91467
+ const properties = zPlaceLabelsProperties.parse({
91468
+ label: feature.properties["label"],
91469
+ zoom_level: feature.properties["zoom_level"],
91018
91470
  style: feature.properties["style"],
91019
- place: feature.properties["place"],
91020
- adminlevel: feature.properties["adminlevel"],
91021
91471
  natural: feature.properties["natural"],
91472
+ place: feature.properties["place"],
91022
91473
  water: feature.properties["water"]
91023
91474
  });
91024
- tippecanoe2 = zPlaceLabelsTippecanoe.parse({
91475
+ const tippecanoe2 = {
91025
91476
  layer: "place_labels",
91026
- minzoom: zoomLevel,
91027
- maxzoom: zoomLevel
91028
- });
91477
+ minzoom: properties.zoom_level,
91478
+ maxzoom: properties.zoom_level
91479
+ };
91480
+ const newFeature = {
91481
+ type: feature.type,
91482
+ properties: {
91483
+ name: properties.label,
91484
+ kind: convertStyleToKind(properties.style, tippecanoe2.minzoom),
91485
+ natural: properties.natural,
91486
+ place: properties.place,
91487
+ water: properties.water
91488
+ },
91489
+ geometry: feature.geometry,
91490
+ tippecanoe: tippecanoe2
91491
+ };
91492
+ return newFeature;
91029
91493
  } catch (e) {
91030
91494
  if (e instanceof z.ZodError) {
91031
- logger.trace({ label }, "Failed to parse expected properties. Discarding feature.");
91032
- return null;
91033
- } else {
91034
- throw new Error("An unexpected error occurred.");
91035
- }
91036
- }
91037
- const newFeature = {
91038
- type: feature.type,
91039
- properties: {
91040
- name: properties.label,
91041
- kind: convertStyleToKind(properties.style, tippecanoe2.minzoom),
91042
- place: properties.place,
91043
- adminlevel: properties.adminlevel,
91044
- natural: properties.natural,
91045
- water: properties.water
91046
- },
91047
- geometry: feature.geometry,
91048
- tippecanoe: tippecanoe2
91049
- };
91050
- return newFeature;
91495
+ logger.trace({ properties: feature.properties }, "Failed to parse required properties.");
91496
+ }
91497
+ throw e;
91498
+ }
91051
91499
  }
91052
91500
  function convertStyleToKind(style, minzoom) {
91053
91501
  if (style.startsWith("ANT"))
@@ -91067,190 +91515,8 @@ function convertStyleToKind(style, minzoom) {
91067
91515
  return "";
91068
91516
  }
91069
91517
 
91070
- // ../../node_modules/tinyqueue/index.js
91071
- var TinyQueue = class {
91072
- constructor(data = [], compare = (a, b) => a < b ? -1 : a > b ? 1 : 0) {
91073
- this.data = data;
91074
- this.length = this.data.length;
91075
- this.compare = compare;
91076
- if (this.length > 0) {
91077
- for (let i = (this.length >> 1) - 1; i >= 0; i--)
91078
- this._down(i);
91079
- }
91080
- }
91081
- push(item) {
91082
- this.data.push(item);
91083
- this._up(this.length++);
91084
- }
91085
- pop() {
91086
- if (this.length === 0)
91087
- return void 0;
91088
- const top = this.data[0];
91089
- const bottom = this.data.pop();
91090
- if (--this.length > 0) {
91091
- this.data[0] = bottom;
91092
- this._down(0);
91093
- }
91094
- return top;
91095
- }
91096
- peek() {
91097
- return this.data[0];
91098
- }
91099
- _up(pos) {
91100
- const { data, compare } = this;
91101
- const item = data[pos];
91102
- while (pos > 0) {
91103
- const parent = pos - 1 >> 1;
91104
- const current = data[parent];
91105
- if (compare(item, current) >= 0)
91106
- break;
91107
- data[pos] = current;
91108
- pos = parent;
91109
- }
91110
- data[pos] = item;
91111
- }
91112
- _down(pos) {
91113
- const { data, compare } = this;
91114
- const halfLength = this.length >> 1;
91115
- const item = data[pos];
91116
- while (pos < halfLength) {
91117
- let bestChild = (pos << 1) + 1;
91118
- const right = bestChild + 1;
91119
- if (right < this.length && compare(data[right], data[bestChild]) < 0) {
91120
- bestChild = right;
91121
- }
91122
- if (compare(data[bestChild], item) >= 0)
91123
- break;
91124
- data[pos] = data[bestChild];
91125
- pos = bestChild;
91126
- }
91127
- data[pos] = item;
91128
- }
91129
- };
91130
-
91131
- // ../../node_modules/polylabel/polylabel.js
91132
- function polylabel(polygon, precision = 1, debug = false) {
91133
- let minX = Infinity;
91134
- let minY = Infinity;
91135
- let maxX = -Infinity;
91136
- let maxY = -Infinity;
91137
- for (const [x, y] of polygon[0]) {
91138
- if (x < minX)
91139
- minX = x;
91140
- if (y < minY)
91141
- minY = y;
91142
- if (x > maxX)
91143
- maxX = x;
91144
- if (y > maxY)
91145
- maxY = y;
91146
- }
91147
- const width = maxX - minX;
91148
- const height = maxY - minY;
91149
- const cellSize = Math.max(precision, Math.min(width, height));
91150
- if (cellSize === precision) {
91151
- const result2 = [minX, minY];
91152
- result2.distance = 0;
91153
- return result2;
91154
- }
91155
- const cellQueue = new TinyQueue([], (a, b) => b.max - a.max);
91156
- let bestCell = getCentroidCell(polygon);
91157
- const bboxCell = new Cell(minX + width / 2, minY + height / 2, 0, polygon);
91158
- if (bboxCell.d > bestCell.d)
91159
- bestCell = bboxCell;
91160
- let numProbes = 2;
91161
- function potentiallyQueue(x, y, h2) {
91162
- const cell = new Cell(x, y, h2, polygon);
91163
- numProbes++;
91164
- if (cell.max > bestCell.d + precision)
91165
- cellQueue.push(cell);
91166
- if (cell.d > bestCell.d) {
91167
- bestCell = cell;
91168
- if (debug)
91169
- console.log(`found best ${Math.round(1e4 * cell.d) / 1e4} after ${numProbes} probes`);
91170
- }
91171
- }
91172
- let h = cellSize / 2;
91173
- for (let x = minX; x < maxX; x += cellSize) {
91174
- for (let y = minY; y < maxY; y += cellSize) {
91175
- potentiallyQueue(x + h, y + h, h);
91176
- }
91177
- }
91178
- while (cellQueue.length) {
91179
- const { max, x, y, h: ch } = cellQueue.pop();
91180
- if (max - bestCell.d <= precision)
91181
- break;
91182
- h = ch / 2;
91183
- potentiallyQueue(x - h, y - h, h);
91184
- potentiallyQueue(x + h, y - h, h);
91185
- potentiallyQueue(x - h, y + h, h);
91186
- potentiallyQueue(x + h, y + h, h);
91187
- }
91188
- if (debug) {
91189
- console.log(`num probes: ${numProbes}
91190
- best distance: ${bestCell.d}`);
91191
- }
91192
- const result = [bestCell.x, bestCell.y];
91193
- result.distance = bestCell.d;
91194
- return result;
91195
- }
91196
- function Cell(x, y, h, polygon) {
91197
- this.x = x;
91198
- this.y = y;
91199
- this.h = h;
91200
- this.d = pointToPolygonDist(x, y, polygon);
91201
- this.max = this.d + this.h * Math.SQRT2;
91202
- }
91203
- function pointToPolygonDist(x, y, polygon) {
91204
- let inside = false;
91205
- let minDistSq = Infinity;
91206
- for (const ring of polygon) {
91207
- for (let i = 0, len = ring.length, j = len - 1; i < len; j = i++) {
91208
- const a = ring[i];
91209
- const b = ring[j];
91210
- if (a[1] > y !== b[1] > y && x < (b[0] - a[0]) * (y - a[1]) / (b[1] - a[1]) + a[0])
91211
- inside = !inside;
91212
- minDistSq = Math.min(minDistSq, getSegDistSq(x, y, a, b));
91213
- }
91214
- }
91215
- return minDistSq === 0 ? 0 : (inside ? 1 : -1) * Math.sqrt(minDistSq);
91216
- }
91217
- function getCentroidCell(polygon) {
91218
- let area = 0;
91219
- let x = 0;
91220
- let y = 0;
91221
- const points = polygon[0];
91222
- for (let i = 0, len = points.length, j = len - 1; i < len; j = i++) {
91223
- const a = points[i];
91224
- const b = points[j];
91225
- const f = a[0] * b[1] - b[0] * a[1];
91226
- x += (a[0] + b[0]) * f;
91227
- y += (a[1] + b[1]) * f;
91228
- area += f * 3;
91229
- }
91230
- const centroid = new Cell(x / area, y / area, 0, polygon);
91231
- if (area === 0 || centroid.d < 0)
91232
- return new Cell(points[0][0], points[0][1], 0, polygon);
91233
- return centroid;
91234
- }
91235
- function getSegDistSq(px, py, a, b) {
91236
- let x = a[0];
91237
- let y = a[1];
91238
- let dx = b[0] - x;
91239
- let dy = b[1] - y;
91240
- if (dx !== 0 || dy !== 0) {
91241
- const t = ((px - x) * dx + (py - y) * dy) / (dx * dx + dy * dy);
91242
- if (t > 1) {
91243
- x = b[0];
91244
- y = b[1];
91245
- } else if (t > 0) {
91246
- x += dx * t;
91247
- y += dy * t;
91248
- }
91249
- }
91250
- dx = px - x;
91251
- dy = py - y;
91252
- return dx * dx + dy * dy;
91253
- }
91518
+ // src/modify/shared.ts
91519
+ var poly = __toESM(require_polylabel(), 1);
91254
91520
 
91255
91521
  // src/modify/consts.ts
91256
91522
  var MajorHighWays = /* @__PURE__ */ new Set([
@@ -91277,7 +91543,7 @@ var MajorHighWays = /* @__PURE__ */ new Set([
91277
91543
  ]);
91278
91544
 
91279
91545
  // src/modify/shared.ts
91280
- var polylabel2 = polylabel;
91546
+ var polylabel = poly.default;
91281
91547
  function handleRoadFeature(feature, options, logger) {
91282
91548
  logger.trace({}, "HandleRoadFeature:Start");
91283
91549
  feature = structuredClone(feature);
@@ -91310,6 +91576,11 @@ function handleRoadFeature(feature, options, logger) {
91310
91576
  logger.trace({}, "HandleRoadFeature:End");
91311
91577
  return feature;
91312
91578
  }
91579
+ function getInaccessibilityPole(geometry, logger) {
91580
+ const coordinates = getCoordinates(geometry, logger);
91581
+ const inaccessibilityPole = polylabel(coordinates);
91582
+ return { type: "Point", coordinates: inaccessibilityPole };
91583
+ }
91313
91584
  function getCoordinates(geometry, logger) {
91314
91585
  switch (geometry.type) {
91315
91586
  case "MultiPolygon":
@@ -91333,10 +91604,7 @@ function handleLayerPois(feature, logger) {
91333
91604
  }
91334
91605
  feature.properties["building"] = bldgUse;
91335
91606
  if (feature.geometry.type === "Polygon" || feature.geometry.type === "MultiPolygon") {
91336
- const coordinates = getCoordinates(feature.geometry, logger);
91337
- const inaccessibilityPole = polylabel2(coordinates);
91338
- const point = { type: "Point", coordinates: inaccessibilityPole };
91339
- feature.geometry = point;
91607
+ feature.geometry = getInaccessibilityPole(feature.geometry, logger);
91340
91608
  }
91341
91609
  }
91342
91610
  logger.trace({}, "HandlePois:End");
@@ -91358,10 +91626,7 @@ function handleLayerPublicTransport(feature, options, logger) {
91358
91626
  function handleKindAerodrome(feature, logger) {
91359
91627
  logger.trace({}, "HandleKindAerodrome:Start");
91360
91628
  feature = structuredClone(feature);
91361
- const coordinates = getCoordinates(feature.geometry, logger);
91362
- const inaccessibilityPole = polylabel2(coordinates);
91363
- const point = { type: "Point", coordinates: inaccessibilityPole };
91364
- feature.geometry = point;
91629
+ feature.geometry = getInaccessibilityPole(feature.geometry, logger);
91365
91630
  logger.trace({}, "HandleKindAerodrome:End");
91366
91631
  return feature;
91367
91632
  }
@@ -93211,7 +93476,7 @@ async function upload(file, bucketPath, logger) {
93211
93476
  if (path4.protocol === "file:")
93212
93477
  await (0, import_promises.mkdir)((0, import_path3.dirname)(path4.pathname), { recursive: true });
93213
93478
  if (filename.endsWith("catalog.json"))
93214
- path4 = new URL(filename, bucketPath);
93479
+ path4 = new URL(`topographic/${filename}`, bucketPath);
93215
93480
  await Fsa.write(path4, stream);
93216
93481
  logger.info({ file, path: path4 }, "Load:Finish");
93217
93482
  return path4;