@arcgis/core 4.33.0-next.20250501 → 4.33.0-next.20250503
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.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{0219c3f9408d3fa3c9a0.js → 03ee9d0407c230b885ed.js} +1 -1
- package/assets/esri/core/workers/chunks/{de16b771d2c8d816c738.js → 05c80002c37002ac99e8.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d40c4783f58af1ae0dc.js → 0e8181e7fc1386d08ffc.js} +1 -1
- package/assets/esri/core/workers/chunks/{96e5d192c8d23c1e324f.js → 13e68c43acc8916520db.js} +1 -1
- package/assets/esri/core/workers/chunks/{e6a5911ea21bef32834b.js → 1bc22af4cc4effcbcf2b.js} +1 -1
- package/assets/esri/core/workers/chunks/{84f972d7851d982701a0.js → 1ca7e0d519ecbfe6976f.js} +1 -1
- package/assets/esri/core/workers/chunks/{9b2ab27159500315fbc1.js → 26850ec0917ee355ddb7.js} +1 -1
- package/assets/esri/core/workers/chunks/{1bd4fe77ba6fb25322e7.js → 29e2b105f55adafc3a6d.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d63dfa5a60c88e03b28.js → 2c77a543a174e5bc736a.js} +1 -1
- package/assets/esri/core/workers/chunks/{d0ddf4f1c6a351b447c7.js → 30d7d2c7d6e9e5e2ecb9.js} +1 -1
- package/assets/esri/core/workers/chunks/3fb25912b274f264c84e.js +1 -0
- package/assets/esri/core/workers/chunks/{febae745a29a17ca130a.js → 4480e4b61affb3b2e9d6.js} +1 -1
- package/assets/esri/core/workers/chunks/{4d4a271351fd288277d2.js → 49085a0b3a74e158f32f.js} +1 -1
- package/assets/esri/core/workers/chunks/{392e64a573f67817db02.js → 4cb199b547e5b97e65fb.js} +1 -1
- package/assets/esri/core/workers/chunks/4df36ee2406861c7afa8.js +1 -0
- package/assets/esri/core/workers/chunks/{9652cfd4668b95036c87.js → 532088a72c3ddc50f3be.js} +1 -1
- package/assets/esri/core/workers/chunks/{ba917175ca2a6681501e.js → 563594357f3648652a5c.js} +1 -1
- package/assets/esri/core/workers/chunks/{abfc5f9ac16c3e885c5f.js → 56db71ea7eb8a5652d98.js} +1 -1
- package/assets/esri/core/workers/chunks/{e56647e61296643c5f84.js → 5719471414810b6a9aec.js} +1 -1
- package/assets/esri/core/workers/chunks/{235efd948ae470a6f238.js → 60b1365d25581ccf0485.js} +1 -1
- package/assets/esri/core/workers/chunks/{3795793643f4db64af0e.js → 63c25455b9cf1b3df76a.js} +1 -1
- package/assets/esri/core/workers/chunks/{909be86782af3deb448e.js → 654fe135d41af81daa13.js} +1 -1
- package/assets/esri/core/workers/chunks/{cd9343c78a7c3acdbbcd.js → 681b2662f6ce936afd7e.js} +1 -1
- package/assets/esri/core/workers/chunks/{65f2b22d8fc12e6d4a87.js → 7000d9158da929a16071.js} +1 -1
- package/assets/esri/core/workers/chunks/{7551011117c3d36ff3db.js → 743cdbff5c4616ddc2b4.js} +1 -1
- package/assets/esri/core/workers/chunks/{968956284f44187f0622.js → 8540fb31bd0b29ff1906.js} +1 -1
- package/assets/esri/core/workers/chunks/8c5cea49e48f8858f115.js +1 -0
- package/assets/esri/core/workers/chunks/{237a965bd41ba8903e03.js → 921c040d0497031fd8ff.js} +1 -1
- package/assets/esri/core/workers/chunks/{96d2a0777f5c418055fb.js → 92b48e3365d1cc933113.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d485c07848164099859.js → 95a4da3150ad8e8e36d8.js} +1 -1
- package/assets/esri/core/workers/chunks/{46fb6ba8900286d18b6f.js → 9d564f79b82d427fc1da.js} +1 -1
- package/assets/esri/core/workers/chunks/{00612d6e05b1c8647668.js → 9fff43ffcd5602ccc50f.js} +1 -1
- package/assets/esri/core/workers/chunks/{653ff3e631fea8ad393a.js → a0db1f3ca29e34dfa16f.js} +12 -12
- package/assets/esri/core/workers/chunks/{1cc5c566e68f2255d035.js → a6ca68ef6311ffc365b2.js} +1 -1
- package/assets/esri/core/workers/chunks/{5a51c75a2932d9da001a.js → a8d043b73e087bee7c40.js} +1 -1
- package/assets/esri/core/workers/chunks/{581180668e0229dcdc14.js → bf190d672dcbaedc1a41.js} +1 -1
- package/assets/esri/core/workers/chunks/{ebfa4a0334401f5e004a.js → c12765e0c8b44e349c2a.js} +1 -1
- package/assets/esri/core/workers/chunks/{afddb94ff4e1a70022c7.js → c3b2b05996e2008adbe3.js} +1 -1
- package/assets/esri/core/workers/chunks/{4fb4884d2de42792abe3.js → d1a9e8db5ba403abe721.js} +1 -1
- package/assets/esri/core/workers/chunks/d35cd309ba7bb8968a22.js +1 -0
- package/assets/esri/core/workers/chunks/{6e6422eda398774acbc7.js → d60da671aba70485050e.js} +1 -1
- package/assets/esri/core/workers/chunks/{7a8df1225abd54ff68ed.js → db298b292a4e43cba72d.js} +1 -1
- package/assets/esri/core/workers/chunks/{2bda2cfc6e81818d7d33.js → dcaeb57c69d432118604.js} +1 -1
- package/assets/esri/core/workers/chunks/{fb455fd89b74b70a6a2b.js → e613df03ceb39e29befa.js} +1 -1
- package/assets/esri/core/workers/chunks/{05d7d8ff3e4cbad32580.js → e8dcaa7837b6fe7bff20.js} +1 -1
- package/assets/esri/core/workers/chunks/ec1a4b82cbc44ba45f83.js +1 -0
- package/assets/esri/core/workers/chunks/ec778cc7a55068f51937.js +1 -0
- package/assets/esri/core/workers/chunks/{51339193abddfe37745d.js → f2b63597ae956db74eb3.js} +1 -1
- package/assets/esri/geometry/support/pe-wasm.wasm +0 -0
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +14 -1
- package/assets/esri/themes/base/widgets/_SelectionList.scss +34 -0
- package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +6 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList.json +1 -1
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_en.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_en.json +1 -1
- package/chunks/Bufferer-CicaNej1.js +1 -1
- package/chunks/Distance2DCalculator-C1KHhZwD.js +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/Envelope2D.js +1 -1
- package/chunks/GeodeticDistanceCalculator-CcF1gMZX.js +1 -1
- package/chunks/Geometry.js +1 -1
- package/chunks/GeometryCleaner-BEJM7I4l.js +1 -1
- package/chunks/OperatorClip.js +1 -1
- package/chunks/OperatorCrosses.js +1 -1
- package/chunks/OperatorCut.js +1 -1
- package/chunks/OperatorGeneralize.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
- package/chunks/OperatorGeodeticDistance.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorIntersects.js +1 -1
- package/chunks/OperatorMultiPartToSinglePart.js +1 -1
- package/chunks/OperatorOverlaps.js +1 -1
- package/chunks/OperatorProximity.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/OperatorSimplifyOGC.js +1 -1
- package/chunks/OperatorTouches.js +1 -1
- package/chunks/OperatorWithin.js +1 -1
- package/chunks/Point2D.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/SideCalculator2D-BNwb5gvz.js +1 -1
- package/chunks/Transformation2D.js +1 -1
- package/chunks/containsOperator.js +1 -1
- package/chunks/disjointOperator.js +1 -1
- package/chunks/equalsOperator.js +1 -1
- package/chunks/pe-wasm.js +1 -1
- package/chunks/pe.js +1 -1
- package/geometry/coordinateFormatter.js +1 -1
- package/geometry/operators/extendOperator.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorAutoComplete.js +1 -1
- package/geometry/operators/gx/operatorBuffer.js +1 -1
- package/geometry/operators/gx/operatorDifference.js +1 -1
- package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
- package/geometry/operators/gx/operatorIntegrate.js +1 -1
- package/geometry/operators/gx/operatorIntersection.js +1 -1
- package/geometry/operators/gx/operatorLabelPoint.js +1 -1
- package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
- package/geometry/operators/gx/operatorLocateBetween.js +1 -1
- package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/gx/operatorSimplify.js +1 -1
- package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
- package/geometry/operators/gx/operatorUnion.js +1 -1
- package/geometry/operators/isNearOperator.js +1 -1
- package/geometry/operators/json/containsOperator.js +1 -1
- package/geometry/operators/json/disjointOperator.js +1 -1
- package/geometry/operators/reshapeOperator.js +1 -1
- package/geometry/operators/support/apiConverter.js +1 -1
- package/geometry/operators/support/initNoPeFactory.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/WKIDUnitConversion.js +1 -1
- package/interfaces.d.ts +31 -0
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/utils.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/layers/DrapedSubView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
- package/views/3d/support/StreamTextureCollection.js +1 -1
- package/views/3d/support/TextureCollection.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
- package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
- package/views/3d/webgl-engine/parts/Model.js +1 -1
- package/widgets/Directions/css.js +5 -0
- package/widgets/Directions.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +5 -0
- package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
- package/widgets/OrientedImageryViewer/css.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/OrientedImageryViewer/mixins/SketchHandlerMixin.js +1 -1
- package/widgets/OrientedImageryViewer/mixins/TriangulatedImageMeasurementMixin.js +5 -0
- package/widgets/OrientedImageryViewer/mixins/TriangulatedSketchHandlerMixin.js +5 -0
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/support/SelectionList/LayerItem.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList/VisibleElements.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
- package/widgets/support/SelectionToolbar/VisibleElements.js +5 -0
- package/widgets/support/SelectionToolbar.js +1 -1
- package/widgets/support/Selector2D/SelectionOperation.js +1 -1
- package/assets/esri/core/workers/chunks/11b55e7e76e50fe11bbe.js +0 -1
- package/assets/esri/core/workers/chunks/7bfa18dd8771d4932533.js +0 -1
- package/assets/esri/core/workers/chunks/84d7ed2cf5fe23a0888f.js +0 -1
- package/assets/esri/core/workers/chunks/86931186095c23e47c0c.js +0 -1
- package/assets/esri/core/workers/chunks/a79511b926a2830bb160.js +0 -1
- package/assets/esri/core/workers/chunks/e3ef0451dcdc2e966628.js +0 -1
- package/views/3d/webgl-engine/lib/ContentObject.js +0 -5
- package/views/3d/webgl-engine/lib/ContentObjectType.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Evented.js";import"../../../../core/has.js";import{disposeMaybe as i,removeMaybe as r}from"../../../../core/maybe.js";import{generateUID as n}from"../../../../core/uid.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as o,s as l}from"../../../../chunks/vec42.js";import{ZEROS as _,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Evented.js";import"../../../../core/has.js";import{disposeMaybe as i,removeMaybe as r}from"../../../../core/maybe.js";import{generateUID as n}from"../../../../core/uid.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as o,s as l}from"../../../../chunks/vec42.js";import{ZEROS as _,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{textTextureAtlas as d}from"./testUtils.js";import{applyTextureResizeModuloCeil as u}from"./textureUtils.js";import{TaskPriority as m}from"../../../support/Scheduler.js";import{Yield as p}from"../../../support/Yield.js";import{TextureWrapMode as g,TextureSamplingMode as f}from"../../../webgl/enums.js";import{Texture as x}from"../../../webgl/Texture.js";import{TextureDescriptor as v}from"../../../webgl/TextureDescriptor.js";const w=4096;let T=class extends t{constructor(e){super(e),this.id=n(),this.events=new s,this._glTexture=null,this._atlas=new b(256,256),this._needsRepack=!1,this._canRepack=!0,this._elementsToRender=new Map,this._elements=new Map,this._uvCallbacks=new Map,this.updating=!1}initialize(){this._canvas=document.createElement("canvas"),this._canvas.setAttribute("id","textAtlasCanvas"),this._canvas.setAttribute("style","display:none"),this._ctx=this._canvas.getContext("2d"),this._stage=this.view.stage,this._stage.addTexture(this),this._updateCanvasElementSize(this._atlas),this._reset()}unload(){this._glTexture=i(this._glTexture),this._frameWorker=r(this._frameWorker),this.updating=!1,this.events.emit("unloaded")}get loaded(){return null!=this._glTexture}get glTexture(){return this._glTexture}static get maxSize(){return C=d.stableRendering?k:0,[w-k-C,w-k-C-R]}load(e){if(this._glTexture)return this._glTexture;const t=new v;return t.wrapMode=g.CLAMP_TO_EDGE,t.samplingMode=f.LINEAR_MIPMAP_LINEAR,t.hasMipmap=!0,t.preMultiplyAlpha=!0,t.maxAnisotropy=e.parameters.maxMaxAnisotropy,this._glTexture=new x(e,t,this._canvas),this._frameWorker=this.view.resourceController.scheduler.registerTask(m.TEXT_TEXTURE_ATLAS,this),this.setDirty(),this._glTexture}dispose(){this._elements.clear(),this._elementsToRender.clear(),this._frameWorker=r(this._frameWorker),this._glTexture&&(this._stage.removeTexture(this),this._glTexture=i(this._glTexture)),this._canvas.width=0,this._canvas.height=0,this._canvas=null,this._ctx=null}_updateCanvasElementSize(e){this._canvas.width=e.width,this._canvas.height=e.height}_resizeAtlas(e,t){const{width:s,height:i}=this._atlas;s===e&&i===t||(this._atlas.width=e,this._atlas.height=t,this._glTexture?.resize(e,t),this._glTexture?.updateData(0,0,0,s,i,this._canvas),this._updateCanvasElementSize(this._atlas),this._elements.forEach((e=>this._uvCallbacks.get(e.textRenderer.key)?.forEach((t=>t(e.uv))))),this._reset())}_reset(){this._elementsToRender.clear(),this._atlas.reset(),this._needsRepack=!0,this.setDirty()}_addAtlasElement(e,t,s,i){const r=this._atlas;if(r.width<s||r.height<i)return!1;let n=r.cursors.get(i);if(!n){if(r.height<r.nextY+i)return!1;n=[new A(r.nextY)],r.cursors.set(i,n),r.nextY+=i}let h=n.find((e=>r.width>=e.x+s));if(null==h){if(r.height<r.nextY+i)return!1;h=new A(r.nextY),r.nextY+=i,n.push(h)}return e.setNewPosition(h),this._elements.set(t,e),this._elementsToRender.set(t,e),h.x+=s,!0}_ensureCallbacks(e){const t=this._uvCallbacks.get(e);if(t)return t;const s=new Set;return this._uvCallbacks.set(e,s),s}_addCallback(e,t){this._ensureCallbacks(e).add(t)}_removeCallback(e,t){const s=this._uvCallbacks.get(e);return!(!s?.delete(t)||0!==s.size)&&(this._uvCallbacks.delete(e),!0)}_processAddition(e){const t=e.textRenderer.key;if(this._needsRepack)return void this._elements.set(t,e);const s=this._atlas,i=e.textRenderer.renderedWidth,r=e.textRenderer.renderedHeight,n=i+k,h=r+k+R;if(!this._addAtlasElement(e,t,n,h)){if(this._canRepack)this._reset();else if(s.width<n){const e=u(Math.max(n,1.5*s.width),w);this._resizeAtlas(e,s.height)}else{const e=s.nextY+h,t=u(Math.max(e,1.5*s.height),w);if(t>s.height)this._resizeAtlas(s.width,t);else if(s.width<w){const e=u(1.5*s.width,w);this._resizeAtlas(e,s.height)}}this._elements.set(t,e)}}_renderElement(e){const t=e.commitNewPosition(),s=e.textRenderer;this._ctx.clearRect(t[0]-k,t[1]-k,s.renderedWidth+2*k,s.renderedHeight+2*k),s.render(this._ctx,t[0],t[1]),this._uvCallbacks.get(s.key)?.forEach((t=>t(e.uv)))}get running(){return this.updating}runTask(e){if(null==this._glTexture)return p;for(;this._needsRepack&&(this._canRepack||this._atlas.height<w&&this._atlas.height<w);){this._canRepack=this._needsRepack=!1;const t=this._elements;this._elements=new Map,t.forEach((e=>this._processAddition(e))),e.madeProgress()}if(this._elementsToRender.size>0){for(const[t,s]of this._elementsToRender){if(e.done)break;this._renderElement(s),this._elementsToRender.delete(t),e.madeProgress()}this._glTexture.setData(this._canvas)}this.updating=this._elementsToRender.size>0}addText(e,t){const s=e.key;this._addCallback(s,t);let i=this._elements.get(s);return i?o(i.uv,_)||t(i.uv):(i=new y(e),this._processAddition(i),this.setDirty()),{remove:()=>this._removeText(e,t)}}_removeText(e,t){const s=e.key;this._elements.get(s)&&this._removeCallback(s,t)&&(this._elements.delete(s),this._elementsToRender.delete(s),this._canRepack=!0)}setDirty(){this._glTexture&&(this.updating=!0)}get test(){}};e([h({constructOnly:!0})],T.prototype,"view",void 0),e([h({type:Boolean})],T.prototype,"updating",void 0),T=e([a("esri.views.3d.webgl-engine.lib.TextTextureAtlas")],T);const k=2,R=2;class y{constructor(e){this.textRenderer=e,this._uv=c(),this._newPosition=[0,0]}get uv(){if(null==this._xOffset||null==this._yOffset)return _;const{renderedWidth:e,renderedHeight:t}=this.textRenderer;return l(this._uv,this._xOffset,this._yOffset+t,this._xOffset+e,this._yOffset)}setNewPosition(e){this._newPosition[0]=e.x,this._newPosition[1]=e.y}commitNewPosition(){return this._xOffset=this._newPosition[0],this._yOffset=this._newPosition[1],this._newPosition}get xOffset(){return this._xOffset}get yOffset(){return this._yOffset}}class b{constructor(e,t){this.width=e,this.height=t,this.cursors=new Map,this.nextY=0}reset(){this.cursors.clear(),this.nextY=C}}class A{constructor(e){this.y=e,this.x=C}}let C=0;export{T as TextTextureAtlas};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import e from"../../../../core/Error.js";import t from"../../../../core/Evented.js";import{disposeMaybe as r,removeMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as i,onAbort as a,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as n,isArrayBuffer as l}from"../../../../core/typedArrayUtil.js";import{isBlobProtocol as
|
|
5
|
+
import"../../../../core/has.js";import e from"../../../../core/Error.js";import t from"../../../../core/Evented.js";import{disposeMaybe as r,removeMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as i,onAbort as a,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as n,isArrayBuffer as l}from"../../../../core/typedArrayUtil.js";import{generateUID as m}from"../../../../core/uid.js";import{isBlobProtocol as h,isDataProtocol as p}from"../../../../core/urlUtils.js";import{whenVideoPlayable as d}from"../../../../layers/support/videoUtils.js";import{requestImage as _}from"../../../../support/requestImageUtils.js";import{loadImageAsync as u}from"../../../../support/requestUtils.js";import{TextureEncodingMimeType as c}from"./basicInterfaces.js";import{createTextureKTX2 as g,createTextureBasis as T,estimateMemoryKTX2 as E,estimateMemoryBasis as f}from"./BasisUtil.js";import{createDDSTexture as x}from"./DDSUtil.js";import{ensureImageMaxSize as y}from"./textureUtils.js";import{assert as A}from"./Util.js";import{TextureWrapMode as D,TextureSamplingMode as I,PixelFormat as F}from"../../../webgl/enums.js";import{Texture as M}from"../../../webgl/Texture.js";import{TextureDescriptor as w}from"../../../webgl/TextureDescriptor.js";class C{constructor(e,r){this._data=e,this.id=m(),this.events=new t,this._parameters={...N,...r},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e)}_startPreloadVideoElement(e){if(!(h(e.src)||"auto"===e.preload&&e.crossOrigin)){e.preload="auto",e.crossOrigin="anonymous";const t=e.paused;if(e.src=e.src,t&&e.autoplay){const t=[];d(e,(e=>t.push(e))).then((()=>{e.play()})).finally((()=>t.forEach((e=>e.remove()))))}}}_startPreloadImageElement(e){p(e.src)||h(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const t=new w;return t.wrapMode=this._parameters.wrap??D.REPEAT,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?I.LINEAR_MIPMAP_LINEAR:I.LINEAR,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t}get glTexture(){return this._glTexture??this._emptyTexture}get loaded(){return null!=this._glTexture}get usedMemory(){return this._glTexture?.usedMemory||L(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._glTexture)return this._glTexture;const t=this._data;return null==t?(this._glTexture=new M(e,this._createDescriptor(e),null),this._glTexture):(this._emptyTexture=e.emptyTexture,this._parameters.reloadable||(this._data=void 0),"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):n(t)&&this._parameters.encoding===c.DDS_ENCODING?this._loadFromDDSData(e,t):l(t)&&this._parameters.encoding===c.DDS_ENCODING?this._loadFromDDSData(e,new Uint8Array(t)):(l(t)||n(t))&&this._parameters.encoding===c.KTX2_ENCODING?this._loadFromKTX2(e,t):(l(t)||n(t))&&this._parameters.encoding===c.BASIS_ENCODING?this._loadFromBasis(e,t):n(t)?this._loadFromPixelData(e,t):l(t)?this._loadFromPixelData(e,new Uint8Array(t)):null)}_update(e,t){return null==this._glTexture||e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._glTexture.setData(e),this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._glTexture=x(e,this._createDescriptor(e),t),this._emptyTexture=null,this._glTexture}_loadFromKTX2(e,t){return this._loadAsync((()=>g(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromBasis(e,t){return this._loadAsync((()=>T(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromPixelData(e,t){A(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return r.pixelFormat=1===this._parameters.components?F.LUMINANCE:3===this._parameters.components?F.RGB:F.RGBA,r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._glTexture=new M(e,r,t),this._glTexture}_loadFromURL(e,t){return this._loadAsync((async r=>{const s=await _(t,{signal:r});return i(r),this._loadFromImage(e,s)}))}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync((async r=>{const s=await u(t,t.src,!1,r);return i(r),this._loadFromImage(e,s)}))}_loadFromVideoElement(e,t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(t,r){return this._loadAsync((i=>new Promise(((n,l)=>{const m=()=>{r.removeEventListener("loadeddata",h),r.removeEventListener("error",p),s(d)},h=()=>{r.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(m(),n(this._loadFromImage(t,r)))},p=t=>{m(),l(t||new e("texture:load-error","Failed to load video"))};r.addEventListener("loadeddata",h),r.addEventListener("error",p);const d=a(i,(()=>p(o())))}))))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=y(r,e.parameters));const s=P(r);this._parameters.width=s.width,this._parameters.height=s.height;const i=this._createDescriptor(e);return i.pixelFormat=3===this._parameters.components?F.RGB:F.RGBA,i.width=s.width,i.height=s.height,i.compressionHandle=this._parameters.compressionHandle,i.compressionCallback=this._parameters.compressionCallback,this._glTexture=new M(e,i,r),this._emptyTexture=null,this.events.emit("loaded"),this._glTexture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const s=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(s,s),r}unload(){if(this._glTexture=r(this._glTexture),this._emptyTexture=null,null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function L(e,t){if(null==e)return 0;if(l(e)||n(e))return t.encoding===c.KTX2_ENCODING?E(e,!!t.mipmap):t.encoding===c.BASIS_ENCODING?f(e,!!t.mipmap):e.byteLength;const{width:r,height:s}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?P(e):t;return(t.mipmap?4/3:1)*r*s*(t.components||4)||0}function P(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const N={wrap:{s:D.REPEAT,t:D.REPEAT},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};export{C as Texture};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import s from"../../../../core/Logger.js";import{isPromiseLike as o,isAbortError as i}from"../../../../core/promiseUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import s from"../../../../core/Logger.js";import{isPromiseLike as o,isAbortError as i}from"../../../../core/promiseUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{RenderRequestType as a}from"./basicInterfaces.js";import{isUpdatableTexture as d}from"./ITexture.js";import{TextureUpdater as l}from"./TextureUpdater.js";import{TaskPriority as h}from"../../../support/Scheduler.js";let p=class extends t{constructor(e){super({}),this._stage=e,this._textures=new Map,this._loadingCount=0,this.events=new r,this.updater=new l,this._frameTask=e.view.resourceController.scheduler.registerTask(h.TEXTURE_UNLOAD)}normalizeCtorArgs(){return{}}destroy(){this._frameTask.remove(),this._stage.forEachTexture((e=>e.unload()))}get updating(){return this._loadingCount>0||this._frameTask.updating}acquire(e){const t=this._textures.get(e);return t?(t.ref(),t.loadingPromise??t):this._createNewRef(e)}update(){this.updater.run()&&this.events.emit("changed",a.BACKGROUND)}_createNewRef(e){const t=this._stage.getTexture(e);if(null==t)return null;const r=t.events.on("unloaded",(()=>{r.remove(),this._onTextureUnloaded(t)})),n=new c(e,(()=>{this._frameTask.schedule((()=>{n.isUnreferenced&&t.unload()}))}));return this._textures.set(e,n),n.ref(),t.loaded?(this._updateGLTexture(n,t.glTexture),d(t)&&this.updater.add(t),n):(this._loadingCount++,n.loadingPromise=this._stage.schedule((()=>{const e=t.load(this._stage.renderView.renderingContext),r=e=>(this._loadingCount--,n.loadingPromise=null,this._updateGLTexture(n,e),d(t)&&this.updater.add(t),n),u=e=>(this._loadingCount--,n.loadingPromise=null,i(e)||s.getLogger(this).error(e),null);return o(e)?e.then(r,u):r(e)})),n.loadingPromise)}_updateGLTexture(e,t){e.glTexture=t,this.events.emit("changed",a.UPDATE)}_onTextureUnloaded(e){this._textures.delete(e.id),this.updater.remove(e)}};e([n()],p.prototype,"_loadingCount",void 0),e([n()],p.prototype,"_frameTask",void 0),e([n()],p.prototype,"updating",null),p=e([u("esri.views.3d.webgl-engine.lib.TextureRepository")],p);class c{constructor(e,t){this.id=e,this._release=t,this._refCount=0}get isUnreferenced(){return 0===this._refCount}ref(){++this._refCount}release(){--this._refCount,this._refCount>0||(0!==this._refCount?(s.getLogger("esri.views.3d.webgl-engine.lib.TextureRepository.RefCountedTextureImpl").error("Cannot dereference texture that has no references!"),this._refCount=0):this._release())}}export{p as TextureRepository};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{removeUnordered as e}from"../../../../core/arrayUtils.js";import{toConst as t}from"../../../../core/compilerUtils.js";import s from"../../../../core/Evented.js";import i from"../../../../core/Handles.js";import"../../../../core/has.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{
|
|
5
|
+
import{removeUnordered as e}from"../../../../core/arrayUtils.js";import{toConst as t}from"../../../../core/compilerUtils.js";import s from"../../../../core/Evented.js";import i from"../../../../core/Handles.js";import"../../../../core/has.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{generateUID as r}from"../../../../core/uid.js";import{DirtyEventNames as h}from"./DirtyEvents.js";import c from"./Octree.js";import{UpdatePolicy as d}from"./UpdatePolicy.js";class l{constructor(e,t,o=""){this.stage=e,this.apiLayerViewUid=o,this.id=r(),this.events=new s,this.visible=!0,this.sliceable=!1,this._objectsAdded=new Array,this._handles=new i,this._objects=new Map,this._pickable=!0,this.visible=t?.visible??!0,this._pickable=t?.pickable??!0,this.updatePolicy=t?.updatePolicy??d.ASYNC,e.addLayer(this);for(const s of h)this._handles.add(this.events.on(s,(t=>e.handleEvent(s,t))))}destroy(){this._handles.size&&(this._handles.destroy(),this.stage.removeLayer(this),this.invalidateSpatialQueryAccelerator())}get objects(){return this._objects}getObject(e){return t(this._objects.get(e))}set pickable(e){this._pickable=e}get pickable(){return this._pickable&&this.visible}add(e){this._objects.set(e.id,e),e.layer=this,this.events.emit("layerObjectAdded",e),null!=this._octree&&this._objectsAdded.push(e)}remove(t){this._objects.delete(t.id)&&(this.events.emit("layerObjectRemoved",t),t.layer=null,null!=this._octree&&(e(this._objectsAdded,t)||this._octree.remove([t])))}addMany(e){for(const t of e)this._objects.set(t.id,t),t.layer=this;this.events.emit("layerObjectsAdded",e),null!=this._octree&&this._objectsAdded.push(...e)}removeMany(t){const s=new Array;for(const e of t)this._objects.delete(e.id)&&s.push(e);if(0!==s.length&&(this.events.emit("layerObjectsRemoved",s),s.forEach((e=>e.layer=null)),null!=this._octree)){for(let t=0;t<s.length;)e(this._objectsAdded,s[t])?(s[t]=s[s.length-1],s.length-=1):++t;this._octree.remove(s)}}sync(){this.updatePolicy!==d.SYNC&&this.stage.syncLayer(this.id)}notifyObjectBBChanged(e,t){null==this._octree||this._objectsAdded.includes(e)||this._octree.update(e,t)}getSpatialQueryAccelerator(){return null==this._octree&&this._objects.size>50?(this._octree=new c((e=>e.boundingVolumeWorldSpace.bounds)),this._octree.add(this._objects.values())):null!=this._octree&&this._objectsAdded.length>0&&(this._octree.add(this._objectsAdded),this._objectsAdded.length=0),this._octree}invalidateSpatialQueryAccelerator(){this._octree=o(this._octree),this._objectsAdded.length=0}get test(){}}export{l as WebGLLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as i}from"../../../../chunks/sphere.js";import{GridLocalOriginFactory as a}from"../lib/GridLocalOriginFactory.js";import n from"../lib/ModelDirtySet.js";import{RenderGeometry as d}from"../lib/RenderGeometry.js";import{assert as c}from"../lib/Util.js";let l=class extends t{constructor(){super(...arguments),this.dirtySet=new n({model:this}),this._originFactory=new a(null),this._textures=new Map,this._layers=new Map}hasTexture(e){return this._textures.has(e.id)}getTexture(e){return null==e?null:this._textures.get(e)}addTexture(e){const t=e.id;c(!this._textures.has(t),"Model/Stage already contains texture to be added"),this._textures.set(t,e)}removeTexture(e){return this._textures.delete(e.id)}addTextures(e){for(const t of e)t&&(c(!this._textures.has(t.id),"Model/Stage already contains object to be added"),this._textures.set(t.id,t))}removeTextures(e){for(const t of e)t&&(c(this._textures.has(t.id),"Model/Stage doesn't contain object to be removed"),this._textures.delete(t.id))}forEachTexture(e){this._textures.forEach((t=>e(t)))}hasLayer(e){return this._layers.has(e.id)}getLayer(e){return null==e?null:this._layers.get(e)}addLayer(e){const t=e.id;c(!this._layers.has(t),"Model/Stage already contains layer to be added"),this._layers.set(t,e)}removeLayer(e){return this._layers.delete(e.id)}getRenderGeometry(e,t){const r=new d(t,{castShadow:e.castShadow,objectShaderTransformation:e.shaderTransformation}),o=t.localOrigin;return r.transformation=e.getCombinedStaticTransformation(t,u),r.localOrigin=o??this._originFactory.getOrigin(i(r.boundingSphere)),r}updateRenderGeometryTransformation(e,t,r){if(null==e)return!1;r.transformation=e.getCombinedStaticTransformation(t,u);const o=this._originFactory.getOrigin(i(r.boundingSphere));return r.localOrigin!==o}get test(){}};e([r({constructOnly:!0})],l.prototype,"dirtySet",void 0),l=e([o("esri.views.3d.webgl-engine.parts.Model")],l);const u=s();export{l as Model};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
const e="esri-directions",o={base:e,accordion:`${e}__accordion`,actionContainer:`${e}__action-container`,addStopButton:`${e}__add-stop-button`,departureTime:`${e}__departure-time`,departureTimeOptions:`${e}__departure-time-options`,directionsHeader:`${e}__directions-header`,directionsHeaderStopName:`${e}__directions-header-stop-name`,editRouteButton:`${e}__edit-route-button`,editFooter:`${e}__edit-footer`,editToolbar:`${e}__edit-toolbar`,editToolbarContainer:`${e}__edit-toolbar-container`,flexColumn:`${e}__flex-column`,flexRow:`${e}__flex-row`,folder:`${e}__folder`,folderHome:`${e}__folder-home`,headerStops:`${e}__header-stops`,labelEmphasize:`${e}__label-emphasize`,labelNoBottomMargin:`${e}__label-no-bottom-margin`,marginInlineMedium:`${e}__margin-inline-medium`,optimizeSection:`${e}__optimize-section`,optimizeSwitches:`${e}__optimize-switches`,paddingMedium:`${e}__padding-medium`,primaryFlowItem:`${e}__primary-flow-item`,primaryFooter:`${e}__primary-footer`,primaryFooterCentered:`${e}__primary-footer-centered`,primaryFooterLoader:`${e}__primary-footer-loader`,routeItem:`${e}__route-item`,routeItemButton:`${e}__route-item-button`,routeItemButtonContent:`${e}__route-item-button-content`,routeItemLabel:`${e}__route-item-label`,routeItemDescription:`${e}__route-item-description`,saveError:`${e}__save-error`,saveErrorIcon:`${e}__save-error-icon`,saveErrorLabel:`${e}__save-error-label`,saveProcessLoader:`${e}__save-process-loader`,selectedFeatureContainer:`${e}__selected-feature-container`,separator:`${e}__separator`,solveRoute:`${e}__solve-route`,stopContainer:`${e}__stop-container`,stopList:`${e}__stop-list`,stopItem:`${e}__stop-item`};export{o as css};
|
package/widgets/Directions.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{isSome as t}from"../core/arrayUtils.js";import i from"../core/Collection.js";import{makeHandle as s}from"../core/handleUtils.js";import{destroyMaybe as o}from"../core/maybe.js";import{debounce as r,isAbortError as a}from"../core/promiseUtils.js";import{watch as n,initial as l,on as c}from"../core/reactiveUtils.js";import{escapeRegExpString as d}from"../core/string.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import h from"../portal/Portal.js";import{defaultUnitPropertyMetadata as u}from"../properties/defaultUnit.js";import v from"../rest/support/Stop.js";import _ from"../symbols/SimpleMarkerSymbol.js";import g from"./Search.js";import w from"./Widget.js";import{DirectionsSearchTool as y}from"./Directions/DirectionsSearchTool.js";import b from"./Directions/DirectionsViewModel.js";import f from"./Directions/DirectionsVisibleElements.js";import{formatDistance as S,formatDuration as M,DepartureTimeOption as k,getIconName as I}from"./Directions/support/directionsUtils.js";import{isArcGISWorldGeocoder as F,meteredArcGISLocatorUrl as T}from"./Search/support/locatorUtils.js";import{loadCalciteComponents as x}from"./support/componentsUtils.js";import{globalCss as D}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as E}from"./support/decorators/messageBundle.js";import{tsx as $}from"./support/jsxFactory.js";function C(e){const{branchName:i,displayText:s,exitName:o,intersectingName:r,name:a,towardName:n}=e;if(null==s)return null;const l=[i,o,r,a,n].filter(t).sort(((e,t)=>t.length-e.length)).map((e=>d(e)));if(!l.length)return s;const c=new RegExp(l.join("|"),"g"),m=s.matchAll(c);let p=0;const h=[];for(const{0:t,index:d}of m)h.push(s.slice(p,d),$("span",{class:R.labelEmphasize,key:`maneuver-${d}`},t)),p=d+t.length;return h.push(s.slice(p)),$("span",null,h)}const L="esri-directions",R={base:L,accordion:`${L}__accordion`,actionContainer:`${L}__action-container`,addStopButton:`${L}__add-stop-button`,departureTime:`${L}__departure-time`,departureTimeOptions:`${L}__departure-time-options`,directionsHeader:`${L}__directions-header`,directionsHeaderStopName:`${L}__directions-header-stop-name`,editFooter:`${L}__edit-footer`,editToolbar:`${L}__edit-toolbar`,editToolbarContainer:`${L}__edit-toolbar-container`,flexColumn:`${L}__flex-column`,flexRow:`${L}__flex-row`,headerStops:`${L}__header-stops`,labelEmphasize:`${L}__label-emphasize`,labelNoBottomMargin:`${L}__label-no-bottom-margin`,marginInlineMedium:`${L}__margin-inline-medium`,optimizeSection:`${L}__optimize-section`,optimizeSwitches:`${L}__optimize-switches`,paddingMedium:`${L}__padding-medium`,primaryFlowItem:`${L}__primary-flow-item`,primaryFooter:`${L}__primary-footer`,primaryFooterCentered:`${L}__primary-footer-centered`,primaryFooterLoader:`${L}__primary-footer-loader`,routeItem:`${L}__route-item`,routeItemButton:`${L}__route-item-button`,routeItemButtonContent:`${L}__route-item-button-content`,routeItemLabel:`${L}__route-item-label`,routeItemDescription:`${L}__route-item-description`,saveError:`${L}__save-error`,saveErrorIcon:`${L}__save-error-icon`,saveErrorLabel:`${L}__save-error-label`,saveProcessLoader:`${L}__save-process-loader`,selectedFeatureContainer:`${L}__selected-feature-container`,separator:`${L}__separator`,solveRoute:`${L}__solve-route`,stopContainer:`${L}__stop-container`,stopList:`${L}__stop-list`,stopItem:`${L}__stop-item`};let A=class extends w{constructor(e,t){super(e,t),this._activeManeuver=null,this._placeholderStops=new i([new v,new v]),this._portalFolderCombobox=null,this._portalFolders=null,this._portalItemNameInput=null,this._portalUserName=null,this._sections=null,this._stopsToSearches=new Map,this._currentFlowItem="primary",this._parentFlowItem="primary",this._saveState="initialized",this._searchTool=null,this.headingLevel=2,this.messages=null,this.messagesUnits=null,this.searchProperties=null,this.viewModel=new b,this.visibleElements=new f,this._solveRouteDebounced=r((()=>this._solveRoute()))}initialize(){this.addHandles([n((()=>this.viewModel.layer),(()=>{try{this.viewModel.load()}catch{}}),l),n((()=>this.viewModel.layer?.routeInfo),(()=>{this._sections=this._getStopSections()}),l),n((()=>this.viewModel.layer?.stops.toArray()),(e=>{e&&this.view?.activeTool&&this._searchTool&&this.view.activeTool===this._searchTool&&!e.includes(this._searchTool.stop)&&(this.view.tools.remove(this._searchTool),this._searchTool=null)}))])}loadDependencies(){return x({accordion:()=>import("@esri/calcite-components/dist/components/calcite-accordion"),"accordion-item":()=>import("@esri/calcite-components/dist/components/calcite-accordion-item"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"block-section":()=>import("@esri/calcite-components/dist/components/calcite-block-section"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch")})}destroy(){this._stopsToSearches.forEach(o)}get apiKey(){return this.viewModel.apiKey}set apiKey(e){this.viewModel.apiKey=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"right"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get lastRoute(){return this.viewModel.lastRoute}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxStops(){return this.viewModel.maxStops}set maxStops(e){this.viewModel.maxStops=e}get unit(){return this.defaultUnit}set unit(e){this._overrideIfSome("unit",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}acquireSearch(e){const{view:t}=this.viewModel;if(this._stopsToSearches.has(e)){const i=this._stopsToSearches.get(e);return i.view=t,this._overrideDefaultSources(i),i}const i=new g({icon:!1,popupEnabled:!1,resultGraphicEnabled:!1,view:t,...this.searchProperties});return this._normalizeSearchSources(i),this.addHandles([c((()=>i.allSources),"change",(()=>this._normalizeSearchSources(i))),i.on("search-clear",(()=>{e.geometry=null,e.name=null,this.viewModel.layer?.removeResult()})),i.on("select-result",(()=>{const t=i.selectedResult;e.geometry=t?.feature.geometry,e.name=t?.name,this._solveRouteDebounced()})),n((()=>i.searchTerm),(t=>{e.name=t}))],i),this._stopsToSearches.set(e,i),i}getDirections(){return this.viewModel.getDirections()}render(){return $("div",{class:this.classes(R.base,D.widget,D.panel)},$("calcite-flow",null,this._renderPrimaryFlowItem(),this._renderDirectionsFlowItem(),this._renderEditFlowItem(),this._renderSaveFlowItem()))}save(){return this.viewModel.save()}saveAs(e,t={}){return this.viewModel.saveAs(e,t)}zoomToRoute(){return this.viewModel.zoomToRoute()}_applyLocatorSourceOverrides({allSources:e}){for(const t of e)"url"in t&&t.url&&(t.locationType??="street",F(t.url)&&this.apiKey&&null==t.apiKey&&(t.apiKey=this.apiKey,t.url=T))}_disposeSearch(e){if(!e||!this._stopsToSearches.has(e))return;const t=this._stopsToSearches.get(e);this.removeHandles(t),t.destroy(),this._stopsToSearches.delete(e)}_getEffectiveStops(){return this.viewModel.layer?.stops??this._placeholderStops}_getErrorDescription(){switch(this.viewModel.lastError?.name){case"directions-view-model:unable-to-route":return this.messages.errors.unableToRoute;case"directions-view-model:service-metadata-unavailable":return this.messages.errors.unableToLoadServiceMetadata;default:return this.messages.errors.unknownError}}_getNetworkFeatureName(e){switch(e.type){case"stop":switch(e.locationType){case"stop":default:return this.messages.networkFeatures.stops.stop;case"waypoint":return this.messages.networkFeatures.stops.waypoint;case"break":return this.messages.networkFeatures.stops.break}case"point-barrier":return this.messages.networkFeatures.pointBarrier;case"polyline-barrier":return this.messages.networkFeatures.polylineBarrier;case"polygon-barrier":return this.messages.networkFeatures.polygonBarrier}}_getRouteCostSummary(){const e=this.viewModel.layer?.routeInfo;if(!e)return null;const t=e.totalDistance??0,i=e.totalDuration??0,{messagesUnits:s,unit:o}=this;return{distance:S(s,t,o),duration:M(i)}}_getStopSections(){if(!this.viewModel.layer)return null;const{directionPoints:e,directionLines:t,stops:i}=this.viewModel.layer;if(!e||!t)return null;const s=[];let o=null;for(const r of e){const{objectId:e,stopId:a}=r;if(null!=a){const e=i.find((({objectId:e})=>e===a));o&&o.stop===e||(o={stop:e,directions:[]},s.push(o));continue}if(null==o)continue;const n=t.find((({directionPointId:t})=>t===e));null!=n&&o.directions.push({directionPoint:r,directionLine:n})}return s}_handleLocateStopAction(e){const{view:t}=this;if(!t)return;const i="directions-search-tool";this.removeHandles(i),this._searchTool=new y({stop:e,view:t}),this.addHandles([this._searchTool.on("click",(async t=>{if(t.mapPoint&&this._stopsToSearches.has(e)){const i=this._stopsToSearches.get(e),s=await i.search(t.mapPoint),o=s?.results?.[0].results?.[0];if(o){const{feature:t,name:s}=o;i.searchTerm=s,e.geometry=t.geometry}}this.removeHandles(i)})),s((()=>{this._searchTool&&(this.view?.tools.remove(this._searchTool),this._searchTool=null)}))],i),t.addAndActivateTool(this._searchTool)}_handleEditingDoneClick(){this.viewModel.stopEditing(),this._currentFlowItem="primary"}async _handleSaveLayerAsAction(){const e=h.getDefault();try{await e.signIn()}catch(t){if(a(t)||"identity-manager:user-aborted"===t.name)return;return this._parentFlowItem=this._currentFlowItem,this._currentFlowItem="save",void(this._saveState="connect-to-portal-error")}this._saveState="fetch-portal-information",this._parentFlowItem=this._currentFlowItem,this._currentFlowItem="save",this._portalUserName=e.user?.username;try{this._portalFolders=await(e.user?.fetchFolders())}catch{return void(this._saveState="fetch-portal-information-error")}this._saveState="save-layer"}_normalizeSearchSources(e){this._overrideDefaultSources(e),this._applyLocatorSourceOverrides(e)}_overrideDefaultSources(e){for(const t of e.viewModel.defaultSources)t.autoNavigate=!1}_renderClearRouteAction(e){return $("calcite-action",{icon:"trash",key:"clear-route",onclick:()=>{this._currentFlowItem="primary",this.viewModel.reset()},...e,text:this.messages.common.clear,textEnabled:!0})}_renderDeleteStopAction(e){const t=this._getEffectiveStops();return $("calcite-action",{icon:"trash",onclick:()=>{t.remove(e),this._disposeSearch(e),this._solveRouteDebounced()},scale:"s",slot:"actions-end",text:this.messages.deleteStop,title:this.messages.deleteStop})}_renderDepartureTime(){const{DEPART_AT:e,NOW:t,UNSPECIFIED:i}=k;return $("calcite-label",{class:R.departureTime,key:"departure-time"},this.messages.departureTime,$("calcite-combobox",{clearDisabled:!0,label:this.messages.departureTime,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{const{selectedItems:t}=e;t.length&&(this.viewModel.departureOption=t[0].value,this._solveRouteDebounced())}},$("calcite-combobox-item",{heading:this.messages.leaveNow,key:t,label:this.messages.leaveNow,selected:this.viewModel.departureOption===t,value:t}),$("calcite-combobox-item",{heading:this.messages.departAt,key:e,label:this.messages.departAt,selected:this.viewModel.departureOption===e,value:e}),$("calcite-combobox-item",{heading:this.messages.timeUnspecified,key:i,label:this.messages.timeUnspecified,selected:this.viewModel.departureOption===i,value:i})))}_renderDepartureTimeOptions(){return this.viewModel.departureOption!==k.DEPART_AT?null:$("div",{class:R.departureTimeOptions},$("calcite-input-date-picker",{scale:"s",value:this.viewModel.departureIsoDate,onCalciteInputDatePickerChange:({currentTarget:{value:e}})=>{Array.isArray(e)||(this.viewModel.departureIsoDate=e,this._solveRouteDebounced())}}),$("calcite-input-time-picker",{scale:"s",value:this.viewModel.departureIsoTime,onCalciteInputTimePickerClose:({currentTarget:{value:e}})=>{this.viewModel.departureIsoTime=e,this._solveRouteDebounced()}}))}_renderDirectionsFlowItem(){if("directions"!==this._currentFlowItem)return null;const e=this._getRouteCostSummary();if(!this._sections||!e)return null;const{distance:t,duration:i}=e,{formattedEta:s}=this.viewModel,o=this._sections.at(0)?.stop.name??"",r=this._sections.at(-1)?.stop.name??"";return $("calcite-flow-item",{key:"directions-flow-item",overlayPositioning:"fixed",selected:"directions"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this._currentFlowItem="primary"}},$("div",{class:R.directionsHeader,slot:"header-content"},$("div",{class:R.headerStops},$("span",null,this.messages.from)," ",$("span",{class:R.directionsHeaderStopName},o),$("span",null,this.messages.to)," ",$("span",{class:R.directionsHeaderStopName},r)),$("div",{class:R.flexColumn},$("span",null,`${i} (${t})`),s?$("span",null,s):null)),this._renderRouteLayerActions({slot:"header-menu-actions"}),$("calcite-accordion",{class:R.accordion,iconPosition:"start",selectionMode:"single"},this._sections.map(((e,t)=>{const{stop:i,directions:s}=e,{name:o}=i;return $("calcite-accordion-item",{expanded:0===t,heading:o??"",key:`stop-${t}`},$("calcite-action",{icon:"zoom-to-object",onclick:()=>{this.viewModel.centerAt(i)},slot:"actions-end",text:this.messages.panToStop}),this._renderDirectionTurns(s))}))))}_renderDirectionTurns(e){return $("calcite-list",{label:this.messages.drivingDirections,selectionMode:"none"},e.map(((e,t)=>{const{directionPoint:i,directionLine:s}=e,{distance:o,duration:r}=s,a=S(this.messagesUnits,o??0,this.unit),n=M(r??0),l=a&&n?`${a} | ${n}`:`${a||n}`,c=C(i),d=I(i.directionPointType);return $("calcite-list-item",{class:R.labelNoBottomMargin,key:`driving-direction-${t}`,onpointerenter:()=>{this.viewModel.highlight(s)},onpointerleave:()=>{this.viewModel.clearHighlights()},onCalciteListItemSelect:()=>{this._activeManeuver===s?this.zoomToRoute():(this._activeManeuver=s,this.viewModel.centerAt(s.geometry))}},$("calcite-icon",{icon:d,slot:"content-start"}),$("div",{slot:"content"},$("calcite-label",{layout:"inline",scale:"s"},c),$("calcite-label",{layout:"inline",scale:"s"},l)))})))}_renderEditFlowItem(){return"edit"!==this._currentFlowItem?null:$("calcite-flow-item",{heading:this.messages.editRoute,headingLevel:this.headingLevel,key:"edit-flow-item",loading:"routing"===this.viewModel.state,selected:"edit"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this.viewModel.stopEditing(),this._currentFlowItem="primary"}},$("div",{class:R.flexColumn,key:"edit-container"},$("div",{class:R.editToolbarContainer},$("calcite-label",{layout:"inline",scale:"s"},this.messages.automaticallySolve,$("calcite-switch",{checked:this.viewModel.autoSolve,scale:"s",onCalciteSwitchChange:e=>{this.viewModel.autoSolve=e.target.checked}})),$("div",{class:R.editToolbar},$("calcite-action",{icon:"flag",onclick:()=>{this.viewModel.create("stop")},scale:"s",text:this.messages.networkFeatures.stops.stop,textEnabled:!0}),$("calcite-action",{icon:"line",onclick:()=>{this.viewModel.create("polyline-barrier")},scale:"s",text:this.messages.barrier,textEnabled:!0}),$("calcite-action",{class:R.solveRoute,disabled:this.viewModel.autoSolve,icon:"refresh",onclick:()=>{this._solveRouteDebounced()},scale:"s",text:this.messages.solve,textEnabled:!0}))),$("div",{class:R.selectedFeatureContainer},$("calcite-list",{label:this.messages.selectedNetworkFeatures,scale:"s",selectionMode:"none"},this.viewModel.selectedNetworkFeatures?.toArray().map(((e,t)=>$("calcite-list-item",{description:this._getNetworkFeatureName(e),key:`network-feature-${t}`,label:e.name??e.objectId?.toString()??this.messages.unnamed},$("calcite-action",{icon:"trash",onclick:()=>{this.viewModel.remove(e)},scale:"s",slot:"actions-end",text:this.messages.common.delete})))))),$("div",{class:R.editFooter},this._renderEditFooterContent())))}_renderEditFooterContent(){return this.viewModel.lastError?this._renderErrorNotice():$("calcite-button",{appearance:"outline-fill",bind:this,onclick:this._handleEditingDoneClick,width:"full"},this.messages.common.done)}_renderErrorNotice(){return $("calcite-notice",{icon:"exclamation-mark-circle",kind:"danger",open:!0},$("calcite-label",{class:R.labelNoBottomMargin,slot:"message"},this._getErrorDescription()))}_renderFooter(){if(!this.viewModel.layer)return $("div",{class:R.primaryFooter,key:"footer-missing-layer"},$("calcite-notice",{icon:"information",open:!0},$("calcite-label",{class:R.labelNoBottomMargin,slot:"message"},this.messages.missingLayer)));if("unauthenticated"===this.viewModel.state)return $("div",{class:R.primaryFooterCentered,key:"footer-sign-in"},$("calcite-label",null,this.messages.signInRequired),$("calcite-button",{onclick:()=>{this.viewModel.load().catch((()=>{}))}},this.messages.common.auth.signIn));if("routing"===this.viewModel.state)return $("div",{class:this.classes(R.primaryFooter,R.primaryFooterLoader),key:"footer-routing"},$("calcite-loader",{label:this.messages.solve,scale:"s"}));if("error"===this.viewModel.state)return $("div",{class:R.primaryFooter,key:"footer-service-error"},this._renderErrorNotice());if(!this.viewModel.layer?.routeInfo)return $("div",{class:R.primaryFooter,key:"footer-unsolved-route"},$("calcite-notice",{icon:"information",open:!0},$("calcite-label",{class:R.labelNoBottomMargin,slot:"message"},this.messages.directionsPlaceholder)));const e=this._getRouteCostSummary();if(!e||!this.viewModel.layer?.directionPoints)return $("div",{class:R.primaryFooter,key:"footer-invalid-route"},$("calcite-notice",{icon:"exclamation-mark-triangle",kind:"danger",open:!0},$("calcite-label",{class:R.labelNoBottomMargin,slot:"message"},this.messages.invalidRoute)));const{distance:t,duration:i}=e,{formattedEta:s}=this.viewModel;return $("div",{class:R.routeItem,key:"footer-directions-summary"},$("button",{"aria-busy":"false","aria-label":this.messages.viewDrivingDirections,"aria-live":"polite",class:R.routeItemButton,onclick:()=>{this._currentFlowItem="directions"},type:"button"},$("div",{class:R.routeItemButtonContent},$("span",{class:R.routeItemLabel},`${i} (${t})`),$("span",{class:R.routeItemDescription},s)),$("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s"})),$("calcite-dropdown",null,$("calcite-action",{icon:"ellipsis",slot:"trigger",text:"Route actions"}),this._renderRouteLayerActions()))}_renderInteractiveRouteActions(){return $("div",{class:R.actionContainer,key:"interactive-route-action-container"},$("calcite-button",{appearance:"outline",class:R.addStopButton,disabled:this._getEffectiveStops().length>=this.maxStops,iconStart:"plus",kind:"neutral",label:this.messages.addStop,onclick:()=>{const e=new _;this.viewModel.layer?.stops.add(new v({symbol:e}))},width:"half"},this.messages.addStop),$("calcite-button",{appearance:"outline",disabled:"2d"!==this.viewModel.view?.type,iconStart:"pencil",kind:"neutral",label:this.messages.editRoute,onclick:()=>{this._currentFlowItem="edit",this.viewModel.startEditing()},width:"half"},this.messages.editRoute))}_renderLocateStopAction(e){if(null!=e.name||null!=e.geometry)return null;const t=this._getEffectiveStops().indexOf(e),i=!!this.view?.activeTool&&this.view.activeTool===this._searchTool&&this._searchTool.stop===e;return $("calcite-action",{active:i,icon:"crosshair",key:`stop-location-action-${t}`,onclick:()=>this._handleLocateStopAction(e),scale:"s",slot:"actions-end",text:this.messages.pickALocationOnTheMap,title:this.messages.pickALocationOnTheMap})}_renderOptimizeStopOrder(){const{routeParameters:e}=this.viewModel,{findBestSequence:t,preserveFirstStop:i,preserveLastStop:s}=e;return $("calcite-block-section",{class:R.optimizeSection,text:this.messages.optimizeOrder,toggleDisplay:"switch",onCalciteBlockSectionToggle:({target:t})=>{e.findBestSequence=t.open,this._solveRouteDebounced()}},t?[$("calcite-label",{class:R.optimizeSwitches,key:"preserve-first-stop",layout:"inline-space-between"},this.messages.preserveFirstStop,$("calcite-switch",{checked:i,scale:"s",onCalciteSwitchChange:({target:{checked:t}})=>{e.preserveFirstStop=t,this._solveRouteDebounced()}})),$("calcite-label",{class:R.optimizeSwitches,key:"preserve-last-stop",layout:"inline-space-between"},this.messages.preserveLastStop,$("calcite-switch",{checked:s,scale:"s",onCalciteSwitchChange:({target:{checked:t}})=>{e.preserveLastStop=t,this._solveRouteDebounced()}}))]:null)}_renderPrimaryFlowItem(){return $("calcite-flow-item",{key:"primary-flow-item",loading:"initializing"===this.viewModel.state,selected:"primary"===this._currentFlowItem},$("calcite-panel",{class:R.primaryFlowItem,disabled:!this.viewModel.layer||"unauthenticated"===this.viewModel.state||"error"===this.viewModel.state&&!this.viewModel.serviceDescription},this._renderStops(),this._renderInteractiveRouteActions(),this._renderSeparator(),this._renderRouteSolveOptions()),this._renderFooter())}_renderRouteLayerActions(e){return[this._renderClearRouteAction(e),this._renderSaveLayerAction(e),this._renderSaveLayerAsAction(e),this._renderViewItemDetailsAction(e)]}_renderRouteSolveOptions(){return $("div",{class:R.marginInlineMedium,key:"route-solve-options"},this._renderTravelModes(),this._renderDepartureTime(),this._renderDepartureTimeOptions(),this._renderOptimizeStopOrder())}_renderSaveContent(){switch(this._saveState){case"initialized":return this._renderSaveInitialized();case"connect-to-portal":return this._renderSaveProcessing(this.messages.identity.lblSigning);case"connect-to-portal-error":return this._renderSaveError(this.messages.errors.authenticating);case"fetch-portal-information":return this._renderSaveProcessing(this.messages.processing.fetching);case"fetch-portal-information-error":return this._renderSaveError(this.messages.errors.fetching);case"save-layer":return this._renderSaveLayerSettings();case"saving":return this._renderSaveProcessing(this.messages.processing.saving);case"saving-error":return this._renderSaveError(this.messages.errors.saving)}}_renderSaveError(e){return $("calcite-panel",{class:R.paddingMedium,key:"save-layer-error"},$("div",{class:R.saveError},$("calcite-icon",{class:R.saveErrorIcon,icon:"exclamation-mark-triangle",scale:"l",textLabel:this.messages.common.errorMessage}),$("calcite-label",{class:R.saveErrorLabel},e)),$("calcite-button",{appearance:"outline",onclick:()=>{this._currentFlowItem=this._parentFlowItem},slot:"footer-actions",width:"full"},this.messages.common.close))}_renderSaveInitialized(){return $("calcite-panel",{class:R.paddingMedium,key:"save-layer-initialized"})}_renderSaveFlowItem(){return"save"!==this._currentFlowItem?null:$("calcite-flow-item",{heading:this.messages.saveLayer,headingLevel:this.headingLevel,key:"save-layer-flow-item",selected:"save"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this._currentFlowItem=this._parentFlowItem}},this._renderSaveContent())}_renderSaveLayerAction(e){if(!this.visibleElements.saveButton)return null;const t=this.viewModel.layer,i=t?.routeInfo,s=t?.portalItem?.itemControl;return $("calcite-action",{disabled:!(!!i&&("admin"===s||"update"===s)),icon:"save",key:"save-route",onclick:()=>{this.viewModel.layer?.save()},...e,text:this.messages.common.save,textEnabled:!0})}_renderSaveLayerAsAction(e){if(!this.visibleElements.saveAsButton)return null;const t=!this.viewModel.layer?.routeInfo;return $("calcite-action",{disabled:t,icon:"save-as",key:"save-as-route",onclick:()=>{this._handleSaveLayerAsAction()},...e,text:this.messages.common.saveAs,textEnabled:!0})}_renderSaveLayerSettings(){if(null==this.layer||null==this._portalFolders||null==this._portalUserName)return this._renderSaveInitialized();const{stops:e}=this.layer,t=`${e.at(0).name} - ${e.at(-1).name}`,i=[$("calcite-combobox-item",{heading:`${this._portalUserName} (${this.messages.common.home})`,key:`${L}-folder-home`,selected:!0,value:`${L}-folder-home`}),...this._portalFolders.map((e=>$("calcite-combobox-item",{heading:e.title??"",key:`${L}-folder-${e.id}`,value:e.id})))];return $("calcite-panel",{key:"save-layer-panel"},$("div",{class:R.paddingMedium},$("calcite-label",null,this.messages.laverName,$("calcite-input",{afterCreate:e=>{this._portalItemNameInput=e},label:this.messages.laverName,value:t})),$("calcite-label",null,this.messages.saveInFolder,$("calcite-combobox",{afterCreate:e=>{this._portalFolderCombobox=e},clearDisabled:!0,label:this.messages.saveInFolder,overlayPositioning:"fixed",selectionMode:"single"},i))),$("calcite-button",{onclick:()=>{if(this._saveState="saving",null==this.layer||null==this._portalFolders)return;const e=this._portalItemNameInput?.value,t=this._portalFolderCombobox?.value,i=this._portalFolders.find((({id:e})=>e===t));this.layer.saveAs({title:e},{folder:i}).then((()=>{this._currentFlowItem=this._parentFlowItem})).catch((()=>{this._saveState="saving-error"}))},slot:"footer-actions",width:"full"},this.messages.common.save),$("calcite-button",{appearance:"outline",onclick:()=>{this._currentFlowItem=this._parentFlowItem},slot:"footer-actions",width:"full"},this.messages.common.cancel))}_renderSaveProcessing(e){return $("calcite-panel",{class:R.marginInlineMedium,key:"save-layer-processing"},$("calcite-loader",{class:R.saveProcessLoader,label:e,text:e}))}_renderSeparator(){return $("div",{class:R.separator})}_renderStop(e){const t=this.acquireSearch(e);null!=e.name&&(t.searchTerm=e.name);const i=this._getEffectiveStops(),s=this._renderLocateStopAction(e),o=i.length>2&&this._renderDeleteStopAction(e);return $("calcite-list-item",{key:e,value:e},s,o,$("div",{class:R.stopItem,slot:"content"},t.render()))}_renderStops(){const e=this._getEffectiveStops();for(const t of this._stopsToSearches.keys())e.includes(t)||this._disposeSearch(t);return $("div",{class:R.stopContainer,key:R.stopContainer},$("calcite-list",{class:R.stopList,dragEnabled:!0,label:this.messages.widgetLabel,scale:"s",onCalciteListOrderChange:({detail:t})=>{e.reorder(t.dragEl.value,t.newIndex),this._solveRouteDebounced()}},e.toArray().map((e=>this._renderStop(e)))),2===e.length&&$("calcite-action",{icon:"arrow-up-down",onclick:()=>{e.reverse(),this._solveRouteDebounced()},scale:"s",text:this.messages.reverseStops}))}_renderTravelModes(){return this.viewModel.travelModes.length?$("calcite-label",{key:"travel-modes"},this.messages.mode,$("calcite-combobox",{clearDisabled:!0,label:this.messages.mode,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{const{selectedItems:t}=e;t.length&&(this.viewModel.selectedTravelMode=t[0].value,this._solveRouteDebounced())}},this.viewModel.travelModes.map((e=>$("calcite-combobox-item",{heading:e.name,key:e.id,label:e.name,selected:this.viewModel.selectedTravelMode?.id===e.id,value:e}))))):null}_renderViewItemDetailsAction(e){if(!this.visibleElements.layerDetails)return null;const t=this.viewModel.layer?.portalItem;return $("calcite-action",{disabled:!t,icon:"launch",key:"open-route-details-link",onclick:()=>{t&&window.open(`${t.portal.url}/home/item.html?id=${t.id}`,"_blank")},...e,text:this.messages.viewLayerDetails,textEnabled:!0})}async _solveRoute(){this.viewModel.updateDepartureTime();if(!((this.viewModel.layer?.stops.filter((({geometry:e})=>!!e)).length??0)<2))try{await this.viewModel.getDirections()}catch{}}};e([m()],A.prototype,"_currentFlowItem",void 0),e([m()],A.prototype,"_saveState",void 0),e([m()],A.prototype,"_searchTool",void 0),e([m()],A.prototype,"apiKey",null),e([m(u)],A.prototype,"defaultUnit",void 0),e([m()],A.prototype,"goToOverride",null),e([m()],A.prototype,"headingLevel",void 0),e([m()],A.prototype,"icon",null),e([m()],A.prototype,"label",null),e([m({readOnly:!0})],A.prototype,"lastRoute",null),e([m()],A.prototype,"layer",null),e([m()],A.prototype,"maxStops",null),e([m(),E("esri/widgets/Directions/t9n/Directions")],A.prototype,"messages",void 0),e([m(),E("esri/core/t9n/Units")],A.prototype,"messagesUnits",void 0),e([m()],A.prototype,"searchProperties",void 0),e([m()],A.prototype,"unit",null),e([m()],A.prototype,"view",null),e([m({type:b})],A.prototype,"viewModel",void 0),e([m({type:f,nonNullable:!0})],A.prototype,"visibleElements",void 0),A=e([p("esri.widgets.Directions")],A);const N=A;export{N as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{isSome as t}from"../core/arrayUtils.js";import s from"../core/Collection.js";import{makeHandle as i}from"../core/handleUtils.js";import{destroyMaybe as o}from"../core/maybe.js";import{debounce as r,isAbortError as a}from"../core/promiseUtils.js";import{watch as n,initial as l,on as c}from"../core/reactiveUtils.js";import{escapeRegExpString as d}from"../core/string.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import p from"../portal/Portal.js";import{defaultUnitPropertyMetadata as u}from"../properties/defaultUnit.js";import v from"../rest/support/Stop.js";import g from"../symbols/SimpleMarkerSymbol.js";import w from"./Search.js";import _ from"./Widget.js";import{css as y}from"./Directions/css.js";import{DirectionsSearchTool as b}from"./Directions/DirectionsSearchTool.js";import f from"./Directions/DirectionsViewModel.js";import S from"./Directions/DirectionsVisibleElements.js";import{formatDistance as M,formatDuration as k,DepartureTimeOption as I,getIconName as F}from"./Directions/support/directionsUtils.js";import{isArcGISWorldGeocoder as T,meteredArcGISLocatorUrl as D}from"./Search/support/locatorUtils.js";import{loadCalciteComponents as x}from"./support/componentsUtils.js";import{globalCss as E}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as C}from"./support/decorators/messageBundle.js";import{tsx as R}from"./support/jsxFactory.js";function A(e){const{branchName:s,displayText:i,exitName:o,intersectingName:r,name:a,towardName:n}=e;if(null==i)return null;const l=[s,o,r,a,n].filter(t).sort(((e,t)=>t.length-e.length)).map((e=>d(e)));if(!l.length)return i;const c=new RegExp(l.join("|"),"g"),h=i.matchAll(c);let m=0;const p=[];for(const{0:t,index:d}of h)p.push(i.slice(m,d),R("span",{class:y.labelEmphasize,key:`maneuver-${d}`},t)),m=d+t.length;return p.push(i.slice(m)),R("span",null,p)}let L=class extends _{constructor(e,t){super(e,t),this._activeManeuver=null,this._placeholderStops=new s([new v,new v]),this._portalFolderCombobox=null,this._portalFolders=null,this._portalItemNameInput=null,this._portalUserName=null,this._sections=null,this._stopsToSearches=new Map,this._currentFlowItem="primary",this._parentFlowItem="primary",this._saveState="initialized",this._searchTool=null,this.headingLevel=2,this.messages=null,this.messagesUnits=null,this.searchProperties=null,this.viewModel=new f,this.visibleElements=new S,this._solveRouteDebounced=r((()=>this._solveRoute()))}initialize(){this.addHandles([n((()=>this.viewModel.layer),(()=>{try{this.viewModel.load()}catch{}}),l),n((()=>this.viewModel.layer?.routeInfo),(()=>{this._sections=this._getStopSections()}),l),n((()=>this.viewModel.layer?.stops.toArray()),(e=>{e&&this.view?.activeTool&&this._searchTool&&this.view.activeTool===this._searchTool&&!e.includes(this._searchTool.stop)&&(this.view.tools.remove(this._searchTool),this._searchTool=null)}))])}loadDependencies(){return x({accordion:()=>import("@esri/calcite-components/dist/components/calcite-accordion"),"accordion-item":()=>import("@esri/calcite-components/dist/components/calcite-accordion-item"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"block-section":()=>import("@esri/calcite-components/dist/components/calcite-block-section"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch")})}destroy(){this._stopsToSearches.forEach(o)}get apiKey(){return this.viewModel.apiKey}set apiKey(e){this.viewModel.apiKey=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"right"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get lastRoute(){return this.viewModel.lastRoute}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxStops(){return this.viewModel.maxStops}set maxStops(e){this.viewModel.maxStops=e}get unit(){return this.defaultUnit}set unit(e){this._overrideIfSome("unit",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}acquireSearch(e){const{view:t}=this.viewModel;if(this._stopsToSearches.has(e)){const s=this._stopsToSearches.get(e);return s.view=t,this._overrideDefaultSources(s),s}const s=new w({icon:!1,popupEnabled:!1,resultGraphicEnabled:!1,view:t,...this.searchProperties});return this._normalizeSearchSources(s),this.addHandles([c((()=>s.allSources),"change",(()=>this._normalizeSearchSources(s))),s.on("search-clear",(()=>{e.geometry=null,e.name=null,this.viewModel.layer?.removeResult()})),s.on("select-result",(()=>{const t=s.selectedResult;e.geometry=t?.feature.geometry,e.name=t?.name,this._solveRouteDebounced()})),n((()=>s.searchTerm),(t=>{e.name=t}))],s),this._stopsToSearches.set(e,s),s}getDirections(){return this.viewModel.getDirections()}render(){return R("div",{class:this.classes(y.base,E.widget,E.panel)},R("calcite-flow",null,this._renderPrimaryFlowItem(),this._renderDirectionsFlowItem(),this._renderEditFlowItem(),this._renderSaveFlowItem()))}save(){return this.viewModel.save()}saveAs(e,t={}){return this.viewModel.saveAs(e,t)}zoomToRoute(){return this.viewModel.zoomToRoute()}_applyLocatorSourceOverrides({allSources:e}){for(const t of e)"url"in t&&t.url&&(t.locationType??="street",T(t.url)&&this.apiKey&&null==t.apiKey&&(t.apiKey=this.apiKey,t.url=D))}_disposeSearch(e){if(!e||!this._stopsToSearches.has(e))return;const t=this._stopsToSearches.get(e);this.removeHandles(t),t.destroy(),this._stopsToSearches.delete(e)}_getEffectiveStops(){return this.viewModel.layer?.stops??this._placeholderStops}_getErrorDescription(){switch(this.viewModel.lastError?.name){case"directions-view-model:unable-to-route":return this.messages.errors.unableToRoute;case"directions-view-model:service-metadata-unavailable":return this.messages.errors.unableToLoadServiceMetadata;default:return this.messages.errors.unknownError}}_getNetworkFeatureName(e){switch(e.type){case"stop":switch(e.locationType){case"stop":default:return this.messages.networkFeatures.stops.stop;case"waypoint":return this.messages.networkFeatures.stops.waypoint;case"break":return this.messages.networkFeatures.stops.break}case"point-barrier":return this.messages.networkFeatures.pointBarrier;case"polyline-barrier":return this.messages.networkFeatures.polylineBarrier;case"polygon-barrier":return this.messages.networkFeatures.polygonBarrier}}_getRouteCostSummary(){const e=this.viewModel.layer?.routeInfo;if(!e)return null;const t=e.totalDistance??0,s=e.totalDuration??0,{messagesUnits:i,unit:o}=this;return{distance:M(i,t,o),duration:k(s)}}_getStopSections(){if(!this.viewModel.layer)return null;const{directionPoints:e,directionLines:t,stops:s}=this.viewModel.layer;if(!e||!t)return null;const i=[];let o=null;for(const r of e){const{objectId:e,stopId:a}=r;if(null!=a){const e=s.find((({objectId:e})=>e===a));o&&o.stop===e||(o={stop:e,directions:[]},i.push(o));continue}if(null==o)continue;const n=t.find((({directionPointId:t})=>t===e));null!=n&&o.directions.push({directionPoint:r,directionLine:n})}return i}_handleLocateStopAction(e){const{view:t}=this;if(!t)return;const s="directions-search-tool";this.removeHandles(s),this._searchTool=new b({stop:e,view:t}),this.addHandles([this._searchTool.on("click",(async t=>{if(t.mapPoint&&this._stopsToSearches.has(e)){const s=this._stopsToSearches.get(e),i=await s.search(t.mapPoint),o=i?.results?.[0].results?.[0];if(o){const{feature:t,name:i}=o;s.searchTerm=i,e.geometry=t.geometry}}this.removeHandles(s)})),i((()=>{this._searchTool&&(this.view?.tools.remove(this._searchTool),this._searchTool=null)}))],s),t.addAndActivateTool(this._searchTool)}_handleEditingDoneClick(){this.viewModel.stopEditing(),this._currentFlowItem="primary"}async _handleSaveLayerAsAction(){const e=p.getDefault();try{await e.signIn()}catch(t){if(a(t)||"identity-manager:user-aborted"===t.name)return;return this._parentFlowItem=this._currentFlowItem,this._currentFlowItem="save",void(this._saveState="connect-to-portal-error")}this._saveState="fetch-portal-information",this._parentFlowItem=this._currentFlowItem,this._currentFlowItem="save",this._portalUserName=e.user?.username;try{this._portalFolders=await(e.user?.fetchFolders())}catch{return void(this._saveState="fetch-portal-information-error")}this._saveState="save-layer"}_normalizeSearchSources(e){this._overrideDefaultSources(e),this._applyLocatorSourceOverrides(e)}_overrideDefaultSources(e){for(const t of e.viewModel.defaultSources)t.autoNavigate=!1}_renderClearRouteAction(e){return R("calcite-action",{icon:"trash",key:"clear-route",onclick:()=>{this._currentFlowItem="primary",this.viewModel.reset()},...e,text:this.messages.common.clear,textEnabled:!0})}_renderDeleteStopAction(e){const t=this._getEffectiveStops();return R("calcite-action",{icon:"trash",onclick:()=>{t.remove(e),this._disposeSearch(e),this._solveRouteDebounced()},scale:"s",slot:"actions-end",text:this.messages.deleteStop,title:this.messages.deleteStop})}_renderDepartureTime(){const{DEPART_AT:e,NOW:t,UNSPECIFIED:s}=I;return R("calcite-label",{class:y.departureTime,key:"departure-time"},this.messages.departureTime,R("calcite-combobox",{clearDisabled:!0,label:this.messages.departureTime,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{const{selectedItems:t}=e;t.length&&(this.viewModel.departureOption=t[0].value,this._solveRouteDebounced())}},R("calcite-combobox-item",{heading:this.messages.leaveNow,key:t,label:this.messages.leaveNow,selected:this.viewModel.departureOption===t,value:t}),R("calcite-combobox-item",{heading:this.messages.departAt,key:e,label:this.messages.departAt,selected:this.viewModel.departureOption===e,value:e}),R("calcite-combobox-item",{heading:this.messages.timeUnspecified,key:s,label:this.messages.timeUnspecified,selected:this.viewModel.departureOption===s,value:s})))}_renderDepartureTimeOptions(){return this.viewModel.departureOption!==I.DEPART_AT?null:R("div",{class:y.departureTimeOptions},R("calcite-input-date-picker",{scale:"s",value:this.viewModel.departureIsoDate,onCalciteInputDatePickerChange:({currentTarget:{value:e}})=>{Array.isArray(e)||(this.viewModel.departureIsoDate=e,this._solveRouteDebounced())}}),R("calcite-input-time-picker",{scale:"s",value:this.viewModel.departureIsoTime,onCalciteInputTimePickerClose:({currentTarget:{value:e}})=>{this.viewModel.departureIsoTime=e,this._solveRouteDebounced()}}))}_renderDirectionsFlowItem(){if("directions"!==this._currentFlowItem)return null;const e=this._getRouteCostSummary();if(!this._sections||!e)return null;const{distance:t,duration:s}=e,{formattedEta:i}=this.viewModel,o=this._sections.at(0)?.stop.name??"",r=this._sections.at(-1)?.stop.name??"";return R("calcite-flow-item",{key:"directions-flow-item",overlayPositioning:"fixed",selected:"directions"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this._currentFlowItem="primary"}},R("div",{class:y.directionsHeader,slot:"header-content"},R("div",{class:y.headerStops},R("span",null,this.messages.from)," ",R("span",{class:y.directionsHeaderStopName},o),R("span",null,this.messages.to)," ",R("span",{class:y.directionsHeaderStopName},r)),R("div",{class:y.flexColumn},R("span",null,`${s} (${t})`),i?R("span",null,i):null)),this._renderRouteLayerActions({slot:"header-menu-actions"}),R("calcite-accordion",{class:y.accordion,iconPosition:"start",selectionMode:"single"},this._sections.map(((e,t)=>{const{stop:s,directions:i}=e,{name:o}=s;return R("calcite-accordion-item",{expanded:0===t,heading:o??"",key:`stop-${t}`},R("calcite-action",{icon:"zoom-to-object",onclick:()=>{this.viewModel.centerAt(s)},slot:"actions-end",text:this.messages.panToStop}),this._renderDirectionTurns(i))}))))}_renderDirectionTurns(e){return R("calcite-list",{label:this.messages.drivingDirections,selectionMode:"none"},e.map(((e,t)=>{const{directionPoint:s,directionLine:i}=e,{distance:o,duration:r}=i,a=M(this.messagesUnits,o??0,this.unit),n=k(r??0),l=a&&n?`${a} | ${n}`:`${a||n}`,c=A(s),d=F(s.directionPointType);return R("calcite-list-item",{class:y.labelNoBottomMargin,key:`driving-direction-${t}`,onpointerenter:()=>{this.viewModel.highlight(i)},onpointerleave:()=>{this.viewModel.clearHighlights()},onCalciteListItemSelect:()=>{this._activeManeuver===i?this.zoomToRoute():(this._activeManeuver=i,this.viewModel.centerAt(i.geometry))}},R("calcite-icon",{icon:d,slot:"content-start"}),R("div",{slot:"content"},R("calcite-label",{layout:"inline",scale:"s"},c),R("calcite-label",{layout:"inline",scale:"s"},l)))})))}_renderEditFlowItem(){return"edit"!==this._currentFlowItem?null:R("calcite-flow-item",{heading:this.messages.editRoute,headingLevel:this.headingLevel,key:"edit-flow-item",loading:"routing"===this.viewModel.state,selected:"edit"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this.viewModel.stopEditing(),this._currentFlowItem="primary"}},R("div",{class:y.flexColumn,key:"edit-container"},R("div",{class:y.editToolbarContainer},R("calcite-label",{layout:"inline",scale:"s"},this.messages.automaticallySolve,R("calcite-switch",{checked:this.viewModel.autoSolve,scale:"s",onCalciteSwitchChange:e=>{this.viewModel.autoSolve=e.target.checked}})),R("div",{class:y.editToolbar},R("calcite-action",{disabled:!this.viewModel.layer||this.viewModel.layer.stops.length>=this.maxStops,icon:"flag",onclick:()=>{this.viewModel.create("stop")},scale:"s",text:this.messages.networkFeatures.stops.stop,textEnabled:!0}),R("calcite-action",{icon:"line",onclick:()=>{this.viewModel.create("polyline-barrier")},scale:"s",text:this.messages.barrier,textEnabled:!0}),R("calcite-action",{class:y.solveRoute,disabled:this.viewModel.autoSolve,icon:"refresh",onclick:()=>{this._solveRouteDebounced()},scale:"s",text:this.messages.solve,textEnabled:!0}))),R("div",{class:y.selectedFeatureContainer},R("calcite-list",{label:this.messages.selectedNetworkFeatures,scale:"s",selectionMode:"none"},this.viewModel.selectedNetworkFeatures?.toArray().map(((e,t)=>R("calcite-list-item",{description:this._getNetworkFeatureName(e),key:`network-feature-${t}`,label:e.name??e.objectId?.toString()??this.messages.unnamed},R("calcite-action",{icon:"trash",onclick:()=>{this.viewModel.remove(e),this.viewModel.autoSolve&&this._solveRouteDebounced()},scale:"s",slot:"actions-end",text:this.messages.common.delete})))))),R("div",{class:y.editFooter},this._renderEditFooterContent())))}_renderEditFooterContent(){return this.viewModel.lastError?this._renderErrorNotice():R("calcite-button",{appearance:"outline-fill",bind:this,onclick:this._handleEditingDoneClick,width:"full"},this.messages.common.done)}_renderErrorNotice(){return R("calcite-notice",{icon:"exclamation-mark-circle",kind:"danger",open:!0},R("calcite-label",{class:y.labelNoBottomMargin,slot:"message"},this._getErrorDescription()))}_renderFooter(){if(!this.viewModel.layer)return R("div",{class:y.primaryFooter,key:"footer-missing-layer"},R("calcite-notice",{icon:"information",open:!0},R("calcite-label",{class:y.labelNoBottomMargin,slot:"message"},this.messages.missingLayer)));if("unauthenticated"===this.viewModel.state)return R("div",{class:y.primaryFooterCentered,key:"footer-sign-in"},R("calcite-label",null,this.messages.signInRequired),R("calcite-button",{onclick:()=>{this.viewModel.load().catch((()=>{}))}},this.messages.common.auth.signIn));if("routing"===this.viewModel.state)return R("div",{class:this.classes(y.primaryFooter,y.primaryFooterLoader),key:"footer-routing"},R("calcite-loader",{label:this.messages.solve,scale:"s"}));if("error"===this.viewModel.state)return R("div",{class:y.primaryFooter,key:"footer-service-error"},this._renderErrorNotice());if(!this.viewModel.layer?.routeInfo)return R("div",{class:y.primaryFooter,key:"footer-unsolved-route"},R("calcite-notice",{icon:"information",open:!0},R("calcite-label",{class:y.labelNoBottomMargin,slot:"message"},this.messages.directionsPlaceholder)));const e=this._getRouteCostSummary();if(!e||!this.viewModel.layer?.directionPoints)return R("div",{class:y.primaryFooter,key:"footer-invalid-route"},R("calcite-notice",{icon:"exclamation-mark-triangle",kind:"danger",open:!0},R("calcite-label",{class:y.labelNoBottomMargin,slot:"message"},this.messages.invalidRoute)));const{distance:t,duration:s}=e,{formattedEta:i}=this.viewModel;return R("div",{class:y.routeItem,key:"footer-directions-summary"},R("button",{"aria-busy":"false","aria-label":this.messages.viewDrivingDirections,"aria-live":"polite",class:y.routeItemButton,onclick:()=>{this._currentFlowItem="directions"},type:"button"},R("div",{class:y.routeItemButtonContent},R("span",{class:y.routeItemLabel},`${s} (${t})`),R("span",{class:y.routeItemDescription},i)),R("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s"})),R("calcite-dropdown",null,R("calcite-action",{icon:"ellipsis",slot:"trigger",text:"Route actions"}),this._renderRouteLayerActions()))}_renderInteractiveRouteActions(){return R("div",{class:y.actionContainer,key:"interactive-route-action-container"},R("calcite-button",{appearance:"outline",class:y.addStopButton,disabled:this._getEffectiveStops().length>=this.maxStops,iconStart:"plus",kind:"neutral",label:this.messages.addStop,onclick:()=>{const e=new g;this.viewModel.layer?.stops.add(new v({symbol:e}))},width:"half"},this.messages.addStop),R("calcite-button",{appearance:"outline",class:y.editRouteButton,disabled:"2d"!==this.viewModel.view?.type,iconStart:"pencil",kind:"neutral",label:this.messages.editRoute,onclick:()=>{this._currentFlowItem="edit",this.viewModel.startEditing()},width:"half"},this.messages.editRoute))}_renderLocateStopAction(e){if(null!=e.name||null!=e.geometry)return null;const t=this._getEffectiveStops().indexOf(e),s=!!this.view?.activeTool&&this.view.activeTool===this._searchTool&&this._searchTool.stop===e;return R("calcite-action",{active:s,icon:"crosshair",key:`stop-location-action-${t}`,onclick:()=>this._handleLocateStopAction(e),scale:"s",slot:"actions-end",text:this.messages.pickALocationOnTheMap,title:this.messages.pickALocationOnTheMap})}_renderOptimizeStopOrder(){const{routeParameters:e}=this.viewModel,{findBestSequence:t,preserveFirstStop:s,preserveLastStop:i}=e;return R("calcite-block-section",{class:y.optimizeSection,text:this.messages.optimizeOrder,toggleDisplay:"switch",onCalciteBlockSectionToggle:({target:t})=>{e.findBestSequence=t.open,this._solveRouteDebounced()}},t?[R("calcite-label",{class:y.optimizeSwitches,key:"preserve-first-stop",layout:"inline-space-between"},this.messages.preserveFirstStop,R("calcite-switch",{checked:s,scale:"s",onCalciteSwitchChange:({target:{checked:t}})=>{e.preserveFirstStop=t,this._solveRouteDebounced()}})),R("calcite-label",{class:y.optimizeSwitches,key:"preserve-last-stop",layout:"inline-space-between"},this.messages.preserveLastStop,R("calcite-switch",{checked:i,scale:"s",onCalciteSwitchChange:({target:{checked:t}})=>{e.preserveLastStop=t,this._solveRouteDebounced()}}))]:null)}_renderPrimaryFlowItem(){return R("calcite-flow-item",{key:"primary-flow-item",loading:"initializing"===this.viewModel.state,selected:"primary"===this._currentFlowItem},R("calcite-panel",{class:y.primaryFlowItem,disabled:!this.viewModel.layer||"unauthenticated"===this.viewModel.state||"error"===this.viewModel.state&&!this.viewModel.serviceDescription},this._renderStops(),this._renderInteractiveRouteActions(),this._renderSeparator(),this._renderRouteSolveOptions()),this._renderFooter())}_renderRouteLayerActions(e){return[this._renderClearRouteAction(e),this._renderSaveLayerAction(e),this._renderSaveLayerAsAction(e),this._renderViewItemDetailsAction(e)]}_renderRouteSolveOptions(){return R("div",{class:y.marginInlineMedium,key:"route-solve-options"},this._renderTravelModes(),this._renderDepartureTime(),this._renderDepartureTimeOptions(),this._renderOptimizeStopOrder())}_renderSaveContent(){switch(this._saveState){case"initialized":return this._renderSaveInitialized();case"connect-to-portal":return this._renderSaveProcessing(this.messages.identity.lblSigning);case"connect-to-portal-error":return this._renderSaveError(this.messages.errors.authenticating);case"fetch-portal-information":return this._renderSaveProcessing(this.messages.processing.fetching);case"fetch-portal-information-error":return this._renderSaveError(this.messages.errors.fetching);case"save-layer":return this._renderSaveLayerSettings();case"saving":return this._renderSaveProcessing(this.messages.processing.saving);case"saving-error":return this._renderSaveError(this.messages.errors.saving)}}_renderSaveError(e){return R("calcite-panel",{class:y.paddingMedium,key:"save-layer-error"},R("div",{class:y.saveError},R("calcite-icon",{class:y.saveErrorIcon,icon:"exclamation-mark-triangle",scale:"l",textLabel:this.messages.common.errorMessage}),R("calcite-label",{class:y.saveErrorLabel},e)),R("calcite-button",{appearance:"outline",onclick:()=>{this._currentFlowItem=this._parentFlowItem},slot:"footer-actions",width:"full"},this.messages.common.close))}_renderSaveInitialized(){return R("calcite-panel",{class:y.paddingMedium,key:"save-layer-initialized"})}_renderSaveFlowItem(){return"save"!==this._currentFlowItem?null:R("calcite-flow-item",{heading:this.messages.saveLayer,headingLevel:this.headingLevel,key:"save-layer-flow-item",selected:"save"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this._currentFlowItem=this._parentFlowItem}},this._renderSaveContent())}_renderSaveLayerAction(e){if(!this.visibleElements.saveButton)return null;const t=this.viewModel.layer,s=t?.routeInfo,i=t?.portalItem?.itemControl;return R("calcite-action",{disabled:!(!!s&&("admin"===i||"update"===i)),icon:"save",key:"save-route",onclick:()=>{this.viewModel.layer?.save()},...e,text:this.messages.common.save,textEnabled:!0})}_renderSaveLayerAsAction(e){if(!this.visibleElements.saveAsButton)return null;const t=!this.viewModel.layer?.routeInfo;return R("calcite-action",{disabled:t,icon:"save-as",key:"save-as-route",onclick:()=>{this._handleSaveLayerAsAction()},...e,text:this.messages.common.saveAs,textEnabled:!0})}_renderSaveLayerSettings(){if(null==this.layer||null==this._portalFolders||null==this._portalUserName)return this._renderSaveInitialized();const{stops:e}=this.layer,t=`${e.at(0).name} - ${e.at(-1).name}`,s=[R("calcite-combobox-item",{heading:`${this._portalUserName} (${this.messages.common.home})`,key:y.folderHome,selected:!0,value:y.folderHome}),...this._portalFolders.map((e=>R("calcite-combobox-item",{heading:e.title??"",key:`${y.folder}-${e.id}`,value:e.id})))];return R("calcite-panel",{key:"save-layer-panel"},R("div",{class:y.paddingMedium},R("calcite-label",null,this.messages.laverName,R("calcite-input",{afterCreate:e=>{this._portalItemNameInput=e},label:this.messages.laverName,value:t})),R("calcite-label",null,this.messages.saveInFolder,R("calcite-combobox",{afterCreate:e=>{this._portalFolderCombobox=e},clearDisabled:!0,label:this.messages.saveInFolder,overlayPositioning:"fixed",selectionMode:"single"},s))),R("calcite-button",{onclick:()=>{if(this._saveState="saving",null==this.layer||null==this._portalFolders)return;const e=this._portalItemNameInput?.value,t=this._portalFolderCombobox?.value,s=this._portalFolders.find((({id:e})=>e===t));this.layer.saveAs({title:e},{folder:s}).then((()=>{this._currentFlowItem=this._parentFlowItem})).catch((()=>{this._saveState="saving-error"}))},slot:"footer-actions",width:"full"},this.messages.common.save),R("calcite-button",{appearance:"outline",onclick:()=>{this._currentFlowItem=this._parentFlowItem},slot:"footer-actions",width:"full"},this.messages.common.cancel))}_renderSaveProcessing(e){return R("calcite-panel",{class:y.marginInlineMedium,key:"save-layer-processing"},R("calcite-loader",{class:y.saveProcessLoader,label:e,text:e}))}_renderSeparator(){return R("div",{class:y.separator})}_renderStop(e){const t=this.acquireSearch(e);null!=e.name&&(t.searchTerm=e.name);const s=this._getEffectiveStops(),i=this._renderLocateStopAction(e),o=s.length>2&&this._renderDeleteStopAction(e);return R("calcite-list-item",{key:e,value:e},i,o,R("div",{class:y.stopItem,slot:"content"},t.render()))}_renderStops(){const e=this._getEffectiveStops();for(const t of this._stopsToSearches.keys())e.includes(t)||this._disposeSearch(t);return R("div",{class:y.stopContainer,key:y.stopContainer},R("calcite-list",{class:y.stopList,dragEnabled:!0,label:this.messages.widgetLabel,scale:"s",onCalciteListOrderChange:({detail:t})=>{e.reorder(t.dragEl.value,t.newIndex),this._solveRouteDebounced()}},e.toArray().map((e=>this._renderStop(e)))),2===e.length&&R("calcite-action",{icon:"arrow-up-down",onclick:()=>{e.reverse(),this._solveRouteDebounced()},scale:"s",text:this.messages.reverseStops}))}_renderTravelModes(){return this.viewModel.travelModes.length?R("calcite-label",{key:"travel-modes"},this.messages.mode,R("calcite-combobox",{clearDisabled:!0,label:this.messages.mode,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{const{selectedItems:t}=e;t.length&&(this.viewModel.selectedTravelMode=t[0].value,this._solveRouteDebounced())}},this.viewModel.travelModes.map((e=>R("calcite-combobox-item",{heading:e.name,key:e.id,label:e.name,selected:this.viewModel.selectedTravelMode?.id===e.id,value:e}))))):null}_renderViewItemDetailsAction(e){if(!this.visibleElements.layerDetails)return null;const t=this.viewModel.layer?.portalItem;return R("calcite-action",{disabled:!t,icon:"launch",key:"open-route-details-link",onclick:()=>{t&&window.open(`${t.portal.url}/home/item.html?id=${t.id}`,"_blank")},...e,text:this.messages.viewLayerDetails,textEnabled:!0})}async _solveRoute(){this.viewModel.updateDepartureTime();if(!((this.viewModel.layer?.stops.filter((({geometry:e})=>!!e)).length??0)<2))try{await this.viewModel.getDirections()}catch{}}};e([h()],L.prototype,"_currentFlowItem",void 0),e([h()],L.prototype,"_saveState",void 0),e([h()],L.prototype,"_searchTool",void 0),e([h()],L.prototype,"apiKey",null),e([h(u)],L.prototype,"defaultUnit",void 0),e([h()],L.prototype,"goToOverride",null),e([h()],L.prototype,"headingLevel",void 0),e([h()],L.prototype,"icon",null),e([h()],L.prototype,"label",null),e([h({readOnly:!0})],L.prototype,"lastRoute",null),e([h()],L.prototype,"layer",null),e([h()],L.prototype,"maxStops",null),e([h(),C("esri/widgets/Directions/t9n/Directions")],L.prototype,"messages",void 0),e([h(),C("esri/core/t9n/Units")],L.prototype,"messagesUnits",void 0),e([h()],L.prototype,"searchProperties",void 0),e([h()],L.prototype,"unit",null),e([h()],L.prototype,"view",null),e([h({type:f})],L.prototype,"viewModel",void 0),e([h({type:S,nonNullable:!0})],L.prototype,"visibleElements",void 0),L=e([m("esri.widgets.Directions")],L);const j=L;export{j as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{watch as t,initial as r,on as i}from"../../../core/reactiveUtils.js";import{stripHTML as s}from"../../../core/string.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{defaultHighlightName as a,temporaryHighlightName as n}from"../../../views/support/HighlightDefaults.js";import d from"../../Widget.js";import c from"../UtilityNetworkAssociationAddAssociationViewModel.js";import{loadCalciteComponents as p}from"../../support/componentsUtils.js";import u from"../../support/FilterBuilder.js";import{globalCss as h}from"../../support/globalCss.js";import{Heading as m}from"../../support/Heading.js";import _ from"../../support/SelectionToolbar.js";import"../../support/widgetUtils.js";import{messageBundle as f}from"../../support/decorators/messageBundle.js";import{tsx as g}from"../../support/jsxFactory.js";import{fetchMessageBundle as v}from"../../../intl/messages.js";import{substitute as y}from"../../../intl/substitute.js";const b="esri-feature-form-utility-network-association-layers",F={base:b,header:`${b}__header`,headingContent:`${b}__heading-content`,featureObserver:`${b}__feature-observer`,filterContainer:`${b}__filter-container`,filterOptionsContainer:`${b}__filter-options-container`,filterOptionsHeader:`${b}__filter-options-header`,listContainer:`${b}__list-container`,spatialSelectContainer:`${b}__spatial-select-container`,spatialSelectToolbar:`${b}__spatial-select-toolbar`,stickySpinnerContainer:`${b}__sticky-loading-container`,loadingContainer:`${b}__loading-container`};let w=class extends d{constructor(e,t){super(e,t),this.headingLevel=5,this.messagesCommon=null,this.messagesEditor=null,this.messagesFeature=null,this.messagesFeatureForm=null,this.messagesFilterBuilder=null,this.viewModel=new c,this.view=null,this._filterBuilder=new u,this._featureFilterText="",this._layerFilterText="",this._observer=new IntersectionObserver((([e])=>{e?.isIntersecting&&this._increaseFeaturePage()}),{root:window.document}),this._observerNode=null,this._selectionToolbar=new _({layerViewPreferenceEnabled:!1}),this._handleSelectionComplete=async e=>{const{highlightHelper:t}=this.viewModel;await this.viewModel.handleSelectionComplete(e),t?.removeAll(),this._featureSpatialGraphics.length>0&&t?.add(this._featureSpatialGraphics)}}initialize(){this._setupSelectionToolbar(),this.addHandles([t((()=>this.viewModel),(()=>this.reset())),t((()=>[this.viewModel.state,this._observerNode]),(()=>this._onObserverChange())),t((()=>this.selectedLayer),(e=>{this._filterBuilder.layer=e,e||(this.filterOptionsVisible=!1,this._featureFilterText="")}))])}loadDependencies(){return p({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}destroy(){this._filterBuilder.destroy(),this._selectionToolbar.destroy()}get filterOptionsVisible(){return this.viewModel.filterOptionsVisible}set filterOptionsVisible(e){this.viewModel.filterOptionsVisible=e}get selectedLayer(){return this.viewModel.selectedLayer}set selectedLayer(e){this.viewModel.selectedLayer=e}get selectedFeature(){return this.viewModel.selectedFeature}set selectedFeature(e){this.viewModel.selectedFeature=e}get filterWhereClause(){return this.viewModel.filterWhereClause}set filterWhereClause(e){this.viewModel.filterWhereClause=e,e||this._filterBuilder.reset()}get _featureSpatialGraphics(){return this.viewModel.featureSpatialItems.toArray().map((e=>e.feature))}get _filteredFeatureItems(){const{_featureFilterText:e}=this,{featureItems:t,featureSpatialItems:r}=this.viewModel;return(r.length?r:t).map((e=>({label:e.label,graphic:e.feature,layer:e.feature.sourceLayer}))).filter((t=>t.label?.toLowerCase().includes(e)??!1))}get _filteredFeatureItemsPage(){const{featurePage:e,featuresPerPage:t}=this.viewModel,r=e*t;return this._filteredFeatureItems.toArray().slice(0,r)}render(){return g("div",{class:this.classes(F.base,h.widget)},this._renderContent())}applyFilterOptions(){const{selectedLayer:e}=this;this.filterOptionsVisible=!1,e&&(this.filterWhereClause=this._filterBuilder.whereClause)}reset(){this.filterWhereClause=null,this._featureFilterText="",this._layerFilterText="",this.filterOptionsVisible=!1,this._filterBuilder.reset()}_setupSelectionToolbar(){const{_selectionToolbar:e}=this;e.defaultRectangleToolOptions={...e.defaultRectangleToolOptions,persistSelection:!1,selectOnComplete:!0},e.defaultLassoToolOptions={...e.defaultLassoToolOptions,persistSelection:!1,selectOnComplete:!0};const s={createTool:"point",mode:"click",toolName:"",icon:"cursor",toolKey:"point",persistSelection:!1,selectOnComplete:!0};v("esri/widgets/Editor/t9n/Editor").then((t=>{e.toolConfigs=[{...s,toolName:t.selectFeature}]})),this.addHandles([t((()=>this.view),(e=>{this.viewModel.reset(),this._selectionToolbar.view="2d"===e?.type?e:null}),r),t((()=>[this.viewModel,this.viewModel.layerItems.length]),(()=>this._selectionToolbar.sources=this.viewModel.layerItems.toArray())),i((()=>this._selectionToolbar),"complete",this._handleSelectionComplete)])}async _onObserverChange(){this._observerNode&&this._observer.unobserve(this._observerNode);const{state:e}=this.viewModel;this._observerNode&&"ready"===e&&this._observer.observe(this._observerNode)}_increaseFeaturePage(){const{featureCount:e,featurePage:t,featureSpatialItems:r,state:i}=this.viewModel;e||r.length||1===t?"ready"===i&&this.viewModel.featurePage++:this.viewModel.featurePage=1}_renderContent(){const{state:e,filterOptionsVisible:t}=this.viewModel;return"loading"===e?this._renderLoading():t?this._renderFilterOptions():[this._renderSelectionToolbar(),this._renderListContent()]}_renderListContent(){return this._selectionToolbar.activeToolInfo?.operation.processingFinalSelection?this._renderLoading():this.selectedLayer||this.viewModel.featureSpatialItems.length?this._renderFeatures():this._renderLayers()}_renderSelectionToolbar(){const{messagesCommon:e,_selectionToolbar:t}=this,{featureSpatialItems:r,selectedLayer:i}=this.viewModel;if(i||!t.sources?.length)return null;const s=g("div",{class:F.spatialSelectToolbar},t.render()),o=g("calcite-button",{appearance:"transparent",disabled:!r.length,label:e.clear,onclick:()=>this.viewModel.reset()},e.clear);return g("div",{class:F.spatialSelectContainer,key:"spatial-select-toolbar"},s,o)}_renderStickyLoading(){return"querying"===this.viewModel.state?g("div",{class:F.stickySpinnerContainer,key:"sticky-loader"},this._renderLoadingIcon()):null}_renderLoading(){return g("div",{class:F.loadingContainer,key:"loading-container"},this._renderLoadingIcon())}_renderLoadingIcon(){return g("calcite-loader",{inline:!0,label:this.messagesCommon.loading})}_renderFilterOptions(){return g("div",{class:F.filterOptionsContainer},g("div",{class:F.filterOptionsHeader},g("span",null,this.messagesFilterBuilder.widgetLabel),g("calcite-button",{appearance:"transparent",onclick:()=>this._filterBuilder.reset()},this.messagesCommon.clear)),this._filterBuilder.render())}_renderLayers(){const e=this.messagesFeatureForm.associations,t=e.availableLayers,r=e.filterLayers;return g("div",null,this._renderHeader({heading:t,placeholder:r,renderFilterOptions:!1,renderTotal:!1}),g("div",{class:F.listContainer},g("calcite-list",{label:e.associatedFeatures},this._renderLayerItems(),this._renderStickyLoading())))}_renderLayerItems(){const{_layerFilterText:e,viewModel:t,messagesCommon:r}=this,{layerItems:i,tableItems:s}=t;return i.concat(s).map((e=>({label:e.title??r.untitled,layer:e}))).filter((t=>t.label?.toLowerCase().includes(e)??!1)).toArray().map((e=>this._renderLayerItem(e)))}_renderLayerItem(e){const{label:t,layer:r}=e;return g("calcite-list-item",{key:`layer-item-${r.id}`,label:s(t),onCalciteListItemSelect:()=>{this.selectedLayer=r,this._filterBuilder.reset()}},g("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderFeatures(){const{selectedLayer:e,viewModel:t}=this,r=t.featureSpatialItems.length>0,i=this.messagesFeatureForm.associations,s=e?.title??this.messagesCommon.untitled,o=i.filterFeatures;return g("div",null,this._renderHeader({heading:s,placeholder:o,renderFilterOptions:!r,renderTotal:!0}),g("div",{class:F.listContainer},g("calcite-list",{label:i.associatedFeatures},this._renderFeatureItems(),this._renderStickyLoading(),this._renderFeatureObserver())))}_renderFeatureItems(){return this._filteredFeatureItemsPage.map((e=>this._renderFeatureItem(e)))}_renderFeatureItem(e){const{viewModel:t}=this,{highlightHelper:r}=t,{label:i,graphic:o}=e,l=t.featureSpatialItems.length>0?()=>r?.update(o,a):void 0,d=t.featureSpatialItems.length>0?()=>r?.update(o,n):void 0;return g("calcite-list-item",{key:`feature-item-${o.uid}`,label:s(i),onmouseenter:l,onmouseleave:d,onCalciteListItemSelect:()=>{this.selectedFeature={feature:o,label:i}}},g("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_onObserverCreate(e){this._observerNode=e}_renderFeatureObserver(){return g("div",{afterCreate:this._onObserverCreate,bind:this,class:F.featureObserver,key:"feature-observer"})}_renderHeader(e){return g("div",{class:F.header,key:"filter"},this._renderHeading(e.heading),this._renderFilter(e.placeholder,e.renderFilterOptions),e.renderTotal?this._renderTotal():null)}_renderHeading(e){return e?g(m,{key:"title",level:this.headingLevel},g("div",{class:F.headingContent},g("calcite-icon",{icon:"layer"}),e)):null}_renderFilter(e,t){const r=!this.selectedLayer&&!this.viewModel.featureSpatialItems.length,i=r?this._layerFilterText:this._featureFilterText;return g("div",{class:F.filterContainer,key:"filter"},g("calcite-input",{icon:"search",placeholder:e,type:"search",value:i,onCalciteInputInput:e=>{r?this._layerFilterText=e.currentTarget.value.trim().toLowerCase():this._featureFilterText=e.currentTarget.value.trim().toLowerCase()}},t?this._renderFilterOptionsAction():null))}_renderFilterOptionsAction(){const e=this.messagesFeatureForm.associations.filterOptions;return g("calcite-action",{appearance:"transparent",icon:"sliders",indicator:!!this._filterBuilder.whereClause,onclick:()=>{this.viewModel.filterOptionsVisible=!this.viewModel.filterOptionsVisible},scale:"s",slot:"action",text:e,title:e})}_renderTotal(){const{messagesFeature:e,viewModel:t}=this,{featureCount:r,featureSpatialItems:i}=t,s=y(e.numberRecords,{number:i.length?i.length:r});return g("div",{key:"total"},s)}};e([o()],w.prototype,"filterOptionsVisible",null),e([o()],w.prototype,"headingLevel",void 0),e([o(),f("esri/t9n/common")],w.prototype,"messagesCommon",void 0),e([o(),f("esri/widgets/Editor/t9n/Editor")],w.prototype,"messagesEditor",void 0),e([o(),f("esri/widgets/Feature/t9n/Feature")],w.prototype,"messagesFeature",void 0),e([o(),f("esri/widgets/FeatureForm/t9n/FeatureForm")],w.prototype,"messagesFeatureForm",void 0),e([o(),f("esri/widgets/support/FilterBuilder/t9n/FilterBuilder")],w.prototype,"messagesFilterBuilder",void 0),e([o()],w.prototype,"selectedLayer",null),e([o({type:c})],w.prototype,"viewModel",void 0),e([o()],w.prototype,"selectedFeature",null),e([o()],w.prototype,"filterWhereClause",null),e([o()],w.prototype,"view",void 0),e([o()],w.prototype,"_filterBuilder",void 0),e([o()],w.prototype,"_featureFilterText",void 0),e([o()],w.prototype,"_layerFilterText",void 0),e([o()],w.prototype,"_observer",void 0),e([o()],w.prototype,"_featureSpatialGraphics",null),e([o()],w.prototype,"_filteredFeatureItems",null),e([o()],w.prototype,"_filteredFeatureItemsPage",null),e([o()],w.prototype,"_observerNode",void 0),w=e([l("esri.widgets.FeatureForm.FeatureFormUtilityNetworkAssociations.UtilityNetworkAssociationItemList")],w);const C=w;export{C as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{watch as t,initial as r,on as i}from"../../../core/reactiveUtils.js";import{stripHTML as s}from"../../../core/string.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{defaultHighlightName as a,temporaryHighlightName as n}from"../../../views/support/HighlightDefaults.js";import d from"../../Widget.js";import c from"../UtilityNetworkAssociationAddAssociationViewModel.js";import{loadCalciteComponents as p}from"../../support/componentsUtils.js";import u from"../../support/FilterBuilder.js";import{globalCss as h}from"../../support/globalCss.js";import{Heading as m}from"../../support/Heading.js";import _ from"../../support/SelectionToolbar.js";import"../../support/widgetUtils.js";import{messageBundle as f}from"../../support/decorators/messageBundle.js";import{tsx as g}from"../../support/jsxFactory.js";import v from"../../support/SelectionToolbar/VisibleElements.js";import{fetchMessageBundle as y}from"../../../intl/messages.js";import{substitute as b}from"../../../intl/substitute.js";const F="esri-feature-form-utility-network-association-layers",w={base:F,header:`${F}__header`,headingContent:`${F}__heading-content`,featureObserver:`${F}__feature-observer`,filterContainer:`${F}__filter-container`,filterOptionsContainer:`${F}__filter-options-container`,filterOptionsHeader:`${F}__filter-options-header`,listContainer:`${F}__list-container`,spatialSelectContainer:`${F}__spatial-select-container`,spatialSelectToolbar:`${F}__spatial-select-toolbar`,stickySpinnerContainer:`${F}__sticky-loading-container`,loadingContainer:`${F}__loading-container`};let C=class extends d{constructor(e,t){super(e,t),this.headingLevel=5,this.messagesCommon=null,this.messagesEditor=null,this.messagesFeature=null,this.messagesFeatureForm=null,this.messagesFilterBuilder=null,this.viewModel=new c,this.view=null,this._filterBuilder=new u,this._featureFilterText="",this._layerFilterText="",this._observer=new IntersectionObserver((([e])=>{e?.isIntersecting&&this._increaseFeaturePage()}),{root:window.document}),this._observerNode=null,this._selectionToolbar=new _({layerViewPreferenceEnabled:!1,visibleElements:new v({chip:!1,pan:!1,pointTool:!1})}),this._handleSelectionComplete=async e=>{const{highlightHelper:t}=this.viewModel;await this.viewModel.handleSelectionComplete(e),t?.removeAll(),this._featureSpatialGraphics.length>0&&t?.add(this._featureSpatialGraphics)}}initialize(){this._setupSelectionToolbar(),this.addHandles([t((()=>this.viewModel),(()=>this.reset())),t((()=>[this.viewModel.state,this._observerNode]),(()=>this._onObserverChange())),t((()=>this.selectedLayer),(e=>{this._filterBuilder.layer=e,e||(this.filterOptionsVisible=!1,this._featureFilterText="")}))])}loadDependencies(){return p({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}destroy(){this._filterBuilder.destroy(),this._selectionToolbar.destroy()}get filterOptionsVisible(){return this.viewModel.filterOptionsVisible}set filterOptionsVisible(e){this.viewModel.filterOptionsVisible=e}get selectedLayer(){return this.viewModel.selectedLayer}set selectedLayer(e){this.viewModel.selectedLayer=e}get selectedFeature(){return this.viewModel.selectedFeature}set selectedFeature(e){this.viewModel.selectedFeature=e}get filterWhereClause(){return this.viewModel.filterWhereClause}set filterWhereClause(e){this.viewModel.filterWhereClause=e,e||this._filterBuilder.reset()}get _featureSpatialGraphics(){return this.viewModel.featureSpatialItems.toArray().map((e=>e.feature))}get _filteredFeatureItems(){const{_featureFilterText:e}=this,{featureItems:t,featureSpatialItems:r}=this.viewModel;return(r.length?r:t).map((e=>({label:e.label,graphic:e.feature,layer:e.feature.sourceLayer}))).filter((t=>t.label?.toLowerCase().includes(e)??!1))}get _filteredFeatureItemsPage(){const{featurePage:e,featuresPerPage:t}=this.viewModel,r=e*t;return this._filteredFeatureItems.toArray().slice(0,r)}render(){return g("div",{class:this.classes(w.base,h.widget)},this._renderContent())}applyFilterOptions(){const{selectedLayer:e}=this;this.filterOptionsVisible=!1,e&&(this.filterWhereClause=this._filterBuilder.whereClause)}reset(){this.filterWhereClause=null,this._featureFilterText="",this._layerFilterText="",this.filterOptionsVisible=!1,this._filterBuilder.reset()}_setupSelectionToolbar(){const{_selectionToolbar:e}=this;e.defaultRectangleToolOptions={...e.defaultRectangleToolOptions,persistSelection:!1,selectOnComplete:!0},e.defaultLassoToolOptions={...e.defaultLassoToolOptions,persistSelection:!1,selectOnComplete:!0};const s={createTool:"point",mode:"click",toolName:"",icon:"cursor",toolKey:"point",persistSelection:!1,selectOnComplete:!0};y("esri/widgets/Editor/t9n/Editor").then((t=>{e.toolConfigs=[{...s,toolName:t.selectFeature}]})),this.addHandles([t((()=>this.view),(e=>{this.viewModel.reset(),this._selectionToolbar.view="2d"===e?.type?e:null}),r),t((()=>[this.viewModel,this.viewModel.layerItems.length]),(()=>this._selectionToolbar.sources=this.viewModel.layerItems.toArray())),i((()=>this._selectionToolbar),"complete",this._handleSelectionComplete)])}async _onObserverChange(){this._observerNode&&this._observer.unobserve(this._observerNode);const{state:e}=this.viewModel;this._observerNode&&"ready"===e&&this._observer.observe(this._observerNode)}_increaseFeaturePage(){const{featureCount:e,featurePage:t,featureSpatialItems:r,state:i}=this.viewModel;e||r.length||1===t?"ready"===i&&this.viewModel.featurePage++:this.viewModel.featurePage=1}_renderContent(){const{state:e,filterOptionsVisible:t}=this.viewModel;return"loading"===e?this._renderLoading():t?this._renderFilterOptions():[this._renderSelectionToolbar(),this._renderListContent()]}_renderListContent(){return this._selectionToolbar.activeToolInfo?.operation.processingFinalSelection?this._renderLoading():this.selectedLayer||this.viewModel.featureSpatialItems.length?this._renderFeatures():this._renderLayers()}_renderSelectionToolbar(){const{messagesCommon:e,_selectionToolbar:t}=this,{featureSpatialItems:r,selectedLayer:i}=this.viewModel;if(i||!t.sources?.length)return null;const s=g("div",{class:w.spatialSelectToolbar},t.render()),o=g("calcite-button",{appearance:"transparent",disabled:!r.length,label:e.clear,onclick:()=>this.viewModel.reset()},e.clear);return g("div",{class:w.spatialSelectContainer,key:"spatial-select-toolbar"},s,o)}_renderStickyLoading(){return"querying"===this.viewModel.state?g("div",{class:w.stickySpinnerContainer,key:"sticky-loader"},this._renderLoadingIcon()):null}_renderLoading(){return g("div",{class:w.loadingContainer,key:"loading-container"},this._renderLoadingIcon())}_renderLoadingIcon(){return g("calcite-loader",{inline:!0,label:this.messagesCommon.loading})}_renderFilterOptions(){return g("div",{class:w.filterOptionsContainer},g("div",{class:w.filterOptionsHeader},g("span",null,this.messagesFilterBuilder.widgetLabel),g("calcite-button",{appearance:"transparent",onclick:()=>this._filterBuilder.reset()},this.messagesCommon.clear)),this._filterBuilder.render())}_renderLayers(){const e=this.messagesFeatureForm.associations,t=e.availableLayers,r=e.filterLayers;return g("div",null,this._renderHeader({heading:t,placeholder:r,renderFilterOptions:!1,renderTotal:!1}),g("div",{class:w.listContainer},g("calcite-list",{label:e.associatedFeatures},this._renderLayerItems(),this._renderStickyLoading())))}_renderLayerItems(){const{_layerFilterText:e,viewModel:t,messagesCommon:r}=this,{layerItems:i,tableItems:s}=t;return i.concat(s).map((e=>({label:e.title??r.untitled,layer:e}))).filter((t=>t.label?.toLowerCase().includes(e)??!1)).toArray().map((e=>this._renderLayerItem(e)))}_renderLayerItem(e){const{label:t,layer:r}=e;return g("calcite-list-item",{key:`layer-item-${r.id}`,label:s(t),onCalciteListItemSelect:()=>{this.selectedLayer=r,this._filterBuilder.reset()}},g("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderFeatures(){const{selectedLayer:e,viewModel:t}=this,r=t.featureSpatialItems.length>0,i=this.messagesFeatureForm.associations,s=e?.title??this.messagesCommon.untitled,o=i.filterFeatures;return g("div",null,this._renderHeader({heading:s,placeholder:o,renderFilterOptions:!r,renderTotal:!0}),g("div",{class:w.listContainer},g("calcite-list",{label:i.associatedFeatures},this._renderFeatureItems(),this._renderStickyLoading(),this._renderFeatureObserver())))}_renderFeatureItems(){return this._filteredFeatureItemsPage.map((e=>this._renderFeatureItem(e)))}_renderFeatureItem(e){const{viewModel:t}=this,{highlightHelper:r}=t,{label:i,graphic:o}=e,l=t.featureSpatialItems.length>0?()=>r?.update(o,a):void 0,d=t.featureSpatialItems.length>0?()=>r?.update(o,n):void 0;return g("calcite-list-item",{key:`feature-item-${o.uid}`,label:s(i),onmouseenter:l,onmouseleave:d,onCalciteListItemSelect:()=>{this.selectedFeature={feature:o,label:i}}},g("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_onObserverCreate(e){this._observerNode=e}_renderFeatureObserver(){return g("div",{afterCreate:this._onObserverCreate,bind:this,class:w.featureObserver,key:"feature-observer"})}_renderHeader(e){return g("div",{class:w.header,key:"filter"},this._renderHeading(e.heading),this._renderFilter(e.placeholder,e.renderFilterOptions),e.renderTotal?this._renderTotal():null)}_renderHeading(e){return e?g(m,{key:"title",level:this.headingLevel},g("div",{class:w.headingContent},g("calcite-icon",{icon:"layer"}),e)):null}_renderFilter(e,t){const r=!this.selectedLayer&&!this.viewModel.featureSpatialItems.length,i=r?this._layerFilterText:this._featureFilterText;return g("div",{class:w.filterContainer,key:"filter"},g("calcite-input",{icon:"search",placeholder:e,type:"search",value:i,onCalciteInputInput:e=>{r?this._layerFilterText=e.currentTarget.value.trim().toLowerCase():this._featureFilterText=e.currentTarget.value.trim().toLowerCase()}},t?this._renderFilterOptionsAction():null))}_renderFilterOptionsAction(){const e=this.messagesFeatureForm.associations.filterOptions;return g("calcite-action",{appearance:"transparent",icon:"sliders",indicator:!!this._filterBuilder.whereClause,onclick:()=>{this.viewModel.filterOptionsVisible=!this.viewModel.filterOptionsVisible},scale:"s",slot:"action",text:e,title:e})}_renderTotal(){const{messagesFeature:e,viewModel:t}=this,{featureCount:r,featureSpatialItems:i}=t,s=b(e.numberRecords,{number:i.length?i.length:r});return g("div",{key:"total"},s)}};e([o()],C.prototype,"filterOptionsVisible",null),e([o()],C.prototype,"headingLevel",void 0),e([o(),f("esri/t9n/common")],C.prototype,"messagesCommon",void 0),e([o(),f("esri/widgets/Editor/t9n/Editor")],C.prototype,"messagesEditor",void 0),e([o(),f("esri/widgets/Feature/t9n/Feature")],C.prototype,"messagesFeature",void 0),e([o(),f("esri/widgets/FeatureForm/t9n/FeatureForm")],C.prototype,"messagesFeatureForm",void 0),e([o(),f("esri/widgets/support/FilterBuilder/t9n/FilterBuilder")],C.prototype,"messagesFilterBuilder",void 0),e([o()],C.prototype,"selectedLayer",null),e([o({type:c})],C.prototype,"viewModel",void 0),e([o()],C.prototype,"selectedFeature",null),e([o()],C.prototype,"filterWhereClause",null),e([o()],C.prototype,"view",void 0),e([o()],C.prototype,"_filterBuilder",void 0),e([o()],C.prototype,"_featureFilterText",void 0),e([o()],C.prototype,"_layerFilterText",void 0),e([o()],C.prototype,"_observer",void 0),e([o()],C.prototype,"_featureSpatialGraphics",null),e([o()],C.prototype,"_filteredFeatureItems",null),e([o()],C.prototype,"_filteredFeatureItemsPage",null),e([o()],C.prototype,"_observerNode",void 0),C=e([l("esri.widgets.FeatureForm.FeatureFormUtilityNetworkAssociations.UtilityNetworkAssociationItemList")],C);const L=C;export{L as default};
|