Files
2024-02-28 17:06:42 +05:00

3 lines
44 KiB
JavaScript

import{A as r,B as s,k4 as C,C as A,a6 as O,dy as z,dw as he,dz as nt,bV as I,a8 as P,a9 as q,z as Ze,s as M,br as fe,ar as re,jE as Se,i3 as at,aU as ze,a1 as Ve,aH as Ke,K,aa as be,ab as He,E,f as W,L as Qe,b$ as lt,la as ut,bS as Pe,iG as pt,ep as ct,a7 as yt,V as j,bm as dt,bn as mt,dp as ft,dq as ht,dr as vt,T as wt,e3 as gt,aJ as St,cx as Ce,ay as ke,kg as bt,I as Tt,S as Bt,j as Nt,g as Pt,v as $t,f_ as Rt,F as It,ae as At,b2 as jt,jf as Lt,bq as Ot}from"./index-b5c8f851.js";import{i as Dt}from"./originUtils-cfe4feaf.js";import{U as H,y as $e,s as Mt,R as Ct,r as Ye,a as Re,b as kt,n as Jt,o as _t,w as xt,d as Ft,D as Je,e as Et,k as Gt,i as Ut,f as qt,l as Wt,m as oe,c as se,C as Y,T as X,j as ee,O as te,S as le,g as Zt}from"./Stop-decb9d97.js";import"./multiOriginJSONSupportUtils-c978f4c3.js";let G=class extends O{constructor(t){super(t),this.break=new z({color:[255,255,255],size:12,outline:{color:[0,122,194],width:3}}),this.first=new z({color:[0,255,0],size:20,outline:{color:[255,255,255],width:4}}),this.unlocated=new z({color:[255,0,0],size:12,outline:{color:[255,255,255],width:3}}),this.last=new z({color:[255,0,0],size:20,outline:{color:[255,255,255],width:4}}),this.middle=new z({color:[51,51,51],size:12,outline:{color:[0,122,194],width:3}}),this.waypoint=new z({color:[255,255,255],size:12,outline:{color:[0,122,194],width:3}})}};r([s({types:C})],G.prototype,"break",void 0),r([s({types:C})],G.prototype,"first",void 0),r([s({types:C})],G.prototype,"unlocated",void 0),r([s({types:C})],G.prototype,"last",void 0),r([s({types:C})],G.prototype,"middle",void 0),r([s({types:C})],G.prototype,"waypoint",void 0),G=r([A("esri.layers.support.RouteStopSymbols")],G);const Xe=G;let x=class extends O{constructor(t){super(t),this.directionLines=new he({color:[0,122,194],width:6}),this.directionPoints=new z({color:[255,255,255],size:6,outline:{color:[0,122,194],width:2}}),this.pointBarriers=new z({style:"x",size:10,outline:{color:[255,0,0],width:3}}),this.polygonBarriers=new nt({color:[255,170,0,.6],outline:{width:7.5,color:[255,0,0,.6]}}),this.polylineBarriers=new he({width:7.5,color:[255,85,0,.7]}),this.routeInfo=new he({width:8,color:[20,89,127]}),this.stops=new Xe}};r([s({types:C})],x.prototype,"directionLines",void 0),r([s({types:C})],x.prototype,"directionPoints",void 0),r([s({types:C})],x.prototype,"pointBarriers",void 0),r([s({types:C})],x.prototype,"polygonBarriers",void 0),r([s({types:C})],x.prototype,"polylineBarriers",void 0),r([s({types:C})],x.prototype,"routeInfo",void 0),r([s({type:Xe})],x.prototype,"stops",void 0),x=r([A("esri.layers.support.RouteSymbols")],x);const et=x;let J=class extends O{constructor(t){super(t),this.dataType=null,this.name=null,this.parameterNames=null,this.restrictionUsageParameterName=null,this.timeNeutralAttributeName=null,this.trafficSupport=null,this.units=null,this.usageType=null}};r([s({type:String})],J.prototype,"dataType",void 0),r([I(H,{ignoreUnknown:!1})],J.prototype,"name",void 0),r([s({type:[String]})],J.prototype,"parameterNames",void 0),r([s({type:String})],J.prototype,"restrictionUsageParameterName",void 0),r([I($e,{ignoreUnknown:!1})],J.prototype,"timeNeutralAttributeName",void 0),r([s({type:String})],J.prototype,"trafficSupport",void 0),r([I(Mt)],J.prototype,"units",void 0),r([I(Ct)],J.prototype,"usageType",void 0),J=r([A("esri.rest.support.NetworkAttribute")],J);const zt=J;let Z=class extends O{constructor(t){super(t),this.buildTime=null,this.name=null,this.networkAttributes=null,this.networkSources=null,this.state=null}};r([s({type:Number})],Z.prototype,"buildTime",void 0),r([s({type:String})],Z.prototype,"name",void 0),r([s({type:[zt]})],Z.prototype,"networkAttributes",void 0),r([s()],Z.prototype,"networkSources",void 0),r([s({type:String})],Z.prototype,"state",void 0),Z=r([A("esri.rest.support.NetworkDataset")],Z);const Vt=Z;let R=class extends O{constructor(t){super(t),this.accumulateAttributeNames=null,this.attributeParameterValues=null,this.currentVersion=null,this.defaultTravelMode=null,this.directionsLanguage=null,this.directionsLengthUnits=null,this.directionsSupportedLanguages=null,this.directionsTimeAttribute=null,this.hasZ=null,this.impedance=null,this.networkDataset=null,this.supportedTravelModes=null}readAccumulateAttributes(t){return t==null?null:t.map(o=>H.fromJSON(o))}writeAccumulateAttributes(t,o,i){t!=null&&t.length&&(o[i]=t.map(n=>H.toJSON(n)))}readDefaultTravelMode(t,o){var n,p;const i=((n=o.supportedTravelModes)==null?void 0:n.find(({id:l})=>l===o.defaultTravelMode))??((p=o.supportedTravelModes)==null?void 0:p.find(({itemId:l})=>l===o.defaultTravelMode));return i?Re.fromJSON(i):null}};r([s()],R.prototype,"accumulateAttributeNames",void 0),r([P("accumulateAttributeNames")],R.prototype,"readAccumulateAttributes",null),r([q("accumulateAttributeNames")],R.prototype,"writeAccumulateAttributes",null),r([s()],R.prototype,"attributeParameterValues",void 0),r([s()],R.prototype,"currentVersion",void 0),r([s()],R.prototype,"defaultTravelMode",void 0),r([P("defaultTravelMode",["defaultTravelMode","supportedTravelModes"])],R.prototype,"readDefaultTravelMode",null),r([s()],R.prototype,"directionsLanguage",void 0),r([I(Ye)],R.prototype,"directionsLengthUnits",void 0),r([s()],R.prototype,"directionsSupportedLanguages",void 0),r([I($e,{ignoreUnknown:!1})],R.prototype,"directionsTimeAttribute",void 0),r([s()],R.prototype,"hasZ",void 0),r([I(H,{ignoreUnknown:!1})],R.prototype,"impedance",void 0),r([s({type:Vt})],R.prototype,"networkDataset",void 0),r([s({type:[Re]})],R.prototype,"supportedTravelModes",void 0),R=r([A("esri.rest.support.NetworkServiceDescription")],R);const Kt=R,Ht=Ze.getLogger("esri.rest.networkService");function ue(e,t,o,i){i[o]=[t.length,t.length+e.length],e.forEach(n=>{t.push(n.geometry)})}function Qt(e,t){for(let o=0;o<t.length;o++){const i=e[t[o]];if(i&&i.length)for(const n of i)n.z=void 0}Ht.warnOnce(`The remote Network Analysis service is powered by a network dataset which is not Z-aware.
Z-coordinates of the input geometry are ignored.`)}function Yt(e,t){for(let o=0;o<t.length;o++){const i=e[t[o]];if(i&&i.length){for(const n of i)if(n!=null&&n.hasZ)return!0}}return!1}async function tt(e,t,o){if(!e)throw new M("network-service:missing-url","Url to Network service is missing");const i=fe({f:"json",token:t},o),{data:n}=await re(e,i),p=n.currentVersion>=10.4?er(e,t,o):Xt(e,o),{defaultTravelMode:l,supportedTravelModes:c}=await p;return n.defaultTravelMode=l,n.supportedTravelModes=c,Kt.fromJSON(n)}async function Xt(e,t){var w,d,a;const o=fe({f:"json"},t),{data:i}=await re(e.replace(/\/rest\/.*$/i,"/info"),o);if(!(i!=null&&i.owningSystemUrl))return{supportedTravelModes:[],defaultTravelMode:null};const{owningSystemUrl:n}=i,p=Se(n)+"/sharing/rest/portals/self",{data:l}=await re(p,o),c=at("helperServices.routingUtilities.url",l);if(!c)return{supportedTravelModes:[],defaultTravelMode:null};const v=ze(n),S=/\/solve$/i.test(v.path)?"Route":/\/solveclosestfacility$/i.test(v.path)?"ClosestFacility":"ServiceAreas",u=fe({f:"json",serviceName:S},t),b=Se(c)+"/GetTravelModes/execute",N=await re(b,u),B=[];let h=null;if((d=(w=N==null?void 0:N.data)==null?void 0:w.results)!=null&&d.length){const T=N.data.results;for(const f of T)if(f.paramName==="supportedTravelModes"){if((a=f.value)!=null&&a.features){for(const{attributes:$}of f.value.features)if($){const k=JSON.parse($.TravelMode);B.push(k)}}}else f.paramName==="defaultTravelMode"&&(h=f.value)}return{supportedTravelModes:B,defaultTravelMode:h}}async function er(e,t,o){try{const i=fe({f:"json",token:t},o),n=Se(e)+"/retrieveTravelModes",{data:{supportedTravelModes:p,defaultTravelMode:l}}=await re(n,i);return{supportedTravelModes:p,defaultTravelMode:l}}catch(i){throw new M("network-service:retrieveTravelModes","Could not get to the NAServer's retrieveTravelModes.",{error:i})}}const _e=new Ve({esriJobMessageTypeInformative:"informative",esriJobMessageTypeProcessDefinition:"process-definition",esriJobMessageTypeProcessStart:"process-start",esriJobMessageTypeProcessStop:"process-stop",esriJobMessageTypeWarning:"warning",esriJobMessageTypeError:"error",esriJobMessageTypeEmpty:"empty",esriJobMessageTypeAbort:"abort"});let ie=class extends O{constructor(t){super(t),this.description=null,this.type=null}};r([s({type:String,json:{write:!0}})],ie.prototype,"description",void 0),r([s({type:String,json:{read:_e.read,write:_e.write}})],ie.prototype,"type",void 0),ie=r([A("esri.rest.support.GPMessage")],ie);const tr=ie,xe=new Ve({0:"informative",1:"process-definition",2:"process-start",3:"process-stop",50:"warning",100:"error",101:"empty",200:"abort"});let de=class extends tr{constructor(t){super(t),this.type=null}};r([s({type:String,json:{read:xe.read,write:xe.write}})],de.prototype,"type",void 0),de=r([A("esri.rest.support.NAMessage")],de);const rr=de;let ne=class extends O{constructor(t){super(t)}};r([s({json:{read:{source:"string"}}})],ne.prototype,"text",void 0),r([I(kt,{name:"stringType"})],ne.prototype,"type",void 0),ne=r([A("esri.rest.support.DirectionsString")],ne);const rt=ne;let U=class extends O{constructor(t){super(t),this.arriveTime=null,this.arriveTimeOffset=null,this.geometry=null,this.strings=null}readArriveTimeOffset(t,o){return Jt(o.ETA,o.arriveTimeUTC)}readGeometry(t,o){return Ke.fromJSON(o.point)}};r([s({type:Date,json:{read:{source:"arriveTimeUTC"}}})],U.prototype,"arriveTime",void 0),r([s()],U.prototype,"arriveTimeOffset",void 0),r([P("arriveTimeOffset",["arriveTimeUTC","ETA"])],U.prototype,"readArriveTimeOffset",null),r([s({type:Ke})],U.prototype,"geometry",void 0),r([P("geometry",["point"])],U.prototype,"readGeometry",null),r([s({type:[rt]})],U.prototype,"strings",void 0),U=r([A("esri.rest.support.DirectionsEvent")],U);const or=U;function sr(e){if(e==null||e==="")return null;let t=0,o=0,i=0,n=0;const p=[];let l,c,v,S,u,b,N,B,h=0,w=0,d=0;if(u=e.match(/((\+|\-)[^\+\-\|]+|\|)/g),u||(u=[]),parseInt(u[h],32)===0){h=2;const a=parseInt(u[h],32);h++,b=parseInt(u[h],32),h++,1&a&&(w=u.indexOf("|")+1,N=parseInt(u[w],32),w++),2&a&&(d=u.indexOf("|",w)+1,B=parseInt(u[d],32),d++)}else b=parseInt(u[h],32),h++;for(;h<u.length&&u[h]!=="|";){l=parseInt(u[h],32)+t,h++,t=l,c=parseInt(u[h],32)+o,h++,o=c;const a=[l/b,c/b];w&&(S=parseInt(u[w],32)+i,w++,i=S,a.push(S/N)),d&&(v=parseInt(u[d],32)+n,d++,n=v,a.push(v/B)),p.push(a)}return{paths:[p],hasZ:w>0,hasM:d>0}}let Q=class extends K{constructor(e){super(e),this.events=null,this.strings=null}readGeometry(e,t){const o=sr(t.compressedGeometry);return o!=null?be.fromJSON(o):null}};r([s({type:[or]})],Q.prototype,"events",void 0),r([P("geometry",["compressedGeometry"])],Q.prototype,"readGeometry",null),r([s({type:[rt]})],Q.prototype,"strings",void 0),Q=r([A("esri.rest.support.DirectionsFeature")],Q);const ir=Q;function nr(e,t){if(e.length===0)return new be({spatialReference:t});const o=[];for(const l of e)for(const c of l.paths)o.push(...c);const i=[];o.forEach((l,c)=>{c!==0&&l[0]===o[c-1][0]&&l[1]===o[c-1][1]||i.push(l)});const{hasM:n,hasZ:p}=e[0];return new be({hasM:n,hasZ:p,paths:[i],spatialReference:t})}let L=class extends E{constructor(t){super(t),this.extent=null,this.features=[],this.geometryType="polyline",this.routeId=null,this.routeName=null,this.totalDriveTime=null,this.totalLength=null,this.totalTime=null}readFeatures(t,o){if(!t)return[];const i=o.summary.envelope.spatialReference??o.spatialReference,n=i&&W.fromJSON(i);return t.map(p=>{const l=ir.fromJSON(p);if(l.geometry!=null&&(l.geometry.spatialReference=n),l.events!=null)for(const c of l.events)c.geometry!=null&&(c.geometry.spatialReference=n);return l})}get mergedGeometry(){return this.features?nr(this.features.map(({geometry:t})=>t),this.extent.spatialReference):null}get strings(){return this.features.flatMap(({strings:t})=>t).filter(Qe)}};r([s({type:He,json:{read:{source:"summary.envelope"}}})],L.prototype,"extent",void 0),r([s({nonNullable:!0})],L.prototype,"features",void 0),r([P("features")],L.prototype,"readFeatures",null),r([s()],L.prototype,"geometryType",void 0),r([s({readOnly:!0})],L.prototype,"mergedGeometry",null),r([s()],L.prototype,"routeId",void 0),r([s()],L.prototype,"routeName",void 0),r([s({value:null,readOnly:!0})],L.prototype,"strings",null),r([s({json:{read:{source:"summary.totalDriveTime"}}})],L.prototype,"totalDriveTime",void 0),r([s({json:{read:{source:"summary.totalLength"}}})],L.prototype,"totalLength",void 0),r([s({json:{read:{source:"summary.totalTime"}}})],L.prototype,"totalTime",void 0),L=r([A("esri.rest.support.DirectionsFeatureSet")],L);const ar=L;let D=class extends O{constructor(t){super(t),this.directionLines=null,this.directionPoints=null,this.directions=null,this.route=null,this.routeName=null,this.stops=null,this.traversedEdges=null,this.traversedJunctions=null,this.traversedTurns=null}};r([s({type:E,json:{write:!0}})],D.prototype,"directionLines",void 0),r([s({type:E,json:{write:!0}})],D.prototype,"directionPoints",void 0),r([s({type:ar,json:{write:!0}})],D.prototype,"directions",void 0),r([s({type:K,json:{write:!0}})],D.prototype,"route",void 0),r([s({type:String,json:{write:!0}})],D.prototype,"routeName",void 0),r([s({type:[K],json:{write:!0}})],D.prototype,"stops",void 0),r([s({type:E,json:{write:!0}})],D.prototype,"traversedEdges",void 0),r([s({type:E,json:{write:!0}})],D.prototype,"traversedJunctions",void 0),r([s({type:E,json:{write:!0}})],D.prototype,"traversedTurns",void 0),D=r([A("esri.rest.support.RouteResult")],D);const lr=D;function ve(e){return e?E.fromJSON(e).features.filter(Qe):[]}let _=class extends O{constructor(t){super(t),this.messages=null,this.pointBarriers=null,this.polylineBarriers=null,this.polygonBarriers=null,this.routeResults=null}readPointBarriers(t,o){return ve(o.barriers)}readPolylineBarriers(t){return ve(t)}readPolygonBarriers(t){return ve(t)}};r([s({type:[rr]})],_.prototype,"messages",void 0),r([s({type:[K]})],_.prototype,"pointBarriers",void 0),r([P("pointBarriers",["barriers"])],_.prototype,"readPointBarriers",null),r([s({type:[K]})],_.prototype,"polylineBarriers",void 0),r([P("polylineBarriers")],_.prototype,"readPolylineBarriers",null),r([s({type:[K]})],_.prototype,"polygonBarriers",void 0),r([P("polygonBarriers")],_.prototype,"readPolygonBarriers",null),r([s({type:[lr]})],_.prototype,"routeResults",void 0),_=r([A("esri.rest.support.RouteSolveResult")],_);const ur=_;function pe(e){return e instanceof E}async function pr(e,t,o){const i=[],n=[],p={},l={},c=ze(e),{path:v}=c;pe(t.stops)&&ue(t.stops.features,n,"stops.features",p),pe(t.pointBarriers)&&ue(t.pointBarriers.features,n,"pointBarriers.features",p),pe(t.polylineBarriers)&&ue(t.polylineBarriers.features,n,"polylineBarriers.features",p),pe(t.polygonBarriers)&&ue(t.polygonBarriers.features,n,"polygonBarriers.features",p);const S=await lt(n);for(const B in p){const h=p[B];i.push(B),l[B]=S.slice(h[0],h[1])}if(Yt(l,i)){let B=null;try{B=await tt(v,t.apiKey,o)}catch{}B&&!B.hasZ&&Qt(l,i)}for(const B in l)l[B].forEach((h,w)=>{ut(t,B)[w].geometry=h});const u={...o,query:{...c.query,..._t(t),f:"json"}},b=v.endsWith("/solve")?v:`${v}/solve`,{data:N}=await re(b,u);return cr(N)}function cr(e){const{barriers:t,directionLines:o,directionPoints:i,directions:n,messages:p,polygonBarriers:l,polylineBarriers:c,routes:v,stops:S,traversedEdges:u,traversedJunctions:b,traversedTurns:N}=e,B=a=>{const T=w.find($=>$.routeName===a);if(T!=null)return T;const f={routeId:w.length+1,routeName:a};return w.push(f),f},h=a=>{const T=w.find($=>$.routeId===a);if(T!=null)return T;const f={routeId:a,routeName:null};return w.push(f),f},w=[];v==null||v.features.forEach((a,T)=>{a.geometry.spatialReference=v.spatialReference??void 0;const f=a.attributes.Name,$=T+1;w.push({routeId:$,routeName:f,route:a})}),n==null||n.forEach(a=>{const{routeName:T}=a;B(T).directions=a});const d=((S==null?void 0:S.features.every(a=>a.attributes.RouteName==null))??!1)&&w.length>0?w[0].routeName:null;return S==null||S.features.forEach(a=>{var $;a.geometry&&(($=a.geometry).spatialReference??($.spatialReference=S.spatialReference??void 0));const T=d??a.attributes.RouteName,f=B(T);f.stops??(f.stops=[]),f.stops.push(a)}),o==null||o.features.forEach(a=>{const T=a.attributes.RouteID,f=h(T),{geometryType:$,spatialReference:k}=o;f.directionLines??(f.directionLines={features:[],geometryType:$,spatialReference:k}),f.directionLines.features.push(a)}),i==null||i.features.forEach(a=>{const T=a.attributes.RouteID,f=h(T),{geometryType:$,spatialReference:k}=i;f.directionPoints??(f.directionPoints={features:[],geometryType:$,spatialReference:k}),f.directionPoints.features.push(a)}),u==null||u.features.forEach(a=>{const T=a.attributes.RouteID,f=h(T),{geometryType:$,spatialReference:k}=u;f.traversedEdges??(f.traversedEdges={features:[],geometryType:$,spatialReference:k}),f.traversedEdges.features.push(a)}),b==null||b.features.forEach(a=>{const T=a.attributes.RouteID,f=h(T),{geometryType:$,spatialReference:k}=b;f.traversedJunctions??(f.traversedJunctions={features:[],geometryType:$,spatialReference:k}),f.traversedJunctions.features.push(a)}),N==null||N.features.forEach(a=>{const T=a.attributes.RouteID,f=h(T);f.traversedTurns??(f.traversedTurns={features:[]}),f.traversedTurns.features.push(a)}),ur.fromJSON({routeResults:w,barriers:t,polygonBarriers:l,polylineBarriers:c,messages:p})}const yr={type:String,json:{read:{source:"token"},write:{target:"token"}}};let F=class extends Pe(O){constructor(e){super(e),this.doNotLocateOnRestrictedElements=null,this.geometry=null,this.geometryType=null,this.name=null,this.spatialRelationship=null,this.type="layer",this.where=null}};r([s({type:Boolean,json:{write:!0}})],F.prototype,"doNotLocateOnRestrictedElements",void 0),r([s({types:pt,json:{read:ct,write:!0}})],F.prototype,"geometry",void 0),r([I(xt)],F.prototype,"geometryType",void 0),r([s({type:String,json:{name:"layerName",write:!0}})],F.prototype,"name",void 0),r([I(Ft,{name:"spatialRel"})],F.prototype,"spatialRelationship",void 0),r([s({type:String,json:{write:!0}})],F.prototype,"type",void 0),r([s({type:String,json:{write:!0}})],F.prototype,"where",void 0),F=r([A("esri.rest.support.DataLayer")],F);const dr=F;var Te;let me=Te=class extends E{constructor(e){super(e),this.doNotLocateOnRestrictedElements=null}clone(){return new Te({doNotLocateOnRestrictedElements:this.doNotLocateOnRestrictedElements,...this.cloneProperties()})}};r([s({type:Boolean,json:{write:!0}})],me.prototype,"doNotLocateOnRestrictedElements",void 0),me=Te=r([A("esri.rest.support.NetworkFeatureSet")],me);const mr=me;let ae=class extends Pe(O){constructor(e){super(e),this.doNotLocateOnRestrictedElements=null,this.url=null}};r([s({type:Boolean,json:{write:!0}})],ae.prototype,"doNotLocateOnRestrictedElements",void 0),r([s({type:String,json:{write:!0}})],ae.prototype,"url",void 0),ae=r([A("esri.rest.support.NetworkUrl")],ae);const fr=ae;var Be;let y=Be=class extends Pe(O){constructor(e){super(e),this.accumulateAttributes=null,this.apiKey=null,this.attributeParameterValues=null,this.directionsLanguage=null,this.directionsLengthUnits=null,this.directionsOutputType=null,this.directionsStyleName=null,this.directionsTimeAttribute=null,this.findBestSequence=null,this.geometryPrecision=null,this.geometryPrecisionM=null,this.geometryPrecisionZ=null,this.ignoreInvalidLocations=null,this.impedanceAttribute=null,this.outputGeometryPrecision=null,this.outputGeometryPrecisionUnits=null,this.outputLines="true-shape",this.outSpatialReference=null,this.overrides=null,this.pointBarriers=null,this.polygonBarriers=null,this.polylineBarriers=null,this.preserveFirstStop=null,this.preserveLastStop=null,this.preserveObjectID=null,this.restrictionAttributes=null,this.restrictUTurns=null,this.returnBarriers=!1,this.returnDirections=!1,this.returnPolygonBarriers=!1,this.returnPolylineBarriers=!1,this.returnRoutes=!0,this.returnStops=!1,this.returnTraversedEdges=null,this.returnTraversedJunctions=null,this.returnTraversedTurns=null,this.returnZ=!0,this.startTime=null,this.startTimeIsUTC=!0,this.stops=null,this.timeWindowsAreUTC=null,this.travelMode=null,this.useHierarchy=null,this.useTimeWindows=null}static from(e){return yt(Be,e)}readAccumulateAttributes(e){return e==null?null:e.map(t=>H.fromJSON(t))}writeAccumulateAttributes(e,t,o){e!=null&&e.length&&(t[o]=e.map(i=>H.toJSON(i)))}writePointBarriers(e,t,o){ce(e,t,o)}writePolygonBarrier(e,t,o){ce(e,t,o)}writePolylineBarrier(e,t,o){ce(e,t,o)}readRestrictionAttributes(e){return e==null?null:e.map(t=>Je.fromJSON(t))}writeRestrictionAttributes(e,t,o){e!=null&&e.length&&(t[o]=e.map(i=>Je.toJSON(i)))}readStartTime(e,t){const{startTime:o}=t;return o==null?null:o==="now"?"now":new Date(o)}writeStartTime(e,t){e!=null&&(t.startTime=e==="now"?"now":e.getTime())}readStops(e,t){return Sr(t.stops)}writeStops(e,t,o){ce(e,t,o)}};r([s({type:[String],json:{name:"accumulateAttributeNames",write:!0}})],y.prototype,"accumulateAttributes",void 0),r([P("accumulateAttributes")],y.prototype,"readAccumulateAttributes",null),r([q("accumulateAttributes")],y.prototype,"writeAccumulateAttributes",null),r([s(yr)],y.prototype,"apiKey",void 0),r([s({json:{write:!0}})],y.prototype,"attributeParameterValues",void 0),r([s({type:String,json:{write:!0}})],y.prototype,"directionsLanguage",void 0),r([I(Ye)],y.prototype,"directionsLengthUnits",void 0),r([I(Et)],y.prototype,"directionsOutputType",void 0),r([I(Gt)],y.prototype,"directionsStyleName",void 0),r([I($e,{name:"directionsTimeAttributeName",ignoreUnknown:!1})],y.prototype,"directionsTimeAttribute",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"findBestSequence",void 0),r([s({type:Number,json:{write:!0}})],y.prototype,"geometryPrecision",void 0),r([s({type:Number,json:{write:!0}})],y.prototype,"geometryPrecisionM",void 0),r([s({type:Number,json:{write:!0}})],y.prototype,"geometryPrecisionZ",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"ignoreInvalidLocations",void 0),r([I(H,{name:"impedanceAttributeName",ignoreUnknown:!1})],y.prototype,"impedanceAttribute",void 0),r([s({type:Number,json:{write:!0}})],y.prototype,"outputGeometryPrecision",void 0),r([I(Ut)],y.prototype,"outputGeometryPrecisionUnits",void 0),r([I(qt)],y.prototype,"outputLines",void 0),r([s({type:W,json:{name:"outSR",write:!0}})],y.prototype,"outSpatialReference",void 0),r([s({json:{write:!0}})],y.prototype,"overrides",void 0),r([s({json:{name:"barriers",write:!0}})],y.prototype,"pointBarriers",void 0),r([q("pointBarriers")],y.prototype,"writePointBarriers",null),r([s({json:{write:!0}})],y.prototype,"polygonBarriers",void 0),r([q("polygonBarriers")],y.prototype,"writePolygonBarrier",null),r([s({json:{write:!0}})],y.prototype,"polylineBarriers",void 0),r([q("polylineBarriers")],y.prototype,"writePolylineBarrier",null),r([s({type:Boolean,json:{write:!0}})],y.prototype,"preserveFirstStop",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"preserveLastStop",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"preserveObjectID",void 0),r([s({type:[String],json:{name:"restrictionAttributeNames",write:!0}})],y.prototype,"restrictionAttributes",void 0),r([P("restrictionAttributes")],y.prototype,"readRestrictionAttributes",null),r([q("restrictionAttributes")],y.prototype,"writeRestrictionAttributes",null),r([I(Wt)],y.prototype,"restrictUTurns",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnBarriers",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnDirections",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnPolygonBarriers",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnPolylineBarriers",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnRoutes",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnStops",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnTraversedEdges",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnTraversedJunctions",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnTraversedTurns",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnZ",void 0),r([s({type:Date,json:{type:Number,write:!0}})],y.prototype,"startTime",void 0),r([P("startTime")],y.prototype,"readStartTime",null),r([q("startTime")],y.prototype,"writeStartTime",null),r([s({type:Boolean,json:{write:!0}})],y.prototype,"startTimeIsUTC",void 0),r([s({json:{write:!0}})],y.prototype,"stops",void 0),r([P("stops")],y.prototype,"readStops",null),r([q("stops")],y.prototype,"writeStops",null),r([s({type:Boolean,json:{write:!0}})],y.prototype,"timeWindowsAreUTC",void 0),r([s({type:Re,json:{write:!0}})],y.prototype,"travelMode",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"useHierarchy",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"useTimeWindows",void 0),y=Be=r([A("esri.rest.support.RouteParameters")],y);const Fe=y;function hr(e){return e&&"type"in e}function vr(e){return e&&"features"in e&&"doNotLocateOnRestrictedElements"in e}function wr(e){return e&&"url"in e}function gr(e){return e&&"features"in e}function Sr(e){return hr(e)?dr.fromJSON(e):wr(e)?fr.fromJSON(e):vr(e)?mr.fromJSON(e):gr(e)?E.fromJSON(e):null}function ce(e,t,o){e!=null&&(t[o]=j.isCollection(e)?{features:e.toArray().map(i=>i.toJSON())}:e.toJSON())}function we(e){return e.length?e:null}function Ne(e){switch(e){case"esriGeometryPoint":return{type:"esriSMS",style:"esriSMSCircle",size:12,color:[0,0,0,0],outline:Ne("esriGeometryPolyline")};case"esriGeometryPolyline":return{type:"esriSLS",style:"esriSLSSolid",width:1,color:[0,0,0,0]};case"esriGeometryPolygon":return{type:"esriSFS",style:"esriSFSNull",outline:Ne("esriGeometryPolyline")}}}function ye(e){return"layers"in e}function br(e){return e.declaredClass==="esri.rest.support.FeatureSet"}function Tr(e){return e.declaredClass==="esri.rest.support.NetworkFeatureSet"}function Br(e,t,o){var Ie,Ae,je,Le,Oe,De;const i=(Ie=t.networkDataset)==null?void 0:Ie.networkAttributes,n=(i==null?void 0:i.filter(({usageType:m})=>m==="cost"))??[],p=o.travelMode??t.defaultTravelMode;if(p==null)return void st.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:c}=p,v=n.find(({name:m})=>m===l),S=n.find(({name:m})=>m===c),u=((Ae=o.travelMode)==null?void 0:Ae.impedanceAttributeName)??o.impedanceAttribute??t.impedance,b=v==null?void 0:v.units,N=S==null?void 0:S.units;if(!b||!N)throw new M("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const B=o.directionsLanguage??t.directionsLanguage,h=o.accumulateAttributes??t.accumulateAttributeNames??[],w=new Set(n.filter(({name:m})=>m===l||m===c||m===u||m!=null&&h.includes(m)).map(({name:m})=>m)),d=m=>{for(const Me in m)w.has(Me)||delete m[Me]};for(const m of e.pointBarriers)m.costs!=null&&(m.addedCost=m.costs[u]??0,d(m.costs));for(const m of e.polygonBarriers)m.costs!=null&&(m.scaleFactor=m.costs[u]??1,d(m.costs));for(const m of e.polylineBarriers)m.costs!=null&&(m.scaleFactor=m.costs[u]??1,d(m.costs));const{routeInfo:a}=e,{findBestSequence:T,preserveFirstStop:f,preserveLastStop:$,startTimeIsUTC:k,timeWindowsAreUTC:it}=o;a.analysisSettings=new Zt({accumulateAttributes:h,directionsLanguage:B,findBestSequence:T,preserveFirstStop:f,preserveLastStop:$,startTimeIsUTC:k,timeWindowsAreUTC:it,travelMode:p}),a.totalDuration=V(((je=a.totalCosts)==null?void 0:je[l])??0,b),a.totalDistance=ge(((Le=a.totalCosts)==null?void 0:Le[c])??0,N),a.totalLateDuration=V(((Oe=a.totalViolations)==null?void 0:Oe[l])??0,b),a.totalWaitDuration=V(((De=a.totalWait)==null?void 0:De[l])??0,b),a.totalCosts!=null&&d(a.totalCosts),a.totalViolations!=null&&d(a.totalViolations),a.totalWait!=null&&d(a.totalWait);for(const m of e.stops)m.serviceCosts!=null&&(m.serviceDuration=V(m.serviceCosts[l]??0,b),m.serviceDistance=ge(m.serviceCosts[c]??0,N),d(m.serviceCosts)),m.cumulativeCosts!=null&&(m.cumulativeDuration=V(m.cumulativeCosts[l]??0,b),m.cumulativeDistance=ge(m.cumulativeCosts[c]??0,N),d(m.cumulativeCosts)),m.violations!=null&&(m.lateDuration=V(m.violations[l]??0,b),d(m.violations)),m.wait!=null&&(m.waitDuration=V(m.wait[l]??0,b),d(m.wait))}async function Ee(e){const t=W.WGS84;return await At(e.spatialReference,t),jt(e,t)}function V(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function ge(e,t){return t==="decimal-degrees"||t==="points"||t==="unknown"?e:Lt(e,t,"meters")}function Nr(e){const{attributes:t,geometry:o,popupTemplate:i,symbol:n}=e.toGraphic().toJSON();return{attributes:t,geometry:o,popupInfo:i,symbol:n}}const Pr=j.ofType(oe),$r=j.ofType(se),Ge=j.ofType(Y),Ue=j.ofType(X),qe=j.ofType(ee),We=j.ofType(te),ot="esri.layers.RouteLayer",st=Ze.getLogger(ot);let g=class extends dt(mt(ft(ht(vt(Ot))))){constructor(e){super(e),this._cachedServiceDescription=null,this._featureCollection=null,this._type="Feature Collection",this.defaultSymbols=new et,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new Ge,this.polygonBarriers=new Ue,this.polylineBarriers=new qe,this.routeInfo=null,this.spatialReference=W.WGS84,this.stops=new We,this.type="route";const t=()=>{this._setStopSymbol(this.stops)};this.addHandles(wt(()=>this.stops,"change",t,{sync:!0,onListenerAdd:t}))}writeFeatureCollectionWebmap(e,t,o,i){const n=[this._writePolygonBarriers(),this._writePolylineBarriers(),this._writePointBarriers(),this._writeRouteInfo(),this._writeDirectionLines(),this._writeDirectionPoints(),this._writeStops()].filter(c=>!!c),p=n.map((c,v)=>v),l=i.origin==="web-map"?"featureCollection.layers":"layers";gt(l,n,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=p}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",o=>oe.fromGraphic(o))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",o=>se.fromGraphic(o))}get fullExtent(){var n;const e=new He({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:W.WGS84});if(((n=this.routeInfo)==null?void 0:n.geometry)!=null)return this.routeInfo.geometry.extent??e;if(this.stops==null)return e;const t=this.stops.filter(p=>p.geometry!=null);if(t.length<2)return e;const{spatialReference:o}=t.at(0).geometry;if(o==null)return e;const i=t.toArray().map(p=>{const l=p.geometry;return[l.x,l.y]});return new St({points:i,spatialReference:o}).extent}readMaxScale(e,t){var n;const o=ye(t)?t.layers:(n=t.featureCollection)==null?void 0:n.layers,i=o==null?void 0:o.find(p=>p.layerDefinition.maxScale!=null);return(i==null?void 0:i.layerDefinition.maxScale)??0}readMinScale(e,t){var n;const o=ye(t)?t.layers:(n=t.featureCollection)==null?void 0:n.layers,i=o==null?void 0:o.find(p=>p.layerDefinition.minScale!=null);return(i==null?void 0:i.layerDefinition.minScale)??0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",o=>Y.fromGraphic(o))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",o=>X.fromGraphic(o))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",o=>ee.fromGraphic(o))}readRouteInfo(e,t){const o=this._getNetworkFeatures(t,"RouteInfo",i=>le.fromGraphic(i));return o.length>0?o.at(0):null}readSpatialReference(e,t){var c,v;const o=ye(t)?t.layers:(c=t.featureCollection)==null?void 0:c.layers;if(!(o!=null&&o.length))return W.WGS84;const{layerDefinition:i,featureSet:n}=o[0],p=n.features[0],l=((v=p==null?void 0:p.geometry)==null?void 0:v.spatialReference)??n.spatialReference??i.spatialReference??i.extent.spatialReference??Ce;return W.fromJSON(l)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",o=>te.fromGraphic(o),o=>this._setStopSymbol(o))}get title(){var e;return((e=this.routeInfo)==null?void 0:e.name)!=null?this.routeInfo.name:"Route"}set title(e){this._overrideIfSome("title",e)}get url(){return ke.routeServiceUrl}set url(e){e!=null?this._set("url",bt(e,st)):this._set("url",ke.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(){this.directionLines!=null&&(this.directionLines.removeAll(),this._set("directionLines",null)),this.directionPoints!=null&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),this.routeInfo!=null&&this._set("routeInfo",null)}async save(){await this.load();const{fullExtent:e,portalItem:t}=this;if(!t)throw new M("routelayer:portal-item-not-set","save() requires to the layer to have a portal item");if(!t.id)throw new M("routelayer:portal-item-not-saved","Please use saveAs() first to save the routelayer");if(t.type!=="Feature Collection")throw new M("routelayer:portal-item-wrong-type",'Portal item needs to have type "Feature Collection"');if(this.routeInfo==null)throw new M("routelayer:route-unsolved","save() requires a solved route");const{portal:o}=t;await o.signIn(),o.user||await t.reload();const{itemUrl:i,itemControl:n}=t;if(n!=="admin"&&n!=="update")throw new M("routelayer:insufficient-permissions","To save this layer, you need to be the owner or an administrator of your organization");const p={messages:[],origin:"portal-item",portal:o,url:i?Tt(i):void 0,writtenProperties:[]},l=this.write(void 0,p);return t.extent=await Ee(e),t.title=this.title,await t.update({data:l}),t}async saveAs(e,t={}){var c;if(await this.load(),this.routeInfo==null)throw new M("routelayer:route-unsolved","saveAs() requires a solved route");const o=Bt.from(e).clone();o.extent??(o.extent=await Ee(this.fullExtent)),o.id=null,o.portal??(o.portal=Nt.getDefault()),o.title??(o.title=this.title),o.type="Feature Collection",o.typeKeywords=["Data","Feature Collection",Pt.MULTI_LAYER,"Route Layer"];const{portal:i}=o,n={messages:[],origin:"portal-item",portal:i,url:null,writtenProperties:[]};await i.signIn();const p=t==null?void 0:t.folder,l=this.write(void 0,n);return await((c=i.user)==null?void 0:c.addItem({item:o,folder:p,data:l})),this.portalItem=o,Dt(n),n.portalItem=o,o}async solve(e,t){const o=(e==null?void 0:e.stops)??this.stops,i=(e==null?void 0:e.pointBarriers)??we(this.pointBarriers),n=(e==null?void 0:e.polylineBarriers)??we(this.polylineBarriers),p=(e==null?void 0:e.polygonBarriers)??we(this.polygonBarriers);if(o==null)throw new M("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if((br(o)||Tr(o))&&o.features.length<2||j.isCollection(o)&&o.length<2)throw new M("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");if(j.isCollection(o))for(const d of o)d.routeName=null;const l=e==null?void 0:e.apiKey,c=this.url,v=await this._getServiceDescription(c,l,t),S=(e==null?void 0:e.travelMode)??v.defaultTravelMode,u=(e==null?void 0:e.accumulateAttributes)??[];S!=null&&(u.push(S.distanceAttributeName),S.timeAttributeName&&u.push(S.timeAttributeName));const b={startTime:new Date},N={accumulateAttributes:u,directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:i,polylineBarriers:n,polygonBarriers:p,preserveFirstStop:!0,preserveLastStop:!0,returnBarriers:!!i,returnDirections:!0,returnPolygonBarriers:!!p,returnPolylineBarriers:!!n,returnRoutes:!0,returnStops:!0,stops:o},B=e?Fe.from(e):new Fe;for(const d in b)B[d]==null&&(B[d]=b[d]);let h;B.set(N);try{h=await pr(c,B,t)}catch(d){throw $t(d)?d:new M("routelayer:failed-route-request","the routing request failed",{error:d})}const w=this._toRouteLayerSolution(h);return this._isOverridden("title")||(this.title=w.routeInfo.name??"Route"),Br(w,v,B),w}update(e){const{stops:t,directionLines:o,directionPoints:i,pointBarriers:n,polylineBarriers:p,polygonBarriers:l,routeInfo:c}=e;this.set({stops:t,pointBarriers:n,polylineBarriers:p,polygonBarriers:l}),this._set("directionLines",o),this._set("directionPoints",i),this._set("routeInfo",c),c.geometry!=null&&(this.spatialReference=c.geometry.spatialReference)}_getNetworkFeatures(e,t,o,i){var w;const n=ye(e)?e.layers:(w=e.featureCollection)==null?void 0:w.layers,p=n==null?void 0:n.find(d=>d.layerDefinition.name===t);if(p==null)return new j;const{layerDefinition:l,popupInfo:c,featureSet:v}=p,S=l.drawingInfo.renderer,{features:u}=v,b=v.spatialReference??l.spatialReference??l.extent.spatialReference??Ce,N=S&&Rt(S),B=W.fromJSON(b),h=u.map(d=>{const a=K.fromJSON(d);a.geometry!=null&&d.geometry!=null&&d.geometry.spatialReference==null&&(a.geometry.spatialReference=B);const T=o(a);return T.symbol??(T.symbol=(N==null?void 0:N.getSymbol(a))??this._getNetworkSymbol(t)),T.popupTemplate??(T.popupTemplate=c&&It.fromJSON(c)),T});return i&&h.some(d=>!d.symbol)&&i(h),new j(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}}async _getServiceDescription(e,t,o){if(this._cachedServiceDescription!=null&&this._cachedServiceDescription.url===e)return this._cachedServiceDescription.serviceDescription;const i=await tt(e,t,o);return this._cachedServiceDescription={serviceDescription:i,url:e},i}_setStopSymbol(e){if(!e||e.length===0||this.defaultSymbols.stops==null||e.every(({symbol:u})=>u!=null))return;const{first:t,last:o,middle:i,unlocated:n,waypoint:p,break:l}=this.defaultSymbols.stops;if(this.routeInfo==null||e.length===1)return void e.forEach((u,b)=>{switch(b){case 0:u.symbol=t;break;case e.length-1:u.symbol=o;break;default:u.symbol=i}});const c=e.map(({sequence:u})=>u).filter(u=>u!=null),v=Math.min(...c),S=Math.max(...c);for(const u of e)u.sequence!==v?u.sequence!==S?u.status==="ok"||u.status==="not-located-on-closest"?u.locationType!=="waypoint"?u.locationType!=="break"?u.symbol=i:u.symbol=l:u.symbol=p:u.symbol=n:u.symbol=o:u.symbol=t}_toRouteLayerSolution(e){var S,u,b,N,B,h,w;const t=(S=e.routeResults[0].stops)==null?void 0:S.map(d=>te.fromJSON(d.toJSON()));this._setStopSymbol(t);const o=new We(t),i=new Ue((u=e.polygonBarriers)==null?void 0:u.map(d=>{const a=X.fromJSON(d.toJSON());return a.symbol=this.defaultSymbols.polygonBarriers,a})),n=new qe((b=e.polylineBarriers)==null?void 0:b.map(d=>{const a=ee.fromJSON(d.toJSON());return a.symbol=this.defaultSymbols.polylineBarriers,a})),p=new Ge((N=e.pointBarriers)==null?void 0:N.map(d=>{const a=Y.fromJSON(d.toJSON());return a.symbol=this.defaultSymbols.pointBarriers,a})),l=(B=e.routeResults[0].route)==null?void 0:B.toJSON(),c=le.fromJSON(l);c.symbol=this.defaultSymbols.routeInfo;const v=new $r((h=e.routeResults[0].directionPoints)==null?void 0:h.features.map(d=>{const a=se.fromJSON(d.toJSON());return a.symbol=this.defaultSymbols.directionPoints,a}));return{directionLines:new Pr((w=e.routeResults[0].directionLines)==null?void 0:w.features.map(d=>{const a=oe.fromJSON(d.toJSON());return a.symbol=this.defaultSymbols.directionLines,a})),directionPoints:v,pointBarriers:p,polygonBarriers:i,polylineBarriers:n,routeInfo:c,stops:o}}_writeDirectionLines(){return this._writeNetworkFeatures(this.directionLines,this.defaultSymbols.directionLines,"esriGeometryPolyline",oe.fields,oe.popupInfo,"DirectionLines","Direction Lines")}_writeDirectionPoints(){return this._writeNetworkFeatures(this.directionPoints,this.defaultSymbols.directionPoints,"esriGeometryPoint",se.fields,se.popupInfo,"DirectionPoints","Direction Points")}_writeNetworkFeatures(e,t,o,i,n,p,l){if(!(e!=null&&e.length))return null;const c=this.spatialReference.toJSON(),{fullExtent:v,maxScale:S,minScale:u}=this;return{featureSet:{features:e.toArray().map(b=>Nr(b)),geometryType:o,spatialReference:c},layerDefinition:{capabilities:"Query,Update,Editing",drawingInfo:{renderer:{type:"simple",symbol:t!=null?t.toJSON():Ne(o)}},extent:v.toJSON(),fields:i,geometryType:o,hasM:!1,hasZ:!1,maxScale:S,minScale:u,name:p,objectIdField:"ObjectID",spatialReference:c,title:l,type:"Feature Layer",typeIdField:""},popupInfo:n}}_writePointBarriers(){return this._writeNetworkFeatures(this.pointBarriers,this.defaultSymbols.pointBarriers,"esriGeometryPoint",Y.fields,Y.popupInfo,"Barriers","Point Barriers")}_writePolygonBarriers(){return this._writeNetworkFeatures(this.polygonBarriers,this.defaultSymbols.polygonBarriers,"esriGeometryPolygon",X.fields,X.popupInfo,"PolygonBarriers","Polygon Barriers")}_writePolylineBarriers(){return this._writeNetworkFeatures(this.polylineBarriers,this.defaultSymbols.polylineBarriers,"esriGeometryPolyline",ee.fields,ee.popupInfo,"PolylineBarriers","Line Barriers")}_writeRouteInfo(){return this._writeNetworkFeatures(this.routeInfo!=null?new j([this.routeInfo]):null,this.defaultSymbols.routeInfo,"esriGeometryPolyline",le.fields,le.popupInfo,"RouteInfo","Route Details")}_writeStops(){var p,l,c;const e=this._writeNetworkFeatures(this.stops,null,"esriGeometryPoint",te.fields,te.popupInfo,"Stops","Stops");if(e==null)return null;const{stops:t}=this.defaultSymbols,o=(p=t==null?void 0:t.first)==null?void 0:p.toJSON(),i=(l=t==null?void 0:t.middle)==null?void 0:l.toJSON(),n=(c=t==null?void 0:t.last)==null?void 0:c.toJSON();return e.layerDefinition.drawingInfo.renderer={type:"uniqueValue",field1:"Sequence",defaultSymbol:i,uniqueValueInfos:[{value:"1",symbol:o,label:"First Stop"},{value:`${this.stops.length}`,symbol:n,label:"Last Stop"}]},e}};r([s({readOnly:!0,json:{read:!1,origins:{"portal-item":{write:{allowNull:!0,ignoreOrigin:!0}},"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:this.portalItem==null}}}}}}})],g.prototype,"_featureCollection",void 0),r([q(["web-map","portal-item"],"_featureCollection")],g.prototype,"writeFeatureCollectionWebmap",null),r([s({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:this.portalItem!=null}}}}}}})],g.prototype,"_type",void 0),r([s({nonNullable:!0,type:et})],g.prototype,"defaultSymbols",void 0),r([s({readOnly:!0})],g.prototype,"directionLines",void 0),r([P(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],g.prototype,"readDirectionLines",null),r([s({readOnly:!0})],g.prototype,"directionPoints",void 0),r([P(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],g.prototype,"readDirectionPoints",null),r([s({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],g.prototype,"featureCollectionType",void 0),r([s({readOnly:!0})],g.prototype,"fullExtent",null),r([s({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],g.prototype,"legendEnabled",void 0),r([s({type:["show","hide"]})],g.prototype,"listMode",void 0),r([s({type:Number,nonNullable:!0,json:{write:!1}})],g.prototype,"maxScale",void 0),r([P(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],g.prototype,"readMaxScale",null),r([s({type:Number,nonNullable:!0,json:{write:!1}})],g.prototype,"minScale",void 0),r([P(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],g.prototype,"readMinScale",null),r([s({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],g.prototype,"operationalLayerType",void 0),r([s({nonNullable:!0,type:j.ofType(Y)})],g.prototype,"pointBarriers",void 0),r([P(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],g.prototype,"readPointBarriers",null),r([s({nonNullable:!0,type:j.ofType(X)})],g.prototype,"polygonBarriers",void 0),r([P(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],g.prototype,"readPolygonBarriers",null),r([s({nonNullable:!0,type:j.ofType(ee)})],g.prototype,"polylineBarriers",void 0),r([P(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],g.prototype,"readPolylineBarriers",null),r([s({readOnly:!0})],g.prototype,"routeInfo",void 0),r([P(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],g.prototype,"readRouteInfo",null),r([s({type:W})],g.prototype,"spatialReference",void 0),r([P(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],g.prototype,"readSpatialReference",null),r([s({nonNullable:!0,type:j.ofType(te)})],g.prototype,"stops",void 0),r([P(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],g.prototype,"readStops",null),r([s()],g.prototype,"title",null),r([s({readOnly:!0,json:{read:!1}})],g.prototype,"type",void 0),r([s()],g.prototype,"url",null),g=r([A(ot)],g);const Ur=g;export{Ur as default};