@arcgis/core 4.23.2 → 4.23.5

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.
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import"../geometry.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import"../renderers/ClassBreaksRenderer.js";import"../renderers/DictionaryRenderer.js";import"../renderers/DotDensityRenderer.js";import"../renderers/HeatmapRenderer.js";import"../renderers/Renderer.js";import"../renderers/SimpleRenderer.js";import"../renderers/UniqueValueRenderer.js";import{read as i}from"../renderers/support/jsonUtils.js";import s from"../core/Collection.js";import n from"../core/Error.js";import{HandleOwnerMixin as l}from"../core/HandleOwner.js";import a from"../core/Logger.js";import{isSome as p,isNone as u,unwrapOrValue as m}from"../core/maybe.js";import{MultiOriginJSONMixin as y}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as f}from"../core/object.js";import{convertUnit as c}from"../core/unitUtils.js";import{urlToObject as d}from"../core/urlUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{reader as S}from"../core/accessorSupport/decorators/reader.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import{writer as w}from"../core/accessorSupport/decorators/writer.js";import{updateOrigins as v}from"../core/accessorSupport/originUtils.js";import b from"../geometry/Extent.js";import{initializeProjection as P,project as B}from"../geometry/projection.js";import{WGS84 as I}from"../geometry/support/spatialReferenceUtils.js";import N from"./Layer.js";import{BlendLayer as j}from"./mixins/BlendLayer.js";import{OperationalLayer as O}from"./mixins/OperationalLayer.js";import{PortalLayer as D}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as L}from"./mixins/ScaleRangeLayer.js";import{sanitizeUrl as _}from"./support/arcgisLayerUrl.js";import C from"./support/DefaultSymbols.js";import T from"../portal/Portal.js";import R from"../portal/PortalItem.js";import{fetchServiceDescription as J}from"../rest/networkService.js";import{solve as A}from"../rest/route.js";import x from"../rest/support/DirectionLine.js";import F from"../rest/support/DirectionPoint.js";import{directionsTimeUnitJsonMap as k,directionsLengthUnitJsonMap as G}from"../rest/support/networkEnums.js";import M from"../rest/support/PointBarrier.js";import U from"../rest/support/PolygonBarrier.js";import q from"../rest/support/PolylineBarrier.js";import E from"../rest/support/RouteInfo.js";import W from"../rest/support/RouteParameters.js";import V from"../rest/support/RouteSettings.js";import H from"../rest/support/Stop.js";import K from"../geometry/SpatialReference.js";import Q from"../geometry/Multipoint.js";function Y(e){return e.length?e:null}function Z(e){return"layers"in e}function $(e){return"esri.rest.support.FeatureSet"===e.declaredClass}function z(e){return"esri.rest.support.NetworkFeatureSet"===e.declaredClass}function X(e,t,r){var o,i,s,l,a,u,m,y,f,c,d;const h=t.networkDataset.networkAttributes.filter((e=>"esriNAUTCost"===e.usageType)),S=t.supportedTravelModes.find((e=>e.id===t.defaultTravelMode)),g=null!=(o=r.travelMode)?o:S,{timeAttributeName:w,distanceAttributeName:v}=g,b=h.find((e=>e.name===w)),P=h.find((e=>e.name===v)),B=null!=(i=null!=(s=null==(l=r.travelMode)?void 0:l.impedanceAttributeName)?s:r.impedanceAttribute)?i:t.impedance,I=k.fromJSON(null==b?void 0:b.units),N=G.fromJSON(null==P?void 0:P.units);if(!I||!N)throw new n("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const j=null!=(a=r.directionsLanguage)?a:t.directionsLanguage,O=null!=(u=null!=(m=r.accumulateAttributes)?m:t.accumulateAttributeNames)?u:[],D=new Set(h.filter((({name:e})=>e===w||e===v||e===B||O.includes(e))).map((({name:e})=>e))),L=e=>{for(const t in e)D.has(t)||delete e[t]};for(const n of e.pointBarriers){var _;if(p(n.costs))n.addedCost=null!=(_=n.costs[B])?_:0,L(n.costs)}for(const n of e.polygonBarriers){var C;if(p(n.costs))n.scaleFactor=null!=(C=n.costs[B])?C:1,L(n.costs)}for(const n of e.polylineBarriers){var T;if(p(n.costs))n.scaleFactor=null!=(T=n.costs[B])?T:1,L(n.costs)}const{routeInfo:R}=e,{findBestSequence:J,preserveFirstStop:A,preserveLastStop:x,startTimeIsUTC:F,timeWindowsAreUTC:M}=r;R.analysisSettings=new V({accumulateAttributes:O,directionsLanguage:j,findBestSequence:J,preserveFirstStop:A,preserveLastStop:x,startTimeIsUTC:F,timeWindowsAreUTC:M,travelMode:g}),R.totalDuration=te(null!=(y=R.totalCosts[w])?y:0,I),R.totalDistance=re(null!=(f=R.totalCosts[v])?f:0,N),R.totalLateDuration=te(null!=(c=R.totalViolations[w])?c:0,I),R.totalWaitDuration=te(null!=(d=R.totalWait[w])?d:0,I),p(R.totalCosts)&&L(R.totalCosts),p(R.totalViolations)&&L(R.totalViolations),p(R.totalWait)&&L(R.totalWait);for(const n of e.stops){var U,q,E,W,H,K;if(p(n.serviceCosts))n.serviceDuration=te(null!=(U=n.serviceCosts[w])?U:0,I),n.serviceDistance=re(null!=(q=n.serviceCosts[v])?q:0,N),L(n.serviceCosts);if(p(n.cumulativeCosts))n.cumulativeDuration=te(null!=(E=n.cumulativeCosts[w])?E:0,I),n.cumulativeDistance=re(null!=(W=n.cumulativeCosts[v])?W:0,N),L(n.cumulativeCosts);if(p(n.violations))n.lateDuration=te(null!=(H=n.violations[w])?H:0,I),L(n.violations);if(p(n.wait))n.waitDuration=te(null!=(K=n.wait[w])?K:0,I),L(n.wait)}}async function ee(e){const t=K.WGS84;return await P(e.spatialReference,t),B(e,t)}function te(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function re(e,t){return"decimal-degrees"===t||"points"===t||"unknown"===t?e:c(e,t,"meters")}const oe=s.ofType(x),ie=s.ofType(F),se=s.ofType(M),ne=s.ofType(U),le=s.ofType(q),ae=s.ofType(H);let pe=class extends(j(L(O(D(y(l(N))))))){constructor(...e){super(...e),this._featureCollection=null,this._type="Feature Collection",this.defaultSymbols=new C,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new se,this.polygonBarriers=new ne,this.polylineBarriers=new le,this.routeInfo=null,this.spatialReference=K.WGS84,this.stops=new ae,this.type="route"}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";f(n,i,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=s}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",(e=>x.fromPortalJSON(e)))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",(e=>F.fromPortalJSON(e)))}get fullExtent(){if(p(this.routeInfo)&&p(this.routeInfo.geometry))return this.routeInfo.geometry.extent;if(this.stops.length>1){const{spatialReference:e}=this.stops[0],t=new Q({spatialReference:e}),r=this.stops.toArray().map((e=>e.geometry));for(const o of r)p(o)&&t.addPoint(o);return t.extent}return new b({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:K.WGS84})}readMaxScale(e,t){var r;const o=(Z(t)?t.layers:t.featureCollection.layers).find((e=>p(e.layerDefinition.maxScale)));return null!=(r=null==o?void 0:o.layerDefinition.maxScale)?r:0}readMinScale(e,t){var r;const o=(Z(t)?t.layers:t.featureCollection.layers).find((e=>p(e.layerDefinition.minScale)));return null!=(r=null==o?void 0:o.layerDefinition.minScale)?r:0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",(e=>M.fromPortalJSON(e)))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",(e=>U.fromPortalJSON(e)))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",(e=>q.fromPortalJSON(e)))}readRouteInfo(e,t){const r=this._getNetworkFeatures(t,"RouteInfo",(e=>E.fromPortalJSON(e)));return r.length>0?r.getItemAt(0):null}readSpatialReference(e,t){var r,o;const i=Z(t)?t.layers:t.featureCollection.layers;if(!i.length)return K.WGS84;const{layerDefinition:s}=i[0],n=null!=(r=null!=(o=s.spatialReference)?o:s.extent.spatialReference)?r:I;return K.fromJSON(n)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",(e=>H.fromPortalJSON(e)),(e=>this._setStopSymbol(e)))}get title(){return p(this.routeInfo)&&p(this.routeInfo.name)?this.routeInfo.name:"Route"}set title(e){e?this._override("title",e):this._clearOverride("title")}get url(){return t.routeServiceUrl}set url(e){null!=e?this._set("url",_(e,a.getLogger(this.declaredClass))):this._set("url",t.routeServiceUrl)}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}removeAll(){p(this.directionLines)&&(this.directionLines.removeAll(),this._set("directionLines",null)),p(this.directionPoints)&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),p(this.routeInfo)&&this._set("routeInfo",null),this.pointBarriers.removeAll(),this.polygonBarriers.removeAll(),this.polylineBarriers.removeAll(),this.stops.removeAll()}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(u(this.routeInfo))throw new n("routelayer:route-unsolved","save() requires a solved route");const{portal:r}=t;if(await r._signIn(),r.user||await t.reload(),r.user.username!==t.owner)throw new n("routelayer:not-portal-item-owner","You can only overwrite your portal items");const{itemUrl:o}=t,i={messages:[],origin:"portal-item",portal:r,url:o&&d(o),writtenProperties:[]},s=this.write(null,i);return t.extent=await ee(e),t.title=this.title,await t.update({data:s}),t}async saveAs(e,t={}){if(await this.load(),u(this.routeInfo))throw new n("routelayer:route-unsolved","saveAs() requires a solved route");const r=R.from(e).clone();null!=r.extent||(r.extent=await ee(this.fullExtent)),r.id=null,null!=r.portal||(r.portal=T.getDefault()),null!=r.title||(r.title=this.title),r.type="Feature Collection",r.typeKeywords=["Data","Feature Collection","Multilayer","Route Layer"];const{portal:o}=r,i={messages:[],origin:"portal-item",portal:o,url:null,writtenProperties:[]};await o._signIn();const s=null==t?void 0:t.folder,l=this.write(null,i);return await o.user.addItem({item:r,folder:s,data:l}),this.portalItem=r,v(i),i.portalItem=r,r}async solve(e,t){var r,o,i,l,a,p;const y=null!=(r=null==e?void 0:e.stops)?r:this.stops,f=null!=(o=null==e?void 0:e.pointBarriers)?o:Y(this.pointBarriers),c=null!=(i=null==e?void 0:e.polylineBarriers)?i:Y(this.polylineBarriers),d=null!=(l=null==e?void 0:e.polygonBarriers)?l:Y(this.polygonBarriers);if(u(y))throw new n("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if(($(y)||z(y))&&y.features.length<2||s.isCollection(y)&&y.length<2)throw new n("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");const h=await J(this.url,null==e?void 0:e.apiKey,t),S=h.supportedTravelModes.find((e=>e.id===h.defaultTravelMode)),g=null!=(a=null==e?void 0:e.travelMode)?a:S,{distanceAttributeName:w}=g,v=null!=(p=null==e?void 0:e.accumulateAttributes)?p:[];v.push(w);const b={startTime:new Date},P={accumulateAttributes:v,directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:f,polylineBarriers:c,polygonBarriers:d,preserveFirstStop:!0,preserveLastStop:!0,returnBarriers:!!f,returnDirections:!0,returnPolygonBarriers:!!d,returnPolylineBarriers:!!c,returnRoutes:!0,returnStops:!0,stops:y},B=e?W.from(e):new W;for(const s in b)null==B[s]&&(B[s]=b[s]);B.set(P);const I=await A(this.url,B,t),N=this._toRouteLayerSolution(I);return this._isOverridden("title")||(this.title=m(N.routeInfo.name,"Route")),X(N,h,B),N}update(e){const{stops:t,directionLines:r,directionPoints:o,pointBarriers:i,polylineBarriers:s,polygonBarriers:n,routeInfo:l}=e;this.set({stops:t,pointBarriers:i,polylineBarriers:s,polygonBarriers:n}),this._set("directionLines",r),this._set("directionPoints",o),this._set("routeInfo",l)}_getLayerDefinition(){return{capabilities:"Query,Update,Editing",extent:this.fullExtent.toJSON(),hasM:!1,hasZ:!1,maxScale:this.maxScale,minScale:this.minScale,objectIdField:"__OBJECTID",spatialReference:this.spatialReference.toJSON(),type:"Feature Layer",typeIdField:""}}_getNetworkFeatures(e,t,n,l){const a=(Z(e)?e.layers:e.featureCollection.layers).find((e=>e.layerDefinition.name===t));if(u(a))return new s;const{layerDefinition:p,popupInfo:m,featureSet:y}=a,f=p.drawingInfo.renderer,{features:c}=y,d=f&&i(f),h=c.map((e=>{var i;const s=n(e),{attributes:l}=e,a=new r({attributes:l});return null!=s.symbol||(s.symbol=null!=(i=null==d?void 0:d.getSymbol(a))?i:this._getNetworkSymbol(t)),null!=s.popupTemplate||(s.popupTemplate=m&&o.fromJSON(m)),s}));return l&&h.some((e=>!e.symbol))&&l(h),new s(h)}_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}}_setStopSymbol(e){if(!e)return;if(e.length<2){for(const t of e)t.symbol=this.defaultSymbols.invalidStop;return}const t=e.map((e=>e.sequence)).filter((e=>p(e))),r=Math.min(...t),o=Math.max(...t);for(const i of e)i.sequence!==r?i.sequence!==o?"ok"===i.status||"not-located-on-closest"===i.status?"waypoint"!==i.locationType?"break"!==i.locationType?i.symbol=this.defaultSymbols.middleStop:i.symbol=this.defaultSymbols.breakStop:i.symbol=this.defaultSymbols.waypointStop:i.symbol=this.defaultSymbols.invalidStop:i.symbol=this.defaultSymbols.lastStop:i.symbol=this.defaultSymbols.firstStop}_toRouteLayerSolution(e){var t,r,o;const i=e.routeResults[0].stops.map((e=>H.fromJSON(e.toJSON())));this._setStopSymbol(i);const s=new ae(i),n=new ne(null==(t=e.polygonBarriers)?void 0:t.map((e=>{const t=U.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polygonBarriers,t}))),l=new le(null==(r=e.polylineBarriers)?void 0:r.map((e=>{const t=q.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polylineBarriers,t}))),a=new se(null==(o=e.pointBarriers)?void 0:o.map((e=>{const t=M.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.pointBarriers,t}))),p=E.fromJSON(e.routeResults[0].route.toJSON());p.symbol=this.defaultSymbols.routeInfo;const u=new ie(e.routeResults[0].directionPoints.features.map((e=>{const t=F.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionPoints,t})));return{directionLines:new oe(e.routeResults[0].directionLines.features.map((e=>{const t=x.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionLines,t}))),directionPoints:u,pointBarriers:a,polygonBarriers:n,polylineBarriers:l,routeInfo:p,stops:s}}_writeDirectionLines(){return u(this.directionLines)||!this.directionLines.length?null:{featureSet:{features:this.directionLines.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPolyline"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.directionLines.toJSON()}},fields:x.fields,geometryType:"esriGeometryPolyline",name:"DirectionLines",title:"Direction Lines"},popupInfo:x.popupInfo}}_writeDirectionPoints(){return u(this.directionPoints)||!this.directionPoints.length?null:{featureSet:{features:this.directionPoints.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPoint"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.directionPoints.toJSON()}},fields:F.fields,geometryType:"esriGeometryPoint",name:"DirectionPoints",title:"Direction Points"},popupInfo:F.popupInfo}}_writePointBarriers(){return u(this.pointBarriers)||!this.pointBarriers.length?null:{featureSet:{features:this.pointBarriers.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPoint"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.pointBarriers.toJSON()}},fields:M.fields,geometryType:"esriGeometryPoint",name:"Barrier",title:"Point Barrier"},popupInfo:M.popupInfo}}_writePolygonBarriers(){return u(this.polygonBarriers)||!this.polygonBarriers.length?null:{featureSet:{features:this.polygonBarriers.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPolygon"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.polygonBarriers.toJSON()}},fields:U.fields,geometryType:"esriGeometryPolygon",name:"PolygonBarriers",title:"Polygon Barriers"},popupInfo:U.popupInfo}}_writePolylineBarriers(){return u(this.polylineBarriers)||!this.polylineBarriers.length?null:{featureSet:{features:this.polylineBarriers.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPolyline"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.polylineBarriers.toJSON()}},fields:q.fields,geometryType:"esriGeometryPolyline",name:"PolylineBarriers",title:"Line Barriers"},popupInfo:q.popupInfo}}_writeRouteInfo(){return u(this.routeInfo)?null:{featureSet:{features:[this.routeInfo.toPortalJSON()],geometryType:"esriGeometryPolyline"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.routeInfo.toJSON()}},fields:E.fields,geometryType:"esriGeometryPolyline",name:"RouteInfo",title:"Route Details"},popupInfo:E.popupInfo}}_writeStops(){return u(this.stops)||!this.stops.length?null:{featureSet:{features:this.stops.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPoint"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"uniqueValue",field1:"Sequence",defaultSymbol:this.defaultSymbols.middleStop.toJSON(),uniqueValueInfos:[{value:"1",symbol:this.defaultSymbols.firstStop.toJSON(),label:"First Stop"},{value:`${this.stops.length}`,symbol:this.defaultSymbols.lastStop.toJSON(),label:"Last Stop"}]}},fields:H.fields,geometryType:"esriGeometryPoint",name:"Stops",title:"Stops"},popupInfo:H.popupInfo}}};e([h({readOnly:!0,json:{read:!1,origins:{"portal-item":{write:{allowNull:!0,ignoreOrigin:!0}},"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:null==this.portalItem}}}}}}})],pe.prototype,"_featureCollection",void 0),e([w(["web-map","portal-item"],"_featureCollection")],pe.prototype,"writeFeatureCollectionWebmap",null),e([h({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:null!=this.portalItem}}}}}}})],pe.prototype,"_type",void 0),e([h({nonNullable:!0,type:C})],pe.prototype,"defaultSymbols",void 0),e([h({readOnly:!0})],pe.prototype,"directionLines",void 0),e([S(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],pe.prototype,"readDirectionLines",null),e([h({readOnly:!0})],pe.prototype,"directionPoints",void 0),e([S(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],pe.prototype,"readDirectionPoints",null),e([h({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],pe.prototype,"featureCollectionType",void 0),e([h({readOnly:!0})],pe.prototype,"fullExtent",null),e([h({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],pe.prototype,"legendEnabled",void 0),e([h({type:["show","hide"]})],pe.prototype,"listMode",void 0),e([h({type:Number,nonNullable:!0,json:{write:!1}})],pe.prototype,"maxScale",void 0),e([S(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],pe.prototype,"readMaxScale",null),e([h({type:Number,nonNullable:!0,json:{write:!1}})],pe.prototype,"minScale",void 0),e([S(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],pe.prototype,"readMinScale",null),e([h({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],pe.prototype,"operationalLayerType",void 0),e([h({nonNullable:!0,type:s.ofType(M)})],pe.prototype,"pointBarriers",void 0),e([S(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPointBarriers",null),e([h({nonNullable:!0,type:s.ofType(U)})],pe.prototype,"polygonBarriers",void 0),e([S(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPolygonBarriers",null),e([h({nonNullable:!0,type:s.ofType(q)})],pe.prototype,"polylineBarriers",void 0),e([S(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPolylineBarriers",null),e([h({readOnly:!0})],pe.prototype,"routeInfo",void 0),e([S(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],pe.prototype,"readRouteInfo",null),e([h({type:K})],pe.prototype,"spatialReference",void 0),e([S(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],pe.prototype,"readSpatialReference",null),e([h({nonNullable:!0,type:s.ofType(H)})],pe.prototype,"stops",void 0),e([S(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],pe.prototype,"readStops",null),e([h()],pe.prototype,"title",null),e([h({readOnly:!0,json:{read:!1}})],pe.prototype,"type",void 0),e([h()],pe.prototype,"url",null),pe=e([g("esri.layers.RouteLayer")],pe);const ue=pe;export{ue as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import"../geometry.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import"../renderers/ClassBreaksRenderer.js";import"../renderers/DictionaryRenderer.js";import"../renderers/DotDensityRenderer.js";import"../renderers/HeatmapRenderer.js";import"../renderers/Renderer.js";import"../renderers/SimpleRenderer.js";import"../renderers/UniqueValueRenderer.js";import{read as i}from"../renderers/support/jsonUtils.js";import s from"../core/Collection.js";import n from"../core/Error.js";import{HandleOwnerMixin as l}from"../core/HandleOwner.js";import a from"../core/Logger.js";import{isSome as p,isNone as u,unwrapOrValue as m}from"../core/maybe.js";import{MultiOriginJSONMixin as y}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as f}from"../core/object.js";import{watch as c}from"../core/reactiveUtils.js";import{convertUnit as d}from"../core/unitUtils.js";import{urlToObject as h}from"../core/urlUtils.js";import{property as S}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{reader as g}from"../core/accessorSupport/decorators/reader.js";import{subclass as w}from"../core/accessorSupport/decorators/subclass.js";import{writer as v}from"../core/accessorSupport/decorators/writer.js";import{updateOrigins as b}from"../core/accessorSupport/originUtils.js";import P from"../geometry/Extent.js";import{initializeProjection as B,project as I}from"../geometry/projection.js";import{WGS84 as N}from"../geometry/support/spatialReferenceUtils.js";import j from"./Layer.js";import{BlendLayer as O}from"./mixins/BlendLayer.js";import{OperationalLayer as L}from"./mixins/OperationalLayer.js";import{PortalLayer as D}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as _}from"./mixins/ScaleRangeLayer.js";import{sanitizeUrl as C}from"./support/arcgisLayerUrl.js";import T from"./support/DefaultSymbols.js";import R from"../portal/Portal.js";import J from"../portal/PortalItem.js";import{fetchServiceDescription as A}from"../rest/networkService.js";import{solve as x}from"../rest/route.js";import F from"../rest/support/DirectionLine.js";import k from"../rest/support/DirectionPoint.js";import{directionsTimeUnitJsonMap as G,directionsLengthUnitJsonMap as M}from"../rest/support/networkEnums.js";import U from"../rest/support/PointBarrier.js";import E from"../rest/support/PolygonBarrier.js";import q from"../rest/support/PolylineBarrier.js";import W from"../rest/support/RouteInfo.js";import V from"../rest/support/RouteParameters.js";import H from"../rest/support/RouteSettings.js";import K from"../rest/support/Stop.js";import Q from"../geometry/SpatialReference.js";import Y from"../geometry/Multipoint.js";function Z(e){return e.length?e:null}function $(e){return"layers"in e}function z(e){return"esri.rest.support.FeatureSet"===e.declaredClass}function X(e){return"esri.rest.support.NetworkFeatureSet"===e.declaredClass}function ee(e,t,r){var o,i,s,l,a,m,y,f,c,d,h;const{impedance:S,networkDataset:g,supportedTravelModes:w,defaultTravelMode:v}=t,b=g.networkAttributes.filter((e=>"esriNAUTCost"===e.usageType)),P=w.find((e=>e.id===v)),B=null!=(o=r.travelMode)?o:P;if(u(B))return void ue.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:I,distanceAttributeName:N}=B,j=b.find((e=>e.name===I)),O=b.find((e=>e.name===N)),L=null!=(i=null!=(s=null==(l=r.travelMode)?void 0:l.impedanceAttributeName)?s:r.impedanceAttribute)?i:S,D=G.fromJSON(null==j?void 0:j.units),_=M.fromJSON(null==O?void 0:O.units);if(!D||!_)throw new n("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const C=null!=(a=r.directionsLanguage)?a:t.directionsLanguage,T=null!=(m=null!=(y=r.accumulateAttributes)?y:t.accumulateAttributeNames)?m:[],R=new Set(b.filter((({name:e})=>e===I||e===N||e===L||T.includes(e))).map((({name:e})=>e))),J=e=>{for(const t in e)R.has(t)||delete e[t]};for(const n of e.pointBarriers){var A;if(p(n.costs))n.addedCost=null!=(A=n.costs[L])?A:0,J(n.costs)}for(const n of e.polygonBarriers){var x;if(p(n.costs))n.scaleFactor=null!=(x=n.costs[L])?x:1,J(n.costs)}for(const n of e.polylineBarriers){var F;if(p(n.costs))n.scaleFactor=null!=(F=n.costs[L])?F:1,J(n.costs)}const{routeInfo:k}=e,{findBestSequence:U,preserveFirstStop:E,preserveLastStop:q,startTimeIsUTC:W,timeWindowsAreUTC:V}=r;k.analysisSettings=new H({accumulateAttributes:T,directionsLanguage:C,findBestSequence:U,preserveFirstStop:E,preserveLastStop:q,startTimeIsUTC:W,timeWindowsAreUTC:V,travelMode:B}),k.totalDuration=re(null!=(f=k.totalCosts[I])?f:0,D),k.totalDistance=oe(null!=(c=k.totalCosts[N])?c:0,_),k.totalLateDuration=re(null!=(d=k.totalViolations[I])?d:0,D),k.totalWaitDuration=re(null!=(h=k.totalWait[I])?h:0,D),p(k.totalCosts)&&J(k.totalCosts),p(k.totalViolations)&&J(k.totalViolations),p(k.totalWait)&&J(k.totalWait);for(const n of e.stops){var K,Q,Y,Z,$,z;if(p(n.serviceCosts))n.serviceDuration=re(null!=(K=n.serviceCosts[I])?K:0,D),n.serviceDistance=oe(null!=(Q=n.serviceCosts[N])?Q:0,_),J(n.serviceCosts);if(p(n.cumulativeCosts))n.cumulativeDuration=re(null!=(Y=n.cumulativeCosts[I])?Y:0,D),n.cumulativeDistance=oe(null!=(Z=n.cumulativeCosts[N])?Z:0,_),J(n.cumulativeCosts);if(p(n.violations))n.lateDuration=re(null!=($=n.violations[I])?$:0,D),J(n.violations);if(p(n.wait))n.waitDuration=re(null!=(z=n.wait[I])?z:0,D),J(n.wait)}}async function te(e){const t=Q.WGS84;return await B(e.spatialReference,t),I(e,t)}function re(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function oe(e,t){return"decimal-degrees"===t||"points"===t||"unknown"===t?e:d(e,t,"meters")}const ie=s.ofType(F),se=s.ofType(k),ne=s.ofType(U),le=s.ofType(E),ae=s.ofType(q),pe=s.ofType(K),ue=a.getLogger("esri.layers.RouteLayer");let me=class extends(O(_(L(D(y(l(j))))))){constructor(...e){super(...e),this._featureCollection=null,this._type="Feature Collection",this.defaultSymbols=new T,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new ne,this.polygonBarriers=new le,this.polylineBarriers=new ae,this.routeInfo=null,this.spatialReference=Q.WGS84,this.stops=new pe,this.type="route",this.handles.add(c((()=>this.stops.toArray()),(()=>{u(this.routeInfo)&&this._setStopSymbol(this.stops)}),{sync:!0}))}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";f(n,i,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=s}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",(e=>F.fromPortalJSON(e)))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",(e=>k.fromPortalJSON(e)))}get fullExtent(){if(p(this.routeInfo)&&p(this.routeInfo.geometry))return this.routeInfo.geometry.extent;if(this.stops.length>1){const{spatialReference:e}=this.stops[0],t=new Y({spatialReference:e}),r=this.stops.toArray().map((e=>e.geometry));for(const o of r)p(o)&&t.addPoint(o);return t.extent}return new P({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:Q.WGS84})}readMaxScale(e,t){var r;const o=($(t)?t.layers:t.featureCollection.layers).find((e=>p(e.layerDefinition.maxScale)));return null!=(r=null==o?void 0:o.layerDefinition.maxScale)?r:0}readMinScale(e,t){var r;const o=($(t)?t.layers:t.featureCollection.layers).find((e=>p(e.layerDefinition.minScale)));return null!=(r=null==o?void 0:o.layerDefinition.minScale)?r:0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",(e=>U.fromPortalJSON(e)))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",(e=>E.fromPortalJSON(e)))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",(e=>q.fromPortalJSON(e)))}readRouteInfo(e,t){const r=this._getNetworkFeatures(t,"RouteInfo",(e=>W.fromPortalJSON(e)));return r.length>0?r.getItemAt(0):null}readSpatialReference(e,t){var r,o;const i=$(t)?t.layers:t.featureCollection.layers;if(!i.length)return Q.WGS84;const{layerDefinition:s}=i[0],n=null!=(r=null!=(o=s.spatialReference)?o:s.extent.spatialReference)?r:N;return Q.fromJSON(n)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",(e=>K.fromPortalJSON(e)),(e=>this._setStopSymbol(e)))}get title(){return p(this.routeInfo)&&p(this.routeInfo.name)?this.routeInfo.name:"Route"}set title(e){e?this._override("title",e):this._clearOverride("title")}get url(){return t.routeServiceUrl}set url(e){null!=e?this._set("url",C(e,ue)):this._set("url",t.routeServiceUrl)}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}removeAll(){p(this.directionLines)&&(this.directionLines.removeAll(),this._set("directionLines",null)),p(this.directionPoints)&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),p(this.routeInfo)&&this._set("routeInfo",null),this.pointBarriers.removeAll(),this.polygonBarriers.removeAll(),this.polylineBarriers.removeAll(),this.stops.removeAll()}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(u(this.routeInfo))throw new n("routelayer:route-unsolved","save() requires a solved route");const{portal:r}=t;if(await r._signIn(),r.user||await t.reload(),r.user.username!==t.owner)throw new n("routelayer:not-portal-item-owner","You can only overwrite your portal items");const{itemUrl:o}=t,i={messages:[],origin:"portal-item",portal:r,url:o&&h(o),writtenProperties:[]},s=this.write(null,i);return t.extent=await te(e),t.title=this.title,await t.update({data:s}),t}async saveAs(e,t={}){if(await this.load(),u(this.routeInfo))throw new n("routelayer:route-unsolved","saveAs() requires a solved route");const r=J.from(e).clone();null!=r.extent||(r.extent=await te(this.fullExtent)),r.id=null,null!=r.portal||(r.portal=R.getDefault()),null!=r.title||(r.title=this.title),r.type="Feature Collection",r.typeKeywords=["Data","Feature Collection","Multilayer","Route Layer"];const{portal:o}=r,i={messages:[],origin:"portal-item",portal:o,url:null,writtenProperties:[]};await o._signIn();const s=null==t?void 0:t.folder,l=this.write(null,i);return await o.user.addItem({item:r,folder:s,data:l}),this.portalItem=r,b(i),i.portalItem=r,r}async solve(e,t){var r,o,i,l,a,y;const f=null!=(r=null==e?void 0:e.stops)?r:this.stops,c=null!=(o=null==e?void 0:e.pointBarriers)?o:Z(this.pointBarriers),d=null!=(i=null==e?void 0:e.polylineBarriers)?i:Z(this.polylineBarriers),h=null!=(l=null==e?void 0:e.polygonBarriers)?l:Z(this.polygonBarriers);if(u(f))throw new n("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if((z(f)||X(f))&&f.features.length<2||s.isCollection(f)&&f.length<2)throw new n("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");const S=await A(this.url,null==e?void 0:e.apiKey,t),{defaultTravelMode:g,supportedTravelModes:w}=S,v=w.find((e=>e.id===g)),b=null!=(a=null==e?void 0:e.travelMode)?a:v,P=null!=(y=null==e?void 0:e.accumulateAttributes)?y:[];p(b)&&P.push(b.distanceAttributeName);const B={startTime:new Date},I={accumulateAttributes:P,directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:c,polylineBarriers:d,polygonBarriers:h,preserveFirstStop:!0,preserveLastStop:!0,returnBarriers:!!c,returnDirections:!0,returnPolygonBarriers:!!h,returnPolylineBarriers:!!d,returnRoutes:!0,returnStops:!0,stops:f},N=e?V.from(e):new V;for(const s in B)null==N[s]&&(N[s]=B[s]);N.set(I);const j=await x(this.url,N,t),O=this._toRouteLayerSolution(j);return this._isOverridden("title")||(this.title=m(O.routeInfo.name,"Route")),ee(O,S,N),O}update(e){const{stops:t,directionLines:r,directionPoints:o,pointBarriers:i,polylineBarriers:s,polygonBarriers:n,routeInfo:l}=e;this.set({stops:t,pointBarriers:i,polylineBarriers:s,polygonBarriers:n}),this._set("directionLines",r),this._set("directionPoints",o),this._set("routeInfo",l)}_getLayerDefinition(){return{capabilities:"Query,Update,Editing",extent:this.fullExtent.toJSON(),hasM:!1,hasZ:!1,maxScale:this.maxScale,minScale:this.minScale,objectIdField:"__OBJECTID",spatialReference:this.spatialReference.toJSON(),type:"Feature Layer",typeIdField:""}}_getNetworkFeatures(e,t,n,l){const a=($(e)?e.layers:e.featureCollection.layers).find((e=>e.layerDefinition.name===t));if(u(a))return new s;const{layerDefinition:p,popupInfo:m,featureSet:y}=a,f=p.drawingInfo.renderer,{features:c}=y,d=f&&i(f),h=c.map((e=>{var i;const s=n(e),{attributes:l}=e,a=new r({attributes:l});return null!=s.symbol||(s.symbol=null!=(i=null==d?void 0:d.getSymbol(a))?i:this._getNetworkSymbol(t)),null!=s.popupTemplate||(s.popupTemplate=m&&o.fromJSON(m)),s}));return l&&h.some((e=>!e.symbol))&&l(h),new s(h)}_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}}_setStopSymbol(e){if(!e||0===e.length)return;if(u(this.routeInfo)||1===e.length)return void e.forEach(((t,r)=>{switch(r){case 0:t.symbol=this.defaultSymbols.firstStop;break;case e.length-1:t.symbol=this.defaultSymbols.lastStop;break;default:t.symbol=this.defaultSymbols.middleStop}}));const t=e.map((e=>e.sequence)).filter((e=>p(e))),r=Math.min(...t),o=Math.max(...t);for(const i of e)i.sequence!==r?i.sequence!==o?"ok"===i.status||"not-located-on-closest"===i.status?"waypoint"!==i.locationType?"break"!==i.locationType?i.symbol=this.defaultSymbols.middleStop:i.symbol=this.defaultSymbols.breakStop:i.symbol=this.defaultSymbols.waypointStop:i.symbol=this.defaultSymbols.invalidStop:i.symbol=this.defaultSymbols.lastStop:i.symbol=this.defaultSymbols.firstStop}_toRouteLayerSolution(e){var t,r,o,i,s;const n=e.routeResults[0].stops.map((e=>K.fromJSON(e.toJSON())));this._setStopSymbol(n);const l=new pe(n),a=new le(null==(t=e.polygonBarriers)?void 0:t.map((e=>{const t=E.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polygonBarriers,t}))),p=new ae(null==(r=e.polylineBarriers)?void 0:r.map((e=>{const t=q.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polylineBarriers,t}))),u=new ne(null==(o=e.pointBarriers)?void 0:o.map((e=>{const t=U.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.pointBarriers,t}))),m=W.fromJSON(e.routeResults[0].route.toJSON());m.symbol=this.defaultSymbols.routeInfo;const y=new se(null==(i=e.routeResults[0].directionPoints)?void 0:i.features.map((e=>{const t=k.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionPoints,t})));return{directionLines:new ie(null==(s=e.routeResults[0].directionLines)?void 0:s.features.map((e=>{const t=F.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionLines,t}))),directionPoints:y,pointBarriers:u,polygonBarriers:a,polylineBarriers:p,routeInfo:m,stops:l}}_writeDirectionLines(){return u(this.directionLines)||!this.directionLines.length?null:{featureSet:{features:this.directionLines.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPolyline"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.directionLines.toJSON()}},fields:F.fields,geometryType:"esriGeometryPolyline",name:"DirectionLines",title:"Direction Lines"},popupInfo:F.popupInfo}}_writeDirectionPoints(){return u(this.directionPoints)||!this.directionPoints.length?null:{featureSet:{features:this.directionPoints.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPoint"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.directionPoints.toJSON()}},fields:k.fields,geometryType:"esriGeometryPoint",name:"DirectionPoints",title:"Direction Points"},popupInfo:k.popupInfo}}_writePointBarriers(){return u(this.pointBarriers)||!this.pointBarriers.length?null:{featureSet:{features:this.pointBarriers.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPoint"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.pointBarriers.toJSON()}},fields:U.fields,geometryType:"esriGeometryPoint",name:"Barrier",title:"Point Barrier"},popupInfo:U.popupInfo}}_writePolygonBarriers(){return u(this.polygonBarriers)||!this.polygonBarriers.length?null:{featureSet:{features:this.polygonBarriers.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPolygon"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.polygonBarriers.toJSON()}},fields:E.fields,geometryType:"esriGeometryPolygon",name:"PolygonBarriers",title:"Polygon Barriers"},popupInfo:E.popupInfo}}_writePolylineBarriers(){return u(this.polylineBarriers)||!this.polylineBarriers.length?null:{featureSet:{features:this.polylineBarriers.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPolyline"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.polylineBarriers.toJSON()}},fields:q.fields,geometryType:"esriGeometryPolyline",name:"PolylineBarriers",title:"Line Barriers"},popupInfo:q.popupInfo}}_writeRouteInfo(){return u(this.routeInfo)?null:{featureSet:{features:[this.routeInfo.toPortalJSON()],geometryType:"esriGeometryPolyline"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.routeInfo.toJSON()}},fields:W.fields,geometryType:"esriGeometryPolyline",name:"RouteInfo",title:"Route Details"},popupInfo:W.popupInfo}}_writeStops(){return u(this.stops)||!this.stops.length?null:{featureSet:{features:this.stops.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPoint"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"uniqueValue",field1:"Sequence",defaultSymbol:this.defaultSymbols.middleStop.toJSON(),uniqueValueInfos:[{value:"1",symbol:this.defaultSymbols.firstStop.toJSON(),label:"First Stop"},{value:`${this.stops.length}`,symbol:this.defaultSymbols.lastStop.toJSON(),label:"Last Stop"}]}},fields:K.fields,geometryType:"esriGeometryPoint",name:"Stops",title:"Stops"},popupInfo:K.popupInfo}}};e([S({readOnly:!0,json:{read:!1,origins:{"portal-item":{write:{allowNull:!0,ignoreOrigin:!0}},"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:null==this.portalItem}}}}}}})],me.prototype,"_featureCollection",void 0),e([v(["web-map","portal-item"],"_featureCollection")],me.prototype,"writeFeatureCollectionWebmap",null),e([S({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:null!=this.portalItem}}}}}}})],me.prototype,"_type",void 0),e([S({nonNullable:!0,type:T})],me.prototype,"defaultSymbols",void 0),e([S({readOnly:!0})],me.prototype,"directionLines",void 0),e([g(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],me.prototype,"readDirectionLines",null),e([S({readOnly:!0})],me.prototype,"directionPoints",void 0),e([g(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],me.prototype,"readDirectionPoints",null),e([S({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],me.prototype,"featureCollectionType",void 0),e([S({readOnly:!0})],me.prototype,"fullExtent",null),e([S({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],me.prototype,"legendEnabled",void 0),e([S({type:["show","hide"]})],me.prototype,"listMode",void 0),e([S({type:Number,nonNullable:!0,json:{write:!1}})],me.prototype,"maxScale",void 0),e([g(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],me.prototype,"readMaxScale",null),e([S({type:Number,nonNullable:!0,json:{write:!1}})],me.prototype,"minScale",void 0),e([g(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],me.prototype,"readMinScale",null),e([S({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],me.prototype,"operationalLayerType",void 0),e([S({nonNullable:!0,type:s.ofType(U)})],me.prototype,"pointBarriers",void 0),e([g(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],me.prototype,"readPointBarriers",null),e([S({nonNullable:!0,type:s.ofType(E)})],me.prototype,"polygonBarriers",void 0),e([g(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],me.prototype,"readPolygonBarriers",null),e([S({nonNullable:!0,type:s.ofType(q)})],me.prototype,"polylineBarriers",void 0),e([g(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],me.prototype,"readPolylineBarriers",null),e([S({readOnly:!0})],me.prototype,"routeInfo",void 0),e([g(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],me.prototype,"readRouteInfo",null),e([S({type:Q})],me.prototype,"spatialReference",void 0),e([g(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],me.prototype,"readSpatialReference",null),e([S({nonNullable:!0,type:s.ofType(K)})],me.prototype,"stops",void 0),e([g(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],me.prototype,"readStops",null),e([S()],me.prototype,"title",null),e([S({readOnly:!0,json:{read:!1}})],me.prototype,"type",void 0),e([S()],me.prototype,"url",null),me=e([w("esri.layers.RouteLayer")],me);const ye=me;export{ye as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.23.2",
3
+ "version": "4.23.5",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS API for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- const c="20220325",d="bd365f30c3ec9889ec50c6d6f51a1c6ac3877d35";export{c as buildDate,d as commitHash};
5
+ const c="20220330",e="c6040e027595ee92afd67ccc7c3952c1c711f402";export{c as buildDate,e as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- const t=8,e=t-2,c=1e-30,h=64,i=4294967295,o=512,a=256,d=256/360,n=!1,p=128,r=8,s=29,f=1,g=16,l=16,m=o/p,v=8,w=50,x=10,b=24,j=8,k={metrics:{width:15,height:17,left:0,top:-7,advance:14}},q=1024,u=0,y=0,z=0,A=1,B=2,C=3,D=4,E=12,F=5,G=6,H=5,I=6,J=0,K=1,L=2,M=3,N=3,O=4,P=2,Q=1,R=2,S=4,T=!1,U=1.05,V=6,W=5,X=6,Y=1.15,Z=2,$=2,_=8,tt=500,et=4,ct=128,ht=10,it=2,ot=0,at=1,dt=4,nt=8,pt=4,rt=1;export{d as ANGLE_FACTOR_256,K as ATTRIBUTE_DATA_ANIMATION,N as ATTRIBUTE_DATA_DD0,O as ATTRIBUTE_DATA_DD1,J as ATTRIBUTE_DATA_FILTER_FLAGS,L as ATTRIBUTE_DATA_GPGPU,M as ATTRIBUTE_DATA_VV,q as ATTRIBUTE_STORE_TEXTURE_SIZE,k as AVERAGE_GLYPH_MOSAIC_ITEM,it as BITSET_GENERIC_LOCK_COLOR,pt as BITSET_LINE_SCALE_DASH,at as BITSET_MARKER_ALIGNMENT_MAP,ot as BITSET_MARKER_ALIGNMENT_SCREEN,dt as BITSET_MARKER_OUTLINE_ALLOW_COLOR_OVERRIDE,nt as BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY,rt as BITSET_TYPE_FILL_OUTLINE,ct as BUFFER_DATA_MINIMUM_SIZE,et as BUFFER_DATA_POOL_SIZE,l as COLLISION_BOX_PADDING,p as COLLISION_BUCKET_SIZE,g as COLLISION_EARLY_REJECT_BUCKET_SIZE,f as COLLISION_MAX_ZOOM_DELTA,v as COLLISION_PLACEMENT_PADDING,m as COLLISION_TILE_BOX_SIZE,n as DEBUG_LABELS,_ as DISPLAY_RECORD_INT_PER_ELEMENT,r as DOT_DENSITY_MAX_FIELDS,S as EFFECT_FLAG_0,T as ENABLE_EARLY_LABEL_DISCARD,h as EXTRUDE_SCALE,R as FILTER_FLAG_0,b as GLYPH_SIZE,x as HEURISTIC_GLYPHS_PER_FEATURE,w as HEURISTIC_GLYPHS_PER_LINE,Q as HIGHLIGHT_FLAG,V as HITTEST_SEARCH_SIZE,s as MAGIC_LABEL_LINE_HEIGHT,P as MAX_FILTERS,Z as MAX_GPU_UPLOADS_PER_FRAME,ht as MIN_MAX_ZOOM_PRECISION_FACTOR,c as NAN_MAGIC_NUMBER,tt as PATCH_PIXEL_BUFFER_ALLOC_SIZE,i as PICTURE_FILL_COLOR,a as RASTER_TILE_SIZE,$ as SPRITE_PADDING,A as TEXTURE_BINDING_ATTRIBUTE_DATA_0,B as TEXTURE_BINDING_ATTRIBUTE_DATA_1,C as TEXTURE_BINDING_ATTRIBUTE_DATA_2,D as TEXTURE_BINDING_ATTRIBUTE_DATA_3,z as TEXTURE_BINDING_BITMAP,y as TEXTURE_BINDING_GLYPH_ATLAS,E as TEXTURE_BINDING_GPGPU,F as TEXTURE_BINDING_HIGHLIGHT_0,G as TEXTURE_BINDING_HIGHLIGHT_1,H as TEXTURE_BINDING_RENDERER_0,I as TEXTURE_BINDING_RENDERER_1,u as TEXTURE_BINDING_SPRITE_ATLAS,j as TEXT_PLACEMENT_PADDING,U as THIN_LINE_HALF_WIDTH_THRESHOLD,o as TILE_SIZE,Y as VTL_HIGH_RES_CUTOFF,X as VTL_TEXTURE_BINDING_UNIT_GLYPHS,W as VTL_TEXTURE_BINDING_UNIT_SPRITES,e as WEBGL_MAX_INNER_STOPS,t as WEBGL_MAX_STOPS};
5
+ const t=8,e=t-2,c=1e-30,h=64,i=4294967295,o=512,a=256,d=256/360,n=!1,p=128,r=8,s=29,f=1,g=16,l=16,m=o/p,v=8,w=50,x=10,b=24,j=8,k={metrics:{width:15,height:17,left:0,top:-7,advance:14}},q=1024,u=0,y=0,z=0,A=1,B=2,C=3,D=4,E=12,F=5,G=6,H=5,I=6,J=0,K=1,L=2,M=3,N=3,O=4,P=2,Q=1,R=2,S=4,T=!1,U=1.05,V=3,W=5,X=6,Y=1.15,Z=2,$=2,_=8,tt=500,et=4,ct=128,ht=10,it=2,ot=0,at=1,dt=4,nt=8,pt=4,rt=1;export{d as ANGLE_FACTOR_256,K as ATTRIBUTE_DATA_ANIMATION,N as ATTRIBUTE_DATA_DD0,O as ATTRIBUTE_DATA_DD1,J as ATTRIBUTE_DATA_FILTER_FLAGS,L as ATTRIBUTE_DATA_GPGPU,M as ATTRIBUTE_DATA_VV,q as ATTRIBUTE_STORE_TEXTURE_SIZE,k as AVERAGE_GLYPH_MOSAIC_ITEM,it as BITSET_GENERIC_LOCK_COLOR,pt as BITSET_LINE_SCALE_DASH,at as BITSET_MARKER_ALIGNMENT_MAP,ot as BITSET_MARKER_ALIGNMENT_SCREEN,dt as BITSET_MARKER_OUTLINE_ALLOW_COLOR_OVERRIDE,nt as BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY,rt as BITSET_TYPE_FILL_OUTLINE,ct as BUFFER_DATA_MINIMUM_SIZE,et as BUFFER_DATA_POOL_SIZE,l as COLLISION_BOX_PADDING,p as COLLISION_BUCKET_SIZE,g as COLLISION_EARLY_REJECT_BUCKET_SIZE,f as COLLISION_MAX_ZOOM_DELTA,v as COLLISION_PLACEMENT_PADDING,m as COLLISION_TILE_BOX_SIZE,n as DEBUG_LABELS,_ as DISPLAY_RECORD_INT_PER_ELEMENT,r as DOT_DENSITY_MAX_FIELDS,S as EFFECT_FLAG_0,T as ENABLE_EARLY_LABEL_DISCARD,h as EXTRUDE_SCALE,R as FILTER_FLAG_0,b as GLYPH_SIZE,x as HEURISTIC_GLYPHS_PER_FEATURE,w as HEURISTIC_GLYPHS_PER_LINE,Q as HIGHLIGHT_FLAG,V as HITTEST_RADIUS,s as MAGIC_LABEL_LINE_HEIGHT,P as MAX_FILTERS,Z as MAX_GPU_UPLOADS_PER_FRAME,ht as MIN_MAX_ZOOM_PRECISION_FACTOR,c as NAN_MAGIC_NUMBER,tt as PATCH_PIXEL_BUFFER_ALLOC_SIZE,i as PICTURE_FILL_COLOR,a as RASTER_TILE_SIZE,$ as SPRITE_PADDING,A as TEXTURE_BINDING_ATTRIBUTE_DATA_0,B as TEXTURE_BINDING_ATTRIBUTE_DATA_1,C as TEXTURE_BINDING_ATTRIBUTE_DATA_2,D as TEXTURE_BINDING_ATTRIBUTE_DATA_3,z as TEXTURE_BINDING_BITMAP,y as TEXTURE_BINDING_GLYPH_ATLAS,E as TEXTURE_BINDING_GPGPU,F as TEXTURE_BINDING_HIGHLIGHT_0,G as TEXTURE_BINDING_HIGHLIGHT_1,H as TEXTURE_BINDING_RENDERER_0,I as TEXTURE_BINDING_RENDERER_1,u as TEXTURE_BINDING_SPRITE_ATLAS,j as TEXT_PLACEMENT_PADDING,U as THIN_LINE_HALF_WIDTH_THRESHOLD,o as TILE_SIZE,Y as VTL_HIGH_RES_CUTOFF,X as VTL_TEXTURE_BINDING_UNIT_GLYPHS,W as VTL_TEXTURE_BINDING_UNIT_SPRITES,e as WEBGL_MAX_INNER_STOPS,t as WEBGL_MAX_STOPS};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t,isNone as e}from"../../../../../core/maybe.js";import{HITTEST_SEARCH_SIZE as i,ATTRIBUTE_DATA_GPGPU as s}from"../definitions.js";import{Effect as o}from"./Effect.js";import{PixelFormat as n,PixelType as r}from"../../../../webgl/enums.js";class l extends o{constructor(){super(...arguments),this.name=this.constructor.name,this.defines=["hittest"]}dispose(){t(this._fbo)&&this._fbo.dispose()}createOptions({pixelRatio:t},e,s=i){if(!e.length)return null;const o=e.shift(),n=o.point.x,r=o.point.y;return this._outstanding=o,{type:"hittest",distance:s*t,position:[n,r]}}bind(t){const{context:i,attributeView:o}=t;if(!o.size)return;const n=o.getBlock(s);if(e(n))return;const r=n.getFBO(i);i.setViewport(0,0,o.size,o.size),i.bindFramebuffer(r),i.setColorMask(!0,!0,!0,!0),i.setClearColor(0,0,0,0),i.clear(i.gl.COLOR_BUFFER_BIT|i.gl.DEPTH_BUFFER_BIT)}unbind(t){}draw(t){const{context:i,attributeView:o}=t,l=o.getBlock(s);if(e(this._outstanding))return;const u=this._outstanding.resolver;if(e(l))return u.resolve([]),void(this._outstanding=null);const c=l.getFBO(i),h=new Uint8Array(c.width*c.height*4);c.readPixels(0,0,c.width,c.height,n.RGBA,r.UNSIGNED_BYTE,h);const a=[];for(let e=0;e<h.length;e+=4)h[e]&&a.push(e/4);this._outstanding=null,u.resolve(a)}}export{l as HittestEffect};
5
+ import{isSome as t,isNone as e}from"../../../../../core/maybe.js";import{HITTEST_RADIUS as i,ATTRIBUTE_DATA_GPGPU as s}from"../definitions.js";import{Effect as o}from"./Effect.js";import{PixelFormat as n,PixelType as r}from"../../../../webgl/enums.js";class l extends o{constructor(){super(...arguments),this.name=this.constructor.name,this.defines=["hittest"]}dispose(){t(this._fbo)&&this._fbo.dispose()}createOptions({pixelRatio:t},e,s=i){if(!e.length)return null;const o=e.shift(),n=o.point.x,r=o.point.y;return this._outstanding=o,{type:"hittest",distance:s*t,position:[n,r]}}bind(t){const{context:i,attributeView:o}=t;if(!o.size)return;const n=o.getBlock(s);if(e(n))return;const r=n.getFBO(i);i.setViewport(0,0,o.size,o.size),i.bindFramebuffer(r),i.setColorMask(!0,!0,!0,!0),i.setClearColor(0,0,0,0),i.clear(i.gl.COLOR_BUFFER_BIT|i.gl.DEPTH_BUFFER_BIT)}unbind(t){}draw(t){const{context:i,attributeView:o}=t,l=o.getBlock(s);if(e(this._outstanding))return;const u=this._outstanding.resolver;if(e(l))return u.resolve([]),void(this._outstanding=null);const c=l.getFBO(i),h=new Uint8Array(c.width*c.height*4);c.readPixels(0,0,c.width,c.height,n.RGBA,r.UNSIGNED_BYTE,h);const a=[];for(let e=0;e<h.length;e+=4)h[e]&&a.push(e/4);this._outstanding=null,u.resolve(a)}}export{l as HittestEffect};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../../../../core/maybe.js";import{HITTEST_SEARCH_SIZE as e}from"../definitions.js";import{Effect as s}from"./Effect.js";import{PixelFormat as o,PixelType as r}from"../../../../webgl/enums.js";class i extends s{constructor(){super(...arguments),this.name=this.constructor.name,this.defines=["id"],this._lastSize=0}dispose(){t(this._fbo)&&this._fbo.dispose()}bind({context:t,painter:e}){const{width:s,height:o}=t.getViewport();this._boundFBO=t.getBoundFramebufferObject();const r=e.getFbos(s,o).effect0;t.bindFramebuffer(r),t.setColorMask(!0,!0,!0,!0),t.setClearColor(0,0,0,0),t.clear(t.gl.COLOR_BUFFER_BIT)}unbind({context:t}){t.bindFramebuffer(this._boundFBO),this._boundFBO=null}draw({context:t,state:s,pixelRatio:i},n,f=e){const a=t.getBoundFramebufferObject(),h=s.size[1]*i,u=Math.round(f*i),b=u/2,c=u/2;this._ensureBuffer(u),n.forEach(((t,e)=>{const s=new Map,f=Math.floor(e.x*i-u/2),l=Math.floor(h-e.y*i-u/2);a.readPixels(f,l,u,u,o.RGBA,r.UNSIGNED_BYTE,this._buf);for(let o=0;o<this._buf32.length;o++){const t=this._buf32[o];if(4294967295!==t&&0!==t){const e=o%u,r=u-Math.floor(o/u),i=(b-e)*(b-e)+(c-r)*(c-r),n=s.has(t)?s.get(t):4294967295;s.set(t,Math.min(i,n))}}const d=Array.from(s).sort(((t,e)=>t[1]-e[1])).map((t=>t[0]));t.resolve(d),n.delete(e)}))}_ensureBuffer(t){this._lastSize!==t&&(this._lastSize=t,this._buf=new Uint8Array(4*t*t),this._buf32=new Uint32Array(this._buf.buffer))}}export{i as HittestEffectVTL};
5
+ import{isSome as t}from"../../../../../core/maybe.js";import{HITTEST_RADIUS as e}from"../definitions.js";import{Effect as s}from"./Effect.js";import{PixelFormat as o,PixelType as r}from"../../../../webgl/enums.js";class i extends s{constructor(){super(...arguments),this.name=this.constructor.name,this.defines=["id"],this._lastSize=0}dispose(){t(this._fbo)&&this._fbo.dispose()}bind({context:t,painter:e}){const{width:s,height:o}=t.getViewport();this._boundFBO=t.getBoundFramebufferObject();const r=e.getFbos(s,o).effect0;t.bindFramebuffer(r),t.setColorMask(!0,!0,!0,!0),t.setClearColor(0,0,0,0),t.clear(t.gl.COLOR_BUFFER_BIT)}unbind({context:t}){t.bindFramebuffer(this._boundFBO),this._boundFBO=null}draw({context:t,state:s,pixelRatio:i},n,f=2*e){const a=t.getBoundFramebufferObject(),h=s.size[1]*i,u=Math.round(f*i),b=u/2,c=u/2;this._ensureBuffer(u),n.forEach(((t,e)=>{const s=new Map,f=Math.floor(e.x*i-u/2),l=Math.floor(h-e.y*i-u/2);a.readPixels(f,l,u,u,o.RGBA,r.UNSIGNED_BYTE,this._buf);for(let o=0;o<this._buf32.length;o++){const t=this._buf32[o];if(4294967295!==t&&0!==t){const e=o%u,r=u-Math.floor(o/u),i=(b-e)*(b-e)+(c-r)*(c-r),n=s.has(t)?s.get(t):4294967295;s.set(t,Math.min(i,n))}}const d=Array.from(s).sort(((t,e)=>t[1]-e[1])).map((t=>t[0]));t.resolve(d),n.delete(e)}))}_ensureBuffer(t){this._lastSize!==t&&(this._lastSize=t,this._buf=new Uint8Array(4*t*t),this._buf32=new Uint32Array(this._buf.buffer))}}export{i as HittestEffectVTL};