@arcgis/core 5.0.0-next.10 → 5.0.0-next.11

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.
Files changed (48) hide show
  1. package/analysis/VolumeMeasurement/volumeMeasurementConfiguration.js +1 -1
  2. package/applications/KnowledgeStudio/resourceSerializationUtils.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/092d72caf3269e696d1c.js +1 -0
  5. package/assets/esri/core/workers/chunks/{066a0ea67688361e85a5.js → 4291681d067ebdf86e73.js} +1 -1
  6. package/assets/esri/core/workers/chunks/655beaf83e9845a02334.js +1 -0
  7. package/assets/esri/core/workers/chunks/6cf391b5ed7351601a2a.js +1 -0
  8. package/assets/esri/core/workers/chunks/8cd03b54b2859b52fb81.js +1 -0
  9. package/assets/esri/core/workers/chunks/b193de09e005b0976a6a.js +1 -0
  10. package/assets/esri/core/workers/chunks/{4fb5f1c671892001a4fd.js → b6853c6a25eaabc9a7f6.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{8ce608013b353155ee5a.js → f57401a759f420596b2c.js} +1 -1
  12. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  13. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
  14. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
  15. package/assets/esri/themes/base/widgets/_FeatureTable.scss +2 -0
  16. package/assets/esri/themes/dark/main.css +1 -1
  17. package/assets/esri/themes/light/main.css +1 -1
  18. package/assets/esri/themes/light/view.css +1 -1
  19. package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
  20. package/chunks/arcgis-knowledge-client-core.js +1 -1
  21. package/config.js +1 -1
  22. package/interfaces.d.ts +24 -4
  23. package/kernel.js +1 -1
  24. package/layers/KnowledgeGraphLayer.js +1 -1
  25. package/layers/LinkChartLayer.js +1 -1
  26. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  27. package/layers/support/fieldFormatUtils.js +1 -1
  28. package/package.json +1 -1
  29. package/support/revision.js +1 -1
  30. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  31. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  32. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  33. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
  34. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  35. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  36. package/views/3d/support/flow/geometryUtils.js +1 -1
  37. package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
  38. package/views/draw/support/tooltipUtils.js +1 -1
  39. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  40. package/views/interactive/tooltip/fields/TooltipField.js +1 -1
  41. package/views/interactive/tooltip/infos/TooltipInfoWithCoordinates.js +1 -1
  42. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  43. package/widgets/TimeSlider.js +1 -1
  44. package/assets/esri/core/workers/chunks/57e04e2d8721bbdc029a.js +0 -1
  45. package/assets/esri/core/workers/chunks/8d9d3797c6d62fdfff9d.js +0 -1
  46. package/assets/esri/core/workers/chunks/9f21436016ff7a899e79.js +0 -1
  47. package/assets/esri/core/workers/chunks/a5a67216e0d0cee95a55.js +0 -1
  48. package/assets/esri/core/workers/chunks/d48af7bc06b4bb176534.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../Color.js";import"../../../../intl.js";import{volumeMeasurementConfiguration as i}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import s from"../../../../core/Accessor.js";import{equals as o}from"../../../../core/arrayUtils.js";import{cyclicalPI as r}from"../../../../core/Cyclical.js";import{destroyMaybe as l}from"../../../../core/maybe.js";import{formatDecimal as n}from"../../../../core/quantityFormatUtils.js";import{watch as a,initial as c}from"../../../../core/reactiveUtils.js";import{adaptiveVolumeUnit as u}from"../../../../core/unitUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as h}from"../../../../chunks/earcut.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{j as g,n as y,e as _,i as f,f as v}from"../../../../chunks/vec32.js";import{create as j,fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as L}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as C}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as w}from"../../../../geometry/support/Indices.js";import{angleAroundAxis as G}from"../../../../geometry/support/vector.js";import{t as P}from"../../../../chunks/vec3.js";import V from"../../../../symbols/support/ElevationInfo.js";import{LabelVisualElement as R}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as F}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as A}from"../../interactive/visualElements/OutlineVisualElement.js";import{EuclideanSegment as O}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as x}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as D}from"../../layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{polygonToRenderInfo as M}from"../../support/renderInfoUtils/polygon.js";import{CutFillColor as S,VolumeGeometry as U}from"../../webgl-engine/lib/CutFillColor.js";import{createStipplePatternSimple as E}from"../../webgl-engine/materials/lineStippleUtils.js";import{onLocaleChange as B}from"../../../../intl/locale.js";import{fetchMessageBundle as N}from"../../../../intl/messages.js";import{substitute as H}from"../../../../intl/substitute.js";let T=class extends s{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}get updating(){return this.loadingMessages}get hasUnsupportedError(){const{error:e}=this.analysisViewData;return!!e&&["unsupported-coordinate-system","unsupported-layer-transparency"].includes(e.name)}constructor(e){super(e),this.unitsMessages=null,this.messages=null,this.loadingMessages=!0,this._elevationContext=x.fromElevationInfo(new V({mode:"absolute-height"})),this._extrusionHeight=1e4,this._projectionLines=[]}initialize(){const{view:e}=this,s={view:e,isDecoration:!0},o=i,r={...s,width:o.geometryOutlineWidth};this._elevationAlignedGeometry=new A({...r,isDraped:!0,color:t.toUnitRGBA(o.geometryOutlineColor)}),this._targetGeometry=new A(r);const l={...s,attached:!0,width:o.projectionLineWidth,renderOccluded:4,polygonOffset:!0},n={...l,stipplePattern:E(o.projectionLineStippleSize)},u=t.toUnitRGBA(o.cutProjectionLineColor),m=t.toUnitRGBA(o.fillProjectionLineColor);this._cutProjectionLines=new F({...l,color:u}),this._occludedCutProjectionLines=new F({...n,color:u}),this._fillProjectionLines=new F({...l,color:m}),this._occludedFillProjectionLines=new F({...n,color:m});const d={...s,attached:!0};this._cutVolumeLabel=new R(d),this._fillVolumeLabel=new R(d),this._cutFillRenderNode=new S({view:e,cutColor:o.cutColor,fillColor:o.fillColor,borderColor:o.geometryOutlineColor}),this.addHandles([a(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry}),({elevationAlignedGeometry:e,targetGeometry:t})=>{this._elevationAlignedGeometry.geometry=e,this._targetGeometry.geometry=t},c),a(()=>({interactive:this.analysisViewData.interactive,measureType:this.analysis.measureType,visible:this.visible}),({visible:e,interactive:t,measureType:i})=>{this._elevationAlignedGeometry.visible=e&&!t,this._targetGeometry.visible=e&&"cut-fill"===i},c),a(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry,visible:this.visible}),({elevationAlignedGeometry:e,targetGeometry:t,visible:i})=>this._updateProjectionLines(e,t,i)),a(()=>({interactive:this.analysisViewData.interactive,accentColor:this.view.effectiveTheme.accentColor,hasResult:!!this.analysisViewData.result}),({interactive:e,accentColor:t,hasResult:i})=>{this._updateColors(e,t,i)},c),a(()=>this.analysisViewData.targetGeometry,()=>this._updateCutFillGeometry(),c),a(()=>this.visible&&!this.hasUnsupportedError,e=>this._updateCutFillVisibility(e),c),a(()=>{const{messages:e,unitsMessages:t,visible:i,analysisViewData:s}=this;return{labelAnchors:s.labelAnchors,effectiveDisplayUnits:s.effectiveDisplayUnits,messages:e,unitsMessages:t,result:s.result,visible:i&&!!s.result}},e=>this._updateLabels(e)),a(()=>this.view.state.camera,e=>this._updateProjectionLineOcclusion(e)),B(()=>this._updateMessageBundle())]),this._updateMessageBundle()}destroy(){this._elevationAlignedGeometry=l(this._elevationAlignedGeometry),this._targetGeometry=l(this._targetGeometry),this._cutProjectionLines=l(this._cutProjectionLines),this._occludedCutProjectionLines=l(this._occludedCutProjectionLines),this._fillProjectionLines=l(this._fillProjectionLines),this._occludedFillProjectionLines=l(this._occludedFillProjectionLines),this._cutVolumeLabel=l(this._cutVolumeLabel),this._fillVolumeLabel=l(this._fillVolumeLabel),this._cutFillRenderNode.destroy()}_updateProjectionLines(e,t,i){if(this._cutProjectionLines.visible=i,this._occludedCutProjectionLines.visible=i,this._fillProjectionLines.visible=i,this._occludedFillProjectionLines.visible=i,!e||!t)return;const{renderCoordsHelper:s}=this.view,r=[],l=e.spatialReference,n=e.rings[0],a=n.length>1&&o(n[0],n[n.length-1]),c=n.length-(a?1:0);for(let o=0;o<c;++o){const e=n[o],i=g(j(),e[0],e[1],e[2]);s.toRenderCoords(i,l,i);const a=t.rings[0][o],c=g(j(),a[0],a[1],a[2]);s.toRenderCoords(c,l,c);const u=new O(i,c);r.push(u)}e.isClockwise(n)||r.reverse();const u=[],m=[],d=[],h=[],p=[],y=this.view.state.camera;for(let o=0;o<r.length;++o){const i=r[o],s=r[0===o?r.length-1:o-1],l=r[o===r.length-1?0:o+1],n=e.rings[0][o],a=t.rings[0][o],c=n[2]>a[2],g=new k(i,s,l,c);u.push(g),g.updateOccluded(y);const _=g.isOccluded;c?(_?d:m).push(i):(_?p:h).push(i)}this._projectionLines=u,this._cutProjectionLines.setGeometryFromSegments(m),this._occludedCutProjectionLines.setGeometryFromSegments(d),this._fillProjectionLines.setGeometryFromSegments(h),this._occludedFillProjectionLines.setGeometryFromSegments(p)}_updateProjectionLineOcclusion(e){const t=[],i=[],s=[],o=[];let r=!1,l=!1;for(const n of this._projectionLines){n.updateOccluded(e)&&(r||=n.isCut,l||=!n.isCut);const a=n.isOccluded;(n.isCut?a?i:t:a?o:s).push(n.segment)}l&&(this._fillProjectionLines.setGeometryFromSegments(s),this._occludedFillProjectionLines.setGeometryFromSegments(o)),r&&(this._cutProjectionLines.setGeometryFromSegments(t),this._occludedCutProjectionLines.setGeometryFromSegments(i))}_updateColors(e,s,o){const{geometryOutlineColor:r,cutColor:l,fillColor:n,cutColorMuted:a,fillColorMuted:c,cutProjectionLineColor:u,fillProjectionLineColor:m}=i;if(this._cutFillRenderNode.cutColor=o?l:a,this._cutFillRenderNode.fillColor=o?n:c,e){const e=t.toUnitRGBA(s);this._targetGeometry.color=e,this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e,this._fillProjectionLines.color=e,this._occludedFillProjectionLines.color=e,this._cutFillRenderNode.borderColor=s}else{this._targetGeometry.color=t.toUnitRGBA(r);const e=t.toUnitRGBA(o?u:a);this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e;const i=t.toUnitRGBA(o?m:c);this._fillProjectionLines.color=i,this._occludedFillProjectionLines.color=i,this._cutFillRenderNode.borderColor=r}}_updateLabels(e){const{labelDistance:t}=i,{effectiveDisplayUnits:s,labelAnchors:o,messages:r,unitsMessages:l,result:n,visible:a}=e;if(this._cutVolumeLabel.visible=a,this._fillVolumeLabel.visible=a,this._cutVolumeLabel.geometry=o.cut?{type:"point",point:o.cut,callout:{distance:t,offset:0}}:null,this._fillVolumeLabel.geometry=o.fill?{type:"point",point:o.fill,callout:{distance:-t,offset:0}}:null,null==n||null==r||null==l)return this._cutVolumeLabel.text="-",void(this._fillVolumeLabel.text="-");const c=s.volume,u=H(r.labels.cut,{volume:I(l,n.cutVolume,c)}),m=H(r.labels.fill,{volume:I(l,n.fillVolume,c)});this._cutVolumeLabel.text=u,this._fillVolumeLabel.text=m}_updateCutFillVisibility(e){e?this._cutFillRenderNode.enable():this._cutFillRenderNode.disable()}_updateCutFillGeometry(){const{renderCoordsHelper:e}=this.view,{targetGeometry:t}=this.analysisViewData;if(!t?.extent)return;const{center:i}=t.extent,s=b(i.x,i.y,0),o=j();e.toRenderCoords(s,t.spatialReference,o);const r=this._getExtrudedVolumes(t,this._extrusionHeight,s),l=this._getExtrudedVolumes(t,-this._extrusionHeight,s);this._cutFillRenderNode.updateGeometries(r,l,o)}_getExtrudedVolumes(e,t,i){const{renderCoordsHelper:s,spatialReference:o,elevationProvider:r}=this.view,l=j(),n=1===s.viewingMode;n||s.worldUpAtPosition([0,0,0],l);const a=M(e,r,s,this._elevationContext),{polygons:c,mapPositions:u,position:m}=a,d=c[0],g=d.count,y=h(d.mapPositions,d.holeIndices,3),_=y.length,f=6*g,v=w(f+_),b=w(_),G=C(3*f),V=C(3*f);D(m,u,y,d,G,null,V,null,v,b,t,l,n);const R=p(),F=p();return L(o,i,R,s.spatialReference),F[12]=-R[12],F[13]=-R[13],F[14]=-R[14],P(G,G,F),new U(G,b,v,V)}async _updateMessageBundle(){this.loadingMessages=!0;try{this.unitsMessages=await N("esri/core/t9n/Units"),this.messages=await N("esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis")}finally{this.loadingMessages=!1}}};function I(e,t,s){if(!t||!e)return null;const o=u(t.value,t.unit,s),r=i.labelPrecisions[o];return n(e,t,o,r)}e([m({constructOnly:!0})],T.prototype,"view",void 0),e([m({constructOnly:!0})],T.prototype,"analysis",void 0),e([m({constructOnly:!0})],T.prototype,"analysisViewData",void 0),e([m()],T.prototype,"unitsMessages",void 0),e([m()],T.prototype,"messages",void 0),e([m()],T.prototype,"loadingMessages",void 0),e([m({readOnly:!0})],T.prototype,"visible",null),e([m()],T.prototype,"updating",null),e([m()],T.prototype,"hasUnsupportedError",null),T=e([d("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillVisualization")],T);class k{constructor(e,t,i,s){this.segment=e,this.previous=t,this.next=i,this.isCut=s,this._isOccluded=!1,this._n1=j(),this._n2=j();const o=y(z,_(z,e.endRenderSpace,e.startRenderSpace));y(this._n1,f(this._n1,o,y(W,_(W,t.startRenderSpace,e.startRenderSpace)))),y(this._n2,f(this._n2,o,y(W,_(W,e.startRenderSpace,i.startRenderSpace)))),this._isConvex=r.normalize(G(this._n1,this._n2,o))<0}get isOccluded(){return this._isOccluded}updateOccluded(e){_(z,this.segment.startRenderSpace,e.eye);const t=v(this._n1,z)<0,i=v(this._n2,z)<0,s=this._isOccluded;return this._isOccluded=this._isConvex?t&&i:t||i,this._isOccluded!==s}}const z=j(),W=j();export{T as VolumeMeasurementCutFillVisualization};
5
+ import{__decorate as e}from"tslib";import t from"../../../../Color.js";import"../../../../intl.js";import{volumeMeasurementConfiguration as i}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import s from"../../../../core/Accessor.js";import{equals as o}from"../../../../core/arrayUtils.js";import{cyclicalPI as r}from"../../../../core/Cyclical.js";import{destroyMaybe as l}from"../../../../core/maybe.js";import{formatDecimal as n}from"../../../../core/quantityFormatUtils.js";import{watch as a,initial as c}from"../../../../core/reactiveUtils.js";import{adaptiveVolumeUnit as u}from"../../../../core/unitUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as h}from"../../../../chunks/earcut.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{j as g,n as y,e as _,i as f,f as v}from"../../../../chunks/vec32.js";import{create as j,fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as L}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as C}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as w}from"../../../../geometry/support/Indices.js";import{angleAroundAxis as G}from"../../../../geometry/support/vector.js";import{t as P}from"../../../../chunks/vec3.js";import V from"../../../../symbols/support/ElevationInfo.js";import{LabelVisualElement as R}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as F}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as A}from"../../interactive/visualElements/OutlineVisualElement.js";import{EuclideanSegment as O}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as x}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as D}from"../../layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{polygonToRenderInfo as M}from"../../support/renderInfoUtils/polygon.js";import{CutFillColor as S,VolumeGeometry as U}from"../../webgl-engine/lib/CutFillColor.js";import{createStipplePatternSimple as E}from"../../webgl-engine/materials/lineStippleUtils.js";import{onLocaleChange as B}from"../../../../intl/locale.js";import{fetchMessageBundle as N}from"../../../../intl/messages.js";import{substitute as H}from"../../../../intl/substitute.js";let T=class extends s{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}get updating(){return this.loadingMessages}get hasUnsupportedError(){const{error:e}=this.analysisViewData;return!!e&&["unsupported-coordinate-system","unsupported-layer-transparency"].includes(e.name)}constructor(e){super(e),this.unitsMessages=null,this.messages=null,this.loadingMessages=!0,this._elevationContext=x.fromElevationInfo(new V({mode:"absolute-height"})),this._extrusionHeight=i.targetElevationRange,this._projectionLines=[]}initialize(){const{view:e}=this,s={view:e,isDecoration:!0},o=i,r={...s,width:o.geometryOutlineWidth};this._elevationAlignedGeometry=new A({...r,isDraped:!0,color:t.toUnitRGBA(o.geometryOutlineColor)}),this._targetGeometry=new A(r);const l={...s,attached:!0,width:o.projectionLineWidth,renderOccluded:4,polygonOffset:!0},n={...l,stipplePattern:E(o.projectionLineStippleSize)},u=t.toUnitRGBA(o.cutProjectionLineColor),m=t.toUnitRGBA(o.fillProjectionLineColor);this._cutProjectionLines=new F({...l,color:u}),this._occludedCutProjectionLines=new F({...n,color:u}),this._fillProjectionLines=new F({...l,color:m}),this._occludedFillProjectionLines=new F({...n,color:m});const d={...s,attached:!0};this._cutVolumeLabel=new R(d),this._fillVolumeLabel=new R(d),this._cutFillRenderNode=new S({view:e,cutColor:o.cutColor,fillColor:o.fillColor,borderColor:o.geometryOutlineColor}),this.addHandles([a(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry}),({elevationAlignedGeometry:e,targetGeometry:t})=>{this._elevationAlignedGeometry.geometry=e,this._targetGeometry.geometry=t},c),a(()=>({interactive:this.analysisViewData.interactive,measureType:this.analysis.measureType,visible:this.visible}),({visible:e,interactive:t,measureType:i})=>{this._elevationAlignedGeometry.visible=e&&!t,this._targetGeometry.visible=e&&"cut-fill"===i},c),a(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry,visible:this.visible}),({elevationAlignedGeometry:e,targetGeometry:t,visible:i})=>this._updateProjectionLines(e,t,i),c),a(()=>({interactive:this.analysisViewData.interactive,accentColor:this.view.effectiveTheme.accentColor,hasResult:!!this.analysisViewData.result}),({interactive:e,accentColor:t,hasResult:i})=>{this._updateColors(e,t,i)},c),a(()=>this.analysisViewData.targetGeometry,()=>this._updateCutFillGeometry(),c),a(()=>this.visible&&!this.hasUnsupportedError,e=>this._updateCutFillVisibility(e),c),a(()=>{const{messages:e,unitsMessages:t,visible:i,analysisViewData:s}=this;return{labelAnchors:s.labelAnchors,effectiveDisplayUnits:s.effectiveDisplayUnits,messages:e,unitsMessages:t,result:s.result,visible:i&&!!s.result}},e=>this._updateLabels(e)),a(()=>this.view.state.camera,e=>this._updateProjectionLineOcclusion(e),c),B(()=>this._updateMessageBundle())]),this._updateMessageBundle()}destroy(){this._elevationAlignedGeometry=l(this._elevationAlignedGeometry),this._targetGeometry=l(this._targetGeometry),this._cutProjectionLines=l(this._cutProjectionLines),this._occludedCutProjectionLines=l(this._occludedCutProjectionLines),this._fillProjectionLines=l(this._fillProjectionLines),this._occludedFillProjectionLines=l(this._occludedFillProjectionLines),this._cutVolumeLabel=l(this._cutVolumeLabel),this._fillVolumeLabel=l(this._fillVolumeLabel),this._cutFillRenderNode.destroy()}_updateProjectionLines(e,t,i){if(this._cutProjectionLines.visible=i,this._occludedCutProjectionLines.visible=i,this._fillProjectionLines.visible=i,this._occludedFillProjectionLines.visible=i,!e||!t)return;const{renderCoordsHelper:s}=this.view,r=[],l=e.spatialReference,n=e.rings[0],a=n.length>1&&o(n[0],n[n.length-1]),c=n.length-(a?1:0);for(let o=0;o<c;++o){const e=n[o],i=g(j(),e[0],e[1],e[2]);s.toRenderCoords(i,l,i);const a=t.rings[0][o],c=g(j(),a[0],a[1],a[2]);s.toRenderCoords(c,l,c);const u=new O(i,c);r.push(u)}e.isClockwise(n)||r.reverse();const u=[],m=[],d=[],h=[],p=[],y=this.view.state.camera;for(let o=0;o<r.length;++o){const i=r[o],s=r[0===o?r.length-1:o-1],l=r[o===r.length-1?0:o+1],n=e.rings[0][o],a=t.rings[0][o],c=n[2]>a[2],g=new k(i,s,l,c);u.push(g),g.updateOccluded(y);const _=g.isOccluded;c?(_?d:m).push(i):(_?p:h).push(i)}this._projectionLines=u,this._cutProjectionLines.setGeometryFromSegments(m),this._occludedCutProjectionLines.setGeometryFromSegments(d),this._fillProjectionLines.setGeometryFromSegments(h),this._occludedFillProjectionLines.setGeometryFromSegments(p)}_updateProjectionLineOcclusion(e){const t=[],i=[],s=[],o=[];let r=!1,l=!1;for(const n of this._projectionLines){n.updateOccluded(e)&&(r||=n.isCut,l||=!n.isCut);const a=n.isOccluded;(n.isCut?a?i:t:a?o:s).push(n.segment)}l&&(this._fillProjectionLines.setGeometryFromSegments(s),this._occludedFillProjectionLines.setGeometryFromSegments(o)),r&&(this._cutProjectionLines.setGeometryFromSegments(t),this._occludedCutProjectionLines.setGeometryFromSegments(i))}_updateColors(e,s,o){const{geometryOutlineColor:r,cutColor:l,fillColor:n,cutColorMuted:a,fillColorMuted:c,cutProjectionLineColor:u,fillProjectionLineColor:m}=i;if(this._cutFillRenderNode.cutColor=o?l:a,this._cutFillRenderNode.fillColor=o?n:c,e){const e=t.toUnitRGBA(s);this._targetGeometry.color=e,this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e,this._fillProjectionLines.color=e,this._occludedFillProjectionLines.color=e,this._cutFillRenderNode.borderColor=s}else{this._targetGeometry.color=t.toUnitRGBA(r);const e=t.toUnitRGBA(o?u:a);this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e;const i=t.toUnitRGBA(o?m:c);this._fillProjectionLines.color=i,this._occludedFillProjectionLines.color=i,this._cutFillRenderNode.borderColor=r}}_updateLabels(e){const{labelDistance:t}=i,{effectiveDisplayUnits:s,labelAnchors:o,messages:r,unitsMessages:l,result:n,visible:a}=e;if(this._cutVolumeLabel.visible=a,this._fillVolumeLabel.visible=a,this._cutVolumeLabel.geometry=o.cut?{type:"point",point:o.cut,callout:{distance:t,offset:0}}:null,this._fillVolumeLabel.geometry=o.fill?{type:"point",point:o.fill,callout:{distance:-t,offset:0}}:null,null==n||null==r||null==l)return this._cutVolumeLabel.text="-",void(this._fillVolumeLabel.text="-");const c=s.volume,u=H(r.labels.cut,{volume:I(l,n.cutVolume,c)}),m=H(r.labels.fill,{volume:I(l,n.fillVolume,c)});this._cutVolumeLabel.text=u,this._fillVolumeLabel.text=m}_updateCutFillVisibility(e){e?this._cutFillRenderNode.enable():this._cutFillRenderNode.disable()}_updateCutFillGeometry(){const{renderCoordsHelper:e}=this.view,{targetGeometry:t}=this.analysisViewData;if(!t?.extent)return;const{center:i}=t.extent,s=b(i.x,i.y,0),o=j();e.toRenderCoords(s,t.spatialReference,o);const r=this._getExtrudedVolumes(t,this._extrusionHeight,s),l=this._getExtrudedVolumes(t,-this._extrusionHeight,s);this._cutFillRenderNode.updateGeometries(r,l,o)}_getExtrudedVolumes(e,t,i){const{renderCoordsHelper:s,spatialReference:o,elevationProvider:r}=this.view,l=j(),n=1===s.viewingMode;n||s.worldUpAtPosition([0,0,0],l);const a=M(e,r,s,this._elevationContext),{polygons:c,mapPositions:u,position:m}=a,d=c[0],g=d.count,y=h(d.mapPositions,d.holeIndices,3),_=y.length,f=6*g,v=w(f+_),b=w(_),G=C(3*f),V=C(3*f);D(m,u,y,d,G,null,V,null,v,b,t,l,n);const R=p(),F=p();return L(o,i,R,s.spatialReference),F[12]=-R[12],F[13]=-R[13],F[14]=-R[14],P(G,G,F),new U(G,b,v,V)}async _updateMessageBundle(){this.loadingMessages=!0;try{this.unitsMessages=await N("esri/core/t9n/Units"),this.messages=await N("esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis")}finally{this.loadingMessages=!1}}};function I(e,t,s){if(!t||!e)return null;const o=u(t.value,t.unit,s),r=i.labelPrecisions[o];return n(e,t,o,r)}e([m({constructOnly:!0})],T.prototype,"view",void 0),e([m({constructOnly:!0})],T.prototype,"analysis",void 0),e([m({constructOnly:!0})],T.prototype,"analysisViewData",void 0),e([m()],T.prototype,"unitsMessages",void 0),e([m()],T.prototype,"messages",void 0),e([m()],T.prototype,"loadingMessages",void 0),e([m({readOnly:!0})],T.prototype,"visible",null),e([m()],T.prototype,"updating",null),e([m()],T.prototype,"hasUnsupportedError",null),T=e([d("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillVisualization")],T);class k{constructor(e,t,i,s){this.segment=e,this.previous=t,this.next=i,this.isCut=s,this._isOccluded=!1,this._n1=j(),this._n2=j();const o=y(z,_(z,e.endRenderSpace,e.startRenderSpace));y(this._n1,f(this._n1,o,y(W,_(W,t.startRenderSpace,e.startRenderSpace)))),y(this._n2,f(this._n2,o,y(W,_(W,e.startRenderSpace,i.startRenderSpace)))),this._isConvex=r.normalize(G(this._n1,this._n2,o))<0}get isOccluded(){return this._isOccluded}updateOccluded(e){_(z,this.segment.startRenderSpace,e.eye);const t=v(this._n1,z)<0,i=v(this._n2,z)<0,s=this._isOccluded;return this._isOccluded=this._isConvex?t&&i:t||i,this._isOccluded!==s}}const z=j(),W=j();export{T as VolumeMeasurementCutFillVisualization};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import o from"../../../../Color.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newFloatArray as e}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as r}from"../../../../geometry/support/HalfFloatArray.js";import{zValueInAbsoluteHeightMode as i}from"../../../../support/elevationInfoUtils.js";import{convertVisualVariables as s,ConvertOptions as n}from"../../layers/support/FastSymbolUpdates.js";import{animatedLineStripsToParameters as a,createGeometry as l}from"../engineContent/line.js";import{valuesPerFlowVertex as p}from"./loadUtils.js";import{drapedZ as m}from"../../terrain/OverlayRenderer.js";function c(o,t,{vertices:i,stage:s,hasMagnitude:n},c,f,d){const{spatialReference:v}=t.extent,h=[],y=p(n),g=t.flowExtentInfo.modelSize[0];let j=0;for(let e=0;e<i.length;e+=y){if(d&&e>0){const o=i[e]-i[e-y];o>g/2?j-=g:-o>g/2&&(j+=g)}const[r,s]=t.modelToMapSpace(i[e]+j,i[e+1],!1),n=d?[r,s,m]:u(r,s,v,o,c);h.push(n)}const S=Math.floor(i.length/y),V=r(S);for(let e=0;e<S;e++)V[e]=i[e*y+2];const{hasVVColor:C,hasVVOpacity:b,hasVVSize:z}=f.parameters;let w,x,R;if(n&&(C||b||z)){const o=e(S);for(let t=0;t<S;t++)o[t]=i[t*y+3];C&&(w=[o]),b&&(x=[o]),z&&(R=[o])}const U=a([h],void 0,[{timeStamps:V,streamlineType:s}],w,x,R);return l(f,U[0])}function f(t,e,r){if(null==t)return{};let i=null;if(t.visualVariables){const o=[],e=t.visualVariables,r=new n({supports:{size:!0,color:!0,rotation:!1,opacity:!0}});i=s(e,r,o)}const a=i?.color?[1,1,1,1]:o.toUnitRGBA(t.color);a[3]*=e;return{color:a,width:t.trailWidth,cap:2,animationSpeed:t.flowSpeed,trailLength:t.trailLength,animation:3,emissiveStrength:r,vvColor:i?.color,vvOpacity:i?.opacity,vvSize:i?.size}}function u(o,e,r,s,n){const{absoluteZ:a}=i(o,e,0,r,s,n),l=t(o,e,a);return s.renderCoordsHelper.toRenderCoords(l,r,l),l}export{c as createStreamlineGeometry,f as materialParametersFromRenderer};
5
+ import o from"../../../../Color.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newFloatArray as e}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as r}from"../../../../geometry/support/HalfFloatArray.js";import{zValueInAbsoluteHeightMode as i}from"../../../../support/elevationInfoUtils.js";import{convertVisualVariables as s,ConvertOptions as n}from"../../layers/support/FastSymbolUpdates.js";import{animatedLineStripsToParameters as a,createGeometry as l}from"../engineContent/line.js";import{valuesPerFlowVertex as p}from"./loadUtils.js";import{drapedZ as m}from"../../terrain/OverlayRenderer.js";function c(o,t,{vertices:i,stage:s,hasMagnitude:n},c,f,d){const{spatialReference:v}=t.extent,h=[],y=p(n),g=t.flowExtentInfo.modelSize[0];let j=0;for(let e=0;e<i.length;e+=y){if(d&&e>0){const o=i[e]-i[e-y];o>g/2?j-=g:-o>g/2&&(j+=g)}const[r,s]=t.modelToMapSpace(i[e]+j,i[e+1],!1),n=d?[r,s,m]:u(r,s,v,o,c);h.push(n)}const S=Math.floor(i.length/y),V=r(S);for(let e=0;e<S;e++)V[e]=i[e*y+2];const{hasVVColor:C,hasVVOpacity:b,hasVVSize:z}=f.parameters;let w,x,R;if(n&&(C||b||z)){const o=e(S);for(let t=0;t<S;t++)o[t]=i[t*y+3];C&&(w=[o]),b&&(x=[o]),z&&(R=[o])}const U=a([h],void 0,[{timeStamps:V,streamlineType:s}],w,x,R);return l(f,U[0])}function f(t,e,r){if(null==t)return{};let i=null;if(t.visualVariables){const o=[],e=t.visualVariables,r=new n({supports:{size:!0,color:!0,rotation:!1,opacity:!0}});i=s(e,r,o)}const a=i?.color?[1,1,1,1]:o.toUnitRGBA(t.color);a[3]*=e;return{color:a,width:t.trailWidth,cap:0,animationSpeed:t.flowSpeed,trailLength:t.trailLength,animation:3,emissiveStrength:r,vvColor:i?.color,vvOpacity:i?.opacity,vvSize:i?.size}}function u(o,e,r,s,n){const{absoluteZ:a}=i(o,e,0,r,s,n),l=t(o,e,a);return s.renderCoordsHelper.toRenderCoords(l,r,l),l}export{c as createStreamlineGeometry,f as materialParametersFromRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import has from"../../../../core/has.js";import{nextPowerOfTwo as t}from"../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{ortho as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderCategory as a,InternalRenderCategory as n}from"../../webgl.js";import{glLayout as c}from"../../support/buffer/glUtil.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import u from"../../webgl/RenderCamera.js";import d from"../../webgl/RenderNode.js";import{ShaderOutputConfiguration as p}from"../core/shaderLibrary/ShaderOutputConfiguration.js";import{VertexArrayObject as m}from"./VertexArrayObject.js";import{C as g}from"../../../../chunks/CutFillDepth.glsl.js";import{CutFillDepthTechnique as f}from"../shaders/CutFillDepthTechnique.js";import{C as _}from"../../../../chunks/CutFillReduction.glsl.js";import{CutFillReductionTechnique as b}from"../shaders/CutFillReductionTechnique.js";import{C as w}from"../../../../chunks/CutFillTargetDepth.glsl.js";import{CutFillTargetDepthTechnique as F}from"../shaders/CutFillTargetDepthTechnique.js";import{PrimitiveType as C,DataType as T}from"../../../webgl/enums.js";import{VertexBuffer as x}from"../../../webgl/VertexBuffer.js";let j=class extends d{constructor(e){super(e),this.consumes={required:[a.TRANSPARENT]},this.produces=n.CUTFILL_DEPTH,this._cutFillTargetDepthConfiguration=new p,this._cutFillTargetDepthParameters=new w,this._cutFillDepthParameters=new g,this._cutFillReductionParameters=new _,this.needsRender=!1,this.done=!0,this._localOrigin=o(),this._maxTextureSize=4096,this._width=0,this._height=0,this._reducedWidth=0,this._reducedHeight=0,this._depthFormat=13,this._colorFormat=10,this._targetVao=null}initialize(){this._maxTextureSize=Math.min(has("esri-mobile")?1024:this._maxTextureSize,this.fboCache.rctx.parameters.maxTextureSize),this._cutFillTargetDepthConfiguration.output=8}destroy(){this._targetVao=r(this._targetVao)}precompile(){this.techniques.precompile(F,this._cutFillTargetDepthConfiguration),this.techniques.precompile(f),this.techniques.precompile(b),this.view.stage.renderer.precompileCutFill()}render(e){const t=e.find(({name:e})=>e===n.CUTFILL_DEPTH);if(!this._orthographicCamera||!this._targetVao||!this.needsRender)return t;const r=this.techniques.get(F,this._cutFillTargetDepthConfiguration),i=this.techniques.get(f),s=this.techniques.get(b);if(!r.compiled||!i.compiled||!s.compiled)return this.requestRender(1),t;this.needsRender=!1;const h=this.renderingContext,o=this.fboCache,a=h.getViewport(),c=o.acquire(this._width,this._height,"cutfill reference depth",this._depthFormat);h.bindFramebuffer(c.fbo),h.setViewport(0,0,this._width,this._height),h.clear(1280),this.view.stage.renderer.renderCutFillReferenceDepth(this._orthographicCamera);const l=o.acquire(this._width,this._height,"cutfill target depth",this._depthFormat);h.bindFramebuffer(l.fbo),h.setViewport(0,0,this._width,this._height),h.setClearDepth(1),h.clear(256),this._cutFillTargetDepthParameters.origin=this._localOrigin,this._cutFillTargetDepthParameters.cutFillCamera=this._orthographicCamera,h.bindTechnique(r,this.bindParameters,this._cutFillTargetDepthParameters),h.bindVAO(this._targetVao),h.drawArrays(C.TRIANGLES,0,this._targetVao.vertexCount("geometry"));let u=o.acquire(this._width,this._height,"cutfill reduction even",this._colorFormat),d=o.acquire(this._width,this._height,"cutfill reduction odd",this._colorFormat);this._cutFillDepthParameters.referenceDepthTexture=c.depthTexture,this._cutFillDepthParameters.targetDepthTexture=l.depthTexture,h.bindFramebuffer(u.fbo),h.bindTechnique(i,this.bindParameters,this._cutFillDepthParameters),h.setClearColor(0,0,0,0),h.clear(16384),h.screen.draw(),c.release(),l.release();let p=this._width,m=this._height;const g=Math.ceil(Math.log2(Math.min(p,m)));for(let n=0;n<g;n++)p=Math.ceil(p/2),m=Math.ceil(m/2),this._cutFillReductionParameters.depthTexture=u.getTexture(),this._prepareFBO(d,p,m),h.bindTechnique(s,this.bindParameters,this._cutFillReductionParameters),h.screen.draw(),[u,d]=[d,u];return this._buffer=new Float32Array(p*m*2),u.fbo?.readPixels(0,0,p,m,33319,T.FLOAT,this._buffer),this._reducedWidth=p,this._reducedHeight=m,u.release(),d.release(),h.setViewport(a.x,a.y,a.width,a.height),this.done=!0,t}setup(e,i){const s=this.renderingContext,{cameraDimensions:{width:h,height:o},localOriginRenderSpace:a}=e,n=this._maxTextureSize,c=o/h,l=h>o?n:n/c,u=h>o?n*c:n;this._width=t(l),this._height=t(u);const d=[this._width,this._height];this._orthographicCamera=this._createCamera(e,d),this._targetVao=r(this._targetVao),this._targetVao=R(s,i),this._localOrigin=a,this.done=!1}start(){0!==this._width&&0!==this._height&&(this.needsRender=!0)}getDepth(){let e=0,t=0;for(let r=0;r<this._reducedWidth;r++)for(let i=0;i<this._reducedHeight;i++){const s=r+i*this._reducedHeight;e+=this._buffer?.[2*s]??0,t+=this._buffer?.[2*s+1]??0}return{cut:e,fill:t}}get width(){return this._width}get height(){return this._height}get updating(){return this.needsRender||!this.done}_prepareFBO(e,t,r){const i=this.renderingContext;i.bindFramebuffer(e.fbo),i.setViewport(0,0,t,r),i.setClearColor(0,0,0,0),i.clear(16384)}_createCamera(e,t){const{cameraPositionRenderSpace:r,localOriginRenderSpace:i,northVector:s,cameraDimensions:{width:o,height:a},cameraNearFar:{near:n,far:c}}=e,l=new u({eye:r,center:i,up:s,near:n,far:c});return l.viewport=[0,0,t[0],t[1]],h(l.projectionMatrix,-o/2,o/2,-a/2,a/2,n,c),l}};e([i()],j.prototype,"consumes",void 0),e([i()],j.prototype,"produces",void 0),e([i()],j.prototype,"needsRender",void 0),e([i()],j.prototype,"done",void 0),e([i()],j.prototype,"updating",null),j=e([s("esri.views.3d.webgl-engine.lib.CutFillDepth")],j);const D=l().vec3f("position").freeze();function R(e,t){const{positions:r,indices:i}=t,s=D.createBuffer(i.length),h=s.position;for(let a=0;a<i.length;++a){const e=3*i[a];h.set(a,0,r[e]),h.set(a,1,r[e+1]),h.set(a,2,r[e+2])}const o=new x(e,c(D),s.buffer);return new m(e,o)}class P{constructor(e,t,r){this.localOrigin=e,this.positions=t,this.indices=r}}export{j as CutFillDepth,P as TargetGeometry};
5
+ import{__decorate as e}from"tslib";import has from"../../../../core/has.js";import{nextPowerOfTwo as t}from"../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{ortho as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderCategory as a,InternalRenderCategory as n}from"../../webgl.js";import{glLayout as c}from"../../support/buffer/glUtil.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import u from"../../webgl/RenderCamera.js";import d from"../../webgl/RenderNode.js";import{ShaderOutputConfiguration as p}from"../core/shaderLibrary/ShaderOutputConfiguration.js";import{VertexArrayObject as m}from"./VertexArrayObject.js";import{C as g}from"../../../../chunks/CutFillDepth.glsl.js";import{CutFillDepthTechnique as f}from"../shaders/CutFillDepthTechnique.js";import{C as _}from"../../../../chunks/CutFillReduction.glsl.js";import{CutFillReductionTechnique as b}from"../shaders/CutFillReductionTechnique.js";import{C as w}from"../../../../chunks/CutFillTargetDepth.glsl.js";import{CutFillTargetDepthTechnique as F}from"../shaders/CutFillTargetDepthTechnique.js";import{PrimitiveType as C,DataType as T}from"../../../webgl/enums.js";import{VertexBuffer as x}from"../../../webgl/VertexBuffer.js";let j=class extends d{constructor(e){super(e),this.consumes={required:[a.TRANSPARENT]},this.produces=n.CUTFILL_DEPTH,this._cutFillTargetDepthConfiguration=new p,this._cutFillTargetDepthParameters=new w,this._cutFillDepthParameters=new g,this._cutFillReductionParameters=new _,this.needsRender=!1,this.done=!0,this._localOrigin=o(),this._maxTextureSize=4096,this._width=0,this._height=0,this._reducedWidth=0,this._reducedHeight=0,this._depthFormat=13,this._colorFormat=10,this._targetVao=null}initialize(){this._maxTextureSize=Math.min(has("esri-mobile")?1024:this._maxTextureSize,this.fboCache.rctx.parameters.maxTextureSize),this._cutFillTargetDepthConfiguration.output=8}destroy(){this._targetVao=r(this._targetVao)}precompile(){this.techniques.precompile(F,this._cutFillTargetDepthConfiguration),this.techniques.precompile(f),this.techniques.precompile(b),this.view.stage.renderer.precompileCutFill()}render(e){const t=e.find(({name:e})=>e===n.CUTFILL_DEPTH);if(!this._orthographicCamera||!this._targetVao||!this.needsRender)return t;const r=this.techniques.get(F,this._cutFillTargetDepthConfiguration),i=this.techniques.get(f),s=this.techniques.get(b);if(!r.compiled||!i.compiled||!s.compiled)return this.requestRender(1),t;this.needsRender=!1;const h=this.renderingContext,o=this.fboCache,a=h.getViewport(),c=o.acquire(this._width,this._height,"cutfill reference depth",this._depthFormat);h.bindFramebuffer(c.fbo),h.setViewport(0,0,this._width,this._height),h.clear(1280),this.view.stage.renderer.renderCutFillReferenceDepth(this._orthographicCamera);const l=o.acquire(this._width,this._height,"cutfill target depth",this._depthFormat);h.bindFramebuffer(l.fbo),h.setViewport(0,0,this._width,this._height),h.setClearDepth(1),h.clear(256),this._cutFillTargetDepthParameters.origin=this._localOrigin,this._cutFillTargetDepthParameters.cutFillCamera=this._orthographicCamera,h.bindTechnique(r,this.bindParameters,this._cutFillTargetDepthParameters),h.bindVAO(this._targetVao),h.drawArrays(C.TRIANGLES,0,this._targetVao.vertexCount("geometry"));let u=o.acquire(this._width,this._height,"cutfill reduction even",this._colorFormat),d=o.acquire(this._width,this._height,"cutfill reduction odd",this._colorFormat);this._cutFillDepthParameters.referenceDepthTexture=c.depthTexture,this._cutFillDepthParameters.targetDepthTexture=l.depthTexture,h.bindFramebuffer(u.fbo),h.bindTechnique(i,this.bindParameters,this._cutFillDepthParameters),h.setClearColor(0,0,0,0),h.clear(16384),h.screen.draw(),c.release(),l.release();let p=this._width,m=this._height;const g=Math.ceil(Math.log2(Math.min(p,m)));for(let n=0;n<g;n++)p=Math.ceil(p/2),m=Math.ceil(m/2),this._cutFillReductionParameters.depthTexture=u.getTexture(),this._prepareFBO(d,p,m),h.bindTechnique(s,this.bindParameters,this._cutFillReductionParameters),h.screen.draw(),[u,d]=[d,u];return this._buffer=new Float32Array(p*m*2),u.fbo?.readPixels(0,0,p,m,33319,T.FLOAT,this._buffer),this._reducedWidth=p,this._reducedHeight=m,u.release(),d.release(),h.setViewport(a.x,a.y,a.width,a.height),this.done=!0,t}setup(e,i){const s=this.renderingContext,{cameraDimensions:{width:h,height:o},localOriginRenderSpace:a}=e,n=this._maxTextureSize,c=o/h,l=h>o?n:n/c,u=h>o?n*c:n;this._width=t(l),this._height=t(u);const d=[this._width,this._height];this._orthographicCamera=this._createCamera(e,d),this._targetVao=r(this._targetVao),this._targetVao=R(s,i),this._localOrigin=a,this.done=!1}start(){0!==this._width&&0!==this._height&&(this.needsRender=!0)}getDepth(){let e=0,t=0;for(let r=0;r<this._reducedWidth;r++)for(let i=0;i<this._reducedHeight;i++){const s=r+i*this._reducedHeight;e+=this._buffer?.[2*s]??0,t+=this._buffer?.[2*s+1]??0}return{cut:e,fill:t}}get width(){return this._width}get height(){return this._height}get updating(){return this.needsRender||!this.done}_prepareFBO(e,t,r){const i=this.renderingContext;i.bindFramebuffer(e.fbo),i.setViewport(0,0,t,r),i.setClearColor(0,0,0,0),i.clear(16384)}_createCamera(e,t){const{cameraPositionRenderSpace:r,localOriginRenderSpace:i,northVector:s,cameraDimensions:{width:o,height:a},cameraNearFar:{near:n,far:c}}=e,l=new u({eye:r,center:i,up:s,near:n,far:c});return l.viewport=[0,0,t[0],t[1]],h(l.projectionMatrix,-o/2,o/2,-a/2,a/2,n,c),l}};e([i()],j.prototype,"consumes",void 0),e([i()],j.prototype,"produces",void 0),e([i()],j.prototype,"needsRender",void 0),e([i()],j.prototype,"done",void 0),e([i()],j.prototype,"updating",null),j=e([s("esri.views.3d.webgl-engine.lib.CutFillDepth")],j);const D=l().vec3f("position").freeze();function R(e,t){const{positions:r,indices:i}=t,s=D.createBuffer(i.length),h=s.position;for(let a=0;a<i.length;++a){const e=3*i[a];h.set(a,0,r[e]),h.set(a,1,r[e+1]),h.set(a,2,r[e+2])}const o=new x(e,c(D),s.buffer);return new m(e,o)}class P{constructor(e,t){this.positions=e,this.indices=t}}export{j as CutFillDepth,P as TargetGeometryRenderInfo};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{valueInUnit as e,zeroSquareMeters as t,zeroMeters as o,createLength as n,zeroDegreesGeographic as i}from"../../../core/quantityUtils.js";import{getMetersPerVerticalUnitForSR as r}from"../../../core/unitUtils.js";import{ensureType as a}from"../../../core/accessorSupport/ensureType.js";import c from"../../../geometry/Point.js";import{absoluteHeightElevationInfo as l,getConvertedElevationFromXYZ as s}from"../../../support/elevationInfoUtils.js";import{getDrawHelpMessage as p}from"./helpMessageUtils.js";import{getDrawMeshHelpMessage as u}from"./helpMessageUtils3d.js";import{getConstraintContext as m}from"../../interactive/sketch/constraintUtils.js";import{updateTooltipInfoFromMeshTransform as d}from"../../interactive/tooltip/tooltipCommonUtils.js";import{DrawCircleTooltipInfo as f}from"../../interactive/tooltip/infos/DrawCircleTooltipInfo.js";import{DrawMeshTooltipInfo as y}from"../../interactive/tooltip/infos/DrawMeshTooltipInfo.js";import{DrawMultipointTooltipInfo as g}from"../../interactive/tooltip/infos/DrawMultipointTooltipInfo.js";import{DrawPointTooltipInfo as w}from"../../interactive/tooltip/infos/DrawPointTooltipInfo.js";import{DrawPolygonTooltipInfo as h}from"../../interactive/tooltip/infos/DrawPolygonTooltipInfo.js";import{DrawPolylineTooltipInfo as v}from"../../interactive/tooltip/infos/DrawPolylineTooltipInfo.js";import{DrawRectangleTooltipInfo as O}from"../../interactive/tooltip/infos/DrawRectangleTooltipInfo.js";import{directionForVertices as k}from"../../support/angularMeasurementUtils.js";import{elevationFromZ as M,elevationFromPoint as x}from"../../support/euclideanLengthMeasurementUtils.js";function D(e,t){return{point:new w({sketchOptions:t,viewType:e}),multipoint:new g({sketchOptions:t,viewType:e}),polyline:new v({sketchOptions:t,viewType:e}),polygon:new h({sketchOptions:t,viewType:e}),mesh:new y({sketchOptions:t,viewType:e}),rectangle:new O({sketchOptions:t}),circle:new f({sketchOptions:t})}}function T(e){const{directionOptions:t,geometryType:o,sketchOptions:n,tooltipInfos:i}=e,r=t=>{const o=N(e).mode,n=i[t].elevation;"relative-to-ground"===o||"relative-to-scene"===o||"on-the-ground"===o?n.lock(W(e)):n.unlock()},a=e=>{if(t){const o=i[e].direction;o.committed=t.angle,o.unlockOnVertexPlacement=!1,n.values.directionMode=t.mode}};switch(o){case"polygon":case"polyline":r(o),a(o);break;case"point":case"mesh":r(o)}}function j(e,t){const{drawOperation:o,view:n}=t,i=b(t),r=N(t);if("2d"===n.type||!e||"absolute-height"!==r.mode||1!==o?.numCommittedVertices||!i||"draw-polyline"!==i.type&&"draw-polygon"!==i.type||i.elevation.locked)return;const[a,c,l]=e,s=K(a,c,l,r,t);null!=s&&i.elevation.lock(s)}function U(e){b(e)?.allFields.forEach(e=>{e.unlockOnVertexPlacement&&e.unlock()})}function b({geometryType:e,graphic:t,tooltipInfos:o}){return t?.geometry?.type!==P[e]?"circle"===e||"rectangle"===e?o[e]:null:o[e]}const P={point:"point",multipoint:"multipoint",mesh:"mesh",polyline:"polyline",polygon:"polygon",circle:"polygon",rectangle:"polygon",freehandPolygon:"polygon",freehandPolyline:"polyline",text:"point"};function I(e,t){switch(e?.type){case"draw-point":L(e,t);break;case"draw-multipoint":V(e,t);break;case"draw-polyline":z(e,t);break;case"draw-polygon":A(e,t);break;case"draw-rectangle":F(e,t);break;case"draw-circle":H(e,t);break;case"draw-mesh":G(e,t)}}function L(e,t){const o=t.graphic?.geometry;"point"===o?.type&&(S(e,o,t),e.helpMessage=p("point",o,t.drawOperation.drawingMode))}function V(e,t){const o=t.graphic?.geometry;"multipoint"===o?.type&&(S(e,o,t),e.helpMessage=p("multipoint",o,t.drawOperation.drawingMode))}function G(e,t){const{graphic:o,view:n}=t,i=o?.geometry;"3d"!==n.type||i&&"mesh"!==i.type||(S(e,i?.origin,t),i&&d(e,i),e.helpMessage=u(o,n))}function S(e,t,o){const{drawOperation:n,view:i,sketchOptions:r}=o,{cursorVertex:a}=n;e.sketchOptions=r,e.viewType=i.type;const c="multipoint"===t?.type?t.getPoint(t.points.length-1):t;if(e.setLocationFromPoint(c,Q(o)),R(e.elevation,o),!a)return void(n.constraints=void 0);const l=a;n.constraints={context:$(l,o),x:e.x.committed,y:e.y.committed,longitude:e.longitude.committed,latitude:e.latitude.committed,elevation:e.elevation.committed,distance:null,direction:null}}function z(e,t){const{createOperationGeometry:n,drawOperation:i,automaticLengthMeasurementUtils:r}=t,a=null!=n?n.full:null;a&&"polyline"!==a.type||(Z(e,t),e.totalLength.actual=i.lastVertex?(a?r.autoLength2D(a):null)??o:null,e.helpMessage=p("polyline",a,t.drawOperation.drawingMode))}function A(e,o){const{createOperationGeometry:n,drawOperation:i}=o,r=null!=n?n.full:null;r&&"polygon"!==r.type||(Z(e,o),e.area.actual=i.lastVertex?(r?o.automaticAreaMeasurementUtils.autoArea2D(r):null)??t:null,e.helpMessage=p("polygon",r,o.drawOperation.drawingMode))}const B=a(c);function Z(e,t){const{drawOperation:n,sketchOptions:r,view:a,automaticLengthMeasurementUtils:c}=t,{cursorVertex:l,lastVertex:s,secondToLastVertex:p}=n,u=r.values.effectiveDirectionMode;e.sketchOptions=r,e.viewType=a.type;const m=s&&l?c.autoDistanceBetweenPoints2D(B(s),B(l))??o:null;if(e.distance.actual=m,e.distance.readOnly=null==s,e.direction.actual=null,e.direction.readOnly=!0,s&&l&&("absolute"===u||p)){const t=k(p,s,l,u);e.direction.actual=t??i,e.direction.readOnly=!1}e.setLocationFromPoint(l,Q(t)),R(e.elevation,t);const d=C(s,t);e.xyMode=d,e.direction.visible="direction-distance"===d,e.distance.visible="direction-distance"===d,e.effectiveX.visible="coordinates"===d,e.effectiveY.visible="coordinates"===d;const f=l??s;n.constraints=f?{context:$(f,t),x:e.x.committed,y:e.y.committed,longitude:e.longitude.committed,latitude:e.latitude.committed,elevation:e.elevation.committed,distance:e.distance.committed,direction:e.direction.committed}:void 0}function C(e,{sketchOptions:t}){const o=t.tooltips.xyMode;return"auto"===o?e?"direction-distance":"coordinates":o}function F(e,t){e.sketchOptions=t.sketchOptions,e.xSize=E(t),e.ySize=X(t),e.area=q(t),e.helpMessage=p("rectangle",t.graphic?.geometry,t.drawOperation.drawingMode)}function H(e,t){const{forceUniformSize:o,sketchOptions:n}=t;e.sketchOptions=n,e.radius=o?Y(t):null,e.xSize=o?null:E(t),e.ySize=o?null:X(t),e.area=q(t),e.helpMessage=p("circle",t.graphic?.geometry,t.drawOperation.drawingMode)}function R(e,t){const{drawOperation:o}=t,n=o?.cursorVertex??o?.lastVertex;e.actual=x(n)??W(t),e.visible=o.hasZ,e.readOnly=!1,e.showAsZ=!0}function q(e){const o=e.createOperationGeometry?.full;return"polygon"!==o?.type?t:e.automaticAreaMeasurementUtils.autoArea2D(o)??t}function E({createOperationGeometry:e,automaticLengthMeasurementUtils:t}){const n=e?.rectangle?.midpoints;return(null!=n?t.autoDistanceBetweenPoints2D(n.left,n.right):null)??o}function X({createOperationGeometry:e,automaticLengthMeasurementUtils:t}){const n=e?.rectangle?.midpoints;return(null!=n?t.autoDistanceBetweenPoints2D(n.top,n.bottom):null)??o}function Y({createOperationGeometry:e,automaticLengthMeasurementUtils:t}){return(null!=e?.circle?.center&&null!=e.circle.edge?t.autoDistanceBetweenPoints2D(e.circle.center,e.circle.edge):null)??o}function J(t){const{geometryType:o,tooltipInfos:n}=t;switch(o){case"point":case"multipoint":case"mesh":case"polyline":case"polygon":{const i=n[o].elevation.committed;if(!i)return;return e(i,"meters")/r(Q(t))}default:return}}function K(e,t,o,n,i){const{view:r,drawOperation:a}=i;if("3d"!==r.type||!a)return;o??=0;const c=Q(i),l=N(i),p=s(r,e,t,o,c,l,n);return M(p,c)??W(i)}function N(e){return e.drawOperation.elevationInfo??l}function Q(e){return e.drawOperation.coordinateHelper.spatialReference}function W(e){const t=r(Q(e));return n(e.defaultZ*t,"meters")}function $(e,t){return m(e,t.view,Q(t),N(t),t.drawOperation.coordinateHelper.hasZ(),t.sketchOptions.values.effectiveDirectionMode)}export{D as createTooltipInfos,b as getActiveTooltipInfo,J as getConstraintZ,T as initializeConstraints,j as lockElevationOnVertexAdd,U as unlockConstraintsOnVertexAddOrRemove,I as updateTooltipInfo};
5
+ import{valueInUnit as e,zeroSquareMeters as t,zeroMeters as o,createLength as n,zeroDegreesGeographic as i}from"../../../core/quantityUtils.js";import{getMetersPerVerticalUnitForSR as r}from"../../../core/unitUtils.js";import{ensureType as a}from"../../../core/accessorSupport/ensureType.js";import c from"../../../geometry/Point.js";import{absoluteHeightElevationInfo as l,getConvertedElevationFromXYZ as s}from"../../../support/elevationInfoUtils.js";import{getDrawHelpMessage as p}from"./helpMessageUtils.js";import{getDrawMeshHelpMessage as u}from"./helpMessageUtils3d.js";import{getConstraintContext as m}from"../../interactive/sketch/constraintUtils.js";import{updateTooltipInfoFromMeshTransform as d}from"../../interactive/tooltip/tooltipCommonUtils.js";import{DrawCircleTooltipInfo as f}from"../../interactive/tooltip/infos/DrawCircleTooltipInfo.js";import{DrawMeshTooltipInfo as y}from"../../interactive/tooltip/infos/DrawMeshTooltipInfo.js";import{DrawMultipointTooltipInfo as g}from"../../interactive/tooltip/infos/DrawMultipointTooltipInfo.js";import{DrawPointTooltipInfo as h}from"../../interactive/tooltip/infos/DrawPointTooltipInfo.js";import{DrawPolygonTooltipInfo as w}from"../../interactive/tooltip/infos/DrawPolygonTooltipInfo.js";import{DrawPolylineTooltipInfo as v}from"../../interactive/tooltip/infos/DrawPolylineTooltipInfo.js";import{DrawRectangleTooltipInfo as O}from"../../interactive/tooltip/infos/DrawRectangleTooltipInfo.js";import{directionForVertices as k}from"../../support/angularMeasurementUtils.js";import{elevationFromZ as M}from"../../support/euclideanLengthMeasurementUtils.js";function x(e,t){return{point:new h({sketchOptions:t,viewType:e}),multipoint:new g({sketchOptions:t,viewType:e}),polyline:new v({sketchOptions:t,viewType:e}),polygon:new w({sketchOptions:t,viewType:e}),mesh:new y({sketchOptions:t,viewType:e}),rectangle:new O({sketchOptions:t}),circle:new f({sketchOptions:t})}}function D(e){const{directionOptions:t,geometryType:o,sketchOptions:n,tooltipInfos:i}=e,r=t=>{const o=J(e).mode,n=i[t].elevation;"relative-to-ground"===o||"relative-to-scene"===o||"on-the-ground"===o?n.lock(N(e)):n.unlock()},a=e=>{if(t){const o=i[e].direction;o.committed=t.angle,o.unlockOnVertexPlacement=!1,n.values.directionMode=t.mode}};switch(o){case"polygon":case"polyline":r(o),a(o);break;case"point":case"mesh":r(o)}}function T(e,t){const{drawOperation:o,view:n}=t,i=U(t),r=J(t);if("2d"===n.type||!e||"absolute-height"!==r.mode||1!==o?.numCommittedVertices||!i||"draw-polyline"!==i.type&&"draw-polygon"!==i.type||i.elevation.locked)return;const[a,c,l]=e,s=Y(a,c,l,r,t);null!=s&&i.elevation.lock(s)}function j(e){U(e)?.allFields.forEach(e=>{e.unlockOnVertexPlacement&&e.unlock()})}function U({geometryType:e,graphic:t,tooltipInfos:o}){return t?.geometry?.type!==P[e]?"circle"===e||"rectangle"===e?o[e]:null:o[e]}const P={point:"point",multipoint:"multipoint",mesh:"mesh",polyline:"polyline",polygon:"polygon",circle:"polygon",rectangle:"polygon",freehandPolygon:"polygon",freehandPolyline:"polyline",text:"point"};function b(e,t){switch(e?.type){case"draw-point":I(e,t);break;case"draw-multipoint":L(e,t);break;case"draw-polyline":S(e,t);break;case"draw-polygon":Z(e,t);break;case"draw-rectangle":B(e,t);break;case"draw-circle":C(e,t);break;case"draw-mesh":V(e,t)}}function I(e,t){const o=t.graphic?.geometry;"point"===o?.type&&(G(e,t),e.helpMessage=p("point",o,t.drawOperation.drawingMode))}function L(e,t){const o=t.graphic?.geometry;"multipoint"===o?.type&&(G(e,t),e.helpMessage=p("multipoint",o,t.drawOperation.drawingMode))}function V(e,t){const{graphic:o,view:n}=t,i=o?.geometry;"3d"!==n.type||i&&"mesh"!==i.type||(G(e,t),i&&d(e,i),e.helpMessage=u(o,n))}function G(e,t){const{drawOperation:o,view:n,sketchOptions:i}=t,{cursorVertex:r,hasZ:a}=o;e.sketchOptions=i,e.viewType=n.type,e.setLocationFromPoint(r,K(t)),e.setElevationFromPoint(r,{hasZ:a}),o.constraints=r?{context:Q(r,t),x:e.x.committed,y:e.y.committed,longitude:e.longitude.committed,latitude:e.latitude.committed,elevation:e.elevation.committed,distance:null,direction:null}:void 0}function S(e,t){const{createOperationGeometry:n,drawOperation:i,automaticLengthMeasurementUtils:r}=t,a=null!=n?n.full:null;a&&"polyline"!==a.type||(F(e,t),e.totalLength.actual=i.lastVertex?(a?r.autoLength2D(a):null)??o:null,e.helpMessage=p("polyline",a,t.drawOperation.drawingMode))}function Z(e,o){const{createOperationGeometry:n,drawOperation:i}=o,r=null!=n?n.full:null;r&&"polygon"!==r.type||(F(e,o),e.area.actual=i.lastVertex?(r?o.automaticAreaMeasurementUtils.autoArea2D(r):null)??t:null,e.helpMessage=p("polygon",r,o.drawOperation.drawingMode))}const z=a(c);function F(e,t){const{drawOperation:n,sketchOptions:r,view:a,automaticLengthMeasurementUtils:c}=t,{cursorVertex:l,lastVertex:s,secondToLastVertex:p,hasZ:u}=n,m=r.values.effectiveDirectionMode;e.sketchOptions=r,e.viewType=a.type;const d=s&&l?c.autoDistanceBetweenPoints2D(z(s),z(l))??o:null;e.distance.actual=d,e.distance.readOnly=null==s;const f=null!==s&&("absolute"===m||p);if(e.direction.actual=null,e.direction.readOnly=!f,f&&l){const t=k(p,s,l,m);e.direction.actual=t??i}e.setLocationFromPoint(l,K(t)),e.setElevationFromPoint(l,{hasZ:u});const y=A(s,t);e.xyMode=y,e.direction.visible="direction-distance"===y,e.distance.visible="direction-distance"===y,e.effectiveX.visible="coordinates"===y,e.effectiveY.visible="coordinates"===y;const g=l??s;n.constraints=g?{context:Q(g,t),x:e.x.committed,y:e.y.committed,longitude:e.longitude.committed,latitude:e.latitude.committed,elevation:e.elevation.committed,distance:e.distance.committed,direction:e.direction.committed}:void 0}function A(e,{sketchOptions:t}){const o=t.tooltips.xyMode;return"auto"===o?e?"direction-distance":"coordinates":o}function B(e,t){e.sketchOptions=t.sketchOptions,e.xSize=H(t),e.ySize=R(t),e.area=E(t),e.helpMessage=p("rectangle",t.graphic?.geometry,t.drawOperation.drawingMode)}function C(e,t){const{forceUniformSize:o,sketchOptions:n}=t;e.sketchOptions=n,e.radius=o?q(t):null,e.xSize=o?null:H(t),e.ySize=o?null:R(t),e.area=E(t),e.helpMessage=p("circle",t.graphic?.geometry,t.drawOperation.drawingMode)}function E(e){const o=e.createOperationGeometry?.full;return"polygon"!==o?.type?t:e.automaticAreaMeasurementUtils.autoArea2D(o)??t}function H({createOperationGeometry:e,automaticLengthMeasurementUtils:t}){const n=e?.rectangle?.midpoints;return(null!=n?t.autoDistanceBetweenPoints2D(n.left,n.right):null)??o}function R({createOperationGeometry:e,automaticLengthMeasurementUtils:t}){const n=e?.rectangle?.midpoints;return(null!=n?t.autoDistanceBetweenPoints2D(n.top,n.bottom):null)??o}function q({createOperationGeometry:e,automaticLengthMeasurementUtils:t}){return(null!=e?.circle?.center&&null!=e.circle.edge?t.autoDistanceBetweenPoints2D(e.circle.center,e.circle.edge):null)??o}function X(t){const{geometryType:o,tooltipInfos:n}=t;switch(o){case"point":case"multipoint":case"mesh":case"polyline":case"polygon":{const i=n[o].elevation.committed;if(!i)return;return e(i,"meters")/r(K(t))}default:return}}function Y(e,t,o,n,i){const{view:r,drawOperation:a}=i;if("3d"!==r.type||!a)return;o??=0;const c=K(i),l=J(i),p=s(r,e,t,o,c,l,n);return M(p,c)??N(i)}function J(e){return e.drawOperation.elevationInfo??l}function K(e){return e.drawOperation.coordinateHelper.spatialReference}function N(e){const t=r(K(e));return n(e.defaultZ*t,"meters")}function Q(e,t){return m(e,t.view,K(t),J(t),t.drawOperation.coordinateHelper.hasZ(),t.sketchOptions.values.effectiveDirectionMode)}export{x as createTooltipInfos,U as getActiveTooltipInfo,X as getConstraintZ,D as initializeConstraints,T as lockElevationOnVertexAdd,j as unlockConstraintsOnVertexAddOrRemove,b as updateTooltipInfo};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{watch as e}from"../../../../core/reactiveUtils.js";import{waitAnimationFrame as i}from"../../../../core/scheduling.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 n}from"../../../../core/accessorSupport/decorators/subclass.js";import{tooltipKeys as s}from"../../keybindings.js";import{base as l}from"../css.js";import r from"../../../../widgets/Widget.js";import{loadCalciteComponents as a}from"../../../../widgets/support/componentsUtils.js";import"../../../../widgets/support/widgetUtils.js";import{tsx as c,tsxFragment as u}from"../../../../widgets/support/jsxFactory.js";import"@arcgis/toolkit/dom";const p=`${l}-editable-field`,d={base:p,inputMode:`${p}--input`,feedbackMode:`${p}--feedback`,readOnly:`${p}--read-only`,locked:`${p}--locked`,title:`${p}__title`,value:`${p}__value`,valueContent:`${p}__value__content`,valueContentReadOnly:`${p}__value__content--read-only`,lockIcon:`${p}__lock-icon`,input:`${p}__input`,inputWrapper:`${p}__input-wrapper`,inputMessage:`${p}__input-message`,inputSuffix:`${p}__input-suffix`,button:`${p}__button`},h={lock:"lock",unlock:"unlock"};let _=class extends r{constructor(){super(...arguments),this._input=null,this._lock=null,this._onLockClick=()=>{this.field.toggleLock(this.context)},this._onLockAfterCreate=t=>{this._lock=t},this._onLockAfterRemoved=()=>{this._lock=null},this._onKeyDown=t=>{t.key===s.discard&&"input"===this.mode&&this._input&&this.context.onDiscard(this._input)},this._onInputKeyDown=t=>{const e=this._input;if(e)switch(t.key){case s.commit:return this.field.onCommit("commit-and-exit",e,this.context);case s.next:{t.preventDefault(),t.stopPropagation();const i=t.shiftKey?"commit-and-previous":"commit-and-next";return this.field.onCommit(i,e,this.context)}}},this._onInput=t=>{this.field.onInput(t.currentTarget.value)},this._onInputBlur=t=>{const e=this._input;e&&t.relatedTarget!==this._lock&&this.field.onCommit("commit-on-blur",e,this.context)},this._selectText=()=>{const t=()=>{this._input===document.activeElement&&this._input?.selectText()};t(),i().then(t)},this._onAfterCreate=t=>{this._input=t,t.addEventListener("paste",this._onPaste),t.addEventListener("beforeinput",this._onBeforeInput)},this._onAfterRemoved=t=>{t.removeEventListener("paste",this._onPaste),t.removeEventListener("beforeinput",this._onBeforeInput)},this._onPaste=t=>{const e=t.clipboardData?.getData("text");if(!e)return;null!=this.field.parse(e,this.context)&&(t.stopPropagation(),this.field.onInput(e))},this._onBeforeInput=t=>{("historyUndo"===t.inputType||"historyRedo"===t.inputType)&&!this.field.dirty&&t.preventDefault()}}initialize(){this.addHandles(e(()=>this._rawDisplayValue,()=>{const{committed:t,inputValue:e}=this.field;t||e||this._input!==document.activeElement||this._selectText()}))}loadDependencies(){return a({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"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message")})}render(){const{field:t,mode:e}=this,i="input"===e,{locked:o,readOnly:n}=t;return c("div",{class:this.classes({[d.base]:!0,[d.feedbackMode]:"feedback"===e,[d.inputMode]:"input"===e,[d.locked]:o,[d.readOnly]:n})},c("div",{class:d.title,key:"title"},this._title),c("div",{class:d.value,key:"value",onkeydown:this._onKeyDown},i?this._renderValueInputMode():this._renderValueFeedbackMode()))}get _formattedValue(){return this.field.getFormattedValue(this.context)||m}get _rawDisplayValue(){return this.field.getRawDisplayValue(this.context)}get _suffix(){return this.field.getSuffix(this.context)}get _title(){const{title:t}=this.field;return"string"==typeof t?t:t(this.context)}get _messages(){return this.context?.messages.sketch??{}}_renderValueFeedbackMode(){return c(u,null,c("div",{class:d.valueContent,key:"value-feedback"},this._formattedValue),this.field.locked&&"input"!==this.mode?c("calcite-icon",{class:d.lockIcon,icon:h.lock,key:"icon",scale:"s"}):null)}_renderValueInputMode(){return this.field.readOnly?this._renderValueReadOnly():this._renderValueWritable()}_renderValueReadOnly(){return c("div",{class:this.classes(d.valueContent,d.valueContentReadOnly),key:"value-read-only"},this._formattedValue)}_renderValueWritable(){const{field:t}=this,e=this._messages,{name:i,invalid:o}=t;return c(u,null,c("div",{class:d.inputWrapper,key:"value-input"},c("calcite-input",{afterCreate:this._onAfterCreate,afterRemoved:this._onAfterRemoved,class:d.input,"data-field-name":i,"data-testid":`tooltip-field-${i}`,key:"input",onblur:this._onInputBlur,onfocus:this._selectText,onkeydown:this._onInputKeyDown,scale:"s",status:o?"invalid":"idle",type:"text",value:this._rawDisplayValue??m,onCalciteInputInput:this._onInput}),o?c("calcite-input-message",{class:d.inputMessage,scale:"s",status:"invalid"},e.invalidValue):null),c("div",{class:d.inputSuffix,key:"suffix"},this._suffix),this._renderedLockButton)}get _renderedLockButton(){const{name:t,locked:e,lockable:i}=this.field;if(!i)return c("div",{key:"no-lock-button"});const o=this._messages,n=e?o.unlockConstraint:o.lockConstraint;return c("calcite-button",{afterCreate:this._onLockAfterCreate,afterRemoved:this._onLockAfterRemoved,alignment:"center",appearance:"transparent",class:d.button,"data-testid":`tooltip-field-${t}-lock`,iconStart:e?h.lock:h.unlock,key:"lock-button",kind:"neutral",label:n,onclick:this._onLockClick,scale:"s",tabIndex:-1,title:n})}};t([o()],_.prototype,"field",void 0),t([o()],_.prototype,"context",void 0),t([o()],_.prototype,"mode",void 0),t([o()],_.prototype,"_input",void 0),t([o()],_.prototype,"_lock",void 0),t([o()],_.prototype,"_formattedValue",null),t([o()],_.prototype,"_rawDisplayValue",null),t([o()],_.prototype,"_suffix",null),t([o()],_.prototype,"_title",null),t([o()],_.prototype,"_messages",null),t([o()],_.prototype,"_renderedLockButton",null),_=t([n("esri.views.interactive.tooltip.components.TooltipEditableField")],_);const m="—";export{_ as TooltipEditableField};
5
+ import{__decorate as t}from"tslib";import{watch as e}from"../../../../core/reactiveUtils.js";import{waitAnimationFrame as i}from"../../../../core/scheduling.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 n}from"../../../../core/accessorSupport/decorators/subclass.js";import{tooltipKeys as s}from"../../keybindings.js";import{base as l}from"../css.js";import r from"../../../../widgets/Widget.js";import{loadCalciteComponents as a}from"../../../../widgets/support/componentsUtils.js";import"../../../../widgets/support/widgetUtils.js";import{tsx as c,tsxFragment as u}from"../../../../widgets/support/jsxFactory.js";import"@arcgis/toolkit/dom";const d=`${l}-editable-field`,p={base:d,inputMode:`${d}--input`,feedbackMode:`${d}--feedback`,readOnly:`${d}--read-only`,locked:`${d}--locked`,title:`${d}__title`,value:`${d}__value`,valueContent:`${d}__value__content`,valueContentReadOnly:`${d}__value__content--read-only`,lockIcon:`${d}__lock-icon`,input:`${d}__input`,inputWrapper:`${d}__input-wrapper`,inputMessage:`${d}__input-message`,inputSuffix:`${d}__input-suffix`,button:`${d}__button`},h={lock:"lock",unlock:"unlock"};let _=class extends r{constructor(){super(...arguments),this._input=null,this._lock=null,this._onLockClick=()=>{this.field.toggleLock(this.context)},this._onLockAfterCreate=t=>{this._lock=t},this._onLockAfterRemoved=()=>{this._lock=null},this._onKeyDown=t=>{t.key===s.discard&&"input"===this.mode&&this._input&&this.context.onDiscard(this._input)},this._onInputKeyDown=t=>{const e=this._input;if(e)switch(t.key){case s.commit:return this.field.onCommit("commit-and-exit",e,this.context);case s.next:{t.preventDefault(),t.stopPropagation();const i=t.shiftKey?"commit-and-previous":"commit-and-next";return this.field.onCommit(i,e,this.context)}}},this._onInput=t=>{this.field.onInput(t.currentTarget.value)},this._onInputBlur=t=>{const e=this._input;e&&t.relatedTarget!==this._lock&&this.field.onCommit("commit-on-blur",e,this.context)},this._selectText=()=>{const t=()=>{this._input===document.activeElement&&this._input?.selectText()};t(),i().then(t)},this._onAfterCreate=t=>{this._input=t,t.addEventListener("paste",this._onPaste),t.addEventListener("beforeinput",this._onBeforeInput)},this._onAfterRemoved=t=>{t.removeEventListener("paste",this._onPaste),t.removeEventListener("beforeinput",this._onBeforeInput)},this._onPaste=t=>{const e=t.clipboardData?.getData("text");if(!e)return;null!=this.field.parse(e,this.context)&&(t.stopPropagation(),this.field.onInput(e))},this._onBeforeInput=t=>{("historyUndo"===t.inputType||"historyRedo"===t.inputType)&&!this.field.dirty&&t.preventDefault()}}initialize(){this.addHandles(e(()=>this._rawDisplayValue,()=>{const{committed:t,inputValue:e}=this.field;t||e||this._input!==document.activeElement||this._selectText()}))}loadDependencies(){return a({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"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message")})}render(){const{field:t,mode:e}=this,i="input"===e,{locked:o,readOnly:n}=t;return c("div",{class:this.classes({[p.base]:!0,[p.feedbackMode]:"feedback"===e,[p.inputMode]:"input"===e,[p.locked]:o,[p.readOnly]:n})},c("div",{class:p.title,key:"title"},this._title),c("div",{class:p.value,key:"value",onkeydown:this._onKeyDown},i?this._renderValueInputMode():this._renderValueFeedbackMode()))}get _formattedValue(){return this.field.getFormattedValue(this.context)||m}get _rawDisplayValue(){return this.field.getRawDisplayValue(this.context)}get _suffix(){return this.field.getSuffix(this.context)}get _title(){const{title:t}=this.field;return"string"==typeof t?t:t(this.context)}get _messages(){return this.context?.messages.sketch??{}}_renderValueFeedbackMode(){return c(u,null,c("div",{class:p.valueContent,key:"value-feedback"},this._formattedValue),this.field.locked&&"input"!==this.mode?c("calcite-icon",{class:p.lockIcon,icon:h.lock,key:"icon",scale:"s"}):null)}_renderValueInputMode(){return this.field.readOnly?this._renderValueReadOnly():this._renderValueWritable()}_renderValueReadOnly(){return c("div",{class:this.classes(p.valueContent,p.valueContentReadOnly),key:"value-read-only"},this._formattedValue)}_renderValueWritable(){const{field:t}=this,e=this._messages,{name:i,invalid:o}=t;return c(u,null,c("div",{class:p.inputWrapper,key:"value-input"},c("calcite-input",{afterCreate:this._onAfterCreate,afterRemoved:this._onAfterRemoved,class:p.input,"data-field-name":i,"data-testid":`tooltip-field-${i}`,key:"input",onblur:this._onInputBlur,onfocus:this._selectText,onkeydown:this._onInputKeyDown,scale:"s",status:o?"invalid":"idle",type:"text",value:this._rawDisplayValue??m,onCalciteInputInput:this._onInput}),o?c("calcite-input-message",{class:p.inputMessage,scale:"s",status:"invalid"},e.invalidValue):null),c("div",{class:p.inputSuffix,key:"suffix"},this._suffix),this._renderedLockButton)}get _renderedLockButton(){const{disabled:t,locked:e,lockable:i,name:o}=this.field;if(!i)return c("div",{key:"no-lock-button"});const n=this._messages,s=e?n.unlockConstraint:n.lockConstraint;return c("calcite-button",{afterCreate:this._onLockAfterCreate,afterRemoved:this._onLockAfterRemoved,alignment:"center",appearance:"transparent",class:p.button,"data-testid":`tooltip-field-${o}-lock`,disabled:t,iconStart:e?h.lock:h.unlock,key:"lock-button",kind:"neutral",label:s,onclick:this._onLockClick,scale:"s",tabIndex:-1,title:s})}};t([o()],_.prototype,"field",void 0),t([o()],_.prototype,"context",void 0),t([o()],_.prototype,"mode",void 0),t([o()],_.prototype,"_input",void 0),t([o()],_.prototype,"_lock",void 0),t([o()],_.prototype,"_formattedValue",null),t([o()],_.prototype,"_rawDisplayValue",null),t([o()],_.prototype,"_suffix",null),t([o()],_.prototype,"_title",null),t([o()],_.prototype,"_messages",null),t([o()],_.prototype,"_renderedLockButton",null),_=t([n("esri.views.interactive.tooltip.components.TooltipEditableField")],_);const m="—";export{_ as TooltipEditableField};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import o from"../../../../core/Accessor.js";import{generateUUID as i}from"../../../../core/uuid.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";let s=class extends o{constructor(t){super(t),this.actual=null,this.lockable=!0,this.id=i(),this.inputValue=null,this.readOnly=!1,this.suffix=null,this.visible=!0,this.invalid=!1,this.unlockOnVertexPlacement=!0}get committed(){return this.lockable?this._get("committed"):null}set committed(t){this.lockable&&this._set("committed",t)}get dirty(){return null!=this.inputValue}get locked(){return this.lockable&&null!=this.committed}onInput(t){this.inputValue=t,this.invalid=!1}onCommit(t,o,i){this.lockable?this._onCommitLockable(t,i):this._onCommitNonLockable(i),this.invalid&&"commit-and-exit"===t||i.onCommit(o,t)}_onCommitLockable(t,o){const{inputValue:i,locked:l}=this;l&&n(i)?this.unlock():("commit-and-exit"===t&&!l||null!=i)&&this._parseInputAndLock(o)}_onCommitNonLockable(t){const{inputValue:o}=this;n(o)?this.lockable?this.setActual(null):this.clearInputValue():null!=o&&this._parseInputAndSetActual(t)}applyValue(t){this.lockable?this.lock(t):this.setActual(t)}clearInputValue(){this.inputValue=null,this.invalid=!1}setActual(t){this.actual=t,this.clearInputValue()}lock(t){this.lockable&&(this.committed=t??this.actual,this.clearInputValue())}unlock(){this.lockable&&(this.committed=null,this.clearInputValue())}toggleLock(t){this.lockable&&(this.locked?this.unlock():this._parseInputAndLock(t))}getSuffix(t){const{suffix:o}=this;return"function"==typeof o?o(t):o}getFormattedValue(t){const{actual:o,committed:i,format:l}=this;return null!=i?l(i,t):null!=o?l(o,t):null}getRawDisplayValue(t){const{actual:o,committed:i,inputValue:l}=this;return null!=l?l:this.lockable&&null!=i?this.formatForInputMode(i,t):null!=o?this.formatForInputMode(o,t):null}_parseInputAndSetActual(t){const{inputValue:o}=this;if(null==o||n(o))return this.setActual(null);const i=this.parse(o,t);null!=i?this.setActual(i):this.invalid=!0}_parseInputAndLock(t){const{inputValue:o,actual:i}=this;if(n(o))return this.unlock();if(null==o)return this.lock(i);const l=this.parse(o,t);null!=l?this.lock(l):this.invalid=!0}};function n(t){return null!=t&&""===t.trim()}t([l()],s.prototype,"actual",void 0),t([l()],s.prototype,"committed",null),t([l()],s.prototype,"dirty",null),t([l()],s.prototype,"format",void 0),t([l()],s.prototype,"formatForInputMode",void 0),t([l()],s.prototype,"lockable",void 0),t([l()],s.prototype,"locked",null),t([l()],s.prototype,"id",void 0),t([l()],s.prototype,"inputValue",void 0),t([l()],s.prototype,"name",void 0),t([l()],s.prototype,"parse",void 0),t([l()],s.prototype,"readOnly",void 0),t([l()],s.prototype,"suffix",void 0),t([l()],s.prototype,"title",void 0),t([l()],s.prototype,"visible",void 0),t([l()],s.prototype,"invalid",void 0),t([l()],s.prototype,"unlockOnVertexPlacement",void 0),s=t([e("esri.views.interactive.tooltip.fields.TooltipField")],s);export{s as TooltipField};
5
+ import{__decorate as t}from"tslib";import o from"../../../../core/Accessor.js";import{generateUUID as i}from"../../../../core/uuid.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";let s=class extends o{constructor(t){super(t),this.actual=null,this.lockable=!0,this.id=i(),this.inputValue=null,this.readOnly=!1,this.suffix=null,this.visible=!0,this.invalid=!1,this.unlockOnVertexPlacement=!0}get committed(){return this.lockable?this._get("committed"):null}set committed(t){this.lockable&&this._set("committed",t)}get dirty(){return null!=this.inputValue}get disabled(){return null==this.actual&&!this.dirty&&!this.locked}get locked(){return this.lockable&&null!=this.committed}onInput(t){this.inputValue=t,this.invalid=!1}onCommit(t,o,i){this.lockable?this._onCommitLockable(t,i):this._onCommitNonLockable(i),this.invalid&&"commit-and-exit"===t||i.onCommit(o,t)}_onCommitLockable(t,o){const{inputValue:i,locked:l}=this;l&&n(i)?this.unlock():("commit-and-exit"===t&&!l||null!=i)&&this._parseInputAndLock(o)}_onCommitNonLockable(t){const{inputValue:o}=this;n(o)?this.lockable?this.setActual(null):this.clearInputValue():null!=o&&this._parseInputAndSetActual(t)}applyValue(t){this.lockable?this.lock(t):this.setActual(t)}clearInputValue(){this.inputValue=null,this.invalid=!1}setActual(t){this.actual=t,this.clearInputValue()}lock(t){this.lockable&&(this.committed=t??this.actual,this.clearInputValue())}unlock(){this.lockable&&(this.committed=null,this.clearInputValue())}toggleLock(t){this.lockable&&(this.locked?this.unlock():this._parseInputAndLock(t))}getSuffix(t){const{suffix:o}=this;return"function"==typeof o?o(t):o}getFormattedValue(t){const{actual:o,committed:i,format:l}=this;return null!=i?l(i,t):null!=o?l(o,t):null}getRawDisplayValue(t){const{actual:o,committed:i,inputValue:l}=this;return null!=l?l:this.lockable&&null!=i?this.formatForInputMode(i,t):null!=o?this.formatForInputMode(o,t):null}_parseInputAndSetActual(t){const{inputValue:o}=this;if(null==o||n(o))return this.setActual(null);const i=this.parse(o,t);null!=i?this.setActual(i):this.invalid=!0}_parseInputAndLock(t){const{inputValue:o,actual:i}=this;if(n(o))return this.unlock();if(null==o)return this.lock(i);const l=this.parse(o,t);null!=l?this.lock(l):this.invalid=!0}};function n(t){return null!=t&&""===t.trim()}t([l()],s.prototype,"actual",void 0),t([l()],s.prototype,"committed",null),t([l()],s.prototype,"dirty",null),t([l()],s.prototype,"disabled",null),t([l()],s.prototype,"format",void 0),t([l()],s.prototype,"formatForInputMode",void 0),t([l()],s.prototype,"lockable",void 0),t([l()],s.prototype,"locked",null),t([l()],s.prototype,"id",void 0),t([l()],s.prototype,"inputValue",void 0),t([l()],s.prototype,"name",void 0),t([l()],s.prototype,"parse",void 0),t([l()],s.prototype,"readOnly",void 0),t([l()],s.prototype,"suffix",void 0),t([l()],s.prototype,"title",void 0),t([l()],s.prototype,"visible",void 0),t([l()],s.prototype,"invalid",void 0),t([l()],s.prototype,"unlockOnVertexPlacement",void 0),s=t([e("esri.views.interactive.tooltip.fields.TooltipField")],s);export{s as TooltipField};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{createScalar as e}from"../../../../core/quantityUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{getLongitudeLatitude as s}from"../../../../geometry/support/pointUtils.js";import{makeLongitudeField as r,makeLatitudeField as a,makeXField as l,makeYField as c,makeElevationField as u}from"../fields/fields.js";import{createGeographicCoordinate as p}from"../fields/parsingAndFormattingUtils.js";import{supportsGeodesicMeasurement as n}from"../../../support/geodesicMeasurementUtils.js";const h=h=>{const f=h;let m=class extends f{constructor(){super(...arguments),this.longitude=r(),this.latitude=a(),this.x=l(),this.y=c(),this.elevation=u(),this.geographic=!1}get effectiveX(){return this.geographic?this.longitude:this.x}get effectiveY(){return this.geographic?this.latitude:this.y}get key(){return{longitude:this.longitude.actual,latitude:this.latitude.actual,x:this.x.actual,y:this.y.actual,elevation:this.elevation.actual,geographic:this.geographic}}setLocationFromPoint(t,i=t?.spatialReference){if(this.geographic=!!i&&n(i),null==t)return this._setActualLonLat(null,null),void this._setActualXY(null,null);if(this.geographic){const e=s(t,g);this._setActualLonLat(p(e?.[0]),p(e?.[1]))}else this._setActualXY(e(t.x),e(t.y))}_setActualLonLat(t,e){this.longitude.actual=t,this.latitude.actual=e}_setActualXY(t,e){this.x.actual=t,this.y.actual=e}};return t([i()],m.prototype,"geographic",void 0),t([i()],m.prototype,"effectiveX",null),t([i()],m.prototype,"effectiveY",null),t([i()],m.prototype,"key",null),m=t([o("esri.views.interactive.tooltip.infos.TooltipInfoWithCoordinates")],m),m},g=[0,0];export{h as TooltipInfoWithCoordinates};
5
+ import{__decorate as t}from"tslib";import{createScalar as e}from"../../../../core/quantityUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{getLongitudeLatitude as s}from"../../../../geometry/support/pointUtils.js";import{makeLongitudeField as r,makeLatitudeField as a,makeXField as l,makeYField as c,makeElevationField as n}from"../fields/fields.js";import{createGeographicCoordinate as u}from"../fields/parsingAndFormattingUtils.js";import{elevationFromPoint as p}from"../../../support/euclideanLengthMeasurementUtils.js";import{supportsGeodesicMeasurement as h}from"../../../support/geodesicMeasurementUtils.js";const g=g=>{const f=g;let d=class extends f{constructor(){super(...arguments),this.longitude=r(),this.latitude=a(),this.x=l(),this.y=c(),this.elevation=n(),this.geographic=!1}get effectiveX(){return this.geographic?this.longitude:this.x}get effectiveY(){return this.geographic?this.latitude:this.y}get key(){return{longitude:this.longitude.actual,latitude:this.latitude.actual,x:this.x.actual,y:this.y.actual,elevation:this.elevation.actual,geographic:this.geographic}}setLocationFromPoint(t,i=t?.spatialReference){if(this.geographic=!!i&&h(i),null==t)return this._setActualLonLat(null,null),void this._setActualXY(null,null);if(this.geographic){const e=s(t,m);this._setActualLonLat(u(e?.[0]),u(e?.[1]))}else this._setActualXY(e(t.x),e(t.y))}setElevationFromPoint(t,e){const{elevation:i}=this;i.actual=p(t),i.visible=e.hasZ,i.readOnly=!1,i.showAsZ=!0}_setActualLonLat(t,e){this.longitude.actual=t,this.latitude.actual=e}_setActualXY(t,e){this.x.actual=t,this.y.actual=e}};return t([i()],d.prototype,"geographic",void 0),t([i()],d.prototype,"effectiveX",null),t([i()],d.prototype,"effectiveY",null),t([i()],d.prototype,"key",null),d=t([o("esri.views.interactive.tooltip.infos.TooltipInfoWithCoordinates")],d),d},m=[0,0];export{g as TooltipInfoWithCoordinates};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{createLength as n}from"../../core/quantityUtils.js";import{lengthUnitFromSpatialReference as t,verticalLengthUnitFromSpatialReference as e}from"../../core/unitUtils.js";import{k as r,j as l}from"../../chunks/vec32.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as u}from"../../geometry/projection/projectVectorToVector.js";import{equals as o}from"../../geometry/support/spatialReferenceUtils.js";import{computeEuclideanMeasurementSR as c}from"./measurementUtils.js";function s(n){return f(n,0)}function a(n){return f(n,1)}function f(e,r){const{hasZ:l,spatialReference:i}=e,u=c(i);let o=0;const s=t(u);if(null==s)return null;const a=0===r?x:Z;for(const n of e.paths){if(n.length<2)continue;const t=n.length-1;for(let e=0;e<t;++e){const t=n[e];U[0]=t[0],U[1]=t[1],U[2]=l?t[2]:0;const r=n[e+1];b[0]=r[0],b[1]=r[1],b[2]=l?r[2]:0;const u=a(U,b,i);if(null==u)return null;o+=u.value}}return n(o,s)}function p(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(U[0]=n.x,U[1]=n.y,U[2]=n.hasZ?n.z:0,b[0]=t.x,b[1]=t.y,b[2]=t.hasZ?t.z:0,j(U,b,e)):null}function h(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(U[0]=n.x,U[1]=n.y,U[2]=n.hasZ?n.z:0,b[0]=t.x,b[1]=t.y,b[2]=t.hasZ?t.z:0,x(U,b,e)):null}function m(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(U[0]=n.x,U[1]=n.y,U[2]=n.hasZ?n.z:0,b[0]=t.x,b[1]=t.y,b[2]=t.hasZ?t.z:0,Z(U,b,e)):null}function z(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(U[0]=n.x,U[1]=n.y,U[2]=n.hasZ?n.z:0,b[0]=t.x,b[1]=t.y,b[2]=t.hasZ?t.z:0,d(U,b,e)):null}function y(n){return null!=n?R(n.hasZ?n.z:0,n.spatialReference):null}function R(t,r){const l=e(r);return null!=l?n(t??0,l):null}function j(t,e,r){const l=g(t,e,r);return null!=l?{direct:n(l.direct,l.unit),horizontal:n(l.horizontal,l.unit),vertical:n(l.vertical,l.unit)}:null}function x(t,e,r){const l=g(t,e,r,0);return null!=l?n(l.direct,l.unit):null}function Z(t,e,r){const l=g(t,e,r,1);return null!=l?n(l.horizontal,l.unit):null}function v(t,e,r){const l=g(t,e,r,2);return null!=l?n(Math.abs(l.verticalSigned),l.unit):null}function d(t,e,r){const l=g(t,e,r,2);return null!=l?n(l.verticalSigned,l.unit):null}function g(n,e,i,o){const s=c(i),a=t(s);if(null==a)return null;const f=e[2]-n[2];if(2===o)return{verticalSigned:f,unit:a};if(!u(n,i,S,s)||!u(e,i,k,s))return null;if(0===o){return{direct:r(k,S),unit:a}}if(l(M,n[0],n[1],e[2]),!u(M,i,M,s))return null;const p=r(M,k);if(1===o)return{horizontal:p,unit:a};return{direct:r(k,S),horizontal:p,vertical:Math.abs(f),unit:a}}const U=i(),b=i(),S=i(),k=i(),M=i();export{y as elevationFromPoint,R as elevationFromZ,x as euclideanDirectDistance,h as euclideanDirectDistanceBetweenPoints,j as euclideanDistance,p as euclideanDistanceBetweenPoints,Z as euclideanHorizontalDistance,m as euclideanHorizontalDistanceBetweenPoints,a as euclideanHorizontalLength,s as euclideanLength,v as verticalDistance,d as verticalSignedDistance,z as verticalSignedDistanceBetweenPoints};
5
+ import{createLength as n}from"../../core/quantityUtils.js";import{verticalLengthUnitFromSpatialReference as t,lengthUnitFromSpatialReference as e}from"../../core/unitUtils.js";import{k as r,j as l}from"../../chunks/vec32.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as u}from"../../geometry/projection/projectVectorToVector.js";import{equals as o}from"../../geometry/support/spatialReferenceUtils.js";import{computeEuclideanMeasurementSR as c}from"./measurementUtils.js";function s(n){return f(n,0)}function a(n){return f(n,1)}function f(t,r){const{hasZ:l,spatialReference:i}=t,u=c(i);let o=0;const s=e(u);if(null==s)return null;const a=0===r?x:Z;for(const n of t.paths){if(n.length<2)continue;const t=n.length-1;for(let e=0;e<t;++e){const t=n[e];U[0]=t[0],U[1]=t[1],U[2]=l?t[2]:0;const r=n[e+1];b[0]=r[0],b[1]=r[1],b[2]=l?r[2]:0;const u=a(U,b,i);if(null==u)return null;o+=u.value}}return n(o,s)}function p(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(U[0]=n.x,U[1]=n.y,U[2]=n.hasZ?n.z:0,b[0]=t.x,b[1]=t.y,b[2]=t.hasZ?t.z:0,j(U,b,e)):null}function h(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(U[0]=n.x,U[1]=n.y,U[2]=n.hasZ?n.z:0,b[0]=t.x,b[1]=t.y,b[2]=t.hasZ?t.z:0,x(U,b,e)):null}function m(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(U[0]=n.x,U[1]=n.y,U[2]=n.hasZ?n.z:0,b[0]=t.x,b[1]=t.y,b[2]=t.hasZ?t.z:0,Z(U,b,e)):null}function z(n,t){const{spatialReference:e}=n;return o(e,t.spatialReference)?(U[0]=n.x,U[1]=n.y,U[2]=n.hasZ?n.z:0,b[0]=t.x,b[1]=t.y,b[2]=t.hasZ?t.z:0,d(U,b,e)):null}function y(n){return null!=n?R(n.hasZ?n.z:0,n.spatialReference):null}function R(e,r){const l=t(r);return null!=l?n(e??0,l):null}function j(t,e,r){const l=g(t,e,r);return null!=l?{direct:n(l.direct,l.unit),horizontal:n(l.horizontal,l.unit),vertical:n(l.vertical,l.unit)}:null}function x(t,e,r){const l=g(t,e,r,0);return null!=l?n(l.direct,l.unit):null}function Z(t,e,r){const l=g(t,e,r,1);return null!=l?n(l.horizontal,l.unit):null}function v(t,e,r){const l=g(t,e,r,2);return null!=l?n(Math.abs(l.verticalSigned),l.unit):null}function d(t,e,r){const l=g(t,e,r,2);return null!=l?n(l.verticalSigned,l.unit):null}function g(n,t,i,o){const s=c(i),a=e(s);if(null==a)return null;const f=t[2]-n[2];if(2===o)return{verticalSigned:f,unit:a};if(!u(n,i,S,s)||!u(t,i,k,s))return null;if(0===o){return{direct:r(k,S),unit:a}}if(l(M,n[0],n[1],t[2]),!u(M,i,M,s))return null;const p=r(M,k);if(1===o)return{horizontal:p,unit:a};return{direct:r(k,S),horizontal:p,vertical:Math.abs(f),unit:a}}const U=i(),b=i(),S=i(),k=i(),M=i();export{y as elevationFromPoint,R as elevationFromZ,x as euclideanDirectDistance,h as euclideanDirectDistanceBetweenPoints,j as euclideanDistance,p as euclideanDistanceBetweenPoints,Z as euclideanHorizontalDistance,m as euclideanHorizontalDistanceBetweenPoints,a as euclideanHorizontalLength,s as euclideanLength,v as verticalDistance,d as verticalSignedDistance,z as verticalSignedDistanceBetweenPoints};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{equals as e}from"../core/arrayUtils.js";import{neverReached as i}from"../core/compilerUtils.js";import{watch as a,initial as s}from"../core/reactiveUtils.js";import{truncateDate as r,offsetDate as o}from"../core/timeUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/Logger.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{formatDate as m,convertDateFormatToIntlOptions as u}from"../intl/date.js";import{unknown as c,system as d}from"../time/constants.js";import p from"../time/TimeInterval.js";import h from"./Slider.js";import v from"./Widget.js";import{loadCalciteComponents as f}from"./support/componentsUtils.js";import{globalCss as y}from"./support/globalCss.js";import{onResize as g}from"./support/widgetUtils.js";import{messageBundle as b}from"./support/decorators/messageBundle.js";import{vmEvent as x}from"./support/decorators/vmEvent.js";import{tsx as w}from"./support/jsxFactory.js";import{getCalciteModeClass as E}from"../support/modeUtils.js";import{css as k}from"./TimeSlider/css.js";import j from"./TimeSlider/TimeSliderViewModel.js";const T=3,_=858,S=[{minor:{value:100,unit:"milliseconds"},major:{value:1,unit:"seconds"},format:{second:"numeric"}},{minor:{value:500,unit:"milliseconds"},major:{value:5,unit:"seconds"},format:{second:"numeric"}},{minor:{value:1,unit:"seconds"},major:{value:20,unit:"seconds"},format:{minute:"numeric",second:"numeric"}},{minor:{value:2,unit:"seconds"},major:{value:30,unit:"seconds"},format:{minute:"numeric",second:"numeric"}},{minor:{value:10,unit:"seconds"},major:{value:1,unit:"minutes"},format:{minute:"numeric"}},{minor:{value:15,unit:"seconds"},major:{value:5,unit:"minutes"},format:{hour:"numeric",minute:"numeric"}},{minor:{value:1,unit:"minutes"},major:{value:20,unit:"minutes"},format:{hour:"numeric",minute:"numeric"}},{minor:{value:5,unit:"minutes"},major:{value:2,unit:"hours"},format:{hour:"numeric",minute:"numeric"}},{minor:{value:15,unit:"minutes"},major:{value:6,unit:"hours"},format:{hour:"numeric",minute:"numeric"}},{minor:{value:1,unit:"hours"},major:{value:1,unit:"days"},format:{day:"numeric",month:"short"}},{minor:{value:6,unit:"hours"},major:{value:1,unit:"weeks"},format:{day:"numeric",month:"short"}},{minor:{value:1,unit:"days"},major:{value:1,unit:"months"},format:{month:"long"}},{minor:{value:2,unit:"days"},major:{value:1,unit:"months"},format:{month:"short"}},{minor:{value:3,unit:"days"},major:{value:1,unit:"months"},format:{month:"short"}},{minor:{value:4,unit:"days"},major:{value:3,unit:"months"},format:{month:"short",year:"numeric"}},{minor:{value:1,unit:"weeks"},major:{value:1,unit:"years"},format:{year:"numeric"}},{minor:{value:1,unit:"months"},major:{value:1,unit:"years"},format:{year:"numeric"}},{minor:{value:2,unit:"months"},major:{value:2,unit:"years"},format:{year:"numeric"}},{minor:{value:1,unit:"years"},major:{value:1,unit:"decades"},format:{year:"numeric"}},{minor:{value:2,unit:"years"},major:{value:5,unit:"decades"},format:{year:"numeric"}},{minor:{value:5,unit:"decades"},major:{value:10,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:1,unit:"centuries"},major:{value:10,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:2,unit:"centuries"},major:{value:20,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:5,unit:"centuries"},major:{value:50,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:10,unit:"centuries"},major:{value:100,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:20,unit:"centuries"},major:{value:200,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:50,unit:"centuries"},major:{value:500,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:100,unit:"centuries"},major:{value:1e3,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:200,unit:"centuries"},major:{value:1e3,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:500,unit:"centuries"},major:{value:5e3,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:1e3,unit:"centuries"},major:{value:1e4,unit:"centuries"},format:{era:"short",year:"numeric"}}];function M(t){return w("div",{class:k.warning},w("calcite-icon",{class:k.warningIcon,icon:"exclamation-mark-triangle"}),w("calcite-label",{alignment:"center",class:k.warningLabel,scale:"s"},t))}let F=class extends v{constructor(t,e){super(t,e),this._allLayouts=["auto","compact","wide"],this._ignoreNextSliderUpdate=!1,this._slider=new h({precision:0,visibleElements:{rangeLabels:!1},rangeLabelInputsEnabled:!1,thumbsConstrained:!1}),this._tickFormat=null,this.disabled=!1,this.labelFormatFunction=null,this.messages=null,this.tickConfigs=null,this.timeVisible=!1,this.viewModel=new j}initialize(){this.addHandles([a(()=>this._slider.values,t=>{if(this._ignoreNextSliderUpdate)return void(this._ignoreNextSliderUpdate=!1);const e=this.viewModel.valuesToTimeExtent(t);this.timeExtent?e?this.timeExtent.equals(e)||(this.timeExtent=e):this.timeExtent=null:e&&(this.timeExtent=e)}),a(()=>this.effectiveStops,()=>this._updateSliderSteps(),s)])}loadDependencies(){return f({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),label:()=>import("@esri/calcite-components/dist/components/calcite-label")})}destroy(){this._slider.destroy(),this._tickFormat=null}get _dateFormat(){return this._getIntlOptions("short-date")}get _timeFormat(){return this._getIntlOptions("long-time")}get actions(){return this.viewModel.actions}set actions(t){this.viewModel.actions=t}get effectiveStops(){return this.viewModel.effectiveStops}get fullTimeExtent(){return this.viewModel.fullTimeExtent}set fullTimeExtent(t){this.viewModel.fullTimeExtent=t}get icon(){return"clock"}set icon(t){this._overrideIfSome("icon",t)}get interactive(){return!(this.disabled||"disabled"===this.viewModel.state||this.timeZone===c)}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}set layout(t){this._set("layout",this._allLayouts.includes(t)?t:"auto")}get loop(){return this.viewModel.loop}set loop(t){this.viewModel.loop=t}get mode(){return this.viewModel.mode}set mode(t){this.viewModel.mode=t}get playRate(){return this.viewModel.playRate}set playRate(t){this.viewModel.playRate=t}get stops(){return this.viewModel.stops}set stops(t){this.viewModel.stops=t}get tickFormats(){const{timeZone:t}=this;return S.map(({minor:e,major:i,format:a})=>({minor:new p(e),major:new p(i),format:{...a,timeZone:t}}))}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(t){this.viewModel.timeExtent=t}get timeZone(){return this.viewModel.view?.timeZone??d}set timeZone(t){this._overrideIfSome("timeZone",t)}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}next(){return this.viewModel.next()}play(){return this.viewModel.play()}previous(){return this.viewModel.previous()}stop(){return this.viewModel.stop()}render(){const{_slider:t,actions:i,domNode:a,effectiveStops:s,fullTimeExtent:r,interactive:o,messages:n,mode:l,tickConfigs:u,timeExtent:c,timeVisible:d,viewModel:{state:p,timeExtentValues:h}}=this;if(r){const{start:e,end:i}=r;if(e&&i){const a=e.getTime(),s=i.getTime(),r=t.min!==a||t.max!==s;if(r&&(t.min=a,t.max=s),u)t.tickConfigs!==u&&(t.tickConfigs=u);else{const e=(s-a)/(t.trackElement?.offsetWidth||400),i=this.tickFormats.find(({minor:t})=>t.toMilliseconds()>T*e)??this.tickFormats.at(-1),o=i&&this._tickFormat!==i;if(o&&(this._tickFormat=i),r||o){const e={mode:"position",values:this._getTickPositions(i.minor),labelsVisible:!1,tickCreatedFunction:(t,e)=>{e?.classList.add(k.sliderMinorTick)}},a={mode:"position",values:this._getTickPositions(i.major),labelsVisible:!0,tickCreatedFunction:(t,e)=>{e?.classList.add(k.sliderMajorTick)},labelFormatFunction:t=>m(t,i.format)};t.tickConfigs=[e,a]}}}}const v=!this.fullTimeExtent?.start||!this.fullTimeExtent.end||!this.timeExtent||this.timeExtent.isAllTime||this.timeExtent.isEmpty||this.timeExtent.start&&(this.timeExtent.start<this.fullTimeExtent.start||this.timeExtent.start>this.fullTimeExtent.end)||this.timeExtent.end&&(this.timeExtent.end>this.fullTimeExtent.end||this.timeExtent.end<this.fullTimeExtent.start);if(v)switch(this._ignoreNextSliderUpdate=!0,l){case"time-window":t.values=[t.min,t.max];break;case"instant":case"cumulative-from-end":t.values=[t.min];break;case"cumulative-from-start":t.values=[t.max]}else h?e(t.values,h)||(t.values=h):t.values=null;t.disabled=!o;const f=v||!o||!s?.length,b="auto"===this.layout?a.clientWidth<_?"compact":"wide":this.layout,x=w("calcite-button",{appearance:"transparent",bind:this,class:k.play,disabled:f,iconStart:"playing"===p?"pause":"play",kind:"neutral",label:"playing"===p?n.control.stop:n.control.play,onclick:this._playOrStopClick,scale:"wide"===b?"l":"m",width:"full"}),j=this.labelFormatFunction?w("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:k.timeExtentStartDate,"data-date":c?[c.start,c.end]:null,"data-layout":b,"data-type":"extent",key:k.timeExtentStartDate}):!c||c.isAllTime?M(n.noTimeExtent):c.isEmpty?M(n.emptyTimeExtent):[c?.start&&w("div",{class:k.timeExtentStartGroup,key:k.timeExtentStartGroup},w("calcite-label",{alignment:"center",class:k.timeExtentStartDate,key:k.timeExtentStartDate,scale:"s"},this._formatDate(c.start)),d?w("calcite-label",{alignment:"center",class:k.timeExtentStartTime,key:k.timeExtentStartTime,scale:"s"},this._formatTime(c.start)):null),c.start&&c.end&&c.start.getTime()!==c.end.getTime()&&w("div",{class:k.timeExtentSeparator,key:k.timeExtentSeparator}),c?.end&&(!c.start||c.start.getTime()!==c.end.getTime())&&w("div",{class:k.timeExtentEndGroup,key:k.timeExtentEndGroup},w("calcite-label",{alignment:"center",class:k.timeExtentEndDate,key:k.timeExtentEndDate,scale:"s"},this._formatDate(c.end)),d?w("calcite-label",{alignment:"center",class:k.timeExtentEndTime,key:k.timeExtentEndTime,scale:"s"},this._formatTime(c.end)):null)],S=w("div",{class:k.timeExtent},j),F=this.labelFormatFunction?w("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:k.minDate,"data-date":r?.start,"data-layout":b,"data-type":"min",key:k.minDate}):r?.start&&[w("calcite-label",{class:k.minDate,key:k.minDate,scale:"s"},this._formatDate(r.start)),d&&w("calcite-label",{class:k.minTime,key:k.minTime,scale:"s"},this._formatTime(r.start))],D=w("div",{class:k.min},F),C=w("div",{class:k.slider},t.render()),L=this.labelFormatFunction?w("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:k.maxDate,"data-date":r?.end,"data-layout":b,"data-type":"max",key:k.maxDate}):r?.end&&[w("calcite-label",{class:k.maxDate,key:k.maxDate,scale:"s"},this._formatDate(r.end)),d&&w("calcite-label",{class:k.maxTime,key:k.maxTime,scale:"s"},this._formatTime(r.end))],U=w("div",{class:k.max},L),Z=w("calcite-button",{appearance:"transparent",bind:this,class:k.previous,disabled:f||"playing"===p,iconStart:"reverse",kind:"neutral",label:n.pagination.previous,onclick:this._previousClick,scale:"wide"===b?"l":"m",width:"full"}),R=w("calcite-button",{appearance:"transparent",bind:this,class:k.next,disabled:f||"playing"===p,iconStart:"forward",kind:"neutral",label:n.pagination.next,onclick:this._nextClick,scale:"wide"===b?"l":"m",width:"full"}),I=i?.length>0,O=I&&w("calcite-action-menu",{class:k.actions,label:n.options},i.toArray().map(t=>w("calcite-action",{bind:this,icon:t.icon,id:t.id,onclick:()=>this.viewModel.triggerAction(t),text:t.title,textEnabled:!0})));return w("div",{afterCreate:t=>{this.addHandles(g(t,()=>this.scheduleRender()))},"aria-label":n.widgetLabel,class:this.classes(k.timeSlider,y.widget,`${k.timeSliderMode}${l}`,`${k.timeSliderLayout}${b}`,!o&&k.timeSliderDisabled,v&&k.timeSliderOutOfBounds,I&&k.hasActions,E(this.container))},"wide"===b&&w("div",{class:k.timeSliderRow},w("div",{class:k.playbackControls},[x,S,D,C,U,Z,R]),O),"compact"===b&&[w("div",{class:k.timeSliderRow,key:"time-slider-row-1"},[S,O]),w("div",{class:k.timeSliderRow,key:"time-slider-row-2"},[C]),w("div",{class:k.timeSliderRow,key:"time-slider-row-3"},[D,Z,x,R,U])])}updateWebDocument(t){this.viewModel?.updateWebDocument(t)}_createLabel(t){if(!this.labelFormatFunction)return;const e=t.getAttribute("data-type"),i=t.getAttribute("data-layout"),a=t["data-date"];this.labelFormatFunction(a,e,t,i)}_formatDate(t){return m(t,this._dateFormat)}_formatTime(t){return m(t,this._timeFormat)}_getIntlOptions(t){const{timeZone:e}=this;return{...u(t),timeZone:e}}_getTickPositions(t){const{fullTimeExtent:e}=this;if(!e?.start||!e.end)return[];const{start:i,end:a}=e,s=[],{value:n,unit:l}=t;let m=r(i,l,this.timeZone);for(;m.getTime()<=a.getTime();)m.getTime()>=i.getTime()&&s.push(m.getTime()),m=o(m,n,l,this.timeZone);return s}_updateSliderSteps(){this._slider.steps=this.effectiveStops&&this.effectiveStops.length>0?this.effectiveStops.map(t=>t.getTime()):null}_playOrStopClick(){switch(this.viewModel.state){case"ready":this.viewModel.play();break;case"playing":this.viewModel.stop();break;case"disabled":break;default:i(this.viewModel.state)}}_previousClick(){this.viewModel.previous()}_nextClick(){this.viewModel.next()}};t([n()],F.prototype,"_dateFormat",null),t([n()],F.prototype,"_timeFormat",null),t([n()],F.prototype,"actions",null),t([n()],F.prototype,"disabled",void 0),t([n()],F.prototype,"effectiveStops",null),t([n()],F.prototype,"fullTimeExtent",null),t([n()],F.prototype,"icon",null),t([n({readOnly:!0})],F.prototype,"interactive",null),t([n()],F.prototype,"label",null),t([n()],F.prototype,"labelFormatFunction",void 0),t([n({value:"auto"})],F.prototype,"layout",null),t([n()],F.prototype,"loop",null),t([n(),b("esri/widgets/TimeSlider/t9n/TimeSlider")],F.prototype,"messages",void 0),t([n()],F.prototype,"mode",null),t([n()],F.prototype,"playRate",null),t([n()],F.prototype,"stops",null),t([n()],F.prototype,"tickConfigs",void 0),t([n()],F.prototype,"tickFormats",null),t([n()],F.prototype,"timeExtent",null),t([n({nonNullable:!0})],F.prototype,"timeVisible",void 0),t([n()],F.prototype,"timeZone",null),t([n()],F.prototype,"view",null),t([n({type:j}),x("trigger-action")],F.prototype,"viewModel",void 0),F=t([l("esri.widgets.TimeSlider")],F);const D=F;export{D as default};
5
+ import{__decorate as t}from"tslib";import{equals as e}from"../core/arrayUtils.js";import{neverReached as i}from"../core/compilerUtils.js";import{watch as a,initial as s}from"../core/reactiveUtils.js";import{truncateDate as r,offsetDate as o}from"../core/timeUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/Logger.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{formatDate as m,convertDateFormatToIntlOptions as u}from"../intl/date.js";import{unknown as c,system as d}from"../time/constants.js";import p from"../time/TimeInterval.js";import h from"./Slider.js";import v from"./Widget.js";import{loadCalciteComponents as f}from"./support/componentsUtils.js";import{globalCss as y}from"./support/globalCss.js";import{onResize as g}from"./support/widgetUtils.js";import{messageBundle as b}from"./support/decorators/messageBundle.js";import{vmEvent as x}from"./support/decorators/vmEvent.js";import{tsx as w}from"./support/jsxFactory.js";import{getCalciteModeClass as E}from"../support/modeUtils.js";import{css as k}from"./TimeSlider/css.js";import j from"./TimeSlider/TimeSliderViewModel.js";const T=3,_=858,S=[{minor:{value:100,unit:"milliseconds"},major:{value:1,unit:"seconds"},format:{second:"numeric"}},{minor:{value:500,unit:"milliseconds"},major:{value:5,unit:"seconds"},format:{second:"numeric"}},{minor:{value:1,unit:"seconds"},major:{value:20,unit:"seconds"},format:{minute:"numeric",second:"numeric"}},{minor:{value:2,unit:"seconds"},major:{value:30,unit:"seconds"},format:{minute:"numeric",second:"numeric"}},{minor:{value:10,unit:"seconds"},major:{value:1,unit:"minutes"},format:{minute:"numeric"}},{minor:{value:15,unit:"seconds"},major:{value:5,unit:"minutes"},format:{hour:"numeric",minute:"numeric"}},{minor:{value:1,unit:"minutes"},major:{value:20,unit:"minutes"},format:{hour:"numeric",minute:"numeric"}},{minor:{value:5,unit:"minutes"},major:{value:2,unit:"hours"},format:{hour:"numeric",minute:"numeric"}},{minor:{value:15,unit:"minutes"},major:{value:6,unit:"hours"},format:{hour:"numeric",minute:"numeric"}},{minor:{value:1,unit:"hours"},major:{value:1,unit:"days"},format:{day:"numeric",month:"short"}},{minor:{value:6,unit:"hours"},major:{value:1,unit:"weeks"},format:{day:"numeric",month:"short"}},{minor:{value:1,unit:"days"},major:{value:1,unit:"months"},format:{month:"long"}},{minor:{value:2,unit:"days"},major:{value:1,unit:"months"},format:{month:"short"}},{minor:{value:3,unit:"days"},major:{value:1,unit:"months"},format:{month:"short"}},{minor:{value:4,unit:"days"},major:{value:3,unit:"months"},format:{month:"short",year:"numeric"}},{minor:{value:1,unit:"weeks"},major:{value:1,unit:"years"},format:{year:"numeric"}},{minor:{value:1,unit:"months"},major:{value:1,unit:"years"},format:{year:"numeric"}},{minor:{value:2,unit:"months"},major:{value:2,unit:"years"},format:{year:"numeric"}},{minor:{value:1,unit:"years"},major:{value:1,unit:"decades"},format:{year:"numeric"}},{minor:{value:2,unit:"years"},major:{value:5,unit:"decades"},format:{year:"numeric"}},{minor:{value:5,unit:"decades"},major:{value:2,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:1,unit:"centuries"},major:{value:10,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:2,unit:"centuries"},major:{value:20,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:5,unit:"centuries"},major:{value:50,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:10,unit:"centuries"},major:{value:100,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:20,unit:"centuries"},major:{value:200,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:50,unit:"centuries"},major:{value:500,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:100,unit:"centuries"},major:{value:1e3,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:200,unit:"centuries"},major:{value:1e3,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:500,unit:"centuries"},major:{value:5e3,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:1e3,unit:"centuries"},major:{value:1e4,unit:"centuries"},format:{era:"short",year:"numeric"}}];function M(t){return w("div",{class:k.warning},w("calcite-icon",{class:k.warningIcon,icon:"exclamation-mark-triangle"}),w("calcite-label",{alignment:"center",class:k.warningLabel,scale:"s"},t))}let F=class extends v{constructor(t,e){super(t,e),this._allLayouts=["auto","compact","wide"],this._ignoreNextSliderUpdate=!1,this._slider=new h({precision:0,visibleElements:{rangeLabels:!1},rangeLabelInputsEnabled:!1,thumbsConstrained:!1}),this._tickFormat=null,this.disabled=!1,this.labelFormatFunction=null,this.messages=null,this.tickConfigs=null,this.timeVisible=!1,this.viewModel=new j}initialize(){this.addHandles([a(()=>this._slider.values,t=>{if(this._ignoreNextSliderUpdate)return void(this._ignoreNextSliderUpdate=!1);const e=this.viewModel.valuesToTimeExtent(t);this.timeExtent?e?this.timeExtent.equals(e)||(this.timeExtent=e):this.timeExtent=null:e&&(this.timeExtent=e)}),a(()=>this.effectiveStops,()=>this._updateSliderSteps(),s)])}loadDependencies(){return f({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),label:()=>import("@esri/calcite-components/dist/components/calcite-label")})}destroy(){this._slider.destroy(),this._tickFormat=null}get _dateFormat(){return this._getIntlOptions("short-date")}get _timeFormat(){return this._getIntlOptions("long-time")}get actions(){return this.viewModel.actions}set actions(t){this.viewModel.actions=t}get effectiveStops(){return this.viewModel.effectiveStops}get fullTimeExtent(){return this.viewModel.fullTimeExtent}set fullTimeExtent(t){this.viewModel.fullTimeExtent=t}get icon(){return"clock"}set icon(t){this._overrideIfSome("icon",t)}get interactive(){return!(this.disabled||"disabled"===this.viewModel.state||this.timeZone===c)}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}set layout(t){this._set("layout",this._allLayouts.includes(t)?t:"auto")}get loop(){return this.viewModel.loop}set loop(t){this.viewModel.loop=t}get mode(){return this.viewModel.mode}set mode(t){this.viewModel.mode=t}get playRate(){return this.viewModel.playRate}set playRate(t){this.viewModel.playRate=t}get stops(){return this.viewModel.stops}set stops(t){this.viewModel.stops=t}get tickFormats(){const{timeZone:t}=this;return S.map(({minor:e,major:i,format:a})=>({minor:new p(e),major:new p(i),format:{...a,timeZone:t}}))}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(t){this.viewModel.timeExtent=t}get timeZone(){return this.viewModel.view?.timeZone??d}set timeZone(t){this._overrideIfSome("timeZone",t)}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}next(){return this.viewModel.next()}play(){return this.viewModel.play()}previous(){return this.viewModel.previous()}stop(){return this.viewModel.stop()}render(){const{_slider:t,actions:i,domNode:a,effectiveStops:s,fullTimeExtent:r,interactive:o,messages:n,mode:l,tickConfigs:u,timeExtent:c,timeVisible:d,viewModel:{state:p,timeExtentValues:h}}=this;if(r){const{start:e,end:i}=r;if(e&&i){const a=e.getTime(),s=i.getTime(),r=t.min!==a||t.max!==s;if(r&&(t.min=a,t.max=s),u)t.tickConfigs!==u&&(t.tickConfigs=u);else{const e=(s-a)/(t.trackElement?.offsetWidth||400),i=this.tickFormats.find(({minor:t})=>t.toMilliseconds()>T*e)??this.tickFormats.at(-1),o=i&&this._tickFormat!==i;if(o&&(this._tickFormat=i),r||o){const e={mode:"position",values:this._getTickPositions(i.minor),labelsVisible:!1,tickCreatedFunction:(t,e)=>{e?.classList.add(k.sliderMinorTick)}},a={mode:"position",values:this._getTickPositions(i.major),labelsVisible:!0,tickCreatedFunction:(t,e)=>{e?.classList.add(k.sliderMajorTick)},labelFormatFunction:t=>m(t,i.format)};t.tickConfigs=[e,a]}}}}const v=!this.fullTimeExtent?.start||!this.fullTimeExtent.end||!this.timeExtent||this.timeExtent.isAllTime||this.timeExtent.isEmpty||this.timeExtent.start&&(this.timeExtent.start<this.fullTimeExtent.start||this.timeExtent.start>this.fullTimeExtent.end)||this.timeExtent.end&&(this.timeExtent.end>this.fullTimeExtent.end||this.timeExtent.end<this.fullTimeExtent.start);if(v)switch(this._ignoreNextSliderUpdate=!0,l){case"time-window":t.values=[t.min,t.max];break;case"instant":case"cumulative-from-end":t.values=[t.min];break;case"cumulative-from-start":t.values=[t.max]}else h?e(t.values,h)||(t.values=h):t.values=null;t.disabled=!o;const f=v||!o||!s?.length,b="auto"===this.layout?a.clientWidth<_?"compact":"wide":this.layout,x=w("calcite-button",{appearance:"transparent",bind:this,class:k.play,disabled:f,iconStart:"playing"===p?"pause":"play",kind:"neutral",label:"playing"===p?n.control.stop:n.control.play,onclick:this._playOrStopClick,scale:"wide"===b?"l":"m",width:"full"}),j=this.labelFormatFunction?w("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:k.timeExtentStartDate,"data-date":c?[c.start,c.end]:null,"data-layout":b,"data-type":"extent",key:k.timeExtentStartDate}):!c||c.isAllTime?M(n.noTimeExtent):c.isEmpty?M(n.emptyTimeExtent):[c?.start&&w("div",{class:k.timeExtentStartGroup,key:k.timeExtentStartGroup},w("calcite-label",{alignment:"center",class:k.timeExtentStartDate,key:k.timeExtentStartDate,scale:"s"},this._formatDate(c.start)),d?w("calcite-label",{alignment:"center",class:k.timeExtentStartTime,key:k.timeExtentStartTime,scale:"s"},this._formatTime(c.start)):null),c.start&&c.end&&c.start.getTime()!==c.end.getTime()&&w("div",{class:k.timeExtentSeparator,key:k.timeExtentSeparator}),c?.end&&(!c.start||c.start.getTime()!==c.end.getTime())&&w("div",{class:k.timeExtentEndGroup,key:k.timeExtentEndGroup},w("calcite-label",{alignment:"center",class:k.timeExtentEndDate,key:k.timeExtentEndDate,scale:"s"},this._formatDate(c.end)),d?w("calcite-label",{alignment:"center",class:k.timeExtentEndTime,key:k.timeExtentEndTime,scale:"s"},this._formatTime(c.end)):null)],S=w("div",{class:k.timeExtent},j),F=this.labelFormatFunction?w("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:k.minDate,"data-date":r?.start,"data-layout":b,"data-type":"min",key:k.minDate}):r?.start&&[w("calcite-label",{class:k.minDate,key:k.minDate,scale:"s"},this._formatDate(r.start)),d&&w("calcite-label",{class:k.minTime,key:k.minTime,scale:"s"},this._formatTime(r.start))],D=w("div",{class:k.min},F),C=w("div",{class:k.slider},t.render()),L=this.labelFormatFunction?w("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:k.maxDate,"data-date":r?.end,"data-layout":b,"data-type":"max",key:k.maxDate}):r?.end&&[w("calcite-label",{class:k.maxDate,key:k.maxDate,scale:"s"},this._formatDate(r.end)),d&&w("calcite-label",{class:k.maxTime,key:k.maxTime,scale:"s"},this._formatTime(r.end))],U=w("div",{class:k.max},L),Z=w("calcite-button",{appearance:"transparent",bind:this,class:k.previous,disabled:f||"playing"===p,iconStart:"reverse",kind:"neutral",label:n.pagination.previous,onclick:this._previousClick,scale:"wide"===b?"l":"m",width:"full"}),R=w("calcite-button",{appearance:"transparent",bind:this,class:k.next,disabled:f||"playing"===p,iconStart:"forward",kind:"neutral",label:n.pagination.next,onclick:this._nextClick,scale:"wide"===b?"l":"m",width:"full"}),I=i?.length>0,O=I&&w("calcite-action-menu",{class:k.actions,label:n.options},i.toArray().map(t=>w("calcite-action",{bind:this,icon:t.icon,id:t.id,onclick:()=>this.viewModel.triggerAction(t),text:t.title,textEnabled:!0})));return w("div",{afterCreate:t=>{this.addHandles(g(t,()=>this.scheduleRender()))},"aria-label":n.widgetLabel,class:this.classes(k.timeSlider,y.widget,`${k.timeSliderMode}${l}`,`${k.timeSliderLayout}${b}`,!o&&k.timeSliderDisabled,v&&k.timeSliderOutOfBounds,I&&k.hasActions,E(this.container))},"wide"===b&&w("div",{class:k.timeSliderRow},w("div",{class:k.playbackControls},[x,S,D,C,U,Z,R]),O),"compact"===b&&[w("div",{class:k.timeSliderRow,key:"time-slider-row-1"},[S,O]),w("div",{class:k.timeSliderRow,key:"time-slider-row-2"},[C]),w("div",{class:k.timeSliderRow,key:"time-slider-row-3"},[D,Z,x,R,U])])}updateWebDocument(t){this.viewModel?.updateWebDocument(t)}_createLabel(t){if(!this.labelFormatFunction)return;const e=t.getAttribute("data-type"),i=t.getAttribute("data-layout"),a=t["data-date"];this.labelFormatFunction(a,e,t,i)}_formatDate(t){return m(t,this._dateFormat)}_formatTime(t){return m(t,this._timeFormat)}_getIntlOptions(t){const{timeZone:e}=this;return{...u(t),timeZone:e}}_getTickPositions(t){const{fullTimeExtent:e}=this;if(!e?.start||!e.end)return[];const{start:i,end:a}=e,s=[],{value:n,unit:l}=t;let m=r(i,l,this.timeZone);for(;m.getTime()<=a.getTime();)m.getTime()>=i.getTime()&&s.push(m.getTime()),m=o(m,n,l,this.timeZone);return s}_updateSliderSteps(){this._slider.steps=this.effectiveStops&&this.effectiveStops.length>0?this.effectiveStops.map(t=>t.getTime()):null}_playOrStopClick(){switch(this.viewModel.state){case"ready":this.viewModel.play();break;case"playing":this.viewModel.stop();break;case"disabled":break;default:i(this.viewModel.state)}}_previousClick(){this.viewModel.previous()}_nextClick(){this.viewModel.next()}};t([n()],F.prototype,"_dateFormat",null),t([n()],F.prototype,"_timeFormat",null),t([n()],F.prototype,"actions",null),t([n()],F.prototype,"disabled",void 0),t([n()],F.prototype,"effectiveStops",null),t([n()],F.prototype,"fullTimeExtent",null),t([n()],F.prototype,"icon",null),t([n({readOnly:!0})],F.prototype,"interactive",null),t([n()],F.prototype,"label",null),t([n()],F.prototype,"labelFormatFunction",void 0),t([n({value:"auto"})],F.prototype,"layout",null),t([n()],F.prototype,"loop",null),t([n(),b("esri/widgets/TimeSlider/t9n/TimeSlider")],F.prototype,"messages",void 0),t([n()],F.prototype,"mode",null),t([n()],F.prototype,"playRate",null),t([n()],F.prototype,"stops",null),t([n()],F.prototype,"tickConfigs",void 0),t([n()],F.prototype,"tickFormats",null),t([n()],F.prototype,"timeExtent",null),t([n({nonNullable:!0})],F.prototype,"timeVisible",void 0),t([n()],F.prototype,"timeZone",null),t([n()],F.prototype,"view",null),t([n({type:j}),x("trigger-action")],F.prototype,"viewModel",void 0),F=t([l("esri.widgets.TimeSlider")],F);const D=F;export{D as default};