import{i as e}from"./chunk-aKtaBQYM.js";import{Ft as t,G as n,Nt as r}from"./mui-BgU4WrXF.js";import{N as i,P as a,T as o}from"./index-bel1r0Sr.js";import{n as s}from"./MapView-Bhqzv-Oc.js";var c=e(t(),1),l=()=>{let e=(0,c.useId)(),t=n(),l=o(`mapGeofences`,!0),u=r(e=>e.geofences.items);return(0,c.useEffect)(()=>l?(s.addSource(e,{type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),s.addLayer({source:e,id:`geofences-fill`,type:`fill`,filter:[`all`,[`==`,`$type`,`Polygon`]],paint:{"fill-color":[`get`,`color`],"fill-outline-color":[`get`,`color`],"fill-opacity":.1}}),s.addLayer({source:e,id:`geofences-line`,type:`line`,paint:{"line-color":[`get`,`color`],"line-width":[`get`,`width`],"line-opacity":[`get`,`opacity`]}}),s.addLayer({source:e,id:`geofences-title`,type:`symbol`,layout:{"text-field":`{name}`,"text-font":i(s),"text-size":12},paint:{"text-halo-color":`white`,"text-halo-width":1}}),()=>{s.getLayer(`geofences-fill`)&&s.removeLayer(`geofences-fill`),s.getLayer(`geofences-line`)&&s.removeLayer(`geofences-line`),s.getLayer(`geofences-title`)&&s.removeLayer(`geofences-title`),s.getSource(e)&&s.removeSource(e)}):()=>{},[l,e]),(0,c.useEffect)(()=>{l&&s.getSource(e)?.setData({type:`FeatureCollection`,features:Object.values(u).filter(e=>!e.attributes.hide).map(e=>a(t,e))})},[l,u,e,t]),null};export{l as t};