/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{impedanceAttributeNameJsonMap as t}from"../support/networkEnums.js";function e(e,r){if(null==e)return null;const i={},s=new RegExp(`^${r}`,"i");for(const o of Object.keys(e))if(s.test(o)){const s=o.slice(r.length);i[t.fromJSON(s)]=e[o]}return i}function r(e,r,i){if(null!=e){r.attributes||(r.attributes={});for(const s in e){const o=t.toJSON(s);r.attributes[`${i}${o}`]=e[s]}}}function i(e){const r={};for(const i of Object.keys(e)){const s=i;r[t.fromJSON(s)]=e[i]}return r}function s(e){const r={};for(const i of Object.keys(e)){const s=i;r[t.toJSON(s)]=e[i]}return r}function o(t,e){return null==t||null==e?null:Math.round((t-e)/6e4)}function n(t){const e=t.toJSON(),r=e;return r.accumulateAttributeNames&&=e.accumulateAttributeNames?.join(),r.attributeParameterValues&&=JSON.stringify(e.attributeParameterValues),r.barriers&&=JSON.stringify(e.barriers),r.locateSettings&&=JSON.stringify(e.locateSettings),r.outSR&&=e.outSR?.wkid,r.overrides&&=JSON.stringify(e.overrides),r.polygonBarriers&&=JSON.stringify(e.polygonBarriers),r.polylineBarriers&&=JSON.stringify(e.polylineBarriers),r.restrictionAttributeNames&&=e.restrictionAttributeNames?.join(),r.stops&&=JSON.stringify(e.stops),r.travelMode&&=JSON.stringify(e.travelMode),r}function a(t){const e=t.toJSON(),r=e;return r.accumulateAttributeNames&&=e.accumulateAttributeNames?.join(),r.attributeParameterValues&&=JSON.stringify(e.attributeParameterValues),r.barriers&&=JSON.stringify(e.barriers),r.facilities&&=JSON.stringify(e.facilities),r.incidents&&=JSON.stringify(e.incidents),r.outSR&&=e.outSR?.wkid,r.overrides&&=JSON.stringify(e.overrides),r.polygonBarriers&&=JSON.stringify(e.polygonBarriers),r.polylineBarriers&&=JSON.stringify(e.polylineBarriers),r.restrictionAttributeNames&&=e.restrictionAttributeNames?.join(),r.travelMode&&=JSON.stringify(e.travelMode),r}function u(t){const e=t.toJSON(),r=e;return r.accumulateAttributeNames&&=e.accumulateAttributeNames?.join(),r.attributeParameterValues&&=JSON.stringify(e.attributeParameterValues),r.barriers&&=JSON.stringify(e.barriers),r.defaultBreaks&&=e.defaultBreaks?.join(),r.excludeSourcesFromPolygons&&=e.excludeSourcesFromPolygons?.join(),r.facilities&&=JSON.stringify(e.facilities),r.outSR&&=e.outSR?.wkid,r.overrides&&=JSON.stringify(e.overrides),r.polygonBarriers&&=JSON.stringify(e.polygonBarriers),r.polylineBarriers&&=JSON.stringify(e.polylineBarriers),r.restrictionAttributeNames&&=e.restrictionAttributeNames?.join(),r.travelMode&&=JSON.stringify(e.travelMode),r}function l(t){const e=t.toJSON(),r={depots:JSON.stringify(e.depots),orders:JSON.stringify(e.orders),routes:JSON.stringify(e.routes),token:e.token};return e.analysis_region&&(r.analysis_region=e.analysis_region),e.directions_language&&(r.directions_language=e.directions_language),e.distance_units&&(r.distance_units=e.distance_units),e.earliest_route_start_date&&(r.earliest_route_start_date=e.earliest_route_start_date),e.earliest_route_start_time&&(r.earliest_route_start_time=e.earliest_route_start_time),e.ignore_invalid_order_locations&&(r.ignore_invalid_order_locations=e.ignore_invalid_order_locations),e.line_barriers&&(r.line_barriers=JSON.stringify(e.line_barriers)),e.max_route_total_time&&(r.max_route_total_time=e.max_route_total_time),e.order_specialties&&(r.order_specialties=JSON.stringify(e.order_specialties)),e.overrides&&(r.overrides=JSON.stringify(e.overrides)),e.point_barriers&&(r.point_barriers=JSON.stringify(e.point_barriers)),e.polygon_barriers&&(r.polygon_barriers=JSON.stringify(e.polygon_barriers)),e.populate_directions&&(r.populate_directions=e.populate_directions),e.route_shape&&(r.route_shape=e.route_shape),e.route_specialties&&(r.route_specialties=JSON.stringify(e.route_specialties)),e.save_output_network_analysis_layer&&(r.save_output_network_analysis_layer=e.save_output_network_analysis_layer),e.save_route_data&&(r.save_route_data=e.save_route_data),e.sequence_gap&&(r.sequence_gap=e.sequence_gap),e.time_units&&(r.time_units=e.time_units),e.time_zone_usage_for_time_fields&&(r.time_zone_usage_for_time_fields=e.time_zone_usage_for_time_fields),e.travel_mode&&(r.travel_mode=JSON.stringify(e.travel_mode)),e.zones&&(r.zones=JSON.stringify(e.zones)),r}export{a as closestFacilityParametersToQueryParameters,s as fromKebabImpedanceAttributes,e as getPrefixedProperties,o as getTimezoneOffset,l as lastMileDeliveryParametersToQueryParameters,n as routeParametersToQueryParameters,u as serviceAreaParametersToQueryParameters,r as setPrefixedProperties,i as toKebabImpedanceAttributes};
