@octostar/map-component 0.2.17 → 0.2.19

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.mjs CHANGED
@@ -65,38 +65,85 @@ function hasAltitudeData(feature) {
65
65
  }
66
66
  return false;
67
67
  }
68
+ function yieldToMain() {
69
+ const scheduler = globalThis.scheduler;
70
+ if (typeof (scheduler == null ? void 0 : scheduler.yield) === "function") {
71
+ return scheduler.yield();
72
+ }
73
+ const channelCtor = globalThis.MessageChannel;
74
+ if (typeof channelCtor === "function") {
75
+ return new Promise((resolve) => {
76
+ const channel = new channelCtor();
77
+ channel.port1.onmessage = () => {
78
+ channel.port1.close();
79
+ resolve();
80
+ };
81
+ channel.port2.postMessage(void 0);
82
+ });
83
+ }
84
+ return new Promise((resolve) => setTimeout(resolve, 0));
85
+ }
68
86
  const PRETTY_EXPORT_MAX_FEATURES = 1e4;
69
87
  const TARGET_PART_CHARS = 8 * 1024 * 1024;
70
- function featureCollectionBlobParts(collection, options) {
71
- const prettyMax = PRETTY_EXPORT_MAX_FEATURES;
72
- if (collection.features.length <= prettyMax) {
73
- return [JSON.stringify(collection, null, 2)];
74
- }
75
- const targetChars = TARGET_PART_CHARS;
76
- const { features, ...rest } = collection;
77
- const head = JSON.stringify(rest);
88
+ function createBlobPartCoalescer(targetChars) {
78
89
  const parts = [];
79
90
  let pending = [];
80
91
  let pendingChars = 0;
81
- const push = (piece) => {
82
- pending.push(piece);
83
- pendingChars += piece.length;
84
- if (pendingChars >= targetChars) {
85
- parts.push(pending.join(""));
86
- pending = [];
87
- pendingChars = 0;
92
+ return {
93
+ push(piece) {
94
+ pending.push(piece);
95
+ pendingChars += piece.length;
96
+ if (pendingChars >= targetChars) {
97
+ parts.push(pending.join(""));
98
+ pending = [];
99
+ pendingChars = 0;
100
+ }
101
+ },
102
+ finish() {
103
+ if (pending.length > 0) parts.push(pending.join(""));
104
+ return parts;
88
105
  }
89
106
  };
90
- push(head.slice(0, -1));
91
- push(head.length > 2 ? ',"features":[' : '"features":[');
107
+ }
108
+ function pushCollectionHead(coalescer, rest) {
109
+ const head = JSON.stringify(rest);
110
+ coalescer.push(head.slice(0, -1));
111
+ coalescer.push(head.length > 2 ? ',"features":[' : '"features":[');
112
+ }
113
+ function serializeFeatureAt(feature, index) {
114
+ return index === 0 ? JSON.stringify(feature) : "," + JSON.stringify(feature);
115
+ }
116
+ const DEFAULT_SLICE_BUDGET_MS = 12;
117
+ async function featureCollectionBlobPartsAsync(collection, options) {
118
+ var _a, _b, _c;
119
+ const prettyMax = (options == null ? void 0 : options.prettyMaxFeatures) ?? PRETTY_EXPORT_MAX_FEATURES;
120
+ const mapFeature = options == null ? void 0 : options.mapFeature;
121
+ const total = collection.features.length;
122
+ if (total <= prettyMax) {
123
+ const mapped = mapFeature ? { ...collection, features: collection.features.map(mapFeature) } : collection;
124
+ (_a = options == null ? void 0 : options.onProgress) == null ? void 0 : _a.call(options, total, total);
125
+ return [JSON.stringify(mapped, null, 2)];
126
+ }
127
+ const { features, ...rest } = collection;
128
+ const coalescer = createBlobPartCoalescer((options == null ? void 0 : options.targetPartChars) ?? TARGET_PART_CHARS);
129
+ const yieldFn = (options == null ? void 0 : options.yieldFn) ?? yieldToMain;
130
+ const budget = (options == null ? void 0 : options.sliceBudgetMs) ?? DEFAULT_SLICE_BUDGET_MS;
131
+ pushCollectionHead(coalescer, rest);
132
+ let sliceStart = performance.now();
92
133
  for (let i = 0; i < features.length; i++) {
93
- push(i === 0 ? JSON.stringify(features[i]) : "," + JSON.stringify(features[i]));
134
+ const feature = mapFeature ? mapFeature(features[i], i) : features[i];
135
+ coalescer.push(serializeFeatureAt(feature, i));
136
+ if (performance.now() - sliceStart >= budget) {
137
+ (_b = options == null ? void 0 : options.onProgress) == null ? void 0 : _b.call(options, i + 1, total);
138
+ await yieldFn();
139
+ sliceStart = performance.now();
140
+ }
94
141
  }
95
- push("]}");
96
- if (pending.length > 0) parts.push(pending.join(""));
97
- return parts;
142
+ coalescer.push("]}");
143
+ (_c = options == null ? void 0 : options.onProgress) == null ? void 0 : _c.call(options, total, total);
144
+ return coalescer.finish();
98
145
  }
99
- const ingestWorkerSource = '"use strict";(()=>{function p(e){let t=e.crs?.properties?.name,n=null;if(t){let r=t.match(/EPSG::?(\\d+)/i);r&&(n=`EPSG:${r[1]}`)}if(!n&&e.features.length>0){let r=w(e.features[0].geometry);if(r){let[s,a]=r;if(Math.abs(s)<=180&&Math.abs(a)<=90)return{sourceCRS:"EPSG:4326",needsReprojection:!1}}return{sourceCRS:null,needsReprojection:!1}}return{sourceCRS:n,needsReprojection:n!==null&&n!=="EPSG:4326"}}function w(e){if(!e)return null;switch(e.type){case"Point":return e.coordinates;case"MultiPoint":case"LineString":return e.coordinates[0];case"MultiLineString":case"Polygon":return e.coordinates[0]?.[0];case"MultiPolygon":return e.coordinates[0]?.[0]?.[0];default:return null}}function S(e){return e.geometry?.type==="LineString"?e.geometry.coordinates.some(n=>n.length>=3&&n[2]!==0):e.geometry?.type==="MultiLineString"?e.geometry.coordinates.some(n=>n.some(r=>r.length>=3&&r[2]!==0)):!1}function i(e){if(!e)return null;if(e instanceof Date)return e;if(typeof e=="string"||typeof e=="number"){let t=new Date(e);return isNaN(t.getTime())?null:t}return null}function b(e){return!!(e.startDate||e.startdate||e.start_date||e.start_time||e.date||e.timestamp||e.flightDate||e.time||e.datetime||e.endDate||e.enddate||e.end_date||e.end_time)}function I(e){let t=i(e.startDate)||i(e.startdate)||i(e.start_date)||i(e.start_time)||i(e.date)||i(e.timestamp)||i(e.flightDate)||i(e.time)||i(e.datetime),n=i(e.endDate)||i(e.enddate)||i(e.end_date)||i(e.end_time);return t&&n&&n<t&&([t,n]=[n,t]),{startDate:t,endDate:n}}function h(e){return"kind"in e&&e.kind==="ack"}function J(){let e=globalThis.crypto?.randomUUID?.bind(globalThis.crypto);return e?e():`f-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function D(e,t,n){switch(n.idStrategy){case"preserve":return e.id;case"layer-index":return e.id!==void 0&&e.id!==null?String(e.id):`${n.layerId}-f${t}`;case"uuid-fallback":return e.id?String(e.id):J()}}function C(e,t){if(Array.isArray(e)){if(typeof e[0]=="number"){let n=e[0],r=e[1];t[0]=Math.min(t[0],n),t[1]=Math.min(t[1],r),t[2]=Math.max(t[2],n),t[3]=Math.max(t[3],r);return}for(let n of e)C(n,t)}}function R(e,t){if(e){if(e.type==="GeometryCollection"){for(let n of e.geometries)R(n,t);return}C(e.coordinates,t)}}function M(e){let t=[1/0,1/0,-1/0,-1/0];for(let n of e)R(n.geometry,t);return t.every(n=>isFinite(n))?t:null}function x(e,t){let n;if(e.type==="text")try{n=JSON.parse(e.text)}catch(d){return{kind:"error",code:"parse-error",message:d instanceof Error?d.message:"Invalid file"}}else n=e.data;if(n&&n.type==="Feature"&&(n={type:"FeatureCollection",features:[n]}),!n||n.type!=="FeatureCollection"||!Array.isArray(n.features))return{kind:"error",code:"invalid-format",message:"Invalid GeoJSON format"};if(t.emptyIsError&&n.features.length===0)return{kind:"error",code:"empty",message:"The file contains no features"};if(n["octostar:map"])return{kind:"enriched",data:n};let{sourceCRS:r,needsReprojection:s}=p(n),a=!1,o=!1,u=[];n.features.forEach((d,G)=>{let m=D(d,G,t);!o&&S(d)&&(o=!0);let g=d.properties||{};if(!b(g)){u.push(t.idStrategy==="preserve"?d:{...d,id:m});return}let{startDate:y,endDate:k}=I(g);(y||k)&&(a=!0),u.push({...d,...m!==void 0&&{id:m},properties:{...g,startDate:y?.toISOString()||null,endDate:k?.toISOString()||null}})});let c=n.properties?.layerMetadata;return{kind:"features",features:u,featureCount:u.length,bbox:M(u),hasTemporal:a,hasAltitude:o,reprojected:!1,sourceCRS:r,...s&&{needsReprojection:s},...c&&{layerMetadata:c}}}var O=5e3;function P(e,t){let n=Number.isNaN(t)?O:Math.max(1,Math.floor(t)),r=[];for(let s=0;s<e.length;s+=n)r.push(e.slice(s,s+n));return r}function f(e){if(e===void 0)return!1;if(typeof e=="number")return Number.isFinite(e)&&!Object.is(e,-0);if(e===null||typeof e!="object")return!0;if(Array.isArray(e)){for(let t=0;t<e.length;t++)if(!f(e[t]))return!1;return!0}for(let t in e)if(!f(e[t]))return!1;return!0}function A(e){for(let t=0;t<e.length;t++)if(!f(e[t]))return e;try{return JSON.stringify(e)}catch{return e}}function E(e){let{kind:t,features:n,...r}=e;return r}async function N(e,t,n,r){let s;try{s=x(t,n)}catch(a){r.post({kind:"result",id:e,ok:!1,error:a instanceof Error?a.message:String(a)});return}if(s.kind!=="features"){r.post({kind:"result",id:e,ok:!0,result:s});return}try{let a=r.encode??A,o=P(s.features,r.chunkSize??O);r.post({kind:"head",id:e,summary:E(s)});let u=o.length>0?a(o[0]):null;for(let c=0;c<o.length;c++){let d=r.waitAck(c);r.post({kind:"chunk",id:e,seq:c,payload:u}),u=c+1<o.length?a(o[c+1]):null,await d}r.post({kind:"done",id:e,chunkCount:o.length})}catch(a){r.post({kind:"error",id:e,message:a instanceof Error?a.message:String(a)})}}var F=e=>self.postMessage(e),l=new Map;self.onmessage=async e=>{let t=e.data;if(h(t)){let o=`${t.id}:${t.seq}`,u=l.get(o);l.delete(o),u?.();return}let{id:n,source:r,options:s,tuning:a}=t;try{let o=r.type==="blob"?{type:"text",text:await r.blob.text()}:r;await N(n,o,s,{post:F,waitAck:u=>new Promise(c=>{l.set(`${n}:${u}`,c)}),...a?.chunkSize!==void 0&&{chunkSize:a.chunkSize},...a?.featureArrayChunks&&{encode:u=>u}})}catch(o){F({kind:"result",id:n,ok:!1,error:o instanceof Error?o.message:String(o)})}finally{l.forEach((o,u)=>{u.startsWith(`${n}:`)&&l.delete(u)})}};})();\n';
146
+ const ingestWorkerSource = '"use strict";(()=>{function b(e,t){let n=e.length,r=Math.max(0,t.max-(t.existing??0));return n<=r?{features:e,dropped:0,sourceCount:n}:{features:e.slice(0,r),dropped:n-r,sourceCount:n}}function S(e){let t=e.crs?.properties?.name,n=null;if(t){let r=t.match(/EPSG::?(\\d+)/i);r&&(n=`EPSG:${r[1]}`)}if(!n&&e.features.length>0){let r=G(e.features[0].geometry);if(r){let[s,a]=r;if(Math.abs(s)<=180&&Math.abs(a)<=90)return{sourceCRS:"EPSG:4326",needsReprojection:!1}}return{sourceCRS:null,needsReprojection:!1}}return{sourceCRS:n,needsReprojection:n!==null&&n!=="EPSG:4326"}}function G(e){if(!e)return null;switch(e.type){case"Point":return e.coordinates;case"MultiPoint":case"LineString":return e.coordinates[0];case"MultiLineString":case"Polygon":return e.coordinates[0]?.[0];case"MultiPolygon":return e.coordinates[0]?.[0]?.[0];default:return null}}function I(e){return e.geometry?.type==="LineString"?e.geometry.coordinates.some(n=>n.length>=3&&n[2]!==0):e.geometry?.type==="MultiLineString"?e.geometry.coordinates.some(n=>n.some(r=>r.length>=3&&r[2]!==0)):!1}function c(e){if(!e)return null;if(e instanceof Date)return e;if(typeof e=="string"||typeof e=="number"){let t=new Date(e);return isNaN(t.getTime())?null:t}return null}function h(e){return!!(e.startDate||e.startdate||e.start_date||e.start_time||e.date||e.timestamp||e.flightDate||e.time||e.datetime||e.endDate||e.enddate||e.end_date||e.end_time)}function F(e){let t=c(e.startDate)||c(e.startdate)||c(e.start_date)||c(e.start_time)||c(e.date)||c(e.timestamp)||c(e.flightDate)||c(e.time)||c(e.datetime),n=c(e.endDate)||c(e.enddate)||c(e.end_date)||c(e.end_time);return t&&n&&n<t&&([t,n]=[n,t]),{startDate:t,endDate:n}}function C(e){return"kind"in e&&e.kind==="ack"}function T(){let e=globalThis.crypto?.randomUUID?.bind(globalThis.crypto);return e?e():`f-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function _(e,t,n){switch(n.idStrategy){case"preserve":return e.id;case"layer-index":return e.id!==void 0&&e.id!==null?String(e.id):`${n.layerId}-f${t}`;case"uuid-fallback":return e.id?String(e.id):T()}}function x(e,t){if(Array.isArray(e)){if(typeof e[0]=="number"){let n=e[0],r=e[1];t[0]=Math.min(t[0],n),t[1]=Math.min(t[1],r),t[2]=Math.max(t[2],n),t[3]=Math.max(t[3],r);return}for(let n of e)x(n,t)}}function R(e,t){if(e){if(e.type==="GeometryCollection"){for(let n of e.geometries)R(n,t);return}x(e.coordinates,t)}}function D(e){let t=[1/0,1/0,-1/0,-1/0];for(let n of e)R(n.geometry,t);return t.every(n=>isFinite(n))?t:null}function O(e,t){let n;if(e.type==="text")try{n=JSON.parse(e.text)}catch(d){return{kind:"error",code:"parse-error",message:d instanceof Error?d.message:"Invalid file"}}else n=e.data;if(n&&n.type==="Feature"&&(n={type:"FeatureCollection",features:[n]}),!n||n.type!=="FeatureCollection"||!Array.isArray(n.features))return{kind:"error",code:"invalid-format",message:"Invalid GeoJSON format"};if(t.emptyIsError&&n.features.length===0)return{kind:"error",code:"empty",message:"The file contains no features"};if(n["octostar:map"])return{kind:"enriched",data:n};let{sourceCRS:r,needsReprojection:s}=S(n),a=b(n.features,{max:t.maxFeatures??1/0}),o=!1,u=!1,i=[];a.features.forEach((d,w)=>{let f=_(d,w,t);!u&&I(d)&&(u=!0);let g=d.properties||{};if(!h(g)){i.push(t.idStrategy==="preserve"?d:{...d,id:f});return}let{startDate:y,endDate:k}=F(g);(y||k)&&(o=!0),i.push({...d,...f!==void 0&&{id:f},properties:{...g,startDate:y?.toISOString()||null,endDate:k?.toISOString()||null}})});let m=n.properties?.layerMetadata;return{kind:"features",features:i,featureCount:i.length,bbox:D(i),hasTemporal:o,hasAltitude:u,reprojected:!1,sourceCRS:r,...s&&{needsReprojection:s},...m&&{layerMetadata:m},...a.dropped>0&&{truncated:{droppedCount:a.dropped,sourceFeatureCount:a.sourceCount,maxFeatures:t.maxFeatures}}}}var N=5e3;function M(e,t){let n=Number.isNaN(t)?N:Math.max(1,Math.floor(t)),r=[];for(let s=0;s<e.length;s+=n)r.push(e.slice(s,s+n));return r}function p(e){if(e===void 0)return!1;if(typeof e=="number")return Number.isFinite(e)&&!Object.is(e,-0);if(e===null||typeof e!="object")return!0;if(Array.isArray(e)){for(let t=0;t<e.length;t++)if(!p(e[t]))return!1;return!0}for(let t in e)if(!p(e[t]))return!1;return!0}function P(e){for(let t=0;t<e.length;t++)if(!p(e[t]))return e;try{return JSON.stringify(e)}catch{return e}}function J(e){let{kind:t,features:n,...r}=e;return r}async function A(e,t,n,r){let s;try{s=O(t,n)}catch(a){r.post({kind:"result",id:e,ok:!1,error:a instanceof Error?a.message:String(a)});return}if(s.kind!=="features"){r.post({kind:"result",id:e,ok:!0,result:s});return}try{let a=r.encode??P,o=M(s.features,r.chunkSize??N);r.post({kind:"head",id:e,summary:J(s)});let u=o.length>0?a(o[0]):null;for(let i=0;i<o.length;i++){let m=r.waitAck(i);r.post({kind:"chunk",id:e,seq:i,payload:u}),u=i+1<o.length?a(o[i+1]):null,await m}r.post({kind:"done",id:e,chunkCount:o.length})}catch(a){r.post({kind:"error",id:e,message:a instanceof Error?a.message:String(a)})}}var E=e=>self.postMessage(e),l=new Map;self.onmessage=async e=>{let t=e.data;if(C(t)){let o=`${t.id}:${t.seq}`,u=l.get(o);l.delete(o),u?.();return}let{id:n,source:r,options:s,tuning:a}=t;try{let o=r.type==="blob"?{type:"text",text:await r.blob.text()}:r;await A(n,o,s,{post:E,waitAck:u=>new Promise(i=>{l.set(`${n}:${u}`,i)}),...a?.chunkSize!==void 0&&{chunkSize:a.chunkSize},...a?.featureArrayChunks&&{encode:u=>u}})}catch(o){E({kind:"result",id:n,ok:!1,error:o instanceof Error?o.message:String(o)})}finally{l.forEach((o,u)=>{u.startsWith(`${n}:`)&&l.delete(u)})}};})();\n';
100
147
  proj4.defs("EPSG:27700", "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs");
101
148
  proj4.defs("EPSG:3857", "+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs");
102
149
  proj4.defs("EPSG:32630", "+proj=utm +zone=30 +datum=WGS84 +units=m +no_defs");
@@ -137,6 +184,55 @@ function reprojectGeometry(geometry, fromCRS) {
137
184
  coordinates: reprojectCoords(geomWithCoords.coordinates)
138
185
  };
139
186
  }
187
+ const DEFAULT_MAX_FEATURES_PER_LAYER = 2e5;
188
+ function resolveFeatureCap(value) {
189
+ if (value === void 0) return DEFAULT_MAX_FEATURES_PER_LAYER;
190
+ if (value === Infinity) return Infinity;
191
+ if (!Number.isFinite(value) || value < 1) {
192
+ console.warn(
193
+ `[map-editor] Ignoring maxFeaturesPerLayer=${String(value)} — expected a number >= 1 or Infinity. Falling back to ${DEFAULT_MAX_FEATURES_PER_LAYER}.`
194
+ );
195
+ return DEFAULT_MAX_FEATURES_PER_LAYER;
196
+ }
197
+ return Math.floor(value);
198
+ }
199
+ function capFeatures(features, options) {
200
+ const sourceCount = features.length;
201
+ const room = Math.max(0, options.max - (options.existing ?? 0));
202
+ if (sourceCount <= room) {
203
+ return { features, dropped: 0, sourceCount };
204
+ }
205
+ return {
206
+ features: features.slice(0, room),
207
+ dropped: sourceCount - room,
208
+ sourceCount
209
+ };
210
+ }
211
+ function formatCount(value) {
212
+ return value.toLocaleString("en-US");
213
+ }
214
+ function formatFeatureCapToast(info) {
215
+ const isRestore = info.source === "restore";
216
+ const variant = isRestore ? "destructive" : "default";
217
+ const withNote = (text) => isRestore ? `${text} Re-saving this map will persist only the loaded features.` : text;
218
+ const layerCount = info.layerCount ?? 1;
219
+ if (layerCount > 1) {
220
+ return {
221
+ title: "Feature limit reached",
222
+ description: withNote(
223
+ `${formatCount(layerCount)} layers were larger than the ${formatCount(info.max)}-feature limit; ${formatCount(info.dropped)} features in total were not loaded.`
224
+ ),
225
+ variant
226
+ };
227
+ }
228
+ return {
229
+ title: "Feature limit reached",
230
+ description: withNote(
231
+ `Only the first ${formatCount(info.kept)} of ${formatCount(info.sourceCount)} features were added to "${info.layerName}"; ${formatCount(info.dropped)} were skipped (per-layer limit).`
232
+ ),
233
+ variant
234
+ };
235
+ }
140
236
  function parseDate(value) {
141
237
  if (!value) return null;
142
238
  if (value instanceof Date) return value;
@@ -230,10 +326,11 @@ function runIngestPipeline(source, options) {
230
326
  return { kind: "enriched", data };
231
327
  }
232
328
  const { sourceCRS, needsReprojection } = detectSourceCRS(data);
329
+ const capped = capFeatures(data.features, { max: options.maxFeatures ?? Infinity });
233
330
  let hasTemporal = false;
234
331
  let hasAltitude = false;
235
332
  const features = [];
236
- data.features.forEach((f, index) => {
333
+ capped.features.forEach((f, index) => {
237
334
  const id = assignId(f, index, options);
238
335
  if (!hasAltitude && hasAltitudeData(f)) hasAltitude = true;
239
336
  const props = f.properties || {};
@@ -268,7 +365,14 @@ function runIngestPipeline(source, options) {
268
365
  reprojected: false,
269
366
  sourceCRS,
270
367
  ...needsReprojection && { needsReprojection },
271
- ...layerMetadata && { layerMetadata }
368
+ ...layerMetadata && { layerMetadata },
369
+ ...capped.dropped > 0 && {
370
+ truncated: {
371
+ droppedCount: capped.dropped,
372
+ sourceFeatureCount: capped.sourceCount,
373
+ maxFeatures: options.maxFeatures
374
+ }
375
+ }
272
376
  };
273
377
  }
274
378
  function decodeChunkPayload(payload) {
@@ -588,9 +692,9 @@ function createIngestProgressStore() {
588
692
  listeners.forEach((listener) => listener());
589
693
  };
590
694
  return {
591
- begin(label) {
695
+ begin(label, options) {
592
696
  const id = nextId++;
593
- entries.set(id, { label, received: 0, total: null });
697
+ entries.set(id, { label, received: 0, total: null, ...(options == null ? void 0 : options.verb) && { verb: options.verb } });
594
698
  notify();
595
699
  return {
596
700
  setTotal(total) {
@@ -686,7 +790,8 @@ function IngestProgressOverlay({
686
790
  className: "rounded-md border bg-background/90 px-3 py-1.5 text-xs text-muted-foreground shadow-md",
687
791
  children: [
688
792
  /* @__PURE__ */ jsxs("span", { children: [
689
- "Importing ",
793
+ entry.verb ?? "Importing",
794
+ " ",
690
795
  entry.label,
691
796
  "…",
692
797
  entry.total !== null ? ` ${entry.received.toLocaleString()} / ${entry.total.toLocaleString()} features` : ""
@@ -1085,15 +1190,28 @@ function collectLayerFeatures(layer, sources) {
1085
1190
  if (readOnly) pushAll(features, readOnly);
1086
1191
  return features;
1087
1192
  }
1088
- function stripInternalProperties(features, keep) {
1089
- return features.map((f) => ({
1090
- ...f,
1193
+ function countLayerFeatures(layer, stores) {
1194
+ var _a;
1195
+ if (layer.readOnly) return ((_a = stores.readOnlyFeatures.get(layer.id)) == null ? void 0 : _a.length) ?? 0;
1196
+ const hidden = stores.hiddenFeatures.get(layer.id);
1197
+ if (!hidden || hidden.length === 0) return layer.featureIds.length;
1198
+ if (layer.featureIds.length === 0) return hidden.length;
1199
+ const ids = new Set(layer.featureIds);
1200
+ let count = layer.featureIds.length;
1201
+ for (const feature of hidden) {
1202
+ if (!ids.has(String(feature.id))) count++;
1203
+ }
1204
+ return count;
1205
+ }
1206
+ function stripInternalPropertiesFromFeature(feature, keep) {
1207
+ return {
1208
+ ...feature,
1091
1209
  properties: Object.fromEntries(
1092
- Object.entries(f.properties ?? {}).filter(
1210
+ Object.entries(feature.properties ?? {}).filter(
1093
1211
  ([key]) => !key.startsWith("_") || ((keep == null ? void 0 : keep.has(key)) ?? false)
1094
1212
  )
1095
1213
  )
1096
- }));
1214
+ };
1097
1215
  }
1098
1216
  const ToastContext = createContext(null);
1099
1217
  function useToast() {
@@ -2227,6 +2345,32 @@ function DrawingToolbar({
2227
2345
  }
2228
2346
  );
2229
2347
  }
2348
+ const BUILT_IN_BASEMAP_IDS = ["streets", "satellite", "dark"];
2349
+ const BUILT_IN_NAMES = {
2350
+ streets: "Streets",
2351
+ satellite: "Satellite",
2352
+ dark: "Dark"
2353
+ };
2354
+ function resolveBasemapChoices(order, customBasemaps) {
2355
+ const describe = (id) => {
2356
+ if (BUILT_IN_BASEMAP_IDS.includes(id)) {
2357
+ return { id, name: BUILT_IN_NAMES[id] ?? id, builtIn: true };
2358
+ }
2359
+ const custom = customBasemaps == null ? void 0 : customBasemaps[id];
2360
+ if (!custom) return void 0;
2361
+ return { id, name: custom.name || id, builtIn: false };
2362
+ };
2363
+ if (order) {
2364
+ return order.map(describe).filter((choice) => !!choice);
2365
+ }
2366
+ const customIds = Object.keys(customBasemaps ?? {}).filter(
2367
+ (id) => !BUILT_IN_BASEMAP_IDS.includes(id)
2368
+ );
2369
+ return [
2370
+ ...BUILT_IN_BASEMAP_IDS.map((id) => describe(id)),
2371
+ ...customIds.map(describe).filter((choice) => !!choice)
2372
+ ];
2373
+ }
2230
2374
  const PRESET_COLORS$1 = [
2231
2375
  "#3b82f6",
2232
2376
  "#ef4444",
@@ -2577,6 +2721,7 @@ function LayersPanel({
2577
2721
  is3DTerrainEnabled = false,
2578
2722
  onToggle3DTerrain,
2579
2723
  onUpdateAltitudeDisplayMode,
2724
+ availableBasemaps,
2580
2725
  hideSatellite = false,
2581
2726
  hideDark = false,
2582
2727
  hideTerrain = false,
@@ -3583,7 +3728,7 @@ function LayersPanel({
3583
3728
  )
3584
3729
  ] }),
3585
3730
  !hideBasemapSwitcher && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
3586
- /* @__PURE__ */ jsx("div", { className: "flex gap-1 flex-1", children: MAP_STYLES.filter((style) => {
3731
+ /* @__PURE__ */ jsx("div", { className: "flex gap-1 flex-1", children: (availableBasemaps ?? MAP_STYLES).filter((style) => {
3587
3732
  if (hideSatellite && style.id === "satellite") return false;
3588
3733
  if (hideDark && style.id === "dark") return false;
3589
3734
  return true;
@@ -6540,9 +6685,11 @@ function geometryEquals(a, b) {
6540
6685
  b.coordinates
6541
6686
  );
6542
6687
  }
6543
- function prepareFeaturesForLayer(input, caller) {
6688
+ function prepareFeaturesForLayer(input, caller, cap) {
6544
6689
  const logging = mapPerfLogEnabled();
6545
6690
  const started = logging ? performance.now() : 0;
6691
+ const capped = cap ? capFeatures(input, cap) : null;
6692
+ if (capped) input = capped.features;
6546
6693
  const count = input.length;
6547
6694
  const features = new Array(count);
6548
6695
  const featureIds = new Array(count);
@@ -6585,10 +6732,17 @@ function prepareFeaturesForLayer(input, caller) {
6585
6732
  withTemporalKeys: temporalCount,
6586
6733
  hasTemporal,
6587
6734
  reused,
6588
- copied: count - reused
6735
+ copied: count - reused,
6736
+ ...capped && capped.dropped > 0 && { dropped: capped.dropped }
6589
6737
  });
6590
6738
  }
6591
- return { features, featureIds, hasTemporal };
6739
+ return {
6740
+ features,
6741
+ featureIds,
6742
+ hasTemporal,
6743
+ dropped: (capped == null ? void 0 : capped.dropped) ?? 0,
6744
+ sourceCount: (capped == null ? void 0 : capped.sourceCount) ?? count
6745
+ };
6592
6746
  }
6593
6747
  function scanTemporalFeatures(features, resolveLayerId, out) {
6594
6748
  let foundTemporal = false;
@@ -7519,7 +7673,13 @@ function extract3DFlightPaths(features) {
7519
7673
  });
7520
7674
  return paths;
7521
7675
  }
7676
+ const CAP_NOTICE_INTERVAL_MS = 5e3;
7522
7677
  const DEFAULT_LOCAL_GLYPHS_URL = "/fonts/{fontstack}/{range}.pbf";
7678
+ function basemapInsertAnchor(map) {
7679
+ if (map.getLayer("satellite-layer")) return "satellite-layer";
7680
+ if (map.getLayer("custom-polygon-fill")) return "custom-polygon-fill";
7681
+ return void 0;
7682
+ }
7523
7683
  function createBaseStyle(options) {
7524
7684
  const sources = {};
7525
7685
  const layers = [
@@ -7637,6 +7797,8 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
7637
7797
  enableProperties = true,
7638
7798
  autoOpenProperties = true,
7639
7799
  toastProvider,
7800
+ maxFeaturesPerLayer,
7801
+ onFeaturesTruncated,
7640
7802
  customGlobalMenuItems,
7641
7803
  extraLayerToolbarButtons,
7642
7804
  extraNewLayerButtons,
@@ -7666,6 +7828,17 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
7666
7828
  const timelineUpdateTimerRef = useRef(null);
7667
7829
  const loadedBasemaps = useRef(new Set(enableSatellite ? ["satellite"] : []));
7668
7830
  const basemapLayerIds = useRef(new Map(enableSatellite ? [["satellite", ["satellite-layer"]]] : []));
7831
+ const availableBasemaps = useMemo(() => {
7832
+ const iconFor = (id) => {
7833
+ var _a;
7834
+ return ((_a = MAP_STYLES.find((style) => style.id === id)) == null ? void 0 : _a.icon) ?? Map$1;
7835
+ };
7836
+ return resolveBasemapChoices(basemapOrder, customBasemaps).map((choice) => ({
7837
+ id: choice.id,
7838
+ name: choice.name,
7839
+ icon: iconFor(choice.id)
7840
+ }));
7841
+ }, [basemapOrder, customBasemaps]);
7669
7842
  const loadingBasemaps = useRef(/* @__PURE__ */ new Set());
7670
7843
  const customBasemapRegistry = useRef(/* @__PURE__ */ new Map());
7671
7844
  const clusterPieManagers = useRef(/* @__PURE__ */ new Map());
@@ -7733,6 +7906,31 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
7733
7906
  const timelineStore = useStore(timelineStoreApi);
7734
7907
  const { toast: internalToast } = useToast();
7735
7908
  const toast = toastProvider ?? internalToast;
7909
+ const featureCap = useMemo(() => resolveFeatureCap(maxFeaturesPerLayer), [maxFeaturesPerLayer]);
7910
+ const featureCapRef = useRef(featureCap);
7911
+ featureCapRef.current = featureCap;
7912
+ const capNoticeRef = useRef(/* @__PURE__ */ new Map());
7913
+ const notifyFeatureCap = useCallback((info) => {
7914
+ if (onFeaturesTruncated) {
7915
+ onFeaturesTruncated(info);
7916
+ return;
7917
+ }
7918
+ if (info.source !== "restore") {
7919
+ const key = info.layerId ?? info.layerName;
7920
+ const now = Date.now();
7921
+ const last = capNoticeRef.current.get(key);
7922
+ if (last != null && now - last < CAP_NOTICE_INTERVAL_MS) return;
7923
+ capNoticeRef.current.set(key, now);
7924
+ }
7925
+ toast(formatFeatureCapToast(info));
7926
+ }, [onFeaturesTruncated, toast]);
7927
+ const countExisting = useCallback(
7928
+ (layer) => countLayerFeatures(layer, {
7929
+ hiddenFeatures: hiddenFeatures.current,
7930
+ readOnlyFeatures: readOnlyFeatures.current
7931
+ }),
7932
+ []
7933
+ );
7736
7934
  useEffect(() => {
7737
7935
  const handleError = (event) => {
7738
7936
  const msg = event.message || "";
@@ -9775,7 +9973,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
9775
9973
  newLayer.source = `${prefix}${newLayer.source}`;
9776
9974
  }
9777
9975
  try {
9778
- const beforeLayer = mapInstance.getLayer("satellite-layer") ? "satellite-layer" : mapInstance.getLayer("custom-polygon-fill") ? "custom-polygon-fill" : void 0;
9976
+ const beforeLayer = basemapInsertAnchor(mapInstance);
9779
9977
  mapInstance.addLayer(newLayer, beforeLayer);
9780
9978
  addedLayerIds.push(prefixedLayerId);
9781
9979
  } catch (e) {
@@ -9804,7 +10002,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
9804
10002
  console.error("Failed to load initial basemap:", err);
9805
10003
  });
9806
10004
  }
9807
- } else {
10005
+ } else if (mapInstance.getLayer("satellite-layer")) {
9808
10006
  mapInstance.setLayoutProperty("satellite-layer", "visibility", "visible");
9809
10007
  }
9810
10008
  if (customBasemaps) {
@@ -9828,12 +10026,12 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
9828
10026
  type: "raster",
9829
10027
  source: sourceId,
9830
10028
  layout: { visibility: isInitialStyle ? "visible" : "none" }
9831
- }, "satellite-layer");
10029
+ }, basemapInsertAnchor(mapInstance));
9832
10030
  loadedBasemaps.current.add(id);
9833
10031
  basemapLayerIds.current.set(id, [layerId]);
9834
10032
  }
9835
10033
  } else if (definition.type === "vector" && definition.style) {
9836
- loadedBasemaps.current.add(id);
10034
+ if (baseMapStyle === id) loadedBasemaps.current.add(id);
9837
10035
  }
9838
10036
  }
9839
10037
  }
@@ -10420,16 +10618,22 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
10420
10618
  clusterConfig: options == null ? void 0 : options.clusterConfig,
10421
10619
  altitudeDisplayMode: options == null ? void 0 : options.altitudeDisplayMode
10422
10620
  };
10621
+ let addedFeatures = (geojson == null ? void 0 : geojson.features) ?? [];
10622
+ let capDropped = 0;
10423
10623
  if (geojson) {
10624
+ const max = featureCapRef.current;
10424
10625
  if (options == null ? void 0 : options.readOnly) {
10425
- const prepared = prepareFeaturesForLayer(geojson.features, "addLayer");
10626
+ const prepared = prepareFeaturesForLayer(geojson.features, "addLayer", { max });
10426
10627
  readOnlyFeatures.current.set(layerId, prepared.features);
10427
10628
  layerTemporalCacheRef.current.set(layerId, { featureCount: prepared.features.length, hasTemporal: prepared.hasTemporal });
10428
10629
  newLayer.featureIds = prepared.featureIds;
10630
+ addedFeatures = prepared.features;
10631
+ capDropped = prepared.dropped;
10429
10632
  } else if (draw.current) {
10633
+ const capped = capFeatures(geojson.features, { max });
10430
10634
  isApiAddingRef.current = true;
10431
10635
  try {
10432
- const addedIds = geojson.features.map((f) => {
10636
+ const addedIds = capped.features.map((f) => {
10433
10637
  const ids = draw.current.add(f);
10434
10638
  return ids[0];
10435
10639
  });
@@ -10437,8 +10641,21 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
10437
10641
  } finally {
10438
10642
  isApiAddingRef.current = false;
10439
10643
  }
10644
+ addedFeatures = capped.features;
10645
+ capDropped = capped.dropped;
10440
10646
  }
10441
10647
  }
10648
+ if (capDropped > 0) {
10649
+ notifyFeatureCap({
10650
+ layerId,
10651
+ layerName: name,
10652
+ kept: addedFeatures.length,
10653
+ dropped: capDropped,
10654
+ sourceCount: (geojson == null ? void 0 : geojson.features.length) ?? 0,
10655
+ max: featureCapRef.current,
10656
+ source: "api"
10657
+ });
10658
+ }
10442
10659
  if (newLayer.visible === false && !(options == null ? void 0 : options.readOnly) && draw.current && newLayer.featureIds.length > 0) {
10443
10660
  const features = newLayer.featureIds.map((id) => draw.current.get(id)).filter(Boolean);
10444
10661
  hiddenFeatures.current.set(layerId, features);
@@ -10456,9 +10673,11 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
10456
10673
  updateFeatureCount();
10457
10674
  scheduleTimelineUpdate();
10458
10675
  scheduleSync();
10459
- if (!(options == null ? void 0 : options.skipFit) && geojson && geojson.features.length > 0 && map.current) {
10676
+ if (!(options == null ? void 0 : options.skipFit) && addedFeatures.length > 0 && map.current) {
10460
10677
  try {
10461
- const bbox = turf.bbox(geojson);
10678
+ const bbox = turf.bbox(
10679
+ capDropped > 0 ? { type: "FeatureCollection", features: addedFeatures } : geojson
10680
+ );
10462
10681
  if (bbox.every((v) => isFinite(v))) {
10463
10682
  map.current.fitBounds(
10464
10683
  [[bbox[0], bbox[1]], [bbox[2], bbox[3]]],
@@ -10551,7 +10770,21 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
10551
10770
  if (options == null ? void 0 : options.recordHistory) saveStateForUndo("add features");
10552
10771
  if (layer.readOnly) {
10553
10772
  const existing = readOnlyFeatures.current.get(layerId) || [];
10554
- const prepared = prepareFeaturesForLayer(features, "addFeatures");
10773
+ const prepared = prepareFeaturesForLayer(features, "addFeatures", {
10774
+ max: featureCapRef.current,
10775
+ existing: existing.length
10776
+ });
10777
+ if (prepared.dropped > 0) {
10778
+ notifyFeatureCap({
10779
+ layerId,
10780
+ layerName: layer.name,
10781
+ kept: prepared.features.length,
10782
+ dropped: prepared.dropped,
10783
+ sourceCount: prepared.sourceCount,
10784
+ max: featureCapRef.current,
10785
+ source: "api"
10786
+ });
10787
+ }
10555
10788
  const layerHasTemporal = (((_a = layerTemporalCacheRef.current.get(layerId)) == null ? void 0 : _a.hasTemporal) ?? false) || prepared.hasTemporal;
10556
10789
  const combined = [...existing, ...prepared.features];
10557
10790
  readOnlyFeatures.current.set(layerId, combined);
@@ -10571,9 +10804,24 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
10571
10804
  }
10572
10805
  if (!draw.current) return [];
10573
10806
  const addedIds = [];
10807
+ const cappedForDraw = capFeatures(features, {
10808
+ max: featureCapRef.current,
10809
+ existing: countExisting(layer)
10810
+ });
10811
+ if (cappedForDraw.dropped > 0) {
10812
+ notifyFeatureCap({
10813
+ layerId,
10814
+ layerName: layer.name,
10815
+ kept: cappedForDraw.features.length,
10816
+ dropped: cappedForDraw.dropped,
10817
+ sourceCount: cappedForDraw.sourceCount,
10818
+ max: featureCapRef.current,
10819
+ source: "api"
10820
+ });
10821
+ }
10574
10822
  isApiAddingRef.current = true;
10575
10823
  try {
10576
- features.forEach((f) => {
10824
+ cappedForDraw.features.forEach((f) => {
10577
10825
  const { startDate, endDate } = normalizeTemporalProperties(f.properties || {});
10578
10826
  const normalizedFeature = {
10579
10827
  ...f,
@@ -10682,12 +10930,27 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
10682
10930
  return { type: "FeatureCollection", features: cleanedFeatures };
10683
10931
  },
10684
10932
  importGeoJSON: (layerId, geojson) => {
10685
- const layer = layers.find((l) => l.id === layerId);
10933
+ const layer = layersRef.current.find((l) => l.id === layerId);
10686
10934
  if (!layer || !draw.current || !isMapLoaded) return [];
10687
10935
  const addedIds = [];
10936
+ const capped = capFeatures(geojson.features, {
10937
+ max: featureCapRef.current,
10938
+ existing: countExisting(layer)
10939
+ });
10940
+ if (capped.dropped > 0) {
10941
+ notifyFeatureCap({
10942
+ layerId,
10943
+ layerName: layer.name,
10944
+ kept: capped.features.length,
10945
+ dropped: capped.dropped,
10946
+ sourceCount: capped.sourceCount,
10947
+ max: featureCapRef.current,
10948
+ source: "api"
10949
+ });
10950
+ }
10688
10951
  isApiAddingRef.current = true;
10689
10952
  try {
10690
- geojson.features.forEach((f) => {
10953
+ capped.features.forEach((f) => {
10691
10954
  const { startDate, endDate } = normalizeTemporalProperties(f.properties || {});
10692
10955
  const normalizedFeature = {
10693
10956
  ...f,
@@ -10743,7 +11006,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
10743
11006
  type: "raster",
10744
11007
  source: sourceId,
10745
11008
  layout: { visibility: "none" }
10746
- }, "satellite-layer");
11009
+ }, basemapInsertAnchor(map.current));
10747
11010
  loadedBasemaps.current.add(id);
10748
11011
  basemapLayerIds.current.set(id, [layerId]);
10749
11012
  }
@@ -10791,9 +11054,20 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
10791
11054
  updateReadOnlyLayer: (layerId, features) => {
10792
11055
  const layer = layersRef.current.find((l) => l.id === layerId);
10793
11056
  if (!layer || !layer.readOnly || !isMapLoadedRef.current) return false;
10794
- const prepared = prepareFeaturesForLayer(features, "updateReadOnlyLayer");
11057
+ const prepared = prepareFeaturesForLayer(features, "updateReadOnlyLayer", { max: featureCapRef.current });
11058
+ if (prepared.dropped > 0) {
11059
+ notifyFeatureCap({
11060
+ layerId,
11061
+ layerName: layer.name,
11062
+ kept: prepared.features.length,
11063
+ dropped: prepared.dropped,
11064
+ sourceCount: prepared.sourceCount,
11065
+ max: featureCapRef.current,
11066
+ source: "api"
11067
+ });
11068
+ }
10795
11069
  readOnlyFeatures.current.set(layerId, prepared.features);
10796
- layerTemporalCacheRef.current.set(layerId, { featureCount: features.length, hasTemporal: prepared.hasTemporal });
11070
+ layerTemporalCacheRef.current.set(layerId, { featureCount: prepared.features.length, hasTemporal: prepared.hasTemporal });
10797
11071
  if (prepared.hasTemporal) {
10798
11072
  scheduleTimelineUpdate();
10799
11073
  }
@@ -10809,9 +11083,20 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
10809
11083
  },
10810
11084
  setLayerData: (name, geojson, options) => {
10811
11085
  if (!isMapLoadedRef.current) return "";
10812
- const prepared = prepareFeaturesForLayer(geojson.features, "setLayerData");
11086
+ const prepared = prepareFeaturesForLayer(geojson.features, "setLayerData", { max: featureCapRef.current });
10813
11087
  const newFeatureIds = prepared.featureIds;
10814
11088
  const layerId = `managed-${name}`;
11089
+ if (prepared.dropped > 0) {
11090
+ notifyFeatureCap({
11091
+ layerId,
11092
+ layerName: name,
11093
+ kept: prepared.features.length,
11094
+ dropped: prepared.dropped,
11095
+ sourceCount: prepared.sourceCount,
11096
+ max: featureCapRef.current,
11097
+ source: "api"
11098
+ });
11099
+ }
10815
11100
  readOnlyFeatures.current.set(layerId, prepared.features);
10816
11101
  layerTemporalCacheRef.current.set(layerId, { featureCount: prepared.features.length, hasTemporal: prepared.hasTemporal });
10817
11102
  const buildLayerObj = (existing) => {
@@ -10861,9 +11146,11 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
10861
11146
  });
10862
11147
  updateFeatureCount();
10863
11148
  scheduleSync();
10864
- if ((options == null ? void 0 : options.fitPadding) != null && geojson.features.length > 0 && map.current) {
11149
+ if ((options == null ? void 0 : options.fitPadding) != null && prepared.features.length > 0 && map.current) {
10865
11150
  try {
10866
- const bbox = turf.bbox(geojson);
11151
+ const bbox = turf.bbox(
11152
+ prepared.dropped > 0 ? { type: "FeatureCollection", features: prepared.features } : geojson
11153
+ );
10867
11154
  if (bbox.every((v) => isFinite(v))) {
10868
11155
  map.current.fitBounds(
10869
11156
  [[bbox[0], bbox[1]], [bbox[2], bbox[3]]],
@@ -11880,11 +12167,11 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
11880
12167
  }
11881
12168
  }, []);
11882
12169
  moveLabelsBeforeBasemapSymbolsRef.current = moveLabelsBeforeBasemapSymbols;
11883
- const loadBasemapStyle = useCallback(async (styleName) => {
12170
+ const loadBasemapStyle = useCallback(async (styleName, overrideStyleUrl) => {
11884
12171
  if (!map.current) return [];
11885
12172
  const mapInstance = map.current;
11886
12173
  const prefix = BASEMAP_LAYER_PREFIXES[styleName] || `${styleName}-`;
11887
- const styleUrl = EXTERNAL_STYLE_URLS[styleName];
12174
+ const styleUrl = overrideStyleUrl || EXTERNAL_STYLE_URLS[styleName];
11888
12175
  if (!styleUrl) {
11889
12176
  console.warn(`No external style URL for: ${styleName}`);
11890
12177
  return [];
@@ -11934,7 +12221,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
11934
12221
  newLayer.source = `${prefix}${newLayer.source}`;
11935
12222
  }
11936
12223
  try {
11937
- const beforeLayer = mapInstance.getLayer("satellite-layer") ? "satellite-layer" : mapInstance.getLayer("custom-polygon-fill") ? "custom-polygon-fill" : void 0;
12224
+ const beforeLayer = basemapInsertAnchor(mapInstance);
11938
12225
  mapInstance.addLayer(newLayer, beforeLayer);
11939
12226
  addedLayerIds.push(prefixedLayerId);
11940
12227
  } catch (e) {
@@ -11986,10 +12273,16 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
11986
12273
  type: "raster",
11987
12274
  source: sourceId,
11988
12275
  layout: { visibility: "none" }
11989
- }, "satellite-layer");
12276
+ }, basemapInsertAnchor(mapInstance));
11990
12277
  }
11991
12278
  loadedBasemaps.current.add(style);
11992
12279
  basemapLayerIds.current.set(style, [layerId]);
12280
+ } else if (customDef.type === "vector" && typeof customDef.style === "string") {
12281
+ loadingBasemaps.current.add(style);
12282
+ const layerIds = await loadBasemapStyle(style, customDef.style);
12283
+ basemapLayerIds.current.set(style, layerIds);
12284
+ loadedBasemaps.current.add(style);
12285
+ loadingBasemaps.current.delete(style);
11993
12286
  }
11994
12287
  }
11995
12288
  } else if (!loadedBasemaps.current.has(style) && !loadingBasemaps.current.has(style)) {
@@ -13172,9 +13465,11 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13172
13465
  source.setData({ type: "FeatureCollection", features });
13173
13466
  }
13174
13467
  }, [measurePoints, measureMode, isMapLoaded]);
13175
- const handleSaveLayerGeoJSON = useCallback((layerId) => {
13468
+ const [ingestProgressStore] = useState(createIngestProgressStore);
13469
+ const exportInFlightRef = useRef(false);
13470
+ const handleSaveLayerGeoJSON = useCallback(async (layerId) => {
13176
13471
  const layer = layers.find((l) => l.id === layerId);
13177
- if (!layer) return;
13472
+ if (!layer || exportInFlightRef.current) return;
13178
13473
  const features = collectLayerFeatures(layer, {
13179
13474
  getDrawFeature: (id) => {
13180
13475
  var _a;
@@ -13189,17 +13484,30 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13189
13484
  if (layer.traceConfig) layerMetadata.traceConfig = layer.traceConfig;
13190
13485
  if (layer.heatmapConfig) layerMetadata.heatmapConfig = layer.heatmapConfig;
13191
13486
  if (layer.visualConfig) layerMetadata.visualConfig = layer.visualConfig;
13192
- const cleanedFeatures = stripInternalProperties(features);
13193
13487
  const geojson = {
13194
13488
  type: "FeatureCollection",
13195
- features: cleanedFeatures,
13489
+ features,
13196
13490
  properties: {
13197
13491
  layerMetadata
13198
13492
  }
13199
13493
  };
13200
- const blob = new Blob(featureCollectionBlobParts(geojson), { type: "application/json" });
13201
- downloadBlob(blob, `${layer.name.replace(/[^a-z0-9]/gi, "_")}.geojson`);
13202
- }, [layers]);
13494
+ exportInFlightRef.current = true;
13495
+ const progress = ingestProgressStore.begin(layer.name, { verb: "Preparing download" });
13496
+ progress.setTotal(features.length);
13497
+ try {
13498
+ const parts = await featureCollectionBlobPartsAsync(geojson, {
13499
+ mapFeature: (f) => stripInternalPropertiesFromFeature(f),
13500
+ onProgress: (done) => progress.update(done)
13501
+ });
13502
+ downloadBlob(
13503
+ new Blob(parts, { type: "application/json" }),
13504
+ `${layer.name.replace(/[^a-z0-9]/gi, "_")}.geojson`
13505
+ );
13506
+ } finally {
13507
+ progress.end();
13508
+ exportInFlightRef.current = false;
13509
+ }
13510
+ }, [layers, ingestProgressStore]);
13203
13511
  const handleLoadLayerGeoJSON = useCallback((layerId) => {
13204
13512
  const input = fileInputRef.current;
13205
13513
  if (!input) return;
@@ -13214,7 +13522,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13214
13522
  input.dataset.createNewLayer = "true";
13215
13523
  input.click();
13216
13524
  }, []);
13217
- const buildEnrichedGeoJSON = useCallback(() => {
13525
+ const buildEnrichedExport = useCallback(() => {
13218
13526
  const allFeatures = [];
13219
13527
  const layerStates = [];
13220
13528
  layers.forEach((layer, idx) => {
@@ -13239,7 +13547,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13239
13547
  const { id: _id, featureIds: _fids, hasAltitudeData: _alt, ...persistable } = layer;
13240
13548
  layerStates.push({ index: idx, ...persistable });
13241
13549
  });
13242
- const cleanedFeatures = stripInternalProperties(allFeatures, ENRICHED_EXPORT_KEEP_KEYS);
13550
+ const rawCount = allFeatures.length;
13243
13551
  let viewport;
13244
13552
  if (map.current && isMapLoaded) {
13245
13553
  const c = map.current.getCenter();
@@ -13255,17 +13563,35 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13255
13563
  ...hostState
13256
13564
  };
13257
13565
  return {
13258
- type: "FeatureCollection",
13259
- features: [...cleanedFeatures, ...extraFeatures],
13260
- "octostar:map": octostarMap
13566
+ collection: {
13567
+ type: "FeatureCollection",
13568
+ features: [...allFeatures, ...extraFeatures],
13569
+ "octostar:map": octostarMap
13570
+ },
13571
+ mapFeature: (feature, index) => index < rawCount ? stripInternalPropertiesFromFeature(feature, ENRICHED_EXPORT_KEEP_KEYS) : feature
13261
13572
  };
13262
13573
  }, [layers, isMapLoaded, getAdditionalSaveState]);
13263
- const handleSaveAllGeoJSON = useCallback(() => {
13264
- if (!draw.current) return;
13265
- const geojson = buildEnrichedGeoJSON();
13266
- const blob = new Blob(featureCollectionBlobParts(geojson), { type: "application/geo+json" });
13267
- downloadBlob(blob, "map_export.geojson");
13268
- }, [buildEnrichedGeoJSON]);
13574
+ const buildEnrichedGeoJSON = useCallback(() => {
13575
+ const { collection, mapFeature } = buildEnrichedExport();
13576
+ return { ...collection, features: collection.features.map(mapFeature) };
13577
+ }, [buildEnrichedExport]);
13578
+ const handleSaveAllGeoJSON = useCallback(async () => {
13579
+ if (!draw.current || exportInFlightRef.current) return;
13580
+ const { collection, mapFeature } = buildEnrichedExport();
13581
+ exportInFlightRef.current = true;
13582
+ const progress = ingestProgressStore.begin("map_export.geojson", { verb: "Preparing download" });
13583
+ progress.setTotal(collection.features.length);
13584
+ try {
13585
+ const parts = await featureCollectionBlobPartsAsync(collection, {
13586
+ mapFeature,
13587
+ onProgress: (done) => progress.update(done)
13588
+ });
13589
+ downloadBlob(new Blob(parts, { type: "application/geo+json" }), "map_export.geojson");
13590
+ } finally {
13591
+ progress.end();
13592
+ exportInFlightRef.current = false;
13593
+ }
13594
+ }, [buildEnrichedExport, ingestProgressStore]);
13269
13595
  const handleSearchAndAddToNewLayer = useCallback(async () => {
13270
13596
  if (!onSearchEngineRequest || !map.current || !draw.current) return;
13271
13597
  const mapInstance = map.current;
@@ -13298,10 +13624,16 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13298
13624
  });
13299
13625
  if (result && result.features && result.features.length > 0) {
13300
13626
  saveStateForUndo();
13627
+ const activeId = activeEditingLayerIdRef.current;
13628
+ const activeLayer = activeId ? layersRef.current.find((l) => l.id === activeId && !l.readOnly) : null;
13629
+ const capped = capFeatures(result.features, {
13630
+ max: featureCapRef.current,
13631
+ existing: activeLayer ? countExisting(activeLayer) : 0
13632
+ });
13301
13633
  const addedIds = [];
13302
13634
  isApiAddingRef.current = true;
13303
13635
  try {
13304
- result.features.forEach((f) => {
13636
+ capped.features.forEach((f) => {
13305
13637
  const { startDate, endDate } = normalizeTemporalProperties(f.properties || {});
13306
13638
  const normalizedFeature = {
13307
13639
  ...f,
@@ -13317,17 +13649,19 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13317
13649
  } finally {
13318
13650
  isApiAddingRef.current = false;
13319
13651
  }
13320
- const activeId = activeEditingLayerIdRef.current;
13321
- const activeLayer = activeId ? layersRef.current.find((l) => l.id === activeId && !l.readOnly) : null;
13652
+ let targetLayerId;
13653
+ let targetLayerName;
13322
13654
  if (activeLayer) {
13323
13655
  activeLayer.featureIds = [...activeLayer.featureIds, ...addedIds];
13324
13656
  setLayers([...layersRef.current]);
13657
+ targetLayerId = activeLayer.id;
13658
+ targetLayerName = activeLayer.name;
13325
13659
  toast({
13326
13660
  title: "Features added",
13327
- description: `Added ${result.features.length} features to "${activeLayer.name}"`
13661
+ description: `Added ${addedIds.length} features to "${activeLayer.name}"`
13328
13662
  });
13329
13663
  } else {
13330
- const layerName = `${result.features.length} workspace features`;
13664
+ const layerName = `${addedIds.length} workspace features`;
13331
13665
  const newLayerId = `layer-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
13332
13666
  const newLayer = {
13333
13667
  id: newLayerId,
@@ -13338,9 +13672,22 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13338
13672
  layersRef.current = [...layersRef.current, newLayer];
13339
13673
  setLayers(layersRef.current);
13340
13674
  setActiveEditingLayerId(newLayerId);
13675
+ targetLayerId = newLayerId;
13676
+ targetLayerName = layerName;
13341
13677
  toast({
13342
13678
  title: "Layer created",
13343
- description: `Added ${result.features.length} features to "${layerName}"`
13679
+ description: `Added ${addedIds.length} features to "${layerName}"`
13680
+ });
13681
+ }
13682
+ if (capped.dropped > 0) {
13683
+ notifyFeatureCap({
13684
+ layerId: targetLayerId,
13685
+ layerName: targetLayerName,
13686
+ kept: addedIds.length,
13687
+ dropped: capped.dropped,
13688
+ sourceCount: capped.sourceCount,
13689
+ max: featureCapRef.current,
13690
+ source: "search"
13344
13691
  });
13345
13692
  }
13346
13693
  updateFeatureCount();
@@ -13354,7 +13701,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13354
13701
  variant: "destructive"
13355
13702
  });
13356
13703
  }
13357
- }, [onSearchEngineRequest, saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, scheduleSync, toast]);
13704
+ }, [onSearchEngineRequest, saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, scheduleSync, toast, notifyFeatureCap]);
13358
13705
  const restoreEnrichedGeoJSON = useCallback((enriched) => {
13359
13706
  var _a;
13360
13707
  const mapState = enriched["octostar:map"];
@@ -13377,9 +13724,22 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13377
13724
  });
13378
13725
  const sortedLayers = [...mapState.layers].sort((a, b) => a.index - b.index);
13379
13726
  const newLayers = [];
13727
+ let restoreDropped = 0;
13728
+ let restoreSourceCount = 0;
13729
+ let restoreKept = 0;
13730
+ let truncatedLayerCount = 0;
13731
+ let firstTruncatedLayer = "";
13380
13732
  for (const ls of sortedLayers) {
13381
13733
  if (((_a = ls.metadata) == null ? void 0 : _a.dataViewing) === true) continue;
13382
- const rawFeatures = featuresByIndex.get(ls.index) ?? [];
13734
+ const capped = capFeatures(featuresByIndex.get(ls.index) ?? [], { max: featureCapRef.current });
13735
+ const rawFeatures = capped.features;
13736
+ if (capped.dropped > 0) {
13737
+ restoreDropped += capped.dropped;
13738
+ restoreSourceCount += capped.sourceCount;
13739
+ restoreKept += rawFeatures.length;
13740
+ truncatedLayerCount += 1;
13741
+ if (!firstTruncatedLayer) firstTruncatedLayer = ls.name;
13742
+ }
13383
13743
  const normalized = rawFeatures.map((f) => {
13384
13744
  const cleanProps = Object.fromEntries(
13385
13745
  Object.entries(f.properties || {}).filter(([k]) => !k.startsWith("_"))
@@ -13441,7 +13801,18 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13441
13801
  title: "Map restored",
13442
13802
  description: `Restored ${newLayers.length} layers with ${totalFeatures} features`
13443
13803
  });
13444
- }, [saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, scheduleSync, onMapStateLoaded, toast]);
13804
+ if (restoreDropped > 0) {
13805
+ notifyFeatureCap({
13806
+ layerName: firstTruncatedLayer,
13807
+ kept: restoreKept,
13808
+ dropped: restoreDropped,
13809
+ sourceCount: restoreSourceCount,
13810
+ max: featureCapRef.current,
13811
+ source: "restore",
13812
+ layerCount: truncatedLayerCount
13813
+ });
13814
+ }
13815
+ }, [saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, scheduleSync, onMapStateLoaded, toast, notifyFeatureCap]);
13445
13816
  restoreEnrichedGeoJSONRef.current = restoreEnrichedGeoJSON;
13446
13817
  const handleWorkspaceLoad = useCallback(async () => {
13447
13818
  if (!onWorkspaceLoad) return;
@@ -13454,12 +13825,24 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13454
13825
  }
13455
13826
  saveStateForUndo();
13456
13827
  const layerId = `layer-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
13457
- const prepared = prepareFeaturesForLayer(result.features, "workspaceLoad");
13828
+ const layerName = "Loaded from workspace";
13829
+ const prepared = prepareFeaturesForLayer(result.features, "workspaceLoad", { max: featureCapRef.current });
13830
+ if (prepared.dropped > 0) {
13831
+ notifyFeatureCap({
13832
+ layerId,
13833
+ layerName,
13834
+ kept: prepared.features.length,
13835
+ dropped: prepared.dropped,
13836
+ sourceCount: prepared.sourceCount,
13837
+ max: featureCapRef.current,
13838
+ source: "workspace"
13839
+ });
13840
+ }
13458
13841
  readOnlyFeatures.current.set(layerId, prepared.features);
13459
13842
  layerTemporalCacheRef.current.set(layerId, { featureCount: prepared.features.length, hasTemporal: prepared.hasTemporal });
13460
13843
  const newLayer = {
13461
13844
  id: layerId,
13462
- name: "Loaded from workspace",
13845
+ name: layerName,
13463
13846
  visible: true,
13464
13847
  featureIds: prepared.featureIds,
13465
13848
  readOnly: true
@@ -13557,20 +13940,23 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13557
13940
  duration: 1e3
13558
13941
  });
13559
13942
  }, [layers, toast]);
13560
- const [ingestProgressStore] = useState(createIngestProgressStore);
13561
13943
  const ingestWithProgress = useCallback(async (label, input, options) => {
13562
13944
  const progress = ingestProgressStore.begin(label);
13563
13945
  try {
13564
- return await getSharedIngestClient().ingest(input, options, {
13565
- onHead: (summary) => progress.setTotal(summary.featureCount),
13566
- onProgress: (received) => progress.update(received)
13567
- });
13946
+ return await getSharedIngestClient().ingest(
13947
+ input,
13948
+ { ...options, maxFeatures: featureCapRef.current },
13949
+ {
13950
+ onHead: (summary) => progress.setTotal(summary.featureCount),
13951
+ onProgress: (received) => progress.update(received)
13952
+ }
13953
+ );
13568
13954
  } finally {
13569
13955
  progress.end();
13570
13956
  }
13571
13957
  }, [ingestProgressStore]);
13572
13958
  const loadGeoJSONFile = useCallback(async (file, requestedTargetLayerId, createNewLayer) => {
13573
- var _a;
13959
+ var _a, _b, _c;
13574
13960
  let result;
13575
13961
  try {
13576
13962
  result = await ingestWithProgress(file.name, file, {
@@ -13620,7 +14006,8 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13620
14006
  data: { type: "FeatureCollection", features: normalizedFeatures },
13621
14007
  file,
13622
14008
  reprojected,
13623
- sourceCRS: sourceCRS ?? void 0
14009
+ sourceCRS: sourceCRS ?? void 0,
14010
+ ...result.truncated && { truncated: result.truncated }
13624
14011
  }) === true) {
13625
14012
  return;
13626
14013
  }
@@ -13640,6 +14027,17 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13640
14027
  readOnlyFeatures.current.set(layerId, normalizedFeatures);
13641
14028
  layerTemporalCacheRef.current.set(layerId, { featureCount: normalizedFeatures.length, hasTemporal: fileHasTemporal });
13642
14029
  newLayer.featureIds = addedIds;
14030
+ if (result.truncated) {
14031
+ notifyFeatureCap({
14032
+ layerId,
14033
+ layerName: newLayer.name,
14034
+ kept: normalizedFeatures.length,
14035
+ dropped: result.truncated.droppedCount,
14036
+ sourceCount: result.truncated.sourceFeatureCount,
14037
+ max: result.truncated.maxFeatures,
14038
+ source: "file"
14039
+ });
14040
+ }
13643
14041
  setLayers((prev) => [...prev, newLayer]);
13644
14042
  updateFeatureCount();
13645
14043
  scheduleTimelineUpdate();
@@ -13683,6 +14081,23 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13683
14081
  return;
13684
14082
  }
13685
14083
  const targetId = targetLayer.id;
14084
+ const appendCapped = capFeatures(normalizedFeatures, {
14085
+ max: featureCapRef.current,
14086
+ existing: countExisting(targetLayer)
14087
+ });
14088
+ const appendFeatures = appendCapped.features;
14089
+ const totalDropped = (((_b = result.truncated) == null ? void 0 : _b.droppedCount) ?? 0) + appendCapped.dropped;
14090
+ if (totalDropped > 0) {
14091
+ notifyFeatureCap({
14092
+ layerId: targetId,
14093
+ layerName: targetLayer.name,
14094
+ kept: appendFeatures.length,
14095
+ dropped: totalDropped,
14096
+ sourceCount: ((_c = result.truncated) == null ? void 0 : _c.sourceFeatureCount) ?? appendCapped.sourceCount,
14097
+ max: featureCapRef.current,
14098
+ source: "file"
14099
+ });
14100
+ }
13686
14101
  const withLayerMetadata = (l, addedIds) => ({
13687
14102
  ...l,
13688
14103
  featureIds: [...l.featureIds, ...addedIds],
@@ -13691,7 +14106,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13691
14106
  ...(layerMetadata == null ? void 0 : layerMetadata.visualConfig) && { visualConfig: layerMetadata.visualConfig }
13692
14107
  });
13693
14108
  if (targetLayer.readOnly) {
13694
- const addedFeatures = normalizedFeatures.map((f) => ({ ...f, id: crypto.randomUUID() }));
14109
+ const addedFeatures = appendFeatures.map((f) => ({ ...f, id: crypto.randomUUID() }));
13695
14110
  const addedIds = addedFeatures.map((f) => String(f.id));
13696
14111
  const existing = readOnlyFeatures.current.get(targetId) || [];
13697
14112
  readOnlyFeatures.current.set(targetId, [...existing, ...addedFeatures]);
@@ -13705,7 +14120,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13705
14120
  const addedIds = [];
13706
14121
  isApiAddingRef.current = true;
13707
14122
  try {
13708
- normalizedFeatures.forEach((f) => {
14123
+ appendFeatures.forEach((f) => {
13709
14124
  const ids = draw.current.add(f);
13710
14125
  addedIds.push(ids[0]);
13711
14126
  });
@@ -13714,9 +14129,9 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13714
14129
  }
13715
14130
  setLayers((prev) => prev.map((l) => l.id === targetId ? withLayerMetadata(l, addedIds) : l));
13716
14131
  } else {
13717
- const addedIds = normalizedFeatures.map((f) => String(f.id));
14132
+ const addedIds = appendFeatures.map((f) => String(f.id));
13718
14133
  const existing = hiddenFeatures.current.get(targetId) || [];
13719
- hiddenFeatures.current.set(targetId, [...existing, ...normalizedFeatures]);
14134
+ hiddenFeatures.current.set(targetId, [...existing, ...appendFeatures]);
13720
14135
  setLayers((prev) => prev.map((l) => l.id === targetId ? withLayerMetadata(l, addedIds) : l));
13721
14136
  }
13722
14137
  updateFeatureCount();
@@ -13725,9 +14140,9 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13725
14140
  const reprojectMsg = reprojected ? ` (reprojected from ${sourceCRS})` : "";
13726
14141
  toast({
13727
14142
  title: "GeoJSON loaded",
13728
- description: `Added ${normalizedFeatures.length} features${reprojectMsg}${!(targetLayer == null ? void 0 : targetLayer.visible) ? " (layer hidden)" : ""}`
14143
+ description: `Added ${appendFeatures.length} features${reprojectMsg}${!(targetLayer == null ? void 0 : targetLayer.visible) ? " (layer hidden)" : ""}`
13729
14144
  });
13730
- }, [saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, scheduleSync, restoreEnrichedGeoJSON, toast, interceptGeoJSONFileLoad, ingestWithProgress]);
14145
+ }, [saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, scheduleSync, restoreEnrichedGeoJSON, toast, interceptGeoJSONFileLoad, ingestWithProgress, notifyFeatureCap]);
13731
14146
  const handleFileChange = useCallback((e) => {
13732
14147
  var _a;
13733
14148
  const file = (_a = e.target.files) == null ? void 0 : _a[0];
@@ -13789,6 +14204,17 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13789
14204
  readOnlyFeatures.current.set(layerId, normalizedFeatures);
13790
14205
  layerTemporalCacheRef.current.set(layerId, { featureCount: normalizedFeatures.length, hasTemporal: result.hasTemporal });
13791
14206
  newLayer.featureIds = addedIds;
14207
+ if (result.truncated) {
14208
+ notifyFeatureCap({
14209
+ layerId,
14210
+ layerName: newLayer.name,
14211
+ kept: normalizedFeatures.length,
14212
+ dropped: result.truncated.droppedCount,
14213
+ sourceCount: result.truncated.sourceFeatureCount,
14214
+ max: result.truncated.maxFeatures,
14215
+ source: "drop"
14216
+ });
14217
+ }
13792
14218
  const nextLayers = [...layersRef.current, newLayer];
13793
14219
  layersRef.current = nextLayers;
13794
14220
  setLayers(nextLayers);
@@ -13811,7 +14237,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13811
14237
  title: "Layer added",
13812
14238
  description: `Created "${newLayer.name}" with ${addedIds.length} features${reprojectMsg} (high-performance)`
13813
14239
  });
13814
- }, [saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, scheduleSync, restoreEnrichedGeoJSON, toast, interceptGeoJSONFileLoad, ingestWithProgress]);
14240
+ }, [saveStateForUndo, updateFeatureCount, scheduleTimelineUpdate, scheduleSync, restoreEnrichedGeoJSON, toast, interceptGeoJSONFileLoad, ingestWithProgress, notifyFeatureCap]);
13815
14241
  const handleDropGeoJSON = useCallback((name, data) => {
13816
14242
  void ingestDroppedLayer(name, data);
13817
14243
  }, [ingestDroppedLayer]);
@@ -14675,6 +15101,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
14675
15101
  is3DTerrainEnabled,
14676
15102
  onToggle3DTerrain: handleToggle3DTerrain,
14677
15103
  onUpdateAltitudeDisplayMode: handleUpdateAltitudeDisplayMode,
15104
+ availableBasemaps,
14678
15105
  hideSatellite: !enableSatellite,
14679
15106
  hideDark: !enableDark,
14680
15107
  hideTerrain: !enableTerrain,
@@ -15801,6 +16228,7 @@ export {
15801
16228
  ActionPanel,
15802
16229
  ClusterPieManager,
15803
16230
  ColorPickerPopover,
16231
+ DEFAULT_MAX_FEATURES_PER_LAYER,
15804
16232
  DebugSidebar,
15805
16233
  DrawingToolbar,
15806
16234
  INTERNAL_PROPERTY_KEYS,
@@ -15819,6 +16247,7 @@ export {
15819
16247
  TimebarToggle,
15820
16248
  cn,
15821
16249
  createClusterPieManager,
16250
+ featureCollectionBlobPartsAsync,
15822
16251
  getIconEmoji,
15823
16252
  isFeatureInRange,
15824
16253
  isInternalProperty,