import{i as e}from"./chunk-aKtaBQYM.js";import{Rt as t,Vt as n,s as r,wt as i}from"./mui-B6lh3XSP.js";import{t as a}from"./EditAttributesAccordion-BaG0aySx.js";import{i as o,n as s,r as c,t as l}from"./ExpandMore-BvigPYWL.js";import{t as u}from"./TextField-DOdnjCrL.js";import{t as d}from"./Typography-DfQXhGTT.js";import{Qt as f,Wt as p,yt as m}from"./index-KVuxnkWj.js";import{t as h}from"./SelectField-9K8NpSQG.js";import{n as g,t as _}from"./useSettingsStyles-X3caKosH.js";import{t as v}from"./EditItemView-BNkSnNuu.js";var y=e(n(),1),b=e=>(0,y.useMemo)(()=>({color:{name:e(`attributeColor`),type:`string`},mapLineWidth:{name:e(`attributeMapLineWidth`),type:`number`},mapLineOpacity:{name:e(`attributeMapLineOpacity`),type:`number`},speedLimit:{name:e(`attributeSpeedLimit`),type:`number`,dataType:`speed`},polylineDistance:{name:e(`attributePolylineDistance`),type:`number`,dataType:`distance`},hide:{name:e(`sharedFilterMap`),type:`boolean`},floor:{name:e(`attributeGeofenceFloor`),type:`number`},ceiling:{name:e(`attributeGeofenceCeiling`),type:`number`}}),[e]),x=i(),S=()=>{let{classes:e}=_(),n=t(),i=m(),S=b(i),[C,w]=(0,y.useState)();return(0,x.jsx)(v,{endpoint:`geofences`,item:C,setItem:w,validate:()=>C&&C.name,onItemSaved:e=>{n(r.update([e]))},menu:(0,x.jsx)(g,{}),breadcrumbs:[`settingsTitle`,`sharedGeofence`],children:C&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(o,{defaultExpanded:!0,children:[(0,x.jsx)(s,{expandIcon:(0,x.jsx)(l,{}),children:(0,x.jsx)(d,{variant:`subtitle1`,children:i(`sharedRequired`)})}),(0,x.jsx)(c,{className:e.details,children:(0,x.jsx)(u,{value:C.name||``,onChange:e=>w({...C,name:e.target.value}),label:i(`sharedName`)})})]}),(0,x.jsxs)(o,{children:[(0,x.jsx)(s,{expandIcon:(0,x.jsx)(l,{}),children:(0,x.jsx)(d,{variant:`subtitle1`,children:i(`sharedExtra`)})}),(0,x.jsxs)(c,{className:e.details,children:[(0,x.jsx)(u,{value:C.description||``,onChange:e=>w({...C,description:e.target.value}),label:i(`sharedDescription`)}),(0,x.jsx)(h,{value:C.calendarId,onChange:e=>w({...C,calendarId:Number(e.target.value)}),endpoint:`/api/calendars`,label:i(`sharedCalendar`)}),(0,x.jsx)(p,{control:(0,x.jsx)(f,{checked:C.attributes.hide,onChange:e=>w({...C,attributes:{...C.attributes,hide:e.target.checked}})}),label:i(`sharedFilterMap`)})]})]}),(0,x.jsx)(a,{attributes:C.attributes,setAttributes:e=>w({...C,attributes:e}),definitions:S})]})})};export{S as default};