@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 23.8 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import{isSome as i}from"../core/arrayUtils.js";import s from"../core/Collection.js";import n from"../core/Error.js";import a from"../core/Logger.js";import{MultiOriginJSONSupportMixin as l}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as u}from"../core/object.js";import{isAbortError as p}from"../core/promiseUtils.js";import{on as c}from"../core/reactiveUtils.js";import{convertUnit as m}from"../core/units.js";import{urlToObject as y}from"../core/urlUtils.js";import{property as f,subclass as d}from"../core/accessorSupport/decorators.js";import{updateOrigins as h}from"../core/accessorSupport/originUtils.js";import g from"../geometry/Extent.js";import w from"../geometry/Multipoint.js";import{initializeProjection as S,project as b}from"../geometry/projectionUtils.js";import v from"../geometry/SpatialReference.js";import{wgs84 as B}from"../geometry/support/spatialReferenceUtils.js";import P from"./Layer.js";import{BlendLayer as I}from"./mixins/BlendLayer.js";import{OperationalLayer as N}from"./mixins/OperationalLayer.js";import{PortalLayer as j}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as D}from"./mixins/ScaleRangeLayer.js";import{sanitizeUrl as C}from"./support/arcgisLayerUrl.js";import _ from"./support/RouteSymbols.js";import L from"../portal/Portal.js";import O from"../portal/PortalItem.js";import{typeKeyword as R}from"../portal/support/portalItemUtils.js";import{read as T}from"../renderers/support/jsonUtils.js";import{fetchServiceDescription as A}from"../rest/networkService.js";import{solve as F}from"../rest/route.js";import k from"../rest/support/DirectionLine.js";import x from"../rest/support/DirectionPoint.js";import G from"../rest/support/PointBarrier.js";import J from"../rest/support/PolygonBarrier.js";import M from"../rest/support/PolylineBarrier.js";import E from"../rest/support/RouteInfo.js";import U from"../rest/support/RouteParameters.js";import W from"../rest/support/RouteSettings.js";import q from"../rest/support/Stop.js";import{writer as V}from"../core/accessorSupport/decorators/writer.js";import{reader as z}from"../core/accessorSupport/decorators/reader.js";function Y(e){if(!e.length)return;const t=e.toArray(),r=t.map(({objectId:e})=>e).filter(e=>null!=e);let o=Math.max(...r,0);for(const i of t)i.objectId??=++o}function Z(e,t){return e.length===t.length&&K(e)&&K(t)}function K(e){return e.every(({objectId:e})=>null!=e)}function X(e,t){return!!e.length||!!t.length}function H(e){return e.length?e:null}function Q(e){switch(e){case"esriGeometryPoint":return{type:"esriSMS",style:"esriSMSCircle",size:12,color:[0,0,0,0],outline:Q("esriGeometryPolyline")};case"esriGeometryPolyline":return{type:"esriSLS",style:"esriSLSSolid",width:1,color:[0,0,0,0]};case"esriGeometryPolygon":return{type:"esriSFS",style:"esriSFSNull",outline:Q("esriGeometryPolyline")}}}function $(e){return"layers"in e}function ee(e){return"esri.rest.support.FeatureSet"===e.declaredClass}function te(e){return"esri.rest.support.NetworkFeatureSet"===e.declaredClass}function re(e,t){for(const r of e){const e=t.find(e=>e.objectId===r.objectId);e&&(e.addedCost=r.addedCost,e.barrierType=r.barrierType,e.costs=r.costs,e.curbApproach=r.curbApproach,e.fullEdge=r.fullEdge,e.geometry=r.geometry,e.name=r.name,e.sideOfEdge=r.sideOfEdge,e.sourceId=r.sourceId,e.sourceOid=r.sourceOid,e.status=r.status,e.symbol=r.symbol)}}function oe(e,t){for(const r of e){const e=t.find(e=>e.objectId===r.objectId);e&&(e.barrierType=r.barrierType,e.costs=r.costs,e.geometry=r.geometry,e.name=r.name,e.scaleFactor=r.scaleFactor,e.symbol=r.symbol)}}function ie(e,t){for(const r of e){const e=t.find(e=>e.objectId===r.objectId);e&&(e.barrierType=r.barrierType,e.costs=r.costs,e.geometry=r.geometry,e.name=r.name,e.scaleFactor=r.scaleFactor,e.symbol=r.symbol)}}function se(e,t){for(const r of e){const e=t.find(e=>e.objectId===r.objectId);e&&(e.arriveCurbApproach=r.arriveCurbApproach,e.arriveTime=r.arriveTime,e.arriveTimeOffset=r.arriveTimeOffset,e.cumulativeCosts=r.cumulativeCosts,e.cumulativeDistance=r.cumulativeDistance,e.cumulativeDuration=r.cumulativeDuration,e.curbApproach=r.curbApproach,e.departCurbApproach=r.departCurbApproach,e.departTime=r.departTime,e.departTimeOffset=r.departTimeOffset,e.distanceToNetworkInMeters=r.distanceToNetworkInMeters,e.geometry=r.geometry,e.lateDuration=r.lateDuration,e.name=r.name,e.navLatency=r.navLatency,e.positionAlong=r.positionAlong,e.routeName=r.routeName,e.serviceCosts=r.serviceCosts,e.serviceDistance=r.serviceDistance,e.serviceDuration=r.serviceDuration,e.sequence=r.sequence,e.sideOfEdge=r.sideOfEdge,e.snapX=r.snapX,e.snapY=r.snapY,e.snapZ=r.snapZ,e.sourceId=r.sourceId,e.sourceOid=r.sourceOid,e.status=r.status,e.symbol=r.symbol,e.timeWindowEnd=r.timeWindowEnd,e.timeWindowStart=r.timeWindowStart,e.violations=r.violations,e.waitDuration=r.waitDuration,e.wait=r.wait)}}async function ne(e){const t=v.WGS84;return await S(e.spatialReference,t),b(e,t)}function ae(e,t){if(t&&e?.length&&!e.every(({symbol:e})=>!!e))for(const r of e)r.symbol=t}function le(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function ue(e,t){return"decimal-degrees"===t||"points"===t||"unknown"===t?e:m(e,t,"meters")}function pe(e){const{attributes:t,geometry:r,popupTemplate:o,symbol:i}=e.toGraphic().toJSON();return{attributes:t,geometry:r,popupInfo:o,symbol:i}}const ce=s.ofType(k),me=s.ofType(x),ye=s.ofType(G),fe=s.ofType(J),de=s.ofType(M),he=s.ofType(q);let ge=class extends(I(D(N(j(l(P)))))){constructor(e){super(e),this._cachedServiceDescription=null,this._featureCollection=null,this._type="Feature Collection",this.checksum=null,this.defaultSymbols=new _,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new ye,this.polygonBarriers=new fe,this.polylineBarriers=new de,this.routeInfo=null,this.spatialReference=v.WGS84,this.stops=new he,this.type="route"}initialize(){const e=()=>{this._setStopSymbol(this.stops)},t=()=>{ae(this.pointBarriers,this.defaultSymbols.pointBarriers)},r=()=>{ae(this.polylineBarriers,this.defaultSymbols.polylineBarriers)},o=()=>{ae(this.polygonBarriers,this.defaultSymbols.polygonBarriers)};this.addHandles([c(()=>this.stops,"change",e,{sync:!0,onListenerAdd:e}),c(()=>this.pointBarriers,"change",t,{sync:!0,onListenerAdd:t}),c(()=>this.polylineBarriers,"change",r,{sync:!0,onListenerAdd:r}),c(()=>this.polygonBarriers,"change",o,{sync:!0,onListenerAdd:o})])}writeFeatureCollectionWebmap(e,t,r,o){const i=[this._writePolygonBarriers(),this._writePolylineBarriers(),this._writePointBarriers(),this._writeRouteInfo(),this._writeDirectionLines(),this._writeDirectionPoints(),this._writeStops()].filter(e=>!!e),s=i.map((e,t)=>t),n="web-map"===o.origin?"featureCollection.layers":"layers";u(n,i,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=s}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",e=>k.fromGraphic(e))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",e=>x.fromGraphic(e))}get fullExtent(){const e=new g({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:v.WGS84});if(null!=this.routeInfo?.geometry)return this.routeInfo.geometry.extent??e;if(null==this.stops)return e;const t=this.stops.filter(e=>null!=e.geometry);if(t.length<2)return e;const{spatialReference:r}=t.at(0).geometry;if(null==r)return e;const o=t.toArray().map(e=>{const t=e.geometry;return[t.x,t.y]});return new w({points:o,spatialReference:r}).extent}readMaxScale(e,t){const r=$(t)?t.layers:t.featureCollection?.layers,o=r?.find(e=>null!=e.layerDefinition.maxScale);return o?.layerDefinition.maxScale??0}readMinScale(e,t){const r=$(t)?t.layers:t.featureCollection?.layers,o=r?.find(e=>null!=e.layerDefinition.minScale);return o?.layerDefinition.minScale??0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",e=>G.fromGraphic(e))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",e=>J.fromGraphic(e))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",e=>M.fromGraphic(e))}readRouteInfo(e,t){return this._getNetworkFeatures(t,"RouteInfo",e=>E.fromGraphic(e)).at(0)??null}readSpatialReference(e,t){const r=$(t)?t.layers:t.featureCollection?.layers;if(!r?.length)return v.WGS84;const{layerDefinition:o,featureSet:i}=r[0],s=i.features[0],n=s?.geometry?.spatialReference??i.spatialReference??o.spatialReference??o.extent.spatialReference??B;return v.fromJSON(n)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",e=>q.fromGraphic(e),e=>this._setStopSymbol(e))}get title(){return this.routeInfo?.name??"Route"}set title(e){this._overrideIfSome("title",e)}get url(){return t.routeServiceUrl}set url(e){null!=e?this._set("url",C(e,a.getLogger(this))):this._set("url",t.routeServiceUrl)}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}removeAll(){this.removeResult(),this.pointBarriers.removeAll(),this.polygonBarriers.removeAll(),this.polylineBarriers.removeAll(),this.stops.removeAll()}removeResult(){null!=this.directionLines&&(this.directionLines.removeAll(),this._set("directionLines",null)),null!=this.directionPoints&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),null!=this.routeInfo&&this._set("routeInfo",null)}async save(){await this.load();const{fullExtent:e,portalItem:t}=this;if(!t)throw new n("routelayer:portal-item-not-set","save() requires to the layer to have a portal item");if(!t.id)throw new n("routelayer:portal-item-not-saved","Please use saveAs() first to save the routelayer");if("Feature Collection"!==t.type)throw new n("routelayer:portal-item-wrong-type",'Portal item needs to have type "Feature Collection"');if(!this.routeInfo)throw new n("routelayer:route-unsolved","save() requires a solved route");const{portal:r}=t;await r.signIn(),r.user||await t.reload();const{itemUrl:o,itemControl:i}=t;if("admin"!==i&&"update"!==i)throw new n("routelayer:insufficient-permissions","To save this layer, you need to be the owner or an administrator of your organization");const s={messages:[],origin:"portal-item",portal:r,url:o?y(o):void 0,writtenProperties:[]},a=this.write(void 0,s);return t.extent=await ne(e),t.title=this.title,await t.update({data:a}),t}async saveAs(e,t={}){if(await this.load(),null==this.routeInfo)throw new n("routelayer:route-unsolved","saveAs() requires a solved route");const r=O.from(e).clone();r.extent??=await ne(this.fullExtent),r.id=null,r.portal??=L.getDefault(),r.title??=this.title,r.type="Feature Collection",r.typeKeywords=["Data","Feature Collection",R.MULTI_LAYER,"Route Layer"];const{portal:o}=r,i={messages:[],origin:"portal-item",portal:o,url:null,writtenProperties:[]};await o.signIn();const s=t?.folder,a=this.write(void 0,i);return await o.user.addItem({item:r,folder:s,data:a}),this.portalItem=r,h(i),i.portalItem=r,r}async solve(e,t){Y(this.stops),Y(this.pointBarriers),Y(this.polylineBarriers),Y(this.polygonBarriers);const r=e?.stops??this.stops,o=e?.pointBarriers??H(this.pointBarriers),i=e?.polylineBarriers??H(this.polylineBarriers),a=e?.polygonBarriers??H(this.polygonBarriers);if(null==r)throw new n("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if((ee(r)||te(r))&&r.features.length<2||s.isCollection(r)&&r.length<2)throw new n("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");if(s.isCollection(r))for(const s of r)s.routeName=null;const l=e?.apiKey,{checksum:u,url:c}=this,m=await this._getServiceDescription(c,l,t),y=e?.travelMode??m.defaultTravelMode,f=e?.accumulateAttributes??[];y&&(f.push(y.distanceAttributeName),y.timeAttributeName&&f.push(y.timeAttributeName));const d={accumulateAttributes:f,checksum:u,directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:o,polylineBarriers:i,polygonBarriers:a,preserveObjectID:!0,returnBarriers:!!o,returnDirections:!0,returnPolygonBarriers:!!a,returnPolylineBarriers:!!i,returnRoutes:!0,returnStops:!0,stops:r},h=U.from(e??{});let g;h.set(d);try{g=await F(c,h,t)}catch(S){throw p(S)?S:new n("routelayer:failed-route-request","the routing request failed",{error:S})}const w=this._toRouteLayerSolution(g);return this._isOverridden("title")||(this.title=w.routeInfo.name??"Route"),this._populatePortalFields(w,m,h),w}update(e){const{checksum:t,directionLines:r,directionPoints:o,pointBarriers:i,polygonBarriers:s,polylineBarriers:n,routeInfo:a,stops:l}=e;Z(l,this.stops)?se(l,this.stops):this.set({stops:l}),X(i,this.pointBarriers)&&(Z(i,this.pointBarriers)?re(i,this.pointBarriers):this.set({pointBarriers:i})),X(n,this.polylineBarriers)&&(Z(n,this.polylineBarriers)?oe(n,this.polylineBarriers):this.set({polylineBarriers:n})),X(s,this.polygonBarriers)&&(Z(s,this.polygonBarriers)?ie(s,this.polygonBarriers):this.set({polygonBarriers:s})),this.set({checksum:t}),this._set("directionLines",r),this._set("directionPoints",o),this._set("routeInfo",a),a.geometry&&(this.spatialReference=a.geometry.spatialReference)}_getNetworkFeatures(e,t,i,n){const a=$(e)?e.layers:e.featureCollection?.layers,l=a?.find(e=>e.layerDefinition.name===t);if(null==l)return new s;const{layerDefinition:u,popupInfo:p,featureSet:c}=l,m=u.drawingInfo.renderer,{features:y}=c,f=c.spatialReference??u.spatialReference??u.extent.spatialReference??B,d=m&&T(m),h=v.fromJSON(f),g=y.map(e=>{const s=r.fromJSON(e);s.geometry&&e.geometry&&null==e.geometry.spatialReference&&(s.geometry.spatialReference=h);const n=i(s);return n.symbol??=d?.getSymbol(s)??this._getNetworkSymbol(t),n.popupTemplate??=p&&o.fromJSON(p),n});return n&&g.some(({symbol:e})=>!e)&&n(g),new s(g)}_getNetworkSymbol(e){switch(e){case"Barriers":return this.defaultSymbols.pointBarriers;case"DirectionPoints":return this.defaultSymbols.directionPoints;case"DirectionLines":return this.defaultSymbols.directionLines;case"PolylineBarriers":return this.defaultSymbols.polylineBarriers;case"PolygonBarriers":return this.defaultSymbols.polygonBarriers;case"RouteInfo":return this.defaultSymbols.routeInfo;case"Stops":return null}}async _getServiceDescription(e,t,r){if(null!=this._cachedServiceDescription&&this._cachedServiceDescription.url===e)return this._cachedServiceDescription.serviceDescription;const o=await A(e,t,r);return this._cachedServiceDescription={serviceDescription:o,url:e},o}_setStopSymbol(e){const t=s.isCollection(e)?e.toArray():e;if(!t||!t.length||!this.defaultSymbols.stops||t.every(({symbol:e})=>!!e))return;const{first:r,last:o,middle:n,unlocated:a,waypoint:l,break:u}=this.defaultSymbols.stops,p=t.map(({sequence:e})=>e).filter(i),c=t.length===p.length;if(!this.routeInfo&&!c||1===t.length)return void t.forEach((e,i)=>{switch(i){case 0:e.symbol=r;break;case t.length-1:e.symbol=o;break;default:e.symbol=n}});const m=Math.min(...p),y=Math.max(...p);for(const i of t)i.sequence!==m?i.sequence!==y?this.routeInfo&&"ok"!==i.status&&"not-located-on-closest"!==i.status?i.symbol=a:"waypoint"!==i.locationType?"break"!==i.locationType?i.symbol=n:i.symbol=u:i.symbol=l:i.symbol=o:i.symbol=r}_toRouteLayerSolution(e){const{checksum:t,routeResults:r}=e,o=r[0].stops?.map(e=>q.fromJSON(e.toJSON()));this._setStopSymbol(o);const i=new he(o),s=new fe(e.polygonBarriers?.map(e=>J.fromJSON(e.toJSON())));ae(s,this.defaultSymbols.polygonBarriers);const n=new de(e.polylineBarriers?.map(e=>M.fromJSON(e.toJSON())));ae(n,this.defaultSymbols.polylineBarriers);const a=new ye(e.pointBarriers?.map(e=>G.fromJSON(e.toJSON())));ae(a,this.defaultSymbols.pointBarriers);const l=r[0].route?.toJSON(),u=E.fromJSON(l);u.symbol=this.defaultSymbols.routeInfo;const p=new me(r[0].directionPoints?.features.map(e=>x.fromJSON(e.toJSON())));ae(p,this.defaultSymbols.directionPoints);const c=new ce(r[0].directionLines?.features.map(e=>k.fromJSON(e.toJSON())));return ae(c,this.defaultSymbols.directionLines),{checksum:t,directionLines:c,directionPoints:p,pointBarriers:a,polygonBarriers:s,polylineBarriers:n,routeInfo:u,stops:i}}_writeDirectionLines(){return this._writeNetworkFeatures(this.directionLines,this.defaultSymbols.directionLines,"esriGeometryPolyline",k.fields,"DirectionLines","Direction Lines")}_writeDirectionPoints(){return this._writeNetworkFeatures(this.directionPoints,this.defaultSymbols.directionPoints,"esriGeometryPoint",x.fields,"DirectionPoints","Direction Points")}_writeNetworkFeatures(e,t,r,o,i,s){if(!e?.length)return null;const n=this.spatialReference.toJSON(),{fullExtent:a,maxScale:l,minScale:u}=this;return{featureSet:{features:e.toArray().map(e=>pe(e)),geometryType:r,spatialReference:n},layerDefinition:{capabilities:"Query,Update,Editing",drawingInfo:{renderer:{type:"simple",symbol:t?.toJSON()??Q(r)}},extent:a.toJSON(),fields:o,geometryType:r,hasM:!1,hasZ:!1,maxScale:l,minScale:u,name:i,objectIdField:"ObjectID",spatialReference:n,title:s,type:"Feature Layer",typeIdField:""}}}_writePointBarriers(){return this._writeNetworkFeatures(this.pointBarriers,this.defaultSymbols.pointBarriers,"esriGeometryPoint",G.fields,"Barriers","Point Barriers")}_writePolygonBarriers(){return this._writeNetworkFeatures(this.polygonBarriers,this.defaultSymbols.polygonBarriers,"esriGeometryPolygon",J.fields,"PolygonBarriers","Polygon Barriers")}_writePolylineBarriers(){return this._writeNetworkFeatures(this.polylineBarriers,this.defaultSymbols.polylineBarriers,"esriGeometryPolyline",M.fields,"PolylineBarriers","Line Barriers")}_writeRouteInfo(){return this._writeNetworkFeatures(null!=this.routeInfo?new s([this.routeInfo]):null,this.defaultSymbols.routeInfo,"esriGeometryPolyline",E.fields,"RouteInfo","Route Details")}_writeStops(){const e=this._writeNetworkFeatures(this.stops,null,"esriGeometryPoint",q.fields,"Stops","Stops");if(null==e)return null;const{stops:t}=this.defaultSymbols,r=t?.first?.toJSON(),o=t?.middle?.toJSON(),i=t?.last?.toJSON();return e.layerDefinition.drawingInfo.renderer={type:"uniqueValue",field1:"Sequence",defaultSymbol:o,uniqueValueInfos:[{value:"1",symbol:r,label:"First Stop"},{value:`${this.stops.length}`,symbol:i,label:"Last Stop"}]},e}_populatePortalFields(e,t,r){const o=t.networkDataset?.networkAttributes,i=o?.filter(({usageType:e})=>"cost"===e)??[],s=r.travelMode??t.defaultTravelMode;if(null==s)return void a.getLogger(this).warn("route-layer:missing-travel-mode","The routing service must have a default travel mode or one must be specified in the route parameter.");const{timeAttributeName:l,distanceAttributeName:u}=s,p=i.find(({name:e})=>e===l),c=i.find(({name:e})=>e===u),m=r.travelMode?.impedanceAttributeName??r.impedanceAttribute??t.impedance,y=p?.units,f=c?.units;if(!y||!f)throw new n("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const d=r.directionsLanguage??t.directionsLanguage,h=r.accumulateAttributes??t.accumulateAttributeNames??[],g=new Set(i.filter(({name:e})=>e===l||e===u||e===m||null!=e&&h.includes(e)).map(({name:e})=>e)),w=e=>{for(const t in e)g.has(t)||delete e[t]};for(const n of e.pointBarriers)null!=n.costs&&(n.addedCost=n.costs[m]??0,w(n.costs));for(const n of e.polygonBarriers)null!=n.costs&&(n.scaleFactor=n.costs[m]??1,w(n.costs));for(const n of e.polylineBarriers)null!=n.costs&&(n.scaleFactor=n.costs[m]??1,w(n.costs));const{routeInfo:S}=e,{findBestSequence:b,preserveFirstStop:v,preserveLastStop:B,startTimeIsUTC:P,timeWindowsAreUTC:I}=r;S.analysisSettings=new W({accumulateAttributes:h,directionsLanguage:d,findBestSequence:b,preserveFirstStop:v,preserveLastStop:B,startTimeIsUTC:P,timeWindowsAreUTC:I,travelMode:s}),S.totalDuration=le(S.totalCosts?.[l]??0,y),S.totalDistance=ue(S.totalCosts?.[u]??0,f),S.totalLateDuration=le(S.totalViolations?.[l]??0,y),S.totalWaitDuration=le(S.totalWait?.[l]??0,y),null!=S.totalCosts&&w(S.totalCosts),null!=S.totalViolations&&w(S.totalViolations),null!=S.totalWait&&w(S.totalWait);for(const n of e.stops)null!=n.serviceCosts&&(n.serviceDuration=le(n.serviceCosts[l]??0,y),n.serviceDistance=ue(n.serviceCosts[u]??0,f),w(n.serviceCosts)),null!=n.cumulativeCosts&&(n.cumulativeDuration=le(n.cumulativeCosts[l]??0,y),n.cumulativeDistance=ue(n.cumulativeCosts[u]??0,f),w(n.cumulativeCosts)),null!=n.violations&&(n.lateDuration=le(n.violations[l]??0,y),w(n.violations)),null!=n.wait&&(n.waitDuration=le(n.wait[l]??0,y),w(n.wait))}};e([f({readOnly:!0,json:{read:!1,origins:{"portal-item":{write:{allowNull:!0,ignoreOrigin:!0}},"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:null==this.portalItem}}}}}}})],ge.prototype,"_featureCollection",void 0),e([V(["web-map","portal-item"],"_featureCollection")],ge.prototype,"writeFeatureCollectionWebmap",null),e([f({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:null!=this.portalItem}}}}}}})],ge.prototype,"_type",void 0),e([f({type:String})],ge.prototype,"checksum",void 0),e([f({nonNullable:!0,type:_})],ge.prototype,"defaultSymbols",void 0),e([f({readOnly:!0})],ge.prototype,"directionLines",void 0),e([z(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],ge.prototype,"readDirectionLines",null),e([f({readOnly:!0})],ge.prototype,"directionPoints",void 0),e([z(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],ge.prototype,"readDirectionPoints",null),e([f({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],ge.prototype,"featureCollectionType",void 0),e([f({readOnly:!0})],ge.prototype,"fullExtent",null),e([f({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],ge.prototype,"legendEnabled",void 0),e([f({type:["show","hide"]})],ge.prototype,"listMode",void 0),e([f({type:Number,nonNullable:!0,json:{write:!1}})],ge.prototype,"maxScale",void 0),e([z(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],ge.prototype,"readMaxScale",null),e([f({type:Number,nonNullable:!0,json:{write:!1}})],ge.prototype,"minScale",void 0),e([z(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],ge.prototype,"readMinScale",null),e([f({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],ge.prototype,"operationalLayerType",void 0),e([f({nonNullable:!0,type:s.ofType(G)})],ge.prototype,"pointBarriers",void 0),e([z(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],ge.prototype,"readPointBarriers",null),e([f({nonNullable:!0,type:s.ofType(J)})],ge.prototype,"polygonBarriers",void 0),e([z(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],ge.prototype,"readPolygonBarriers",null),e([f({nonNullable:!0,type:s.ofType(M)})],ge.prototype,"polylineBarriers",void 0),e([z(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],ge.prototype,"readPolylineBarriers",null),e([f({readOnly:!0})],ge.prototype,"routeInfo",void 0),e([z(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],ge.prototype,"readRouteInfo",null),e([f({type:v})],ge.prototype,"spatialReference",void 0),e([z(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],ge.prototype,"readSpatialReference",null),e([f({nonNullable:!0,type:s.ofType(q)})],ge.prototype,"stops",void 0),e([z(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],ge.prototype,"readStops",null),e([f()],ge.prototype,"title",null),e([f({readOnly:!0,json:{read:!1}})],ge.prototype,"type",void 0),e([f()],ge.prototype,"url",null),ge=e([d("esri.layers.RouteLayer")],ge);const we=ge;export{we as default};