1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1c1fc3e0-0c57-4397-8629-dba912e446d7",e._sentryDebugIdIdentifier="sentry-dbid-1c1fc3e0-0c57-4397-8629-dba912e446d7")}()}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8550],{36992:(e,t,i)=>{function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e}).apply(null,arguments)}i.d(t,{bS:()=>eE,cF:()=>N,hV:()=>e_,iA:()=>Q});let o="draw",n="edit";!function(e){e.Commit="commit",e.Provisional="provisional",e.Finish="finish"}(eC||(eC={}));let s={SELECTED:"selected",MID_POINT:"midPoint",SELECTION_POINT_FEATURE_ID:"selectionPointFeatureId",SELECTION_POINT:"selectionPoint"},a={MODE:"mode",CURRENTLY_DRAWING:"currentlyDrawing",EDITED:"edited",CLOSING_POINT:"closingPoint",SNAPPING_POINT:"snappingPoint",COORDINATE_POINT:"coordinatePoint",COORDINATE_POINT_FEATURE_ID:"coordinatePointFeatureId",COORDINATE_POINT_IDS:"coordinatePointIds",PROVISIONAL_COORDINATE_COUNT:"provisionalCoordinateCount",COMMITTED_COORDINATE_COUNT:"committedCoordinateCount",MARKER:"marker"};function d(e){return!!(e&&"object"==typeof e&&null!==e&&!Array.isArray(e))}function h(e){return!!(e&&"object"==typeof e&&"properties"in e&&"object"==typeof e.properties&&null!==e.properties&&"mode"in e.properties)}function l(e){return!!("number"==typeof e&&!isNaN(new Date(e).valueOf()))}!function(e){e.Drawing="drawing",e.Select="select",e.Static="static",e.Render="render"}(ex||(ex={}));let u={rightClick:!0,contextMenu:!1,leftClick:!0,onDragStart:!0,onDrag:!0,onDragEnd:!0};class c{get state(){return this._state}set state(e){throw Error("Please use the modes lifecycle methods")}get styles(){return this._styles}set styles(e){if("object"!=typeof e)throw Error("Styling must be an object");this.onStyleChange&&this.onStyleChange([],"styling"),this._styles=e}registerBehaviors(e){}constructor(e,t=!1){this._state="unregistered",this._styles={},this.pointerEvents=u,this.behaviors=[],this.validate=void 0,this.pointerDistance=40,this.coordinatePrecision=void 0,this.onStyleChange=void 0,this.store=void 0,this.projection="web-mercator",this.setDoubleClickToZoom=void 0,this.unproject=void 0,this.project=void 0,this.setCursor=void 0,this.isInitialUpdate=!1,this.type=ex.Drawing,this.mode="base",t?this.isInitialUpdate=!0:this.updateOptions(r({},e))}updateOptions(e){null!=e&&e.styles&&(this.styles=r({},this._styles,e.styles)),null!=e&&e.pointerDistance&&(this.pointerDistance=e.pointerDistance),null!=e&&e.validation&&(this.validate=e&&e.validation),null!=e&&e.projection&&(this.projection=e.projection),void 0!==(null==e?void 0:e.pointerEvents)&&(this.pointerEvents=e.pointerEvents),null!=e&&e.modeName&&!0===this.isInitialUpdate&&(this.mode=e.modeName),this.isInitialUpdate=!1}allowPointerEvent(e,t){return"boolean"==typeof e?e:"function"!=typeof e||e(t)}setDrawing(){if("started"!==this._state)throw Error("Mode must be unregistered or stopped to start");this._state="drawing"}setStarted(){if("stopped"!==this._state&&"registered"!==this._state&&"drawing"!==this._state&&"selecting"!==this._state)throw Error("Mode must be unregistered or stopped to start");this._state="started",this.setDoubleClickToZoom(!1)}setStopped(){if("started"!==this._state)throw Error("Mode must be started to be stopped");this._state="stopped",this.setDoubleClickToZoom(!0)}register(e){if("unregistered"!==this._state)throw Error("Can not register unless mode is unregistered");this._state="registered",this.store=e.store,this.store.registerOnChange(e.onChange),this.setDoubleClickToZoom=e.setDoubleClickToZoom,this.project=e.project,this.unproject=e.unproject,this.onSelect=e.onSelect,this.onDeselect=e.onDeselect,this.setCursor=e.setCursor,this.onStyleChange=e.onChange,this.onFinish=e.onFinish,this.coordinatePrecision=e.coordinatePrecision,this.registerBehaviors({mode:e.mode,store:this.store,project:this.project,unproject:this.unproject,pointerDistance:this.pointerDistance,coordinatePrecision:e.coordinatePrecision,projection:this.projection})}
1validateFeature(e){return this.performFeatureValidation(e)}afterFeatureAdded(e){}afterFeatureUpdated(e){}performFeatureValidation(e){if("unregistered"===this._state)throw Error("Mode must be registered");let t=function(e,t){let i;if(d(e))if(null==e.id)i="Feature has no id";else if("string"!=typeof e.id&&"number"!=typeof e.id)i="Feature must be string or number as per GeoJSON spec";else if(t(e.id))if(d(e.geometry))if(d(e.properties))if("string"==typeof e.geometry.type&&["Polygon","LineString","Point"].includes(e.geometry.type))if(Array.isArray(e.geometry.coordinates)){if(!e.properties.mode||"string"!=typeof e.properties.mode)return{valid:!1,reason:"Feature does not have a valid mode property"}}else i="Feature coordinates is not an array";else i="Feature is not Point, LineString or Polygon";else i="Feature has no properties";else i="Feature has no geometry";else i="Feature must match the id strategy (default is UUID4)";else i="Feature is not object";return i?{valid:!1,reason:i}:{valid:!0}}(e,this.store.idStrategy.isValidId);if(this.validate){let i=this.validate(e,{project:this.project,unproject:this.unproject,coordinatePrecision:this.coordinatePrecision,updateType:eC.Provisional});return{valid:t.valid&&i.valid,reason:i.reason}}return{valid:t.valid,reason:t.reason}}validateModeFeature(e,t){let i=this.performFeatureValidation(e);return i.valid?e.properties.mode!==this.mode?{valid:!1,reason:"Feature mode property does not match the mode being added to"}:t(e):{valid:!1,reason:i.reason}}onFinish(e,t){}onDeselect(e){}onSelect(e){}onKeyDown(e){}onKeyUp(e){}onMouseMove(e){}onClick(e){}onDragStart(e,t){}onDrag(e,t){}onDragEnd(e,t){}getHexColorStylingValue(e,t,i){return this.getStylingValue(e,t,i)}getNumericStylingValue(e,t,i){return this.getStylingValue(e,t,i)}getUrlStylingValue(e,t,i){return this.getStylingValue(e,t,i)}getStylingValue(e,t,i){return void 0===e?t:"function"==typeof e?e(i):e}}class p extends c{constructor(...e){super(...e),this.type=ex.Select}}function g(e,t){let i=e=>e*Math.PI/180,r=i(e[1]),o=i(e[0]),n=i(t[1]),s=n-r,a=i(t[0])-o,d=Math.sin(s/2)*Math.sin(s/2)+Math.cos(r)*Math.cos(n)*Math.sin(a/2)*Math.sin(a/2);return 2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d))*6371e3/1e3}function y(e){return e%360*Math.PI/180}function m(e){return e%(2*Math.PI)*180/Math.PI}function f(e,t=9){let i=Math.pow(10,t);return Math.round(e*i)/i}let v=(e,t)=>({x:0===e?0:.017453292519943295*e*6378137,y:0===t?0:6378137*Math.log(Math.tan(Math.PI/4+.017453292519943295*t/2))}),P=(e,t)=>({lng:0===e?0:e/6378137*57.29577951308232,lat:0===t?0:(2*Math.atan(Math.exp(t/6378137))-Math.PI/2)*57.29577951308232});function I(e){let{center:t,radiusKilometers:i,coordinatePrecision:r}=e,o=e.steps?e.steps:64,n=[];for(let e=0;e<o;e++){let s=function(e,t,i){let r=y(e[0]),o=y(e[1]),n=y(i),s=t/6371.0088,a=Math.asin(Math.sin(o)*Math.cos(s)+Math.cos(o)*Math.sin(s)*Math.cos(n));return[m(r+Math.atan2(Math.sin(n)*Math.sin(s)*Math.cos(o),Math.cos(s)-Math.sin(o)*Math.sin(a))),m(a)]}(t,i,-360*e/o);n.push([f(s[0],r),f(s[1],r)])}return n.push(n[0]),{type:"Feature",geometry:{type:"Polygon",coordinates:[n]},properties:{}}}function C(e,t){return e[0]===t[0]&&e[1]===t[1]}function x(e){let t=1,i=0;for(;Math.round(e*t)/t!==e;)t*=10,i++;return i}function _(e,t){var i,r,o;if("Polygon"!==e.geometry.type)return{valid:!1,reason:"Feature is not a Polygon"};if(1!==e.geometry.coordinates.length)return{valid:!1,reason:"Feature has holes"};if(e.geometry.coordinates[0].length<4)return{valid:!1,reason:"Feature has less than 4 coordinates"};for(let i=0;i<e.geometry.coordinates[0].length;i++){if(!function(e){var t,i;return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]&&1/0!==e[0]&&1/0!==e[1]&&(i=e[0])>=-180&&i<=180&&(t=e[1])>=-90&&t<=90}(e.geometry.coordinates[0][i]))return{valid:!1,reason:"Feature has invalid coordinates"};if(o=e.geometry.coordinates[0][i],!(x(o[0])<=t&&x(o[1])<=t))return{valid:!1,reason:"Feature has coordinates with excessive precision"}}return(i=e.geometry.coordinates[0][0])[0]!==(r=e.geometry.coordinates[0][e.geometry.coordinates[0].length-1])[0]||i[1]!==r[1]?{valid:!1,reason:"Feature coordinates are not closed"}:{valid:!0}}class E{constructor({store:e,mode:t,project:i,unproject:r,pointerDistance:o,coordinatePrecision:n,projection:s}){this.store=void 0,this.mode=void 0,this.project=void 0,this.unproject=void 0,this.pointerDistance=void 0,this.coordinatePrecision=void 0,this.projection=void 0,this.store=e,this.mode=t,this.project=i,this.unproject=r,this.pointerDistance=o,this.coordinatePrecision=n,this.projection=s}}function M(e){if(!function(e){let t=e.coordinates[0],i=0;for(let e=0;e<t.length-1;e++){let[r,o]=t[e],[n,s]=t[e+1];i+=(n-r)*(s+o)}return i<0}(e))return{type:"Polygon",coordinates:[e.coordinates[0].reverse()]}}let F="insert-before",w="insert-after",D="update",S="delete",O="replace";
1class b extends E{constructor(e,t){super(e),this.options=void 0,this.options=t}createPoint({coordinates:e,properties:t,context:i}){if((null==i?void 0:i.updateType)!==eC.Finish||this.validateGeometryWithUpdateType({geometry:{type:"Point",coordinates:e},properties:t,updateType:eC.Finish}))return this.handleCreateFeature({geometry:{type:"Point",coordinates:e},properties:t})}createLineString({coordinates:e,properties:t}){return this.handleCreateFeature({geometry:{type:"LineString",coordinates:e},properties:t})}createPolygon({coordinates:e,properties:t}){let i=M({type:"Polygon",coordinates:[e]});return this.handleCreateFeature({geometry:{type:"Polygon",coordinates:i?i.coordinates:[e]},properties:t})}createGuidancePoint({coordinate:e,type:t}){return this.createGuidancePoints({coordinates:[e],type:t})[0]}createGuidancePoints({coordinates:e,type:t,additionalProperties:i}){let o=e.map((e,o)=>({type:"Feature",geometry:{type:"Point",coordinates:e},properties:r({mode:this.mode,[t]:!0},i?i(o):{})}));return this.createFeatures(o)}updatePoint({featureId:e,coordinateMutations:t,propertyMutations:i,context:r}){return this.handleMutateFeature({type:"Point",featureId:e,coordinateMutations:t,propertyMutations:i,context:r})}updatePolygon({featureId:e,coordinateMutations:t,context:i,propertyMutations:r}){return this.handleMutateFeature({type:"Polygon",featureId:e,coordinateMutations:t,propertyMutations:r,context:i})}updateLineString({featureId:e,coordinateMutations:t,context:i,propertyMutations:r}){return this.handleMutateFeature({type:"LineString",featureId:e,coordinateMutations:t,propertyMutations:r,context:i})}deleteFeatureIfPresent(e){e&&this.store.has(e)&&this.store.delete([e])}deleteFeaturesIfPresent(e){if(0===e.length)return;let t=e.filter(e=>this.store.has(e));t.length&&this.store.delete(t)}setDeselected(e){let t=e.filter(e=>this.store.has(e)).map(e=>({featureId:e,properties:{[s.SELECTED]:!1}}));this.updateFeatureProperties(t)}setSelected(e){let{type:t}=this.store.getGeometryCopy(e),i={featureId:e,propertyMutations:{[s.SELECTED]:!0},context:{updateType:eC.Commit}};"Polygon"===t?this.updatePolygon(i):"LineString"===t?this.updateLineString(i):"Point"===t&&this.updatePoint(i)}updateGuidancePoints(e){this.updateFeatureGeometries(e.map(({featureId:e,coordinate:t})=>({id:e,geometry:{type:"Point",coordinates:t}})))}handleCreateFeature({geometry:e,properties:t}){return this.createFeatureWithGeometry({geometry:e,properties:t})}handleMutateFeature({type:e,featureId:t,coordinateMutations:i,propertyMutations:o,context:n}){if(!this.mutateFeature({type:e,featureId:t,coordinateMutations:i,propertyMutations:o,context:n.updateType===eC.Finish?r({},n,{correctRightHandRule:!0}):r({},n)}))return null;let s=this.buildFeatureWithGeometry(t);return n.updateType!==eC.Finish||i||this.validateGeometryWithUpdateType({geometry:s.geometry,properties:s.properties,updateType:n.updateType})?s:null}epsilonOffset(){return Math.max(1e-6,1/Math.pow(10,this.coordinatePrecision-1))}mutateFeature({type:e,featureId:t,coordinateMutations:i,propertyMutations:r,context:o}){if(!t)return!1;let n=this.store.getGeometryCopy(t),s=this.store.getPropertiesCopy(t);if(n.type!==e)throw Error(`${e} geometries cannot be updated on features with ${n.type} geometries`);
1if(i){let e=this.applyCoordinateMutations(n,i);if(o.correctRightHandRule&&"Polygon"===e.type){let t=M(e);t&&(e=t)}if(!this.validateGeometryWithUpdateType({geometry:e,properties:s,updateType:o.updateType}))return!1;this.updateFeatureGeometries([{id:t,geometry:e}])}return r&&this.updateFeatureProperties([{featureId:t,properties:r}]),!0}applyCoordinateMutations(e,t){if(this.isReplaceMutation(t))return r({},e,{coordinates:t.coordinates});if("Point"===e.type)throw Error("Coordinate mutations are not supported for Point geometries");let i="Polygon"===e.type,o=i?e.coordinates[0].slice():e.coordinates.slice(),n=o.length,s=e=>{let t=e<0?n+e:e;if(t<0||t>=n)throw RangeError(`Index ${e} (normalized to ${t}) is out of bounds`);return t},a=Array(n).fill(void 0),d=Array.from({length:n},()=>[]),h=Array.from({length:n},()=>[]),l=[];for(let e of t){if(e.type===F||e.type===w){let t=e.index,i=t<0?n+t:t;if(i<0||i>n)throw RangeError(`Index ${e.index} (normalized to ${i}) is out of bounds`);if(e.type===F){if(i>=n)throw RangeError(`INSERT_BEFORE index ${e.index} (normalized to ${i}) is out of bounds for length ${n}`);d[i].push(e)}else i===n?l.push(e):h[i].push(e);continue}let t=s(e.index);a[t]=r({},e,{index:t})}let u=[];for(let e=0;e<n;e++){for(let t of d[e])u.push(t.coordinate);let t=a[e];for(let i of(t?t.type===S||u.push(t.coordinate):u.push(o[e]),h[e]))u.push(i.coordinate)}for(let e of l)u.push(e.coordinate);return r({},e,i?{coordinates:[u,...e.coordinates.slice(1)]}:{coordinates:u})}isReplaceMutation(e){return e.type===O}createFeatureWithGeometry({geometry:e,properties:t}){let[i]=this.createFeatures([{type:"Feature",geometry:e,properties:t}]);return{id:i,type:"Feature",properties:this.store.getPropertiesCopy(i),geometry:this.store.getGeometryCopy(i)}}validateGeometryWithUpdateType({geometry:e,properties:t,updateType:i}){return!this.options.validate||this.options.validate({type:"Feature",geometry:e,properties:t||{}},{project:this.project,unproject:this.unproject,coordinatePrecision:this.coordinatePrecision,updateType:i}).valid}buildFeatureWithGeometry(e){return{id:e,type:"Feature",properties:this.store.getPropertiesCopy(e),geometry:this.store.getGeometryCopy(e)}}createFeatures(e){return this.store.create(e)}updateFeatureGeometries(e){this.store.updateGeometry(e)}updateFeatureProperties(e){let t=e.map(({featureId:e,properties:t})=>Object.entries(t).map(([t,i])=>({id:e,property:t,value:i}))).flat();this.store.updateProperty(t)}}let T={cancel:"Escape",finish:"Enter"},k={start:"crosshair"};class N extends c{constructor(e){super(e,!0),this.mode="circle",this.center=void 0,this.endPosition=void 0,this.segments=64,this.currentCircleId=void 0,this.keyEvents=T,this.cursors=k,this.startingRadiusKilometers=1e-5,this.cursorMovedAfterInitialCursorDown=!1,this.drawInteraction="click-move",this.drawType=void 0,this.mutateFeature=void 0,this.updateOptions(e)}updateOptions(e){super.updateOptions(e),null!=e&&e.cursors&&(this.cursors=r({},this.cursors,e.cursors)),null===(null==e?void 0:e.keyEvents)?this.keyEvents={cancel:null,finish:null}:null!=e&&e.keyEvents&&(this.keyEvents=r({},this.keyEvents,e.keyEvents)),null!=e&&e.startingRadiusKilometers&&(this.startingRadiusKilometers=e.startingRadiusKilometers),null!=e&&e.drawInteraction&&(this.drawInteraction=e.drawInteraction),null!=e&&e.segments&&(this.segments=e.segments<3?3:e.segments)}close(){if(void 0===this.currentCircleId||void 0===this.endPosition||!this.updateCircle(this.endPosition,eC.Finish))return;let e=this.currentCircleId;this.cursorMovedAfterInitialCursorDown=!1,this.center=void 0,this.currentCircleId=void 0,this.drawType=void 0,"drawing"===this.state&&this.setStarted(),this.onFinish(e,{mode:this.mode,action:o})}beginDrawing(e,t="click"){this.center=[e.lng,e.lat],this.endPosition=[e.lng,e.lat];let i=I({center:this.center,radiusKilometers:this.startingRadiusKilometers,coordinatePrecision:this.coordinatePrecision}),r=this.mutateFeature.createPolygon({coordinates:i.geometry.coordinates[0],properties:{mode:this.mode,radiusKilometers:this.startingRadiusKilometers,[a.CURRENTLY_DRAWING]:!0}});r&&(this.currentCircleId=r.id,this.cursorMovedAfterInitialCursorDown=!1,this.drawType=t,this.setDrawing())}dragDrawAllowed(){return"click-drag"===this.drawInteraction||"click-move-or-drag"===this.drawInteraction}moveDrawAllowed(){return"click-move"===this.drawInteraction||"click-move-or-drag"===this.drawInteraction}start(){this.setStarted(),this.setCursor(this.cursors.start)}stop(){this.cleanUp(),this.setStopped(),this.setCursor("unset")}onClick(e){this.moveDrawAllowed()&&("right"===e.button&&this.allowPointerEvent(this.pointerEvents.rightClick,e)||"left"===e.button&&this.allowPointerEvent(this.pointerEvents.leftClick,e)||e.isContextMenu&&this.allowPointerEvent(this.pointerEvents.contextMenu,e))&&(this.center?this.center&&void 0!==this.currentCircleId&&(this.endPosition=[e.lng,e.lat],this.close()):this.beginDrawing(e))}onMouseMove(e){this.cursorMovedAfterInitialCursorDown=!0,this.endPosition=[e.lng,e.lat],this.updateCircle(this.endPosition,eC.Provisional)}onKeyDown(){}onKeyUp(e){e.key===this.keyEvents.cancel?this.cleanUp():e.key===this.keyEvents.finish&&this.close()}onDragStart(e,t){"drawing"!==this.state&&this.allowPointerEvent(this.pointerEvents.onDragStart,e)&&this.dragDrawAllowed()&&(this.beginDrawing(e,"drag"),t(!1))}onDrag(e,t){this.allowPointerEvent(this.pointerEvents.onDrag,e)&&this.dragDrawAllowed()&&"drag"===this.drawType&&(this.cursorMovedAfterInitialCursorDown=!0,this.endPosition=[e.lng,e.lat],this.updateCircle(this.endPosition,eC.Provisional))}onDragEnd(e,t){this.allowPointerEvent(this.pointerEvents.onDragEnd,e)&&this.dragDrawAllowed()&&"drag"===this.drawType&&(this.endPosition=[e.lng,e.lat],this.close(),t(!0))}cleanUp(){let e=this.currentCircleId;this.center=void 0,this.currentCircleId=void 0,this.drawType=void 0,"drawing"===this.state&&this.setStarted(),this.mutateFeature.deleteFeatureIfPresent(e)}
1styleFeature(e){let t=r({},{polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0,markerUrl:void 0,markerHeight:void 0,markerWidth:void 0});return"Feature"===e.type&&"Polygon"===e.geometry.type&&e.properties.mode===this.mode&&(t.polygonFillColor=this.getHexColorStylingValue(this.styles.fillColor,t.polygonFillColor,e),t.polygonOutlineColor=this.getHexColorStylingValue(this.styles.outlineColor,t.polygonOutlineColor,e),t.polygonOutlineWidth=this.getNumericStylingValue(this.styles.outlineWidth,t.polygonOutlineWidth,e),t.polygonFillOpacity=this.getNumericStylingValue(this.styles.fillOpacity,t.polygonFillOpacity,e),t.zIndex=10),t}validateFeature(e){return this.validateModeFeature(e,e=>(function(e,t){let i=_(e,t);return i.valid?!function(e){let t;if("Polygon"===e.geometry.type)t=e.geometry.coordinates;else{if("LineString"!==e.geometry.type)throw Error("Self intersects only accepts Polygons and LineStrings");t=[e.geometry.coordinates]}let i=[];for(let e=0;e<t.length;e++)for(let r=0;r<t[e].length-1;r++)for(let o=0;o<t.length;o++)for(let n=0;n<t[o].length-1;n++)!function(e,r,o,n){let s,a,d=t[e][r],h=t[e][r+1],l=t[o][n],u=t[o][n+1],c=function(e,t,i,r){if(C(e,i)||C(e,r)||C(t,i)||C(r,i))return null;let o=e[0],n=e[1],s=t[0],a=t[1],d=i[0],h=i[1],l=r[0],u=r[1],c=(o-s)*(h-u)-(n-a)*(d-l);return 0===c?null:[((o*a-n*s)*(d-l)-(o-s)*(d*u-h*l))/c,((o*a-n*s)*(h-u)-(n-a)*(d*u-h*l))/c]}(d,h,l,u);if(null!==c){var p;s=h[0]!==d[0]?(c[0]-d[0])/(h[0]-d[0]):(c[1]-d[1])/(h[1]-d[1]),a=u[0]!==l[0]?(c[0]-l[0])/(u[0]-l[0]):(c[1]-l[1])/(u[1]-l[1]),s<0||s>1||(p=a)<0||p>1||(c.toString(),i.push(c))}}(e,r,o,n);return i.length>0}(e)?{valid:!0}:{valid:!1,reason:"Feature intersects itself"}:i})(e,this.coordinatePrecision))}updateCircle(e,t){let i,r;if(void 0===this.currentCircleId||void 0===this.center)return;let n=t===eC.Finish;if(this.cursorMovedAfterInitialCursorDown)if(r=g(this.center,e),"web-mercator"===this.projection){let t=function(e,t){let i=1e3*g(e,t);if(0===i)return 1;let{x:r,y:o}=v(e[0],e[1]),{x:n,y:s}=v(t[0],t[1]);return Math.sqrt(Math.pow(n-r,2)+Math.pow(s-o,2))/i}(this.center,e);i=function(e){let{center:t,radiusKilometers:i,coordinatePrecision:r}=e,o=e.steps?e.steps:64,n=1e3*i,[s,a]=t,{x:d,y:h}=v(s,a),l=[];for(let e=0;e<o;e++){let t=360*e/o*Math.PI/180,[i,s]=[d+n*Math.cos(t),h+n*Math.sin(t)],{lng:a,lat:u}=P(i,s);l.push([f(a,r),f(u,r)])}return l.push(l[0]),{type:"Feature",geometry:{type:"Polygon",coordinates:[l]},properties:{}}}({center:this.center,radiusKilometers:r*t,coordinatePrecision:this.coordinatePrecision,steps:this.segments})}else{if("globe"!==this.projection)throw Error("Invalid projection");i=I({center:this.center,radiusKilometers:r,coordinatePrecision:this.coordinatePrecision,steps:this.segments})}let s={};return i&&r&&(s.radiusKilometers=r),n&&(s[a.CURRENTLY_DRAWING]=void 0),this.mutateFeature.updatePolygon({featureId:this.currentCircleId,coordinateMutations:i?{type:O,coordinates:i.geometry.coordinates}:void 0,propertyMutations:s,context:n?{updateType:t,action:o}:{updateType:t}})}afterFeatureUpdated(e){this.currentCircleId===e.id&&(this.cursorMovedAfterInitialCursorDown=!1,this.center=void 0,this.currentCircleId=void 0,this.drawType=void 0,"drawing"===this.state&&this.setStarted())}registerBehaviors(e){this.mutateFeature=new b(e,{validate:this.validate})}}let A=(e,t)=>{let{x:i,y:r}=e,{x:o,y:n}=t,s=o-i,a=n-r;return Math.sqrt(a*a+s*s)};class B extends E{constructor(e){super(e)}getGeometryType(e){return this.store.getGeometryCopy(e).type}coordinateAtIndexIsIdentical({featureId:e,newCoordinate:t,index:i}){var r;let o,n=this.store.getGeometryCopy(e);if("Polygon"===n.type)o=n.coordinates[0][i];else if("LineString"===n.type)o=n.coordinates[i];else{if(0!==i)throw Error("Point geometries only have one coordinate at index 0");o=n.coordinates}return r=o,t[0]===r[0]&&t[1]===r[1]}getGeometry(e){return this.store.getGeometryCopy(e)}getCoordinates(e){let{type:t,coordinates:i}=this.store.getGeometryCopy(e);return"Polygon"===t?i[0]:i}getCoordinate(e,t){let i=this.getCoordinates(e),r=t<0?i.length+t:t;if(r<0||r>=i.length)throw RangeError(`Index ${t} (normalized to ${r}) is out of bounds`);return i[r]}getProperties(e){return this.store.getPropertiesCopy(e)}hasFeature(e){return this.store.has(e)}getAllFeatureIdsWhere(e){return this.store.copyAllWhere(e).map(({id:e})=>e)}}function R({unproject:e,point:t,pointerDistance:i}){let r=i/2,{x:o,y:n}=t;return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[e(o-r,n-r),e(o+r,n-r),e(o+r,n+r),e(o-r,n+r),e(o-r,n-r)].map(e=>[e.lng,e.lat])]}}}
1class G extends E{constructor(e){super(e)}create(e){let{containerX:t,containerY:i}=e;return R({unproject:this.unproject,point:{x:t,y:i},pointerDistance:this.pointerDistance})}}class L extends E{constructor(e){super(e)}measure(e,t){let{x:i,y:r}=this.project(t[0],t[1]);return A({x:i,y:r},{x:e.containerX,y:e.containerY})}}class U extends E{constructor(e,t,i){super(e),this.config=void 0,this.pixelDistance=void 0,this.clickBoundingBox=void 0,this.getSnappableCoordinateFirstClick=e=>this.getSnappable(e,e=>!!(e.properties&&e.properties.mode===this.mode)).coordinate,this.getSnappableCoordinate=(e,t)=>this.getSnappable(e,e=>!!(e.properties&&e.properties.mode===this.mode&&e.id!==t)).coordinate,this.config=e,this.pixelDistance=t,this.clickBoundingBox=i}getSnappable(e,t){let i=this.clickBoundingBox.create(e),r=this.store.search(i,t),o={featureId:void 0,featureCoordinateIndex:void 0,coordinate:void 0,minDist:1/0};return r.forEach(t=>{let i;if("Polygon"===t.geometry.type)i=t.geometry.coordinates[0];else{if("LineString"!==t.geometry.type)return;i=t.geometry.coordinates}i.forEach((i,r)=>{let n=this.pixelDistance.measure(e,i);n<o.minDist&&n<this.pointerDistance&&(o.coordinate=i,o.minDist=n,o.featureId=t.id,o.featureCoordinateIndex=r)})}),o}}function j(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2))}function W(e,t){return Math.acos(Math.min(Math.max(function(e,t){let[i,r,o]=e,[n,s,a]=t;return i*n+r*s+o*a}(e,t)/(j(e)*j(t)),-1),1))}function Y(e){let t=y(e[1]),i=y(e[0]);return[Math.cos(t)*Math.cos(i),Math.cos(t)*Math.sin(i),Math.sin(t)]}function X(e){let[t,i,r]=e,o=m(Math.asin(r));return[m(Math.atan2(i,t)),o]}class K extends E{constructor(e,t,i){super(e),this.config=void 0,this.pixelDistance=void 0,this.clickBoundingBox=void 0,this.get
1SnappableCoordinateFirstClick=e=>{let t=this.getSnappable(e,e=>!!(e.properties&&e.properties.mode===this.mode));return t.coordinate?[f(t.coordinate[0],this.config.coordinatePrecision),f(t.coordinate[1],this.config.coordinatePrecision)]:void 0},this.getSnappableCoordinate=(e,t)=>{let i=this.getSnappable(e,e=>!!(e.properties&&e.properties.mode===this.mode&&e.id!==t));return i.coordinate?[f(i.coordinate[0],this.config.coordinatePrecision),f(i.coordinate[1],this.config.coordinatePrecision)]:void 0},this.config=e,this.pixelDistance=t,this.clickBoundingBox=i}getSnappable(e,t){let i=this.clickBoundingBox.create(e),r=this.store.search(i,t),o={featureId:void 0,featureCoordinateIndex:void 0,coordinate:void 0,minDistance:1/0};return r.forEach(t=>{let i,r;if("Polygon"===t.geometry.type)i=t.geometry.coordinates[0];else{if("LineString"!==t.geometry.type)return;i=t.geometry.coordinates}let n=[];for(let e=0;e<i.length-1;e++)n.push([i[e],i[e+1]]);let s=[e.lng,e.lat];if("web-mercator"===this.config.projection?r=function(e,t){let i=[1/0,1/0],r=1/0,o=0;for(let n of t){let s=n[0],a=n[1],d,h=1/0,l=v(s[0],s[1]),u=v(a[0],a[1]),c=v(e[0],e[1]);if(s[0]===e[0]&&s[1]===e[1])d=s;else if(a[0]===e[0]&&a[1]===e[1])d=a;else{let{x:e,y:t}=function(e,t,i){let r=t.x-e.x,o=t.y-e.y,n=Math.max(0,Math.min(1,((i.x-e.x)*r+(i.y-e.y)*o)/(r*r+o*o)));return{x:e.x+n*r,y:e.y+n*o}}(l,u,c),{lng:i,lat:r}=P(e,t);d=[i,r]}d&&(h=A(c,v(d[0],d[1])))<r&&(i=d,r=h,o=t.indexOf(n))}return 1/0===r?void 0:{coordinate:i,lineIndex:o,distance:r}}(s,n):"globe"===this.config.projection&&(r=function(e,t){let i=[1/0,1/0],r=1/0,o=0;for(let n of t){let s=n[0],a=n[1],d,h=1/0;s[0]===e[0]&&s[1]===e[1]?d=s:a[0]===e[0]&&a[1]===e[1]?d=a:[d]=function(e,t,i){let r,o=Y(e),n=Y(t),[s,a,d]=Y(i),[h,l,u]=function(e,t){let[i,r,o]=e,[n,s,a]=t;return[r*a-o*s,o*n-i*a,i*s-r*n]}(o,n),c=l*d-u*a,p=u*s-h*d,y=h*a-l*s,m=y*l-p*u,f=c*u-y*h,v=p*h-c*l,P=1/Math.sqrt(Math.pow(m,2)+Math.pow(f,2)+Math.pow(v,2)),I=[m*P,f*P,v*P],C=[-1*m*P,-1*f*P,-1*v*P],x=W(o,n),_=W(o,I),E=W(n,I),M=W(o,C),F=W(n,C);return W(o,r=_<M&&_<F||E<M&&E<F?I:C)>x||W(n,r)>x?g(X(r),X(o))<=g(X(r),X(n))?[X(o),!0,!1]:[X(n),!1,!0]:[X(r),!1,!1]}(s,a,e),d&&(h=g(e,d))<r&&(i=d,r=h,o=t.indexOf(n))}return 1/0===r?void 0:{coordinate:i,distance:r,lineIndex:o}}(s,n)),!r)return;let a=this.pixelDistance.measure(e,r.coordinate);a<o.minDistance&&a<this.pointerDistance&&(o.featureId=t.id,o.coordinate=[f(r.coordinate[0],this.config.coordinatePrecision),f(r.coordinate[1],this.config.coordinatePrecision)],o.featureCoordinateIndex=r.lineIndex,o.minDistance=a)}),o}}function $(e){return Array.isArray(e)&&e.length>0&&Array.isArray(e[0])&&Array.isArray(e[0][0])}let V=e=>$(e)?e[0].slice(0,-1):e,z=e=>$(e)?e[0]:e;
1class H extends E{constructor(e,t,i,r){super(e),this.config=void 0,this.pixelDistance=void 0,this.mutateFeatureBehavior=void 0,this.readFeatureBehavior=void 0,this._startEndPoints=[],this.config=e,this.pixelDistance=t,this.mutateFeatureBehavior=i,this.readFeatureBehavior=r}get ids(){return this._startEndPoints.concat()}set ids(e){}create(e){if(this.ids.length)throw Error("Opening and closing points already created");let t=$(e),i=z(e);if(t){if(i.length<=3)throw Error("Requires at least 4 coordinates");this._startEndPoints=this.mutateFeatureBehavior.createGuidancePoints({coordinates:[i[0],i[i.length-2]],type:a.CLOSING_POINT})}else this._startEndPoints=[this.mutateFeatureBehavior.createGuidancePoint({coordinate:i[i.length-2],type:a.CLOSING_POINT})]}delete(){this.ids.length&&(this.mutateFeatureBehavior.deleteFeaturesIfPresent(this.ids),this._startEndPoints=[])}updateOne(e,t){this.mutateFeatureBehavior.updateGuidancePoints([{featureId:this.ids[e],coordinate:t}])}update(e){let t=z(e);1!==this.ids.length?2===this.ids.length&&this.mutateFeatureBehavior.updateGuidancePoints([{featureId:this.ids[0],coordinate:t[0]},{featureId:this.ids[1],coordinate:t[t.length-3]}]):this.mutateFeatureBehavior.updateGuidancePoints([{featureId:this.ids[0],coordinate:t[t.length-2]}])}isLineStringClosingPoint(e){if(1!==this.ids.length)return{isClosing:!1};let t=this.readFeatureBehavior.getGeometry(this.ids[0]);return{isClosing:this.pixelDistance.measure(e,t.coordinates)<this.pointerDistance}}isPolygonClosingPoints(e){if(2!==this.ids.length)return{isClosing:!1,isPreviousClosing:!1};let t=this.readFeatureBehavior.getGeometry(this.ids[0]),i=this.readFeatureBehavior.getGeometry(this.ids[1]),r=this.pixelDistance.measure(e,t.coordinates),o=this.pixelDistance.measure(e,i.coordinates);return{isClosing:r<this.pointerDistance,isPreviousClosing:o<this.pointerDistance}}}class q extends E{constructor(e,t,i){super(e),this.readFeature=void 0,this.mutateFeature=void 0,this.readFeature=t,this.mutateFeature=i}createOrUpdate({featureId:e,featureCoordinates:t}){if(!this.readFeature.hasFeature(e))return void this.deleteOrphanedPoints(e);let i=V(t),r=this.readFeature.getProperties(e),o=r.coordinatePointIds;if(o)if(o&&o.every(e=>this.readFeature.hasFeature(e))){let t=r.coordinatePointIds,o=t.map(e=>this.readFeature.getGeometry(e).coordinates);if(t.length!==i.length){this.deleteCoordinatePoints(t);let o=this.createPoints(i,r.mode,e);this.setFeatureCoordinatePoints(e,o)}else{let e=[];i.forEach((i,r)=>{i[0]===o[r][0]&&i[1]===o[r][1]||e.push({featureId:t[r],coordinate:i})}),this.mutateFeature.updateGuidancePoints(e)}}else{let t=o.filter(e=>this.readFeature.hasFeature(e));t.length&&this.deleteCoordinatePoints(t);let n=this.createPoints(i,r.mode,e);this.setFeatureCoordinatePoints(e,n)}else{let t=this.createPoints(i,r.mode,e);this.setFeatureCoordinatePoints(e,t)}}deletePointsByFeatureIds(e){for(let t of e)this.deleteIfPresent(t)}updateOneAtIndex(e,t,i){let r=this.readFeature.getProperties(e).coordinatePointIds;r&&0!==r.length&&void 0!==r[t]&&this.mutateFeature.updateGuidancePoints([{featureId:r[t],coordinate:i}])}updateAllInPlace({featureId:e,featureCoordinates:t}){let i=this.readFeature.getProperties(e);if(!i.coordinatePointIds)return;let r=V(t);r.length===i.coordinatePointIds.length&&this.mutateFeature.updateGuidancePoints(i.coordinatePointIds.map((e,t)=>({featureId:e,coordinate:r[t]})))}createPoints(e,t,i){return this.mutateFeature.createGuidancePoints({coordinates:e,type:a.COORDINATE_POINT,additionalProperties:e=>({mode:t,[a.COORDINATE_POINT]:!0,[a.COORDINATE_POINT_FEATURE_ID]:i,index:e})})}setFeatureCoordinatePoints(e,t,i=eC.Commit){let r=this.readFeature.getGeometryType(e),o={featureId:e,propertyMutations:{[a.COORDINATE_POINT_IDS]:t},context:{updateType:i}};if("Polygon"===r)this.mutateFeature.updatePolygon(o);else{if("LineString"!==r)throw Error("Unsupported geometry type for coordinate points");this.mutateFeature.updateLineString(o)}}deleteCoordinatePoints(e){this.mutateFeature.deleteFeaturesIfPresent(e)}deleteIfPresent(e){if(!this.readFeature.hasFeature(e))return;let t=this.readFeature.getProperties(e).coordinatePointIds;t&&(this.deleteCoordinatePoints(t),this.setFeatureCoordinatePoints(e,null))}deleteOrphanedPoints(e){let t=this.readFeature.getAllFeatureIdsWhere(t=>t[a.COORDINATE_POINT_FEATURE_ID]===e);this.mutateFeature.deleteFeaturesIfPresent(t)}}let Z={cancel:"Escape",finish:"Enter"},J={start:"crosshair",close:"pointer",dragStart:"grabbing",dragEnd:"crosshair"};class Q extends c{constructor(e){super(e,!0),this.mode="polygon",this.currentCoordinate=0,this.currentId=void 0,this.keyEvents=Z,this.cursors=J,this.mouseMove=!1,this.showCoordinatePoints=!1,this.lastMouseMoveEvent=void 0,this.snapping=void 0,this.snappedPointId=void 0,this.editable=!1,this.editedFeatureId=void 0,this.editedFeatureCoordinateIndex=void 0,this.editedSnapType=void 0,this.editedInsertIndex=void 0,this.editedPointId=void 0,this.coordinatePoints=void 0,this.lineSnapping=void 0,this.coordinateSnapping=void 0,this.pixelDistance=void 0,this.closingPoints=void 0,this.clickBoundingBox=void 0,this.mutateFeature=void 0,this.readFeature=void 0,this.updateOptions(e)}updateOptions(e){if(super.updateOptions(e),null!=e&&e.cursors&&(this.cursors=r({},this.cursors,e.cursors)),null===(null==e?void 0:e.keyEvents)?this.keyEvents={cancel:null,finish:null}:null!=e&&e.keyEvents&&(this.keyEvents=r({},this.keyEvents,e.keyEvents)),null!=e&&e.snapping&&(this.snapping=e.snapping),void 0!==(null==e?void 0:e.editable)&&(this.editable=e.editable),void 0!==(null==e?void 0:e.pointerEvents)&&(this.pointerEvents=e.pointerEvents),void 0!==(null==e?void 0:e.showCoordinatePoints)){if(this.showCoordinatePoints=e.showCoordinatePoints,this.coordinatePoints&&!0===e.showCoordinatePoints)this.store.copyAllWhere(e=>
1e.mode===this.mode).forEach(e=>{this.coordinatePoints.createOrUpdate({featureId:e.id,featureCoordinates:e.geometry.coordinates})});else if(this.coordinatePoints&&!1===this.showCoordinatePoints){let e=this.store.copyAllWhere(e=>e.mode===this.mode&&!!e[a.COORDINATE_POINT_IDS]);this.coordinatePoints.deletePointsByFeatureIds(e.map(e=>e.id))}}}close(){if(void 0===this.currentId||this.readFeature.getCoordinates(this.currentId).length<5)return;let e=this.mutateFeature.updatePolygon({featureId:this.currentId,coordinateMutations:[{type:S,index:-2}],propertyMutations:{[a.CURRENTLY_DRAWING]:void 0,[a.COMMITTED_COORDINATE_COUNT]:void 0,[a.PROVISIONAL_COORDINATE_COUNT]:void 0},context:{updateType:eC.Finish,action:o}});if(!e)return;this.showCoordinatePoints&&this.coordinatePoints.createOrUpdate({featureId:this.currentId,featureCoordinates:e.geometry.coordinates}),"drawing"===this.state&&this.setStarted(),this.editedPointId&&(this.mutateFeature.deleteFeatureIfPresent(this.editedPointId),this.editedPointId=void 0),this.snappedPointId&&(this.mutateFeature.deleteFeatureIfPresent(this.snappedPointId),this.snappedPointId=void 0),this.closingPoints.delete();let t=this.currentId;this.currentCoordinate=0,this.currentId=void 0,this.onFinish(t,{mode:this.mode,action:o})}registerBehaviors(e){this.readFeature=new B(e),this.mutateFeature=new b(e,{validate:this.validate}),this.clickBoundingBox=new G(e),this.pixelDistance=new L(e),this.lineSnapping=new K(e,this.pixelDistance,this.clickBoundingBox),this.coordinateSnapping=new U(e,this.pixelDistance,this.clickBoundingBox),this.closingPoints=new H(e,this.pixelDistance,this.mutateFeature,this.readFeature),this.coordinatePoints=new q(e,this.readFeature,this.mutateFeature)}start(){this.setStarted(),this.setCursor(this.cursors.start)}stop(){this.cleanUp(),this.setStopped(),this.setCursor("unset")}updateSnappedCoordinate(e){let t=this.snapCoordinate(e);t?(this.snappedPointId?this.mutateFeature.updateGuidancePoints([{featureId:this.snappedPointId,coordinate:t}]):this.snappedPointId=this.mutateFeature.createGuidancePoint({coordinate:t,type:a.SNAPPING_POINT}),e.lng=t[0],e.lat=t[1]):this.snappedPointId&&(this.mutateFeature.deleteFeatureIfPresent(this.snappedPointId),this.snappedPointId=void 0)}onMouseMove(e){let t;if(this.mouseMove=!0,this.setCursor(this.cursors.start),this.lastMouseMoveEvent=e,this.updateSnappedCoordinate(e),void 0===this.currentId||0===this.currentCoordinate)return;let i=this.readFeature.getCoordinate(this.currentId,0),r=[e.lng,e.lat];if(1===this.currentCoordinate)t=[{type:D,index:1,coordinate:r},{type:D,index:2,coordinate:[e.lng,e.lat-this.mutateFeature.epsilonOffset()]}];else if(2===this.currentCoordinate)t=[{type:D,index:2,coordinate:r}];else{let{isClosing:o,isPreviousClosing:n}=this.closingPoints.isPolygonClosingPoints(e);n||o?(this.snappedPointId&&(this.mutateFeature.deleteFeatureIfPresent(this.snappedPointId),this.snappedPointId=void 0),this.setCursor(this.cursors.close),t=[{type:D,index:-1,coordinate:i},{type:D,index:-2,coordinate:i}]):t=[{type:D,index:-2,coordinate:r},{type:D,index:-1,coordinate:i}]}let o=this.mutateFeature.updatePolygon({featureId:this.currentId,coordinateMutations:t,propertyMutations:{[a.PROVISIONAL_COORDINATE_COUNT]:this.currentCoordinate+1},context:{updateType:eC.Provisional}});o&&this.showCoordinatePoints&&this.coordinatePoints.createOrUpdate({featureId:this.currentId,featureCoordinates:o.geometry.coordinates})}snapCoordinate(e){var t,i,r;let o;if(null!=(t=this.snapping)&&t.toLine){let t;(t=this.currentId?this.lineSnapping.getSnappableCoordinate(e,this.currentId):this.lineSnapping.getSnappableCoordinateFirstClick(e))&&(o=t)}if(null!=(i=this.snapping)&&i.toCoordinate){let t;(t=this.currentId?this.coordinateSnapping.getSnappableCoordinate(e,this.currentId):this.coordinateSnapping.getSnappableCoordinateFirstClick(e))&&(o=t)}if(null!=(r=this.snapping)&&r.toCustom){let t=this.snapping.toCustom(e,{currentCoordinate:this.currentCoordinate,currentId:this.currentId,getCurrentGeometrySnapshot:this.currentId?()=>this.readFeature.getGeometry(this.currentId):()=>null,project:this.project,unproject:this.unproject});t&&(o=t)}return o}polygonFilter(e){return!!("Polygon"===e.geometry.type&&e.properties&&e.properties.mode===this.mode)}onRightClick(e){let t;if(!this.editable||"started"!==this.state)return;let{featureId:i,featureCoordinateIndex:r}=this.coordinateSnapping.getSnappable(e,e=>this.polygonFilter(e));if(!i||void 0===r)return;let o=this.readFeature.getGeometry(i);if("Polygon"!==o.type)return;let s=o.coordinates[0];if(s.length<=4)return;t=0===r||r===s.length-1?[{type:S,index:0},{type:S,index:-1}
1,{type:w,index:-1,coordinate:s[1]}]:[{type:S,index:r}];let d=this.mutateFeature.updatePolygon({featureId:i,coordinateMutations:t,context:{updateType:eC.Finish,action:n}});if(d){if(this.showCoordinatePoints&&this.coordinatePoints.createOrUpdate({featureId:i,featureCoordinates:d.geometry.coordinates}),this.snappedPointId&&(this.mutateFeature.deleteFeatureIfPresent(this.snappedPointId),this.snappedPointId=void 0,this.snapping)){let t=this.snapCoordinate(e);if(t){let[e]=this.mutateFeature.createGuidancePoints({type:a.SNAPPING_POINT,coordinates:[t]});this.snappedPointId=e}}this.onFinish(i,{mode:this.mode,action:n})}}onLeftClick(e){this.snappedPointId&&(this.mutateFeature.deleteFeatureIfPresent(this.snappedPointId),this.snappedPointId=void 0);let t=this.snapCoordinate(e)||[e.lng,e.lat];if(0===this.currentCoordinate){let{id:e,geometry:i}=this.mutateFeature.createPolygon({coordinates:[t,t,t,t],properties:{mode:this.mode,[a.CURRENTLY_DRAWING]:!0,[a.COMMITTED_COORDINATE_COUNT]:this.currentCoordinate+1,[a.PROVISIONAL_COORDINATE_COUNT]:this.currentCoordinate+1}});this.showCoordinatePoints&&this.coordinatePoints.createOrUpdate({featureId:e,featureCoordinates:i.coordinates}),this.currentId=e,this.currentCoordinate++,this.setDrawing()}else if(1===this.currentCoordinate&&this.currentId){if(this.readFeature.coordinateAtIndexIsIdentical({featureId:this.currentId,newCoordinate:t,index:0}))return;let e=this.mutateFeature.updatePolygon({featureId:this.currentId,coordinateMutations:[{type:D,index:1,coordinate:t},{type:D,index:2,coordinate:t}],propertyMutations:{[a.COMMITTED_COORDINATE_COUNT]:this.currentCoordinate+1},context:{updateType:eC.Commit}});if(!e)return;this.showCoordinatePoints&&this.coordinatePoints.createOrUpdate({featureId:this.currentId,featureCoordinates:e.geometry.coordinates}),this.currentCoordinate++}else if(2===this.currentCoordinate&&this.currentId){if(this.readFeature.coordinateAtIndexIsIdentical({featureId:this.currentId,newCoordinate:t,index:1}))return;let e=this.mutateFeature.updatePolygon({featureId:this.currentId,coordinateMutations:[{type:D,index:2,coordinate:t},{type:w,index:2,coordinate:t}],propertyMutations:{[a.COMMITTED_COORDINATE_COUNT]:this.currentCoordinate+1},context:{updateType:eC.Commit}});if(!e)return;this.showCoordinatePoints&&this.coordinatePoints.createOrUpdate({featureId:this.currentId,featureCoordinates:e.geometry.coordinates}),2===this.currentCoordinate&&this.closingPoints.create(e.geometry.coordinates),this.currentCoordinate++}else if(this.currentId){let{isClosing:i,isPreviousClosing:r}=this.closingPoints.isPolygonClosingPoints(e);if(r||i)this.close();else{if(this.readFeature.coordinateAtIndexIsIdentical({featureId:this.currentId,newCoordinate:t,index:this.currentCoordinate-1}))return;let e=this.mutateFeature.updatePolygon({featureId:this.currentId,coordinateMutations:[{type:F,index:-1,coordinate:t}],propertyMutations:{[a.COMMITTED_COORDINATE_COUNT]:this.currentCoordinate+1},context:{updateType:eC.Commit}});if(!e)return;this.showCoordinatePoints&&this.coordinatePoints.createOrUpdate({featureId:this.currentId,featureCoordinates:e.geometry.coordinates}),this.currentCoordinate++,this.closingPoints.ids.length&&this.closingPoints.update(e.geometry.coordinates)}}}onClick(e){this.currentCoordinate>0&&!this.mouseMove&&this.onMouseMove(e),this.mouseMove=!1,"right"===e.button&&this.allowPointerEvent(this.pointerEvents.rightClick,e)||e.isContextMenu&&this.allowPointerEvent(this.pointerEvents.contextMenu,e)?this.onRightClick(e):"left"===e.button&&this.allowPointerEvent(this.pointerEvents.leftClick,e)&&this.onLeftClick(e)}onKeyUp(e){e.key===this.keyEvents.cancel?this.cleanUp():e.key===this.keyEvents.finish&&this.close()}onKeyDown(){}onDragStart(e,t){let i;if(this.allowPointerEvent(this.pointerEvents.onDragStart,e)&&this.editable){if("started"===this.state){let t=this.lineSnapping.getSnappable(e,e=>this.polygonFilter(e));t.coordinate&&(this.editedSnapType="line",this.editedFeatureCoordinateIndex=t.featureCoordinateIndex,this.editedFeatureId=t.featureId,i=t.coordinate);let r=this.coordinateSnapping.getSnappable(e,e=>this.polygonFilter(e));r.coordinate&&(this.editedSnapType="coordinate",this.editedFeatureCoordinateIndex=r.featureCoordinateIndex,this.editedFeatureId=r.featureId,i=r.coordinate)}this.editedFeatureId&&i&&(this.editedPointId||(this.editedPointId=this.mutateFeature.createGuidancePoint({coordinate:i,type:a.EDITED})),this.setCursor(this.cursors.dragStart),t(!1))}}onDrag(e,t){if(!this.allowPointerEvent(this.pointerEvents.onDrag,e)||void 0===this.editedFeatureId||void 0===this.editedFeatureCoordinateIndex)return;let i=this.readFeature.getGeometry(this.editedFeatureId),r=[e.lng,e.lat],o=[];if("coordinate"===this.editedSnapType||"line"===this.editedSnapType&&void 0!==this.editedInsertIndex?o=0===this.editedFeatureCoordinateIndex||this.editedFeatureCoordinateIndex===i.coordinates[0].length-1?[{type:D,index:0,coordinate:r}
1,{type:D,index:-1,coordinate:r}]:[{type:D,index:this.editedFeatureCoordinateIndex,coordinate:r}]:"line"===this.editedSnapType&&void 0===this.editedInsertIndex&&(this.editedInsertIndex=this.editedFeatureCoordinateIndex+1,o=[{type:F,index:this.editedInsertIndex,coordinate:r}],this.editedFeatureCoordinateIndex++),0===o.length)return;let n=this.mutateFeature.updatePolygon({featureId:this.editedFeatureId,coordinateMutations:o,propertyMutations:{[a.EDITED]:!0},context:{updateType:eC.Provisional}});n&&(this.showCoordinatePoints&&(this.editedInsertIndex?this.coordinatePoints.createOrUpdate({featureId:this.editedFeatureId,featureCoordinates:n.geometry.coordinates}):this.coordinatePoints.updateOneAtIndex(this.editedFeatureId,this.editedFeatureCoordinateIndex,n.geometry.coordinates[0][this.editedFeatureCoordinateIndex])),this.snapping&&this.snappedPointId&&(this.mutateFeature.deleteFeatureIfPresent(this.snappedPointId),this.snappedPointId=void 0),this.editedPointId&&this.mutateFeature.updateGuidancePoints([{featureId:this.editedPointId,coordinate:r}]))}onDragEnd(e,t){if(!this.allowPointerEvent(this.pointerEvents.onDragEnd,e)||void 0===this.editedFeatureId||(this.setCursor(this.cursors.dragEnd),!this.mutateFeature.updatePolygon({featureId:this.editedFeatureId,propertyMutations:{[a.EDITED]:!1},context:{updateType:eC.Finish,action:n}})))return;let i=this.editedFeatureId;this.editedPointId&&(this.mutateFeature.deleteFeatureIfPresent(this.editedPointId),this.editedPointId=void 0),this.snappedPointId&&(this.mutateFeature.deleteFeatureIfPresent(this.snappedPointId),this.snappedPointId=void 0),this.editedFeatureId=void 0,this.editedFeatureCoordinateIndex=void 0,this.editedInsertIndex=void 0,this.editedSnapType=void 0,t(!0),this.onFinish(i,{mode:this.mode,action:o})}cleanUp(){let e=this.currentId,t=this.snappedPointId,i=this.editedPointId;this.currentId=void 0,this.snappedPointId=void 0,this.editedPointId=void 0,this.editedFeatureId=void 0,this.editedFeatureCoordinateIndex=void 0,this.editedInsertIndex=void 0,this.editedSnapType=void 0,this.currentCoordinate=0,"drawing"===this.state&&this.setStarted(),e&&this.coordinatePoints.deletePointsByFeatureIds([e]),this.mutateFeature.deleteFeatureIfPresent(e),this.mutateFeature.deleteFeatureIfPresent(i),this.mutateFeature.deleteFeatureIfPresent(t),this.closingPoints.ids.length&&this.closingPoints.delete()}
1styleFeature(e){let t=r({},{polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0,markerUrl:void 0,markerHeight:void 0,markerWidth:void 0});if(e.properties.mode===this.mode){if("Polygon"===e.geometry.type)return t.polygonFillColor=this.getHexColorStylingValue(this.styles.fillColor,t.polygonFillColor,e),t.polygonOutlineColor=this.getHexColorStylingValue(this.styles.outlineColor,t.polygonOutlineColor,e),t.polygonOutlineWidth=this.getNumericStylingValue(this.styles.outlineWidth,t.polygonOutlineWidth,e),t.polygonFillOpacity=this.getNumericStylingValue(this.styles.fillOpacity,t.polygonFillOpacity,e),t.zIndex=10,t;if("Point"===e.geometry.type){let i=e.properties[a.EDITED],r=e.properties[a.COORDINATE_POINT],o=i?"editedPoint":e.properties[a.CLOSING_POINT]?"closingPoint":e.properties[a.SNAPPING_POINT]?"snappingPoint":r?"coordinatePoint":void 0;if(!o)return t;let n={editedPoint:{width:this.styles.editedPointOutlineWidth,color:this.styles.editedPointColor,outlineColor:this.styles.editedPointOutlineColor,outlineWidth:this.styles.editedPointOutlineWidth},closingPoint:{width:this.styles.closingPointWidth,color:this.styles.closingPointColor,outlineColor:this.styles.closingPointOutlineColor,outlineWidth:this.styles.closingPointOutlineWidth},snappingPoint:{width:this.styles.snappingPointWidth,color:this.styles.snappingPointColor,outlineColor:this.styles.snappingPointOutlineColor,outlineWidth:this.styles.snappingPointOutlineWidth},coordinatePoint:{width:this.styles.coordinatePointWidth,color:this.styles.coordinatePointColor,outlineColor:this.styles.coordinatePointOutlineColor,outlineWidth:this.styles.coordinatePointOutlineWidth}};return t.pointWidth=this.getNumericStylingValue(n[o].width,t.pointWidth,e),t.pointColor=this.getHexColorStylingValue(n[o].color,t.pointColor,e),t.pointOutlineColor=this.getHexColorStylingValue(n[o].outlineColor,t.pointOutlineColor,e),t.pointOutlineWidth=this.getNumericStylingValue(n[o].outlineWidth,2,e),t.zIndex=i?40:r?20:30,t}}return t}afterFeatureAdded(e){this.showCoordinatePoints&&this.coordinatePoints.createOrUpdate({featureId:e.id,featureCoordinates:e.geometry.coordinates})}afterFeatureUpdated(e){this.showCoordinatePoints&&this.coordinatePoints.createOrUpdate({featureId:e.id,featureCoordinates:e.geometry.coordinates}),this.editedFeatureId===e.id&&this.editedPointId&&(this.mutateFeature.deleteFeatureIfPresent(this.editedPointId),this.editedPointId=void 0,this.editedFeatureId=void 0,this.editedFeatureCoordinateIndex=void 0,this.editedSnapType=void 0),this.snappedPointId&&this.lastMouseMoveEvent&&this.updateSnappedCoordinate(this.lastMouseMoveEvent),this.currentId===e.id&&(this.currentCoordinate=0,this.currentId=void 0,this.closingPoints.delete(),"drawing"===this.state&&this.setStarted())}validateFeature(e){return this.validateModeFeature(e,e=>_(e,this.coordinatePrecision))}}let ee=(e,t,i)=>{let r=(e,t)=>(e=>e*e)(e.x-t.x)+(e=>e*e)(e.y-t.y);return Math.sqrt(((e,t,i)=>{let o=r(t,i);if(0===o)return r(e,t);let n=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/o;return n=Math.max(0,Math.min(1,n)),r(e,{x:t.x+n*(i.x-t.x),y:t.y+n*(i.y-t.y)})})(e,t,i))};class et extends c{constructor(...e){super(...e),this.type=ex.Static,this.mode="static"}start(){}stop(){}onKeyUp(){}onKeyDown(){}onClick(){}onDragStart(){}onDrag(){}onDragEnd(){}onMouseMove(){}cleanUp(){}
1styleFeature(){return r({},{polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0,markerUrl:void 0,markerHeight:void 0,markerWidth:void 0})}}function ei(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function er(e,t){eo(e,0,e.children.length,t,e)}function eo(e,t,i,r,o){o||(o=ec([])),o.minX=1/0,o.minY=1/0,o.maxX=-1/0,o.maxY=-1/0;for(let n=t;n<i;n++){let t=e.children[n];en(o,e.leaf?r(t):t)}return o}function en(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function es(e,t){return e.minX-t.minX}function ea(e,t){return e.minY-t.minY}function ed(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function eh(e){return e.maxX-e.minX+(e.maxY-e.minY)}function el(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function eu(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function ec(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ep(e,t,i,r,o){let n=[t,i];for(;n.length;){if((i=n.pop())-(t=n.pop())<=r)continue;let s=t+Math.ceil((i-t)/r/2)*r;(function e(t,i,r,o,n){for(;o>r;){if(o-r>600){let s=o-r+1,a=i-r+1,d=Math.log(s),h=.5*Math.exp(2*d/3),l=.5*Math.sqrt(d*h*(s-h)/s)*(a-s/2<0?-1:1);e(t,i,Math.max(r,Math.floor(i-a*h/s+l)),Math.min(o,Math.floor(i+(s-a)*h/s+l)),n)}let s=t[i],a=r,d=o;for(ei(t,r,i),n(t[o],s)>0&&ei(t,r,o);a<d;){for(ei(t,a,d),a++,d--;0>n(t[a],s);)a++;for(;n(t[d],s)>0;)d--}0===n(t[r],s)?ei(t,r,d):ei(t,++d,o),d<=i&&(r=d+1),i<=d&&(o=d-1)}})(e,s,t,i,o),n.push(t,s,s,i)}}class eg{constructor(e){this._maxEntries=void 0,this._minEntries=void 0,this.data=void 0,this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}search(e){let t=this.data,i=[];if(!eu(e,t))return i;let r=this.toBBox,o=[];for(;t;){for(let n=0;n<t.children.length;n++){let s=t.children[n],a=t.leaf?r(s):s;eu(e,a)&&(t.leaf?i.push(s):el(e,a)?this._all(s,i):o.push(s))}t=o.pop()}return i}collides(e){let t=this.data;if(eu(e,t)){let i=[];for(;t;){for(let r=0;r<t.children.length;r++){let o=t.children[r],n=t.leaf?this.toBBox(o):o;if(eu(e,n)){if(t.leaf||el(e,n))return!0;i.push(o)}}t=i.pop()}}return!1}load(e){if(e.length<this._minEntries){for(let t=0;t<e.length;t++)this.insert(e[t]);return}let t=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let e=this.data;this.data=t,t=e}this._insert(t,this.data.height-t.height-1,!0)}else this.data=t}insert(e){this._insert(e,this.data.height-1)}clear(){this.data=ec([])}remove(e){let t=this.data,i=this.toBBox(e),r=[],o=[],n,s,a=!1;for(;t||r.length;){if(t||(t=r.pop(),s=r[r.length-1],n=o.pop(),a=!0),t.leaf){let i=t.children.indexOf(e);-1!==i&&(t.children.splice(i,1),r.push(t),this._condense(r))}a||t.leaf||!el(t,i)?s?(n++,t=s.children[n],a=!1):t=null:(r.push(t),o.push(n),n=0,s=t,t=t.children[0])}}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}_all(e,t){let i=[];for(;e;)e.leaf?t.push(...e.children):i.push(...e.children),e=i.pop();return t}_build(e,t,i,r){let o=i-t+1,n,s=this._maxEntries;if(o<=s)return er(n=ec(e.slice(t,i+1)),this.toBBox),n;r||(r=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/Math.pow(s,r-1))),(n=ec([])).leaf=!1,n.height=r;let a=Math.ceil(o/s),d=a*Math.ceil(Math.sqrt(s));ep(e,t,i,d,this.compareMinX);for(let o=t;o<=i;o+=d){let t=Math.min(o+d-1,i);ep(e,o,t,a,this.compareMinY);for(let i=o;i<=t;i+=a){let o=Math.min(i+a-1,t);n.children.push(this._build(e,i,o,r-1))}}return er(n,this.toBBox),n}_chooseSubtree(e,t,i,r){for(;r.push(t),!t.leaf&&r.length-1!==i;){let i,r=1/0,o=1/0;for(let n=0;n<t.children.length;n++){let s=t.children[n],a=ed(s),d=(Math.max(s.maxX,e.maxX)-Math.min(s.minX,e.minX))*(Math.max(s.maxY,e.maxY)-Math.min(s.minY,e.minY))-a;d<o?(o=d,r=a<r?a:r,i=s):d===o&&a<r&&(r=a,i=s)}t=i||t.children[0]}return t}_insert(e,t,i){let r=i?e:this.toBBox(e),o=[],n=this._chooseSubtree(r,this.data,t,o);for(n.children.push(e),en(n,r);t>=0&&o[t].children.length>this._maxEntries;)this._split(o,t),t--;this._adjustParentBBoxes(r,o,t)}_split(e,t){let i=e[t],r=i.children.length,o=this._minEntries;this._chooseSplitAxis(i,o,r);let n=this._chooseSplitIndex(i,o,r),s=ec(i.children.splice(n,i.children.length-n));s.height=i.height,s.leaf=i.leaf,er(i,this.toBBox),er(s,this.toBBox),t?e[t-1].children.push(s):this._splitRoot(i,s)}_splitRoot(e,t){this.data=ec([e,t]),this.data.height=e.height+1,this.data.leaf=!1,er(this.data,this.toBBox)}_chooseSplitIndex(e,t,i){let r,o=1/0,n=1/0;for(let s=t;s<=i-t;s++){let t=eo(e,0,s,this.toBBox),a=eo(e,s,i,this.toBBox),d=function(e,t){let i=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY);return Math.max(0,Math.min(e.maxX,t.maxX)-i)*Math.max(0,Math.min(e.maxY,t.maxY)-r)}(t,a),h=ed(t)+ed(a);d<o?(o=d,r=s,n=h<n?h:n):d===o&&h<n&&(n=h,r=s)}return r||i-t}_chooseSplitAxis(e,t,i){let r=e.leaf?this.compareMinX:es,o=e.leaf?this.compareMinY:ea;this._allDistMargin(e,t,i,r)<this._allDistMargin(e,t,i,o)&&e.children.sort(r)}_allDistMargin(e,t,i,r){e.children.sort(r);let o=this.toBBox,n=eo(e,0,t,o),s=eo(e,i-t,i,o),a=eh(n)+eh(s);for(let r=t;r<i-t;r++){let t=e.children[r];en(n,e.leaf?o(t):t),a+=eh(n)}for(let r=i-t-1;r>=t;r--){let t=e.children[r];en(s,e.leaf?o(t):t),a+=eh(s)}return a}_adjustParentBBoxes(e,t,i){for(let r=i;r>=0;r--)en(t[r],e)}_condense(e){for(let t,i=e.length-1;i>=0;i--)0===e[i].children.length?i>0?(t=e[i-1].children).splice(t.indexOf(e[i]),1):this.clear():er(e[i],this.toBBox)}}class ey{constructor(e){this.tree=void 0,this.idToNode=void 0,this.nodeToId=void 0,this.tree=new eg(e&&e.maxEntries?e.maxEntries:9),this.idToNode=new Map,this.nodeToId=new Map}setMaps(e,t){this.idToNode.set(e.id,t),this.nodeToId.set(t,e.id)}toBBox(e){let t,i=[],r=[];if("Polygon"===e.geometry.type)t=e.geometry.coordinates[0];else if("LineString"===e.geometry.type)t=e.geometry.coordinates;else{if("Point"!==e.geometry.type)throw Error("Not a valid feature to turn into a bounding box");t=[e.geometry.coordinates]}for(let e=0;e<t.length;e++)r.push(t[e][1]),i.push(t[e][0]);return{minX:Math.min(...i),minY:Math.min(...r),maxX:Math.max(...i),maxY:Math.max(...r)}}insert(e){if(this.idToNode.get(String(e.id)))throw Error("Feature already exists");let t=this.toBBox(e);this.setMaps(e,t),this.tree.insert(t)}load(e){let t=[],i=new Set;
1e.forEach(e=>{let r=this.toBBox(e);if(this.setMaps(e,r),i.has(String(e.id)))throw Error(`Duplicate feature ID found ${e.id}`);i.add(String(e.id)),t.push(r)}),this.tree.load(t)}update(e){this.remove(e.id);let t=this.toBBox(e);this.setMaps(e,t),this.tree.insert(t)}remove(e){let t=this.idToNode.get(e);if(!t)throw Error(`${e} not inserted into the spatial index`);this.tree.remove(t)}clear(){this.tree.clear()}search(e){return this.tree.search(this.toBBox(e)).map(e=>this.nodeToId.get(e))}collides(e){return this.tree.collides(this.toBBox(e))}}let em={getId:()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}),isValidId:e=>"string"==typeof e&&36===e.length},ef={target:"geometry"},ev={target:"properties"};class eP{constructor(e){this.idStrategy=void 0,this.tracked=void 0,this.spatialIndex=void 0,this.store=void 0,this._onChange=()=>{},this.store={},this.spatialIndex=new ey,this.tracked=!e||!1!==e.tracked,this.idStrategy=e&&e.idStrategy?e.idStrategy:em}clone(e){return JSON.parse(JSON.stringify(e))}getId(){return this.idStrategy.getId()}has(e){return!!this.store[e]}load(e,t,i,r){if(0===e.length)return[];let o=this.clone(e),n=[],s=[];o=o.filter(e=>{null==e.id&&(e.id=this.idStrategy.getId());let i=e.id;if(t){let r=t(e);if(!r.valid)return n.push({id:i,valid:!1,reason:r.reason}),!1}if(this.tracked){if(e.properties.createdAt){if(!l(e.properties.createdAt))return n.push({id:e.id,valid:!1,reason:"createdAt is not a valid numeric timestamp"}),!1}else e.properties.createdAt=+new Date;if(e.properties.updatedAt){if(!l(e.properties.updatedAt))return n.push({id:e.id,valid:!1,reason:"updatedAt is not a valid numeric timestamp"}),!1}else e.properties.updatedAt=+new Date}return this.has(i)?(n.push({id:i,valid:!1,reason:`Feature already exists with this id: ${i}`}),!1):(this.store[i]=e,s.push(e),n.push({id:i,valid:!0}),!0)}),this.spatialIndex.load(o);let a=s.map(({id:e})=>e);return a.length>0&&(this._onChange(a,"create",r),i&&s.forEach(e=>{i(e)})),n}search(e,t){let i=this.spatialIndex.search(e).map(e=>this.store[e]);return this.clone(t?i.filter(t):i)}registerOnChange(e){this._onChange=(t,i,r)=>{e(t,i,r)}}getGeometryCopy(e){let t=this.store[e];if(!t)throw Error(`No feature with this id (${e}), can not get geometry copy`);return this.clone(t.geometry)}getPropertiesCopy(e){let t=this.store[e];if(!t)throw Error(`No feature with this id (${e}), can not get properties copy`);return this.clone(t.properties)}updateProperty(e,t){let i=new Set;e.forEach(({id:e,property:t,value:r})=>{let o=this.store[e];if(!o)throw Error(`No feature with this (${e}), can not update geometry`);o.properties[t]!==r&&(i.add(e),void 0===r?delete o.properties[t]:o.properties[t]=r,this.tracked&&(o.properties.updatedAt=+new Date))}),this._onChange&&i.size>0&&this._onChange(Array.from(i),"update",t?r({},t,ev):ev)}updateGeometry(e,t){let i=new Set;e.forEach(({id:e,geometry:t})=>{i.add(e);let r=this.store[e];if(!r)throw Error(`No feature with this (${e}), can not update geometry`);r.geometry=this.clone(t),this.spatialIndex.update(r),this.tracked&&(r.properties.updatedAt=+new Date)}),this._onChange&&i.size>0&&this._onChange(Array.from(i),"update",t?r({},t,ef):ef)}create(e,t){let i=[];return e.forEach(({geometry:e,properties:t})=>{let o,n=r({},t);this.tracked&&(o=+new Date,t?(n.createdAt="number"==typeof t.createdAt?t.createdAt:o,n.updatedAt="number"==typeof t.updatedAt?t.updatedAt:o):n={createdAt:o,updatedAt:o});let s=this.getId(),a={id:s,type:"Feature",geometry:e,properties:n};this.store[s]=a,this.spatialIndex.insert(a),i.push(s)}),this._onChange&&this._onChange([...i],"create",t),i}delete(e,t){e.forEach(e=>{if(!this.store[e])throw Error(`No feature with id ${e}, can not delete`);delete this.store[e],this.spatialIndex.remove(e)}),this._onChange&&this._onChange([...e],"delete",t)}copy(e){return this.clone(this.store[e])}copyAll(){return this.clone(Object.keys(this.store).map(e=>this.store[e]))}copyAllWhere(e){return this.clone(Object.keys(this.store).map(e=>this.store[e]).filter(t=>t.properties&&e(t.properties)))}clear(){this.store={},this.spatialIndex.clear()}size(){return Object.keys(this.store).length}}class eI{constructor({name:e,callback:t,unregister:i,register:r}){this.name=void 0,this.callback=void 0,this.registered=!1,this.register=void 0,this.unregister=void 0,this.name=e,this.register=()=>{this.registered||(this.registered=!0,r(t))},this.unregister=()=>{this.register&&(this.registered=!1,i(t))},this.callback=t}}var eC,ex,e_={__proto__:null,GeoJSONStore:eP,TerraDrawBaseDrawMode:c,TerraDrawBaseSelectMode:p,TerraDrawBaseAdapter
1:class{constructor(e){this._nextKeyUpIsContextMenu=!1,this._lastPointerDownEventTarget=void 0,this._ignoreMismatchedPointerEvents=!1,this._minPixelDragDistance=void 0,this._minPixelDragDistanceDrawing=void 0,this._minPixelDragDistanceSelecting=void 0,this._lastDrawEvent=void 0,this._coordinatePrecision=void 0,this._heldKeys=new Set,this._listeners=[],this._dragState="not-dragging",this._currentModeCallbacks=void 0,this._ignoreMismatchedPointerEvents="boolean"==typeof e.ignoreMismatchedPointerEvents&&e.ignoreMismatchedPointerEvents,this._minPixelDragDistance="number"==typeof e.minPixelDragDistance?e.minPixelDragDistance:1,this._minPixelDragDistanceSelecting="number"==typeof e.minPixelDragDistanceSelecting?e.minPixelDragDistanceSelecting:1,this._minPixelDragDistanceDrawing="number"==typeof e.minPixelDragDistanceDrawing?e.minPixelDragDistanceDrawing:8,this._coordinatePrecision="number"==typeof e.coordinatePrecision?e.coordinatePrecision:9}getButton(e){return -1===e.button?"neither":0===e.button?"left":1===e.button?"middle":2===e.button?"right":"neither"}getMapElementXYPosition(e){let{left:t,top:i}=this.getMapEventElement(e.type).getBoundingClientRect();return{containerX:e.clientX-t,containerY:e.clientY-i}}getDrawEventFromEvent(e,t=!1){let i=this.getLngLatFromEvent(e);if(!i)return null;let{lng:r,lat:o}=i,{containerX:n,containerY:s}=this.getMapElementXYPosition(e),a=this.getButton(e),d=Array.from(this._heldKeys);return{lng:f(r,this._coordinatePrecision),lat:f(o,this._coordinatePrecision),containerX:n,containerY:s,button:a,heldKeys:d,isContextMenu:t}}register(e){this._currentModeCallbacks=e,this._listeners=this.getAdapterListeners(),this._listeners.forEach(e=>{e.register()})}getCoordinatePrecision(){return this._coordinatePrecision}getAdapterListeners(){return[new eI({name:"pointerdown",callback:e=>{if(!this._currentModeCallbacks||!e.isPrimary)return;let t=this.getDrawEventFromEvent(e);t&&(this._dragState="pre-dragging",this._lastDrawEvent=t,this._lastPointerDownEventTarget=e.target?e.target:void 0)},register:e=>{this.getMapEventElement("pointerdown").addEventListener("pointerdown",e)},unregister:e=>{this.getMapEventElement("pointerdown").removeEventListener("pointerdown",e)}}),new eI({name:"pointermove",callback:e=>{if(!this._currentModeCallbacks||!e.isPrimary)return;e.preventDefault();let t=this.getDrawEventFromEvent(e);if(t)if("not-dragging"===this._dragState)this._currentModeCallbacks.onMouseMove(t),this._lastDrawEvent=t;else if("pre-dragging"===this._dragState){if(!this._lastDrawEvent)return;let e={x:this._lastDrawEvent.containerX,y:this._lastDrawEvent.containerY},i={x:t.containerX,y:t.containerY},r=this._currentModeCallbacks.getState(),o=A(e,i);if("drawing"===r?o<this._minPixelDragDistanceDrawing:"selecting"===r?o<this._minPixelDragDistanceSelecting:o<this._minPixelDragDistance)return;this._nextKeyUpIsContextMenu=!1,this._dragState="dragging",this._currentModeCallbacks.onDragStart(t,e=>{this.setDraggability.bind(this)(e)})}else"dragging"===this._dragState&&this._currentModeCallbacks.onDrag(t,e=>{this.setDraggability.bind(this)(e)})},register:e=>{this.getMapEventElement("pointermove").addEventListener("pointermove",e)},unregister:e=>{this.getMapEventElement("pointermove").removeEventListener("pointermove",e)}}),new eI({name:"contextmenu",callback:e=>{this._currentModeCallbacks&&(e.preventDefault(),this._nextKeyUpIsContextMenu=!0)},register:e=>{this.getMapEventElement("contextmenu").addEventListener("contextmenu",e)},unregister:e=>{this.getMapEventElement("contextmenu").removeEventListener("contextmenu",e)}}),new eI({name:"pointerup",callback:e=>{if(!this._currentModeCallbacks||e.target!==this.getMapEventElement("pointerup")||this._ignoreMismatchedPointerEvents&&this._lastPointerDownEventTarget!==e.target||(this._lastPointerDownEventTarget=void 0,!e.isPrimary))return;let t=this.getDrawEventFromEvent(e);t&&("dragging"===this._dragState?this._currentModeCallbacks.onDragEnd(t,e=>{this.setDraggability.bind(this)(e)}):"not-dragging"!==this._dragState&&"pre-dragging"!==this._dragState||(this._nextKeyUpIsContextMenu&&(t.isContextMenu=!0,this._nextKeyUpIsContextMenu=!1),this._currentModeCallbacks.onClick(t)),this._dragState="not-dragging",this.setDraggability(!0))},register:e=>{this.getMapEventElement("pointerup").addEventListener("pointerup",e)},unregister:e=>{this.getMapEventElement("pointerup").removeEventListener("pointerup",e)}}),new eI({name:"keyup",callback:e=>{this._currentModeCallbacks&&(this._heldKeys.delete(e.key),this._currentModeCallbacks.onKeyUp({key:e.key,heldKeys:Array.from(this._heldKeys),preventDefault:()=>e.preventDefault()}))},register:e=>{this.getMapEventElement("keyup").addEventListener("keyup",e)},unregister:e=>{this.getMapEventElement("keyup").removeEventListener("keyup",e)}}),new eI({name:"keydown",callback:e=>{this._currentModeCallbacks&&(this._heldKeys.add(e.key),this._currentModeCallbacks.onKeyDown({key:e.key,heldKeys:Array.from(this._heldKeys),preventDefault:()=>e.preventDefault()}))},register:e=>{this.getMapEventElement("keydown").addEventListener("keydown",e)},unregister:e=>{this.getMapEventElement("keydown").removeEventListener("keydown",e)}})]}
1unregister(){this._listeners.forEach(e=>{e.unregister()}),this.clear(),this._currentModeCallbacks=void 0,this._lastDrawEvent=void 0,this._lastPointerDownEventTarget=void 0,this._nextKeyUpIsContextMenu=!1}},getDefaultStyling:()=>({polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0,markerUrl:void 0,markerHeight:void 0,markerWidth:void 0}),SELECT_PROPERTIES:s};class eE{constructor(e){this._modes=void 0,this._mode=void 0,this._adapter=void 0,this._enabled=!1,this._store=void 0,this._eventListeners=void 0,this._instanceSelectMode=void 0,this._adapter=e.adapter,this._mode=new et;let t=new Set,i=e.modes.reduce((e,i)=>{if(t.has(i.mode))throw Error(`There is already a ${i.mode} mode provided`);return t.add(i.mode),e[i.mode]=i,e},{}),o=Object.keys(i);if(0===o.length)throw Error("No modes provided");o.forEach(e=>{if(i[e].type===ex.Select){if(this._instanceSelectMode)throw Error("only one type of select mode can be provided");this._instanceSelectMode=e}}),this._modes=r({},i,{static:this._mode}),this._eventListeners={change:[],select:[],deselect:[],finish:[],ready:[]},this._store=new eP({tracked:!!e.tracked,idStrategy:e.idStrategy?e.idStrategy:void 0});let n=e=>{let t=[],i=this._store.copyAll().filter(i=>!e.includes(i.id)||(t.push(i),!1));return{changed:t,unchanged:i}},s=(e,t)=>{this._enabled&&this._eventListeners.finish.forEach(i=>{i(e,t)})},a=(e,t,i)=>{if(!this._enabled)return;this._eventListeners.change.forEach(r=>{r(e,t,i)});let{changed:r,unchanged:o}=n(e);"create"===t?this._adapter.render({created:r,deletedIds:[],unchanged:o,updated:[]},this.getModeStyles()):"update"===t?this._adapter.render({created:[],deletedIds:[],unchanged:o,updated:r},this.getModeStyles()):"delete"===t?this._adapter.render({created:[],deletedIds:e,unchanged:o,updated:[]},this.getModeStyles()):"styling"===t&&this._adapter.render({created:[],deletedIds:[],unchanged:o,updated:[]},this.getModeStyles())},d=e=>{if(!this._enabled)return;this._eventListeners.select.forEach(t=>{t(e)});let{changed:t,unchanged:i}=n([e]);this._adapter.render({created:[],deletedIds:[],unchanged:i,updated:t},this.getModeStyles())},h=e=>{if(!this._enabled)return;this._eventListeners.deselect.forEach(e=>{e()});let{changed:t,unchanged:i}=n([e]);t&&this._adapter.render({created:[],deletedIds:[],unchanged:i,updated:t},this.getModeStyles())};Object.keys(this._modes).forEach(e=>{this._modes[e].register({mode:e,store:this._store,setCursor:this._adapter.setCursor.bind(this._adapter),project:this._adapter.project.bind(this._adapter),unproject:this._adapter.unproject.bind(this._adapter),setDoubleClickToZoom:this._adapter.setDoubleClickToZoom.bind(this._adapter),onChange:a,onSelect:d,onDeselect:h,onFinish:s,coordinatePrecision:this._adapter.getCoordinatePrecision()})})}checkEnabled(){if(!this._enabled)throw Error("Terra Draw is not enabled")}getModeStyles(){let e={};return Object.keys(this._modes).forEach(t=>{e[t]=e=>this._instanceSelectMode&&e.properties[s.SELECTED]?this._modes[this._instanceSelectMode].styleFeature.bind(this._modes[this._instanceSelectMode])(e):this._modes[t].styleFeature.bind(this._modes[t])(e)}),e}featuresAtLocation({lng:e,lat:t},i){let r=i&&void 0!==i.pointerDistance?i.pointerDistance:30,o=!i||void 0===i.ignoreSelectFeatures||i.ignoreSelectFeatures,n=!(!i||void 0===i.ignoreCoordinatePoints)&&i.ignoreCoordinatePoints,d=!(!i||void 0===i.ignoreCurrentlyDrawing)&&i.ignoreCurrentlyDrawing,h=!(!i||void 0===i.ignoreClosingPoints)&&i.ignoreClosingPoints,l=!(!i||void 0===i.ignoreSnappingPoints)&&i.ignoreSnappingPoints,u=this._adapter.unproject.bind(this._adapter),c=this._adapter.project.bind(this._adapter),p=c(e,t),y=R({unproject:u,point:p,pointerDistance:r});return this._store.search(y).filter(u=>{if(o&&(u.properties[s.MID_POINT]||u.properties[s.SELECTION_POINT])||n&&u.properties[a.COORDINATE_POINT]||h&&u.properties[a.CLOSING_POINT]||d&&u.properties[a.CURRENTLY_DRAWING]||l&&u.properties[a.SNAPPING_POINT])return!1;if("Point"===u.geometry.type){let e=u.geometry.coordinates;return A(p,c(e[0],e[1]))<r}if("LineString"===u.geometry.type){let e=u.geometry.coordinates;for(let t=0;t<e.length-1;t++){let i=e[t],o=e[t+1];if(ee(p,c(i[0],i[1]),c(o[0],o[1]))<r)return!0}return!1}if(function(e,t){var i,r;let o=!1;for(let n=0,s=t.length;n<s;n++){let s=t[n];for(let t=0,n=s.length,a=n-1;t<n;a=t++)(i=s[t])[1]>e[1]!=(r=s[a])[1]>e[1]&&e[0]<(r[0]-i[0])*(e[1]-i[1])/(r[1]-i[1])+i[0]&&(o=!o)}return o}([e,t],u.geometry.coordinates))return!0;
1if(null!=i&&i.includePolygonsWithinPointerDistance)for(let e of u.geometry.coordinates)for(let t=0;t<e.length-1;t++){let i=e[t],o=e[t+1];if(ee(p,c(i[0],i[1]),c(o[0],o[1]))<r)return!0}return!1}).map(r=>{let o;if(null==i||!i.addClosestCoordinateInfoToProperties)return r;if("Polygon"===r.geometry.type)o=r.geometry.coordinates[0].slice(0,-1);else{if("LineString"!==r.geometry.type)return r;o=r.geometry.coordinates}let n,s=-1,a=1/0;for(let e=0;e<o.length;e++){let t=o[e],i=A(c(t[0],t[1]),p);i<a&&(s=e,a=i,n=t)}return r.properties.closestCoordinateIndexToEvent=s,r.properties.closestCoordinatePixelDistanceToEvent=a,r.properties.closestCoordinateDistanceKmToEvent=g(n,[e,t]),r})}getSelectModeOrThrow(){let e=this.getSelectMode({switchToSelectMode:!0});if(!e)throw Error("No select mode defined in instance");return e}getSelectMode({switchToSelectMode:e}){if(this.checkEnabled(),!this._instanceSelectMode)return null;let t=this.getMode();return e&&t!==this._instanceSelectMode&&this.setMode(this._instanceSelectMode),this._modes[this._instanceSelectMode]}isGuidanceFeature(e){return!!(e.properties[s.MID_POINT]||e.properties[s.SELECTION_POINT]||e.properties[a.COORDINATE_POINT]||e.properties[a.SNAPPING_POINT])}setModeStyles(e,t){if(this.checkEnabled(),!this._modes[e])throw Error("No mode with this name present");this._modes[e].styles=t}updateModeOptions(e,t){if(this.checkEnabled(),!this._modes[e])throw Error("No mode with this name present");this._modes[e].updateOptions(t)}getSnapshot(){return this._store.copyAll()}getSnapshotFeature(e){if(this._store.has(e))return this._store.copy(e)}clear(){this.checkEnabled(),this._adapter.clear()}get enabled(){return this._enabled}set enabled(e){throw Error("Enabled is read only")}getMode(){return this._mode.mode}getModeState(){return this._mode.state}setMode(e){if(this.checkEnabled(),!this._modes[e])throw Error("No mode with this name present");this._mode.stop(),this._mode=this._modes[e],this._mode.start()}removeFeatures(e){let t;this.checkEnabled();let i=[],r=[];e.forEach(e=>{if(!this._store.has(e))throw Error(`No feature with id ${e}, can not delete`);let o=this._store.getPropertiesCopy(e);o[s.SELECTED]&&this.deselectFeature(e),o[a.CURRENTLY_DRAWING]&&this._modes[o.mode]?t=o.mode:(o[a.COORDINATE_POINT_IDS]&&i.push(...o[a.COORDINATE_POINT_IDS]),r.push(e))}),this._store.delete([...r,...i],{origin:"api"}),t&&this._modes[t]&&this._modes[t].cleanUp()&&this._modes[t].cleanUp()}selectFeature(e){this.getSelectModeOrThrow().selectFeature(e)}deselectFeature(e){this.getSelectModeOrThrow().deselectFeature(e)}getFeatureId(){return this._store.getId()}hasFeature(e){return this._store.has(e)}checkIsReservedProperty(e){return![...Object.values(s),...Object.values(a)].includes(e)}updateFeatureProperties(e,t){if(!this._store.has(e))throw Error(`No feature with id ${e} present in store`);let i=this._store.copy(e);if(this.isGuidanceFeature(i))throw Error("Guidance features are not allowed to be updated directly.");let r=i.properties.mode;if(!this._modes[r])throw Error(`No mode with name ${r} present in instance`);let o=Object.entries(t);o.forEach(([e,t])=>{if(!this.checkIsReservedProperty(e))throw Error(`You are trying to update a reserved property name: ${e}. Please choose another name.`);if(void 0!==t&&!function e(t){if(null===t||"boolean"==typeof t||"string"==typeof t)return!0;if(void 0===t)return!1;if("number"==typeof t)return Number.isFinite(t);if("bigint"==typeof t||"symbol"==typeof t||"function"==typeof t||t instanceof RegExp||t instanceof Map||t instanceof Set||t instanceof Date)return!1;if("object"==typeof t&&null!==t&&!Array.isArray(t)){let e=Object.getPrototypeOf(t);if(e!==Object.prototype&&null!==e)return!1}if(ArrayBuffer.isView(t)&&!(t instanceof DataView))return!1;if(Array.isArray(t)){for(let i of t)if(!e(i))return!1}return"object"==typeof t&&Object.keys(t).every(i=>"string"==typeof i&&e(t[i]))}(t))throw Error(`Invalid JSON value provided for property ${e}`)}),this._store.updateProperty(o.map(([e,t])=>({id:i.id,property:e,value:t})),{origin:"api"})}updateFeatureGeometry(e,t){if(!this._store.has(e))throw Error(`No feature with id ${e} present in store`);let i=this._store.copy(e);if(this.isGuidanceFeature(i))throw Error("Guidance features are not allowed to be updated directly.");if(!(i&&t&&t.type&&t.coordinates))throw Error("Invalid geometry provided");
1if(t.type!==i.geometry.type)throw Error(`Geometry type mismatch: expected ${i.geometry.type}, got ${t.type}`);let o=i.properties.mode,n=this._modes[o];if(!n)throw Error(`No mode with name ${o} present in instance`);let a=r({},i,{geometry:t}),d=n.validateFeature(a);if(!d.valid)throw Error(`Feature validation failed: ${d.reason||"Unknown reason"}`);if(this._store.updateGeometry([{id:i.id,geometry:t}],{origin:"api"}),n.afterFeatureUpdated){n.afterFeatureUpdated(a);let e=a.properties[s.SELECTED],t=this.getSelectMode({switchToSelectMode:!1});t&&e&&t.afterFeatureUpdated(a)}}transformFeatureGeometry(e,t){let i;if(!this._store.has(e))throw Error(`No feature with id ${e} present in store`);let r=this._store.copy(e);if(this.isGuidanceFeature(r))throw Error("Guidance features are not allowed to be updated directly.");let o=r.properties.mode,n=this._modes[o];if(!n)throw Error(`No mode with name ${o} present in instance`);if("Polygon"===r.geometry.type)i=r.geometry.coordinates[0];else{if("LineString"!==r.geometry.type)throw Error(`Feature geometry type ${r.geometry.type} is not supported for transformation`);i=r.geometry.coordinates}if("web-mercator"!=t.projection)throw Error(`Projection ${t.projection} is not currently supported for transformation`);if("scale"===t.type){let{x:e,y:r}=v(t.origin[0],t.origin[1]);!function({coordinates:e,originX:t,originY:i,xScale:r,yScale:o}){1===r&&1===o||e.forEach(e=>{let{x:n,y:s}=v(e[0],e[1]),{lng:a,lat:d}=P(t+(n-t)*r,i+(s-i)*o);e[0]=a,e[1]=d})}({coordinates:i,originX:e,originY:r,xScale:t.options.xScale||1,yScale:t.options.yScale||1})}else"rotate"===t.type&&(i="Polygon"===(r=((e,t)=>{if(0===t||360===t||-360===t)return e;let i=.017453292519943295*t,r=("Polygon"===e.geometry.type?e.geometry.coordinates[0]:e.geometry.coordinates).map(([e,t])=>v(e,t)),o=r.reduce((e,t)=>({x:e.x+t.x,y:e.y+t.y}),{x:0,y:0});o.x/=r.length,o.y/=r.length;let n=r.map(e=>({x:o.x+(e.x-o.x)*Math.cos(i)-(e.y-o.y)*Math.sin(i),y:o.y+(e.x-o.x)*Math.sin(i)+(e.y-o.y)*Math.cos(i)})).map(({x:e,y:t})=>[P(e,t).lng,P(e,t).lat]);return"Polygon"===e.geometry.type?e.geometry.coordinates[0]=n:e.geometry.coordinates=n,e})(r,t.options.angle||0)).geometry.type?r.geometry.coordinates[0]:r.geometry.coordinates);if(i=i.map(e=>[f(e[0],this._adapter.getCoordinatePrecision()),f(e[1],this._adapter.getCoordinatePrecision())]),r.geometry.coordinates="Polygon"===r.geometry.type?[i]:i,this._store.updateGeometry([{id:r.id,geometry:r.geometry}],{origin:"api"}),n.afterFeatureUpdated){n.afterFeatureUpdated(r);let e=r.properties[s.SELECTED],t=this.getSelectMode({switchToSelectMode:!1});t&&e&&t.afterFeatureUpdated(r)}}addFeatures(e){return this.checkEnabled(),0===e.length?[]:this._store.load(e,e=>{if(h(e)){let t=e.properties.mode,i=this._modes[t];if(!i)return{id:e.id,valid:!1,reason:`${t} mode is not in the list of instantiated modes`};let r=i.validateFeature.bind(i)(e);return{id:e.id,valid:r.valid,reason:r.reason?r.reason:r.valid?void 0:"Feature is invalid"}}return{id:e.id,valid:!1,reason:"Mode property does not exist"}},e=>{if(h(e)){let t=this._modes[e.properties.mode];t&&t.afterFeatureAdded&&t.afterFeatureAdded(e)}},{origin:"api"})}start(){this._enabled||(this._enabled=!0,this._adapter.register({onReady:()=>{this._eventListeners.ready.forEach(e=>{e()})},getState:()=>this._mode.state,onClick:e=>{this._mode.onClick(e)},onMouseMove:e=>{this._mode.onMouseMove(e)},onKeyDown:e=>{this._mode.onKeyDown(e)},onKeyUp:e=>{this._mode.onKeyUp(e)},onDragStart:(e,t)=>{this._mode.onDragStart(e,t)},onDrag:(e,t)=>{this._mode.onDrag(e,t)},onDragEnd:(e,t)=>{this._mode.onDragEnd(e,t)},onClear:()=>{this._mode.cleanUp(),this._store.clear()}}))}getFeaturesAtLngLat(e,t){let{lng:i,lat:r}=e;return this.featuresAtLocation({lng:i,lat:r},t)}getFeaturesAtPointerEvent(e,t){let i=this._adapter.getLngLatFromEvent.bind(this._adapter)(e);return null===i?[]:this.featuresAtLocation(i,t)}stop(){this._enabled&&(this._enabled=!1,this._adapter.unregister())}on(e,t){let i=this._eventListeners[e];i.includes(t)||i.push(t)}off(e,t){let i=this._eventListeners[e];i.includes(t)&&i.splice(i.indexOf(t),1)}}}}]); 2//# sourceMappingURL=0b726828-ca3e5b1c97631bcf.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.