@qaecy/cue-ui 0.0.32 → 0.0.34
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/112.js +1 -1
- package/170.js +1 -0
- package/36.js +1 -0
- package/418.js +1 -1
- package/446.js +1 -1
- package/493.js +1 -0
- package/571.js +1 -1
- package/627.js +1 -0
- package/828.js +1 -0
- package/common.js +1 -1
- package/index.js +1 -1
- package/main.js +1 -1
- package/package.json +1 -1
- package/240.js +0 -1
- package/360.js +0 -1
- package/613.js +0 -1
- package/645.js +0 -1
- package/741.js +0 -1
- package/911.js +0 -1
package/446.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[446],{503(ne,Y,l){var F=l(6119);function x(w){var v=0;if(w&&w.length>0){v+=Math.abs(A(w[0]));for(var T=1;T<w.length;T++)v-=Math.abs(A(w[T]))}return v}function A(w){var v,T,f,a,u,m,b=0,D=w.length;if(D>2){for(m=0;m<D;m++)m===D-2?(f=D-2,a=D-1,u=0):m===D-1?(f=D-1,a=0,u=1):(f=m,a=m+1,u=m+2),v=w[f],T=w[a],b+=(s(w[u][0])-s(v[0]))*Math.sin(s(T[1]));b=b*F.RADIUS*F.RADIUS/2}return b}function s(w){return w*Math.PI/180}ne.exports.geometry=function g(w){var T,v=0;switch(w.type){case"Polygon":return x(w.coordinates);case"MultiPolygon":for(T=0;T<w.coordinates.length;T++)v+=x(w.coordinates[T]);return v;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(T=0;T<w.geometries.length;T++)v+=g(w.geometries[T]);return v}},ne.exports.ring=A},5341(ne){ne.exports=function l(F){if(!F||!F.type)return null;var g=Y[F.type];return g?"geometry"===g?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:F}]}:"feature"===g?{type:"FeatureCollection",features:[F]}:"featurecollection"===g?F:void 0:null};var Y={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"}},3183(ne,Y,l){"use strict";l.d(Y,{A:()=>m});var F=l(7705),g=l(5802),x=l(9417),A=l(1359),s=l(8957),w=l(2245),v=l(5381),T=l(5547);const y=(b,D)=>D.value;function f(b,D){if(1&b){const c=T.RV6();T.j41(0,"cue-input",6),T.bIt("valueChange",function(N){g.eBV(c);const k=T.XpG();return k.searchText=N,g.Njj(k.onSearchChange())}),T.k0s()}if(2&b){const c=T.XpG();T.Y8G("value",c.searchText)}}function a(b,D){if(1&b){const c=T.RV6();T.j41(0,"cue-checkbox",7),T.bIt("checkedChange",function(N){const k=g.eBV(c).$implicit,H=T.XpG();return k.selected=N,g.Njj(H.onSelectionChange())}),T.k0s()}if(2&b){const c=D.$implicit;T.Y8G("label",c.value||"(blank)")("checked",c.selected)}}function u(b,D){1&b&&(T.j41(0,"cue-typography",5),T.EFF(1,"No results"),T.k0s())}let m=(()=>{class b{_cdr=(0,g.WQX)(F.gRc);_params;options=[];filteredOptions=[];searchText="";agInit(c){this._params=c}afterGuiAttached(c){this._refreshOptions(),this._cdr.markForCheck()}onNewRowsLoaded(){this._refreshOptions(),this._cdr.markForCheck()}isFilterActive(){return this.options.some(c=>!c.selected)}doesFilterPass(c){const P=new Set(this.options.filter(h=>h.selected).map(h=>h.value)),N=this._params.getValue(c.node),k=null==N?"":String(N);return"..."===k||"Loading..."===k||(""===k?P.has(""):k.split(", ").map(h=>h.trim()).some(h=>P.has(h)))}getModel(){return this.isFilterActive()?{selectedValues:this.options.filter(c=>c.selected).map(c=>c.value)}:null}setModel(c){if(c){const P=new Set(c.selectedValues);this.options.forEach(N=>N.selected=P.has(N.value))}else this.options.forEach(P=>P.selected=!0);this._applySearch(),this._cdr.markForCheck()}onSelectionChange(){this._params.filterChangedCallback(),this._cdr.markForCheck()}onSearchChange(){this._applySearch(),this._cdr.markForCheck()}get allSelected(){return this.options.length>0&&this.options.every(c=>c.selected)}toggleAll(c){this.options.forEach(P=>P.selected=c),this._applySearch(),this._params.filterChangedCallback(),this._cdr.markForCheck()}_refreshOptions(){const c=new Set;this._params.api.forEachNode(N=>{const k=this._params.getValue(N);if(null==k||""===k)c.add("");else{const H=String(k);if("..."===H||"Loading..."===H)return;const h=H.split(", ").map(S=>S.trim());for(const S of h)c.add(S)}});const P=new Map(this.options.map(N=>[N.value,N.selected]));this.options=Array.from(c).sort((N,k)=>N.localeCompare(k)).map(N=>({value:N,selected:P.get(N)??!0})),this._applySearch()}_applySearch(){const c=this.searchText.toLowerCase().trim();this.filteredOptions=c?this.options.filter(P=>P.value.toLowerCase().includes(c)):this.options}static \u0275fac=function(P){return new(P||b)};static \u0275cmp=T.VBU({type:b,selectors:[["cue-multi-select-filter"]],decls:7,vars:3,consts:[["direction","column","gap","s"],["placeholder","Search...","size","s",3,"value"],["size","s","label","Select all",3,"checkedChange","checked"],[1,"msf-list"],["size","s",3,"label","checked"],["size","s"],["placeholder","Search...","size","s",3,"valueChange","value"],["size","s",3,"checkedChange","label","checked"]],template:function(P,N){1&P&&(T.j41(0,"cue-flexcontainer",0),T.nVh(1,f,1,1,"cue-input",1),T.j41(2,"cue-checkbox",2),T.bIt("checkedChange",function(H){return N.toggleAll(H)}),T.k0s(),T.j41(3,"div",3),T.Z7z(4,a,1,2,"cue-checkbox",4,y),T.nVh(6,u,2,0,"cue-typography",5),T.k0s()()),2&P&&(T.R7$(),T.vxM(N.options.length>10?1:-1),T.R7$(),T.Y8G("checked",N.allSelected),T.R7$(2),T.Dyx(N.filteredOptions),T.R7$(2),T.vxM(0===N.filteredOptions.length?6:-1))},dependencies:[x.YN,A.S,s.p,w.Typography,v.n],styles:["[_nghost-%COMP%]{display:block;padding:var(--cue-card-padding-y) var(--cue-card-padding-x);min-width:200px;max-width:300px;box-sizing:border-box}.msf-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;max-height:200px;overflow-y:auto}"],changeDetection:0})}return b})()},5902(ne,Y,l){"use strict";l.d(Y,{U:()=>u});var F=l(7705),g=l(5802),x=l(2271),A=l(9352),s=l(8957),w=l(2444),v=l(2245),T=l(5381),y=l(5547);function f(m,b){if(1&m){const D=y.RV6();y.j41(0,"cue-input",4),y.bIt("valueChange",function(P){g.eBV(D);const N=y.XpG();return g.Njj(N.onValueChange(P))}),y.k0s()}if(2&m){const D=y.XpG();y.Y8G("value",D.filterText)}}function a(m,b){if(1&m){const D=y.RV6();y.j41(0,"cue-typography",5),y.bIt("click",function(){g.eBV(D);const P=y.XpG();return g.Njj(P.clear())}),y.EFF(1,"Clear"),y.k0s()}}let u=(()=>{class m{_cdr=(0,g.WQX)(F.gRc);_params;filterText="";filterType="contains";filterTypeOptions=["contains","notContains","equals","notEqual","startsWith","endsWith","blank","notBlank"];_labelContains=(0,A.Xx)("components.agGridColumnSelect.textFilterContains");_labelNotContains=(0,A.Xx)("components.agGridColumnSelect.textFilterNotContains");_labelEquals=(0,A.Xx)("components.agGridColumnSelect.textFilterEquals");_labelNotEqual=(0,A.Xx)("components.agGridColumnSelect.textFilterNotEqual");_labelStartsWith=(0,A.Xx)("components.agGridColumnSelect.textFilterStartsWith");_labelEndsWith=(0,A.Xx)("components.agGridColumnSelect.textFilterEndsWith");_labelBlank=(0,A.Xx)("components.agGridColumnSelect.textFilterBlank");_labelNotBlank=(0,A.Xx)("components.agGridColumnSelect.textFilterNotBlank");filterTypeLabelMap=(0,x.EW)(()=>({contains:this._labelContains(),notContains:this._labelNotContains(),equals:this._labelEquals(),notEqual:this._labelNotEqual(),startsWith:this._labelStartsWith(),endsWith:this._labelEndsWith(),blank:this._labelBlank(),notBlank:this._labelNotBlank()}));showTextInput=(0,x.EW)(()=>!["blank","notBlank"].includes(this.filterType));agInit(D){this._params=D}afterGuiAttached(D){this._cdr.markForCheck()}isFilterActive(){return!!["blank","notBlank"].includes(this.filterType)||this.filterText.trim().length>0}doesFilterPass(D){const c=this._params.getValue(D.node),P=null==c?"":String(c),N=this.filterText.toLowerCase().trim(),k=P.toLowerCase();switch(this.filterType){case"contains":default:return k.includes(N);case"notContains":return!k.includes(N);case"equals":return k===N;case"notEqual":return k!==N;case"startsWith":return k.startsWith(N);case"endsWith":return k.endsWith(N);case"blank":return""===P;case"notBlank":return""!==P}}getModel(){return this.isFilterActive()?{filterType:"text",type:this.filterType,filter:this.filterText}:null}setModel(D){this.filterText=D?.filter??"",this.filterType=D?.type??"contains",this._cdr.markForCheck()}onValueChange(D){this.filterText=D,this._params.filterChangedCallback(),this._cdr.markForCheck()}onFilterTypeChange(D){this.filterType=String(D||"contains"),["blank","notBlank"].includes(this.filterType)&&(this.filterText=""),this._params.filterChangedCallback(),this._cdr.markForCheck()}clear(){this.filterText="",this.filterType="contains",this._params.filterChangedCallback(),this._cdr.markForCheck()}static \u0275fac=function(c){return new(c||m)};static \u0275cmp=y.VBU({type:m,selectors:[["cue-text-filter"]],decls:4,vars:5,consts:[["direction","column","gap","s"],["size","s",3,"valueChange","value","options","labelMap"],["placeholder","Filter...","size","s",3,"value"],["size","s",2,"cursor","pointer","text-align","right"],["placeholder","Filter...","size","s",3,"valueChange","value"],["size","s",2,"cursor","pointer","text-align","right",3,"click"]],template:function(c,P){1&c&&(y.j41(0,"cue-flexcontainer",0)(1,"cue-select",1),y.bIt("valueChange",function(k){return P.onFilterTypeChange(k)}),y.k0s(),y.nVh(2,f,1,1,"cue-input",2),y.nVh(3,a,2,0,"cue-typography",3),y.k0s()),2&c&&(y.R7$(),y.Y8G("value",P.filterType)("options",P.filterTypeOptions)("labelMap",P.filterTypeLabelMap()),y.R7$(),y.vxM(P.showTextInput()?2:-1),y.R7$(),y.vxM(P.filterText||"contains"!==P.filterType?3:-1))},dependencies:[s.p,w.l,v.Typography,T.n],styles:["[_nghost-%COMP%]{display:block;padding:var(--cue-card-padding-y) var(--cue-card-padding-x);min-width:180px;max-width:280px;box-sizing:border-box}"],changeDetection:0})}return m})()},6756(ne,Y,l){"use strict";l.d(Y,{BK:()=>F,In:()=>y,Kz:()=>f,Mc:()=>u,U6:()=>x,g0:()=>m,g8:()=>A,r:()=>g,u9:()=>w});const F=["#2B5DE6","#1A2B50","#C5E045","#6FA8FF","#00C2E0","#5847EB","#008585","#4ADE80","#0F4C81","#8B5CF6","#FACC15","#FB923C","#F43F5E","#E879F9","#D97706","#334155","#64748B","#94A3B8","#C7D2FE","#F8FAFC"];function g(c){switch(c){case"primary":default:return"#2859e1";case"accent":return"#e2f552";case"tertiary":return"#ffffff"}}function x(c){switch(c){case"primary":default:return"#1744c2";case"accent":return"#b8cc3f";case"tertiary":return"#eeeeee"}}function A(c){const[P,N,k]=function s(c,P){if(void 0===c)return[];const k=window.getComputedStyle(c.nativeElement);return P.map(H=>k.getPropertyValue(H).trim()||"")}(c,["--cue-chart-text-color","--cue-chart-border-background-color","--chart-graph-edge-color"]);return{text:P,borderBackground:N,edgeColor:k}}const w={fontFamily:"Poppins, sans-serif",fontWeight:"normal",color:"#333"};function y(c){return c>=1e6?`${(c/1e6).toFixed(1)}m`:c>=1e3?`${(c/1e3).toFixed(0)}k`:c.toString()}function f(c,P,N,k){if(1===k)return c;const H=b(c),h=b(P),S=N/(k-1);return`rgb(${Math.round(H.r+(h.r-H.r)*S)}, ${Math.round(H.g+(h.g-H.g)*S)}, ${Math.round(H.b+(h.b-H.b)*S)})`}const u=(c,P)=>void 0===P?c:P.children??[];function m(c,P,N=.05,k="Other"){const H=c.reduce((R,O)=>R+D(O),0),h=[],S=[];if(c.forEach(R=>{let O,V;O=void 0===R.value&&Array.isArray(R.children)&&R.children.length>0?R.children.reduce((j,J)=>j+D(J),0):void 0!==R.value?R.value:0,Array.isArray(R.children)&&R.children.length>0&&(V=m(R.children,P,N,k));const K={...R,value:O,children:V};P&&H>0&&O/H<N?S.push(K):h.push(K)}),P&&S.length>0){const R=S.reduce((O,V)=>O+V.value,0);h.push({id:"__grouped_small__",name:k,value:R,children:S,isGroup:!0})}return h}function b(c){const P=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(c);return P?{r:parseInt(P[1],16),g:parseInt(P[2],16),b:parseInt(P[3],16)}:{r:0,g:0,b:0}}function D(c){return"number"==typeof c.value?c.value:Array.isArray(c.children)&&c.children.length>0?c.children.reduce((P,N)=>P+D(N),0):0}},4853(ne,Y,l){"use strict";l.d(Y,{H:()=>c});var F=l(7705),g=l(5802),x=l(7089),A=l(7023),s=l(5381),w=l(5971),v=l(3319),T=l(356),y=l(6279),f=l(5547);const a=()=>({position:"bottomleft"}),u=(P,N)=>N.label||P;function m(P,N){if(1&P){const k=f.RV6();f.j41(0,"cue-menu-item",4),f.bIt("click",function(){const h=g.eBV(k).$implicit;return g.Njj(h.action())}),f.EFF(1),f.k0s()}if(2&P){const k=N.$implicit;f.Y8G("selected",k.selected),f.R7$(),f.JRh(k.label)}}function b(P,N){if(1&P&&(f.j41(0,"cue-menu-wrap"),f.Z7z(1,m,2,2,"cue-menu-item",3,u),f.k0s()),2&P){const k=f.XpG();f.R7$(),f.Dyx(k.contextMenuItems())}}function D(P,N){if(1&P){const k=f.RV6();f.j41(0,"cue-button",5),f.bIt("click",function(h){const S=g.eBV(k).$implicit,R=f.XpG();return g.Njj(R.handleClick(h,S))}),f.nrm(1,"cue-button-icon",6),f.k0s()}if(2&P){const k=N.$implicit,H=f.XpG(),h=f.sdS(1);f.Y8G("cueTooltip",k.label)("variant",k.variant?k.variant:H.variant())("size",H.size())("cueContextMenu",h)("contextMenuData",f.lJ4(7,a))("cueContextEnabled",void 0!==k.contextMenuItems&&k.contextMenuItems.length>0),f.R7$(),f.Y8G("icon",k.icon)}}let c=(()=>{class P{items=F.hFB.required();noGap=(0,F.hFB)(!0);direction=(0,F.hFB)("row");size=(0,F.hFB)("xs");variant=(0,F.hFB)("tertiary");mouseEnter=(0,F.CGW)();mouseLeave=(0,F.CGW)();contextMenuItems=(0,g.vPA)([]);handleClick(k,H){k.stopPropagation(),H.contextMenuItems&&H.contextMenuItems.length>0?this.contextMenuItems.set(H.contextMenuItems):H.action&&(this.contextMenuItems.set([]),H.action())}static \u0275fac=function(H){return new(H||P)};static \u0275cmp=f.VBU({type:P,selectors:[["cue-entity-menu"]],inputs:{items:[1,"items"],noGap:[1,"noGap"],direction:[1,"direction"],size:[1,"size"],variant:[1,"variant"]},outputs:{mouseEnter:"mouseEnter",mouseLeave:"mouseLeave"},decls:5,vars:2,consts:[["contextMenu",""],["gap","s","justify","end",2,"width","100%",3,"mouseenter","mouseleave","direction","noGap"],["trigger","leftclick",3,"cueTooltip","variant","size","cueContextMenu","contextMenuData","cueContextEnabled"],[3,"selected"],[3,"click","selected"],["trigger","leftclick",3,"click","cueTooltip","variant","size","cueContextMenu","contextMenuData","cueContextEnabled"],[3,"icon"]],template:function(H,h){1&H&&(f.DNE(0,b,3,0,"ng-template",null,0,f.C5r),f.j41(2,"cue-flexcontainer",1),f.bIt("mouseenter",function(){return h.mouseEnter.emit()})("mouseleave",function(){return h.mouseLeave.emit()}),f.Z7z(3,D,2,8,"cue-button",2,u),f.k0s()),2&H&&(f.R7$(2),f.Y8G("direction",h.direction())("noGap",h.noGap()),f.R7$(),f.Dyx(h.items()))},dependencies:[s.n,w.$,x.d,v.a,A.Q,T.M,y.D],encapsulation:2,changeDetection:0})}return P})()},1024(ne,Y,l){"use strict";l.d(Y,{p:()=>x});var F=l(5547);const g=["*"];let x=(()=>{class A{static \u0275fac=function(v){return new(v||A)};static \u0275cmp=F.VBU({type:A,selectors:[["cue-key-val-list"]],ngContentSelectors:g,decls:2,vars:0,consts:[[1,"key-val-list"]],template:function(v,T){1&v&&(F.NAR(),F.rj2(0,"div",0),F.SdG(1),F.eux())},styles:[".key-val-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--cue-grid-gap-s)}"]})}return A})()},9421(ne,Y,l){"use strict";l.d(Y,{F:()=>v});var F=l(7705),g=l(5802),x=l(2271),A=l(7335),s=l(2245),w=l(5547);let v=(()=>{class T{entityMenuDirective;size=(0,F.hFB)("m");key=F.hFB.required();val=F.geq.required();options=(0,F.hFB)([]);suffix=(0,F.hFB)("");valueChange=(0,F.CGW)();editModeEnabled=(0,g.vPA)(!1);valueChanged=(0,x.EW)(()=>this.val()!==this.newValue());newValue=(0,x.uu)(()=>this.val());labelSize=(0,x.EW)(()=>{switch(this.size()){case"s":return"xs";case"m":return"s";case"l":return"m";case"xl":return"l"}});onKeyPress(f){this.editModeEnabled()&&("Escape"===f.key?(this._reset(),f.stopPropagation()):"Enter"===f.key&&this._emitChange())}saveCancelMenu=(0,x.EW)(()=>{const f=[{icon:"close",label:"Cancel",action:()=>this._reset()}];return this.valueChanged()&&f.push({icon:"save",label:"Save",action:()=>this._emitChange()}),f});selectionChange(f){this.newValue.set(f?.toString()??"")}inputChange(f){this.newValue.set(f)}_emitChange(){this.valueChange.emit(this.newValue()),this.val.set(this.newValue()),this.editModeEnabled.set(!1)}_reset(){this.newValue.set(this.val()),this.editModeEnabled.set(!1)}static \u0275fac=function(a){return new(a||T)};static \u0275cmp=w.VBU({type:T,selectors:[["cue-key-val"]],viewQuery:function(a,u){if(1&a&&w.GBs(A.e,5),2&a){let m;w.mGM(m=w.lsd())&&(u.entityMenuDirective=m.first)}},hostBindings:function(a,u){1&a&&w.bIt("keydown",function(b){return u.onKeyPress(b)},w.EBC)},inputs:{size:[1,"size"],key:[1,"key"],val:[1,"val"],options:[1,"options"],suffix:[1,"suffix"]},outputs:{val:"valChange",valueChange:"valueChange"},decls:8,vars:5,consts:[[1,"key-val-container"],[3,"size"],[1,"value-content"]],template:function(a,u){1&a&&(w.j41(0,"dl",0)(1,"dt")(2,"cue-typography",1),w.EFF(3),w.k0s()(),w.j41(4,"dd")(5,"cue-typography",1)(6,"span",2),w.EFF(7),w.k0s()()()()),2&a&&(w.R7$(2),w.Y8G("size",u.labelSize()),w.R7$(),w.JRh(u.key()),w.R7$(2),w.Y8G("size",u.size()),w.R7$(2),w.Lme("",u.val()," ",u.suffix()))},dependencies:[s.Typography],styles:[".key-val-container[_ngcontent-%COMP%]{margin:0;display:flex;flex-direction:column;gap:var(--cue-grid-gap-s, 8px)}dt[_ngcontent-%COMP%], dd[_ngcontent-%COMP%]{margin:0}.read-mode-container[_ngcontent-%COMP%]{display:inline-flex;align-items:center;width:100%;position:relative}.read-mode-container.interactive[_ngcontent-%COMP%]:hover{cursor:pointer}.value-content[_ngcontent-%COMP%]{flex:1}[_nghost-%COMP%]{color:var(--cue-typography-text-color, inherit)}dt[_ngcontent-%COMP%] cue-typography[_ngcontent-%COMP%], dd[_ngcontent-%COMP%] cue-typography[_ngcontent-%COMP%], .value-content[_ngcontent-%COMP%]{color:var(--cue-typography-text-color, inherit)!important}dt[_ngcontent-%COMP%] cue-typography[_ngcontent-%COMP%] div[_ngcontent-%COMP%], dd[_ngcontent-%COMP%] cue-typography[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{color:var(--cue-typography-text-color, inherit)!important}[_ngcontent-%COMP%]:deep(cue-svg-icon), [_ngcontent-%COMP%]:deep(cue-entity-menu cue-svg-icon){color:var(--cue-icon-color, inherit)!important}.dirty-indicator[_ngcontent-%COMP%]{opacity:.8;margin-left:4px;color:var(--cue-typography-text-color, inherit)!important;font-weight:700;font-size:.4em;transform:translateY(-1em)}"]})}return T})()},7517(ne,Y,l){"use strict";l.d(Y,{P:()=>m});var F=l(7705),g=l(2271),x=l(2245),A=l(1359),s=l(5381),w=l(5802),v=l(5547);const T=(b,D)=>D.category;function y(b,D){if(1&b){const c=v.RV6();v.j41(0,"cue-flexcontainer",1)(1,"cue-checkbox",2),v.bIt("checkedChange",function(){w.eBV(c);const N=v.XpG();return w.Njj(N.toggleAll())}),v.k0s()()}if(2&b){const c=v.XpG();v.R7$(),v.Y8G("checked",c.allVisible())}}function f(b,D){if(1&b&&(v.j41(0,"cue-typography",3),v.EFF(1),v.k0s()),2&b){const c=v.XpG().$implicit;v.R7$(),v.JRh(c.category)}}function a(b,D){if(1&b){const c=v.RV6();v.j41(0,"cue-flexcontainer",1)(1,"cue-checkbox",4),v.bIt("checkedChange",function(){const N=w.eBV(c).$implicit,k=v.XpG(2);return w.Njj(k.toggleSingle(N))}),v.k0s(),v.j41(2,"cue-typography",5),v.bIt("click",function(){const N=w.eBV(c).$implicit,k=v.XpG(2);return w.Njj(k.toggleSingle(N))}),v.EFF(3),v.k0s()()}if(2&b){const c=D.$implicit;v.R7$(),v.Y8G("checked",c.visible)("color",c.color),v.R7$(2),v.JRh(c.label)}}function u(b,D){if(1&b&&(v.nVh(0,f,2,1,"cue-typography",3),v.Z7z(1,a,4,3,"cue-flexcontainer",1,v.Vm6)),2&b){const c=D.$implicit;v.vxM(c.category?0:-1),v.R7$(),v.Dyx(c.items)}}let m=(()=>{class b{layers=(0,F.geq)([]);visibilityChange=(0,F.CGW)();layerChange=(0,F.CGW)();visibilityAll=(0,F.CGW)();showCheckAll=(0,g.EW)(()=>this.layers().length>1);allVisible=(0,g.EW)(()=>this.layers().every(c=>c.visible));groupedLayers=(0,g.EW)(()=>{const c=[];for(const P of this.layers()){const N=P.category,k=c.find(H=>H.category===N);k?k.items.push(P):c.push({category:N,items:[P]})}return c});toggleAll(){const c=this.allVisible(),P=this.layers().map(N=>(N.visible=!c,N));this.layers.update(()=>[...P]),this.visibilityAll.emit(c),this.emitChange()}toggleSingle(c){c.visible=!c.visible,this.layerChange.emit(c),this.layers.update(()=>[...this.layers()]),this.emitChange()}emitChange(){this.visibilityChange.emit(this.layers())}static \u0275fac=function(P){return new(P||b)};static \u0275cmp=v.VBU({type:b,selectors:[["cue-layer-legend"]],inputs:{layers:[1,"layers"]},outputs:{layers:"layersChange",visibilityChange:"visibilityChange",layerChange:"layerChange",visibilityAll:"visibilityAll"},decls:4,vars:1,consts:[["direction","column"],["align","center","justify","start",2,"width","100%"],["size","s",3,"checkedChange","checked"],["variant","label",2,"margin-top","4px","opacity","0.6"],["size","s",3,"checkedChange","checked","color"],[2,"cursor","pointer",3,"click"]],template:function(P,N){1&P&&(v.j41(0,"cue-flexcontainer",0),v.nVh(1,y,2,1,"cue-flexcontainer",1),v.Z7z(2,u,3,1,null,null,T),v.k0s()),2&P&&(v.R7$(),v.vxM(N.showCheckAll()?1:-1),v.R7$(),v.Dyx(N.groupedLayers()))},dependencies:[s.n,x.Typography,A.S],encapsulation:2,changeDetection:0})}return b})()},2843(ne,Y,l){"use strict";l.d(Y,{M:()=>$n});var F={};l.r(F),l.d(F,{LAT_MAX:()=>N,LAT_MIN:()=>c,LAT_RENDERED_MAX:()=>k,LAT_RENDERED_MIN:()=>P,LNG_MAX:()=>h,LNG_MIN:()=>H,activeStates:()=>b,classes:()=>s,cursors:()=>v,events:()=>a,geojsonTypes:()=>y,interactions:()=>D,meta:()=>m,modes:()=>f,sources:()=>w,types:()=>T,updateActions:()=>u});var g={};l.r(g),l.d(g,{isActiveFeature:()=>O,isBackspaceKey:()=>he,isDeleteKey:()=>fe,isDigit1Key:()=>re,isDigit2Key:()=>ze,isDigit3Key:()=>Fe,isDigitKey:()=>ve,isEnterKey:()=>de,isEscapeKey:()=>ge,isFeature:()=>j,isInactiveFeature:()=>V,isOfMetaType:()=>S,isShiftDown:()=>oe,isShiftMousedown:()=>R,isTrue:()=>at,isVertex:()=>J,noTarget:()=>K});var x={};l.r(x),l.d(x,{CommonSelectors:()=>g,ModeHandler:()=>rt,StringSet:()=>Ae,constrainFeatureMovement:()=>At,createMidPoint:()=>tn,createSupplementaryPoints:()=>Dt,createVertex:()=>je,doubleClickZoom:()=>Pe,euclideanDistance:()=>et,featuresAt:()=>Re,getFeatureAtAndSetCursors:()=>Ze,isClick:()=>tt,isEventAtCoordinates:()=>mt,isTap:()=>nt,mapEventToBoundingBox:()=>He,moveFeatures:()=>wt,sortFeatures:()=>ct,stringSetsAreEqual:()=>pn,theme:()=>Bt,toDenseArray:()=>we});var A=l(5802);const s={CANVAS:"mapboxgl-canvas",CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMBINE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},w={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},v={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},T={POLYGON:"polygon",LINE:"line_string",POINT:"point"},y={FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},f={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select"},a={CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},u={MOVE:"move",CHANGE_PROPERTIES:"change_properties",CHANGE_COORDINATES:"change_coordinates"},m={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},b={ACTIVE:"true",INACTIVE:"false"},D=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],c=-90,P=-85,N=90,k=85,H=-270,h=270;function S(e){return function(t){const n=t.featureTarget;return!(!n||!n.properties)&&n.properties.meta===e}}function R(e){return!(!e.originalEvent||!e.originalEvent.shiftKey)&&0===e.originalEvent.button}function O(e){return!(!e.featureTarget||!e.featureTarget.properties)&&e.featureTarget.properties.active===b.ACTIVE&&e.featureTarget.properties.meta===m.FEATURE}function V(e){return!(!e.featureTarget||!e.featureTarget.properties)&&e.featureTarget.properties.active===b.INACTIVE&&e.featureTarget.properties.meta===m.FEATURE}function K(e){return void 0===e.featureTarget}function j(e){return!(!e.featureTarget||!e.featureTarget.properties)&&e.featureTarget.properties.meta===m.FEATURE}function J(e){const t=e.featureTarget;return!(!t||!t.properties)&&t.properties.meta===m.VERTEX}function oe(e){return!!e.originalEvent&&!0===e.originalEvent.shiftKey}function ge(e){return"Escape"===e.key||27===e.keyCode}function de(e){return"Enter"===e.key||13===e.keyCode}function he(e){return"Backspace"===e.key||8===e.keyCode}function fe(e){return"Delete"===e.key||46===e.keyCode}function re(e){return"1"===e.key||49===e.keyCode}function ze(e){return"2"===e.key||50===e.keyCode}function Fe(e){return"3"===e.key||51===e.keyCode}function ve(e){const t=e.key||String.fromCharCode(e.keyCode);return t>="0"&&t<="9"}function at(){return!0}var Xe=l(503);const De={Point:0,LineString:1,MultiLineString:1,Polygon:2};function lt(e,t){const n=De[e.geometry.type]-De[t.geometry.type];return 0===n&&e.geometry.type===y.POLYGON?e.area-t.area:n}const ct=function _t(e){return e.map(t=>(t.geometry.type===y.POLYGON&&(t.area=Xe.geometry({type:y.FEATURE,property:{},geometry:t.geometry})),t)).sort(lt).map(t=>(delete t.area,t))},He=function Qe(e,t=0){return[[e.point.x-t,e.point.y-t],[e.point.x+t,e.point.y+t]]};function Ne(e){if(this._items={},this._nums={},this._length=e?e.length:0,e)for(let t=0,n=e.length;t<n;t++)this.add(e[t]),void 0!==e[t]&&("string"==typeof e[t]?this._items[e[t]]=t:this._nums[e[t]]=t)}Ne.prototype.add=function(e){return this.has(e)||(this._length++,"string"==typeof e?this._items[e]=this._length:this._nums[e]=this._length),this},Ne.prototype.delete=function(e){return!1===this.has(e)||(this._length--,delete this._items[e],delete this._nums[e]),this},Ne.prototype.has=function(e){return!("string"!=typeof e&&"number"!=typeof e||void 0===this._items[e]&&void 0===this._nums[e])},Ne.prototype.values=function(){const e=[];return Object.keys(this._items).forEach(t=>{e.push({k:t,v:this._items[t]})}),Object.keys(this._nums).forEach(t=>{e.push({k:JSON.parse(t),v:this._nums[t]})}),e.sort((t,n)=>t.v-n.v).map(t=>t.k)},Ne.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};const Ae=Ne,qe=[m.FEATURE,m.MIDPOINT,m.VERTEX],Re={click:function vt(e,t,n){return ut(e,t,n,n.options.clickBuffer)},touch:function Et(e,t,n){return ut(e,t,n,n.options.touchBuffer)}};function ut(e,t,n,r){if(null===n.map)return[];const o=e?He(e,r):t,i={};n.options.styles&&(i.layers=n.options.styles.map(G=>G.id).filter(G=>null!=n.map.getLayer(G)));const d=n.map.queryRenderedFeatures(o,i).filter(G=>-1!==qe.indexOf(G.properties.meta)),L=new Ae,E=[];return d.forEach(G=>{const X=G.properties.id;L.has(X)||(L.add(X),E.push(G))}),ct(E)}function Ze(e,t){const n=Re.click(e,null,t),r={mouse:v.NONE};return n[0]&&(r.mouse=n[0].properties.active===b.ACTIVE?v.MOVE:v.POINTER,r.feature=n[0].properties.meta),-1!==t.events.currentModeName().indexOf("draw")&&(r.mouse=v.ADD),t.ui.queueMapClasses(r),t.ui.updateMapClasses(),n[0]}function et(e,t){const n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function tt(e,t,n={}){const r=null!=n.fineTolerance?n.fineTolerance:4,o=null!=n.grossTolerance?n.grossTolerance:12,i=null!=n.interval?n.interval:500;e.point=e.point||t.point,e.time=e.time||t.time;const d=et(e.point,t.point);return d<r||d<o&&t.time-e.time<i}function nt(e,t,n={}){const r=null!=n.tolerance?n.tolerance:25,o=null!=n.interval?n.interval:250;return e.point=e.point||t.point,e.time=e.time||t.time,et(e.point,t.point)<r&&t.time-e.time<o}const rt=function(e,t){const n={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},r={on(i,d,L){if(void 0===n[i])throw new Error(`Invalid event type: ${i}`);n[i].push({selector:d,fn:L})},render(i){t.store.featureChanged(i)}},o=function(i,d){const L=n[i];let E=L.length;for(;E--;){const G=L[E];if(G.selector(d)){G.fn.call(r,d)||t.store.render(),t.ui.updateMapClasses();break}}};return e.start.call(r),{render:e.render,stop(){e.stop&&e.stop()},trash(){e.trash&&(e.trash(),t.store.render())},combineFeatures(){e.combineFeatures&&e.combineFeatures()},uncombineFeatures(){e.uncombineFeatures&&e.uncombineFeatures()},drag(i){o("drag",i)},click(i){o("click",i)},mousemove(i){o("mousemove",i)},mousedown(i){o("mousedown",i)},mouseup(i){o("mouseup",i)},mouseout(i){o("mouseout",i)},keydown(i){o("keydown",i)},keyup(i){o("keyup",i)},touchstart(i){o("touchstart",i)},touchmove(i){o("touchmove",i)},touchend(i){o("touchend",i)},tap(i){o("tap",i)}}},_=((e,t=21)=>(n=t)=>{let r="",o=0|n;for(;o--;)r+=e[Math.random()*e.length|0];return r})("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",32);function C(){return _()}const U=function(e,t){this.ctx=e,this.properties=t.properties||{},this.coordinates=t.geometry.coordinates,this.id=t.id||C(),this.type=t.geometry.type};U.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},U.prototype.incomingCoords=function(e){this.setCoordinates(e)},U.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},U.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},U.prototype.setProperty=function(e,t){this.properties[e]=t},U.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:y.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},U.prototype.internal=function(e){const t={id:this.id,meta:m.FEATURE,"meta:type":this.type,active:b.INACTIVE,mode:e};if(this.ctx.options.userProperties)for(const n in this.properties)t[`user_${n}`]=this.properties[n];return{type:y.FEATURE,properties:t,geometry:{coordinates:this.getCoordinates(),type:this.type}}};const Z=U,se=function(e,t){Z.call(this,e,t)};(se.prototype=Object.create(Z.prototype)).isValid=function(){return"number"==typeof this.coordinates[0]&&"number"==typeof this.coordinates[1]},se.prototype.updateCoordinate=function(e,t,n){this.coordinates=3===arguments.length?[t,n]:[e,t],this.changed()},se.prototype.getCoordinate=function(){return this.getCoordinates()};const ue=se,me=function(e,t){Z.call(this,e,t)};(me.prototype=Object.create(Z.prototype)).isValid=function(){return this.coordinates.length>1},me.prototype.addCoordinate=function(e,t,n){this.changed();const r=parseInt(e,10);this.coordinates.splice(r,0,[t,n])},me.prototype.getCoordinate=function(e){const t=parseInt(e,10);return JSON.parse(JSON.stringify(this.coordinates[t]))},me.prototype.removeCoordinate=function(e){this.changed(),this.coordinates.splice(parseInt(e,10),1)},me.prototype.updateCoordinate=function(e,t,n){const r=parseInt(e,10);this.coordinates[r]=[t,n],this.changed()};const ae=me,ee=function(e,t){Z.call(this,e,t),this.coordinates=this.coordinates.map(n=>n.slice(0,-1))};(ee.prototype=Object.create(Z.prototype)).isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every(e=>e.length>2)},ee.prototype.incomingCoords=function(e){this.coordinates=e.map(t=>t.slice(0,-1)),this.changed()},ee.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},ee.prototype.addCoordinate=function(e,t,n){this.changed();const r=e.split(".").map(i=>parseInt(i,10));this.coordinates[r[0]].splice(r[1],0,[t,n])},ee.prototype.removeCoordinate=function(e){this.changed();const t=e.split(".").map(r=>parseInt(r,10)),n=this.coordinates[t[0]];n&&(n.splice(t[1],1),n.length<3&&this.coordinates.splice(t[0],1))},ee.prototype.getCoordinate=function(e){const t=e.split(".").map(r=>parseInt(r,10));return JSON.parse(JSON.stringify(this.coordinates[t[0]][t[1]]))},ee.prototype.getCoordinates=function(){return this.coordinates.map(e=>e.concat([e[0]]))},ee.prototype.updateCoordinate=function(e,t,n){this.changed();const r=e.split("."),o=parseInt(r[0],10),i=parseInt(r[1],10);void 0===this.coordinates[o]&&(this.coordinates[o]=[]),this.coordinates[o][i]=[t,n]};const ye=ee,We={MultiPoint:ue,MultiLineString:ae,MultiPolygon:ye},ke=(e,t,n,r,o)=>{const i=n.split("."),d=parseInt(i[0],10),L=i[1]?i.slice(1).join("."):null;return e[d][t](L,r,o)},pe=function(e,t){if(Z.call(this,e,t),delete this.coordinates,this.model=We[t.geometry.type],void 0===this.model)throw new TypeError(`${t.geometry.type} is not a valid type`);this.features=this._coordinatesToFeatures(t.geometry.coordinates)};(pe.prototype=Object.create(Z.prototype))._coordinatesToFeatures=function(e){const t=this.model.bind(this);return e.map(n=>new t(this.ctx,{id:C(),type:y.FEATURE,properties:{},geometry:{coordinates:n,type:this.type.replace("Multi","")}}))},pe.prototype.isValid=function(){return this.features.every(e=>e.isValid())},pe.prototype.setCoordinates=function(e){this.features=this._coordinatesToFeatures(e),this.changed()},pe.prototype.getCoordinate=function(e){return ke(this.features,"getCoordinate",e)},pe.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map(e=>e.type===y.POLYGON?e.getCoordinates():e.coordinates)))},pe.prototype.updateCoordinate=function(e,t,n){ke(this.features,"updateCoordinate",e,t,n),this.changed()},pe.prototype.addCoordinate=function(e,t,n){ke(this.features,"addCoordinate",e,t,n),this.changed()},pe.prototype.removeCoordinate=function(e){ke(this.features,"removeCoordinate",e),this.changed()},pe.prototype.getFeatures=function(){return this.features};const q=pe;function W(e){this.map=e.map,this.drawConfig=JSON.parse(JSON.stringify(e.options||{})),this._ctx=e}W.prototype.setSelected=function(e){return this._ctx.store.setSelected(e)},W.prototype.setSelectedCoordinates=function(e){this._ctx.store.setSelectedCoordinates(e),e.reduce((t,n)=>(void 0===t[n.feature_id]&&(t[n.feature_id]=!0,this._ctx.store.get(n.feature_id).changed()),t),{})},W.prototype.getSelected=function(){return this._ctx.store.getSelected()},W.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},W.prototype.isSelected=function(e){return this._ctx.store.isSelected(e)},W.prototype.getFeature=function(e){return this._ctx.store.get(e)},W.prototype.select=function(e){return this._ctx.store.select(e)},W.prototype.deselect=function(e){return this._ctx.store.deselect(e)},W.prototype.deleteFeature=function(e,t={}){return this._ctx.store.delete(e,t)},W.prototype.addFeature=function(e,t={}){return this._ctx.store.add(e,t)},W.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},W.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},W.prototype.setActionableState=function(e={}){return this._ctx.events.actionable({trash:e.trash||!1,combineFeatures:e.combineFeatures||!1,uncombineFeatures:e.uncombineFeatures||!1})},W.prototype.changeMode=function(e,t={},n={}){return this._ctx.events.changeMode(e,t,n)},W.prototype.fire=function(e,t){return this._ctx.events.fire(e,t)},W.prototype.updateUIClasses=function(e){return this._ctx.ui.queueMapClasses(e)},W.prototype.activateUIButton=function(e){return this._ctx.ui.setActiveButton(e)},W.prototype.featuresAt=function(e,t,n="click"){if("click"!==n&&"touch"!==n)throw new Error("invalid buffer type");return Re[n](e,t,this._ctx)},W.prototype.newFeature=function(e){const t=e.geometry.type;return t===y.POINT?new ue(this._ctx,e):t===y.LINE_STRING?new ae(this._ctx,e):t===y.POLYGON?new ye(this._ctx,e):new q(this._ctx,e)},W.prototype.isInstanceOf=function(e,t){if(e===y.POINT)return t instanceof ue;if(e===y.LINE_STRING)return t instanceof ae;if(e===y.POLYGON)return t instanceof ye;if("MultiFeature"===e)return t instanceof q;throw new Error(`Unknown feature class: ${e}`)},W.prototype.doRender=function(e){return this._ctx.store.featureChanged(e)};const Ee=W;W.prototype.onSetup=function(){},W.prototype.onDrag=function(){},W.prototype.onClick=function(){},W.prototype.onMouseMove=function(){},W.prototype.onMouseDown=function(){},W.prototype.onMouseUp=function(){},W.prototype.onMouseOut=function(){},W.prototype.onKeyUp=function(){},W.prototype.onKeyDown=function(){},W.prototype.onTouchStart=function(){},W.prototype.onTouchMove=function(){},W.prototype.onTouchEnd=function(){},W.prototype.onTap=function(){},W.prototype.onStop=function(){},W.prototype.onTrash=function(){},W.prototype.onCombineFeature=function(){},W.prototype.onUncombineFeature=function(){},W.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};const Ce={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},Be=Object.keys(Ce);const we=function ot(e){return[].concat(e).filter(t=>void 0!==t)};function dt(){const e=this;if(!e.ctx.map||void 0===e.ctx.map.getSource(w.HOT))return E();const n=e.ctx.events.currentModeName();e.ctx.ui.queueMapClasses({mode:n});let r=[],o=[];e.isDirty?o=e.getAllIds():(r=e.getChangedIds().filter(G=>void 0!==e.get(G)),o=e.sources.hot.filter(G=>G.properties.id&&-1===r.indexOf(G.properties.id)&&void 0!==e.get(G.properties.id)).map(G=>G.properties.id)),e.sources.hot=[];const i=e.sources.cold.length;e.sources.cold=e.isDirty?[]:e.sources.cold.filter(G=>-1===r.indexOf(G.properties.id||G.properties.parent));const d=i!==e.sources.cold.length||o.length>0;function L(G,X){const I=e.get(G).internal(n);e.ctx.events.currentModeRender(I,z=>{z.properties.mode=n,e.sources[X].push(z)})}function E(){e.isDirty=!1,e.clearChangedIds()}r.forEach(G=>L(G,"hot")),o.forEach(G=>L(G,"cold")),d&&e.ctx.map.getSource(w.COLD).setData({type:y.FEATURE_COLLECTION,features:e.sources.cold}),e.ctx.map.getSource(w.HOT).setData({type:y.FEATURE_COLLECTION,features:e.sources.hot}),E()}function ie(e){let t;this._features={},this._featureIds=new Ae,this._selectedFeatureIds=new Ae,this._selectedCoordinates=[],this._changedFeatureIds=new Ae,this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=e,this.sources={hot:[],cold:[]},this.render=()=>{t||(t=requestAnimationFrame(()=>{t=null,dt.call(this),this._emitSelectionChange&&(this.ctx.events.fire(a.SELECTION_CHANGE,{features:this.getSelected().map(n=>n.toGeoJSON()),points:this.getSelectedCoordinates().map(n=>({type:y.FEATURE,properties:{},geometry:{type:y.POINT,coordinates:n.coordinates}}))}),this._emitSelectionChange=!1),this.ctx.events.fire(a.RENDER,{})}))},this.isDirty=!1}function ht(e,t={}){const n=e._selectedCoordinates.filter(r=>e._selectedFeatureIds.has(r.feature_id));e._selectedCoordinates.length!==n.length&&!t.silent&&(e._emitSelectionChange=!0),e._selectedCoordinates=n}ie.prototype.createRenderBatch=function(){const e=this.render;let t=0;return this.render=function(){t++},()=>{this.render=e,t>0&&this.render()}},ie.prototype.setDirty=function(){return this.isDirty=!0,this},ie.prototype.featureCreated=function(e,t={}){if(this._changedFeatureIds.add(e),!0!==(null!=t.silent?t.silent:this.ctx.options.suppressAPIEvents)){const r=this.get(e);this.ctx.events.fire(a.CREATE,{features:[r.toGeoJSON()]})}return this},ie.prototype.featureChanged=function(e,t={}){return this._changedFeatureIds.add(e),!0!==(null!=t.silent?t.silent:this.ctx.options.suppressAPIEvents)&&this.ctx.events.fire(a.UPDATE,{action:t.action?t.action:u.CHANGE_COORDINATES,features:[this.get(e).toGeoJSON()]}),this},ie.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},ie.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},ie.prototype.getAllIds=function(){return this._featureIds.values()},ie.prototype.add=function(e,t={}){return this._features[e.id]=e,this._featureIds.add(e.id),this.featureCreated(e.id,{silent:t.silent}),this},ie.prototype.delete=function(e,t={}){const n=[];return we(e).forEach(r=>{this._featureIds.has(r)&&(this._featureIds.delete(r),this._selectedFeatureIds.delete(r),t.silent||-1===n.indexOf(this._features[r])&&n.push(this._features[r].toGeoJSON()),delete this._features[r],this.isDirty=!0)}),n.length&&this.ctx.events.fire(a.DELETE,{features:n}),ht(this,t),this},ie.prototype.get=function(e){return this._features[e]},ie.prototype.getAll=function(){return Object.keys(this._features).map(e=>this._features[e])},ie.prototype.select=function(e,t={}){return we(e).forEach(n=>{this._selectedFeatureIds.has(n)||(this._selectedFeatureIds.add(n),this._changedFeatureIds.add(n),t.silent||(this._emitSelectionChange=!0))}),this},ie.prototype.deselect=function(e,t={}){return we(e).forEach(n=>{this._selectedFeatureIds.has(n)&&(this._selectedFeatureIds.delete(n),this._changedFeatureIds.add(n),t.silent||(this._emitSelectionChange=!0))}),ht(this,t),this},ie.prototype.clearSelected=function(e={}){return this.deselect(this._selectedFeatureIds.values(),{silent:e.silent}),this},ie.prototype.setSelected=function(e,t={}){return e=we(e),this.deselect(this._selectedFeatureIds.values().filter(n=>-1===e.indexOf(n)),{silent:t.silent}),this.select(e.filter(n=>!this._selectedFeatureIds.has(n)),{silent:t.silent}),this},ie.prototype.setSelectedCoordinates=function(e){return this._selectedCoordinates=e,this._emitSelectionChange=!0,this},ie.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},ie.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},ie.prototype.getSelected=function(){return this.getSelectedIds().map(e=>this.get(e))},ie.prototype.getSelectedCoordinates=function(){return this._selectedCoordinates.map(t=>({coordinates:this.get(t.feature_id).getCoordinate(t.coord_path)}))},ie.prototype.isSelected=function(e){return this._selectedFeatureIds.has(e)},ie.prototype.setFeatureProperty=function(e,t,n,r={}){this.get(e).setProperty(t,n),this.featureChanged(e,{silent:r.silent,action:u.CHANGE_PROPERTIES})},ie.prototype.storeMapConfig=function(){D.forEach(e=>{this.ctx.map[e]&&(this._mapInitialConfig[e]=this.ctx.map[e].isEnabled())})},ie.prototype.restoreMapConfig=function(){Object.keys(this._mapInitialConfig).forEach(e=>{this._mapInitialConfig[e]?this.ctx.map[e].enable():this.ctx.map[e].disable()})},ie.prototype.getInitialConfigValue=function(e){return void 0===this._mapInitialConfig[e]||this._mapInitialConfig[e]};const Rt=["mode","feature","mouse"];function gn(e){let t=null,n=null;const r={onRemove(){return e.map.off("load",r.connect),clearInterval(n),r.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.boxZoomInitial&&e.map.boxZoom.enable(),e.map=null,e.container=null,e.store=null,t&&t.parentNode&&t.parentNode.removeChild(t),t=null,this},connect(){e.map.off("load",r.connect),clearInterval(n),r.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd(o){if(e.map=o,e.events=function _e(e){const t=Object.keys(e.options.modes).reduce((I,z)=>(I[z]=function be(e){const t=Object.keys(e);return function(n,r={}){let o={};const i=t.reduce((L,E)=>(L[E]=e[E],L),new Ee(n));return{start(){o=i.onSetup(r),Be.forEach(L=>{const E=Ce[L];let G=()=>!1;e[E]&&(G=()=>!0),this.on(L,G,function d(L){return E=>i[L](o,E)}(E))})},stop(){i.onStop(o)},trash(){i.onTrash(o)},combineFeatures(){i.onCombineFeatures(o)},uncombineFeatures(){i.onUncombineFeatures(o)},render(L,E){i.toDisplayFeatures(o,L,E)}}}}(e.options.modes[z]),I),{});let n={},r={};const o={};let i=null,d=null;o.drag=function(I,z){z({point:I.point,time:(new Date).getTime()})?(e.ui.queueMapClasses({mouse:v.DRAG}),d.drag(I)):I.originalEvent.stopPropagation()},o.mousedrag=function(I){o.drag(I,z=>!tt(n,z))},o.touchdrag=function(I){o.drag(I,z=>!nt(r,z))},o.mousemove=function(I){if(1===(void 0!==I.originalEvent.buttons?I.originalEvent.buttons:I.originalEvent.which))return o.mousedrag(I);const $=Ze(I,e);I.featureTarget=$,d.mousemove(I)},o.mousedown=function(I){n={time:(new Date).getTime(),point:I.point};const z=Ze(I,e);I.featureTarget=z,d.mousedown(I)},o.mouseup=function(I){const z=Ze(I,e);I.featureTarget=z,tt(n,{point:I.point,time:(new Date).getTime()})?d.click(I):d.mouseup(I)},o.mouseout=function(I){d.mouseout(I)},o.touchstart=function(I){if(!e.options.touchEnabled)return;r={time:(new Date).getTime(),point:I.point};const z=Re.touch(I,null,e)[0];I.featureTarget=z,d.touchstart(I)},o.touchmove=function(I){if(e.options.touchEnabled)return d.touchmove(I),o.touchdrag(I)},o.touchend=function(I){if(I.originalEvent.preventDefault(),!e.options.touchEnabled)return;const z=Re.touch(I,null,e)[0];I.featureTarget=z,nt(r,{time:(new Date).getTime(),point:I.point})?d.tap(I):d.touchend(I)};const L=I=>{const z=he(I),$=fe(I),te=ve(I);return!(z||$||te)};function E(I,z,$={}){d.stop();const te=t[I];if(void 0===te)throw new Error(`${I} is not valid`);i=I;const Me=te(e,z);d=rt(Me,e),$.silent||e.map.fire(a.MODE_CHANGE,{mode:I}),e.store.setDirty(),e.store.render()}o.keydown=function(I){(I.srcElement||I.target).classList.contains(s.CANVAS)&&((he(I)||fe(I))&&e.options.controls.trash?(I.preventDefault(),d.trash()):L(I)?d.keydown(I):re(I)&&e.options.controls.point?E(f.DRAW_POINT):ze(I)&&e.options.controls.line_string?E(f.DRAW_LINE_STRING):Fe(I)&&e.options.controls.polygon&&E(f.DRAW_POLYGON))},o.keyup=function(I){L(I)&&d.keyup(I)},o.zoomend=function(){e.store.changeZoom()},o.data=function(I){if("style"===I.dataType){const{setup:z,map:$,options:te,store:Me}=e;te.styles.some(Ge=>$.getLayer(Ge.id))||(z.addLayers(),Me.setDirty(),Me.render())}};const G={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start(){i=e.options.defaultMode,d=rt(t[i](e),e)},changeMode:E,actionable:function X(I){let z=!1;Object.keys(I).forEach($=>{if(void 0===G[$])throw new Error("Invalid action type");G[$]!==I[$]&&(z=!0),G[$]=I[$]}),z&&e.map.fire(a.ACTIONABLE,{actions:G})},currentModeName:()=>i,currentModeRender:(I,z)=>d.render(I,z),fire(I,z){e.map&&e.map.fire(I,z)},addEventListeners(){e.map.on("mousemove",o.mousemove),e.map.on("mousedown",o.mousedown),e.map.on("mouseup",o.mouseup),e.map.on("data",o.data),e.map.on("touchmove",o.touchmove),e.map.on("touchstart",o.touchstart),e.map.on("touchend",o.touchend),e.container.addEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",o.keydown),e.container.addEventListener("keyup",o.keyup))},removeEventListeners(){e.map.off("mousemove",o.mousemove),e.map.off("mousedown",o.mousedown),e.map.off("mouseup",o.mouseup),e.map.off("data",o.data),e.map.off("touchmove",o.touchmove),e.map.off("touchstart",o.touchstart),e.map.off("touchend",o.touchend),e.container.removeEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",o.keydown),e.container.removeEventListener("keyup",o.keyup))},trash(I){d.trash(I)},combineFeatures(){d.combineFeatures()},uncombineFeatures(){d.uncombineFeatures()},getMode:()=>i}}(e),e.ui=function St(e){const t={};let n=null,r={mode:null,feature:null,mouse:null},o={mode:null,feature:null,mouse:null};function d(z){o=Object.assign(o,z)}function L(){if(!e.container)return;const z=[],$=[];Rt.forEach(te=>{o[te]!==r[te]&&(z.push(`${te}-${r[te]}`),null!==o[te]&&$.push(`${te}-${o[te]}`))}),z.length>0&&e.container.classList.remove(...z),$.length>0&&e.container.classList.add(...$),r=Object.assign(r,o)}function E(z,$={}){const te=document.createElement("button");return te.className=`${s.CONTROL_BUTTON} ${$.className}`,te.setAttribute("title",$.title),$.container.appendChild(te),te.addEventListener("click",Me=>{if(Me.preventDefault(),Me.stopPropagation(),Me.target===n)return G(),void $.onDeactivate();X(z),$.onActivate()},!0),te}function G(){n&&(n.classList.remove(s.ACTIVE_BUTTON),n=null)}function X(z){G();const $=t[z];$&&$&&"trash"!==z&&($.classList.add(s.ACTIVE_BUTTON),n=$)}return{setActiveButton:X,queueMapClasses:d,updateMapClasses:L,clearMapClasses:function i(){d({mode:null,feature:null,mouse:null}),L()},addButtons:function Q(){const z=e.options.controls,$=document.createElement("div");return $.className=`${s.CONTROL_GROUP} ${s.CONTROL_BASE}`,z&&(z[T.POINT]&&(t[T.POINT]=E(T.POINT,{container:$,className:s.CONTROL_BUTTON_POINT,title:"Marker tool "+(e.options.keybindings?"(1)":""),onActivate:()=>e.events.changeMode(f.DRAW_POINT),onDeactivate:()=>e.events.trash()})),z[T.LINE]&&(t[T.LINE]=E(T.LINE,{container:$,className:s.CONTROL_BUTTON_LINE,title:"LineString tool "+(e.options.keybindings?"(2)":""),onActivate:()=>e.events.changeMode(f.DRAW_LINE_STRING),onDeactivate:()=>e.events.trash()})),z[T.POLYGON]&&(t[T.POLYGON]=E(T.POLYGON,{container:$,className:s.CONTROL_BUTTON_POLYGON,title:"Polygon tool "+(e.options.keybindings?"(3)":""),onActivate:()=>e.events.changeMode(f.DRAW_POLYGON),onDeactivate:()=>e.events.trash()})),z.trash&&(t.trash=E("trash",{container:$,className:s.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:()=>{e.events.trash()}})),z.combine_features&&(t.combine_features=E("combineFeatures",{container:$,className:s.CONTROL_BUTTON_COMBINE_FEATURES,title:"Combine",onActivate:()=>{e.events.combineFeatures()}})),z.uncombine_features&&(t.uncombine_features=E("uncombineFeatures",{container:$,className:s.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:()=>{e.events.uncombineFeatures()}}))),$},removeButtons:function I(){Object.keys(t).forEach(z=>{const $=t[z];$.parentNode&&$.parentNode.removeChild($),delete t[z]})}}}(e),e.container=o.getContainer(),e.store=new ie(e),t=e.ui.addButtons(),e.options.boxSelect){e.boxZoomInitial=o.boxZoom.isEnabled(),o.boxZoom.disable();const i=o.dragPan.isEnabled();o.dragPan.disable(),o.dragPan.enable(),i||o.dragPan.disable()}return o.loaded()?r.connect():(o.on("load",r.connect),n=setInterval(()=>{o.loaded()&&r.connect()},16)),e.events.start(),t},addLayers(){e.map.addSource(w.COLD,{data:{type:y.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.map.addSource(w.HOT,{data:{type:y.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.options.styles.forEach(o=>{e.map.addLayer(o)}),e.store.setDirty(!0),e.store.render()},removeLayers(){e.options.styles.forEach(o=>{e.map.getLayer(o.id)&&e.map.removeLayer(o.id)}),e.map.getSource(w.COLD)&&e.map.removeSource(w.COLD),e.map.getSource(w.HOT)&&e.map.removeSource(w.HOT)}};return e.setup=r,r}const Pt="#3bb2d0",it="#fbb03b",Bt=[{id:"gl-draw-polygon-fill",type:"fill",filter:["all",["==","$type","Polygon"]],paint:{"fill-color":["case",["==",["get","active"],"true"],it,Pt],"fill-opacity":.1}},{id:"gl-draw-lines",type:"line",filter:["any",["==","$type","LineString"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["==",["get","active"],"true"],it,Pt],"line-dasharray":["case",["==",["get","active"],"true"],[.2,2],[2,0]],"line-width":2}},{id:"gl-draw-point-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":"#fff"}},{id:"gl-draw-point-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":["case",["==",["get","active"],"true"],it,Pt]}},{id:"gl-draw-vertex-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":"#fff"}},{id:"gl-draw-vertex-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":it}},{id:"gl-draw-midpoint",type:"circle",filter:["all",["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":it}}];function Ve(e,t){this.x=e,this.y=t}Ve.prototype={clone(){return new Ve(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const n=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=n,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),n=Math.sin(e),o=n*this.x+t*this.y;return this.x=t*this.x-n*this.y,this.y=o,this},_rotateAround(e,t){const n=Math.cos(e),r=Math.sin(e),i=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=t.x+n*(this.x-t.x)-r*(this.y-t.y),this.y=i,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Ve},Ve.convert=function(e){if(e instanceof Ve)return e;if(Array.isArray(e))return new Ve(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new Ve(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};const Ot=function mn(e,t){const n=t.getBoundingClientRect();return new Ve(e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0))};function je(e,t,n,r){return{type:y.FEATURE,properties:{meta:m.VERTEX,parent:e,coord_path:n,active:r?b.ACTIVE:b.INACTIVE},geometry:{type:y.POINT,coordinates:t}}}function st(e,t,n){if(null!==e)for(var r,o,i,d,L,E,G,I,X=0,Q=0,z=e.type,$="FeatureCollection"===z,te="Feature"===z,Me=$?e.features.length:1,Le=0;Le<Me;Le++){L=(I=!!(G=$?e.features[Le].geometry:te?e.geometry:e)&&"GeometryCollection"===G.type)?G.geometries.length:1;for(var Ge=0;Ge<L;Ge++){var Se=0,Ke=0;if(null!==(d=I?G.geometries[Ge]:G)){E=d.coordinates;var Ue=d.type;switch(X=!n||"Polygon"!==Ue&&"MultiPolygon"!==Ue?0:1,Ue){case null:break;case"Point":if(!1===t(E,Q,Le,Se,Ke))return!1;Q++,Se++;break;case"LineString":case"MultiPoint":for(r=0;r<E.length;r++){if(!1===t(E[r],Q,Le,Se,Ke))return!1;Q++,"MultiPoint"===Ue&&Se++}"LineString"===Ue&&Se++;break;case"Polygon":case"MultiLineString":for(r=0;r<E.length;r++){for(o=0;o<E[r].length-X;o++){if(!1===t(E[r][o],Q,Le,Se,Ke))return!1;Q++}"MultiLineString"===Ue&&Se++,"Polygon"===Ue&&Ke++}"Polygon"===Ue&&Se++;break;case"MultiPolygon":for(r=0;r<E.length;r++){for(Ke=0,o=0;o<E[r].length;o++){for(i=0;i<E[r][o].length-X;i++){if(!1===t(E[r][o][i],Q,Le,Se,Ke))return!1;Q++}Ke++}Se++}break;case"GeometryCollection":for(r=0;r<d.geometries.length;r++)if(!1===st(d.geometries[r],t,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Zt(e){const t={type:"Feature"};return Object.keys(e).forEach(n=>{switch(n){case"type":case"properties":case"geometry":return;default:t[n]=e[n]}}),t.properties=jt(e.properties),t.geometry=null==e.geometry?null:Ft(e.geometry),t}function jt(e){const t={};return e&&Object.keys(e).forEach(n=>{const r=e[n];t[n]="object"==typeof r?null===r?null:Array.isArray(r)?r.map(o=>o):jt(r):r}),t}function Ft(e){const t={type:e.type};return e.bbox&&(t.bbox=e.bbox),"GeometryCollection"===e.type?(t.geometries=e.geometries.map(n=>Ft(n)),t):(t.coordinates=Jt(e.coordinates),t)}function Jt(e){const t=e;return"object"!=typeof t[0]?t.slice():t.map(n=>Jt(n))}function Yt(e,t={}){return Qt(e,"mercator",t)}function Qt(e,t,n={}){var r=(n=n||{}).mutate;if(!e)throw new Error("geojson is required");return Array.isArray(e)&&function pt(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}(e[0])?e="mercator"===t?qt(e):en(e):(!0!==r&&(e=function Sn(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return Zt(e);case"FeatureCollection":return function Pn(e){const t={type:"FeatureCollection"};return Object.keys(e).forEach(n=>{switch(n){case"type":case"features":return;default:t[n]=e[n]}}),t.features=e.features.map(n=>Zt(n)),t}(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Ft(e);default:throw new Error("unknown GeoJSON type")}}(e)),st(e,function(o){var i="mercator"===t?qt(o):en(o);o[0]=i[0],o[1]=i[1]})),e}function qt(e){var t=Math.PI/180,n=6378137,r=20037508.342789244,o=Math.abs(e[0])<=180?e[0]:e[0]-360*function In(e){return e<0?-1:e>0?1:0}(e[0]),i=[n*o*t,n*Math.log(Math.tan(.25*Math.PI+.5*e[1]*t))];return i[0]>r&&(i[0]=r),i[0]<-r&&(i[0]=-r),i[1]>r&&(i[1]=r),i[1]<-r&&(i[1]=-r),i}function en(e){var t=180/Math.PI,n=6378137;return[e[0]*t/n,(.5*Math.PI-2*Math.atan(Math.exp(-e[1]/n)))*t]}function tn(e,t,n){const r=t.geometry.coordinates,o=n.geometry.coordinates;if(r[1]>k||r[1]<P||o[1]>k||o[1]<P)return null;const i=Yt(r),d=Yt(o),L=Q=>Number(Q.toFixed(8)),E=(Q,I)=>(Q+I)/2,G=function On(e,t={}){return Qt(e,"wgs84",t)}([E(i[0],d[0]),E(i[1],d[1])]),X=[L(G[0]),L(G[1])];return{type:y.FEATURE,properties:{meta:m.MIDPOINT,parent:e,lng:X[0],lat:X[1],coord_path:n.properties.coord_path},geometry:{type:y.POINT,coordinates:X}}}Math;const Dt=function nn(e,t={},n=null){const{type:r,coordinates:o}=e.geometry,i=e.properties&&e.properties.id;let d=[];function L(X,Q){let I="",z=null;X.forEach(($,te)=>{const Me=null!=Q?`${Q}.${te}`:String(te),Le=je(i,$,Me,E(Me));if(t.midpoints&&z){const Se=tn(i,z,Le);Se&&d.push(Se)}z=Le;const Ge=JSON.stringify($);I!==Ge&&d.push(Le),0===te&&(I=Ge)})}function E(X){return!!t.selectedPaths&&-1!==t.selectedPaths.indexOf(X)}return r===y.POINT?d.push(je(i,o,n,E(n))):r===y.POLYGON?o.forEach((X,Q)=>{L(X,null!==n?`${n}.${Q}`:String(Q))}):r===y.LINE_STRING?L(o,n):0===r.indexOf(y.MULTI_PREFIX)&&function G(){const X=r.replace(y.MULTI_PREFIX,"");o.forEach((Q,I)=>{d=d.concat(nn({type:y.FEATURE,properties:e.properties,geometry:{type:X,coordinates:Q}},t,I))})}(),d},Pe={enable(e){setTimeout(()=>{!e.map||!e.map.doubleClickZoom||!e._ctx||!e._ctx.store||!e._ctx.store.getInitialConfigValue||e._ctx.store.getInitialConfigValue("doubleClickZoom")&&e.map.doubleClickZoom.enable()},0)},disable(e){setTimeout(()=>{!e.map||!e.map.doubleClickZoom||e.map.doubleClickZoom.disable()},0)}},{LAT_MIN:ft,LAT_MAX:gt,LAT_RENDERED_MIN:rn,LAT_RENDERED_MAX:on,LNG_MIN:sn,LNG_MAX:an}=F;function At(e,t){let n=ft,r=gt,o=ft,i=gt,d=an,L=sn;e.forEach(G=>{const X=function xn(e){const n=[e.geometry.coordinates].flat({Point:0,LineString:1,Polygon:2,MultiPoint:1,MultiLineString:2,MultiPolygon:3}[e.geometry.type]),r=n.map(L=>L[0]),o=n.map(L=>L[1]),i=L=>Math.min.apply(null,L),d=L=>Math.max.apply(null,L);return[i(r),i(o),d(r),d(o)]}(G),Q=X[1],I=X[3],z=X[0],$=X[2];Q>n&&(n=Q),I<r&&(r=I),I>o&&(o=I),Q<i&&(i=Q),z<d&&(d=z),$>L&&(L=$)});const E=t;return n+E.lat>on&&(E.lat=on-n),o+E.lat>gt&&(E.lat=gt-o),r+E.lat<rn&&(E.lat=rn-r),i+E.lat<ft&&(E.lat=ft-i),d+E.lng<=sn&&(E.lng+=360*Math.ceil(Math.abs(E.lng)/360)),L+E.lng>=an&&(E.lng-=360*Math.ceil(Math.abs(E.lng)/360)),E}function wt(e,t){const n=At(e.map(r=>r.toGeoJSON()),t);e.forEach(r=>{const o=r.getCoordinates(),i=G=>{const X={lng:G[0]+n.lng,lat:G[1]+n.lat};return[X.lng,X.lat]},d=G=>G.map(X=>i(X));let E;r.type===y.POINT?E=i(o):r.type===y.LINE_STRING||r.type===y.MULTI_POINT?E=o.map(i):r.type===y.POLYGON||r.type===y.MULTI_LINE_STRING?E=o.map(d):r.type===y.MULTI_POLYGON&&(E=o.map(G=>G.map(X=>d(X)))),r.incomingCoords(E)})}const le={onSetup:function(e){const t={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initialDragPanState:this.map.dragPan.isEnabled(),initiallySelectedFeatureIds:e.featureIds||[]};return this.setSelected(t.initiallySelectedFeatureIds.filter(n=>void 0!==this.getFeature(n))),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),t},fireUpdate:function(){this.fire(a.UPDATE,{action:u.MOVE,features:this.getSelected().map(e=>e.toGeoJSON())})},fireActionable:function(){const e=this.getSelected(),t=e.filter(i=>this.isInstanceOf("MultiFeature",i));let n=!1;if(e.length>1){n=!0;const i=e[0].type.replace("Multi","");e.forEach(d=>{d.type.replace("Multi","")!==i&&(n=!1)})}this.setActionableState({combineFeatures:n,uncombineFeatures:t.length>0,trash:e.length>0})},getUniqueIds:function(e){return e.length?e.map(n=>n.properties.id).filter(n=>void 0!==n).reduce((n,r)=>(n.add(r),n),new Ae).values():[]},stopExtendedInteractions:function(e){e.boxSelectElement&&(e.boxSelectElement.parentNode&&e.boxSelectElement.parentNode.removeChild(e.boxSelectElement),e.boxSelectElement=null),(e.canDragMove||e.canBoxSelect)&&!0===e.initialDragPanState&&this.map.dragPan.enable(),e.boxSelecting=!1,e.canBoxSelect=!1,e.dragMoving=!1,e.canDragMove=!1},onStop:function(){Pe.enable(this)},onMouseMove:function(e,t){return j(t)&&e.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(e),!0},onMouseOut:function(e){return!e.dragMoving||this.fireUpdate()}};le.onTap=le.onClick=function(e,t){return K(t)?this.clickAnywhere(e,t):S(m.VERTEX)(t)?this.clickOnVertex(e,t):j(t)?this.clickOnFeature(e,t):void 0},le.clickAnywhere=function(e){const t=this.getSelectedIds();t.length&&(this.clearSelectedFeatures(),t.forEach(n=>this.doRender(n))),Pe.enable(this),this.stopExtendedInteractions(e)},le.clickOnVertex=function(e,t){this.changeMode(f.DIRECT_SELECT,{featureId:t.featureTarget.properties.parent,coordPath:t.featureTarget.properties.coord_path,startPos:t.lngLat}),this.updateUIClasses({mouse:v.MOVE})},le.startOnActiveFeature=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),this.doRender(t.featureTarget.properties.id),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},le.clickOnFeature=function(e,t){Pe.disable(this),this.stopExtendedInteractions(e);const n=oe(t),r=this.getSelectedIds(),o=t.featureTarget.properties.id,i=this.isSelected(o);if(!n&&i&&this.getFeature(o).type!==y.POINT)return this.changeMode(f.DIRECT_SELECT,{featureId:o});i&&n?(this.deselect(o),this.updateUIClasses({mouse:v.POINTER}),1===r.length&&Pe.enable(this)):!i&&n?(this.select(o),this.updateUIClasses({mouse:v.MOVE})):!i&&!n&&(r.forEach(d=>this.doRender(d)),this.setSelected(o),this.updateUIClasses({mouse:v.MOVE})),this.doRender(o)},le.onMouseDown=function(e,t){return e.initialDragPanState=this.map.dragPan.isEnabled(),O(t)?this.startOnActiveFeature(e,t):this.drawConfig.boxSelect&&R(t)?this.startBoxSelect(e,t):void 0},le.startBoxSelect=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),e.boxSelectStartLocation=Ot(t.originalEvent,this.map.getContainer()),e.canBoxSelect=!0},le.onTouchStart=function(e,t){if(O(t))return this.startOnActiveFeature(e,t)},le.onDrag=function(e,t){return e.canDragMove?this.dragMove(e,t):this.drawConfig.boxSelect&&e.canBoxSelect?this.whileBoxSelect(e,t):void 0},le.whileBoxSelect=function(e,t){e.boxSelecting=!0,this.updateUIClasses({mouse:v.ADD}),e.boxSelectElement||(e.boxSelectElement=document.createElement("div"),e.boxSelectElement.classList.add(s.BOX_SELECT),this.map.getContainer().appendChild(e.boxSelectElement));const n=Ot(t.originalEvent,this.map.getContainer()),r=Math.min(e.boxSelectStartLocation.x,n.x),o=Math.max(e.boxSelectStartLocation.x,n.x),i=Math.min(e.boxSelectStartLocation.y,n.y),d=Math.max(e.boxSelectStartLocation.y,n.y),L=`translate(${r}px, ${i}px)`;e.boxSelectElement.style.transform=L,e.boxSelectElement.style.WebkitTransform=L,e.boxSelectElement.style.width=o-r+"px",e.boxSelectElement.style.height=d-i+"px"},le.dragMove=function(e,t){e.dragMoving=!0,t.originalEvent.stopPropagation();const n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};wt(this.getSelected(),n),e.dragMoveLocation=t.lngLat},le.onTouchEnd=le.onMouseUp=function(e,t){if(e.dragMoving)this.fireUpdate();else if(e.boxSelecting){const n=[e.boxSelectStartLocation,Ot(t.originalEvent,this.map.getContainer())],r=this.featuresAt(null,n,"click"),o=this.getUniqueIds(r).filter(i=>!this.isSelected(i));o.length&&(this.select(o),o.forEach(i=>this.doRender(i)),this.updateUIClasses({mouse:v.MOVE}))}this.stopExtendedInteractions(e)},le.toDisplayFeatures=function(e,t,n){t.properties.active=this.isSelected(t.properties.id)?b.ACTIVE:b.INACTIVE,n(t),this.fireActionable(),t.properties.active===b.ACTIVE&&t.geometry.type!==y.POINT&&Dt(t).forEach(n)},le.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},le.onCombineFeatures=function(){const e=this.getSelected();if(0===e.length||e.length<2)return;const t=[],n=[],r=e[0].type.replace("Multi","");for(let o=0;o<e.length;o++){const i=e[o];if(i.type.replace("Multi","")!==r)return;i.type.includes("Multi")?i.getCoordinates().forEach(d=>{t.push(d)}):t.push(i.getCoordinates()),n.push(i.toGeoJSON())}if(n.length>1){const o=this.newFeature({type:y.FEATURE,properties:n[0].properties,geometry:{type:`Multi${r}`,coordinates:t}});this.addFeature(o),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([o.id]),this.fire(a.COMBINE_FEATURES,{createdFeatures:[o.toGeoJSON()],deletedFeatures:n})}this.fireActionable()},le.onUncombineFeatures=function(){const e=this.getSelected();if(0===e.length)return;const t=[],n=[];for(let r=0;r<e.length;r++){const o=e[r];this.isInstanceOf("MultiFeature",o)&&(o.getFeatures().forEach(i=>{this.addFeature(i),i.properties=o.properties,t.push(i.toGeoJSON()),this.select([i.id])}),this.deleteFeature(o.id,{silent:!0}),n.push(o.toGeoJSON()))}t.length>1&&this.fire(a.UNCOMBINE_FEATURES,{createdFeatures:t,deletedFeatures:n}),this.fireActionable()};const Fn=le,ln=S(m.VERTEX),cn=S(m.MIDPOINT),ce={fireUpdate:function(){this.fire(a.UPDATE,{action:u.CHANGE_COORDINATES,features:this.getSelected().map(e=>e.toGeoJSON())})},fireActionable:function(e){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:e.selectedCoordPaths.length>0})},startDragging:function(e,t){null==e.initialDragPanState&&(e.initialDragPanState=this.map.dragPan.isEnabled()),this.map.dragPan.disable(),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},stopDragging:function(e){e.canDragMove&&!0===e.initialDragPanState&&this.map.dragPan.enable(),e.initialDragPanState=null,e.dragMoving=!1,e.canDragMove=!1,e.dragMoveLocation=null},onVertex:function(e,t){this.startDragging(e,t);const n=t.featureTarget.properties,r=e.selectedCoordPaths.indexOf(n.coord_path);oe(t)||-1!==r?oe(t)&&-1===r&&e.selectedCoordPaths.push(n.coord_path):e.selectedCoordPaths=[n.coord_path];const o=this.pathsToCoordinates(e.featureId,e.selectedCoordPaths);this.setSelectedCoordinates(o)},onMidpoint:function(e,t){this.startDragging(e,t);const n=t.featureTarget.properties;e.feature.addCoordinate(n.coord_path,n.lng,n.lat),this.fireUpdate(),e.selectedCoordPaths=[n.coord_path]},pathsToCoordinates:function(e,t){return t.map(n=>({feature_id:e,coord_path:n}))},onFeature:function(e,t){0===e.selectedCoordPaths.length?this.startDragging(e,t):this.stopDragging(e)},dragFeature:function(e,t,n){wt(this.getSelected(),n),e.dragMoveLocation=t.lngLat},dragVertex:function(e,t,n){const r=e.selectedCoordPaths.map(d=>e.feature.getCoordinate(d)),i=At(r.map(d=>({type:y.FEATURE,properties:{},geometry:{type:y.POINT,coordinates:d}})),n);for(let d=0;d<r.length;d++){const L=r[d];e.feature.updateCoordinate(e.selectedCoordPaths[d],L[0]+i.lng,L[1]+i.lat)}},clickNoTarget:function(){this.changeMode(f.SIMPLE_SELECT)},clickInactive:function(){this.changeMode(f.SIMPLE_SELECT)},clickActiveFeature:function(e){e.selectedCoordPaths=[],this.clearSelectedCoordinates(),e.feature.changed()},onSetup:function(e){const t=e.featureId,n=this.getFeature(t);if(!n)throw new Error("You must provide a featureId to enter direct_select mode");if(n.type===y.POINT)throw new TypeError("direct_select mode doesn't handle point features");const r={featureId:t,feature:n,dragMoveLocation:e.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:e.coordPath?[e.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(t,r.selectedCoordPaths)),this.setSelected(t),Pe.disable(this),this.setActionableState({trash:!0}),r},onStop:function(){Pe.enable(this),this.clearSelectedCoordinates()},toDisplayFeatures:function(e,t,n){e.featureId===t.properties.id?(t.properties.active=b.ACTIVE,n(t),Dt(t,{map:this.map,midpoints:!0,selectedPaths:e.selectedCoordPaths}).forEach(n)):(t.properties.active=b.INACTIVE,n(t)),this.fireActionable(e)},onTrash:function(e){e.selectedCoordPaths.sort((t,n)=>n.localeCompare(t,"en",{numeric:!0})).forEach(t=>e.feature.removeCoordinate(t)),this.fireUpdate(),e.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(e),!1===e.feature.isValid()&&(this.deleteFeature([e.featureId]),this.changeMode(f.SIMPLE_SELECT,{}))},onMouseMove:function(e,t){const n=O(t),r=ln(t),o=cn(t),i=0===e.selectedCoordPaths.length;return this.updateUIClasses(n&&i||r&&!i?{mouse:v.MOVE}:{mouse:v.NONE}),(r||n||o)&&e.dragMoving&&this.fireUpdate(),this.stopDragging(e),!0},onMouseOut:function(e){return e.dragMoving&&this.fireUpdate(),!0}};ce.onTouchStart=ce.onMouseDown=function(e,t){return ln(t)?this.onVertex(e,t):O(t)?this.onFeature(e,t):cn(t)?this.onMidpoint(e,t):void 0},ce.onDrag=function(e,t){if(!0!==e.canDragMove)return;e.dragMoving=!0,t.originalEvent.stopPropagation();const n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};e.selectedCoordPaths.length>0?this.dragVertex(e,t,n):this.dragFeature(e,t,n),e.dragMoveLocation=t.lngLat},ce.onClick=function(e,t){return K(t)?this.clickNoTarget(e,t):O(t)?this.clickActiveFeature(e,t):V(t)?this.clickInactive(e,t):void this.stopDragging(e)},ce.onTap=function(e,t){return K(t)?this.clickNoTarget(e,t):O(t)?this.clickActiveFeature(e,t):V(t)?this.clickInactive(e,t):void 0},ce.onTouchEnd=ce.onMouseUp=function(e){e.dragMoving&&this.fireUpdate(),this.stopDragging(e)};const Dn=ce,xe={onSetup:function(){const e=this.newFeature({type:y.FEATURE,properties:{},geometry:{type:y.POINT,coordinates:[]}});return this.addFeature(e),this.clearSelectedFeatures(),this.updateUIClasses({mouse:v.ADD}),this.activateUIButton(T.POINT),this.setActionableState({trash:!0}),{point:e}},stopDrawingAndRemove:function(e){this.deleteFeature([e.point.id],{silent:!0}),this.changeMode(f.SIMPLE_SELECT)}};xe.onTap=xe.onClick=function(e,t){this.updateUIClasses({mouse:v.MOVE}),e.point.updateCoordinate("",t.lngLat.lng,t.lngLat.lat),this.fire(a.CREATE,{features:[e.point.toGeoJSON()]}),this.changeMode(f.SIMPLE_SELECT,{featureIds:[e.point.id]})},xe.onStop=function(e){this.activateUIButton(),e.point.getCoordinate().length||this.deleteFeature([e.point.id],{silent:!0})},xe.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.point.id;if(t.properties.active=r?b.ACTIVE:b.INACTIVE,!r)return n(t)},xe.onTrash=xe.stopDrawingAndRemove,xe.onKeyUp=function(e,t){if(ge(t)||de(t))return this.stopDrawingAndRemove(e,t)};const An=xe,mt=function wn(e,t){return!!e.lngLat&&e.lngLat.lng===t[0]&&e.lngLat.lat===t[1]},Oe={onSetup:function(){const e=this.newFeature({type:y.FEATURE,properties:{},geometry:{type:y.POLYGON,coordinates:[[]]}});return this.addFeature(e),this.clearSelectedFeatures(),Pe.disable(this),this.updateUIClasses({mouse:v.ADD}),this.activateUIButton(T.POLYGON),this.setActionableState({trash:!0}),{polygon:e,currentVertexPosition:0}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&mt(t,e.polygon.coordinates[0][e.currentVertexPosition-1]))return this.changeMode(f.SIMPLE_SELECT,{featureIds:[e.polygon.id]});this.updateUIClasses({mouse:v.ADD}),e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),e.currentVertexPosition++,e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(f.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},onMouseMove:function(e,t){e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),J(t)&&this.updateUIClasses({mouse:v.POINTER})}};Oe.onTap=Oe.onClick=function(e,t){return J(t)?this.clickOnVertex(e,t):this.clickAnywhere(e,t)},Oe.onKeyUp=function(e,t){ge(t)?(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(f.SIMPLE_SELECT)):de(t)&&this.changeMode(f.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},Oe.onStop=function(e){this.updateUIClasses({mouse:v.NONE}),Pe.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.polygon.id)&&(e.polygon.removeCoordinate(`0.${e.currentVertexPosition}`),e.polygon.isValid()?this.fire(a.CREATE,{features:[e.polygon.toGeoJSON()]}):(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(f.SIMPLE_SELECT,{},{silent:!0})))},Oe.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.polygon.id;if(t.properties.active=r?b.ACTIVE:b.INACTIVE,!r)return n(t);if(0===t.geometry.coordinates.length)return;const o=t.geometry.coordinates[0].length;if(!(o<3)){if(t.properties.meta=m.FEATURE,n(je(e.polygon.id,t.geometry.coordinates[0][0],"0.0",!1)),o>3){const i=t.geometry.coordinates[0].length-3;n(je(e.polygon.id,t.geometry.coordinates[0][i],`0.${i}`,!1))}if(o<=4&&(n({type:y.FEATURE,properties:t.properties,geometry:{coordinates:[[t.geometry.coordinates[0][0][0],t.geometry.coordinates[0][0][1]],[t.geometry.coordinates[0][1][0],t.geometry.coordinates[0][1][1]]],type:y.LINE_STRING}}),3===o))return;return n(t)}},Oe.onTrash=function(e){this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(f.SIMPLE_SELECT)};const Nn=Oe,Ie={onSetup:function(e){const t=(e=e||{}).featureId;let n,r,o="forward";if(t){if(n=this.getFeature(t),!n)throw new Error("Could not find a feature with the provided featureId");let i=e.from;if(i&&"Feature"===i.type&&i.geometry&&"Point"===i.geometry.type&&(i=i.geometry),i&&"Point"===i.type&&i.coordinates&&2===i.coordinates.length&&(i=i.coordinates),!i||!Array.isArray(i))throw new Error("Please use the `from` property to indicate which point to continue the line from");const d=n.coordinates.length-1;if(n.coordinates[d][0]===i[0]&&n.coordinates[d][1]===i[1])r=d+1,n.addCoordinate(r,...n.coordinates[d]);else{if(n.coordinates[0][0]!==i[0]||n.coordinates[0][1]!==i[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");o="backwards",r=0,n.addCoordinate(r,...n.coordinates[0])}}else n=this.newFeature({type:y.FEATURE,properties:{},geometry:{type:y.LINE_STRING,coordinates:[]}}),r=0,this.addFeature(n);return this.clearSelectedFeatures(),Pe.disable(this),this.updateUIClasses({mouse:v.ADD}),this.activateUIButton(T.LINE),this.setActionableState({trash:!0}),{line:n,currentVertexPosition:r,direction:o}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&mt(t,e.line.coordinates[e.currentVertexPosition-1])||"backwards"===e.direction&&mt(t,e.line.coordinates[e.currentVertexPosition+1]))return this.changeMode(f.SIMPLE_SELECT,{featureIds:[e.line.id]});this.updateUIClasses({mouse:v.ADD}),e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),"forward"===e.direction?(e.currentVertexPosition++,e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat)):e.line.addCoordinate(0,t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(f.SIMPLE_SELECT,{featureIds:[e.line.id]})},onMouseMove:function(e,t){e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),J(t)&&this.updateUIClasses({mouse:v.POINTER})}};Ie.onTap=Ie.onClick=function(e,t){if(J(t))return this.clickOnVertex(e,t);this.clickAnywhere(e,t)},Ie.onKeyUp=function(e,t){de(t)?this.changeMode(f.SIMPLE_SELECT,{featureIds:[e.line.id]}):ge(t)&&(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(f.SIMPLE_SELECT))},Ie.onStop=function(e){Pe.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.line.id)&&(e.line.removeCoordinate(`${e.currentVertexPosition}`),e.line.isValid()?this.fire(a.CREATE,{features:[e.line.toGeoJSON()]}):(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(f.SIMPLE_SELECT,{},{silent:!0})))},Ie.onTrash=function(e){this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(f.SIMPLE_SELECT)},Ie.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.line.id;if(t.properties.active=r?b.ACTIVE:b.INACTIVE,!r)return n(t);t.geometry.coordinates.length<2||(t.properties.meta=m.FEATURE,n(je(e.line.id,t.geometry.coordinates["forward"===e.direction?t.geometry.coordinates.length-2:1],""+("forward"===e.direction?t.geometry.coordinates.length-2:1),!1)),n(t))};const un={simple_select:Fn,direct_select:Dn,draw_point:An,draw_polygon:Nn,draw_line_string:Ie},Rn={defaultMode:f.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:Bt,modes:un,controls:{},userProperties:!1,suppressAPIEvents:!0},kn={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},Bn={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function dn(e,t){return e.map(n=>n.source?n:Object.assign({},n,{id:`${n.id}.${t}`,source:"hot"===t?w.HOT:w.COLD}))}var hn=l(362),Gn=l(5341);function pn(e,t){return e.length===t.length&&JSON.stringify(e.map(n=>n).sort())===JSON.stringify(t.map(n=>n).sort())}const Un={Polygon:ye,LineString:ae,Point:ue,MultiPolygon:q,MultiLineString:q,MultiPoint:q};function yt(e){!function(e,t){e=function Vn(e={}){let t=Object.assign({},e);return e.controls||(t.controls={}),t.controls=Object.assign({},!1===e.displayControlsDefault?Bn:kn,e.controls),t=Object.assign({},Rn,t),t.styles=dn(t.styles,"cold").concat(dn(t.styles,"hot")),t}(e);const n={options:e};t=function zn(e,t){t.modes=f;const n=void 0===e.options.suppressAPIEvents||!!e.options.suppressAPIEvents;return t.getFeatureIdsAt=function(r){return Re.click({point:r},null,e).map(i=>i.properties.id)},t.getSelectedIds=function(){return e.store.getSelectedIds()},t.getSelected=function(){return{type:y.FEATURE_COLLECTION,features:e.store.getSelectedIds().map(r=>e.store.get(r)).map(r=>r.toGeoJSON())}},t.getSelectedPoints=function(){return{type:y.FEATURE_COLLECTION,features:e.store.getSelectedCoordinates().map(r=>({type:y.FEATURE,properties:{},geometry:{type:y.POINT,coordinates:r.coordinates}}))}},t.set=function(r){if(void 0===r.type||r.type!==y.FEATURE_COLLECTION||!Array.isArray(r.features))throw new Error("Invalid FeatureCollection");const o=e.store.createRenderBatch();let i=e.store.getAllIds().slice();const d=t.add(r),L=new Ae(d);return i=i.filter(E=>!L.has(E)),i.length&&t.delete(i),o(),d},t.add=function(r){const i=JSON.parse(JSON.stringify(Gn(r))).features.map(d=>{if(d.id=d.id||C(),null===d.geometry)throw new Error("Invalid geometry: null");if(void 0===e.store.get(d.id)||e.store.get(d.id).type!==d.geometry.type){const L=Un[d.geometry.type];if(void 0===L)throw new Error(`Invalid geometry type: ${d.geometry.type}.`);const E=new L(e,d);e.store.add(E,{silent:n})}else{const L=e.store.get(d.id),E=L.properties;L.properties=d.properties,hn(E,d.properties)||e.store.featureChanged(L.id,{silent:n}),hn(L.getCoordinates(),d.geometry.coordinates)||L.incomingCoords(d.geometry.coordinates)}return d.id});return e.store.render(),i},t.get=function(r){const o=e.store.get(r);if(o)return o.toGeoJSON()},t.getAll=function(){return{type:y.FEATURE_COLLECTION,features:e.store.getAll().map(r=>r.toGeoJSON())}},t.delete=function(r){return e.store.delete(r,{silent:n}),t.getMode()!==f.DIRECT_SELECT||e.store.getSelectedIds().length?e.store.render():e.events.changeMode(f.SIMPLE_SELECT,void 0,{silent:n}),t},t.deleteAll=function(){return e.store.delete(e.store.getAllIds(),{silent:n}),t.getMode()===f.DIRECT_SELECT?e.events.changeMode(f.SIMPLE_SELECT,void 0,{silent:n}):e.store.render(),t},t.changeMode=function(r,o={}){return r===f.SIMPLE_SELECT&&t.getMode()===f.SIMPLE_SELECT?(pn(o.featureIds||[],e.store.getSelectedIds())||(e.store.setSelected(o.featureIds,{silent:n}),e.store.render()),t):(r===f.DIRECT_SELECT&&t.getMode()===f.DIRECT_SELECT&&o.featureId===e.store.getSelectedIds()[0]||e.events.changeMode(r,o,{silent:n}),t)},t.getMode=function(){return e.events.getMode()},t.trash=function(){return e.events.trash({silent:n}),t},t.combineFeatures=function(){return e.events.combineFeatures({silent:n}),t},t.uncombineFeatures=function(){return e.events.uncombineFeatures({silent:n}),t},t.setFeatureProperty=function(r,o,i){return e.store.setFeatureProperty(r,o,i,{silent:n}),t},t}(n,t),n.api=t;const r=gn(n);t.onAdd=r.onAdd,t.onRemove=r.onRemove,t.types=T,t.options=e}(e,this)}yt.modes=un,yt.constants=F,yt.lib=x;const fn=yt;let $n=(()=>{class e{_draw;_map;_drawMode=(0,A.vPA)(!1);_settingDrawMode=!1;_eventListeners=[];_clearAfterFinish=!0;drawEvent=(0,A.vPA)(void 0);destroy(){this._cleanup()}initializeWithMap(n){this._map=n,this._initDrawControl(n)}setDrawMode(n,r){if(this._draw&&this._map&&!this._settingDrawMode){if(this._clearAfterFinish=r,this._settingDrawMode=!0,this._drawMode.set(n),n){this._draw.deleteAll(),this._draw.changeMode("draw_polygon");const o={type:"polygon",status:"started",coordinates:[],bbox:{minLng:0,minLat:0,maxLng:0,maxLat:0}};this.drawEvent.update(()=>o)}else this._draw.changeMode("simple_select"),this._draw.deleteAll();this._settingDrawMode=!1}}setClearAfterFinish(n){this._clearAfterFinish=n}getClearAfterFinish(){return this._clearAfterFinish}getDrawMode(){return this._drawMode()}clearDrawings(){this._draw&&this._draw.deleteAll()}getDrawInstance(){return this._draw}_initDrawControl(n){this._draw=new fn({displayControlsDefault:!1,modes:{...fn.modes}}),n.addControl(this._draw,"top-left");const r=document.querySelector(".mapbox-gl-draw_ctrl-draw-btn")?.parentElement;r&&(r.style.display="none");const o=L=>{const E=L.features[0];if("Polygon"===E.geometry.type){const G=E.geometry.coordinates[0],Q={type:"polygon",status:"ended",coordinates:G,bbox:this._calculateBBox(G)};this.drawEvent.update(()=>Q),this._drawMode.set(!1),this._clearAfterFinish&&this._draw?.deleteAll()}},i=L=>{const E=L.features[0];if("Polygon"===E.geometry.type){const G=E.geometry.coordinates[0],Q={type:"polygon",status:"in-progress",coordinates:G,bbox:this._calculateBBox(G)};this.drawEvent.update(()=>Q)}},d=()=>{if(this._drawMode()){const L=this._draw?.getAll();if(L?.features?.length){const E=L.features[0];if("Polygon"===E.geometry.type){const G=E.geometry.coordinates[0];if(G.length>2){const Q={type:"polygon",status:"in-progress",coordinates:G,bbox:this._calculateBBox(G)};this.drawEvent.update(()=>Q)}}}}};n.on("draw.create",o),n.on("draw.update",i),n.on("mousemove",d),this._eventListeners.push({event:"draw.create",handler:o}),this._eventListeners.push({event:"draw.update",handler:i}),this._eventListeners.push({event:"mousemove",handler:d})}_cleanup(){this._map&&(this._eventListeners.forEach(({event:n,handler:r})=>{this._map?.off(n,r)}),this._eventListeners=[],this._draw&&this._map._controls?.includes(this._draw)&&this._map.removeControl(this._draw)),this._draw=void 0,this._map=void 0,this.drawEvent.set(void 0)}_calculateBBox(n){return n.reduce((r,o)=>({minLng:Math.min(r.minLng,o[0]),minLat:Math.min(r.minLat,o[1]),maxLng:Math.max(r.maxLng,o[0]),maxLat:Math.max(r.maxLat,o[1])}),{minLng:1/0,minLat:1/0,maxLng:-1/0,maxLat:-1/0})}static \u0275fac=function(r){return new(r||e)};static \u0275prov=A.jDH({token:e,factory:e.\u0275fac})}return e})()},6103(ne,Y,l){"use strict";l.d(Y,{N:()=>A});var F=l(2306),g=l(140),x=l(58);function A({entityData:s,availableEntityRelationships:w}){const v=m=>w.find(b=>b.iri===m)?.label??m.split("#").pop()??m,T=[],y={};for(const[m,b]of Object.entries(s)){for(const D of b.directMapGeometries??[])T.push({iri:m,wkt:D.wkt});for(const D of b.indirectMapGeometries??[]){y[D.rel]||(y[D.rel]=[]);for(const c of D.geometries)y[D.rel].push({iri:D.entityUUID,wkt:c.wkt})}}const f=(m,b,D)=>{if(!b.length)return null;const c=new F.ux(m,m);return c.category=D,c.collection=new g.o(b.flatMap(({iri:P,wkt:N})=>{const k=(0,x.S)(N);return k?[{type:"Feature",geometry:(0,x.n)(k),properties:{iri:P}}]:[]})),c},a=[],u=f("direct",T,"Direct");u&&a.push(u);for(const[m,b]of Object.entries(y)){const D=v(m),c=f(D,b,D);c&&a.push(c)}return a}},6986(ne,Y,l){"use strict";l.d(Y,{A4:()=>F,Jc:()=>v,Ln:()=>x,dx:()=>s,g8:()=>g,j5:()=>A,n7:()=>w});const F=12;function g(f,a,u){return{id:f,source:a,type:"circle",maxzoom:F,filter:["==",["get","_isCentroid"],!0],paint:{"circle-radius":6,"circle-color":["coalesce",["get","_color"],u],"circle-stroke-width":2,"circle-stroke-color":"white","circle-opacity":.8}}}function x(f,a,u,m){return function y(f,a,u,m,b){const D={id:f,source:m},c=b||u;switch(a){case"Point":case"MultiPoint":return[{...D,id:`${f}-clusters`,type:"circle",filter:["has","point_count"],paint:{"circle-color":c,"circle-radius":["step",["get","point_count"],15,100,20,750,25],"circle-stroke-width":2,"circle-stroke-color":"white","circle-opacity":.8}},{...D,id:`${f}-cluster-count`,type:"symbol",filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-font":["Poppins Medium","Arial Unicode MS Bold"],"text-size":12,"text-allow-overlap":!0,"text-ignore-placement":!0},paint:{"text-color":"#ffffff","text-halo-color":"rgba(0, 0, 0, 0.3)","text-halo-width":1}},{...D,id:`${f}-unclustered`,type:"circle",filter:["!",["has","point_count"]],paint:{"circle-radius":6,"circle-color":["coalesce",["get","_color"],u],"circle-stroke-width":2,"circle-stroke-color":"white","circle-opacity":.8}}];case"LineString":case"MultiLineString":return{...D,type:"line",paint:{"line-color":["coalesce",["get","_color"],u],"line-width":3,"line-opacity":.8},layout:{"line-join":"round","line-cap":"round"}};case"Polygon":case"MultiPolygon":return[{id:`${f}-fill`,source:m,type:"fill",paint:{"fill-color":["coalesce",["get","_color"],u],"fill-opacity":.3}},{id:`${f}-stroke`,source:m,type:"line",paint:{"line-color":["coalesce",["get","_color"],u],"line-width":2,"line-opacity":.8},layout:{"line-join":"round","line-cap":"round"}},{id:`${f}-labels`,source:m,type:"symbol",layout:{"text-field":["coalesce",["get","label"],""],"text-font":["Poppins Medium","Arial Unicode MS Bold"],"text-size":13,"text-anchor":"center","text-allow-overlap":!1},paint:{"text-color":"#333333","text-halo-color":"rgba(255, 255, 255, 0.9)","text-halo-width":2}}];default:return console.warn(`Unsupported geometry type: ${a}`),null}}(f,a,u,m,u)}function A(f){return"Polygon"===f||"MultiPolygon"===f}function s(f){return"LineString"===f||"MultiLineString"===f}function w(f,a){return a&&("Point"===f||"MultiPoint"===f)}function v(f,a){return w(f,a)?{cluster:!0,clusterMaxZoom:14,clusterRadius:50,clusterMinPoints:2}:{cluster:!1}}},3646(ne,Y,l){"use strict";l.d(Y,{B:()=>N});var F=l(467),g=l(5802),x=l(2271),A=l(4412),s=l(1413),w=l(2306),v=l(140);function c(k){let H=1/0,h=1/0,S=-1/0,R=-1/0;const O=k.features,V=j=>{j.length>=2&&(H=Math.min(H,j[0]),h=Math.min(h,j[1]),S=Math.max(S,j[0]),R=Math.max(R,j[1]))},K=(j,J)=>{if(0===J)V(j);else if(Array.isArray(j))for(const oe of j)K(oe,J-1)};for(const j of O){const J=j.geometry;switch(J.type){case"Point":K(J.coordinates,0);break;case"LineString":case"MultiPoint":K(J.coordinates,1);break;case"Polygon":case"MultiLineString":K(J.coordinates,2);break;case"MultiPolygon":K(J.coordinates,3);break;case"GeometryCollection":for(const oe of J.geometries){const he=c(new v.o([{type:"Feature",geometry:oe,properties:null}]));he&&(V([he[0],he[1]]),V([he[2],he[3]]))}}}return H===1/0?null:[H,h,S,R]}var P=l(6986);let N=(()=>{class k{_layers$=new A.t([]);_map;_sources={};_sourceLayers={};_sourceIds=[];_attachedListeners=[];_hoveredFeature=(0,g.vPA)(void 0);_layerGroups={};_layerClickable={};_pointLayerIds=new Set;_lineLayerIds=new Set;_processedClickEvents=new WeakSet;_clearHoverTimeout;_hoverSequence=0;layers=this._layers$.asObservable();layersSignal=(0,x.EW)(()=>this._layers$.getValue());clickedFeature=new s.B;hoveredFeature=new s.B;initializeWithMap(h){this._map=h,h.on("mousemove",S=>{const R=h.getCanvas();if(!R)return;const O=Object.keys(this._layerClickable).filter(K=>this._layerClickable[K]&&h.getLayer(K)),V=h.queryRenderedFeatures(S.point,{layers:O});R.style.cursor=V.length>0?"pointer":""})}getLayers(){return this._layers$.getValue()}setLayers(h){this._layers$.next([...h])}addLayer(h){const S=this._layers$.getValue(),R=S.findIndex(O=>O.id===h.id);R>=0?S[R]={...h}:S.push({...h}),this._layers$.next([...S])}removeLayer(h){const R=this._layers$.getValue().filter(O=>O.id!==h);this._layers$.next(R),this._deleteSourceIfExists(h.toString()),delete this._sources[h.toString()],delete this._sourceLayers[h.toString()],delete this._layerClickable[h.toString()],this._pointLayerIds.delete(h.toString()),this._lineLayerIds.delete(h.toString()),this._sourceIds=this._sourceIds.filter(O=>O!==h.toString())}toggleVisibility(h){const S=h.toString();if(this._layerGroups[S])return void this.toggleLayerGroupVisibility(S);const O=this._layers$.getValue().map(V=>{if(V.id===h){const K={...V,visible:!V.visible};return this._updateLayerVisibility(h.toString(),K.visible),K}return V});this._layers$.next(O)}setLayerVisibility(h,S){const R=h.toString();if(this._layerGroups[R]){if(this._map){const j=S?"visible":"none";this._layerGroups[R].forEach(J=>{this._map.setLayoutProperty(J,"visibility",j)})}}else this._updateLayerVisibility(R,S);const V=this._layers$.getValue().map(K=>K.id===h?{...K,visible:S}:K);this._layers$.next(V)}loadGeoJSONLayerGroup(h,S,R){var O=this;return(0,F.A)(function*(V,K,j,J={}){const{cluster:oe=!1,zoomToFit:ge=!0,visible:de=!0,label:he=V,color:fe=O._extractColorFromLayer(j[0])}=J;if(!O._map)return void console.warn("Map not initialized in LayerService");const re=V;yield O._addSource(V,{type:"geojson",data:K,...(0,P.Jc)("Point",oe)});const ze=[];for(const ve of j){ze.push(ve.id),O._layerClickable[ve.id]=!0,O._sourceLayers[re]||(O._sourceLayers[re]={layer:ve,clickable:!0});const Xe=ve.type;if("circle"===Xe||"symbol"===Xe)O._pointLayerIds.add(ve.id),O._map.addLayer(ve);else if("line"===Xe){O._lineLayerIds.add(ve.id);const De=O._getBeforePointLayerId();O._map.addLayer(ve,De)}else{const De=O._getBeforeLineLayerId()??O._getBeforePointLayerId();O._map.addLayer(ve,De)}O._map&&O._map.setLayoutProperty(ve.id,"visibility",de?"visible":"none")}for(const ve of j)O._setLayerEvents(re,ve);O._layerGroups[V]=ze;const Fe=new w.ux(he,V);Fe.collection=K,Fe.color=fe,Fe.visible=de,O.addLayer(Fe),ge&&O.fitLayerBounds(V)}).apply(this,arguments)}toggleLayerGroupVisibility(h){const S=this._layerGroups[h];if(!S)return;const R=this.getLayer(h);if(!R)return;const O=!R.visible;if(this._map){const V=O?"visible":"none";S.forEach(K=>{this._map.setLayoutProperty(K,"visibility",V)})}this.updateLayer(h,{visible:O})}removeLayerGroup(h){const S=this._layerGroups[h];S&&(this._map&&(S.forEach(R=>{this._map.removeLayer(R),this._attachedListeners=this._attachedListeners.filter(O=>O!==h),delete this._layerClickable[R],this._pointLayerIds.delete(R),this._lineLayerIds.delete(R)}),this._deleteSourceIfExists(h)),delete this._sources[h],delete this._sourceLayers[h],this._sourceIds=this._sourceIds.filter(R=>R!==h),delete this._layerGroups[h],this.removeLayer(h))}loadGeoJSONLayer(h,S,R){var O=this;return(0,F.A)(function*(V,K,j,J={}){const{cluster:oe=!0,zoomToFit:ge=!0,visible:de=!0,label:he=V,color:fe=O._extractColorFromLayer(j)}=J;if(!O._map)return void console.warn("Map not initialized in LayerService");yield O._addSource(V,{type:"geojson",data:K,...(0,P.Jc)("Point",oe)},j);const re=new w.ux(he,V);re.collection=K,re.color=fe,re.visible=de,O.addLayer(re),O._updateLayerVisibility(V,de),ge&&O.fitLayerBounds(V)}).apply(this,arguments)}_addSource(h,S,R){var O=this;return(0,F.A)(function*(V,K,j,J=!0){O._map&&(O._sources[V]=K,O._deleteSourceIfExists(V),O._sourceIds.push(V),O._map.getSource(V)&&O._map.removeSource(V),O._map.addSource(V,K),j&&O._addSourceLayer(V,j,J))}).apply(this,arguments)}_getBeforePointLayerId(){if(!this._map||0===this._pointLayerIds.size)return;const h=this._map.getStyle()?.layers??[];for(const S of h)if(this._pointLayerIds.has(S.id))return S.id}_getBeforeLineLayerId(){if(!this._map||0===this._lineLayerIds.size)return;const h=this._map.getStyle()?.layers??[];for(const S of h)if(this._lineLayerIds.has(S.id))return S.id}_addSourceLayer(h,S,R=!0){if(!this._map)return;this._layerClickable[S.id]=R,this._sourceLayers[h]||(this._sourceLayers[h]={layer:S,clickable:R});const O=S.type;if("circle"===O||"symbol"===O)this._pointLayerIds.add(S.id),this._map.addLayer(S);else if("line"===O){this._lineLayerIds.add(S.id);const V=this._getBeforePointLayerId();this._map.addLayer(S,V)}else{const V=this._getBeforeLineLayerId()??this._getBeforePointLayerId();this._map.addLayer(S,V)}R&&this._setLayerEvents(h,S)}_updateLayerVisibility(h,S){if(!this._map)return;const R=this._sourceLayers[h];R&&this._map.setLayoutProperty(R.layer.id,"visibility",S?"visible":"none")}getLayer(h){return this._layers$.getValue().find(S=>S.id===h)}updateLayer(h,S){const O=this._layers$.getValue().map(V=>{if(V.id===h){const K={...V,...S};return void 0!==S.visible&&this._updateLayerVisibility(h.toString(),S.visible),K}return V});this._layers$.next(O)}toggleAllLayers(){const h=this._layers$.getValue(),R=!h.some(V=>V.visible),O=h.map(V=>(this._updateLayerVisibility(V.id.toString(),R),{...V,visible:R}));this._layers$.next(O)}getVisibleLayersCount(){return this._layers$.getValue().filter(h=>h.visible).length}getTotalLayersCount(){return this._layers$.getValue().length}hasLayer(h){return this._layers$.getValue().some(S=>S.id===h)}fitGeoJSONBounds(h,S=50,R=!0,O=19){this._fitGeoJSONBounds(h,S,R,O)}fitLayerBounds(h,S=50){const R=this._layers$.getValue().find(O=>O.id===h);!R||!R.collection||!this._map||("features"in R.collection?this._fitGeoJSONBounds(R.collection,S):console.warn("Layer collection is not a FeatureCollection, cannot fit bounds."))}fitAllVisibleLayers(h=50){const S=this._layers$.getValue().filter(K=>K.visible&&K.collection);if(0===S.length||!this._map)return;const R=S.flatMap(K=>{const j=K.collection;return j&&"features"in j&&Array.isArray(j.features)?j.features:[]}),O=new v.o(R),V=c(O);V&&(O.bbox=V),this._fitGeoJSONBounds(O,h)}clearAllLayers(){if(this._map){for(const[h,S]of Object.entries(this._layerGroups))S.forEach(R=>{this._map.getLayer(R)&&this._map.removeLayer(R)}),this._map.getSource(h)&&this._map.removeSource(h);for(const h of this._sourceIds)this._layerGroups[h]||this._deleteSourceIfExists(h)}this._sourceIds=[],this._sourceLayers={},this._sources={},this._attachedListeners=[],this._layerGroups={},this._layerClickable={},this._layers$.next([])}reapplyLayers(){this._map&&(Object.keys(this._sources).forEach(h=>{this._deleteSourceIfExists(h),this._map.addSource(h,this._sources[h]);const S=this._sourceLayers[h];if(S){this._map.addLayer(S.layer);const R=this._layers$.getValue().find(O=>O.id===h);R&&this._updateLayerVisibility(h,R.visible)}}),this._reattachAllLayerEvents())}_extractColorFromLayer(h){if("paint"in h&&"object"==typeof h.paint){const S=h.paint;return S["circle-color"]||S["fill-color"]||S["line-color"]||""}return""}_fitGeoJSONBounds(h,S=50,R=!0,O=19){if(!this._map)return void console.warn("Map not initialized when trying to fit bounds");if(!h.features||0===h.features.length)return void console.warn("No features to fit bounds to");let V=h.bbox;if(!V){const K=c(h);if(!K)return void console.warn("Failed to calculate bbox for GeoJSON");h.bbox=K,V=K}if(V&&4===V.length)try{this._map.fitBounds([[V[0],V[1]],[V[2],V[3]]],{padding:S,maxZoom:O,animate:R})}catch(K){console.error("Error fitting bounds:",K)}}_deleteSourceIfExists(h){if(!this._map||!this._map.getSource(h))return;const R=this._layerGroups[h];if(R)R.forEach(O=>{this._map.getLayer(O)&&this._map.removeLayer(O)});else{const O=Object.values(this._sourceLayers).find(V=>"source"in V.layer&&V.layer.source===h);O&&this._map.getLayer(O.layer.id)&&(this._map.removeLayer(O.layer.id),this._attachedListeners=this._attachedListeners.filter(V=>V!==O.layer.id))}this._map.removeSource(h)}_setLayerEvents(h,S){if(!this._map)return;const R=S.id.endsWith("-fill"),O=S.id.endsWith("-stroke"),V=R?S.id.replace("-fill",""):O?S.id.replace("-stroke",""):S.id;if(R||O){const J=`${V}-stroke`;this._layerClickable[`${V}-fill`]=!0,this._layerClickable[J]=!0}if(!this._layerClickable[S.id])return;const K=[];if(R||O){const j=`${V}-fill`,J=`${V}-stroke`;this._map.getLayer(j)&&K.push(j),this._map.getLayer(J)&&K.push(J)}else K.push(S.id);K.forEach(j=>{this._attachedListeners.includes(j)||(this._map.on("click",j,J=>{if(!J.features||this._processedClickEvents.has(J.originalEvent))return;const oe=J.features[0],ge=oe.properties;if(ge&&!ge.cluster){const de=this.getLayer(h)||this.getLayer(V)||this.getLayer(j);if(de){const he={...oe,geometry:oe.geometry};if(de.collection&&"features"in de.collection){const fe=de.collection.features.find(re=>re.geometry.type===oe.geometry?.type&&JSON.stringify(re.properties)===JSON.stringify(oe.properties));fe&&fe.id&&(he.id=fe.id)}this._processedClickEvents.add(J.originalEvent),this.clickedFeature.next({feature:he,event:J.originalEvent,layer:de,lngLat:J.lngLat})}}}),this._map.on("mouseenter",j,J=>{if(this._hoverSequence++,this._clearHoverTimeout&&(clearTimeout(this._clearHoverTimeout),this._clearHoverTimeout=void 0),!J.features)return;const oe=J.features[0],ge=oe.properties,de={...oe,geometry:oe.geometry};if(ge&&!ge.cluster){const he=this.getLayer(h)||this.getLayer(V)||this.getLayer(j);if(he){if(he.collection&&"features"in he.collection){const fe=he.collection.features.find(re=>re.geometry.type===oe.geometry?.type&&JSON.stringify(re.properties)===JSON.stringify(oe.properties));fe&&fe.id&&(de.id=fe.id)}this.hoveredFeature.next({feature:de,event:J.originalEvent,layer:he,lngLat:J.lngLat})}this._hoveredFeature.set(de)}}),this._map.on("mouseleave",j,()=>{const J=this._hoverSequence;this._clearHoverTimeout=window.setTimeout(()=>{this._hoverSequence===J&&(this._hoveredFeature.set(void 0),this.hoveredFeature.next(void 0)),this._clearHoverTimeout=void 0},50)}),this._map.on("click",j,J=>{if(!J.features)return;const oe=J.features[0].properties;if(oe&&oe.cluster){const ge=this._map?.getZoom();ge&&this._map?.flyTo({center:J.lngLat,zoom:ge+1})}}),this._attachedListeners.push(j))})}_reattachAllLayerEvents(){this._attachedListeners=[],Object.keys(this._sourceLayers).forEach(h=>{const S=this._sourceLayers[h];S&&this._setLayerEvents(h,S.layer)})}static \u0275fac=function(S){return new(S||k)};static \u0275prov=g.jDH({token:k,factory:k.\u0275fac})}return k})()},8017(ne,Y,l){"use strict";l.d(Y,{T:()=>rt});var F=l(467),g=l(5802),x=l(7705),A=l(2271),s=l(5547),w=l(9769),v=l(5970),T=l(6170),y=l(5949),f=l(2843),a=l(3646),u=l(9079),m=l(1413),b=l(2306),D=l(7089),c=l(9352),P=l(5381),N=l(5187),k=l(5971),H=l(3319);function h(M,B){if(1&M){const p=s.RV6();s.j41(0,"cue-button",5),s.nI1(1,"transloco"),s.bIt("click",function(){g.eBV(p);const C=s.XpG(2);return g.Njj(C.handleZoomFit())}),s.nrm(2,"cue-button-icon",9),s.k0s()}2&M&&s.Y8G("cueTooltip",s.bMT(1,1,"components.map.tooltipZoomFit"))}function S(M,B){if(1&M){const p=s.RV6();s.j41(0,"cue-flexcontainer",3)(1,"cue-button",5),s.nI1(2,"transloco"),s.bIt("click",function(){g.eBV(p);const C=s.XpG();return g.Njj(C.handleZoomOut())}),s.nrm(3,"cue-button-icon",6),s.k0s(),s.j41(4,"cue-button",5),s.nI1(5,"transloco"),s.bIt("click",function(){g.eBV(p);const C=s.XpG();return g.Njj(C.handleZoomIn())}),s.nrm(6,"cue-button-icon",7),s.k0s(),s.nVh(7,h,3,3,"cue-button",8),s.k0s()}if(2&M){const p=s.XpG();s.R7$(),s.Y8G("cueTooltip",s.bMT(2,3,"components.map.tooltipZoomOut")),s.R7$(3),s.Y8G("cueTooltip",s.bMT(5,5,"components.map.tooltipZoomIn")),s.R7$(3),s.vxM(p.displayZoomFit()?7:-1)}}function R(M,B){if(1&M){const p=s.RV6();s.j41(0,"cue-button",10),s.nI1(1,"transloco"),s.nI1(2,"transloco"),s.mxI("selectedChange",function(C){g.eBV(p);const U=s.XpG();return s.DH7(U.layersVisible,C)||(U.layersVisible=C),g.Njj(C)}),s.nrm(3,"cue-button-icon",11),s.k0s()}if(2&M){const p=s.XpG();s.AVh("border-left",p.options().displayZoom&&p.displayLayerToggle()),s.Y8G("cueTooltip",p.layersVisible()?s.bMT(1,6,"components.map.tooltipHideLayers"):s.bMT(2,8,"components.map.tooltipShowLayers"))("toggleButton",!0),s.R50("selected",p.layersVisible),s.R7$(3),s.Y8G("icon",p.layersVisible()?"layers-clear":"layers")}}function O(M,B){if(1&M){const p=s.RV6();s.j41(0,"cue-button",10),s.nI1(1,"transloco"),s.nI1(2,"transloco"),s.mxI("selectedChange",function(C){g.eBV(p);const U=s.XpG();return s.DH7(U.geoFenceDrawEnabled,C)||(U.geoFenceDrawEnabled=C),g.Njj(C)}),s.nrm(3,"cue-button-icon",12),s.k0s()}if(2&M){const p=s.XpG();s.AVh("border-left",p.options().displayGeofenceDraw),s.Y8G("cueTooltip",p.geoFenceDrawEnabled()?s.bMT(1,5,"components.map.tooltipEndDrawGeofence"):s.bMT(2,7,"components.map.tooltipDrawGeofence"))("toggleButton",!0),s.R50("selected",p.geoFenceDrawEnabled)}}let V=(()=>{class M{_service=(0,g.WQX)(y.u);layerService=(0,g.WQX)(a.B);mapLayers=(0,u.ot)(this.layerService.layers);options=(0,x.hFB)(new b.AA);zoom=(0,x.geq)(1);rotate=(0,x.CGW)();geoFenceDrawEnabled=(0,x.geq)(!1);layersVisible=(0,x.geq)(!1);hasLayers=(0,A.EW)(()=>void 0!==this.mapLayers()&&this.mapLayers().length>0);displayLayerToggle=(0,A.EW)(()=>this.options().displayLayerToggle&&this.hasLayers());displayZoomFit=(0,A.EW)(()=>this.options().displayZoom&&this.hasLayers());selectMenuPositions=(0,A.EW)(()=>"top"===this.options().position?"bottomleft":"topleft");handleZoomIn(){this._service.zoomIn()}handleZoomOut(){this._service.zoomOut()}handleZoomFit(){this._service.fitGeoJSONBBOX(void 0,.01)}static \u0275fac=function(_){return new(_||M)};static \u0275cmp=s.VBU({type:M,selectors:[["cue-map-toolbar"]],inputs:{options:[1,"options"],zoom:[1,"zoom"],geoFenceDrawEnabled:[1,"geoFenceDrawEnabled"],layersVisible:[1,"layersVisible"]},outputs:{zoom:"zoomChange",rotate:"rotate",geoFenceDrawEnabled:"geoFenceDrawEnabledChange",layersVisible:"layersVisibleChange"},decls:6,vars:4,consts:[["justify","center",1,"container"],[1,"toolbar",3,"padded"],["align","center"],["align","center","gap","s"],["size","xs","variant","ghost",3,"border-left","cueTooltip","toggleButton","selected"],["size","xs","variant","tertiary",3,"click","cueTooltip"],["icon","zoom-out"],["icon","zoom-in"],["size","xs","variant","tertiary",3,"cueTooltip"],["icon","zoom-fit"],["size","xs","variant","ghost",3,"selectedChange","cueTooltip","toggleButton","selected"],[3,"icon"],["icon","polygon"]],template:function(_,C){1&_&&(s.j41(0,"cue-flexcontainer",0)(1,"cue-card",1)(2,"cue-flexcontainer",2),s.nVh(3,S,8,7,"cue-flexcontainer",3),s.nVh(4,R,4,10,"cue-button",4),s.nVh(5,O,4,9,"cue-button",4),s.k0s()()()),2&_&&(s.R7$(),s.Y8G("padded",!1),s.R7$(2),s.vxM(C.options().displayZoom?3:-1),s.R7$(),s.vxM(C.displayLayerToggle()?4:-1),s.R7$(),s.vxM(C.options().displayGeofenceDraw?5:-1))},dependencies:[P.n,N.Z,k.$,H.a,D.d,c.Kj],styles:[".container[_ngcontent-%COMP%]{width:100%;pointer-events:none}.toolbar[_ngcontent-%COMP%]{pointer-events:all;padding:5px 10px}.border-left[_ngcontent-%COMP%]{border-left:1px solid;padding-left:12px}"],changeDetection:0})}return M})();var K=l(7023),j=l(1024),J=l(9421);function oe(M,B){if(1&M&&s.nrm(0,"cue-key-val",1),2&M){const p=B.$implicit;s.Y8G("key",p.key)("val",p.val)}}let ge=(()=>{class M{props=(0,x.hFB)(null);keyVals=(0,A.EW)(()=>{const p=this.props();return p?Object.entries(p).map(([_,C])=>({key:_,val:String(C)})):[]});static \u0275fac=function(_){return new(_||M)};static \u0275cmp=s.VBU({type:M,selectors:[["cue-props-panel"]],inputs:{props:[1,"props"]},decls:4,vars:0,consts:[[2,"height","100%","overflow-y","auto"],[3,"key","val"]],template:function(_,C){1&_&&(s.j41(0,"cue-flexcontainer",0)(1,"cue-key-val-list"),s.Z7z(2,oe,1,2,"cue-key-val",1,s.Vm6),s.k0s()()),2&_&&(s.R7$(2),s.Dyx(C.keyVals()))},dependencies:[j.p,J.F,P.n],encapsulation:2,changeDetection:0})}return M})();var de=l(7517);let he=(()=>{class M{layerService=(0,g.WQX)(a.B);mapLayers=(0,u.ot)(this.layerService.layers);layerDefs=(0,A.EW)(()=>{const p=this.mapLayers();return p?p.map(_=>({label:_.label,color:_.color??"#000000",visible:_.visible,category:_.category})):[]});updateSingle(p){const _=this.mapLayers()?.find(C=>C.label===p.label);_&&this.layerService.toggleVisibility(_.id)}updateAll(p){const _=this.mapLayers();if(_)for(const C of _)C.visible===p&&this.layerService.toggleVisibility(C.id)}static \u0275fac=function(_){return new(_||M)};static \u0275cmp=s.VBU({type:M,selectors:[["cue-layer-panel"]],decls:1,vars:1,consts:[[3,"layerChange","visibilityAll","layers"]],template:function(_,C){1&_&&(s.j41(0,"cue-layer-legend",0),s.bIt("layerChange",function(Z){return C.updateSingle(Z)})("visibilityAll",function(Z){return C.updateAll(Z)}),s.k0s()),2&_&&s.Y8G("layers",C.layerDefs())},dependencies:[w.MD,de.P],encapsulation:2})}return M})();var fe=l(140),re=l(6986);function ve(M){const B=M.flatMap(p=>{const _=function Fe(M){switch(M.type){case"Point":return[M.coordinates[0],M.coordinates[1]];case"MultiPoint":{if(!M.coordinates.length)return null;const B=M.coordinates.reduce((p,_)=>[p[0]+_[0],p[1]+_[1]],[0,0]);return[B[0]/M.coordinates.length,B[1]/M.coordinates.length]}case"LineString":{if(!M.coordinates.length)return null;const B=Math.floor(M.coordinates.length/2);return[M.coordinates[B][0],M.coordinates[B][1]]}case"MultiLineString":{if(!M.coordinates.length||!M.coordinates[0].length)return null;const B=M.coordinates[0],p=Math.floor(B.length/2);return[B[p][0],B[p][1]]}case"Polygon":{if(!M.coordinates.length||!M.coordinates[0].length)return null;const B=M.coordinates[0],p=B.reduce((_,C)=>[_[0]+C[0],_[1]+C[1]],[0,0]);return[p[0]/B.length,p[1]/B.length]}case"MultiPolygon":{if(!M.coordinates.length||!M.coordinates[0]?.length||!M.coordinates[0][0]?.length)return null;const B=M.coordinates[0][0],p=B.reduce((_,C)=>[_[0]+C[0],_[1]+C[1]],[0,0]);return[p[0]/B.length,p[1]/B.length]}default:return null}}(p.geometry);return _?[{type:"Feature",id:p.id,geometry:{type:"Point",coordinates:_},properties:{...p.properties??{},_isCentroid:!0}}]:[]});return[...M,...B]}const lt=["rgba(255, 0, 0, 0.5)","rgba(0, 0, 255, 0.5)","rgba(0, 255, 0, 0.5)","rgba(255, 165, 0, 0.5)","rgba(128, 0, 128, 0.5)","rgba(255, 192, 203, 0.5)","rgba(255, 255, 0, 0.5)"];function _t(M){const B=M.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d\.]+))?\)/);if(B)return{r:parseInt(B[1]),g:parseInt(B[2]),b:parseInt(B[3]),a:B[4]?parseFloat(B[4]):1};const p=M.match(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/);if(p){const _=p[1];return{r:parseInt(3===_.length?_[0]+_[0]:_.slice(0,2),16),g:parseInt(3===_.length?_[1]+_[1]:_.slice(2,4),16),b:parseInt(3===_.length?_[2]+_[2]:_.slice(4,6),16),a:1}}return{r:0,g:0,b:0,a:1}}function Qe(M){if(0===M.length)return lt[0];if(1===M.length)return M[0].color;const B=M.map(ae=>({...ae,totalWeight:ae.featureCount*ae.weight})).sort((ae,ee)=>ee.totalWeight-ae.totalWeight),p=B.reduce((ae,ee)=>ae+ee.totalWeight,0),_=B[0];if(_.totalWeight/p>.6)return _.color;const C=B.slice(0,Math.min(3,B.length)),U=C.reduce((ae,ee)=>ae+ee.totalWeight,0);let Z=0,se=0,ue=0,me=0;for(const ae of C){const ee=_t(ae.color),ye=ae.totalWeight/U;Z+=ee.r*ye,se+=ee.g*ye,ue+=ee.b*ye,me+=ee.a*ye}return function ct(M,B,p,_=1){return _<1?`rgba(${Math.round(M)}, ${Math.round(B)}, ${Math.round(p)}, ${_})`:`rgb(${Math.round(M)}, ${Math.round(B)}, ${Math.round(p)})`}(Z,se,ue,me)}function He(M,B,p,_){if(!_||"Point"!==p&&"MultiPoint"!==p)return[{color:B,weight:1,featureCount:M.length}];const C=M.length;if(C<10)return[{color:B,weight:1,featureCount:C}];let U=0,Z=0,se=0;C>=750?(U=Math.floor(.1*C),Z=Math.floor(.3*C),se=C-U-Z):C>=100?(Z=Math.floor(.4*C),se=C-Z):(se=Math.floor(.8*C),Z=C-se);const ue=[];return se>0&&ue.push({color:B,weight:1,featureCount:se}),Z>0&&ue.push({color:"#f28cb1",weight:2,featureCount:Z}),U>0&&ue.push({color:"#e2f552",weight:3,featureCount:U}),ue}function qe(M,B,p,_,C,U){const Z=Array.isArray(_)?_:[_];(0,re.j5)(C)?M.layerService.loadGeoJSONLayerGroup(B,p,Z,{cluster:!1,zoomToFit:U.zoomToFit,visible:U.visible,label:U.label,color:U.color}):Z.length>1||("Point"===C||"MultiPoint"===C)&&Array.isArray(Z)&&Z.length>1?M.layerService.loadGeoJSONLayerGroup(B,p,Z,{cluster:(0,re.n7)(C,U.cluster),zoomToFit:U.zoomToFit,visible:U.visible,label:U.label,color:U.color}):M.loadGeoJSON(B,p,Z[0],(0,re.n7)(C,U.cluster),U.zoomToFit)}var vt=l(6756),Et=l(356),ut=l(6279);const Ze=["map"],et=M=>({position:"bottomleft",hoveredFeature:M}),bt=(M,B)=>B.label;function Mt(M,B){if(1&M){const p=s.RV6();s.j41(0,"cue-menu-item",6),s.bIt("click",function(C){const U=g.eBV(p).$implicit;return g.Njj(U.action(C))}),s.EFF(1),s.k0s()}if(2&M){const p=B.$implicit;s.R7$(),s.JRh(p.label)}}function Ct(M,B){if(1&M&&(s.j41(0,"cue-menu-wrap"),s.Z7z(1,Mt,2,1,"cue-menu-item",null,bt),s.k0s()),2&M){const p=s.XpG();s.R7$(),s.Dyx(p.contextMenuItems())}}function tt(M,B){if(1&M&&(s.j41(0,"span"),s.EFF(1),s.k0s()),2&M){const p=s.XpG();s.R7$(),s.JRh(p.mapService.error())}}function Tt(M,B){if(1&M){const p=s.RV6();s.j41(0,"cue-map-toolbar",8),s.mxI("zoomChange",function(C){g.eBV(p);const U=s.XpG(2);return s.DH7(U.zoom,C)||(U.zoom=C),g.Njj(C)})("layersVisibleChange",function(C){g.eBV(p);const U=s.XpG(2);return s.DH7(U.layerPanelVisible,C)||(U.layerPanelVisible=C),g.Njj(C)})("geoFenceDrawEnabledChange",function(C){g.eBV(p);const U=s.XpG(2);return s.DH7(U.geoFenceDrawEnabled,C)||(U.geoFenceDrawEnabled=C),g.Njj(C)}),s.k0s()}if(2&M){const p=s.XpG(),_=s.XpG();s.Aen(_.toolbarStyle()),s.Y8G("options",p),s.R50("zoom",_.zoom)("layersVisible",_.layerPanelVisible)("geoFenceDrawEnabled",_.geoFenceDrawEnabled)}}function Lt(M,B){1&M&&s.nVh(0,Tt,1,6,"cue-map-toolbar",7),2&M&&s.vxM(B.hidden?-1:0)}function nt(M,B){1&M&&(s.j41(0,"cue-card",4),s.nrm(1,"cue-layer-panel"),s.k0s())}function Nt(M,B){1&M&&(s.j41(0,"cue-card",5),s.nrm(1,"cue-props-panel",9),s.k0s()),2&M&&(s.R7$(),s.Y8G("props",B))}let rt=(()=>{class M{mapService=(0,g.WQX)(y.u);drawService=(0,g.WQX)(f.M);settings=(0,x.hFB)(new b.yY);center=(0,x.hFB)([8.5,47.4]);layerPanelVisible=(0,x.geq)(!1);zoom=(0,x.geq)(2);instruction=(0,x.geq)("Hello");layers=(0,x.hFB)([]);zoomToFit=(0,x.hFB)(!0);zoomToFitEachLayer=(0,x.hFB)(!1);splitLayersByGeometryType=(0,x.hFB)(!0);maxClickZoom=(0,x.hFB)(1/0);borderRadius=(0,x.hFB)("0");geoFenceDrawEnabled=(0,x.geq)(!1);contextMenuItemsBefore=(0,x.hFB)([]);contextMenuItemsAfter=(0,x.hFB)([]);immidiateDrawMode=(0,x.hFB)(void 0);mapReady=(0,x.CGW)();clickedMap=(0,x.CGW)();pannedMap=(0,x.CGW)();panningMap=(0,x.CGW)();zoomedMap=(0,x.CGW)();clickedFeature=(0,x.CGW)();hoveredFeature=(0,x.CGW)();drawEvent=(0,x.CGW)();layersSaturated=(0,A.EW)(()=>this.layers().map((p,_)=>{const C={...p};return C.color||(C.color=vt.BK[_]),C}));toolbarOptions=(0,A.EW)(()=>this.settings().toolbar);featureBeingHovered=(0,g.vPA)(void 0);lastClickedFeatureEvent=(0,g.vPA)(void 0);lastHoveredFeatureEvent=(0,g.vPA)(void 0);shownProperties=(0,g.vPA)(null);_featureClickedThisTick=!1;_previousLayersHash=(0,g.vPA)("");_userHasInteracted=(0,g.vPA)(!1);toolbarStyle=(0,A.EW)(()=>{const p=this.toolbarOptions();return{position:"absolute",left:p.margin,right:p.margin,["top"===p.position?"top":"bottom"]:p.margin,"z-index":"10",display:"flex","justify-content":"center"}});contextMenuEnabled=(0,A.EW)(()=>{const p=this.contextMenuItems().length>0,_=this.featureBeingHovered(),C=this.lastClickedFeatureEvent();return p&&(void 0!==_||void 0!==C)});contextMenuItems=(0,A.EW)(()=>{const p=this.lastHoveredFeatureEvent(),_=this.lastClickedFeatureEvent(),U=(p?.feature||_?.feature)?.properties||null,Z=U?Object.fromEntries(Object.entries(U).filter(([ye])=>!ye.startsWith("_"))):null,se=p?.lngLat||_?.lngLat||null,me=[...this.contextMenuItemsBefore()||[]],ae=this.settings().contextMenu;Z&&Object.keys(Z).length>0&&ae.showProperties&&me.push({label:"Show properties",action:()=>{this.shownProperties.update(()=>Z)}}),se&&ae.showFlyTo&&me.push({label:"Fly to feature",action:()=>{this.mapService.flyTo([se.lng,se.lat],this.zoom())}});const ee=this.contextMenuItemsAfter()||[];return[...me,...ee]});_mapContainer;_destroy$=new m.B;constructor(){this._subscribeToServiceOutputs(),this._setupEffects(),(0,s.mal)(()=>{this._destroy$.closed||this._tryInitializeMap()})}ngOnDestroy(){this._destroy$.next(),this._destroy$.complete(),this.drawService.destroy(),this.mapService.destroy()}_subscribeToServiceOutputs(){this.mapService.mapReady.pipe((0,u.pQ)()).subscribe(()=>this.mapReady.emit()),this.mapService.clickedMap.pipe((0,u.pQ)()).subscribe(p=>{this._featureClickedThisTick||(this.lastClickedFeatureEvent.update(()=>{}),this.lastHoveredFeatureEvent.update(()=>{}),this.featureBeingHovered.update(()=>{}),this.clickedMap.emit(p),this.shownProperties.update(()=>null))}),this.mapService.pannedMap.pipe((0,u.pQ)()).subscribe(p=>{this._userHasInteracted.set(!0),this.pannedMap.emit(p)}),this.mapService.panningMap.pipe((0,u.pQ)()).subscribe(p=>this.panningMap.emit(p)),this.mapService.zoomedMap.pipe((0,u.pQ)()).subscribe(p=>{this._userHasInteracted.set(!0),this.zoomedMap.emit(this.mapService.getZoom()??this.zoom())}),this.mapService.clickedFeature.pipe((0,u.pQ)()).subscribe(p=>{this._featureClickedThisTick=!0,queueMicrotask(()=>{this._featureClickedThisTick=!1}),this.lastClickedFeatureEvent.update(()=>p),this.clickedFeature.emit(p);const _=p.feature?.geometry?.type,C="Point"===_||"MultiPoint"===_,U=this.mapService.getZoom()??0,Z=this.contextMenuItems().length>0;C&&!Z&&U<this.maxClickZoom()&&this.mapService.zoomToCoordinate(p.lngLat)}),this.mapService.hoveredFeature.pipe((0,u.pQ)()).subscribe(p=>{this.featureBeingHovered.update(()=>p?.feature),this.lastHoveredFeatureEvent.update(()=>p),this.hoveredFeature.emit(p)})}_setupEffects(){var p=this;(0,g.QZP)(()=>{"polygon"===this.immidiateDrawMode()&&(this.geoFenceDrawEnabled.set(!0),setTimeout(()=>{this.drawService.setDrawMode(!0,this.settings().toolbar.clearGeofenceAfterDraw)},500))}),(0,g.QZP)(()=>this.mapService.flyTo(this.center(),this.zoom())),(0,g.QZP)(()=>{const C=this.settings()?.mapboxToken;C&&"string"==typeof C&&""!==C.trim()&&!this.mapService.isMapReady()&&this._tryInitializeMap()}),(0,g.QZP)(()=>{const _=this.geoFenceDrawEnabled();this.drawService.setDrawMode(_,this.settings().toolbar.clearGeofenceAfterDraw)}),(0,g.QZP)(()=>{const _=this.drawService.drawEvent();void 0!==_&&this.drawEvent.emit(_)}),(0,g.QZP)((0,F.A)(function*(){const _=p.layersSaturated();if(!_||0===_.length)return;const C=p._createLayersHash(_);if(C===p._previousLayersHash())return;p._previousLayersHash.set(C),yield p.mapService.waitForMapReady(),p.mapService.clearLayers();const Z=p.zoomToFitEachLayer();_.forEach((se,ue)=>{!function Re(M,B,p,_,C,U,Z){const se=B.collection,ue=B.color??lt[p];let me;me="geometries"in se?function Ne(M){const B=M.geometries.map((_,C)=>({type:"Feature",geometry:_,properties:{},id:M.id?`${M.id}_${C}`:void 0})),p=new fe.o(B);return p.id=M.id,p.bbox=M.bbox,p}(se):se;const ae=function Ae(M){const B=[];return M.forEach(p=>{p.geometry&&"GeometryCollection"===p.geometry.type?p.geometry.geometries.forEach((_,C)=>{B.push({type:"Feature",geometry:_,properties:p.properties||{},id:p.id?`${p.id}_${C}`:void 0})}):B.push(p)}),B}(me.features),ee=new fe.o(ae);ee.id=me.id,ee.bbox=me.bbox;let ye=ue;if(!U){const pe=B.id.toString(),q=ae[0]?.geometry?.type||"Point";ye=Qe(He(ae,ue,q,_));let Ee=Z(pe,q,ye,pe),Ce=ee;const Be="Point"!==q&&"MultiPoint"!==q,be=(0,re.j5)(q),_e=(0,re.dx)(q);if(_&&Be&&!be&&!_e&&Ee){const ot=Array.isArray(Ee)?Ee:[Ee],we=ve(ae);Ce=new fe.o(we),Ce.id=ee.id,Ce.bbox=ee.bbox,Ee=[(0,re.g8)(`${pe}-centroid`,pe,ye),...ot.map(ie=>({...ie,minzoom:re.A4}))]}return void(Ee&&qe(M,pe,Ce,Ee,q,{cluster:_,zoomToFit:C,visible:!0,label:B.label||B.id.toString(),color:ye}))}if(U){const pe=new Set(ae.map(W=>W.geometry.type)),q=[];return pe.forEach(W=>{const Ee=`${B.id.toString()}-${W}`,Ce=ae.filter(_e=>_e.geometry.type===W),Be=He(Ce,ue,W,_);q.push(...Be);let be=Z(Ee,W,ue,Ee);if(be){let _e=new fe.o(Ce);_e.id=ee.id,_e.bbox=ee.bbox;const ot="Point"!==W&&"MultiPoint"!==W,we=(0,re.j5)(W),dt=(0,re.dx)(W);if(_&&ot&&!we&&!dt){const ie=Array.isArray(be)?be:[be],ht=ve(Ce);_e=new fe.o(ht),_e.id=ee.id,_e.bbox=ee.bbox,be=[(0,re.g8)(`${Ee}-centroid`,Ee,ue),...ie.map(St=>({...St,minzoom:re.A4}))]}qe(M,Ee,_e,be,W,{cluster:_,zoomToFit:C,visible:!0,label:pe.size>1?`${B.label||B.id} (${W})`:`${B.label||B.id}`,color:ue})}}),void(q.length>0&&(ye=Qe(q),M.layerService.getLayer(B.id.toString())&&M.layerService.updateLayer(B.id.toString(),{color:ye})))}const We=new Map;ae.forEach(pe=>{const q=pe.geometry.type;let W;W="Point"===q||"MultiPoint"===q?"Point":"LineString"===q||"MultiLineString"===q?"LineString":"Polygon"===q||"MultiPolygon"===q?"Polygon":q,We.has(W)||We.set(W,[]),We.get(W).push(q)});const ke=[];We.forEach((pe,q)=>{const W=`${B.id.toString()}-${q}`,Ee=ae.filter(be=>{const _e=be.geometry.type;return"Point"===q?"Point"===_e||"MultiPoint"===_e:"LineString"===q?"LineString"===_e||"MultiLineString"===_e:"Polygon"===q?"Polygon"===_e||"MultiPolygon"===_e:_e===q}),Ce=He(Ee,ue,q,_);ke.push(...Ce);const Be=Z(W,q,ue,W);if(Be){const be=new fe.o(Ee);be.id=ee.id,be.bbox=ee.bbox,qe(M,W,be,Be,q,{cluster:_,zoomToFit:C,visible:!0,label:We.size>1?`${B.label||B.id} (${q})`:`${B.label||B.id}`,color:ue})}}),ke.length>0&&(ye=Qe(ke),M.layerService.getLayer(B.id.toString())&&M.layerService.updateLayer(B.id.toString(),{color:ye}))}(p.mapService,se,ue,se.cluster,Z&&se.zoomToFit,p.splitLayersByGeometryType(),re.Ln)}),p.zoomToFit()&&!Z&&!p._userHasInteracted()&&p.mapService.fitGeoJSONBBOX()}))}_tryInitializeMap(){if(this._destroy$.closed)return;const _=this.settings()?.mapboxToken,C=_&&"string"==typeof _&&""!==_.trim(),U=this._mapContainer,Z=!this.mapService.isMapReady();C&&U&&Z&&(this._userHasInteracted.set(!1),this.mapService.init(this._mapContainer.nativeElement,_,this.center(),this.zoom(),this.borderRadius()))}_createLayersHash(p){return p.map(_=>{const C=_.collection;let U=0;return C&&"FeatureCollection"===C.type&&"features"in C&&(U=Array.isArray(C.features)?C.features.length:0),`${_.id}|${_.label}|${_.visible}|${U}`}).join("::")}static \u0275fac=function(_){return new(_||M)};static \u0275cmp=s.VBU({type:M,selectors:[["cue-map"]],viewQuery:function(_,C){if(1&_&&s.GBs(Ze,5),2&_){let U;s.mGM(U=s.lsd())&&(C._mapContainer=U.first)}},hostAttrs:["data-component","cue-map-main"],inputs:{settings:[1,"settings"],center:[1,"center"],layerPanelVisible:[1,"layerPanelVisible"],zoom:[1,"zoom"],instruction:[1,"instruction"],layers:[1,"layers"],zoomToFit:[1,"zoomToFit"],zoomToFitEachLayer:[1,"zoomToFitEachLayer"],splitLayersByGeometryType:[1,"splitLayersByGeometryType"],maxClickZoom:[1,"maxClickZoom"],borderRadius:[1,"borderRadius"],geoFenceDrawEnabled:[1,"geoFenceDrawEnabled"],contextMenuItemsBefore:[1,"contextMenuItemsBefore"],contextMenuItemsAfter:[1,"contextMenuItemsAfter"],immidiateDrawMode:[1,"immidiateDrawMode"]},outputs:{layerPanelVisible:"layerPanelVisibleChange",zoom:"zoomChange",instruction:"instructionChange",geoFenceDrawEnabled:"geoFenceDrawEnabledChange",mapReady:"mapReady",clickedMap:"clickedMap",pannedMap:"pannedMap",panningMap:"panningMap",zoomedMap:"zoomedMap",clickedFeature:"clickedFeature",hoveredFeature:"hoveredFeature",drawEvent:"drawEvent"},features:[s.Jv_([y.u,f.M,a.B])],decls:9,vars:9,consts:[["hoveringFeature",""],["map",""],["direction","row",1,"container"],["id","map","cueResized","","cueDarkMode","","trigger","leftclick",3,"darkModeChange","resized","cueContextMenu","contextMenuData","cueContextEnabled"],[1,"layer-panel"],[1,"props-panel"],[3,"click"],[3,"options","style","zoom","layersVisible","geoFenceDrawEnabled"],[3,"zoomChange","layersVisibleChange","geoFenceDrawEnabledChange","options","zoom","layersVisible","geoFenceDrawEnabled"],[3,"props"]],template:function(_,C){if(1&_&&(s.DNE(0,Ct,3,0,"ng-template",null,0,s.C5r),s.j41(2,"cue-flexcontainer",2)(3,"div",3,1),s.bIt("darkModeChange",function(Z){return C.mapService.setDarkMode(Z)})("resized",function(){return C.mapService.onParentResize()}),s.k0s(),s.nVh(5,tt,2,1,"span"),s.nVh(6,Lt,1,1),s.nVh(7,nt,2,0,"cue-card",4),s.nVh(8,Nt,2,1,"cue-card",5),s.k0s()),2&_){let U,Z;const se=s.sdS(1);s.R7$(3),s.Y8G("cueContextMenu",se)("contextMenuData",s.eq3(7,et,C.lastHoveredFeatureEvent()))("cueContextEnabled",C.contextMenuEnabled()),s.R7$(2),s.vxM(C.mapService.error()?5:-1),s.R7$(),s.vxM((U=C.toolbarOptions())?6:-1,U),s.R7$(),s.vxM(C.layerPanelVisible()?7:-1),s.R7$(),s.vxM((Z=C.shownProperties())?8:-1,Z)}},dependencies:[w.MD,v.C,T.R,V,K.Q,Et.M,ut.D,P.n,ge,he,N.Z],styles:["#map[_ngcontent-%COMP%]{flex:1;min-height:0;border-radius:inherit;overflow:hidden}[_nghost-%COMP%]{display:flex;flex-direction:column;position:relative;width:100%;height:100%;min-height:400px;min-width:200px;flex:1 1 auto;align-self:stretch;box-sizing:border-box;overflow:hidden;border-radius:var(--cue-card-border-radius, inherit)}.mapboxgl-canvas-container[_ngcontent-%COMP%], .mapboxgl-canvas[_ngcontent-%COMP%]{border-radius:inherit!important}.mapboxgl-map[_ngcontent-%COMP%]{border-radius:inherit!important;overflow:hidden!important}.container[_ngcontent-%COMP%]{position:relative;width:100%;flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column}.props-panel[_ngcontent-%COMP%]{position:absolute;top:8px;right:8px;bottom:8px;z-index:10}.layer-panel[_ngcontent-%COMP%]{position:absolute;top:10px;left:10px;z-index:10}cue-map-toolbar[_ngcontent-%COMP%]{position:absolute;left:0;right:0;bottom:0;z-index:10;display:flex;justify-content:center}"]})}return M})()},5949(ne,Y,l){"use strict";l.d(Y,{u:()=>T});var F=l(467),g=l(5802),x=l(2271),A=l(1413),s=l(3646),w=l(2843),v=l(9079);let T=(()=>{class y{_map;_mapContainer;_isInitializing=!1;_mapReadyPromiseResolve;_mapReady=new Promise(a=>{this._mapReadyPromiseResolve=a});_emittedReady=!1;_firstThemeReceived=!1;_hoveredFeature=(0,g.vPA)(void 0);_layerService=(0,g.WQX)(s.B);_drawService=(0,g.WQX)(w.M);mapboxToken=(0,g.vPA)("");center=(0,g.vPA)([8.5,47.4]);zoom=(0,g.vPA)(2);borderRadius=(0,g.vPA)("0");mapReady=new A.B;clickedMap=new A.B;pannedMap=new A.B;panningMap=new A.B;zoomedMap=new A.B;error=(0,g.vPA)("");get clickedFeature(){return this._layerService.clickedFeature}get hoveredFeature(){return this._layerService.hoveredFeature}get layers(){return this._layerService.layers}get layersSignal(){return this._layerService.layersSignal}get layerService(){return this._layerService}get drawService(){return this._drawService}get drawEvent(){return this._drawService.drawEvent}_darkMode=(0,g.vPA)(this._getSystemColorPreference());_styleId=(0,x.EW)(()=>this._darkMode()?"madsholten/clwjh4xeu00q601pnczm07jq6":"madsholten/clwjh6ug900q701pn6eor8p51");get map(){return this._map}constructor(){this._layerService.hoveredFeature.pipe((0,v.pQ)()).subscribe(a=>{this._hoveredFeature.set(a?.feature)}),(0,g.QZP)(()=>{this._styleId(),this._firstThemeReceived?void 0!==this._map&&this._updateStyle().catch(a=>{console.error("Failed to update map style:",a)}):this._firstThemeReceived=!0})}destroy(){if(this._layerService?.clearAllLayers(),this._drawService?.destroy(),this._map)try{this._map.remove()}catch(a){console.warn("Error removing map:",a)}this._map=void 0,this._mapContainer&&(this._mapContainer.innerHTML="",this._mapContainer=void 0),this._isInitializing=!1,this._emittedReady=!1,this._mapReady=new Promise(a=>{this._mapReadyPromiseResolve=a})}isMapReady(){return void 0!==this._map&&this._emittedReady&&!this._isInitializing}waitForMapReady(){var a=this;return(0,F.A)(function*(){return a._mapReady})()}init(a,u,m,b,D){var c=this;return(0,F.A)(function*(){if(u&&""!==u.trim())if(c._map||c._isInitializing)console.warn("MapService: Map is already initialized or currently initializing");else{c._isInitializing=!0,c.mapboxToken.set(u),c.center.set(m),c.zoom.set(b),c.borderRadius.set(D),c._mapContainer=a,c._mapContainer&&(c._mapContainer.innerHTML="");try{yield c._loadMapboxCSS();const P=yield l.e(247).then(l.t.bind(l,1247,23)),N=P.default||P;if(!N||"function"!=typeof N.Map)throw new Error("Mapbox GL JS not properly loaded");N.accessToken=c.mapboxToken(),c._map=new N.Map({container:a,style:c._getMapStyleURL(),center:c.center(),zoom:c.zoom()}),c._applyBorderRadius(a),c._initEventListeners(c._map)}catch(P){console.error("Failed to load mapbox-gl:",P),c.error.set("Failed to load map library. Please ensure mapbox-gl is installed.")}finally{c._isInitializing=!1}}else console.warn("MapService: Cannot initialize map without valid mapbox token")})()}loadGeoJSON(a,u,m){var b=this;return(0,F.A)(function*(D,c,P,N=!0,k=!0){return yield b._mapReady,b._layerService.loadGeoJSONLayer(D,c,P,{cluster:N,zoomToFit:k,visible:!0,label:D})}).apply(this,arguments)}fitGeoJSONBBOX(a){var u=this;return(0,F.A)(function*(m,b=50,D=!0,c=19){yield u._mapReady,m?u._layerService.fitGeoJSONBounds(m,b,D,c):u._layerService.fitAllVisibleLayers(b)}).apply(this,arguments)}jumpTo(a,u){this._map?.jumpTo({center:a,zoom:u??this.zoom()})}setDarkMode(a){this._darkMode.set(a)}zoomToCoordinate(a){const u=this._map?.getZoom();if(!u)return;const m=u+1;this._map?.flyTo({center:a,zoom:m})}getZoom(){return this._map?.getZoom()}flyTo(a,u,m){this._map?.flyTo({center:a,zoom:u??this.zoom(),essential:!0,padding:m})}zoomIn(){if(!this._map)return;const a=this._map.getZoom();this._map.flyTo({zoom:a+1})}zoomOut(){if(!this._map)return;const a=this._map.getZoom();this._map.flyTo({zoom:a-1})}clearLayers(){this._layerService.clearAllLayers()}getImage(){const a=this._map?.getCanvas();if(void 0!==a)return a.toDataURL("image/png")}onParentResize(){this._map?.resize()}_loadMapboxCSS(){return(0,F.A)(function*(){return new Promise((a,u)=>{if(document.querySelector('link[href*="mapbox-gl.css"]'))return void a();const m=document.createElement("link");m.rel="stylesheet",m.href="https://api.mapbox.com/mapbox-gl-js/v3.3.0/mapbox-gl.css",m.onload=()=>a(),m.onerror=()=>{const b=document.createElement("link");b.rel="stylesheet",b.href="node_modules/mapbox-gl/dist/mapbox-gl.css",b.onload=()=>a(),b.onerror=()=>u(new Error("Failed to load Mapbox CSS")),document.head.appendChild(b)},document.head.appendChild(m)})})()}_applyBorderRadius(a){const u=this.borderRadius();let m=u;if("0"===u){const D=a.closest("cue-map")?.parentElement;D&&(m=getComputedStyle(D).borderRadius||"0")}"0"!==m&&(a.style.borderRadius=m,a.style.overflow="hidden",setTimeout(()=>{const b=a.querySelector(".mapboxgl-canvas"),D=a.querySelector(".mapboxgl-canvas-container"),c=a.querySelector(".mapboxgl-map");b&&(b.style.borderRadius=m),D&&(D.style.borderRadius=m),c&&(c.style.borderRadius=m)},100))}_initEventListeners(a){a.on("click",u=>{void 0===this._hoveredFeature()&&this.clickedMap.next(u)}),a.on("drag",u=>{void 0===this._hoveredFeature()&&this.panningMap.next(u)}),a.on("dragend",u=>{void 0===this._hoveredFeature()&&this.pannedMap.next(u)}),a.on("zoomend",u=>{this.zoomedMap.next(u)}),a.on("load",()=>{this._emittedReady||(this._layerService.initializeWithMap(a),this._drawService.initializeWithMap(a),this._mapReadyPromiseResolve(),this.mapReady.next(),this._emittedReady=!0)}),a.on("error",u=>{this.error.set(u.error.message)})}_getMapStyleURL(){return`mapbox://styles/${this._styleId()}`}_updateStyle(){var a=this;return(0,F.A)(function*(){if(void 0===a._map)return;const u=a._map.getZoom(),m=a._map.getCenter();void 0!==a._mapContainer&&(yield a.init(a._mapContainer,a.mapboxToken(),m,u,a.borderRadius()),setTimeout(()=>{a._layerService.reapplyLayers(),a._map?.flyTo({center:m,zoom:u})},500))})()}_getSystemColorPreference(){return typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches}static \u0275fac=function(u){return new(u||y)};static \u0275prov=g.jDH({token:y,factory:y.\u0275fac})}return y})()},2306(ne,Y,l){"use strict";l.d(Y,{AA:()=>A,ux:()=>s,yY:()=>x});var F=l(140),g=l(8402);class x{mapboxToken;contextMenu={showProperties:!0,showFlyTo:!0};toolbar=new A}class A{hidden=!1;position="bottom";margin="20px";displayZoom=!0;displayGeofenceDraw=!1;displayLayerToggle=!0;clearGeofenceAfterDraw=!0}class s{label;id;collection=new F.o;color;visible=!0;cluster=!0;zoomToFit=!0;category;constructor(v,T=(0,g.A)()){this.label=v,this.id=T}}},8334(ne,Y,l){"use strict";l.d(Y,{o:()=>A});var F=l(7705),g=l(5547);const x=["*"];let A=(()=>{class s{label=F.hFB.required();active=(0,F.geq)(!1);static \u0275fac=function(T){return new(T||s)};static \u0275cmp=g.VBU({type:s,selectors:[["cue-tab"]],hostVars:1,hostBindings:function(T,y){2&T&&g.Avn("hidden",!y.active())},inputs:{label:[1,"label"],active:[1,"active"]},outputs:{active:"activeChange"},ngContentSelectors:x,decls:1,vars:0,template:function(T,y){1&T&&(g.NAR(),g.SdG(0))},styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0}[hidden][_nghost-%COMP%]{display:none!important}"]})}return s})()},6455(ne,Y,l){"use strict";l.d(Y,{t:()=>T});var F=l(7705),g=l(5802),x=l(8334),A=l(5547);const s=["*"],w=(y,f)=>f.label();function v(y,f){if(1&y){const a=A.RV6();A.rj2(0,"button",3),A.VwU("click",function(){const m=g.eBV(a).$index,b=A.XpG();return g.Njj(b.setActive(m))}),A.EFF(1),A.eux()}if(2&y){const a=f.$implicit,u=f.$index,m=A.XpG();A.AVh("active",m.activeIndex()===u),A.R7$(),A.SpI(" ",a.label()," ")}}let T=(()=>{class y{tabs=(0,F.tEk)(x.o);activeIndex=(0,g.vPA)(0);constructor(){(0,g.QZP)(()=>{const a=this.tabs(),u=this.activeIndex();a.forEach((m,b)=>m.active.set(b===u))})}setActive(a){this.activeIndex.set(a)}static \u0275fac=function(u){return new(u||y)};static \u0275cmp=A.VBU({type:y,selectors:[["cue-tabs"]],contentQueries:function(u,m,b){1&u&&A.C6U(b,m.tabs,x.o,4),2&u&&A.NyB()},ngContentSelectors:s,decls:5,vars:0,consts:[[1,"tabs-header"],[1,"tab-button",3,"active"],[1,"tabs-content"],[1,"tab-button",3,"click"]],template:function(u,m){1&u&&(A.NAR(),A.rj2(0,"div",0),A.Z7z(1,v,2,3,"button",1,w),A.eux(),A.rj2(3,"div",2),A.SdG(4),A.eux()),2&u&&(A.R7$(),A.Dyx(m.tabs()))},styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;border-radius:var(--cue-card-border-radius);border:1px solid var(--cue-card-border-color);background-color:var(--cue-default);color:var(--cue-defaultContrast);box-sizing:border-box;overflow:hidden}.tabs-header[_ngcontent-%COMP%]{display:flex;border-bottom:1px solid var(--cue-card-border-color);background-color:var(--cue-default)}.tab-button[_ngcontent-%COMP%]{padding:10px 16px;background:none;border:none;border-bottom:2px solid transparent;cursor:pointer;color:var(--cue-defaultContrast);font-family:var(--cue-font-family);font-size:var(--cue-font-s-size);line-height:var(--cue-font-s-line-height);opacity:.6;transition:opacity .15s,border-bottom-color .15s}.tab-button[_ngcontent-%COMP%]:hover{opacity:.9}.tab-button.active[_ngcontent-%COMP%]{border-bottom-color:var(--cue-accent);opacity:1;font-weight:500}.tabs-content[_ngcontent-%COMP%]{padding:var(--cue-card-padding-y) var(--cue-card-padding-x);flex:1;min-height:0;box-sizing:border-box;display:flex;flex-direction:column}"]})}return y})()},7335(ne,Y,l){"use strict";l.d(Y,{e:()=>T});var F=l(7705),g=l(5802),x=l(5547),A=l(8359),s=l(6939),w=l(63),v=l(4853);let T=(()=>{class y{_targetEl=(0,g.WQX)(x.aKT);_overlay=(0,g.WQX)(w.hJ);_overlayRef;_isOverlayHovered=!1;_subscriptions;display=(0,F.hFB)("on-hover");menuItems=F.hFB.required();menuEnabled=(0,F.hFB)(!0);onMouseEnter(){if("on-hover"===this.display()){if(!this.menuItems().length)return void this.removeOverlayMenu();this.appendOverlayMenu()}}onMouseLeave(){this._checkShouldRemoveOverlay()}appendOverlayMenu(){if(!this.menuItems().length||this._overlayRef)return;const a=this._overlay.create({positionStrategy:this._overlay.position().flexibleConnectedTo(this._targetEl).withPositions([{originX:"end",originY:"center",overlayX:"start",overlayY:"center",offsetX:2,offsetY:0}])});this._overlayRef=a;const u=window.getComputedStyle(this._targetEl.nativeElement).color;a.overlayElement.style.color=u;const m=new s.A8(v.H),b=a.attach(m);b.instance.items=this.menuItems,this._subscriptions&&this._subscriptions.unsubscribe(),this._subscriptions=new A.yU,this._subscriptions.add(b.instance.mouseEnter.subscribe(()=>{this._isOverlayHovered=!0})),this._subscriptions.add(b.instance.mouseLeave.subscribe(()=>{this._isOverlayHovered=!1,this._checkShouldRemoveOverlay()}))}removeOverlayMenu(){this._overlayRef&&(this._subscriptions&&(this._subscriptions.unsubscribe(),this._subscriptions=void 0),this._overlayRef.detach(),this._overlayRef.dispose(),this._overlayRef=void 0)}_checkShouldRemoveOverlay(){setTimeout(()=>{this._isOverlayHovered||this.removeOverlayMenu()},300)}static \u0275fac=function(u){return new(u||y)};static \u0275dir=x.FsC({type:y,selectors:[["","cueEntityMenu",""]],hostBindings:function(u,m){1&u&&x.bIt("mouseenter",function(){return m.onMouseEnter()})("mouseleave",function(){return m.onMouseLeave()})},inputs:{display:[1,"display"],menuItems:[1,"menuItems"],menuEnabled:[1,"menuEnabled"]}})}return y})()},140(ne,Y,l){"use strict";l.d(Y,{o:()=>F});class F{type="FeatureCollection";features=[];bbox;id;constructor(x=[]){this.features=x}addFeature(x){this.features.push(x)}removeFeature(x){return this.features.splice(x,1)[0]}getFeatureCount(){return this.features.length}clear(){this.features=[]}}},58(ne,Y,l){"use strict";function F(a){let u=0,m=-1,b=-1;for(let D=0;D<a.length;D++)if("("===a[D])u++,1===u&&(m=D+1);else if(")"===a[D]&&(u--,0===u)){b=D;break}return-1!==m&&-1!==b?a.substring(m,b):null}l.d(Y,{S:()=>y,n:()=>f});class g{x;y;z;constructor(u,m,b){this.x=u,this.y=m,this.z=b}}class x{points;constructor(u){this.points=u}}class A{lines;constructor(u){this.lines=u}}function y(a){if(a){if((a=a.trim().toUpperCase()).startsWith("POINT"))return function w(a){a=a.trim().toUpperCase();const m=F(a)?.split(" ")??[];return a.includes("POINT Z")?new g(parseFloat(m[0]),parseFloat(m[1]),parseFloat(m[2])):new g(parseFloat(m[0]),parseFloat(m[1]))}(a);if(a.startsWith("LINESTRING"))return function s(a){const u=F(a=a.trim().toUpperCase()),m=[];return u?.split(",").map(b=>b.trim().split(" ").map(D=>parseFloat(D))).map(b=>{m.push(new g(b[0],b[1],b[2]))}),new x(m)}(a);if(a.startsWith("POLYGON"))return function v(a){const u=F(a=a.trim().toUpperCase());if(!u)return new A([]);const m=u.match(/\(([^)]+)\)/g);if(!m)return new A([]);const b=m.map(D=>{const c=F(D);return c?c.split(",").map(P=>{const N=P.trim().split(" ");return N.length>=3?new g(parseFloat(N[0]),parseFloat(N[1]),parseFloat(N[2])):new g(parseFloat(N[0]),parseFloat(N[1]))}):[]});return new A(b)}(a)}}function f(a){if(a instanceof g)return{type:"Point",coordinates:void 0!==a.z?[a.x,a.y,a.z]:[a.x,a.y]};if(a instanceof x)return{type:"LineString",coordinates:a.points.map(u=>void 0!==u.z?[u.x,u.y,u.z]:[u.x,u.y])};if(a instanceof A)return{type:"Polygon",coordinates:a.lines.map(u=>u.map(m=>void 0!==m.z?[m.x,m.y,m.z]:[m.x,m.y]))};throw new Error("Unknown WKT type")}},362(ne){"use strict";ne.exports=function Y(l,F){if(l===F)return!0;if(l&&F&&"object"==typeof l&&"object"==typeof F){if(l.constructor!==F.constructor)return!1;var g,x,A;if(Array.isArray(l)){if((g=l.length)!=F.length)return!1;for(x=g;0!==x--;)if(!Y(l[x],F[x]))return!1;return!0}if(l.constructor===RegExp)return l.source===F.source&&l.flags===F.flags;if(l.valueOf!==Object.prototype.valueOf)return l.valueOf()===F.valueOf();if(l.toString!==Object.prototype.toString)return l.toString()===F.toString();if((g=(A=Object.keys(l)).length)!==Object.keys(F).length)return!1;for(x=g;0!==x--;)if(!Object.prototype.hasOwnProperty.call(F,A[x]))return!1;for(x=g;0!==x--;){var s=A[x];if(!Y(l[s],F[s]))return!1}return!0}return l!=l&&F!=F}},5332(ne,Y,l){"use strict";l.d(Y,{k:()=>A});for(var g=[],x=0;x<256;++x)g.push((x+256).toString(16).slice(1));function A(v,T=0){return(g[v[T+0]]+g[v[T+1]]+g[v[T+2]]+g[v[T+3]]+"-"+g[v[T+4]]+g[v[T+5]]+"-"+g[v[T+6]]+g[v[T+7]]+"-"+g[v[T+8]]+g[v[T+9]]+"-"+g[v[T+10]]+g[v[T+11]]+g[v[T+12]]+g[v[T+13]]+g[v[T+14]]+g[v[T+15]]).toLowerCase()}},8402(ne,Y,l){"use strict";l.d(Y,{A:()=>T});const g={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};var x,A=new Uint8Array(16);function s(){if(!x&&!(x=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return x(A)}var w=l(5332);const T=function v(y,f,a){if(g.randomUUID&&!f&&!y)return g.randomUUID();var u=(y=y||{}).random||(y.rng||s)();if(u[6]=15&u[6]|64,u[8]=63&u[8]|128,f){a=a||0;for(var m=0;m<16;++m)f[a+m]=u[m];return f}return(0,w.k)(u)}},6119(ne){ne.exports.RADIUS=6378137,ne.exports.FLATTENING=1/298.257223563,ne.exports.POLAR_RADIUS=6356752.3142}}]);
|
|
1
|
+
(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[170,446],{503(te,Y,l){var F=l(6119);function x(A){var v=0;if(A&&A.length>0){v+=Math.abs(D(A[0]));for(var C=1;C<A.length;C++)v-=Math.abs(D(A[C]))}return v}function D(A){var v,C,p,a,u,y,M=0,w=A.length;if(w>2){for(y=0;y<w;y++)y===w-2?(p=w-2,a=w-1,u=0):y===w-1?(p=w-1,a=0,u=1):(p=y,a=y+1,u=y+2),v=A[p],C=A[a],M+=(s(A[u][0])-s(v[0]))*Math.sin(s(C[1]));M=M*F.RADIUS*F.RADIUS/2}return M}function s(A){return A*Math.PI/180}te.exports.geometry=function f(A){var C,v=0;switch(A.type){case"Polygon":return x(A.coordinates);case"MultiPolygon":for(C=0;C<A.coordinates.length;C++)v+=x(A.coordinates[C]);return v;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(C=0;C<A.geometries.length;C++)v+=f(A.geometries[C]);return v}},te.exports.ring=D},5341(te){te.exports=function l(F){if(!F||!F.type)return null;var f=Y[F.type];return f?"geometry"===f?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:F}]}:"feature"===f?{type:"FeatureCollection",features:[F]}:"featurecollection"===f?F:void 0:null};var Y={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"}},3183(te,Y,l){"use strict";l.d(Y,{A:()=>y});var F=l(7705),f=l(5802),x=l(9417),D=l(1359),s=l(8957),A=l(2245),v=l(5381),C=l(5547);const m=(M,w)=>w.value;function p(M,w){if(1&M){const c=C.RV6();C.j41(0,"cue-input",6),C.bIt("valueChange",function(N){f.eBV(c);const k=C.XpG();return k.searchText=N,f.Njj(k.onSearchChange())}),C.k0s()}if(2&M){const c=C.XpG();C.Y8G("value",c.searchText)}}function a(M,w){if(1&M){const c=C.RV6();C.j41(0,"cue-checkbox",7),C.bIt("checkedChange",function(N){const k=f.eBV(c).$implicit,H=C.XpG();return k.selected=N,f.Njj(H.onSelectionChange())}),C.k0s()}if(2&M){const c=w.$implicit;C.Y8G("label",c.value||"(blank)")("checked",c.selected)}}function u(M,w){1&M&&(C.j41(0,"cue-typography",5),C.EFF(1,"No results"),C.k0s())}let y=(()=>{class M{_cdr=(0,f.WQX)(F.gRc);_params;options=[];filteredOptions=[];searchText="";agInit(c){this._params=c}afterGuiAttached(c){this._refreshOptions(),this._cdr.markForCheck()}onNewRowsLoaded(){this._refreshOptions(),this._cdr.markForCheck()}isFilterActive(){return this.options.some(c=>!c.selected)}doesFilterPass(c){const S=new Set(this.options.filter(h=>h.selected).map(h=>h.value)),N=this._params.getValue(c.node),k=null==N?"":String(N);return"..."===k||"Loading..."===k||(""===k?S.has(""):k.split(", ").map(h=>h.trim()).some(h=>S.has(h)))}getModel(){return this.isFilterActive()?{selectedValues:this.options.filter(c=>c.selected).map(c=>c.value)}:null}setModel(c){if(c){const S=new Set(c.selectedValues);this.options.forEach(N=>N.selected=S.has(N.value))}else this.options.forEach(S=>S.selected=!0);this._applySearch(),this._cdr.markForCheck()}onSelectionChange(){this._params.filterChangedCallback(),this._cdr.markForCheck()}onSearchChange(){this._applySearch(),this._cdr.markForCheck()}get allSelected(){return this.options.length>0&&this.options.every(c=>c.selected)}toggleAll(c){this.options.forEach(S=>S.selected=c),this._applySearch(),this._params.filterChangedCallback(),this._cdr.markForCheck()}_refreshOptions(){const c=new Set;this._params.api.forEachNode(N=>{const k=this._params.getValue(N);if(null==k||""===k)c.add("");else{const H=String(k);if("..."===H||"Loading..."===H)return;const h=H.split(", ").map(P=>P.trim());for(const P of h)c.add(P)}});const S=new Map(this.options.map(N=>[N.value,N.selected]));this.options=Array.from(c).sort((N,k)=>N.localeCompare(k)).map(N=>({value:N,selected:S.get(N)??!0})),this._applySearch()}_applySearch(){const c=this.searchText.toLowerCase().trim();this.filteredOptions=c?this.options.filter(S=>S.value.toLowerCase().includes(c)):this.options}static \u0275fac=function(S){return new(S||M)};static \u0275cmp=C.VBU({type:M,selectors:[["cue-multi-select-filter"]],decls:7,vars:3,consts:[["direction","column","gap","s"],["placeholder","Search...","size","s",3,"value"],["size","s","label","Select all",3,"checkedChange","checked"],[1,"msf-list"],["size","s",3,"label","checked"],["size","s"],["placeholder","Search...","size","s",3,"valueChange","value"],["size","s",3,"checkedChange","label","checked"]],template:function(S,N){1&S&&(C.j41(0,"cue-flexcontainer",0),C.nVh(1,p,1,1,"cue-input",1),C.j41(2,"cue-checkbox",2),C.bIt("checkedChange",function(H){return N.toggleAll(H)}),C.k0s(),C.j41(3,"div",3),C.Z7z(4,a,1,2,"cue-checkbox",4,m),C.nVh(6,u,2,0,"cue-typography",5),C.k0s()()),2&S&&(C.R7$(),C.vxM(N.options.length>10?1:-1),C.R7$(),C.Y8G("checked",N.allSelected),C.R7$(2),C.Dyx(N.filteredOptions),C.R7$(2),C.vxM(0===N.filteredOptions.length?6:-1))},dependencies:[x.YN,D.S,s.p,A.Typography,v.n],styles:["[_nghost-%COMP%]{display:block;padding:var(--cue-card-padding-y) var(--cue-card-padding-x);min-width:200px;max-width:300px;box-sizing:border-box}.msf-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;max-height:200px;overflow-y:auto}"],changeDetection:0})}return M})()},5902(te,Y,l){"use strict";l.d(Y,{U:()=>u});var F=l(7705),f=l(5802),x=l(2271),D=l(9352),s=l(8957),A=l(2444),v=l(2245),C=l(5381),m=l(5547);function p(y,M){if(1&y){const w=m.RV6();m.j41(0,"cue-input",4),m.bIt("valueChange",function(S){f.eBV(w);const N=m.XpG();return f.Njj(N.onValueChange(S))}),m.k0s()}if(2&y){const w=m.XpG();m.Y8G("value",w.filterText)}}function a(y,M){if(1&y){const w=m.RV6();m.j41(0,"cue-typography",5),m.bIt("click",function(){f.eBV(w);const S=m.XpG();return f.Njj(S.clear())}),m.EFF(1,"Clear"),m.k0s()}}let u=(()=>{class y{_cdr=(0,f.WQX)(F.gRc);_params;filterText="";filterType="contains";filterTypeOptions=["contains","notContains","equals","notEqual","startsWith","endsWith","blank","notBlank"];_labelContains=(0,D.Xx)("components.agGridColumnSelect.textFilterContains");_labelNotContains=(0,D.Xx)("components.agGridColumnSelect.textFilterNotContains");_labelEquals=(0,D.Xx)("components.agGridColumnSelect.textFilterEquals");_labelNotEqual=(0,D.Xx)("components.agGridColumnSelect.textFilterNotEqual");_labelStartsWith=(0,D.Xx)("components.agGridColumnSelect.textFilterStartsWith");_labelEndsWith=(0,D.Xx)("components.agGridColumnSelect.textFilterEndsWith");_labelBlank=(0,D.Xx)("components.agGridColumnSelect.textFilterBlank");_labelNotBlank=(0,D.Xx)("components.agGridColumnSelect.textFilterNotBlank");filterTypeLabelMap=(0,x.EW)(()=>({contains:this._labelContains(),notContains:this._labelNotContains(),equals:this._labelEquals(),notEqual:this._labelNotEqual(),startsWith:this._labelStartsWith(),endsWith:this._labelEndsWith(),blank:this._labelBlank(),notBlank:this._labelNotBlank()}));showTextInput=(0,x.EW)(()=>!["blank","notBlank"].includes(this.filterType));agInit(w){this._params=w}afterGuiAttached(w){this._cdr.markForCheck()}isFilterActive(){return!!["blank","notBlank"].includes(this.filterType)||this.filterText.trim().length>0}doesFilterPass(w){const c=this._params.getValue(w.node),S=null==c?"":String(c),N=this.filterText.toLowerCase().trim(),k=S.toLowerCase();switch(this.filterType){case"contains":default:return k.includes(N);case"notContains":return!k.includes(N);case"equals":return k===N;case"notEqual":return k!==N;case"startsWith":return k.startsWith(N);case"endsWith":return k.endsWith(N);case"blank":return""===S;case"notBlank":return""!==S}}getModel(){return this.isFilterActive()?{filterType:"text",type:this.filterType,filter:this.filterText}:null}setModel(w){this.filterText=w?.filter??"",this.filterType=w?.type??"contains",this._cdr.markForCheck()}onValueChange(w){this.filterText=w,this._params.filterChangedCallback(),this._cdr.markForCheck()}onFilterTypeChange(w){this.filterType=String(w||"contains"),["blank","notBlank"].includes(this.filterType)&&(this.filterText=""),this._params.filterChangedCallback(),this._cdr.markForCheck()}clear(){this.filterText="",this.filterType="contains",this._params.filterChangedCallback(),this._cdr.markForCheck()}static \u0275fac=function(c){return new(c||y)};static \u0275cmp=m.VBU({type:y,selectors:[["cue-text-filter"]],decls:4,vars:5,consts:[["direction","column","gap","s"],["size","s",3,"valueChange","value","options","labelMap"],["placeholder","Filter...","size","s",3,"value"],["size","s",2,"cursor","pointer","text-align","right"],["placeholder","Filter...","size","s",3,"valueChange","value"],["size","s",2,"cursor","pointer","text-align","right",3,"click"]],template:function(c,S){1&c&&(m.j41(0,"cue-flexcontainer",0)(1,"cue-select",1),m.bIt("valueChange",function(k){return S.onFilterTypeChange(k)}),m.k0s(),m.nVh(2,p,1,1,"cue-input",2),m.nVh(3,a,2,0,"cue-typography",3),m.k0s()),2&c&&(m.R7$(),m.Y8G("value",S.filterType)("options",S.filterTypeOptions)("labelMap",S.filterTypeLabelMap()),m.R7$(),m.vxM(S.showTextInput()?2:-1),m.R7$(),m.vxM(S.filterText||"contains"!==S.filterType?3:-1))},dependencies:[s.p,A.l,v.Typography,C.n],styles:["[_nghost-%COMP%]{display:block;padding:var(--cue-card-padding-y) var(--cue-card-padding-x);min-width:180px;max-width:280px;box-sizing:border-box}"],changeDetection:0})}return y})()},6756(te,Y,l){"use strict";l.d(Y,{BK:()=>F,In:()=>m,Kz:()=>p,Mc:()=>u,U6:()=>x,g0:()=>y,g8:()=>D,r:()=>f,u9:()=>A});const F=["#2B5DE6","#1A2B50","#C5E045","#6FA8FF","#00C2E0","#5847EB","#008585","#4ADE80","#0F4C81","#8B5CF6","#FACC15","#FB923C","#F43F5E","#E879F9","#D97706","#334155","#64748B","#94A3B8","#C7D2FE","#F8FAFC"];function f(c){switch(c){case"primary":default:return"#2859e1";case"accent":return"#e2f552";case"tertiary":return"#ffffff"}}function x(c){switch(c){case"primary":default:return"#1744c2";case"accent":return"#b8cc3f";case"tertiary":return"#eeeeee"}}function D(c){const[S,N,k]=function s(c,S){if(void 0===c)return[];const k=window.getComputedStyle(c.nativeElement);return S.map(H=>k.getPropertyValue(H).trim()||"")}(c,["--cue-chart-text-color","--cue-chart-border-background-color","--chart-graph-edge-color"]);return{text:S,borderBackground:N,edgeColor:k}}const A={fontFamily:"Poppins, sans-serif",fontWeight:"normal",color:"#333"};function m(c){return c>=1e6?`${(c/1e6).toFixed(1)}m`:c>=1e3?`${(c/1e3).toFixed(0)}k`:c.toString()}function p(c,S,N,k){if(1===k)return c;const H=M(c),h=M(S),P=N/(k-1);return`rgb(${Math.round(H.r+(h.r-H.r)*P)}, ${Math.round(H.g+(h.g-H.g)*P)}, ${Math.round(H.b+(h.b-H.b)*P)})`}const u=(c,S)=>void 0===S?c:S.children??[];function y(c,S,N=.05,k="Other"){const H=c.reduce((R,O)=>R+w(O),0),h=[],P=[];if(c.forEach(R=>{let O,V;O=void 0===R.value&&Array.isArray(R.children)&&R.children.length>0?R.children.reduce((j,J)=>j+w(J),0):void 0!==R.value?R.value:0,Array.isArray(R.children)&&R.children.length>0&&(V=y(R.children,S,N,k));const K={...R,value:O,children:V};S&&H>0&&O/H<N?P.push(K):h.push(K)}),S&&P.length>0){const R=P.reduce((O,V)=>O+V.value,0);h.push({id:"__grouped_small__",name:k,value:R,children:P,isGroup:!0})}return h}function M(c){const S=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(c);return S?{r:parseInt(S[1],16),g:parseInt(S[2],16),b:parseInt(S[3],16)}:{r:0,g:0,b:0}}function w(c){return"number"==typeof c.value?c.value:Array.isArray(c.children)&&c.children.length>0?c.children.reduce((S,N)=>S+w(N),0):0}},4853(te,Y,l){"use strict";l.d(Y,{H:()=>c});var F=l(7705),f=l(5802),x=l(7089),D=l(7023),s=l(5381),A=l(5971),v=l(3319),C=l(356),m=l(6279),p=l(5547);const a=()=>({position:"bottomleft"}),u=(S,N)=>N.label||S;function y(S,N){if(1&S){const k=p.RV6();p.j41(0,"cue-menu-item",4),p.bIt("click",function(){const h=f.eBV(k).$implicit;return f.Njj(h.action())}),p.EFF(1),p.k0s()}if(2&S){const k=N.$implicit;p.Y8G("selected",k.selected),p.R7$(),p.JRh(k.label)}}function M(S,N){if(1&S&&(p.j41(0,"cue-menu-wrap"),p.Z7z(1,y,2,2,"cue-menu-item",3,u),p.k0s()),2&S){const k=p.XpG();p.R7$(),p.Dyx(k.contextMenuItems())}}function w(S,N){if(1&S){const k=p.RV6();p.j41(0,"cue-button",5),p.bIt("click",function(h){const P=f.eBV(k).$implicit,R=p.XpG();return f.Njj(R.handleClick(h,P))}),p.nrm(1,"cue-button-icon",6),p.k0s()}if(2&S){const k=N.$implicit,H=p.XpG(),h=p.sdS(1);p.Y8G("cueTooltip",k.label)("variant",k.variant?k.variant:H.variant())("size",H.size())("cueContextMenu",h)("contextMenuData",p.lJ4(7,a))("cueContextEnabled",void 0!==k.contextMenuItems&&k.contextMenuItems.length>0),p.R7$(),p.Y8G("icon",k.icon)}}let c=(()=>{class S{items=F.hFB.required();noGap=(0,F.hFB)(!0);direction=(0,F.hFB)("row");size=(0,F.hFB)("xs");variant=(0,F.hFB)("tertiary");mouseEnter=(0,F.CGW)();mouseLeave=(0,F.CGW)();contextMenuItems=(0,f.vPA)([]);handleClick(k,H){k.stopPropagation(),H.contextMenuItems&&H.contextMenuItems.length>0?this.contextMenuItems.set(H.contextMenuItems):H.action&&(this.contextMenuItems.set([]),H.action())}static \u0275fac=function(H){return new(H||S)};static \u0275cmp=p.VBU({type:S,selectors:[["cue-entity-menu"]],inputs:{items:[1,"items"],noGap:[1,"noGap"],direction:[1,"direction"],size:[1,"size"],variant:[1,"variant"]},outputs:{mouseEnter:"mouseEnter",mouseLeave:"mouseLeave"},decls:5,vars:2,consts:[["contextMenu",""],["gap","s","justify","end",2,"width","100%",3,"mouseenter","mouseleave","direction","noGap"],["trigger","leftclick",3,"cueTooltip","variant","size","cueContextMenu","contextMenuData","cueContextEnabled"],[3,"selected"],[3,"click","selected"],["trigger","leftclick",3,"click","cueTooltip","variant","size","cueContextMenu","contextMenuData","cueContextEnabled"],[3,"icon"]],template:function(H,h){1&H&&(p.DNE(0,M,3,0,"ng-template",null,0,p.C5r),p.j41(2,"cue-flexcontainer",1),p.bIt("mouseenter",function(){return h.mouseEnter.emit()})("mouseleave",function(){return h.mouseLeave.emit()}),p.Z7z(3,w,2,8,"cue-button",2,u),p.k0s()),2&H&&(p.R7$(2),p.Y8G("direction",h.direction())("noGap",h.noGap()),p.R7$(),p.Dyx(h.items()))},dependencies:[s.n,A.$,x.d,v.a,D.Q,C.M,m.D],encapsulation:2,changeDetection:0})}return S})()},1024(te,Y,l){"use strict";l.d(Y,{p:()=>x});var F=l(5547);const f=["*"];let x=(()=>{class D{static \u0275fac=function(v){return new(v||D)};static \u0275cmp=F.VBU({type:D,selectors:[["cue-key-val-list"]],ngContentSelectors:f,decls:2,vars:0,consts:[[1,"key-val-list"]],template:function(v,C){1&v&&(F.NAR(),F.rj2(0,"div",0),F.SdG(1),F.eux())},styles:[".key-val-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--cue-grid-gap-s)}"]})}return D})()},9421(te,Y,l){"use strict";l.d(Y,{F:()=>v});var F=l(7705),f=l(5802),x=l(2271),D=l(7335),s=l(2245),A=l(5547);let v=(()=>{class C{entityMenuDirective;size=(0,F.hFB)("m");key=F.hFB.required();val=F.geq.required();options=(0,F.hFB)([]);suffix=(0,F.hFB)("");valueChange=(0,F.CGW)();editModeEnabled=(0,f.vPA)(!1);valueChanged=(0,x.EW)(()=>this.val()!==this.newValue());newValue=(0,x.uu)(()=>this.val());labelSize=(0,x.EW)(()=>{switch(this.size()){case"s":return"xs";case"m":return"s";case"l":return"m";case"xl":return"l"}});onKeyPress(p){this.editModeEnabled()&&("Escape"===p.key?(this._reset(),p.stopPropagation()):"Enter"===p.key&&this._emitChange())}saveCancelMenu=(0,x.EW)(()=>{const p=[{icon:"close",label:"Cancel",action:()=>this._reset()}];return this.valueChanged()&&p.push({icon:"save",label:"Save",action:()=>this._emitChange()}),p});selectionChange(p){this.newValue.set(p?.toString()??"")}inputChange(p){this.newValue.set(p)}_emitChange(){this.valueChange.emit(this.newValue()),this.val.set(this.newValue()),this.editModeEnabled.set(!1)}_reset(){this.newValue.set(this.val()),this.editModeEnabled.set(!1)}static \u0275fac=function(a){return new(a||C)};static \u0275cmp=A.VBU({type:C,selectors:[["cue-key-val"]],viewQuery:function(a,u){if(1&a&&A.GBs(D.e,5),2&a){let y;A.mGM(y=A.lsd())&&(u.entityMenuDirective=y.first)}},hostBindings:function(a,u){1&a&&A.bIt("keydown",function(M){return u.onKeyPress(M)},A.EBC)},inputs:{size:[1,"size"],key:[1,"key"],val:[1,"val"],options:[1,"options"],suffix:[1,"suffix"]},outputs:{val:"valChange",valueChange:"valueChange"},decls:8,vars:5,consts:[[1,"key-val-container"],[3,"size"],[1,"value-content"]],template:function(a,u){1&a&&(A.j41(0,"dl",0)(1,"dt")(2,"cue-typography",1),A.EFF(3),A.k0s()(),A.j41(4,"dd")(5,"cue-typography",1)(6,"span",2),A.EFF(7),A.k0s()()()()),2&a&&(A.R7$(2),A.Y8G("size",u.labelSize()),A.R7$(),A.JRh(u.key()),A.R7$(2),A.Y8G("size",u.size()),A.R7$(2),A.Lme("",u.val()," ",u.suffix()))},dependencies:[s.Typography],styles:[".key-val-container[_ngcontent-%COMP%]{margin:0;display:flex;flex-direction:column;gap:var(--cue-grid-gap-s, 8px)}dt[_ngcontent-%COMP%], dd[_ngcontent-%COMP%]{margin:0}.read-mode-container[_ngcontent-%COMP%]{display:inline-flex;align-items:center;width:100%;position:relative}.read-mode-container.interactive[_ngcontent-%COMP%]:hover{cursor:pointer}.value-content[_ngcontent-%COMP%]{flex:1}[_nghost-%COMP%]{color:var(--cue-typography-text-color, inherit)}dt[_ngcontent-%COMP%] cue-typography[_ngcontent-%COMP%], dd[_ngcontent-%COMP%] cue-typography[_ngcontent-%COMP%], .value-content[_ngcontent-%COMP%]{color:var(--cue-typography-text-color, inherit)!important}dt[_ngcontent-%COMP%] cue-typography[_ngcontent-%COMP%] div[_ngcontent-%COMP%], dd[_ngcontent-%COMP%] cue-typography[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{color:var(--cue-typography-text-color, inherit)!important}[_ngcontent-%COMP%]:deep(cue-svg-icon), [_ngcontent-%COMP%]:deep(cue-entity-menu cue-svg-icon){color:var(--cue-icon-color, inherit)!important}.dirty-indicator[_ngcontent-%COMP%]{opacity:.8;margin-left:4px;color:var(--cue-typography-text-color, inherit)!important;font-weight:700;font-size:.4em;transform:translateY(-1em)}"]})}return C})()},7517(te,Y,l){"use strict";l.d(Y,{P:()=>y});var F=l(7705),f=l(2271),x=l(2245),D=l(1359),s=l(5381),A=l(5802),v=l(5547);const C=(M,w)=>w.category;function m(M,w){if(1&M){const c=v.RV6();v.j41(0,"cue-flexcontainer",1)(1,"cue-checkbox",2),v.bIt("checkedChange",function(){A.eBV(c);const N=v.XpG();return A.Njj(N.toggleAll())}),v.k0s()()}if(2&M){const c=v.XpG();v.R7$(),v.Y8G("checked",c.allVisible())}}function p(M,w){if(1&M&&(v.j41(0,"cue-typography",3),v.EFF(1),v.k0s()),2&M){const c=v.XpG().$implicit;v.R7$(),v.JRh(c.category)}}function a(M,w){if(1&M){const c=v.RV6();v.j41(0,"cue-flexcontainer",1)(1,"cue-checkbox",4),v.bIt("checkedChange",function(){const N=A.eBV(c).$implicit,k=v.XpG(2);return A.Njj(k.toggleSingle(N))}),v.k0s(),v.j41(2,"cue-typography",5),v.bIt("click",function(){const N=A.eBV(c).$implicit,k=v.XpG(2);return A.Njj(k.toggleSingle(N))}),v.EFF(3),v.k0s()()}if(2&M){const c=w.$implicit;v.R7$(),v.Y8G("checked",c.visible)("color",c.color),v.R7$(2),v.JRh(c.label)}}function u(M,w){if(1&M&&(v.nVh(0,p,2,1,"cue-typography",3),v.Z7z(1,a,4,3,"cue-flexcontainer",1,v.Vm6)),2&M){const c=w.$implicit;v.vxM(c.category?0:-1),v.R7$(),v.Dyx(c.items)}}let y=(()=>{class M{layers=(0,F.geq)([]);visibilityChange=(0,F.CGW)();layerChange=(0,F.CGW)();visibilityAll=(0,F.CGW)();showCheckAll=(0,f.EW)(()=>this.layers().length>1);allVisible=(0,f.EW)(()=>this.layers().every(c=>c.visible));groupedLayers=(0,f.EW)(()=>{const c=[];for(const S of this.layers()){const N=S.category,k=c.find(H=>H.category===N);k?k.items.push(S):c.push({category:N,items:[S]})}return c});toggleAll(){const c=this.allVisible(),S=this.layers().map(N=>(N.visible=!c,N));this.layers.update(()=>[...S]),this.visibilityAll.emit(c),this.emitChange()}toggleSingle(c){c.visible=!c.visible,this.layerChange.emit(c),this.layers.update(()=>[...this.layers()]),this.emitChange()}emitChange(){this.visibilityChange.emit(this.layers())}static \u0275fac=function(S){return new(S||M)};static \u0275cmp=v.VBU({type:M,selectors:[["cue-layer-legend"]],inputs:{layers:[1,"layers"]},outputs:{layers:"layersChange",visibilityChange:"visibilityChange",layerChange:"layerChange",visibilityAll:"visibilityAll"},decls:4,vars:1,consts:[["direction","column"],["align","center","justify","start",2,"width","100%"],["size","s",3,"checkedChange","checked"],["variant","label",2,"margin-top","4px","opacity","0.6"],["size","s",3,"checkedChange","checked","color"],[2,"cursor","pointer",3,"click"]],template:function(S,N){1&S&&(v.j41(0,"cue-flexcontainer",0),v.nVh(1,m,2,1,"cue-flexcontainer",1),v.Z7z(2,u,3,1,null,null,C),v.k0s()),2&S&&(v.R7$(),v.vxM(N.showCheckAll()?1:-1),v.R7$(),v.Dyx(N.groupedLayers()))},dependencies:[s.n,x.Typography,D.S],encapsulation:2,changeDetection:0})}return M})()},2843(te,Y,l){"use strict";l.d(Y,{M:()=>$n});var F={};l.r(F),l.d(F,{LAT_MAX:()=>N,LAT_MIN:()=>c,LAT_RENDERED_MAX:()=>k,LAT_RENDERED_MIN:()=>S,LNG_MAX:()=>h,LNG_MIN:()=>H,activeStates:()=>M,classes:()=>s,cursors:()=>v,events:()=>a,geojsonTypes:()=>m,interactions:()=>w,meta:()=>y,modes:()=>p,sources:()=>A,types:()=>C,updateActions:()=>u});var f={};l.r(f),l.d(f,{isActiveFeature:()=>O,isBackspaceKey:()=>he,isDeleteKey:()=>pe,isDigit1Key:()=>re,isDigit2Key:()=>We,isDigit3Key:()=>Fe,isDigitKey:()=>ve,isEnterKey:()=>de,isEscapeKey:()=>ge,isFeature:()=>j,isInactiveFeature:()=>V,isOfMetaType:()=>P,isShiftDown:()=>oe,isShiftMousedown:()=>R,isTrue:()=>at,isVertex:()=>J,noTarget:()=>K});var x={};l.r(x),l.d(x,{CommonSelectors:()=>f,ModeHandler:()=>rt,StringSet:()=>Ae,constrainFeatureMovement:()=>At,createMidPoint:()=>tn,createSupplementaryPoints:()=>Dt,createVertex:()=>je,doubleClickZoom:()=>Se,euclideanDistance:()=>et,featuresAt:()=>Re,getFeatureAtAndSetCursors:()=>Ze,isClick:()=>tt,isEventAtCoordinates:()=>mt,isTap:()=>nt,mapEventToBoundingBox:()=>He,moveFeatures:()=>wt,sortFeatures:()=>ct,stringSetsAreEqual:()=>fn,theme:()=>Bt,toDenseArray:()=>we});var D=l(5802);const s={CANVAS:"mapboxgl-canvas",CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMBINE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},A={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},v={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},C={POLYGON:"polygon",LINE:"line_string",POINT:"point"},m={FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},p={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select"},a={CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},u={MOVE:"move",CHANGE_PROPERTIES:"change_properties",CHANGE_COORDINATES:"change_coordinates"},y={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},M={ACTIVE:"true",INACTIVE:"false"},w=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],c=-90,S=-85,N=90,k=85,H=-270,h=270;function P(e){return function(t){const n=t.featureTarget;return!(!n||!n.properties)&&n.properties.meta===e}}function R(e){return!(!e.originalEvent||!e.originalEvent.shiftKey)&&0===e.originalEvent.button}function O(e){return!(!e.featureTarget||!e.featureTarget.properties)&&e.featureTarget.properties.active===M.ACTIVE&&e.featureTarget.properties.meta===y.FEATURE}function V(e){return!(!e.featureTarget||!e.featureTarget.properties)&&e.featureTarget.properties.active===M.INACTIVE&&e.featureTarget.properties.meta===y.FEATURE}function K(e){return void 0===e.featureTarget}function j(e){return!(!e.featureTarget||!e.featureTarget.properties)&&e.featureTarget.properties.meta===y.FEATURE}function J(e){const t=e.featureTarget;return!(!t||!t.properties)&&t.properties.meta===y.VERTEX}function oe(e){return!!e.originalEvent&&!0===e.originalEvent.shiftKey}function ge(e){return"Escape"===e.key||27===e.keyCode}function de(e){return"Enter"===e.key||13===e.keyCode}function he(e){return"Backspace"===e.key||8===e.keyCode}function pe(e){return"Delete"===e.key||46===e.keyCode}function re(e){return"1"===e.key||49===e.keyCode}function We(e){return"2"===e.key||50===e.keyCode}function Fe(e){return"3"===e.key||51===e.keyCode}function ve(e){const t=e.key||String.fromCharCode(e.keyCode);return t>="0"&&t<="9"}function at(){return!0}var Xe=l(503);const De={Point:0,LineString:1,MultiLineString:1,Polygon:2};function lt(e,t){const n=De[e.geometry.type]-De[t.geometry.type];return 0===n&&e.geometry.type===m.POLYGON?e.area-t.area:n}const ct=function _t(e){return e.map(t=>(t.geometry.type===m.POLYGON&&(t.area=Xe.geometry({type:m.FEATURE,property:{},geometry:t.geometry})),t)).sort(lt).map(t=>(delete t.area,t))},He=function Qe(e,t=0){return[[e.point.x-t,e.point.y-t],[e.point.x+t,e.point.y+t]]};function Ne(e){if(this._items={},this._nums={},this._length=e?e.length:0,e)for(let t=0,n=e.length;t<n;t++)this.add(e[t]),void 0!==e[t]&&("string"==typeof e[t]?this._items[e[t]]=t:this._nums[e[t]]=t)}Ne.prototype.add=function(e){return this.has(e)||(this._length++,"string"==typeof e?this._items[e]=this._length:this._nums[e]=this._length),this},Ne.prototype.delete=function(e){return!1===this.has(e)||(this._length--,delete this._items[e],delete this._nums[e]),this},Ne.prototype.has=function(e){return!("string"!=typeof e&&"number"!=typeof e||void 0===this._items[e]&&void 0===this._nums[e])},Ne.prototype.values=function(){const e=[];return Object.keys(this._items).forEach(t=>{e.push({k:t,v:this._items[t]})}),Object.keys(this._nums).forEach(t=>{e.push({k:JSON.parse(t),v:this._nums[t]})}),e.sort((t,n)=>t.v-n.v).map(t=>t.k)},Ne.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};const Ae=Ne,qe=[y.FEATURE,y.MIDPOINT,y.VERTEX],Re={click:function vt(e,t,n){return ut(e,t,n,n.options.clickBuffer)},touch:function Et(e,t,n){return ut(e,t,n,n.options.touchBuffer)}};function ut(e,t,n,r){if(null===n.map)return[];const o=e?He(e,r):t,i={};n.options.styles&&(i.layers=n.options.styles.map(G=>G.id).filter(G=>null!=n.map.getLayer(G)));const d=n.map.queryRenderedFeatures(o,i).filter(G=>-1!==qe.indexOf(G.properties.meta)),L=new Ae,E=[];return d.forEach(G=>{const X=G.properties.id;L.has(X)||(L.add(X),E.push(G))}),ct(E)}function Ze(e,t){const n=Re.click(e,null,t),r={mouse:v.NONE};return n[0]&&(r.mouse=n[0].properties.active===M.ACTIVE?v.MOVE:v.POINTER,r.feature=n[0].properties.meta),-1!==t.events.currentModeName().indexOf("draw")&&(r.mouse=v.ADD),t.ui.queueMapClasses(r),t.ui.updateMapClasses(),n[0]}function et(e,t){const n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function tt(e,t,n={}){const r=null!=n.fineTolerance?n.fineTolerance:4,o=null!=n.grossTolerance?n.grossTolerance:12,i=null!=n.interval?n.interval:500;e.point=e.point||t.point,e.time=e.time||t.time;const d=et(e.point,t.point);return d<r||d<o&&t.time-e.time<i}function nt(e,t,n={}){const r=null!=n.tolerance?n.tolerance:25,o=null!=n.interval?n.interval:250;return e.point=e.point||t.point,e.time=e.time||t.time,et(e.point,t.point)<r&&t.time-e.time<o}const rt=function(e,t){const n={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},r={on(i,d,L){if(void 0===n[i])throw new Error(`Invalid event type: ${i}`);n[i].push({selector:d,fn:L})},render(i){t.store.featureChanged(i)}},o=function(i,d){const L=n[i];let E=L.length;for(;E--;){const G=L[E];if(G.selector(d)){G.fn.call(r,d)||t.store.render(),t.ui.updateMapClasses();break}}};return e.start.call(r),{render:e.render,stop(){e.stop&&e.stop()},trash(){e.trash&&(e.trash(),t.store.render())},combineFeatures(){e.combineFeatures&&e.combineFeatures()},uncombineFeatures(){e.uncombineFeatures&&e.uncombineFeatures()},drag(i){o("drag",i)},click(i){o("click",i)},mousemove(i){o("mousemove",i)},mousedown(i){o("mousedown",i)},mouseup(i){o("mouseup",i)},mouseout(i){o("mouseout",i)},keydown(i){o("keydown",i)},keyup(i){o("keyup",i)},touchstart(i){o("touchstart",i)},touchmove(i){o("touchmove",i)},touchend(i){o("touchend",i)},tap(i){o("tap",i)}}},_=((e,t=21)=>(n=t)=>{let r="",o=0|n;for(;o--;)r+=e[Math.random()*e.length|0];return r})("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",32);function T(){return _()}const U=function(e,t){this.ctx=e,this.properties=t.properties||{},this.coordinates=t.geometry.coordinates,this.id=t.id||T(),this.type=t.geometry.type};U.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},U.prototype.incomingCoords=function(e){this.setCoordinates(e)},U.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},U.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},U.prototype.setProperty=function(e,t){this.properties[e]=t},U.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:m.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},U.prototype.internal=function(e){const t={id:this.id,meta:y.FEATURE,"meta:type":this.type,active:M.INACTIVE,mode:e};if(this.ctx.options.userProperties)for(const n in this.properties)t[`user_${n}`]=this.properties[n];return{type:m.FEATURE,properties:t,geometry:{coordinates:this.getCoordinates(),type:this.type}}};const Z=U,se=function(e,t){Z.call(this,e,t)};(se.prototype=Object.create(Z.prototype)).isValid=function(){return"number"==typeof this.coordinates[0]&&"number"==typeof this.coordinates[1]},se.prototype.updateCoordinate=function(e,t,n){this.coordinates=3===arguments.length?[t,n]:[e,t],this.changed()},se.prototype.getCoordinate=function(){return this.getCoordinates()};const ue=se,me=function(e,t){Z.call(this,e,t)};(me.prototype=Object.create(Z.prototype)).isValid=function(){return this.coordinates.length>1},me.prototype.addCoordinate=function(e,t,n){this.changed();const r=parseInt(e,10);this.coordinates.splice(r,0,[t,n])},me.prototype.getCoordinate=function(e){const t=parseInt(e,10);return JSON.parse(JSON.stringify(this.coordinates[t]))},me.prototype.removeCoordinate=function(e){this.changed(),this.coordinates.splice(parseInt(e,10),1)},me.prototype.updateCoordinate=function(e,t,n){const r=parseInt(e,10);this.coordinates[r]=[t,n],this.changed()};const ae=me,ee=function(e,t){Z.call(this,e,t),this.coordinates=this.coordinates.map(n=>n.slice(0,-1))};(ee.prototype=Object.create(Z.prototype)).isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every(e=>e.length>2)},ee.prototype.incomingCoords=function(e){this.coordinates=e.map(t=>t.slice(0,-1)),this.changed()},ee.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},ee.prototype.addCoordinate=function(e,t,n){this.changed();const r=e.split(".").map(i=>parseInt(i,10));this.coordinates[r[0]].splice(r[1],0,[t,n])},ee.prototype.removeCoordinate=function(e){this.changed();const t=e.split(".").map(r=>parseInt(r,10)),n=this.coordinates[t[0]];n&&(n.splice(t[1],1),n.length<3&&this.coordinates.splice(t[0],1))},ee.prototype.getCoordinate=function(e){const t=e.split(".").map(r=>parseInt(r,10));return JSON.parse(JSON.stringify(this.coordinates[t[0]][t[1]]))},ee.prototype.getCoordinates=function(){return this.coordinates.map(e=>e.concat([e[0]]))},ee.prototype.updateCoordinate=function(e,t,n){this.changed();const r=e.split("."),o=parseInt(r[0],10),i=parseInt(r[1],10);void 0===this.coordinates[o]&&(this.coordinates[o]=[]),this.coordinates[o][i]=[t,n]};const ye=ee,ze={MultiPoint:ue,MultiLineString:ae,MultiPolygon:ye},ke=(e,t,n,r,o)=>{const i=n.split("."),d=parseInt(i[0],10),L=i[1]?i.slice(1).join("."):null;return e[d][t](L,r,o)},fe=function(e,t){if(Z.call(this,e,t),delete this.coordinates,this.model=ze[t.geometry.type],void 0===this.model)throw new TypeError(`${t.geometry.type} is not a valid type`);this.features=this._coordinatesToFeatures(t.geometry.coordinates)};(fe.prototype=Object.create(Z.prototype))._coordinatesToFeatures=function(e){const t=this.model.bind(this);return e.map(n=>new t(this.ctx,{id:T(),type:m.FEATURE,properties:{},geometry:{coordinates:n,type:this.type.replace("Multi","")}}))},fe.prototype.isValid=function(){return this.features.every(e=>e.isValid())},fe.prototype.setCoordinates=function(e){this.features=this._coordinatesToFeatures(e),this.changed()},fe.prototype.getCoordinate=function(e){return ke(this.features,"getCoordinate",e)},fe.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map(e=>e.type===m.POLYGON?e.getCoordinates():e.coordinates)))},fe.prototype.updateCoordinate=function(e,t,n){ke(this.features,"updateCoordinate",e,t,n),this.changed()},fe.prototype.addCoordinate=function(e,t,n){ke(this.features,"addCoordinate",e,t,n),this.changed()},fe.prototype.removeCoordinate=function(e){ke(this.features,"removeCoordinate",e),this.changed()},fe.prototype.getFeatures=function(){return this.features};const q=fe;function z(e){this.map=e.map,this.drawConfig=JSON.parse(JSON.stringify(e.options||{})),this._ctx=e}z.prototype.setSelected=function(e){return this._ctx.store.setSelected(e)},z.prototype.setSelectedCoordinates=function(e){this._ctx.store.setSelectedCoordinates(e),e.reduce((t,n)=>(void 0===t[n.feature_id]&&(t[n.feature_id]=!0,this._ctx.store.get(n.feature_id).changed()),t),{})},z.prototype.getSelected=function(){return this._ctx.store.getSelected()},z.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},z.prototype.isSelected=function(e){return this._ctx.store.isSelected(e)},z.prototype.getFeature=function(e){return this._ctx.store.get(e)},z.prototype.select=function(e){return this._ctx.store.select(e)},z.prototype.deselect=function(e){return this._ctx.store.deselect(e)},z.prototype.deleteFeature=function(e,t={}){return this._ctx.store.delete(e,t)},z.prototype.addFeature=function(e,t={}){return this._ctx.store.add(e,t)},z.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},z.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},z.prototype.setActionableState=function(e={}){return this._ctx.events.actionable({trash:e.trash||!1,combineFeatures:e.combineFeatures||!1,uncombineFeatures:e.uncombineFeatures||!1})},z.prototype.changeMode=function(e,t={},n={}){return this._ctx.events.changeMode(e,t,n)},z.prototype.fire=function(e,t){return this._ctx.events.fire(e,t)},z.prototype.updateUIClasses=function(e){return this._ctx.ui.queueMapClasses(e)},z.prototype.activateUIButton=function(e){return this._ctx.ui.setActiveButton(e)},z.prototype.featuresAt=function(e,t,n="click"){if("click"!==n&&"touch"!==n)throw new Error("invalid buffer type");return Re[n](e,t,this._ctx)},z.prototype.newFeature=function(e){const t=e.geometry.type;return t===m.POINT?new ue(this._ctx,e):t===m.LINE_STRING?new ae(this._ctx,e):t===m.POLYGON?new ye(this._ctx,e):new q(this._ctx,e)},z.prototype.isInstanceOf=function(e,t){if(e===m.POINT)return t instanceof ue;if(e===m.LINE_STRING)return t instanceof ae;if(e===m.POLYGON)return t instanceof ye;if("MultiFeature"===e)return t instanceof q;throw new Error(`Unknown feature class: ${e}`)},z.prototype.doRender=function(e){return this._ctx.store.featureChanged(e)};const Ee=z;z.prototype.onSetup=function(){},z.prototype.onDrag=function(){},z.prototype.onClick=function(){},z.prototype.onMouseMove=function(){},z.prototype.onMouseDown=function(){},z.prototype.onMouseUp=function(){},z.prototype.onMouseOut=function(){},z.prototype.onKeyUp=function(){},z.prototype.onKeyDown=function(){},z.prototype.onTouchStart=function(){},z.prototype.onTouchMove=function(){},z.prototype.onTouchEnd=function(){},z.prototype.onTap=function(){},z.prototype.onStop=function(){},z.prototype.onTrash=function(){},z.prototype.onCombineFeature=function(){},z.prototype.onUncombineFeature=function(){},z.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};const Ce={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},Be=Object.keys(Ce);const we=function ot(e){return[].concat(e).filter(t=>void 0!==t)};function dt(){const e=this;if(!e.ctx.map||void 0===e.ctx.map.getSource(A.HOT))return E();const n=e.ctx.events.currentModeName();e.ctx.ui.queueMapClasses({mode:n});let r=[],o=[];e.isDirty?o=e.getAllIds():(r=e.getChangedIds().filter(G=>void 0!==e.get(G)),o=e.sources.hot.filter(G=>G.properties.id&&-1===r.indexOf(G.properties.id)&&void 0!==e.get(G.properties.id)).map(G=>G.properties.id)),e.sources.hot=[];const i=e.sources.cold.length;e.sources.cold=e.isDirty?[]:e.sources.cold.filter(G=>-1===r.indexOf(G.properties.id||G.properties.parent));const d=i!==e.sources.cold.length||o.length>0;function L(G,X){const I=e.get(G).internal(n);e.ctx.events.currentModeRender(I,W=>{W.properties.mode=n,e.sources[X].push(W)})}function E(){e.isDirty=!1,e.clearChangedIds()}r.forEach(G=>L(G,"hot")),o.forEach(G=>L(G,"cold")),d&&e.ctx.map.getSource(A.COLD).setData({type:m.FEATURE_COLLECTION,features:e.sources.cold}),e.ctx.map.getSource(A.HOT).setData({type:m.FEATURE_COLLECTION,features:e.sources.hot}),E()}function ie(e){let t;this._features={},this._featureIds=new Ae,this._selectedFeatureIds=new Ae,this._selectedCoordinates=[],this._changedFeatureIds=new Ae,this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=e,this.sources={hot:[],cold:[]},this.render=()=>{t||(t=requestAnimationFrame(()=>{t=null,dt.call(this),this._emitSelectionChange&&(this.ctx.events.fire(a.SELECTION_CHANGE,{features:this.getSelected().map(n=>n.toGeoJSON()),points:this.getSelectedCoordinates().map(n=>({type:m.FEATURE,properties:{},geometry:{type:m.POINT,coordinates:n.coordinates}}))}),this._emitSelectionChange=!1),this.ctx.events.fire(a.RENDER,{})}))},this.isDirty=!1}function ht(e,t={}){const n=e._selectedCoordinates.filter(r=>e._selectedFeatureIds.has(r.feature_id));e._selectedCoordinates.length!==n.length&&!t.silent&&(e._emitSelectionChange=!0),e._selectedCoordinates=n}ie.prototype.createRenderBatch=function(){const e=this.render;let t=0;return this.render=function(){t++},()=>{this.render=e,t>0&&this.render()}},ie.prototype.setDirty=function(){return this.isDirty=!0,this},ie.prototype.featureCreated=function(e,t={}){if(this._changedFeatureIds.add(e),!0!==(null!=t.silent?t.silent:this.ctx.options.suppressAPIEvents)){const r=this.get(e);this.ctx.events.fire(a.CREATE,{features:[r.toGeoJSON()]})}return this},ie.prototype.featureChanged=function(e,t={}){return this._changedFeatureIds.add(e),!0!==(null!=t.silent?t.silent:this.ctx.options.suppressAPIEvents)&&this.ctx.events.fire(a.UPDATE,{action:t.action?t.action:u.CHANGE_COORDINATES,features:[this.get(e).toGeoJSON()]}),this},ie.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},ie.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},ie.prototype.getAllIds=function(){return this._featureIds.values()},ie.prototype.add=function(e,t={}){return this._features[e.id]=e,this._featureIds.add(e.id),this.featureCreated(e.id,{silent:t.silent}),this},ie.prototype.delete=function(e,t={}){const n=[];return we(e).forEach(r=>{this._featureIds.has(r)&&(this._featureIds.delete(r),this._selectedFeatureIds.delete(r),t.silent||-1===n.indexOf(this._features[r])&&n.push(this._features[r].toGeoJSON()),delete this._features[r],this.isDirty=!0)}),n.length&&this.ctx.events.fire(a.DELETE,{features:n}),ht(this,t),this},ie.prototype.get=function(e){return this._features[e]},ie.prototype.getAll=function(){return Object.keys(this._features).map(e=>this._features[e])},ie.prototype.select=function(e,t={}){return we(e).forEach(n=>{this._selectedFeatureIds.has(n)||(this._selectedFeatureIds.add(n),this._changedFeatureIds.add(n),t.silent||(this._emitSelectionChange=!0))}),this},ie.prototype.deselect=function(e,t={}){return we(e).forEach(n=>{this._selectedFeatureIds.has(n)&&(this._selectedFeatureIds.delete(n),this._changedFeatureIds.add(n),t.silent||(this._emitSelectionChange=!0))}),ht(this,t),this},ie.prototype.clearSelected=function(e={}){return this.deselect(this._selectedFeatureIds.values(),{silent:e.silent}),this},ie.prototype.setSelected=function(e,t={}){return e=we(e),this.deselect(this._selectedFeatureIds.values().filter(n=>-1===e.indexOf(n)),{silent:t.silent}),this.select(e.filter(n=>!this._selectedFeatureIds.has(n)),{silent:t.silent}),this},ie.prototype.setSelectedCoordinates=function(e){return this._selectedCoordinates=e,this._emitSelectionChange=!0,this},ie.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},ie.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},ie.prototype.getSelected=function(){return this.getSelectedIds().map(e=>this.get(e))},ie.prototype.getSelectedCoordinates=function(){return this._selectedCoordinates.map(t=>({coordinates:this.get(t.feature_id).getCoordinate(t.coord_path)}))},ie.prototype.isSelected=function(e){return this._selectedFeatureIds.has(e)},ie.prototype.setFeatureProperty=function(e,t,n,r={}){this.get(e).setProperty(t,n),this.featureChanged(e,{silent:r.silent,action:u.CHANGE_PROPERTIES})},ie.prototype.storeMapConfig=function(){w.forEach(e=>{this.ctx.map[e]&&(this._mapInitialConfig[e]=this.ctx.map[e].isEnabled())})},ie.prototype.restoreMapConfig=function(){Object.keys(this._mapInitialConfig).forEach(e=>{this._mapInitialConfig[e]?this.ctx.map[e].enable():this.ctx.map[e].disable()})},ie.prototype.getInitialConfigValue=function(e){return void 0===this._mapInitialConfig[e]||this._mapInitialConfig[e]};const Rt=["mode","feature","mouse"];function gn(e){let t=null,n=null;const r={onRemove(){return e.map.off("load",r.connect),clearInterval(n),r.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.boxZoomInitial&&e.map.boxZoom.enable(),e.map=null,e.container=null,e.store=null,t&&t.parentNode&&t.parentNode.removeChild(t),t=null,this},connect(){e.map.off("load",r.connect),clearInterval(n),r.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd(o){if(e.map=o,e.events=function _e(e){const t=Object.keys(e.options.modes).reduce((I,W)=>(I[W]=function Me(e){const t=Object.keys(e);return function(n,r={}){let o={};const i=t.reduce((L,E)=>(L[E]=e[E],L),new Ee(n));return{start(){o=i.onSetup(r),Be.forEach(L=>{const E=Ce[L];let G=()=>!1;e[E]&&(G=()=>!0),this.on(L,G,function d(L){return E=>i[L](o,E)}(E))})},stop(){i.onStop(o)},trash(){i.onTrash(o)},combineFeatures(){i.onCombineFeatures(o)},uncombineFeatures(){i.onUncombineFeatures(o)},render(L,E){i.toDisplayFeatures(o,L,E)}}}}(e.options.modes[W]),I),{});let n={},r={};const o={};let i=null,d=null;o.drag=function(I,W){W({point:I.point,time:(new Date).getTime()})?(e.ui.queueMapClasses({mouse:v.DRAG}),d.drag(I)):I.originalEvent.stopPropagation()},o.mousedrag=function(I){o.drag(I,W=>!tt(n,W))},o.touchdrag=function(I){o.drag(I,W=>!nt(r,W))},o.mousemove=function(I){if(1===(void 0!==I.originalEvent.buttons?I.originalEvent.buttons:I.originalEvent.which))return o.mousedrag(I);const $=Ze(I,e);I.featureTarget=$,d.mousemove(I)},o.mousedown=function(I){n={time:(new Date).getTime(),point:I.point};const W=Ze(I,e);I.featureTarget=W,d.mousedown(I)},o.mouseup=function(I){const W=Ze(I,e);I.featureTarget=W,tt(n,{point:I.point,time:(new Date).getTime()})?d.click(I):d.mouseup(I)},o.mouseout=function(I){d.mouseout(I)},o.touchstart=function(I){if(!e.options.touchEnabled)return;r={time:(new Date).getTime(),point:I.point};const W=Re.touch(I,null,e)[0];I.featureTarget=W,d.touchstart(I)},o.touchmove=function(I){if(e.options.touchEnabled)return d.touchmove(I),o.touchdrag(I)},o.touchend=function(I){if(I.originalEvent.preventDefault(),!e.options.touchEnabled)return;const W=Re.touch(I,null,e)[0];I.featureTarget=W,nt(r,{time:(new Date).getTime(),point:I.point})?d.tap(I):d.touchend(I)};const L=I=>{const W=he(I),$=pe(I),ne=ve(I);return!(W||$||ne)};function E(I,W,$={}){d.stop();const ne=t[I];if(void 0===ne)throw new Error(`${I} is not valid`);i=I;const be=ne(e,W);d=rt(be,e),$.silent||e.map.fire(a.MODE_CHANGE,{mode:I}),e.store.setDirty(),e.store.render()}o.keydown=function(I){(I.srcElement||I.target).classList.contains(s.CANVAS)&&((he(I)||pe(I))&&e.options.controls.trash?(I.preventDefault(),d.trash()):L(I)?d.keydown(I):re(I)&&e.options.controls.point?E(p.DRAW_POINT):We(I)&&e.options.controls.line_string?E(p.DRAW_LINE_STRING):Fe(I)&&e.options.controls.polygon&&E(p.DRAW_POLYGON))},o.keyup=function(I){L(I)&&d.keyup(I)},o.zoomend=function(){e.store.changeZoom()},o.data=function(I){if("style"===I.dataType){const{setup:W,map:$,options:ne,store:be}=e;ne.styles.some(Ge=>$.getLayer(Ge.id))||(W.addLayers(),be.setDirty(),be.render())}};const G={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start(){i=e.options.defaultMode,d=rt(t[i](e),e)},changeMode:E,actionable:function X(I){let W=!1;Object.keys(I).forEach($=>{if(void 0===G[$])throw new Error("Invalid action type");G[$]!==I[$]&&(W=!0),G[$]=I[$]}),W&&e.map.fire(a.ACTIONABLE,{actions:G})},currentModeName:()=>i,currentModeRender:(I,W)=>d.render(I,W),fire(I,W){e.map&&e.map.fire(I,W)},addEventListeners(){e.map.on("mousemove",o.mousemove),e.map.on("mousedown",o.mousedown),e.map.on("mouseup",o.mouseup),e.map.on("data",o.data),e.map.on("touchmove",o.touchmove),e.map.on("touchstart",o.touchstart),e.map.on("touchend",o.touchend),e.container.addEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",o.keydown),e.container.addEventListener("keyup",o.keyup))},removeEventListeners(){e.map.off("mousemove",o.mousemove),e.map.off("mousedown",o.mousedown),e.map.off("mouseup",o.mouseup),e.map.off("data",o.data),e.map.off("touchmove",o.touchmove),e.map.off("touchstart",o.touchstart),e.map.off("touchend",o.touchend),e.container.removeEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",o.keydown),e.container.removeEventListener("keyup",o.keyup))},trash(I){d.trash(I)},combineFeatures(){d.combineFeatures()},uncombineFeatures(){d.uncombineFeatures()},getMode:()=>i}}(e),e.ui=function Pt(e){const t={};let n=null,r={mode:null,feature:null,mouse:null},o={mode:null,feature:null,mouse:null};function d(W){o=Object.assign(o,W)}function L(){if(!e.container)return;const W=[],$=[];Rt.forEach(ne=>{o[ne]!==r[ne]&&(W.push(`${ne}-${r[ne]}`),null!==o[ne]&&$.push(`${ne}-${o[ne]}`))}),W.length>0&&e.container.classList.remove(...W),$.length>0&&e.container.classList.add(...$),r=Object.assign(r,o)}function E(W,$={}){const ne=document.createElement("button");return ne.className=`${s.CONTROL_BUTTON} ${$.className}`,ne.setAttribute("title",$.title),$.container.appendChild(ne),ne.addEventListener("click",be=>{if(be.preventDefault(),be.stopPropagation(),be.target===n)return G(),void $.onDeactivate();X(W),$.onActivate()},!0),ne}function G(){n&&(n.classList.remove(s.ACTIVE_BUTTON),n=null)}function X(W){G();const $=t[W];$&&$&&"trash"!==W&&($.classList.add(s.ACTIVE_BUTTON),n=$)}return{setActiveButton:X,queueMapClasses:d,updateMapClasses:L,clearMapClasses:function i(){d({mode:null,feature:null,mouse:null}),L()},addButtons:function Q(){const W=e.options.controls,$=document.createElement("div");return $.className=`${s.CONTROL_GROUP} ${s.CONTROL_BASE}`,W&&(W[C.POINT]&&(t[C.POINT]=E(C.POINT,{container:$,className:s.CONTROL_BUTTON_POINT,title:"Marker tool "+(e.options.keybindings?"(1)":""),onActivate:()=>e.events.changeMode(p.DRAW_POINT),onDeactivate:()=>e.events.trash()})),W[C.LINE]&&(t[C.LINE]=E(C.LINE,{container:$,className:s.CONTROL_BUTTON_LINE,title:"LineString tool "+(e.options.keybindings?"(2)":""),onActivate:()=>e.events.changeMode(p.DRAW_LINE_STRING),onDeactivate:()=>e.events.trash()})),W[C.POLYGON]&&(t[C.POLYGON]=E(C.POLYGON,{container:$,className:s.CONTROL_BUTTON_POLYGON,title:"Polygon tool "+(e.options.keybindings?"(3)":""),onActivate:()=>e.events.changeMode(p.DRAW_POLYGON),onDeactivate:()=>e.events.trash()})),W.trash&&(t.trash=E("trash",{container:$,className:s.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:()=>{e.events.trash()}})),W.combine_features&&(t.combine_features=E("combineFeatures",{container:$,className:s.CONTROL_BUTTON_COMBINE_FEATURES,title:"Combine",onActivate:()=>{e.events.combineFeatures()}})),W.uncombine_features&&(t.uncombine_features=E("uncombineFeatures",{container:$,className:s.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:()=>{e.events.uncombineFeatures()}}))),$},removeButtons:function I(){Object.keys(t).forEach(W=>{const $=t[W];$.parentNode&&$.parentNode.removeChild($),delete t[W]})}}}(e),e.container=o.getContainer(),e.store=new ie(e),t=e.ui.addButtons(),e.options.boxSelect){e.boxZoomInitial=o.boxZoom.isEnabled(),o.boxZoom.disable();const i=o.dragPan.isEnabled();o.dragPan.disable(),o.dragPan.enable(),i||o.dragPan.disable()}return o.loaded()?r.connect():(o.on("load",r.connect),n=setInterval(()=>{o.loaded()&&r.connect()},16)),e.events.start(),t},addLayers(){e.map.addSource(A.COLD,{data:{type:m.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.map.addSource(A.HOT,{data:{type:m.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.options.styles.forEach(o=>{e.map.addLayer(o)}),e.store.setDirty(!0),e.store.render()},removeLayers(){e.options.styles.forEach(o=>{e.map.getLayer(o.id)&&e.map.removeLayer(o.id)}),e.map.getSource(A.COLD)&&e.map.removeSource(A.COLD),e.map.getSource(A.HOT)&&e.map.removeSource(A.HOT)}};return e.setup=r,r}const St="#3bb2d0",it="#fbb03b",Bt=[{id:"gl-draw-polygon-fill",type:"fill",filter:["all",["==","$type","Polygon"]],paint:{"fill-color":["case",["==",["get","active"],"true"],it,St],"fill-opacity":.1}},{id:"gl-draw-lines",type:"line",filter:["any",["==","$type","LineString"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["==",["get","active"],"true"],it,St],"line-dasharray":["case",["==",["get","active"],"true"],[.2,2],[2,0]],"line-width":2}},{id:"gl-draw-point-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":"#fff"}},{id:"gl-draw-point-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":["case",["==",["get","active"],"true"],it,St]}},{id:"gl-draw-vertex-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":"#fff"}},{id:"gl-draw-vertex-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":it}},{id:"gl-draw-midpoint",type:"circle",filter:["all",["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":it}}];function Ve(e,t){this.x=e,this.y=t}Ve.prototype={clone(){return new Ve(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const n=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=n,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),n=Math.sin(e),o=n*this.x+t*this.y;return this.x=t*this.x-n*this.y,this.y=o,this},_rotateAround(e,t){const n=Math.cos(e),r=Math.sin(e),i=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=t.x+n*(this.x-t.x)-r*(this.y-t.y),this.y=i,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Ve},Ve.convert=function(e){if(e instanceof Ve)return e;if(Array.isArray(e))return new Ve(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new Ve(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};const Ot=function mn(e,t){const n=t.getBoundingClientRect();return new Ve(e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0))};function je(e,t,n,r){return{type:m.FEATURE,properties:{meta:y.VERTEX,parent:e,coord_path:n,active:r?M.ACTIVE:M.INACTIVE},geometry:{type:m.POINT,coordinates:t}}}function st(e,t,n){if(null!==e)for(var r,o,i,d,L,E,G,I,X=0,Q=0,W=e.type,$="FeatureCollection"===W,ne="Feature"===W,be=$?e.features.length:1,Le=0;Le<be;Le++){L=(I=!!(G=$?e.features[Le].geometry:ne?e.geometry:e)&&"GeometryCollection"===G.type)?G.geometries.length:1;for(var Ge=0;Ge<L;Ge++){var Pe=0,Ke=0;if(null!==(d=I?G.geometries[Ge]:G)){E=d.coordinates;var Ue=d.type;switch(X=!n||"Polygon"!==Ue&&"MultiPolygon"!==Ue?0:1,Ue){case null:break;case"Point":if(!1===t(E,Q,Le,Pe,Ke))return!1;Q++,Pe++;break;case"LineString":case"MultiPoint":for(r=0;r<E.length;r++){if(!1===t(E[r],Q,Le,Pe,Ke))return!1;Q++,"MultiPoint"===Ue&&Pe++}"LineString"===Ue&&Pe++;break;case"Polygon":case"MultiLineString":for(r=0;r<E.length;r++){for(o=0;o<E[r].length-X;o++){if(!1===t(E[r][o],Q,Le,Pe,Ke))return!1;Q++}"MultiLineString"===Ue&&Pe++,"Polygon"===Ue&&Ke++}"Polygon"===Ue&&Pe++;break;case"MultiPolygon":for(r=0;r<E.length;r++){for(Ke=0,o=0;o<E[r].length;o++){for(i=0;i<E[r][o].length-X;i++){if(!1===t(E[r][o][i],Q,Le,Pe,Ke))return!1;Q++}Ke++}Pe++}break;case"GeometryCollection":for(r=0;r<d.geometries.length;r++)if(!1===st(d.geometries[r],t,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Zt(e){const t={type:"Feature"};return Object.keys(e).forEach(n=>{switch(n){case"type":case"properties":case"geometry":return;default:t[n]=e[n]}}),t.properties=jt(e.properties),t.geometry=null==e.geometry?null:Ft(e.geometry),t}function jt(e){const t={};return e&&Object.keys(e).forEach(n=>{const r=e[n];t[n]="object"==typeof r?null===r?null:Array.isArray(r)?r.map(o=>o):jt(r):r}),t}function Ft(e){const t={type:e.type};return e.bbox&&(t.bbox=e.bbox),"GeometryCollection"===e.type?(t.geometries=e.geometries.map(n=>Ft(n)),t):(t.coordinates=Jt(e.coordinates),t)}function Jt(e){const t=e;return"object"!=typeof t[0]?t.slice():t.map(n=>Jt(n))}function Yt(e,t={}){return Qt(e,"mercator",t)}function Qt(e,t,n={}){var r=(n=n||{}).mutate;if(!e)throw new Error("geojson is required");return Array.isArray(e)&&function ft(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}(e[0])?e="mercator"===t?qt(e):en(e):(!0!==r&&(e=function Pn(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return Zt(e);case"FeatureCollection":return function Sn(e){const t={type:"FeatureCollection"};return Object.keys(e).forEach(n=>{switch(n){case"type":case"features":return;default:t[n]=e[n]}}),t.features=e.features.map(n=>Zt(n)),t}(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Ft(e);default:throw new Error("unknown GeoJSON type")}}(e)),st(e,function(o){var i="mercator"===t?qt(o):en(o);o[0]=i[0],o[1]=i[1]})),e}function qt(e){var t=Math.PI/180,n=6378137,r=20037508.342789244,o=Math.abs(e[0])<=180?e[0]:e[0]-360*function In(e){return e<0?-1:e>0?1:0}(e[0]),i=[n*o*t,n*Math.log(Math.tan(.25*Math.PI+.5*e[1]*t))];return i[0]>r&&(i[0]=r),i[0]<-r&&(i[0]=-r),i[1]>r&&(i[1]=r),i[1]<-r&&(i[1]=-r),i}function en(e){var t=180/Math.PI,n=6378137;return[e[0]*t/n,(.5*Math.PI-2*Math.atan(Math.exp(-e[1]/n)))*t]}function tn(e,t,n){const r=t.geometry.coordinates,o=n.geometry.coordinates;if(r[1]>k||r[1]<S||o[1]>k||o[1]<S)return null;const i=Yt(r),d=Yt(o),L=Q=>Number(Q.toFixed(8)),E=(Q,I)=>(Q+I)/2,G=function On(e,t={}){return Qt(e,"wgs84",t)}([E(i[0],d[0]),E(i[1],d[1])]),X=[L(G[0]),L(G[1])];return{type:m.FEATURE,properties:{meta:y.MIDPOINT,parent:e,lng:X[0],lat:X[1],coord_path:n.properties.coord_path},geometry:{type:m.POINT,coordinates:X}}}Math;const Dt=function nn(e,t={},n=null){const{type:r,coordinates:o}=e.geometry,i=e.properties&&e.properties.id;let d=[];function L(X,Q){let I="",W=null;X.forEach(($,ne)=>{const be=null!=Q?`${Q}.${ne}`:String(ne),Le=je(i,$,be,E(be));if(t.midpoints&&W){const Pe=tn(i,W,Le);Pe&&d.push(Pe)}W=Le;const Ge=JSON.stringify($);I!==Ge&&d.push(Le),0===ne&&(I=Ge)})}function E(X){return!!t.selectedPaths&&-1!==t.selectedPaths.indexOf(X)}return r===m.POINT?d.push(je(i,o,n,E(n))):r===m.POLYGON?o.forEach((X,Q)=>{L(X,null!==n?`${n}.${Q}`:String(Q))}):r===m.LINE_STRING?L(o,n):0===r.indexOf(m.MULTI_PREFIX)&&function G(){const X=r.replace(m.MULTI_PREFIX,"");o.forEach((Q,I)=>{d=d.concat(nn({type:m.FEATURE,properties:e.properties,geometry:{type:X,coordinates:Q}},t,I))})}(),d},Se={enable(e){setTimeout(()=>{!e.map||!e.map.doubleClickZoom||!e._ctx||!e._ctx.store||!e._ctx.store.getInitialConfigValue||e._ctx.store.getInitialConfigValue("doubleClickZoom")&&e.map.doubleClickZoom.enable()},0)},disable(e){setTimeout(()=>{!e.map||!e.map.doubleClickZoom||e.map.doubleClickZoom.disable()},0)}},{LAT_MIN:pt,LAT_MAX:gt,LAT_RENDERED_MIN:rn,LAT_RENDERED_MAX:on,LNG_MIN:sn,LNG_MAX:an}=F;function At(e,t){let n=pt,r=gt,o=pt,i=gt,d=an,L=sn;e.forEach(G=>{const X=function xn(e){const n=[e.geometry.coordinates].flat({Point:0,LineString:1,Polygon:2,MultiPoint:1,MultiLineString:2,MultiPolygon:3}[e.geometry.type]),r=n.map(L=>L[0]),o=n.map(L=>L[1]),i=L=>Math.min.apply(null,L),d=L=>Math.max.apply(null,L);return[i(r),i(o),d(r),d(o)]}(G),Q=X[1],I=X[3],W=X[0],$=X[2];Q>n&&(n=Q),I<r&&(r=I),I>o&&(o=I),Q<i&&(i=Q),W<d&&(d=W),$>L&&(L=$)});const E=t;return n+E.lat>on&&(E.lat=on-n),o+E.lat>gt&&(E.lat=gt-o),r+E.lat<rn&&(E.lat=rn-r),i+E.lat<pt&&(E.lat=pt-i),d+E.lng<=sn&&(E.lng+=360*Math.ceil(Math.abs(E.lng)/360)),L+E.lng>=an&&(E.lng-=360*Math.ceil(Math.abs(E.lng)/360)),E}function wt(e,t){const n=At(e.map(r=>r.toGeoJSON()),t);e.forEach(r=>{const o=r.getCoordinates(),i=G=>{const X={lng:G[0]+n.lng,lat:G[1]+n.lat};return[X.lng,X.lat]},d=G=>G.map(X=>i(X));let E;r.type===m.POINT?E=i(o):r.type===m.LINE_STRING||r.type===m.MULTI_POINT?E=o.map(i):r.type===m.POLYGON||r.type===m.MULTI_LINE_STRING?E=o.map(d):r.type===m.MULTI_POLYGON&&(E=o.map(G=>G.map(X=>d(X)))),r.incomingCoords(E)})}const le={onSetup:function(e){const t={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initialDragPanState:this.map.dragPan.isEnabled(),initiallySelectedFeatureIds:e.featureIds||[]};return this.setSelected(t.initiallySelectedFeatureIds.filter(n=>void 0!==this.getFeature(n))),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),t},fireUpdate:function(){this.fire(a.UPDATE,{action:u.MOVE,features:this.getSelected().map(e=>e.toGeoJSON())})},fireActionable:function(){const e=this.getSelected(),t=e.filter(i=>this.isInstanceOf("MultiFeature",i));let n=!1;if(e.length>1){n=!0;const i=e[0].type.replace("Multi","");e.forEach(d=>{d.type.replace("Multi","")!==i&&(n=!1)})}this.setActionableState({combineFeatures:n,uncombineFeatures:t.length>0,trash:e.length>0})},getUniqueIds:function(e){return e.length?e.map(n=>n.properties.id).filter(n=>void 0!==n).reduce((n,r)=>(n.add(r),n),new Ae).values():[]},stopExtendedInteractions:function(e){e.boxSelectElement&&(e.boxSelectElement.parentNode&&e.boxSelectElement.parentNode.removeChild(e.boxSelectElement),e.boxSelectElement=null),(e.canDragMove||e.canBoxSelect)&&!0===e.initialDragPanState&&this.map.dragPan.enable(),e.boxSelecting=!1,e.canBoxSelect=!1,e.dragMoving=!1,e.canDragMove=!1},onStop:function(){Se.enable(this)},onMouseMove:function(e,t){return j(t)&&e.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(e),!0},onMouseOut:function(e){return!e.dragMoving||this.fireUpdate()}};le.onTap=le.onClick=function(e,t){return K(t)?this.clickAnywhere(e,t):P(y.VERTEX)(t)?this.clickOnVertex(e,t):j(t)?this.clickOnFeature(e,t):void 0},le.clickAnywhere=function(e){const t=this.getSelectedIds();t.length&&(this.clearSelectedFeatures(),t.forEach(n=>this.doRender(n))),Se.enable(this),this.stopExtendedInteractions(e)},le.clickOnVertex=function(e,t){this.changeMode(p.DIRECT_SELECT,{featureId:t.featureTarget.properties.parent,coordPath:t.featureTarget.properties.coord_path,startPos:t.lngLat}),this.updateUIClasses({mouse:v.MOVE})},le.startOnActiveFeature=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),this.doRender(t.featureTarget.properties.id),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},le.clickOnFeature=function(e,t){Se.disable(this),this.stopExtendedInteractions(e);const n=oe(t),r=this.getSelectedIds(),o=t.featureTarget.properties.id,i=this.isSelected(o);if(!n&&i&&this.getFeature(o).type!==m.POINT)return this.changeMode(p.DIRECT_SELECT,{featureId:o});i&&n?(this.deselect(o),this.updateUIClasses({mouse:v.POINTER}),1===r.length&&Se.enable(this)):!i&&n?(this.select(o),this.updateUIClasses({mouse:v.MOVE})):!i&&!n&&(r.forEach(d=>this.doRender(d)),this.setSelected(o),this.updateUIClasses({mouse:v.MOVE})),this.doRender(o)},le.onMouseDown=function(e,t){return e.initialDragPanState=this.map.dragPan.isEnabled(),O(t)?this.startOnActiveFeature(e,t):this.drawConfig.boxSelect&&R(t)?this.startBoxSelect(e,t):void 0},le.startBoxSelect=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),e.boxSelectStartLocation=Ot(t.originalEvent,this.map.getContainer()),e.canBoxSelect=!0},le.onTouchStart=function(e,t){if(O(t))return this.startOnActiveFeature(e,t)},le.onDrag=function(e,t){return e.canDragMove?this.dragMove(e,t):this.drawConfig.boxSelect&&e.canBoxSelect?this.whileBoxSelect(e,t):void 0},le.whileBoxSelect=function(e,t){e.boxSelecting=!0,this.updateUIClasses({mouse:v.ADD}),e.boxSelectElement||(e.boxSelectElement=document.createElement("div"),e.boxSelectElement.classList.add(s.BOX_SELECT),this.map.getContainer().appendChild(e.boxSelectElement));const n=Ot(t.originalEvent,this.map.getContainer()),r=Math.min(e.boxSelectStartLocation.x,n.x),o=Math.max(e.boxSelectStartLocation.x,n.x),i=Math.min(e.boxSelectStartLocation.y,n.y),d=Math.max(e.boxSelectStartLocation.y,n.y),L=`translate(${r}px, ${i}px)`;e.boxSelectElement.style.transform=L,e.boxSelectElement.style.WebkitTransform=L,e.boxSelectElement.style.width=o-r+"px",e.boxSelectElement.style.height=d-i+"px"},le.dragMove=function(e,t){e.dragMoving=!0,t.originalEvent.stopPropagation();const n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};wt(this.getSelected(),n),e.dragMoveLocation=t.lngLat},le.onTouchEnd=le.onMouseUp=function(e,t){if(e.dragMoving)this.fireUpdate();else if(e.boxSelecting){const n=[e.boxSelectStartLocation,Ot(t.originalEvent,this.map.getContainer())],r=this.featuresAt(null,n,"click"),o=this.getUniqueIds(r).filter(i=>!this.isSelected(i));o.length&&(this.select(o),o.forEach(i=>this.doRender(i)),this.updateUIClasses({mouse:v.MOVE}))}this.stopExtendedInteractions(e)},le.toDisplayFeatures=function(e,t,n){t.properties.active=this.isSelected(t.properties.id)?M.ACTIVE:M.INACTIVE,n(t),this.fireActionable(),t.properties.active===M.ACTIVE&&t.geometry.type!==m.POINT&&Dt(t).forEach(n)},le.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},le.onCombineFeatures=function(){const e=this.getSelected();if(0===e.length||e.length<2)return;const t=[],n=[],r=e[0].type.replace("Multi","");for(let o=0;o<e.length;o++){const i=e[o];if(i.type.replace("Multi","")!==r)return;i.type.includes("Multi")?i.getCoordinates().forEach(d=>{t.push(d)}):t.push(i.getCoordinates()),n.push(i.toGeoJSON())}if(n.length>1){const o=this.newFeature({type:m.FEATURE,properties:n[0].properties,geometry:{type:`Multi${r}`,coordinates:t}});this.addFeature(o),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([o.id]),this.fire(a.COMBINE_FEATURES,{createdFeatures:[o.toGeoJSON()],deletedFeatures:n})}this.fireActionable()},le.onUncombineFeatures=function(){const e=this.getSelected();if(0===e.length)return;const t=[],n=[];for(let r=0;r<e.length;r++){const o=e[r];this.isInstanceOf("MultiFeature",o)&&(o.getFeatures().forEach(i=>{this.addFeature(i),i.properties=o.properties,t.push(i.toGeoJSON()),this.select([i.id])}),this.deleteFeature(o.id,{silent:!0}),n.push(o.toGeoJSON()))}t.length>1&&this.fire(a.UNCOMBINE_FEATURES,{createdFeatures:t,deletedFeatures:n}),this.fireActionable()};const Fn=le,ln=P(y.VERTEX),cn=P(y.MIDPOINT),ce={fireUpdate:function(){this.fire(a.UPDATE,{action:u.CHANGE_COORDINATES,features:this.getSelected().map(e=>e.toGeoJSON())})},fireActionable:function(e){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:e.selectedCoordPaths.length>0})},startDragging:function(e,t){null==e.initialDragPanState&&(e.initialDragPanState=this.map.dragPan.isEnabled()),this.map.dragPan.disable(),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},stopDragging:function(e){e.canDragMove&&!0===e.initialDragPanState&&this.map.dragPan.enable(),e.initialDragPanState=null,e.dragMoving=!1,e.canDragMove=!1,e.dragMoveLocation=null},onVertex:function(e,t){this.startDragging(e,t);const n=t.featureTarget.properties,r=e.selectedCoordPaths.indexOf(n.coord_path);oe(t)||-1!==r?oe(t)&&-1===r&&e.selectedCoordPaths.push(n.coord_path):e.selectedCoordPaths=[n.coord_path];const o=this.pathsToCoordinates(e.featureId,e.selectedCoordPaths);this.setSelectedCoordinates(o)},onMidpoint:function(e,t){this.startDragging(e,t);const n=t.featureTarget.properties;e.feature.addCoordinate(n.coord_path,n.lng,n.lat),this.fireUpdate(),e.selectedCoordPaths=[n.coord_path]},pathsToCoordinates:function(e,t){return t.map(n=>({feature_id:e,coord_path:n}))},onFeature:function(e,t){0===e.selectedCoordPaths.length?this.startDragging(e,t):this.stopDragging(e)},dragFeature:function(e,t,n){wt(this.getSelected(),n),e.dragMoveLocation=t.lngLat},dragVertex:function(e,t,n){const r=e.selectedCoordPaths.map(d=>e.feature.getCoordinate(d)),i=At(r.map(d=>({type:m.FEATURE,properties:{},geometry:{type:m.POINT,coordinates:d}})),n);for(let d=0;d<r.length;d++){const L=r[d];e.feature.updateCoordinate(e.selectedCoordPaths[d],L[0]+i.lng,L[1]+i.lat)}},clickNoTarget:function(){this.changeMode(p.SIMPLE_SELECT)},clickInactive:function(){this.changeMode(p.SIMPLE_SELECT)},clickActiveFeature:function(e){e.selectedCoordPaths=[],this.clearSelectedCoordinates(),e.feature.changed()},onSetup:function(e){const t=e.featureId,n=this.getFeature(t);if(!n)throw new Error("You must provide a featureId to enter direct_select mode");if(n.type===m.POINT)throw new TypeError("direct_select mode doesn't handle point features");const r={featureId:t,feature:n,dragMoveLocation:e.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:e.coordPath?[e.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(t,r.selectedCoordPaths)),this.setSelected(t),Se.disable(this),this.setActionableState({trash:!0}),r},onStop:function(){Se.enable(this),this.clearSelectedCoordinates()},toDisplayFeatures:function(e,t,n){e.featureId===t.properties.id?(t.properties.active=M.ACTIVE,n(t),Dt(t,{map:this.map,midpoints:!0,selectedPaths:e.selectedCoordPaths}).forEach(n)):(t.properties.active=M.INACTIVE,n(t)),this.fireActionable(e)},onTrash:function(e){e.selectedCoordPaths.sort((t,n)=>n.localeCompare(t,"en",{numeric:!0})).forEach(t=>e.feature.removeCoordinate(t)),this.fireUpdate(),e.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(e),!1===e.feature.isValid()&&(this.deleteFeature([e.featureId]),this.changeMode(p.SIMPLE_SELECT,{}))},onMouseMove:function(e,t){const n=O(t),r=ln(t),o=cn(t),i=0===e.selectedCoordPaths.length;return this.updateUIClasses(n&&i||r&&!i?{mouse:v.MOVE}:{mouse:v.NONE}),(r||n||o)&&e.dragMoving&&this.fireUpdate(),this.stopDragging(e),!0},onMouseOut:function(e){return e.dragMoving&&this.fireUpdate(),!0}};ce.onTouchStart=ce.onMouseDown=function(e,t){return ln(t)?this.onVertex(e,t):O(t)?this.onFeature(e,t):cn(t)?this.onMidpoint(e,t):void 0},ce.onDrag=function(e,t){if(!0!==e.canDragMove)return;e.dragMoving=!0,t.originalEvent.stopPropagation();const n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};e.selectedCoordPaths.length>0?this.dragVertex(e,t,n):this.dragFeature(e,t,n),e.dragMoveLocation=t.lngLat},ce.onClick=function(e,t){return K(t)?this.clickNoTarget(e,t):O(t)?this.clickActiveFeature(e,t):V(t)?this.clickInactive(e,t):void this.stopDragging(e)},ce.onTap=function(e,t){return K(t)?this.clickNoTarget(e,t):O(t)?this.clickActiveFeature(e,t):V(t)?this.clickInactive(e,t):void 0},ce.onTouchEnd=ce.onMouseUp=function(e){e.dragMoving&&this.fireUpdate(),this.stopDragging(e)};const Dn=ce,xe={onSetup:function(){const e=this.newFeature({type:m.FEATURE,properties:{},geometry:{type:m.POINT,coordinates:[]}});return this.addFeature(e),this.clearSelectedFeatures(),this.updateUIClasses({mouse:v.ADD}),this.activateUIButton(C.POINT),this.setActionableState({trash:!0}),{point:e}},stopDrawingAndRemove:function(e){this.deleteFeature([e.point.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT)}};xe.onTap=xe.onClick=function(e,t){this.updateUIClasses({mouse:v.MOVE}),e.point.updateCoordinate("",t.lngLat.lng,t.lngLat.lat),this.fire(a.CREATE,{features:[e.point.toGeoJSON()]}),this.changeMode(p.SIMPLE_SELECT,{featureIds:[e.point.id]})},xe.onStop=function(e){this.activateUIButton(),e.point.getCoordinate().length||this.deleteFeature([e.point.id],{silent:!0})},xe.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.point.id;if(t.properties.active=r?M.ACTIVE:M.INACTIVE,!r)return n(t)},xe.onTrash=xe.stopDrawingAndRemove,xe.onKeyUp=function(e,t){if(ge(t)||de(t))return this.stopDrawingAndRemove(e,t)};const An=xe,mt=function wn(e,t){return!!e.lngLat&&e.lngLat.lng===t[0]&&e.lngLat.lat===t[1]},Oe={onSetup:function(){const e=this.newFeature({type:m.FEATURE,properties:{},geometry:{type:m.POLYGON,coordinates:[[]]}});return this.addFeature(e),this.clearSelectedFeatures(),Se.disable(this),this.updateUIClasses({mouse:v.ADD}),this.activateUIButton(C.POLYGON),this.setActionableState({trash:!0}),{polygon:e,currentVertexPosition:0}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&mt(t,e.polygon.coordinates[0][e.currentVertexPosition-1]))return this.changeMode(p.SIMPLE_SELECT,{featureIds:[e.polygon.id]});this.updateUIClasses({mouse:v.ADD}),e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),e.currentVertexPosition++,e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(p.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},onMouseMove:function(e,t){e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),J(t)&&this.updateUIClasses({mouse:v.POINTER})}};Oe.onTap=Oe.onClick=function(e,t){return J(t)?this.clickOnVertex(e,t):this.clickAnywhere(e,t)},Oe.onKeyUp=function(e,t){ge(t)?(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT)):de(t)&&this.changeMode(p.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},Oe.onStop=function(e){this.updateUIClasses({mouse:v.NONE}),Se.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.polygon.id)&&(e.polygon.removeCoordinate(`0.${e.currentVertexPosition}`),e.polygon.isValid()?this.fire(a.CREATE,{features:[e.polygon.toGeoJSON()]}):(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT,{},{silent:!0})))},Oe.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.polygon.id;if(t.properties.active=r?M.ACTIVE:M.INACTIVE,!r)return n(t);if(0===t.geometry.coordinates.length)return;const o=t.geometry.coordinates[0].length;if(!(o<3)){if(t.properties.meta=y.FEATURE,n(je(e.polygon.id,t.geometry.coordinates[0][0],"0.0",!1)),o>3){const i=t.geometry.coordinates[0].length-3;n(je(e.polygon.id,t.geometry.coordinates[0][i],`0.${i}`,!1))}if(o<=4&&(n({type:m.FEATURE,properties:t.properties,geometry:{coordinates:[[t.geometry.coordinates[0][0][0],t.geometry.coordinates[0][0][1]],[t.geometry.coordinates[0][1][0],t.geometry.coordinates[0][1][1]]],type:m.LINE_STRING}}),3===o))return;return n(t)}},Oe.onTrash=function(e){this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT)};const Nn=Oe,Ie={onSetup:function(e){const t=(e=e||{}).featureId;let n,r,o="forward";if(t){if(n=this.getFeature(t),!n)throw new Error("Could not find a feature with the provided featureId");let i=e.from;if(i&&"Feature"===i.type&&i.geometry&&"Point"===i.geometry.type&&(i=i.geometry),i&&"Point"===i.type&&i.coordinates&&2===i.coordinates.length&&(i=i.coordinates),!i||!Array.isArray(i))throw new Error("Please use the `from` property to indicate which point to continue the line from");const d=n.coordinates.length-1;if(n.coordinates[d][0]===i[0]&&n.coordinates[d][1]===i[1])r=d+1,n.addCoordinate(r,...n.coordinates[d]);else{if(n.coordinates[0][0]!==i[0]||n.coordinates[0][1]!==i[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");o="backwards",r=0,n.addCoordinate(r,...n.coordinates[0])}}else n=this.newFeature({type:m.FEATURE,properties:{},geometry:{type:m.LINE_STRING,coordinates:[]}}),r=0,this.addFeature(n);return this.clearSelectedFeatures(),Se.disable(this),this.updateUIClasses({mouse:v.ADD}),this.activateUIButton(C.LINE),this.setActionableState({trash:!0}),{line:n,currentVertexPosition:r,direction:o}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&mt(t,e.line.coordinates[e.currentVertexPosition-1])||"backwards"===e.direction&&mt(t,e.line.coordinates[e.currentVertexPosition+1]))return this.changeMode(p.SIMPLE_SELECT,{featureIds:[e.line.id]});this.updateUIClasses({mouse:v.ADD}),e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),"forward"===e.direction?(e.currentVertexPosition++,e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat)):e.line.addCoordinate(0,t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(p.SIMPLE_SELECT,{featureIds:[e.line.id]})},onMouseMove:function(e,t){e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),J(t)&&this.updateUIClasses({mouse:v.POINTER})}};Ie.onTap=Ie.onClick=function(e,t){if(J(t))return this.clickOnVertex(e,t);this.clickAnywhere(e,t)},Ie.onKeyUp=function(e,t){de(t)?this.changeMode(p.SIMPLE_SELECT,{featureIds:[e.line.id]}):ge(t)&&(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT))},Ie.onStop=function(e){Se.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.line.id)&&(e.line.removeCoordinate(`${e.currentVertexPosition}`),e.line.isValid()?this.fire(a.CREATE,{features:[e.line.toGeoJSON()]}):(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT,{},{silent:!0})))},Ie.onTrash=function(e){this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT)},Ie.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.line.id;if(t.properties.active=r?M.ACTIVE:M.INACTIVE,!r)return n(t);t.geometry.coordinates.length<2||(t.properties.meta=y.FEATURE,n(je(e.line.id,t.geometry.coordinates["forward"===e.direction?t.geometry.coordinates.length-2:1],""+("forward"===e.direction?t.geometry.coordinates.length-2:1),!1)),n(t))};const un={simple_select:Fn,direct_select:Dn,draw_point:An,draw_polygon:Nn,draw_line_string:Ie},Rn={defaultMode:p.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:Bt,modes:un,controls:{},userProperties:!1,suppressAPIEvents:!0},kn={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},Bn={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function dn(e,t){return e.map(n=>n.source?n:Object.assign({},n,{id:`${n.id}.${t}`,source:"hot"===t?A.HOT:A.COLD}))}var hn=l(362),Gn=l(5341);function fn(e,t){return e.length===t.length&&JSON.stringify(e.map(n=>n).sort())===JSON.stringify(t.map(n=>n).sort())}const Un={Polygon:ye,LineString:ae,Point:ue,MultiPolygon:q,MultiLineString:q,MultiPoint:q};function yt(e){!function(e,t){e=function Vn(e={}){let t=Object.assign({},e);return e.controls||(t.controls={}),t.controls=Object.assign({},!1===e.displayControlsDefault?Bn:kn,e.controls),t=Object.assign({},Rn,t),t.styles=dn(t.styles,"cold").concat(dn(t.styles,"hot")),t}(e);const n={options:e};t=function Wn(e,t){t.modes=p;const n=void 0===e.options.suppressAPIEvents||!!e.options.suppressAPIEvents;return t.getFeatureIdsAt=function(r){return Re.click({point:r},null,e).map(i=>i.properties.id)},t.getSelectedIds=function(){return e.store.getSelectedIds()},t.getSelected=function(){return{type:m.FEATURE_COLLECTION,features:e.store.getSelectedIds().map(r=>e.store.get(r)).map(r=>r.toGeoJSON())}},t.getSelectedPoints=function(){return{type:m.FEATURE_COLLECTION,features:e.store.getSelectedCoordinates().map(r=>({type:m.FEATURE,properties:{},geometry:{type:m.POINT,coordinates:r.coordinates}}))}},t.set=function(r){if(void 0===r.type||r.type!==m.FEATURE_COLLECTION||!Array.isArray(r.features))throw new Error("Invalid FeatureCollection");const o=e.store.createRenderBatch();let i=e.store.getAllIds().slice();const d=t.add(r),L=new Ae(d);return i=i.filter(E=>!L.has(E)),i.length&&t.delete(i),o(),d},t.add=function(r){const i=JSON.parse(JSON.stringify(Gn(r))).features.map(d=>{if(d.id=d.id||T(),null===d.geometry)throw new Error("Invalid geometry: null");if(void 0===e.store.get(d.id)||e.store.get(d.id).type!==d.geometry.type){const L=Un[d.geometry.type];if(void 0===L)throw new Error(`Invalid geometry type: ${d.geometry.type}.`);const E=new L(e,d);e.store.add(E,{silent:n})}else{const L=e.store.get(d.id),E=L.properties;L.properties=d.properties,hn(E,d.properties)||e.store.featureChanged(L.id,{silent:n}),hn(L.getCoordinates(),d.geometry.coordinates)||L.incomingCoords(d.geometry.coordinates)}return d.id});return e.store.render(),i},t.get=function(r){const o=e.store.get(r);if(o)return o.toGeoJSON()},t.getAll=function(){return{type:m.FEATURE_COLLECTION,features:e.store.getAll().map(r=>r.toGeoJSON())}},t.delete=function(r){return e.store.delete(r,{silent:n}),t.getMode()!==p.DIRECT_SELECT||e.store.getSelectedIds().length?e.store.render():e.events.changeMode(p.SIMPLE_SELECT,void 0,{silent:n}),t},t.deleteAll=function(){return e.store.delete(e.store.getAllIds(),{silent:n}),t.getMode()===p.DIRECT_SELECT?e.events.changeMode(p.SIMPLE_SELECT,void 0,{silent:n}):e.store.render(),t},t.changeMode=function(r,o={}){return r===p.SIMPLE_SELECT&&t.getMode()===p.SIMPLE_SELECT?(fn(o.featureIds||[],e.store.getSelectedIds())||(e.store.setSelected(o.featureIds,{silent:n}),e.store.render()),t):(r===p.DIRECT_SELECT&&t.getMode()===p.DIRECT_SELECT&&o.featureId===e.store.getSelectedIds()[0]||e.events.changeMode(r,o,{silent:n}),t)},t.getMode=function(){return e.events.getMode()},t.trash=function(){return e.events.trash({silent:n}),t},t.combineFeatures=function(){return e.events.combineFeatures({silent:n}),t},t.uncombineFeatures=function(){return e.events.uncombineFeatures({silent:n}),t},t.setFeatureProperty=function(r,o,i){return e.store.setFeatureProperty(r,o,i,{silent:n}),t},t}(n,t),n.api=t;const r=gn(n);t.onAdd=r.onAdd,t.onRemove=r.onRemove,t.types=C,t.options=e}(e,this)}yt.modes=un,yt.constants=F,yt.lib=x;const pn=yt;let $n=(()=>{class e{_draw;_map;_drawMode=(0,D.vPA)(!1);_settingDrawMode=!1;_eventListeners=[];_clearAfterFinish=!0;drawEvent=(0,D.vPA)(void 0);destroy(){this._cleanup()}initializeWithMap(n){this._map=n,this._initDrawControl(n)}setDrawMode(n,r){if(this._draw&&this._map&&!this._settingDrawMode){if(this._clearAfterFinish=r,this._settingDrawMode=!0,this._drawMode.set(n),n){this._draw.deleteAll(),this._draw.changeMode("draw_polygon");const o={type:"polygon",status:"started",coordinates:[],bbox:{minLng:0,minLat:0,maxLng:0,maxLat:0}};this.drawEvent.update(()=>o)}else this._draw.changeMode("simple_select"),this._draw.deleteAll();this._settingDrawMode=!1}}setClearAfterFinish(n){this._clearAfterFinish=n}getClearAfterFinish(){return this._clearAfterFinish}getDrawMode(){return this._drawMode()}clearDrawings(){this._draw&&this._draw.deleteAll()}getDrawInstance(){return this._draw}_initDrawControl(n){this._draw=new pn({displayControlsDefault:!1,modes:{...pn.modes}}),n.addControl(this._draw,"top-left");const r=document.querySelector(".mapbox-gl-draw_ctrl-draw-btn")?.parentElement;r&&(r.style.display="none");const o=L=>{const E=L.features[0];if("Polygon"===E.geometry.type){const G=E.geometry.coordinates[0],Q={type:"polygon",status:"ended",coordinates:G,bbox:this._calculateBBox(G)};this.drawEvent.update(()=>Q),this._drawMode.set(!1),this._clearAfterFinish&&this._draw?.deleteAll()}},i=L=>{const E=L.features[0];if("Polygon"===E.geometry.type){const G=E.geometry.coordinates[0],Q={type:"polygon",status:"in-progress",coordinates:G,bbox:this._calculateBBox(G)};this.drawEvent.update(()=>Q)}},d=()=>{if(this._drawMode()){const L=this._draw?.getAll();if(L?.features?.length){const E=L.features[0];if("Polygon"===E.geometry.type){const G=E.geometry.coordinates[0];if(G.length>2){const Q={type:"polygon",status:"in-progress",coordinates:G,bbox:this._calculateBBox(G)};this.drawEvent.update(()=>Q)}}}}};n.on("draw.create",o),n.on("draw.update",i),n.on("mousemove",d),this._eventListeners.push({event:"draw.create",handler:o}),this._eventListeners.push({event:"draw.update",handler:i}),this._eventListeners.push({event:"mousemove",handler:d})}_cleanup(){this._map&&(this._eventListeners.forEach(({event:n,handler:r})=>{this._map?.off(n,r)}),this._eventListeners=[],this._draw&&this._map._controls?.includes(this._draw)&&this._map.removeControl(this._draw)),this._draw=void 0,this._map=void 0,this.drawEvent.set(void 0)}_calculateBBox(n){return n.reduce((r,o)=>({minLng:Math.min(r.minLng,o[0]),minLat:Math.min(r.minLat,o[1]),maxLng:Math.max(r.maxLng,o[0]),maxLat:Math.max(r.maxLat,o[1])}),{minLng:1/0,minLat:1/0,maxLng:-1/0,maxLat:-1/0})}static \u0275fac=function(r){return new(r||e)};static \u0275prov=D.jDH({token:e,factory:e.\u0275fac})}return e})()},6103(te,Y,l){"use strict";l.d(Y,{N:()=>D});var F=l(2306),f=l(140),x=l(58);function D({entityData:s,availableEntityRelationships:A}){const v=y=>A.find(M=>M.iri===y)?.label??y.split("#").pop()??y,C=[],m={};for(const[y,M]of Object.entries(s)){for(const w of M.directMapGeometries??[])C.push({iri:y,wkt:w.wkt});for(const w of M.indirectMapGeometries??[]){m[w.rel]||(m[w.rel]=[]);for(const c of w.geometries)m[w.rel].push({iri:w.entityUUID,wkt:c.wkt})}}const p=(y,M,w)=>{if(!M.length)return null;const c=new F.ux(y,y);return c.category=w,c.collection=new f.o(M.flatMap(({iri:S,wkt:N})=>{const k=(0,x.S)(N);return k?[{type:"Feature",geometry:(0,x.n)(k),properties:{iri:S}}]:[]})),c},a=[],u=p("direct",C,"Direct");u&&a.push(u);for(const[y,M]of Object.entries(m)){const w=v(y),c=p(w,M,w);c&&a.push(c)}return a}},6986(te,Y,l){"use strict";l.d(Y,{A4:()=>F,Jc:()=>v,Ln:()=>x,dx:()=>s,g8:()=>f,j5:()=>D,n7:()=>A});const F=12;function f(p,a,u){return{id:p,source:a,type:"circle",maxzoom:F,filter:["==",["get","_isCentroid"],!0],paint:{"circle-radius":6,"circle-color":["coalesce",["get","_color"],u],"circle-stroke-width":2,"circle-stroke-color":"white","circle-opacity":.8}}}function x(p,a,u,y){return function m(p,a,u,y,M){const w={id:p,source:y},c=M||u;switch(a){case"Point":case"MultiPoint":return[{...w,id:`${p}-clusters`,type:"circle",filter:["has","point_count"],paint:{"circle-color":c,"circle-radius":["step",["get","point_count"],15,100,20,750,25],"circle-stroke-width":2,"circle-stroke-color":"white","circle-opacity":.8}},{...w,id:`${p}-cluster-count`,type:"symbol",filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-font":["Poppins Medium","Arial Unicode MS Bold"],"text-size":12,"text-allow-overlap":!0,"text-ignore-placement":!0},paint:{"text-color":"#ffffff","text-halo-color":"rgba(0, 0, 0, 0.3)","text-halo-width":1}},{...w,id:`${p}-unclustered`,type:"circle",filter:["!",["has","point_count"]],paint:{"circle-radius":6,"circle-color":["coalesce",["get","_color"],u],"circle-stroke-width":2,"circle-stroke-color":"white","circle-opacity":.8}}];case"LineString":case"MultiLineString":return{...w,type:"line",paint:{"line-color":["coalesce",["get","_color"],u],"line-width":3,"line-opacity":.8},layout:{"line-join":"round","line-cap":"round"}};case"Polygon":case"MultiPolygon":return[{id:`${p}-fill`,source:y,type:"fill",paint:{"fill-color":["coalesce",["get","_color"],u],"fill-opacity":.3}},{id:`${p}-stroke`,source:y,type:"line",paint:{"line-color":["coalesce",["get","_color"],u],"line-width":2,"line-opacity":.8},layout:{"line-join":"round","line-cap":"round"}},{id:`${p}-labels`,source:y,type:"symbol",layout:{"text-field":["coalesce",["get","label"],""],"text-font":["Poppins Medium","Arial Unicode MS Bold"],"text-size":13,"text-anchor":"center","text-allow-overlap":!1},paint:{"text-color":"#333333","text-halo-color":"rgba(255, 255, 255, 0.9)","text-halo-width":2}}];default:return console.warn(`Unsupported geometry type: ${a}`),null}}(p,a,u,y,u)}function D(p){return"Polygon"===p||"MultiPolygon"===p}function s(p){return"LineString"===p||"MultiLineString"===p}function A(p,a){return a&&("Point"===p||"MultiPoint"===p)}function v(p,a){return A(p,a)?{cluster:!0,clusterMaxZoom:14,clusterRadius:50,clusterMinPoints:2}:{cluster:!1}}},3646(te,Y,l){"use strict";l.d(Y,{B:()=>N});var F=l(467),f=l(5802),x=l(2271),D=l(4412),s=l(1413),A=l(2306),v=l(140);function c(k){let H=1/0,h=1/0,P=-1/0,R=-1/0;const O=k.features,V=j=>{j.length>=2&&(H=Math.min(H,j[0]),h=Math.min(h,j[1]),P=Math.max(P,j[0]),R=Math.max(R,j[1]))},K=(j,J)=>{if(0===J)V(j);else if(Array.isArray(j))for(const oe of j)K(oe,J-1)};for(const j of O){const J=j.geometry;switch(J.type){case"Point":K(J.coordinates,0);break;case"LineString":case"MultiPoint":K(J.coordinates,1);break;case"Polygon":case"MultiLineString":K(J.coordinates,2);break;case"MultiPolygon":K(J.coordinates,3);break;case"GeometryCollection":for(const oe of J.geometries){const he=c(new v.o([{type:"Feature",geometry:oe,properties:null}]));he&&(V([he[0],he[1]]),V([he[2],he[3]]))}}}return H===1/0?null:[H,h,P,R]}var S=l(6986);let N=(()=>{class k{_layers$=new D.t([]);_map;_sources={};_sourceLayers={};_sourceIds=[];_attachedListeners=[];_hoveredFeature=(0,f.vPA)(void 0);_layerGroups={};_layerClickable={};_pointLayerIds=new Set;_lineLayerIds=new Set;_processedClickEvents=new WeakSet;_clearHoverTimeout;_hoverSequence=0;layers=this._layers$.asObservable();layersSignal=(0,x.EW)(()=>this._layers$.getValue());clickedFeature=new s.B;hoveredFeature=new s.B;initializeWithMap(h){this._map=h,h.on("mousemove",P=>{const R=h.getCanvas();if(!R)return;const O=Object.keys(this._layerClickable).filter(K=>this._layerClickable[K]&&h.getLayer(K)),V=h.queryRenderedFeatures(P.point,{layers:O});R.style.cursor=V.length>0?"pointer":""})}getLayers(){return this._layers$.getValue()}setLayers(h){this._layers$.next([...h])}addLayer(h){const P=this._layers$.getValue(),R=P.findIndex(O=>O.id===h.id);R>=0?P[R]={...h}:P.push({...h}),this._layers$.next([...P])}removeLayer(h){const R=this._layers$.getValue().filter(O=>O.id!==h);this._layers$.next(R),this._deleteSourceIfExists(h.toString()),delete this._sources[h.toString()],delete this._sourceLayers[h.toString()],delete this._layerClickable[h.toString()],this._pointLayerIds.delete(h.toString()),this._lineLayerIds.delete(h.toString()),this._sourceIds=this._sourceIds.filter(O=>O!==h.toString())}toggleVisibility(h){const P=h.toString();if(this._layerGroups[P])return void this.toggleLayerGroupVisibility(P);const O=this._layers$.getValue().map(V=>{if(V.id===h){const K={...V,visible:!V.visible};return this._updateLayerVisibility(h.toString(),K.visible),K}return V});this._layers$.next(O)}setLayerVisibility(h,P){const R=h.toString();if(this._layerGroups[R]){if(this._map){const j=P?"visible":"none";this._layerGroups[R].forEach(J=>{this._map.setLayoutProperty(J,"visibility",j)})}}else this._updateLayerVisibility(R,P);const V=this._layers$.getValue().map(K=>K.id===h?{...K,visible:P}:K);this._layers$.next(V)}loadGeoJSONLayerGroup(h,P,R){var O=this;return(0,F.A)(function*(V,K,j,J={}){const{cluster:oe=!1,zoomToFit:ge=!0,visible:de=!0,label:he=V,color:pe=O._extractColorFromLayer(j[0])}=J;if(!O._map)return void console.warn("Map not initialized in LayerService");const re=V;yield O._addSource(V,{type:"geojson",data:K,...(0,S.Jc)("Point",oe)});const We=[];for(const ve of j){We.push(ve.id),O._layerClickable[ve.id]=!0,O._sourceLayers[re]||(O._sourceLayers[re]={layer:ve,clickable:!0});const Xe=ve.type;if("circle"===Xe||"symbol"===Xe)O._pointLayerIds.add(ve.id),O._map.addLayer(ve);else if("line"===Xe){O._lineLayerIds.add(ve.id);const De=O._getBeforePointLayerId();O._map.addLayer(ve,De)}else{const De=O._getBeforeLineLayerId()??O._getBeforePointLayerId();O._map.addLayer(ve,De)}O._map&&O._map.setLayoutProperty(ve.id,"visibility",de?"visible":"none")}for(const ve of j)O._setLayerEvents(re,ve);O._layerGroups[V]=We;const Fe=new A.ux(he,V);Fe.collection=K,Fe.color=pe,Fe.visible=de,O.addLayer(Fe),ge&&O.fitLayerBounds(V)}).apply(this,arguments)}toggleLayerGroupVisibility(h){const P=this._layerGroups[h];if(!P)return;const R=this.getLayer(h);if(!R)return;const O=!R.visible;if(this._map){const V=O?"visible":"none";P.forEach(K=>{this._map.setLayoutProperty(K,"visibility",V)})}this.updateLayer(h,{visible:O})}removeLayerGroup(h){const P=this._layerGroups[h];P&&(this._map&&(P.forEach(R=>{this._map.removeLayer(R),this._attachedListeners=this._attachedListeners.filter(O=>O!==h),delete this._layerClickable[R],this._pointLayerIds.delete(R),this._lineLayerIds.delete(R)}),this._deleteSourceIfExists(h)),delete this._sources[h],delete this._sourceLayers[h],this._sourceIds=this._sourceIds.filter(R=>R!==h),delete this._layerGroups[h],this.removeLayer(h))}loadGeoJSONLayer(h,P,R){var O=this;return(0,F.A)(function*(V,K,j,J={}){const{cluster:oe=!0,zoomToFit:ge=!0,visible:de=!0,label:he=V,color:pe=O._extractColorFromLayer(j)}=J;if(!O._map)return void console.warn("Map not initialized in LayerService");yield O._addSource(V,{type:"geojson",data:K,...(0,S.Jc)("Point",oe)},j);const re=new A.ux(he,V);re.collection=K,re.color=pe,re.visible=de,O.addLayer(re),O._updateLayerVisibility(V,de),ge&&O.fitLayerBounds(V)}).apply(this,arguments)}_addSource(h,P,R){var O=this;return(0,F.A)(function*(V,K,j,J=!0){O._map&&(O._sources[V]=K,O._deleteSourceIfExists(V),O._sourceIds.push(V),O._map.getSource(V)&&O._map.removeSource(V),O._map.addSource(V,K),j&&O._addSourceLayer(V,j,J))}).apply(this,arguments)}_getBeforePointLayerId(){if(!this._map||0===this._pointLayerIds.size)return;const h=this._map.getStyle()?.layers??[];for(const P of h)if(this._pointLayerIds.has(P.id))return P.id}_getBeforeLineLayerId(){if(!this._map||0===this._lineLayerIds.size)return;const h=this._map.getStyle()?.layers??[];for(const P of h)if(this._lineLayerIds.has(P.id))return P.id}_addSourceLayer(h,P,R=!0){if(!this._map)return;this._layerClickable[P.id]=R,this._sourceLayers[h]||(this._sourceLayers[h]={layer:P,clickable:R});const O=P.type;if("circle"===O||"symbol"===O)this._pointLayerIds.add(P.id),this._map.addLayer(P);else if("line"===O){this._lineLayerIds.add(P.id);const V=this._getBeforePointLayerId();this._map.addLayer(P,V)}else{const V=this._getBeforeLineLayerId()??this._getBeforePointLayerId();this._map.addLayer(P,V)}R&&this._setLayerEvents(h,P)}_updateLayerVisibility(h,P){if(!this._map)return;const R=this._sourceLayers[h];R&&this._map.setLayoutProperty(R.layer.id,"visibility",P?"visible":"none")}getLayer(h){return this._layers$.getValue().find(P=>P.id===h)}updateLayer(h,P){const O=this._layers$.getValue().map(V=>{if(V.id===h){const K={...V,...P};return void 0!==P.visible&&this._updateLayerVisibility(h.toString(),P.visible),K}return V});this._layers$.next(O)}toggleAllLayers(){const h=this._layers$.getValue(),R=!h.some(V=>V.visible),O=h.map(V=>(this._updateLayerVisibility(V.id.toString(),R),{...V,visible:R}));this._layers$.next(O)}getVisibleLayersCount(){return this._layers$.getValue().filter(h=>h.visible).length}getTotalLayersCount(){return this._layers$.getValue().length}hasLayer(h){return this._layers$.getValue().some(P=>P.id===h)}fitGeoJSONBounds(h,P=50,R=!0,O=19){this._fitGeoJSONBounds(h,P,R,O)}fitLayerBounds(h,P=50){const R=this._layers$.getValue().find(O=>O.id===h);!R||!R.collection||!this._map||("features"in R.collection?this._fitGeoJSONBounds(R.collection,P):console.warn("Layer collection is not a FeatureCollection, cannot fit bounds."))}fitAllVisibleLayers(h=50){const P=this._layers$.getValue().filter(K=>K.visible&&K.collection);if(0===P.length||!this._map)return;const R=P.flatMap(K=>{const j=K.collection;return j&&"features"in j&&Array.isArray(j.features)?j.features:[]}),O=new v.o(R),V=c(O);V&&(O.bbox=V),this._fitGeoJSONBounds(O,h)}clearAllLayers(){if(this._map){for(const[h,P]of Object.entries(this._layerGroups))P.forEach(R=>{this._map.getLayer(R)&&this._map.removeLayer(R)}),this._map.getSource(h)&&this._map.removeSource(h);for(const h of this._sourceIds)this._layerGroups[h]||this._deleteSourceIfExists(h)}this._sourceIds=[],this._sourceLayers={},this._sources={},this._attachedListeners=[],this._layerGroups={},this._layerClickable={},this._layers$.next([])}reapplyLayers(){this._map&&(Object.keys(this._sources).forEach(h=>{this._deleteSourceIfExists(h),this._map.addSource(h,this._sources[h]);const P=this._sourceLayers[h];if(P){this._map.addLayer(P.layer);const R=this._layers$.getValue().find(O=>O.id===h);R&&this._updateLayerVisibility(h,R.visible)}}),this._reattachAllLayerEvents())}_extractColorFromLayer(h){if("paint"in h&&"object"==typeof h.paint){const P=h.paint;return P["circle-color"]||P["fill-color"]||P["line-color"]||""}return""}_fitGeoJSONBounds(h,P=50,R=!0,O=19){if(!this._map)return void console.warn("Map not initialized when trying to fit bounds");if(!h.features||0===h.features.length)return void console.warn("No features to fit bounds to");let V=h.bbox;if(!V){const K=c(h);if(!K)return void console.warn("Failed to calculate bbox for GeoJSON");h.bbox=K,V=K}if(V&&4===V.length)try{this._map.fitBounds([[V[0],V[1]],[V[2],V[3]]],{padding:P,maxZoom:O,animate:R})}catch(K){console.error("Error fitting bounds:",K)}}_deleteSourceIfExists(h){if(!this._map||!this._map.getSource(h))return;const R=this._layerGroups[h];if(R)R.forEach(O=>{this._map.getLayer(O)&&this._map.removeLayer(O)});else{const O=Object.values(this._sourceLayers).find(V=>"source"in V.layer&&V.layer.source===h);O&&this._map.getLayer(O.layer.id)&&(this._map.removeLayer(O.layer.id),this._attachedListeners=this._attachedListeners.filter(V=>V!==O.layer.id))}this._map.removeSource(h)}_setLayerEvents(h,P){if(!this._map)return;const R=P.id.endsWith("-fill"),O=P.id.endsWith("-stroke"),V=R?P.id.replace("-fill",""):O?P.id.replace("-stroke",""):P.id;if(R||O){const J=`${V}-stroke`;this._layerClickable[`${V}-fill`]=!0,this._layerClickable[J]=!0}if(!this._layerClickable[P.id])return;const K=[];if(R||O){const j=`${V}-fill`,J=`${V}-stroke`;this._map.getLayer(j)&&K.push(j),this._map.getLayer(J)&&K.push(J)}else K.push(P.id);K.forEach(j=>{this._attachedListeners.includes(j)||(this._map.on("click",j,J=>{if(!J.features||this._processedClickEvents.has(J.originalEvent))return;const oe=J.features[0],ge=oe.properties;if(ge&&!ge.cluster){const de=this.getLayer(h)||this.getLayer(V)||this.getLayer(j);if(de){const he={...oe,geometry:oe.geometry};if(de.collection&&"features"in de.collection){const pe=de.collection.features.find(re=>re.geometry.type===oe.geometry?.type&&JSON.stringify(re.properties)===JSON.stringify(oe.properties));pe&&pe.id&&(he.id=pe.id)}this._processedClickEvents.add(J.originalEvent),this.clickedFeature.next({feature:he,event:J.originalEvent,layer:de,lngLat:J.lngLat})}}}),this._map.on("mouseenter",j,J=>{if(this._hoverSequence++,this._clearHoverTimeout&&(clearTimeout(this._clearHoverTimeout),this._clearHoverTimeout=void 0),!J.features)return;const oe=J.features[0],ge=oe.properties,de={...oe,geometry:oe.geometry};if(ge&&!ge.cluster){const he=this.getLayer(h)||this.getLayer(V)||this.getLayer(j);if(he){if(he.collection&&"features"in he.collection){const pe=he.collection.features.find(re=>re.geometry.type===oe.geometry?.type&&JSON.stringify(re.properties)===JSON.stringify(oe.properties));pe&&pe.id&&(de.id=pe.id)}this.hoveredFeature.next({feature:de,event:J.originalEvent,layer:he,lngLat:J.lngLat})}this._hoveredFeature.set(de)}}),this._map.on("mouseleave",j,()=>{const J=this._hoverSequence;this._clearHoverTimeout=window.setTimeout(()=>{this._hoverSequence===J&&(this._hoveredFeature.set(void 0),this.hoveredFeature.next(void 0)),this._clearHoverTimeout=void 0},50)}),this._map.on("click",j,J=>{if(!J.features)return;const oe=J.features[0].properties;if(oe&&oe.cluster){const ge=this._map?.getZoom();ge&&this._map?.flyTo({center:J.lngLat,zoom:ge+1})}}),this._attachedListeners.push(j))})}_reattachAllLayerEvents(){this._attachedListeners=[],Object.keys(this._sourceLayers).forEach(h=>{const P=this._sourceLayers[h];P&&this._setLayerEvents(h,P.layer)})}static \u0275fac=function(P){return new(P||k)};static \u0275prov=f.jDH({token:k,factory:k.\u0275fac})}return k})()},8017(te,Y,l){"use strict";l.d(Y,{T:()=>rt});var F=l(467),f=l(5802),x=l(7705),D=l(2271),s=l(5547),A=l(9769),v=l(5970),C=l(6170),m=l(5949),p=l(2843),a=l(3646),u=l(9079),y=l(1413),M=l(2306),w=l(7089),c=l(9352),S=l(5381),N=l(5187),k=l(5971),H=l(3319);function h(b,B){if(1&b){const g=s.RV6();s.j41(0,"cue-button",5),s.nI1(1,"transloco"),s.bIt("click",function(){f.eBV(g);const T=s.XpG(2);return f.Njj(T.handleZoomFit())}),s.nrm(2,"cue-button-icon",9),s.k0s()}2&b&&s.Y8G("cueTooltip",s.bMT(1,1,"components.map.tooltipZoomFit"))}function P(b,B){if(1&b){const g=s.RV6();s.j41(0,"cue-flexcontainer",3)(1,"cue-button",5),s.nI1(2,"transloco"),s.bIt("click",function(){f.eBV(g);const T=s.XpG();return f.Njj(T.handleZoomOut())}),s.nrm(3,"cue-button-icon",6),s.k0s(),s.j41(4,"cue-button",5),s.nI1(5,"transloco"),s.bIt("click",function(){f.eBV(g);const T=s.XpG();return f.Njj(T.handleZoomIn())}),s.nrm(6,"cue-button-icon",7),s.k0s(),s.nVh(7,h,3,3,"cue-button",8),s.k0s()}if(2&b){const g=s.XpG();s.R7$(),s.Y8G("cueTooltip",s.bMT(2,3,"components.map.tooltipZoomOut")),s.R7$(3),s.Y8G("cueTooltip",s.bMT(5,5,"components.map.tooltipZoomIn")),s.R7$(3),s.vxM(g.displayZoomFit()?7:-1)}}function R(b,B){if(1&b){const g=s.RV6();s.j41(0,"cue-button",10),s.nI1(1,"transloco"),s.nI1(2,"transloco"),s.mxI("selectedChange",function(T){f.eBV(g);const U=s.XpG();return s.DH7(U.layersVisible,T)||(U.layersVisible=T),f.Njj(T)}),s.nrm(3,"cue-button-icon",11),s.k0s()}if(2&b){const g=s.XpG();s.AVh("border-left",g.options().displayZoom&&g.displayLayerToggle()),s.Y8G("cueTooltip",g.layersVisible()?s.bMT(1,6,"components.map.tooltipHideLayers"):s.bMT(2,8,"components.map.tooltipShowLayers"))("toggleButton",!0),s.R50("selected",g.layersVisible),s.R7$(3),s.Y8G("icon",g.layersVisible()?"layers-clear":"layers")}}function O(b,B){if(1&b){const g=s.RV6();s.j41(0,"cue-button",10),s.nI1(1,"transloco"),s.nI1(2,"transloco"),s.mxI("selectedChange",function(T){f.eBV(g);const U=s.XpG();return s.DH7(U.geoFenceDrawEnabled,T)||(U.geoFenceDrawEnabled=T),f.Njj(T)}),s.nrm(3,"cue-button-icon",12),s.k0s()}if(2&b){const g=s.XpG();s.AVh("border-left",g.options().displayGeofenceDraw),s.Y8G("cueTooltip",g.geoFenceDrawEnabled()?s.bMT(1,5,"components.map.tooltipEndDrawGeofence"):s.bMT(2,7,"components.map.tooltipDrawGeofence"))("toggleButton",!0),s.R50("selected",g.geoFenceDrawEnabled)}}let V=(()=>{class b{_service=(0,f.WQX)(m.u);layerService=(0,f.WQX)(a.B);mapLayers=(0,u.ot)(this.layerService.layers);options=(0,x.hFB)(new M.AA);zoom=(0,x.geq)(1);rotate=(0,x.CGW)();geoFenceDrawEnabled=(0,x.geq)(!1);layersVisible=(0,x.geq)(!1);hasLayers=(0,D.EW)(()=>void 0!==this.mapLayers()&&this.mapLayers().length>0);displayLayerToggle=(0,D.EW)(()=>this.options().displayLayerToggle&&this.hasLayers());displayZoomFit=(0,D.EW)(()=>this.options().displayZoom&&this.hasLayers());selectMenuPositions=(0,D.EW)(()=>"top"===this.options().position?"bottomleft":"topleft");handleZoomIn(){this._service.zoomIn()}handleZoomOut(){this._service.zoomOut()}handleZoomFit(){this._service.fitGeoJSONBBOX(void 0,.01)}static \u0275fac=function(_){return new(_||b)};static \u0275cmp=s.VBU({type:b,selectors:[["cue-map-toolbar"]],inputs:{options:[1,"options"],zoom:[1,"zoom"],geoFenceDrawEnabled:[1,"geoFenceDrawEnabled"],layersVisible:[1,"layersVisible"]},outputs:{zoom:"zoomChange",rotate:"rotate",geoFenceDrawEnabled:"geoFenceDrawEnabledChange",layersVisible:"layersVisibleChange"},decls:6,vars:4,consts:[["justify","center",1,"container"],[1,"toolbar",3,"padded"],["align","center"],["align","center","gap","s"],["size","xs","variant","ghost",3,"border-left","cueTooltip","toggleButton","selected"],["size","xs","variant","tertiary",3,"click","cueTooltip"],["icon","zoom-out"],["icon","zoom-in"],["size","xs","variant","tertiary",3,"cueTooltip"],["icon","zoom-fit"],["size","xs","variant","ghost",3,"selectedChange","cueTooltip","toggleButton","selected"],[3,"icon"],["icon","polygon"]],template:function(_,T){1&_&&(s.j41(0,"cue-flexcontainer",0)(1,"cue-card",1)(2,"cue-flexcontainer",2),s.nVh(3,P,8,7,"cue-flexcontainer",3),s.nVh(4,R,4,10,"cue-button",4),s.nVh(5,O,4,9,"cue-button",4),s.k0s()()()),2&_&&(s.R7$(),s.Y8G("padded",!1),s.R7$(2),s.vxM(T.options().displayZoom?3:-1),s.R7$(),s.vxM(T.displayLayerToggle()?4:-1),s.R7$(),s.vxM(T.options().displayGeofenceDraw?5:-1))},dependencies:[S.n,N.Z,k.$,H.a,w.d,c.Kj],styles:[".container[_ngcontent-%COMP%]{width:100%;pointer-events:none}.toolbar[_ngcontent-%COMP%]{pointer-events:all;padding:5px 10px}.border-left[_ngcontent-%COMP%]{border-left:1px solid;padding-left:12px}"],changeDetection:0})}return b})();var K=l(7023),j=l(1024),J=l(9421);function oe(b,B){if(1&b&&s.nrm(0,"cue-key-val",1),2&b){const g=B.$implicit;s.Y8G("key",g.key)("val",g.val)}}let ge=(()=>{class b{props=(0,x.hFB)(null);keyVals=(0,D.EW)(()=>{const g=this.props();return g?Object.entries(g).map(([_,T])=>({key:_,val:String(T)})):[]});static \u0275fac=function(_){return new(_||b)};static \u0275cmp=s.VBU({type:b,selectors:[["cue-props-panel"]],inputs:{props:[1,"props"]},decls:4,vars:0,consts:[[2,"height","100%","overflow-y","auto"],[3,"key","val"]],template:function(_,T){1&_&&(s.j41(0,"cue-flexcontainer",0)(1,"cue-key-val-list"),s.Z7z(2,oe,1,2,"cue-key-val",1,s.Vm6),s.k0s()()),2&_&&(s.R7$(2),s.Dyx(T.keyVals()))},dependencies:[j.p,J.F,S.n],encapsulation:2,changeDetection:0})}return b})();var de=l(7517);let he=(()=>{class b{layerService=(0,f.WQX)(a.B);mapLayers=(0,u.ot)(this.layerService.layers);layerDefs=(0,D.EW)(()=>{const g=this.mapLayers();return g?g.map(_=>({label:_.label,color:_.color??"#000000",visible:_.visible,category:_.category})):[]});updateSingle(g){const _=this.mapLayers()?.find(T=>T.label===g.label);_&&this.layerService.toggleVisibility(_.id)}updateAll(g){const _=this.mapLayers();if(_)for(const T of _)T.visible===g&&this.layerService.toggleVisibility(T.id)}static \u0275fac=function(_){return new(_||b)};static \u0275cmp=s.VBU({type:b,selectors:[["cue-layer-panel"]],decls:1,vars:1,consts:[[3,"layerChange","visibilityAll","layers"]],template:function(_,T){1&_&&(s.j41(0,"cue-layer-legend",0),s.bIt("layerChange",function(Z){return T.updateSingle(Z)})("visibilityAll",function(Z){return T.updateAll(Z)}),s.k0s()),2&_&&s.Y8G("layers",T.layerDefs())},dependencies:[A.MD,de.P],encapsulation:2})}return b})();var pe=l(140),re=l(6986);function ve(b){const B=b.flatMap(g=>{const _=function Fe(b){switch(b.type){case"Point":return[b.coordinates[0],b.coordinates[1]];case"MultiPoint":{if(!b.coordinates.length)return null;const B=b.coordinates.reduce((g,_)=>[g[0]+_[0],g[1]+_[1]],[0,0]);return[B[0]/b.coordinates.length,B[1]/b.coordinates.length]}case"LineString":{if(!b.coordinates.length)return null;const B=Math.floor(b.coordinates.length/2);return[b.coordinates[B][0],b.coordinates[B][1]]}case"MultiLineString":{if(!b.coordinates.length||!b.coordinates[0].length)return null;const B=b.coordinates[0],g=Math.floor(B.length/2);return[B[g][0],B[g][1]]}case"Polygon":{if(!b.coordinates.length||!b.coordinates[0].length)return null;const B=b.coordinates[0],g=B.reduce((_,T)=>[_[0]+T[0],_[1]+T[1]],[0,0]);return[g[0]/B.length,g[1]/B.length]}case"MultiPolygon":{if(!b.coordinates.length||!b.coordinates[0]?.length||!b.coordinates[0][0]?.length)return null;const B=b.coordinates[0][0],g=B.reduce((_,T)=>[_[0]+T[0],_[1]+T[1]],[0,0]);return[g[0]/B.length,g[1]/B.length]}default:return null}}(g.geometry);return _?[{type:"Feature",id:g.id,geometry:{type:"Point",coordinates:_},properties:{...g.properties??{},_isCentroid:!0}}]:[]});return[...b,...B]}const lt=["rgba(255, 0, 0, 0.5)","rgba(0, 0, 255, 0.5)","rgba(0, 255, 0, 0.5)","rgba(255, 165, 0, 0.5)","rgba(128, 0, 128, 0.5)","rgba(255, 192, 203, 0.5)","rgba(255, 255, 0, 0.5)"];function _t(b){const B=b.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d\.]+))?\)/);if(B)return{r:parseInt(B[1]),g:parseInt(B[2]),b:parseInt(B[3]),a:B[4]?parseFloat(B[4]):1};const g=b.match(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/);if(g){const _=g[1];return{r:parseInt(3===_.length?_[0]+_[0]:_.slice(0,2),16),g:parseInt(3===_.length?_[1]+_[1]:_.slice(2,4),16),b:parseInt(3===_.length?_[2]+_[2]:_.slice(4,6),16),a:1}}return{r:0,g:0,b:0,a:1}}function Qe(b){if(0===b.length)return lt[0];if(1===b.length)return b[0].color;const B=b.map(ae=>({...ae,totalWeight:ae.featureCount*ae.weight})).sort((ae,ee)=>ee.totalWeight-ae.totalWeight),g=B.reduce((ae,ee)=>ae+ee.totalWeight,0),_=B[0];if(_.totalWeight/g>.6)return _.color;const T=B.slice(0,Math.min(3,B.length)),U=T.reduce((ae,ee)=>ae+ee.totalWeight,0);let Z=0,se=0,ue=0,me=0;for(const ae of T){const ee=_t(ae.color),ye=ae.totalWeight/U;Z+=ee.r*ye,se+=ee.g*ye,ue+=ee.b*ye,me+=ee.a*ye}return function ct(b,B,g,_=1){return _<1?`rgba(${Math.round(b)}, ${Math.round(B)}, ${Math.round(g)}, ${_})`:`rgb(${Math.round(b)}, ${Math.round(B)}, ${Math.round(g)})`}(Z,se,ue,me)}function He(b,B,g,_){if(!_||"Point"!==g&&"MultiPoint"!==g)return[{color:B,weight:1,featureCount:b.length}];const T=b.length;if(T<10)return[{color:B,weight:1,featureCount:T}];let U=0,Z=0,se=0;T>=750?(U=Math.floor(.1*T),Z=Math.floor(.3*T),se=T-U-Z):T>=100?(Z=Math.floor(.4*T),se=T-Z):(se=Math.floor(.8*T),Z=T-se);const ue=[];return se>0&&ue.push({color:B,weight:1,featureCount:se}),Z>0&&ue.push({color:"#f28cb1",weight:2,featureCount:Z}),U>0&&ue.push({color:"#e2f552",weight:3,featureCount:U}),ue}function qe(b,B,g,_,T,U){const Z=Array.isArray(_)?_:[_];(0,re.j5)(T)?b.layerService.loadGeoJSONLayerGroup(B,g,Z,{cluster:!1,zoomToFit:U.zoomToFit,visible:U.visible,label:U.label,color:U.color}):Z.length>1||("Point"===T||"MultiPoint"===T)&&Array.isArray(Z)&&Z.length>1?b.layerService.loadGeoJSONLayerGroup(B,g,Z,{cluster:(0,re.n7)(T,U.cluster),zoomToFit:U.zoomToFit,visible:U.visible,label:U.label,color:U.color}):b.loadGeoJSON(B,g,Z[0],(0,re.n7)(T,U.cluster),U.zoomToFit)}var vt=l(6756),Et=l(356),ut=l(6279);const Ze=["map"],et=b=>({position:"bottomleft",hoveredFeature:b}),Mt=(b,B)=>B.label;function bt(b,B){if(1&b){const g=s.RV6();s.j41(0,"cue-menu-item",6),s.bIt("click",function(T){const U=f.eBV(g).$implicit;return f.Njj(U.action(T))}),s.EFF(1),s.k0s()}if(2&b){const g=B.$implicit;s.R7$(),s.JRh(g.label)}}function Ct(b,B){if(1&b&&(s.j41(0,"cue-menu-wrap"),s.Z7z(1,bt,2,1,"cue-menu-item",null,Mt),s.k0s()),2&b){const g=s.XpG();s.R7$(),s.Dyx(g.contextMenuItems())}}function tt(b,B){if(1&b&&(s.j41(0,"span"),s.EFF(1),s.k0s()),2&b){const g=s.XpG();s.R7$(),s.JRh(g.mapService.error())}}function Tt(b,B){if(1&b){const g=s.RV6();s.j41(0,"cue-map-toolbar",8),s.mxI("zoomChange",function(T){f.eBV(g);const U=s.XpG(2);return s.DH7(U.zoom,T)||(U.zoom=T),f.Njj(T)})("layersVisibleChange",function(T){f.eBV(g);const U=s.XpG(2);return s.DH7(U.layerPanelVisible,T)||(U.layerPanelVisible=T),f.Njj(T)})("geoFenceDrawEnabledChange",function(T){f.eBV(g);const U=s.XpG(2);return s.DH7(U.geoFenceDrawEnabled,T)||(U.geoFenceDrawEnabled=T),f.Njj(T)}),s.k0s()}if(2&b){const g=s.XpG(),_=s.XpG();s.Aen(_.toolbarStyle()),s.Y8G("options",g),s.R50("zoom",_.zoom)("layersVisible",_.layerPanelVisible)("geoFenceDrawEnabled",_.geoFenceDrawEnabled)}}function Lt(b,B){1&b&&s.nVh(0,Tt,1,6,"cue-map-toolbar",7),2&b&&s.vxM(B.hidden?-1:0)}function nt(b,B){1&b&&(s.j41(0,"cue-card",4),s.nrm(1,"cue-layer-panel"),s.k0s())}function Nt(b,B){1&b&&(s.j41(0,"cue-card",5),s.nrm(1,"cue-props-panel",9),s.k0s()),2&b&&(s.R7$(),s.Y8G("props",B))}let rt=(()=>{class b{mapService=(0,f.WQX)(m.u);drawService=(0,f.WQX)(p.M);settings=(0,x.hFB)(new M.yY);center=(0,x.hFB)([8.5,47.4]);layerPanelVisible=(0,x.geq)(!1);zoom=(0,x.geq)(2);instruction=(0,x.geq)("Hello");layers=(0,x.hFB)([]);zoomToFit=(0,x.hFB)(!0);zoomToFitEachLayer=(0,x.hFB)(!1);splitLayersByGeometryType=(0,x.hFB)(!0);maxClickZoom=(0,x.hFB)(1/0);borderRadius=(0,x.hFB)("0");geoFenceDrawEnabled=(0,x.geq)(!1);contextMenuItemsBefore=(0,x.hFB)([]);contextMenuItemsAfter=(0,x.hFB)([]);immidiateDrawMode=(0,x.hFB)(void 0);mapReady=(0,x.CGW)();clickedMap=(0,x.CGW)();pannedMap=(0,x.CGW)();panningMap=(0,x.CGW)();zoomedMap=(0,x.CGW)();clickedFeature=(0,x.CGW)();hoveredFeature=(0,x.CGW)();drawEvent=(0,x.CGW)();layersSaturated=(0,D.EW)(()=>this.layers().map((g,_)=>{const T={...g};return T.color||(T.color=vt.BK[_]),T}));toolbarOptions=(0,D.EW)(()=>this.settings().toolbar);featureBeingHovered=(0,f.vPA)(void 0);lastClickedFeatureEvent=(0,f.vPA)(void 0);lastHoveredFeatureEvent=(0,f.vPA)(void 0);shownProperties=(0,f.vPA)(null);_featureClickedThisTick=!1;_previousLayersHash=(0,f.vPA)("");_userHasInteracted=(0,f.vPA)(!1);toolbarStyle=(0,D.EW)(()=>{const g=this.toolbarOptions();return{position:"absolute",left:g.margin,right:g.margin,["top"===g.position?"top":"bottom"]:g.margin,"z-index":"10",display:"flex","justify-content":"center"}});contextMenuEnabled=(0,D.EW)(()=>{const g=this.contextMenuItems().length>0,_=this.featureBeingHovered(),T=this.lastClickedFeatureEvent();return g&&(void 0!==_||void 0!==T)});contextMenuItems=(0,D.EW)(()=>{const g=this.lastHoveredFeatureEvent(),_=this.lastClickedFeatureEvent(),U=(g?.feature||_?.feature)?.properties||null,Z=U?Object.fromEntries(Object.entries(U).filter(([ye])=>!ye.startsWith("_"))):null,se=g?.lngLat||_?.lngLat||null,me=[...this.contextMenuItemsBefore()||[]],ae=this.settings().contextMenu;Z&&Object.keys(Z).length>0&&ae.showProperties&&me.push({label:"Show properties",action:()=>{this.shownProperties.update(()=>Z)}}),se&&ae.showFlyTo&&me.push({label:"Fly to feature",action:()=>{this.mapService.flyTo([se.lng,se.lat],this.zoom())}});const ee=this.contextMenuItemsAfter()||[];return[...me,...ee]});_mapContainer;_destroy$=new y.B;constructor(){this._subscribeToServiceOutputs(),this._setupEffects(),(0,s.mal)(()=>{this._destroy$.closed||this._tryInitializeMap()})}ngOnDestroy(){this._destroy$.next(),this._destroy$.complete(),this.drawService.destroy(),this.mapService.destroy()}_subscribeToServiceOutputs(){this.mapService.mapReady.pipe((0,u.pQ)()).subscribe(()=>this.mapReady.emit()),this.mapService.clickedMap.pipe((0,u.pQ)()).subscribe(g=>{this._featureClickedThisTick||(this.lastClickedFeatureEvent.update(()=>{}),this.lastHoveredFeatureEvent.update(()=>{}),this.featureBeingHovered.update(()=>{}),this.clickedMap.emit(g),this.shownProperties.update(()=>null))}),this.mapService.pannedMap.pipe((0,u.pQ)()).subscribe(g=>{this._userHasInteracted.set(!0),this.pannedMap.emit(g)}),this.mapService.panningMap.pipe((0,u.pQ)()).subscribe(g=>this.panningMap.emit(g)),this.mapService.zoomedMap.pipe((0,u.pQ)()).subscribe(g=>{this._userHasInteracted.set(!0),this.zoomedMap.emit(this.mapService.getZoom()??this.zoom())}),this.mapService.clickedFeature.pipe((0,u.pQ)()).subscribe(g=>{this._featureClickedThisTick=!0,queueMicrotask(()=>{this._featureClickedThisTick=!1}),this.lastClickedFeatureEvent.update(()=>g),this.clickedFeature.emit(g);const _=g.feature?.geometry?.type,T="Point"===_||"MultiPoint"===_,U=this.mapService.getZoom()??0,Z=this.contextMenuItems().length>0;T&&!Z&&U<this.maxClickZoom()&&this.mapService.zoomToCoordinate(g.lngLat)}),this.mapService.hoveredFeature.pipe((0,u.pQ)()).subscribe(g=>{this.featureBeingHovered.update(()=>g?.feature),this.lastHoveredFeatureEvent.update(()=>g),this.hoveredFeature.emit(g)})}_setupEffects(){var g=this;(0,f.QZP)(()=>{"polygon"===this.immidiateDrawMode()&&(this.geoFenceDrawEnabled.set(!0),setTimeout(()=>{this.drawService.setDrawMode(!0,this.settings().toolbar.clearGeofenceAfterDraw)},500))}),(0,f.QZP)(()=>this.mapService.flyTo(this.center(),this.zoom())),(0,f.QZP)(()=>{const T=this.settings()?.mapboxToken;T&&"string"==typeof T&&""!==T.trim()&&!this.mapService.isMapReady()&&this._tryInitializeMap()}),(0,f.QZP)(()=>{const _=this.geoFenceDrawEnabled();this.drawService.setDrawMode(_,this.settings().toolbar.clearGeofenceAfterDraw)}),(0,f.QZP)(()=>{const _=this.drawService.drawEvent();void 0!==_&&this.drawEvent.emit(_)}),(0,f.QZP)((0,F.A)(function*(){const _=g.layersSaturated();if(!_||0===_.length)return;const T=g._createLayersHash(_);if(T===g._previousLayersHash())return;g._previousLayersHash.set(T),yield g.mapService.waitForMapReady(),g.mapService.clearLayers();const Z=g.zoomToFitEachLayer();_.forEach((se,ue)=>{!function Re(b,B,g,_,T,U,Z){const se=B.collection,ue=B.color??lt[g];let me;me="geometries"in se?function Ne(b){const B=b.geometries.map((_,T)=>({type:"Feature",geometry:_,properties:{},id:b.id?`${b.id}_${T}`:void 0})),g=new pe.o(B);return g.id=b.id,g.bbox=b.bbox,g}(se):se;const ae=function Ae(b){const B=[];return b.forEach(g=>{g.geometry&&"GeometryCollection"===g.geometry.type?g.geometry.geometries.forEach((_,T)=>{B.push({type:"Feature",geometry:_,properties:g.properties||{},id:g.id?`${g.id}_${T}`:void 0})}):B.push(g)}),B}(me.features),ee=new pe.o(ae);ee.id=me.id,ee.bbox=me.bbox;let ye=ue;if(!U){const fe=B.id.toString(),q=ae[0]?.geometry?.type||"Point";ye=Qe(He(ae,ue,q,_));let Ee=Z(fe,q,ye,fe),Ce=ee;const Be="Point"!==q&&"MultiPoint"!==q,Me=(0,re.j5)(q),_e=(0,re.dx)(q);if(_&&Be&&!Me&&!_e&&Ee){const ot=Array.isArray(Ee)?Ee:[Ee],we=ve(ae);Ce=new pe.o(we),Ce.id=ee.id,Ce.bbox=ee.bbox,Ee=[(0,re.g8)(`${fe}-centroid`,fe,ye),...ot.map(ie=>({...ie,minzoom:re.A4}))]}return void(Ee&&qe(b,fe,Ce,Ee,q,{cluster:_,zoomToFit:T,visible:!0,label:B.label||B.id.toString(),color:ye}))}if(U){const fe=new Set(ae.map(z=>z.geometry.type)),q=[];return fe.forEach(z=>{const Ee=`${B.id.toString()}-${z}`,Ce=ae.filter(_e=>_e.geometry.type===z),Be=He(Ce,ue,z,_);q.push(...Be);let Me=Z(Ee,z,ue,Ee);if(Me){let _e=new pe.o(Ce);_e.id=ee.id,_e.bbox=ee.bbox;const ot="Point"!==z&&"MultiPoint"!==z,we=(0,re.j5)(z),dt=(0,re.dx)(z);if(_&&ot&&!we&&!dt){const ie=Array.isArray(Me)?Me:[Me],ht=ve(Ce);_e=new pe.o(ht),_e.id=ee.id,_e.bbox=ee.bbox,Me=[(0,re.g8)(`${Ee}-centroid`,Ee,ue),...ie.map(Pt=>({...Pt,minzoom:re.A4}))]}qe(b,Ee,_e,Me,z,{cluster:_,zoomToFit:T,visible:!0,label:fe.size>1?`${B.label||B.id} (${z})`:`${B.label||B.id}`,color:ue})}}),void(q.length>0&&(ye=Qe(q),b.layerService.getLayer(B.id.toString())&&b.layerService.updateLayer(B.id.toString(),{color:ye})))}const ze=new Map;ae.forEach(fe=>{const q=fe.geometry.type;let z;z="Point"===q||"MultiPoint"===q?"Point":"LineString"===q||"MultiLineString"===q?"LineString":"Polygon"===q||"MultiPolygon"===q?"Polygon":q,ze.has(z)||ze.set(z,[]),ze.get(z).push(q)});const ke=[];ze.forEach((fe,q)=>{const z=`${B.id.toString()}-${q}`,Ee=ae.filter(Me=>{const _e=Me.geometry.type;return"Point"===q?"Point"===_e||"MultiPoint"===_e:"LineString"===q?"LineString"===_e||"MultiLineString"===_e:"Polygon"===q?"Polygon"===_e||"MultiPolygon"===_e:_e===q}),Ce=He(Ee,ue,q,_);ke.push(...Ce);const Be=Z(z,q,ue,z);if(Be){const Me=new pe.o(Ee);Me.id=ee.id,Me.bbox=ee.bbox,qe(b,z,Me,Be,q,{cluster:_,zoomToFit:T,visible:!0,label:ze.size>1?`${B.label||B.id} (${q})`:`${B.label||B.id}`,color:ue})}}),ke.length>0&&(ye=Qe(ke),b.layerService.getLayer(B.id.toString())&&b.layerService.updateLayer(B.id.toString(),{color:ye}))}(g.mapService,se,ue,se.cluster,Z&&se.zoomToFit,g.splitLayersByGeometryType(),re.Ln)}),g.zoomToFit()&&!Z&&!g._userHasInteracted()&&g.mapService.fitGeoJSONBBOX()}))}_tryInitializeMap(){if(this._destroy$.closed)return;const _=this.settings()?.mapboxToken,T=_&&"string"==typeof _&&""!==_.trim(),U=this._mapContainer,Z=!this.mapService.isMapReady();T&&U&&Z&&(this._userHasInteracted.set(!1),this.mapService.init(this._mapContainer.nativeElement,_,this.center(),this.zoom(),this.borderRadius()))}_createLayersHash(g){return g.map(_=>{const T=_.collection;let U=0;return T&&"FeatureCollection"===T.type&&"features"in T&&(U=Array.isArray(T.features)?T.features.length:0),`${_.id}|${_.label}|${_.visible}|${U}`}).join("::")}static \u0275fac=function(_){return new(_||b)};static \u0275cmp=s.VBU({type:b,selectors:[["cue-map"]],viewQuery:function(_,T){if(1&_&&s.GBs(Ze,5),2&_){let U;s.mGM(U=s.lsd())&&(T._mapContainer=U.first)}},hostAttrs:["data-component","cue-map-main"],inputs:{settings:[1,"settings"],center:[1,"center"],layerPanelVisible:[1,"layerPanelVisible"],zoom:[1,"zoom"],instruction:[1,"instruction"],layers:[1,"layers"],zoomToFit:[1,"zoomToFit"],zoomToFitEachLayer:[1,"zoomToFitEachLayer"],splitLayersByGeometryType:[1,"splitLayersByGeometryType"],maxClickZoom:[1,"maxClickZoom"],borderRadius:[1,"borderRadius"],geoFenceDrawEnabled:[1,"geoFenceDrawEnabled"],contextMenuItemsBefore:[1,"contextMenuItemsBefore"],contextMenuItemsAfter:[1,"contextMenuItemsAfter"],immidiateDrawMode:[1,"immidiateDrawMode"]},outputs:{layerPanelVisible:"layerPanelVisibleChange",zoom:"zoomChange",instruction:"instructionChange",geoFenceDrawEnabled:"geoFenceDrawEnabledChange",mapReady:"mapReady",clickedMap:"clickedMap",pannedMap:"pannedMap",panningMap:"panningMap",zoomedMap:"zoomedMap",clickedFeature:"clickedFeature",hoveredFeature:"hoveredFeature",drawEvent:"drawEvent"},features:[s.Jv_([m.u,p.M,a.B])],decls:9,vars:9,consts:[["hoveringFeature",""],["map",""],["direction","row",1,"container"],["id","map","cueResized","","cueDarkMode","","trigger","leftclick",3,"darkModeChange","resized","cueContextMenu","contextMenuData","cueContextEnabled"],[1,"layer-panel"],[1,"props-panel"],[3,"click"],[3,"options","style","zoom","layersVisible","geoFenceDrawEnabled"],[3,"zoomChange","layersVisibleChange","geoFenceDrawEnabledChange","options","zoom","layersVisible","geoFenceDrawEnabled"],[3,"props"]],template:function(_,T){if(1&_&&(s.DNE(0,Ct,3,0,"ng-template",null,0,s.C5r),s.j41(2,"cue-flexcontainer",2)(3,"div",3,1),s.bIt("darkModeChange",function(Z){return T.mapService.setDarkMode(Z)})("resized",function(){return T.mapService.onParentResize()}),s.k0s(),s.nVh(5,tt,2,1,"span"),s.nVh(6,Lt,1,1),s.nVh(7,nt,2,0,"cue-card",4),s.nVh(8,Nt,2,1,"cue-card",5),s.k0s()),2&_){let U,Z;const se=s.sdS(1);s.R7$(3),s.Y8G("cueContextMenu",se)("contextMenuData",s.eq3(7,et,T.lastHoveredFeatureEvent()))("cueContextEnabled",T.contextMenuEnabled()),s.R7$(2),s.vxM(T.mapService.error()?5:-1),s.R7$(),s.vxM((U=T.toolbarOptions())?6:-1,U),s.R7$(),s.vxM(T.layerPanelVisible()?7:-1),s.R7$(),s.vxM((Z=T.shownProperties())?8:-1,Z)}},dependencies:[A.MD,v.C,C.R,V,K.Q,Et.M,ut.D,S.n,ge,he,N.Z],styles:["#map[_ngcontent-%COMP%]{flex:1;min-height:0;border-radius:inherit;overflow:hidden}[_nghost-%COMP%]{display:flex;flex-direction:column;position:relative;width:100%;height:100%;min-height:400px;min-width:200px;flex:1 1 auto;align-self:stretch;box-sizing:border-box;overflow:hidden;border-radius:var(--cue-card-border-radius, inherit)}.mapboxgl-canvas-container[_ngcontent-%COMP%], .mapboxgl-canvas[_ngcontent-%COMP%]{border-radius:inherit!important}.mapboxgl-map[_ngcontent-%COMP%]{border-radius:inherit!important;overflow:hidden!important}.container[_ngcontent-%COMP%]{position:relative;width:100%;flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column}.props-panel[_ngcontent-%COMP%]{position:absolute;top:8px;right:8px;bottom:8px;z-index:10}.layer-panel[_ngcontent-%COMP%]{position:absolute;top:10px;left:10px;z-index:10}cue-map-toolbar[_ngcontent-%COMP%]{position:absolute;left:0;right:0;bottom:0;z-index:10;display:flex;justify-content:center}"]})}return b})()},5949(te,Y,l){"use strict";l.d(Y,{u:()=>C});var F=l(467),f=l(5802),x=l(2271),D=l(1413),s=l(3646),A=l(2843),v=l(9079);let C=(()=>{class m{_map;_mapContainer;_isInitializing=!1;_mapReadyPromiseResolve;_mapReady=new Promise(a=>{this._mapReadyPromiseResolve=a});_emittedReady=!1;_firstThemeReceived=!1;_hoveredFeature=(0,f.vPA)(void 0);_layerService=(0,f.WQX)(s.B);_drawService=(0,f.WQX)(A.M);mapboxToken=(0,f.vPA)("");center=(0,f.vPA)([8.5,47.4]);zoom=(0,f.vPA)(2);borderRadius=(0,f.vPA)("0");mapReady=new D.B;clickedMap=new D.B;pannedMap=new D.B;panningMap=new D.B;zoomedMap=new D.B;error=(0,f.vPA)("");get clickedFeature(){return this._layerService.clickedFeature}get hoveredFeature(){return this._layerService.hoveredFeature}get layers(){return this._layerService.layers}get layersSignal(){return this._layerService.layersSignal}get layerService(){return this._layerService}get drawService(){return this._drawService}get drawEvent(){return this._drawService.drawEvent}_darkMode=(0,f.vPA)(this._getSystemColorPreference());_styleId=(0,x.EW)(()=>this._darkMode()?"madsholten/clwjh4xeu00q601pnczm07jq6":"madsholten/clwjh6ug900q701pn6eor8p51");get map(){return this._map}constructor(){this._layerService.hoveredFeature.pipe((0,v.pQ)()).subscribe(a=>{this._hoveredFeature.set(a?.feature)}),(0,f.QZP)(()=>{this._styleId(),this._firstThemeReceived?void 0!==this._map&&this._updateStyle().catch(a=>{console.error("Failed to update map style:",a)}):this._firstThemeReceived=!0})}destroy(){if(this._layerService?.clearAllLayers(),this._drawService?.destroy(),this._map)try{this._map.remove()}catch(a){console.warn("Error removing map:",a)}this._map=void 0,this._mapContainer&&(this._mapContainer.innerHTML="",this._mapContainer=void 0),this._isInitializing=!1,this._emittedReady=!1,this._mapReady=new Promise(a=>{this._mapReadyPromiseResolve=a})}isMapReady(){return void 0!==this._map&&this._emittedReady&&!this._isInitializing}waitForMapReady(){var a=this;return(0,F.A)(function*(){return a._mapReady})()}init(a,u,y,M,w){var c=this;return(0,F.A)(function*(){if(u&&""!==u.trim())if(c._map||c._isInitializing)console.warn("MapService: Map is already initialized or currently initializing");else{c._isInitializing=!0,c.mapboxToken.set(u),c.center.set(y),c.zoom.set(M),c.borderRadius.set(w),c._mapContainer=a,c._mapContainer&&(c._mapContainer.innerHTML="");try{yield c._loadMapboxCSS();const S=yield l.e(247).then(l.t.bind(l,1247,23)),N=S.default||S;if(!N||"function"!=typeof N.Map)throw new Error("Mapbox GL JS not properly loaded");N.accessToken=c.mapboxToken(),c._map=new N.Map({container:a,style:c._getMapStyleURL(),center:c.center(),zoom:c.zoom()}),c._applyBorderRadius(a),c._initEventListeners(c._map)}catch(S){console.error("Failed to load mapbox-gl:",S),c.error.set("Failed to load map library. Please ensure mapbox-gl is installed.")}finally{c._isInitializing=!1}}else console.warn("MapService: Cannot initialize map without valid mapbox token")})()}loadGeoJSON(a,u,y){var M=this;return(0,F.A)(function*(w,c,S,N=!0,k=!0){return yield M._mapReady,M._layerService.loadGeoJSONLayer(w,c,S,{cluster:N,zoomToFit:k,visible:!0,label:w})}).apply(this,arguments)}fitGeoJSONBBOX(a){var u=this;return(0,F.A)(function*(y,M=50,w=!0,c=19){yield u._mapReady,y?u._layerService.fitGeoJSONBounds(y,M,w,c):u._layerService.fitAllVisibleLayers(M)}).apply(this,arguments)}jumpTo(a,u){this._map?.jumpTo({center:a,zoom:u??this.zoom()})}setDarkMode(a){this._darkMode.set(a)}zoomToCoordinate(a){const u=this._map?.getZoom();if(!u)return;const y=u+1;this._map?.flyTo({center:a,zoom:y})}getZoom(){return this._map?.getZoom()}flyTo(a,u,y){this._map?.flyTo({center:a,zoom:u??this.zoom(),essential:!0,padding:y})}zoomIn(){if(!this._map)return;const a=this._map.getZoom();this._map.flyTo({zoom:a+1})}zoomOut(){if(!this._map)return;const a=this._map.getZoom();this._map.flyTo({zoom:a-1})}clearLayers(){this._layerService.clearAllLayers()}getImage(){const a=this._map?.getCanvas();if(void 0!==a)return a.toDataURL("image/png")}onParentResize(){this._map?.resize()}_loadMapboxCSS(){return(0,F.A)(function*(){return new Promise((a,u)=>{if(document.querySelector('link[href*="mapbox-gl.css"]'))return void a();const y=document.createElement("link");y.rel="stylesheet",y.href="https://api.mapbox.com/mapbox-gl-js/v3.3.0/mapbox-gl.css",y.onload=()=>a(),y.onerror=()=>{const M=document.createElement("link");M.rel="stylesheet",M.href="node_modules/mapbox-gl/dist/mapbox-gl.css",M.onload=()=>a(),M.onerror=()=>u(new Error("Failed to load Mapbox CSS")),document.head.appendChild(M)},document.head.appendChild(y)})})()}_applyBorderRadius(a){const u=this.borderRadius();let y=u;if("0"===u){const w=a.closest("cue-map")?.parentElement;w&&(y=getComputedStyle(w).borderRadius||"0")}"0"!==y&&(a.style.borderRadius=y,a.style.overflow="hidden",setTimeout(()=>{const M=a.querySelector(".mapboxgl-canvas"),w=a.querySelector(".mapboxgl-canvas-container"),c=a.querySelector(".mapboxgl-map");M&&(M.style.borderRadius=y),w&&(w.style.borderRadius=y),c&&(c.style.borderRadius=y)},100))}_initEventListeners(a){a.on("click",u=>{void 0===this._hoveredFeature()&&this.clickedMap.next(u)}),a.on("drag",u=>{void 0===this._hoveredFeature()&&this.panningMap.next(u)}),a.on("dragend",u=>{void 0===this._hoveredFeature()&&this.pannedMap.next(u)}),a.on("zoomend",u=>{this.zoomedMap.next(u)}),a.on("load",()=>{this._emittedReady||(this._layerService.initializeWithMap(a),this._drawService.initializeWithMap(a),this._mapReadyPromiseResolve(),this.mapReady.next(),this._emittedReady=!0)}),a.on("error",u=>{this.error.set(u.error.message)})}_getMapStyleURL(){return`mapbox://styles/${this._styleId()}`}_updateStyle(){var a=this;return(0,F.A)(function*(){if(void 0===a._map)return;const u=a._map.getZoom(),y=a._map.getCenter();void 0!==a._mapContainer&&(yield a.init(a._mapContainer,a.mapboxToken(),y,u,a.borderRadius()),setTimeout(()=>{a._layerService.reapplyLayers(),a._map?.flyTo({center:y,zoom:u})},500))})()}_getSystemColorPreference(){return typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches}static \u0275fac=function(u){return new(u||m)};static \u0275prov=f.jDH({token:m,factory:m.\u0275fac})}return m})()},2306(te,Y,l){"use strict";l.d(Y,{AA:()=>D,ux:()=>s,yY:()=>x});var F=l(140),f=l(8402);class x{mapboxToken;contextMenu={showProperties:!0,showFlyTo:!0};toolbar=new D}class D{hidden=!1;position="bottom";margin="20px";displayZoom=!0;displayGeofenceDraw=!1;displayLayerToggle=!0;clearGeofenceAfterDraw=!0}class s{label;id;collection=new F.o;color;visible=!0;cluster=!0;zoomToFit=!0;category;constructor(v,C=(0,f.A)()){this.label=v,this.id=C}}},8334(te,Y,l){"use strict";l.d(Y,{o:()=>D});var F=l(7705),f=l(5547);const x=["*"];let D=(()=>{class s{label=F.hFB.required();active=(0,F.geq)(!1);static \u0275fac=function(C){return new(C||s)};static \u0275cmp=f.VBU({type:s,selectors:[["cue-tab"]],hostVars:1,hostBindings:function(C,m){2&C&&f.Avn("hidden",!m.active())},inputs:{label:[1,"label"],active:[1,"active"]},outputs:{active:"activeChange"},ngContentSelectors:x,decls:1,vars:0,template:function(C,m){1&C&&(f.NAR(),f.SdG(0))},styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0}[hidden][_nghost-%COMP%]{display:none!important}"]})}return s})()},6455(te,Y,l){"use strict";l.d(Y,{t:()=>C});var F=l(7705),f=l(5802),x=l(8334),D=l(5547);const s=["*"],A=(m,p)=>p.label();function v(m,p){if(1&m){const a=D.RV6();D.rj2(0,"button",3),D.VwU("click",function(){const y=f.eBV(a).$index,M=D.XpG();return f.Njj(M.setActive(y))}),D.EFF(1),D.eux()}if(2&m){const a=p.$implicit,u=p.$index,y=D.XpG();D.AVh("active",y.activeIndex()===u),D.R7$(),D.SpI(" ",a.label()," ")}}let C=(()=>{class m{tabs=(0,F.tEk)(x.o);activeIndex=(0,f.vPA)(0);constructor(){(0,f.QZP)(()=>{const a=this.tabs(),u=this.activeIndex();a.forEach((y,M)=>y.active.set(M===u))})}setActive(a){this.activeIndex.set(a)}static \u0275fac=function(u){return new(u||m)};static \u0275cmp=D.VBU({type:m,selectors:[["cue-tabs"]],contentQueries:function(u,y,M){1&u&&D.C6U(M,y.tabs,x.o,4),2&u&&D.NyB()},ngContentSelectors:s,decls:5,vars:0,consts:[[1,"tabs-header"],[1,"tab-button",3,"active"],[1,"tabs-content"],[1,"tab-button",3,"click"]],template:function(u,y){1&u&&(D.NAR(),D.rj2(0,"div",0),D.Z7z(1,v,2,3,"button",1,A),D.eux(),D.rj2(3,"div",2),D.SdG(4),D.eux()),2&u&&(D.R7$(),D.Dyx(y.tabs()))},styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;border-radius:var(--cue-card-border-radius);border:1px solid var(--cue-card-border-color);background-color:var(--cue-default);color:var(--cue-defaultContrast);box-sizing:border-box;overflow:hidden}.tabs-header[_ngcontent-%COMP%]{display:flex;border-bottom:1px solid var(--cue-card-border-color);background-color:var(--cue-default)}.tab-button[_ngcontent-%COMP%]{padding:10px 16px;background:none;border:none;border-bottom:2px solid transparent;cursor:pointer;color:var(--cue-defaultContrast);font-family:var(--cue-font-family);font-size:var(--cue-font-s-size);line-height:var(--cue-font-s-line-height);opacity:.6;transition:opacity .15s,border-bottom-color .15s}.tab-button[_ngcontent-%COMP%]:hover{opacity:.9}.tab-button.active[_ngcontent-%COMP%]{border-bottom-color:var(--cue-accent);opacity:1;font-weight:500}.tabs-content[_ngcontent-%COMP%]{padding:var(--cue-card-padding-y) var(--cue-card-padding-x);flex:1;min-height:0;box-sizing:border-box;display:flex;flex-direction:column}"]})}return m})()},6170(te,Y,l){"use strict";l.d(Y,{R:()=>s});var F=l(7705),f=l(5802),x=l(2271),D=l(5547);let s=(()=>{class A{destroyRef=(0,f.WQX)(f.abz);_isDarkMode=(0,f.vPA)(this.hasDarkClass());isDarkMode=(0,x.EW)(()=>this._isDarkMode());darkModeChange=(0,F.CGW)();constructor(){const C=new MutationObserver(m=>{m.forEach(p=>{if("attributes"===p.type&&"class"===p.attributeName){const a=this.hasDarkClass();a!==this._isDarkMode()&&this._isDarkMode.set(a)}})});C.observe(document.body,{attributes:!0,attributeFilter:["class"]}),this.destroyRef.onDestroy(()=>C.disconnect()),(0,f.QZP)(()=>{this.darkModeChange.emit(this._isDarkMode()),document.documentElement.style.colorScheme=this._isDarkMode()?"dark":"light"})}hasDarkClass(){return document.body.classList.contains("dark")}toggleDarkMode(){document.body.classList.toggle("dark")}static \u0275fac=function(m){return new(m||A)};static \u0275dir=D.FsC({type:A,selectors:[["","cueDarkMode",""]],outputs:{darkModeChange:"darkModeChange"},exportAs:["darkModeDetector"]})}return A})()},7335(te,Y,l){"use strict";l.d(Y,{e:()=>C});var F=l(7705),f=l(5802),x=l(5547),D=l(8359),s=l(6939),A=l(63),v=l(4853);let C=(()=>{class m{_targetEl=(0,f.WQX)(x.aKT);_overlay=(0,f.WQX)(A.hJ);_overlayRef;_isOverlayHovered=!1;_subscriptions;display=(0,F.hFB)("on-hover");menuItems=F.hFB.required();menuEnabled=(0,F.hFB)(!0);onMouseEnter(){if("on-hover"===this.display()){if(!this.menuItems().length)return void this.removeOverlayMenu();this.appendOverlayMenu()}}onMouseLeave(){this._checkShouldRemoveOverlay()}appendOverlayMenu(){if(!this.menuItems().length||this._overlayRef)return;const a=this._overlay.create({positionStrategy:this._overlay.position().flexibleConnectedTo(this._targetEl).withPositions([{originX:"end",originY:"center",overlayX:"start",overlayY:"center",offsetX:2,offsetY:0}])});this._overlayRef=a;const u=window.getComputedStyle(this._targetEl.nativeElement).color;a.overlayElement.style.color=u;const y=new s.A8(v.H),M=a.attach(y);M.instance.items=this.menuItems,this._subscriptions&&this._subscriptions.unsubscribe(),this._subscriptions=new D.yU,this._subscriptions.add(M.instance.mouseEnter.subscribe(()=>{this._isOverlayHovered=!0})),this._subscriptions.add(M.instance.mouseLeave.subscribe(()=>{this._isOverlayHovered=!1,this._checkShouldRemoveOverlay()}))}removeOverlayMenu(){this._overlayRef&&(this._subscriptions&&(this._subscriptions.unsubscribe(),this._subscriptions=void 0),this._overlayRef.detach(),this._overlayRef.dispose(),this._overlayRef=void 0)}_checkShouldRemoveOverlay(){setTimeout(()=>{this._isOverlayHovered||this.removeOverlayMenu()},300)}static \u0275fac=function(u){return new(u||m)};static \u0275dir=x.FsC({type:m,selectors:[["","cueEntityMenu",""]],hostBindings:function(u,y){1&u&&x.bIt("mouseenter",function(){return y.onMouseEnter()})("mouseleave",function(){return y.onMouseLeave()})},inputs:{display:[1,"display"],menuItems:[1,"menuItems"],menuEnabled:[1,"menuEnabled"]}})}return m})()},140(te,Y,l){"use strict";l.d(Y,{o:()=>F});class F{type="FeatureCollection";features=[];bbox;id;constructor(x=[]){this.features=x}addFeature(x){this.features.push(x)}removeFeature(x){return this.features.splice(x,1)[0]}getFeatureCount(){return this.features.length}clear(){this.features=[]}}},58(te,Y,l){"use strict";function F(a){let u=0,y=-1,M=-1;for(let w=0;w<a.length;w++)if("("===a[w])u++,1===u&&(y=w+1);else if(")"===a[w]&&(u--,0===u)){M=w;break}return-1!==y&&-1!==M?a.substring(y,M):null}l.d(Y,{S:()=>m,n:()=>p});class f{x;y;z;constructor(u,y,M){this.x=u,this.y=y,this.z=M}}class x{points;constructor(u){this.points=u}}class D{lines;constructor(u){this.lines=u}}function m(a){if(a){if((a=a.trim().toUpperCase()).startsWith("POINT"))return function A(a){a=a.trim().toUpperCase();const y=F(a)?.split(" ")??[];return a.includes("POINT Z")?new f(parseFloat(y[0]),parseFloat(y[1]),parseFloat(y[2])):new f(parseFloat(y[0]),parseFloat(y[1]))}(a);if(a.startsWith("LINESTRING"))return function s(a){const u=F(a=a.trim().toUpperCase()),y=[];return u?.split(",").map(M=>M.trim().split(" ").map(w=>parseFloat(w))).map(M=>{y.push(new f(M[0],M[1],M[2]))}),new x(y)}(a);if(a.startsWith("POLYGON"))return function v(a){const u=F(a=a.trim().toUpperCase());if(!u)return new D([]);const y=u.match(/\(([^)]+)\)/g);if(!y)return new D([]);const M=y.map(w=>{const c=F(w);return c?c.split(",").map(S=>{const N=S.trim().split(" ");return N.length>=3?new f(parseFloat(N[0]),parseFloat(N[1]),parseFloat(N[2])):new f(parseFloat(N[0]),parseFloat(N[1]))}):[]});return new D(M)}(a)}}function p(a){if(a instanceof f)return{type:"Point",coordinates:void 0!==a.z?[a.x,a.y,a.z]:[a.x,a.y]};if(a instanceof x)return{type:"LineString",coordinates:a.points.map(u=>void 0!==u.z?[u.x,u.y,u.z]:[u.x,u.y])};if(a instanceof D)return{type:"Polygon",coordinates:a.lines.map(u=>u.map(y=>void 0!==y.z?[y.x,y.y,y.z]:[y.x,y.y]))};throw new Error("Unknown WKT type")}},362(te){"use strict";te.exports=function Y(l,F){if(l===F)return!0;if(l&&F&&"object"==typeof l&&"object"==typeof F){if(l.constructor!==F.constructor)return!1;var f,x,D;if(Array.isArray(l)){if((f=l.length)!=F.length)return!1;for(x=f;0!==x--;)if(!Y(l[x],F[x]))return!1;return!0}if(l.constructor===RegExp)return l.source===F.source&&l.flags===F.flags;if(l.valueOf!==Object.prototype.valueOf)return l.valueOf()===F.valueOf();if(l.toString!==Object.prototype.toString)return l.toString()===F.toString();if((f=(D=Object.keys(l)).length)!==Object.keys(F).length)return!1;for(x=f;0!==x--;)if(!Object.prototype.hasOwnProperty.call(F,D[x]))return!1;for(x=f;0!==x--;){var s=D[x];if(!Y(l[s],F[s]))return!1}return!0}return l!=l&&F!=F}},5332(te,Y,l){"use strict";l.d(Y,{k:()=>D});for(var f=[],x=0;x<256;++x)f.push((x+256).toString(16).slice(1));function D(v,C=0){return(f[v[C+0]]+f[v[C+1]]+f[v[C+2]]+f[v[C+3]]+"-"+f[v[C+4]]+f[v[C+5]]+"-"+f[v[C+6]]+f[v[C+7]]+"-"+f[v[C+8]]+f[v[C+9]]+"-"+f[v[C+10]]+f[v[C+11]]+f[v[C+12]]+f[v[C+13]]+f[v[C+14]]+f[v[C+15]]).toLowerCase()}},8402(te,Y,l){"use strict";l.d(Y,{A:()=>C});const f={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};var x,D=new Uint8Array(16);function s(){if(!x&&!(x=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return x(D)}var A=l(5332);const C=function v(m,p,a){if(f.randomUUID&&!p&&!m)return f.randomUUID();var u=(m=m||{}).random||(m.rng||s)();if(u[6]=15&u[6]|64,u[8]=63&u[8]|128,p){a=a||0;for(var y=0;y<16;++y)p[a+y]=u[y];return p}return(0,A.k)(u)}},6119(te){te.exports.RADIUS=6378137,te.exports.FLATTENING=1/298.257223563,te.exports.POLAR_RADIUS=6356752.3142}}]);
|