@arcgis/core 4.34.0-next.47 → 4.34.0-next.49

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 (143) hide show
  1. package/analysis/ElevationProfileUnits.js +1 -1
  2. package/analysis/support/elevationProfileLineTypes.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{6ce2f86b9b1d2f2b8675.js → 0874b88d5ae7c2b78b3b.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{90a97ffba604c1c35532.js → 0b52c0ca432761076076.js} +65 -65
  6. package/assets/esri/core/workers/chunks/0c129b78e5cfe96795e1.js +1 -0
  7. package/assets/esri/core/workers/chunks/{9f869b331dff505b6b55.js → 1d234c057a6671acc59f.js} +1 -1
  8. package/assets/esri/core/workers/chunks/4cc982c99d84e896d535.js +1 -0
  9. package/assets/esri/core/workers/chunks/4e2b125e6e3945985a54.js +1 -0
  10. package/assets/esri/core/workers/chunks/5a016dcd3192d42d363e.js +1 -0
  11. package/assets/esri/core/workers/chunks/{574ea32d6c257e0d2079.js → 5b0c42bb95d81085061d.js} +1 -1
  12. package/assets/esri/core/workers/chunks/6130bc641aa7c1bcaaa8.js +1 -0
  13. package/assets/esri/core/workers/chunks/72ecf49d03bb24bf0998.js +1 -0
  14. package/assets/esri/core/workers/chunks/781b59ba0cabe78bc122.js +1 -0
  15. package/assets/esri/core/workers/chunks/{28a85997c9003cacdefb.js → 8e3c09c3524654830b14.js} +1 -1
  16. package/assets/esri/core/workers/chunks/ad93a2621f75270f06cb.js +1 -0
  17. package/assets/esri/core/workers/chunks/bd7e303dd64a27ba6846.js +1 -0
  18. package/assets/esri/core/workers/chunks/cb8f2ce22274990b359c.js +1 -0
  19. package/assets/esri/core/workers/chunks/{0b67b16d7e6c030bcfc7.js → d4766c97d97554b3b408.js} +1 -1
  20. package/assets/esri/core/workers/chunks/ddd6597a66ec6b972f9c.js +1 -0
  21. package/chunks/LineSeries.js +1 -1
  22. package/chunks/Theme.js +1 -1
  23. package/chunks/chartUtilsAm5.js +1 -1
  24. package/config.js +1 -1
  25. package/core/lang.js +1 -1
  26. package/core/timeUtils.js +1 -1
  27. package/editing/sharedTemplates/support/sharedTemplateErrors.js +1 -1
  28. package/interfaces.d.ts +44 -10
  29. package/kernel.js +1 -1
  30. package/layers/LinkChartLayer.js +1 -1
  31. package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
  32. package/layers/orientedImagery/transformations/utils.js +1 -1
  33. package/layers/save/featureLayerUtils.js +1 -1
  34. package/layers/support/rasterDatasets/pixelReader.js +1 -1
  35. package/libs/linkchartlayout/LinkChartLayout.js +1 -1
  36. package/libs/parquet/parquet.js +1 -1
  37. package/networks/UtilityNetwork.js +1 -1
  38. package/networks/support/UtilityNetworkLookupHelper.js +1 -1
  39. package/networks/support/networkFieldUtils.js +1 -1
  40. package/networks/support/typeUtils.js +1 -1
  41. package/package.json +4 -4
  42. package/rest/networks/support/CircuitLocation.js +5 -0
  43. package/rest/networks/support/CircuitSection.js +5 -0
  44. package/rest/support/Query.js +1 -1
  45. package/rest/support/RelationshipQuery.js +1 -1
  46. package/rest/utils.js +1 -1
  47. package/support/revision.js +1 -1
  48. package/support/webSceneUtils.js +1 -1
  49. package/symbols/cim/utils.js +1 -1
  50. package/views/2d/LabelManager.js +1 -1
  51. package/views/2d/engine/flow/utils.js +1 -1
  52. package/views/2d/engine/imagery/RasterBitmap.js +1 -1
  53. package/views/2d/engine/webgl/DisplayId.js +1 -1
  54. package/views/2d/engine/webgl/animations/instructions.js +1 -1
  55. package/views/2d/engine/webgl/mesh/templates/templateUtils.js +1 -1
  56. package/views/2d/interactive/editingTools.js +1 -1
  57. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  58. package/views/2d/layers/features/FeatureContainer.js +1 -1
  59. package/views/2d/layers/features/RenderState.js +1 -1
  60. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  61. package/views/2d/layers/features/sources/strategies/chunks/ParquetSourceChunk.js +1 -1
  62. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  63. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  64. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +5 -0
  65. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  66. package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementComputation.js +1 -1
  67. package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementController.js +1 -1
  68. package/views/3d/environment/SunLighting.js +1 -1
  69. package/views/3d/layers/FlowSubView3D.js +1 -1
  70. package/views/3d/layers/I3SMeshView3D.js +1 -1
  71. package/views/3d/layers/graphics/Graphics3DSymbolLayerFactory.js +1 -1
  72. package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
  73. package/views/3d/terrain/terrainUtils.js +1 -1
  74. package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
  75. package/views/3d/webgl-engine/core/shaderModules/Matrix4sDrawUniform.js +1 -1
  76. package/views/3d/webgl-engine/core/shaderModules/Matrix4sPassUniform.js +1 -1
  77. package/views/3d/webgl-engine/lib/Program.js +1 -1
  78. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  79. package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
  80. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  81. package/views/analysis/ElevationProfile/ElevationProfileController.js +5 -0
  82. package/views/analysis/ElevationProfile/ElevationProfileLineComputation.js +5 -0
  83. package/views/analysis/ElevationProfile/ElevationProfileLineGroundComputation.js +5 -0
  84. package/views/analysis/ElevationProfile/ElevationProfileLineInputComputation.js +5 -0
  85. package/views/analysis/ElevationProfile/ElevationProfileLineQueryComputation.js +5 -0
  86. package/views/analysis/ElevationProfile/ProfileGenerationError.js +5 -0
  87. package/views/analysis/ElevationProfile/constants.js +5 -0
  88. package/views/analysis/ElevationProfile/elevationQuerySourceUtils.js +5 -0
  89. package/views/analysis/ElevationProfile/geometryUtils.js +5 -0
  90. package/views/analysis/ElevationProfile/profileUtils.js +5 -0
  91. package/views/analysis/ElevationProfile/statisticsUtils.js +5 -0
  92. package/views/analysis/ElevationProfile/traversalUtils.js +5 -0
  93. package/views/analysis/ElevationProfile/unitUtils.js +5 -0
  94. package/views/analysis/ElevationProfileResult.js +1 -1
  95. package/views/support/LayerLayerViewInfo.js +1 -1
  96. package/views/support/highlightOptionsUtils.js +1 -1
  97. package/views/webgl/Program.js +1 -1
  98. package/views/webgl/textureUtils.js +1 -1
  99. package/webscene/SunLighting.js +1 -1
  100. package/widgets/Daylight/DaylightViewModel.js +1 -1
  101. package/widgets/Daylight/support/daylightUtils.js +1 -1
  102. package/widgets/Editor/EditorViewModel.js +1 -1
  103. package/widgets/Editor/support/SketchController.js +1 -1
  104. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  105. package/widgets/FeatureTable/FieldColumn.js +1 -1
  106. package/widgets/FeatureTable/Grid/Column.js +1 -1
  107. package/widgets/FeatureTable.js +1 -1
  108. package/widgets/Features/FeaturesViewModel.js +1 -1
  109. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  110. package/widgets/OrientedImageryViewer/constants.js +1 -1
  111. package/widgets/OrientedImageryViewer/navigation/errors.js +1 -1
  112. package/widgets/OrientedImageryViewer.js +1 -1
  113. package/widgets/ShadowCast/css.js +1 -1
  114. package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
  115. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
  116. package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
  117. package/widgets/smartMapping/SmartMappingSliderViewModel.js +1 -1
  118. package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
  119. package/widgets/support/SelectionList.js +1 -1
  120. package/arcade/credentials.js +0 -5
  121. package/arcade/featureset/support/Guid.js +0 -5
  122. package/arcade/request.js +0 -5
  123. package/arcade/serviceAreaMetaData.js +0 -5
  124. package/assets/esri/core/workers/chunks/45b450c045d5fadf71b6.js +0 -1
  125. package/assets/esri/core/workers/chunks/4f5e72993a4f5180d703.js +0 -1
  126. package/assets/esri/core/workers/chunks/516b30778cd54d29e362.js +0 -1
  127. package/assets/esri/core/workers/chunks/53e166944a42af027345.js +0 -1
  128. package/assets/esri/core/workers/chunks/576792b5e1e13084adba.js +0 -1
  129. package/assets/esri/core/workers/chunks/5f7dc9657803ae3140a6.js +0 -1
  130. package/assets/esri/core/workers/chunks/8d51b6823ef5d290c670.js +0 -1
  131. package/assets/esri/core/workers/chunks/947085d176bd3a930e6f.js +0 -1
  132. package/assets/esri/core/workers/chunks/b1b6300451cc4ccefd46.js +0 -1
  133. package/assets/esri/core/workers/chunks/d09ded9fb621491e2466.js +0 -1
  134. package/assets/esri/core/workers/chunks/eb61b47df99a54a364c8.js +0 -1
  135. package/rest/versionManagement/support/GetVersionInfosResult.js +0 -5
  136. package/symbols/cim/quantizeTime.js +0 -5
  137. package/undoredo/support/DataEditingContext.js +0 -5
  138. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/WriterRegistry.js +0 -5
  139. package/views/2d/interactive/editingTools/MediaTransformToolsWrapper.js +0 -5
  140. package/views/2d/layers/features/sources/strategies/chunks/FeatureSourceEndChunk.js +0 -5
  141. package/views/3d/webgl-engine/core/shaderLibrary/util/RgbaFloat16Encoding.glsl.js +0 -25
  142. package/webscene/spec-certification/index.js +0 -5
  143. package/widgets/HighlightConfigurator.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../Color.js";import{getColorLuminance as t}from"../../../core/colorUtils.js";import{round as l,numDigits as o,percentChange as i}from"../../../renderers/support/numberUtils.js";import{updateReferenceSizeSymbol as n}from"../../../smartMapping/renderers/support/referenceSizeUtils.js";import{updateSpikeSymbol as r}from"../../../smartMapping/renderers/support/spikeUtils.js";import s from"../../../symbols/SimpleLineSymbol.js";import a from"../../../symbols/SimpleMarkerSymbol.js";import{applyCIMSymbolColor as u}from"../../../symbols/support/cimSymbolUtils.js";import{getCIMSymbolPreviewSize as c}from"../../../symbols/support/previewCIMSymbol.js";import{isSymbol3D as m}from"../../../symbols/support/typeUtils.js";import{isVolumetricSymbol as p,getSymbolOutlineSize as f}from"../../../symbols/support/utils.js";import{getAuthoringInfoVisualVariableByTheme as y,getSymbolForFlowRenderer as b,createStopLabel as d}from"./utils.js";import"../../support/widgetUtils.js";import{isDarkMode as h}from"../../../support/modeUtils.js";const w=30,S=12,g=24,v=[255,255,255],z=[200,200,200],k=[128,128,128],j=20,I=5;function V(e){return"esri.symbols.SimpleMarkerSymbol"===e.declaredClass}function x(e){return"esri.symbols.PictureMarkerSymbol"===e.declaredClass}function M(e){return"esri.symbols.SimpleLineSymbol"===e.declaredClass}function U(e){return"esri.symbols.TextSymbol"===e.declaredClass}function C(e,t){const l=e.length-1;return e.map((e,o)=>d(e,o,l,t))}async function L(e,t,o,i,n,r,s){const a=t.legendOptions,u=a?.customValues,m=s||await B(e,o),b=t.stops,d=!!m,h=!!u,w=null!=t.minSize&&null!=t.maxSize,S=b&&b.length>1,v=!!t.target;if(!d||!h&&!(w||S&&!v))return;const z=p(m);let k=!1,j=null,I=null;j=z&&!S?l([t.minDataValue,t.maxDataValue]):u??await H(t,m,i,n?.type);const V=e?.authoringInfo,x="univariate-color-size"===V?.type,M=x&&"above-and-below"===V?.univariateTheme,U=!!y(e,"reference-size"),L=!!y(e,"spike");if(!j&&S&&(j=b.map(e=>e.value),k=b.some(e=>!!e.label),"flow"===e.type&&(j=l(j)),k&&(I=b.map(e=>e.label))),z&&null!=j&&j?.length>2&&!M&&(j=[j[0],j[j.length-1]]),!j)return null;x&&5!==j?.length&&(j=O({minSize:j[0],maxSize:j[j.length-1]}));const T=z?D(e,j):null,q=f(m),E=k?null:C(j,r),P=await Promise.all(j.map(async(l,o)=>{let r=z?T[o]:await G(t,m,l,i,n?.type),s=r;U&&(r*=g/t.maxSize||1,s=g);const a=J(m,r,e,o);L&&"cim"===a.type&&(s=await c(a));return{value:l,symbol:a,label:k?I[o]:E[o],size:s,outlineSize:q}}));return P.reverse()}function D(e,t){const l=e?.authoringInfo,o="univariate-color-size"===l?.type;let i=[S,w];if(o){const e=t[0],l=t[t.length-1],o=S,n=w;i=t.map(t=>o+(t-e)/(l-e)*(n-o))}return o&&"below"===l?.univariateTheme&&i.reverse(),i}function T(t,l,o,i){const r="class-breaks"===t.type,s=r?t.classBreakInfos?.[0]?.symbol?.clone():t.uniqueValueInfos?.[0]?.symbol?.clone();return s&&"type"in s&&"cim"===s.type?(n(s,{color:i??(r?null:new e(z)),innerDotSize:l*(g/o)||1,outerRingSize:g}),s):null}function q(e,t){const l=e.classBreakInfos,o=l.length,i=o<2||!(t>=2)?l[0].symbol.clone():l[o-1].symbol.clone(),n=e.visualVariables?.some(e=>"color"===e.type);return n&&(i.type.includes("3d")?P(i):R(i)),i}async function B(l,o){if("flow"===l.type)return b(l,o);if("pie-chart"===l.type)return new a({color:null,outline:l.outline?.width?l.outline:new s});let i=null,u=null;if("simple"===l.type)i=l.symbol;else if("class-breaks"===l.type){const e=l.classBreakInfos;i=e&&e[0]&&e[0].symbol,u=e.length>1}else if("unique-value"===l.type){const e=l.uniqueValueInfos;i=e?.[0]?.symbol,u=null!=e&&e.length>1}if(!i||E(i))return null;if(i=i.clone(),o||u)if(i.type.includes("3d"))P(i);else if(y(l,"reference-size")&&"cim"===i.type)n(i,{color:o??("class-breaks"!==l.type?new e(z):null)});else if(y(l,"spike")&&"cim"===i.type){const l=new e(z),n=new e(k),s="CIMPointSymbol"===i.data.symbol?.type?i.data.symbol:null,a=!!s?.symbolLayers?.find(({type:e})=>"CIMSolidStroke"===e)?.colorLocked;let u,c=o??void 0;if(c){const e=t(c),o=h();(!o&&e>225||o&&e<25)&&(c=l,u=a?n:l)}else c=l,u=a?n:l;r(i,{color:c,strokeColor:u})}else R(i);return i}function E(e){return m(e)?e.symbolLayers?.some(e=>"fill"===e?.type)??!1:e?.type.includes("fill")??!1}function P(e){"line-3d"===e.type?e.symbolLayers.forEach(e=>{e.material={color:k}}):e.symbolLayers.forEach(e=>{"icon"!==e.type||e.resource?.href?e.material={color:z}:(e.material={color:v},e.outline={color:k,size:1.5})})}function R(t){const l=h();if("cim"===t.type)u(t,new e(z));else if(t.type.includes("line"))t.color=k;else if(t.color=l?k:v,"simple-marker"===t.type)if(t.outline){const e=t.outline?.color?.toHex();"#ffffff"===e&&(t.outline.color=k)}else t.outline={color:k,width:1.5}}async function H(e,t,o,i){const n=(await import("../../../renderers/visualVariables/support/visualVariableUtils.js")).getSizeRangeAtScale(e,o,i),r=n&&O(n);if(!n||!r)return;let s=r.map(t=>A(t,e,n));s=l(s);for(let l=1;l<s.length-1;l++){const n=await F(e,t,s[l],s[l-1],o,i);n&&(s[l]=n[0],r[l]=n[1])}return s}function O(e){const t=e.minSize,l=e.maxSize,o=I,i=(l-t)/(o-1),n=[];for(let r=0;r<o;r++)n.push(t+i*r);return n}function A(e,t,l){const o=l.minSize,i=l.maxSize,n=t.minDataValue,r=t.maxDataValue;let s;if(e<=o)s=n;else if(e>=i)s=r;else{s=(e-o)/(i-o)*(r-n)+n}return s}async function F(e,t,n,r,s,a){const u=await G(e,t,n,s,a),c=await G(e,t,r,s,a),m=o(n),p=m.fractional,f=j;let y=m.integer,b=null,d=null;n>0&&n<1&&(b=10**p,y=o(n*=b).integer);for(let o=y-1;o>=0;o--){const r=10**o;let m=Math.floor(n/r)*r,p=Math.ceil(n/r)*r;null!=b&&(m/=b,p/=b);let y=(m+p)/2;[,y]=l([m,y,p],{indexes:[1]});const h=await G(e,t,m,s,a),w=await G(e,t,p,s,a),S=await G(e,t,y,s,a),g=i(u,h,c,null),v=i(u,w,c,null),z=i(u,S,c,null);let k=g.previous<=f,j=v.previous<=f;if(k&&j&&(g.previous<=v.previous?(k=!0,j=!1):(j=!0,k=!1)),k?d=[m,h]:j?d=[p,w]:z.previous<=f&&(d=[y,S]),d)break}return d}async function G(e,t,l,o,i){const{getSize:n}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");return n(e,l,{scale:o,view:i,shape:"simple-marker"===t.type?t.style:null})}function J(e,t,l,o){"univariate-color-size"===l?.authoringInfo?.type&&"above-and-below"===l?.authoringInfo?.univariateTheme&&"class-breaks"===l.type&&(e=q(l,o));const i=e.clone();if(m(i))p(i)||i.symbolLayers.forEach(e=>{"fill"!==e.type&&(e.size=t)});else if(V(i))i.size=t;else if(x(i)){const e=i.width,l=i.height;i.height=t,i.width=t*(e/l)}else M(i)?i.width=t:U(i)?i.font&&(i.font.size=t):"cim"===i.type&&y(l,"reference-size")?n(i,{innerDotSize:t,outerRingSize:g}):"cim"===i.type&&y(l,"spike")&&r(i,{defaultHeight:t,primitiveOverrides:null});return i}export{L as getRampStops,T as getReferenceSizeSymbol,w as realWorldMaxSize,S as realWorldMinSize};
5
+ import e from"../../../Color.js";import{getColorLuminance as t}from"../../../core/colorUtils.js";import{round as l,numDigits as i,percentChange as o}from"../../../renderers/support/numberUtils.js";import{updateReferenceSizeSymbol as r}from"../../../smartMapping/renderers/support/referenceSizeUtils.js";import{updateSpikeSymbol as s}from"../../../smartMapping/renderers/support/spikeUtils.js";import n from"../../../symbols/SimpleLineSymbol.js";import a from"../../../symbols/SimpleMarkerSymbol.js";import{applyCIMSymbolColor as u}from"../../../symbols/support/cimSymbolUtils.js";import{getCIMSymbolPreviewSize as m}from"../../../symbols/support/previewCIMSymbol.js";import{isSymbol3D as c}from"../../../symbols/support/typeUtils.js";import{isVolumetricSymbol as p,getSymbolOutlineSize as f}from"../../../symbols/support/utils.js";import{getAuthoringInfoVisualVariableByTheme as y,getSymbolForFlowRenderer as b,createStopLabel as d}from"./utils.js";import"../../support/widgetUtils.js";import{isDarkMode as h}from"../../../support/modeUtils.js";const w=30,S=12,g=24,v=[255,255,255],z=[200,200,200],k=[128,128,128],j=20,x=5;function V(e){return"esri.symbols.SimpleMarkerSymbol"===e.declaredClass}function I(e){return"esri.symbols.PictureMarkerSymbol"===e.declaredClass}function M(e){return"esri.symbols.SimpleLineSymbol"===e.declaredClass}function U(e){return"esri.symbols.TextSymbol"===e.declaredClass}function C(e,t){const l=e.length-1;return e.map((e,i)=>d(e,i,l,t))}async function L(e,t,i,o,r,s,n){const a=t.legendOptions,u=a?.customValues,c=n||await E(e,i),b=t.stops,d=!!c,h=!!u,w=null!=t.minSize&&null!=t.maxSize,S=b&&b.length>1,v=!!t.target;if(!d||!h&&!(w||S&&!v))return;const z=p(c);let k=!1,j=null,x=null;j=z&&!S?l([t.minDataValue,t.maxDataValue]):u??await H(t,c,o,r?.type);const V=e?.authoringInfo,I="univariate-color-size"===V?.type,M=I&&"above-and-below"===V?.univariateTheme,U=!!y(e,"reference-size"),L=!!y(e,"spike");if(!j&&S&&(j=b.map(e=>e.value),k=b.some(e=>!!e.label),"flow"===e.type&&(j=l(j)),k&&(x=b.map(e=>e.label))),z&&null!=j&&j?.length>2&&!M&&(j=[j[0],j[j.length-1]]),!j)return null;I&&5!==j?.length&&(j=O({minSize:j[0],maxSize:j[j.length-1]}));const T=z?D(e,j):null,P=f(c),q=k?null:C(j,s),B=await Promise.all(j.map(async(l,i)=>{let s=z?T[i]:await F(t,c,l,o,r?.type),n=s;U&&(s*=g/t.maxSize||1,n=g);const a=G(c,s,e,i);L&&"cim"===a.type&&(n=await m(a));return{value:l,symbol:a,label:k?x[i]:q[i],size:n,outlineSize:P}}));return B.reverse()}function D(e,t){const l=e?.authoringInfo,i="univariate-color-size"===l?.type;let o=[S,w];if(i){const e=t[0],l=t[t.length-1],i=S,r=w;o=t.map(t=>i+(t-e)/(l-e)*(r-i))}return i&&"below"===l?.univariateTheme&&o.reverse(),o}function T(e,t){const l=e.classBreakInfos,i=l.length,o=i<2||!(t>=2)?l[0].symbol.clone():l[i-1].symbol.clone(),r=e.visualVariables?.some(e=>"color"===e.type);return r&&(o.type.includes("3d")?q(o):B(o)),o}async function E(l,i){if("flow"===l.type)return b(l,i);if("pie-chart"===l.type)return new a({color:null,outline:l.outline?.width?l.outline:new n});let o=null,u=null;if("simple"===l.type)o=l.symbol;else if("class-breaks"===l.type){const e=l.classBreakInfos;o=e&&e[0]&&e[0].symbol,u=e.length>1}else if("unique-value"===l.type){const e=l.uniqueValueInfos;o=e?.[0]?.symbol,u=null!=e&&e.length>1}if(!o||P(o))return null;if(o=o.clone(),i||u)if(o.type.includes("3d"))q(o);else if(y(l,"reference-size")&&"cim"===o.type)r(o,{color:i??("class-breaks"!==l.type?new e(z):null)});else if(y(l,"spike")&&"cim"===o.type){const l=new e(z),r=new e(k),n="CIMPointSymbol"===o.data.symbol?.type?o.data.symbol:null,a=!!n?.symbolLayers?.find(({type:e})=>"CIMSolidStroke"===e)?.colorLocked;let u,m=i??void 0;if(m){const e=t(m),i=h();(!i&&e>225||i&&e<25)&&(m=l,u=a?r:l)}else m=l,u=a?r:l;s(o,{color:m,strokeColor:u})}else B(o);return o}function P(e){return c(e)?e.symbolLayers?.some(e=>"fill"===e?.type)??!1:e?.type.includes("fill")??!1}function q(e){"line-3d"===e.type?e.symbolLayers.forEach(e=>{e.material={color:k}}):e.symbolLayers.forEach(e=>{"icon"!==e.type||e.resource?.href?e.material={color:z}:(e.material={color:v},e.outline={color:k,size:1.5})})}function B(t){const l=h();if("cim"===t.type)u(t,new e(z));else if(t.type.includes("line"))t.color=k;else if(t.color=l?k:v,"simple-marker"===t.type)if(t.outline){const e=t.outline?.color?.toHex();"#ffffff"===e&&(t.outline.color=k)}else t.outline={color:k,width:1.5}}async function H(e,t,i,o){const r=(await import("../../../renderers/visualVariables/support/visualVariableUtils.js")).getSizeRangeAtScale(e,i,o),s=r&&O(r);if(!r||!s)return;let n=s.map(t=>R(t,e,r));n=l(n);for(let l=1;l<n.length-1;l++){const r=await A(e,t,n[l],n[l-1],i,o);r&&(n[l]=r[0],s[l]=r[1])}return n}function O(e){const t=e.minSize,l=e.maxSize,i=x,o=(l-t)/(i-1),r=[];for(let s=0;s<i;s++)r.push(t+o*s);return r}function R(e,t,l){const i=l.minSize,o=l.maxSize,r=t.minDataValue,s=t.maxDataValue;let n;if(e<=i)n=r;else if(e>=o)n=s;else{n=(e-i)/(o-i)*(s-r)+r}return n}async function A(e,t,r,s,n,a){const u=await F(e,t,r,n,a),m=await F(e,t,s,n,a),c=i(r),p=c.fractional,f=j;let y=c.integer,b=null,d=null;r>0&&r<1&&(b=10**p,y=i(r*=b).integer);for(let i=y-1;i>=0;i--){const s=10**i;let c=Math.floor(r/s)*s,p=Math.ceil(r/s)*s;null!=b&&(c/=b,p/=b);let y=(c+p)/2;[,y]=l([c,y,p],{indexes:[1]});const h=await F(e,t,c,n,a),w=await F(e,t,p,n,a),S=await F(e,t,y,n,a),g=o(u,h,m,null),v=o(u,w,m,null),z=o(u,S,m,null);let k=g.previous<=f,j=v.previous<=f;if(k&&j&&(g.previous<=v.previous?(k=!0,j=!1):(j=!0,k=!1)),k?d=[c,h]:j?d=[p,w]:z.previous<=f&&(d=[y,S]),d)break}return d}async function F(e,t,l,i,o){const{getSize:r}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");return r(e,l,{scale:i,view:o,shape:"simple-marker"===t.type?t.style:null})}function G(e,t,l,i){"univariate-color-size"===l?.authoringInfo?.type&&"above-and-below"===l?.authoringInfo?.univariateTheme&&"class-breaks"===l.type&&(e=T(l,i));const o=e.clone();if(c(o))p(o)||o.symbolLayers.forEach(e=>{"fill"!==e.type&&(e.size=t)});else if(V(o))o.size=t;else if(I(o)){const e=o.width,l=o.height;o.height=t,o.width=t*(e/l)}else M(o)?o.width=t:U(o)?o.font&&(o.font.size=t):"cim"===o.type&&y(l,"reference-size")?r(o,{innerDotSize:t,outerRingSize:g}):"cim"===o.type&&y(l,"spike")&&s(o,{defaultHeight:t,primitiveOverrides:null});return o}export{L as getRampStops,w as realWorldMaxSize,S as realWorldMinSize};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{rad2deg as e}from"../../core/mathUtils.js";const t=120,a=[21,36,51,60],T=3.5,R=["FAR_WEST","FAR_NORTH","FAR_EAST","FAR_SOUTH","WEST","NORTH","EAST","SOUTH","NEAR_WEST","NEAR_NORTH","NEAR_EAST","NEAR_SOUTH"],r=23.937554159486076,A=96.06244584051393,E={EAST:[r,r,A,r,60,r],NORTH:[r,A,r,r,r,60],SOUTH:[A,r,A,A,A,60],WEST:[A,A,r,A,60,A]},S=-999,c=100,m=()=>["after-data-capture-complete","deselect-data-capture-features","select-data-capture-features"],x="ImageGeometry",O="OIObjectId",s=[1920,1080],o=[{x:-2886579864025407e-30,y:1080},{x:0,y:0},{x:1920,y:54511950509095186e-30},{x:1920,y:1080},{x:-2886579864025407e-30,y:1080}],y={xmin:-150,ymin:1,xmax:20,ymax:80,spatialReference:{wkid:4326}},H=5,N=5,_=e(Math.acos(.05));export{N as defaultAngleThresholdInDegrees,x as defaultImageGeometryField,O as defaultOIObjectIDField,T as featureCircleRadius,H as featureDistanceFactor,s as fixedImageSize,m as getDelegatedEvents,c as imageGalleryThumbnailSize,S as invalidCameraHeading,t as navigationToolDimensionLength,y as sampleExtent,R as sectorsInOrder,a as sectorsRadii,E as segmentArcs,o as videoExtent,_ as viewingLimit};
5
+ import{rad2deg as e}from"../../core/mathUtils.js";const t=120,a=[21,36,51,60],T=3.5,R=["FAR_WEST","FAR_NORTH","FAR_EAST","FAR_SOUTH","WEST","NORTH","EAST","SOUTH","NEAR_WEST","NEAR_NORTH","NEAR_EAST","NEAR_SOUTH"],r=23.937554159486076,A=96.06244584051393,E={EAST:[r,r,A,r,60,r],NORTH:[r,A,r,r,r,60],SOUTH:[A,r,A,A,A,60],WEST:[A,A,r,A,60,A]},S=-999,c=100,m=()=>["after-data-capture-complete","deselect-data-capture-features","select-data-capture-features"],x="ImageGeometry",O="OIObjectId",s=[1920,1080],o=[{x:-2886579864025407e-30,y:1080},{x:0,y:0},{x:1920,y:54511950509095186e-30},{x:1920,y:1080},{x:-2886579864025407e-30,y:1080}],y={xmin:-150,ymin:1,xmax:20,ymax:80,spatialReference:{wkid:4326}},H=5,N=e(Math.acos(.05));export{H as defaultAngleThresholdInDegrees,x as defaultImageGeometryField,O as defaultOIObjectIDField,T as featureCircleRadius,s as fixedImageSize,m as getDelegatedEvents,c as imageGalleryThumbnailSize,S as invalidCameraHeading,t as navigationToolDimensionLength,y as sampleExtent,R as sectorsInOrder,a as sectorsRadii,E as segmentArcs,o as videoExtent,N as viewingLimit};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import r from"../../../core/Error.js";class o extends r{constructor(r){super("InvalidDirectionError",`cannot navigate in direction: ${r}`)}}class e extends r{constructor(r){super("NavigationManagerLoadError",`cannot load navigation manager for mode: ${r}`)}}class t extends r{constructor(r){super("FeatureSectorNotFoundError",`cannot find feature sector of node: ${r}`)}}class n extends r{constructor(){super("NoActiveViewerError","no active viewer")}}class s extends r{constructor(){super("NoImageLoadedError","no image loaded")}}class a extends r{constructor(r){super("NoFeatureFoundWithObjectIdError",`no feature found with objectId: ${r}`)}}export{t as FeatureSectorNotFoundError,o as InvalidDirectionError,e as NavigationManagerLoadError,n as NoActiveViewerError,a as NoFeatureFoundWithObjectIdError,s as NoImageLoadedError};
5
+ import r from"../../../core/Error.js";class e extends r{constructor(r){super("InvalidDirectionError",`cannot navigate in direction: ${r}`)}}class o extends r{constructor(r){super("FeatureSectorNotFoundError",`cannot find feature sector of node: ${r}`)}}class t extends r{constructor(){super("NoActiveViewerError","no active viewer")}}class n extends r{constructor(){super("NoImageLoadedError","no image loaded")}}class s extends r{constructor(r){super("NoFeatureFoundWithObjectIdError",`no feature found with objectId: ${r}`)}}export{o as FeatureSectorNotFoundError,e as InvalidDirectionError,t as NoActiveViewerError,s as NoFeatureFoundWithObjectIdError,n as NoImageLoadedError};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import"../intl.js";import{prefersReducedMotion as t}from"../core/a11yUtils.js";import{createTask as i}from"../core/asyncUtils.js";import a from"../core/Collection.js";import{deprecatedProperty as s}from"../core/deprecate.js";import o from"../core/Logger.js";import{isAbortError as n}from"../core/promiseUtils.js";import{watch as r,initial as l,syncAndInitial as d,whenOnce as c}from"../core/reactiveUtils.js";import{property as g}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{or as m}from"../layers/orientedImagery/transformations/utils.js";import u from"./Expand.js";import v from"./PanoramicViewer.js";import p from"./Widget.js";import{getAllArcPath as y}from"./OrientedImageryViewer/arcUtils.js";import{getDelegatedEvents as w,defaultImageGeometryField as _,defaultOIObjectIDField as M,segmentArcs as T,featureCircleRadius as b,navigationToolDimensionLength as C,sectorsRadii as A}from"./OrientedImageryViewer/constants.js";import{css as I,navigation as f,navigationToolRotationFrom as L,navigationToolRotationTo as V,root as k}from"./OrientedImageryViewer/css.js";import{loadImageForAttachment as S,getThumbnailPixelBlock as O,isFeatureAttachment as E,renderImageWithRotation as F}from"./OrientedImageryViewer/galleryUtils.js";import P from"./OrientedImageryViewer/OrientedImageryViewerViewModel.js";import x from"./OrientedImageryViewer/OrientedImageryViewerVisibleElements.js";import{loadAlertComponents as j,Alert as H}from"./OrientedImageryViewer/components/Alert.js";import G from"./OrientedImageryViewer/components/ImageLocationWidget.js";import D from"./OrientedImageryViewer/components/ImageViewer.js";import $ from"./OrientedImageryViewer/components/NavigationAction.js";import{NavigationActionsCollection as N,NavigationActions as B}from"./OrientedImageryViewer/components/NavigationActions.js";import{renderEnhancementSlider as R,VideoEnhancementTools as W}from"./OrientedImageryViewer/components/VideoEnhancementTools.js";import{NoImageLoadedError as U}from"./OrientedImageryViewer/navigation/errors.js";import{loadCalciteComponents as z}from"./support/componentsUtils.js";import{globalCss as q}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as Z}from"./support/decorators/messageBundle.js";import{vmEvent as J}from"./support/decorators/vmEvent.js";import{tsx as K,tsxFragment as Q}from"./support/jsxFactory.js";import{substitute as X}from"../intl/substitute.js";const Y={overlayed:"overlayed"};let ee=class extends p{constructor(e,t){super(e,t),this.dataCaptureEnabled=!1,this.galleryOpened=!1,this.imageEnhancementToolActive=!1,this.videoEnhancementToolActive=!1,this.imageOverlaysOpened=!1,this.navigationToolActive=!1,this.viewModel=new P,this.messagesCommon=null,this.messagesSketch=null,this.pixelMeasurementUnit="meters",this.pixelAreaMeasurementUnit="square-meters",this.showCameraLocations=!1,this.showMapFeatures=!1,this.visibleElements=new x,this._imageOverlaysLoaderTask=null,this._imageMeasurementToolsLoaderTask=null,this._navigationSettingsLoaderTask=null,this._clearMeasurements=()=>{this.viewModel.measureType=null,this.viewModel.clearPreviousMeasurements()},this._clearImageLocation=()=>{this.imageLocationToolActive=!1},this._navigationToolExpanded=!1,this._navigationTool=null,this._galleryController=new AbortController,this._galleryObserver=new IntersectionObserver(this._lazyLoadImage.bind(this)),this._overlayedLayers=new a,this._previousAction=null,this._handleDataCaptureLayerChange=async e=>{if(this.dataCaptureLayer&&await this.stopDataCapture(!0),this.dataCaptureLayer=this.dataCaptureLayer===e?null:e,this.dataCaptureLayer)return this.startDataCapture(this.dataCaptureLayer)},this._handleNavigationSettingsInputChange=(e,t)=>{this.set(`${e}Threshold`,t)},this._handleNavigationSettingsToggle=e=>{this.viewModel.preserveAngle=e},this._handleOverlayLayerDeselect=e=>{const t=e.layer;t===this.dataCaptureLayer&&(this.stopDataCapture(),this.dataCaptureLayer=null),this.removeOverlayedGraphicsOnImage(`${t.id}`)},this._handleOverlayLayerSelect=e=>{const t=e.layer;this.viewModel.overlayMapFeatures(t,this.showMapFeatures),this.addHandles(r(()=>t.visible,()=>{this.viewModel.toggleOverlayMapFeatures(t.id,t.visible,this.showMapFeatures)}),`${Y.overlayed}-${t.id}`)},this._highlight=e=>{const t=e.target?.dataset.objectid;t&&this.viewModel.highlight(t)},this._onAction=e=>{const{target:t}=e,{dataset:{action:i}}=t,{_previousAction:a}=this,s=a?.dataset.action,o=s?.includes("draw")??!1,n="select-feature"===s,r=s!==i;switch(i){case"draw-point":case"draw-polygon":case"draw-polyline":{a&&m(n,o&&r)&&(a.active=!1),t.active=!t.active;const e=i.replace("draw-","");this.viewModel.digitizeCreate(e),this._previousAction=t.active?t:null;break}case"save":this.viewModel.saveDrawing();break;case"select-feature":o&&(this._previousAction.active=!1),t.active=!t.active,this.viewModel.toggleSelection(t.active),this._previousAction=t.active?t:null;break;case"delete-feature":this.viewModel.digitizeDelete()}},this._onImageOverlayClosed=()=>{this.imageOverlaysOpened=!1},this._onShowCameraLocationsChanged=e=>{this.showCameraLocations=e},this._onShowMapFeaturesChanged=e=>{this.showMapFeatures=e},this._removeHighlight=()=>this.viewModel.removeHighlight(),this._restoreOverlays=async()=>Promise.all(this._overlayedLayers.map(e=>this.viewModel.overlayMapFeatures(e,this.showMapFeatures))),this._scaleNavigationTool=()=>{this._navigationToolExpanded=!this._navigationToolExpanded},this._sketchLoaderTask=null,this._settingsToggle=null,this._toggleImageNavigation=async e=>{const t=this.navigationMode;this._closeAllImageTools(),this.navigationMode=t!==e?e:null;const{activeViewer:i}=this.viewModel;if(!i)return;const{mode:a,preserveAngle:s}=this.viewModel;if("default"===a)if("directional"===this.navigationMode){const e=await this._loadNavigationSettings(),t="heading"===s||"both"===s,i="pitch"===s||"both"===s,{messages:a,messagesCommon:o}=this,n=new e({cameraHeadingThreshold:this.cameraHeadingThreshold,cameraPitchThreshold:this.cameraPitchThreshold,uiStrings:{configureNavigation:a.configureNavigation,preserveHeading:a.preserveHeading,preserveHeadingDescription:a.preserveHeadingDescription,preservePitch:a.preservePitch,preservePitchDescription:a.preservePitchDescription,settings:o.settings,thresholdLabel:a.thresholdLabel},onInputChange:this._handleNavigationSettingsInputChange,onToggle:this._handleNavigationSettingsToggle,preserveHeading:t,preservePitch:i});this._settingsToggle=new u({content:n,expandIcon:"configure"}),this.viewModel.activeViewer?.ui.add(this._settingsToggle,{position:"top-left"})}else this._settingsToggle&&(this._settingsToggle.expanded=!1,this.viewModel.activeViewer?.ui.remove(this._settingsToggle))},this._toggleImageAttributes=()=>{this.viewModel.toggleImageAttributes()},this.navigate=async e=>{let t=null;try{const{currentNode:i}=this.viewModel;if(!i)throw new U;t=await this.viewModel.navigate(i,e)}catch(i){n(i)||o.getLogger(this).error("Error occurred while navigating",i)}return t},this._loadImageFromGallery=this._loadImageFromGallery.bind(this),this._registerGalleryItem=this._registerGalleryItem.bind(this),this._unregisterGalleryItem=this._unregisterGalleryItem.bind(this),this.loadImageFromSource=this.loadImageFromSource.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this),this._handleVideoBrightnessChange=this._handleVideoBrightnessChange.bind(this),this._handleVideoContrastChange=this._handleVideoContrastChange.bind(this),this._handleBrightnessChange=this._handleBrightnessChange.bind(this),this._handleContrastChange=this._handleContrastChange.bind(this),this._handleSharpnessChange=this._handleSharpnessChange.bind(this),this._resetVideoTools=this._resetVideoTools.bind(this),this._toggleVideoEnhancementToolState=this._toggleVideoEnhancementToolState.bind(this)}initialize(){this.addHandles([r(()=>[this.viewModel?.bestFeatureAngle,this._navigationTool],([e,t])=>{t&&this._updateNavigationTool(t)},l),r(()=>this.currentCoverageVisible,e=>this._onCurrentCoverageVisibilityChange(e)),r(()=>this.isAdditionalCoverageVisible,e=>this._onAdditionalCoverageVisibilityChange(e)),r(()=>this.isAdditionalPointSourcesVisible,e=>this._onAdditionalCameraLocationsVisibility(e)),r(()=>({features:this.currentBestFeature,showCameraLocations:this.showCameraLocations,state:this.viewModel.state}),({showCameraLocations:e,state:t})=>{"image-loaded"===t&&this.viewModel.overlayCameraLocations(e)},d),r(()=>({feature:this.currentBestFeature,showMapFeatures:this.showMapFeatures,state:this.viewModel.state}),async(e,t)=>{if(e.showMapFeatures!==t?.showMapFeatures&&this.viewModel.toggleAllOverlayMapFeatures(e.showMapFeatures),null!=e.feature&&e.feature!==t?.feature){if(this.viewModel.removeAllOverlayMapFeatures(),await c(()=>"image-loaded"===this.viewModel.state),this.dataCaptureLayer&&this.stopDataCapture(),await this._restoreOverlays(),!this.dataCaptureLayer)return;await this.startDataCapture(this.dataCaptureLayer),this._previousAction?.active&&(this._previousAction.active=!1,this._previousAction=null)}},l)])}loadDependencies(){return Promise.all([z({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),shell:()=>import("@esri/calcite-components/dist/components/calcite-shell"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider")}),j()])}destroy(){this._galleryController.abort(),this._galleryObserver.disconnect(),this.currentBestFeature=null}get accuracyParametersMissing(){return this.viewModel.accuracyParametersMissing}get activeLayer(){return s(o.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){s(o.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeVideoIcon(){const{videoElement:e,videoViewModel:t}=this.viewModel;return e?.loaded&&t?t.videoPaused?"play":"pause":"play"}get activeAudioIcon(){const{videoElement:e,videoViewModel:t}=this.viewModel;return e?.loaded&&t?.videoMuted?"sound-off":"sound"}get cameraHeadingThreshold(){return this.viewModel.cameraHeadingThreshold}set cameraHeadingThreshold(e){this.viewModel.cameraHeadingThreshold=e}get cameraPitchThreshold(){return this.viewModel.cameraPitchThreshold}set cameraPitchThreshold(e){this.viewModel.cameraPitchThreshold=e}get canNavigateSequentially(){const{layer:e}=this;if(!e)return!1;const{fields:t,sequenceOrderField:i}=e;return t.some(({name:e})=>e.toLowerCase()===`${i??"sequenceorder"}`.toLowerCase())}get currentBestFeature(){return this.viewModel.currentBestFeature}set currentBestFeature(e){this.viewModel.currentBestFeature=e}get currentCoverageVisible(){return this.viewModel.currentCoverageVisible}set currentCoverageVisible(e){this.viewModel.currentCoverageVisible=e}get dataCaptureLayer(){return this.viewModel.dataCaptureLayer}set dataCaptureLayer(e){this.viewModel.dataCaptureLayer=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get displayMessage(){return this.viewModel.displayMessage}get features(){return this.viewModel.features}get imagePointsInView(){return this.viewModel.imagePointsInView}get icon(){return"oriented-imagery-widget"}set icon(e){this._overrideIfSome("icon",e)}get imageGalleryEnabled(){return this.viewModel.imageGalleryEnabled}get imageLocationToolActive(){return this.viewModel.imageLocationToolState}set imageLocationToolActive(e){this.viewModel.imageLocationToolState=e}get invalidCameraHeading(){return this.viewModel.invalidCameraHeading}get isAdditionalCoverageVisible(){return this.viewModel.isAdditionalCoverageVisible}set isAdditionalCoverageVisible(e){this.viewModel.isAdditionalCoverageVisible=e}get isAdditionalPointSourcesVisible(){return this.viewModel.isAdditionalPointSourcesVisible}set isAdditionalPointSourcesVisible(e){this.viewModel.isAdditionalPointSourcesVisible=e}get mapImageConversionToolState(){return this.viewModel.mapImageConversionToolState}set mapImageConversionToolState(e){this.viewModel.mapImageConversionToolState=e}get measureType(){return this.viewModel.measureType}set measureType(e){this.viewModel.measureType=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get navigationMode(){return this.viewModel.navigationMode}set navigationMode(e){this.viewModel.navigationMode=e}get popupEnabled(){const{popupEnabled:e,state:t}=this.viewModel;return("image-loaded"===t||this.videoLoaded)&&e}get referencePoint(){return this.viewModel.referencePoint??null}get sketchViewModel(){return this.viewModel.sketch}get triangularMeasurementActive(){return this.viewModel.triangularMeasurementActive}set triangularMeasurementActive(e){this.viewModel.triangularMeasurementActive=e}get videoLoaded(){const{mode:e,videoElement:t}=this.viewModel;return("video"===e&&!0===t?.loaded)??!1}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set determineWorkflowForFeature(e){this.viewModel.determineWorkflowForFeature=e}get determineWorkflowForFeature(){return this.viewModel.determineWorkflowForFeature}set updateFootprint(e){this.viewModel.updateFootprint=e}get updateFootprint(){return this.viewModel.updateFootprint}_renderActionBar(){return K("calcite-action-bar",{expandDisabled:!0,layout:"horizontal",slot:"action-bar"},K("calcite-action-group",null,this._currentFootprintToggle(),this._additionalFootprintToggle(),this._additionalPointSourcesToggle()),K("calcite-action-group",null,this._directionToolToggle(),this._mapImageConversionToggle(),this._navigationToolToggle(),this._imageEnhancementsToggle(),this._videoEnhancementsToggle()),K("calcite-action-group",null,this._measurementToolsToggle(),this._imageGalleryToggle(),this._imageOverlaysToggle(),this._openPopupAction()))}get _activeMeasurementIcon(){const{measureType:e,imageLocationToolActive:t}=this;if(t)return"pin-tear";switch(e){case"area":return"measure-area";case"height":return"measure-building-height-top-base";default:return"measure-line"}}get _activeMeasurementHeading(){const{measureType:e,messages:t,triangularMeasurementActive:i}=this,{groundArea:a,heightAboveGround:s,groundDistance:o,triangulatedAreaHeading:n,triangulatedDistanceHeading:r}=t;if(i)return"area"===e?n:r;switch(e){case"area":return a;case"height":return s;default:return o}}_additionalFootprintToggle(){const{isAdditionalCoverageVisible:e,invalidCameraHeading:t,visibleElements:{additionalFootprintToggle:i}}=this;return i?K("calcite-action",{active:e,bind:this,class:I.addCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleAdditionalCoverage,text:this.messages.additionalFootprints,title:this.messages.additionalFootprints}):null}_additionalPointSourcesToggle(){const{isAdditionalPointSourcesVisible:e,invalidCameraHeading:t,visibleElements:{additionalCameraLocationsToggle:i}}=this;return i?K("calcite-action",{active:e,bind:this,class:I.addExpPoints,disabled:t,icon:"circle-area",onclick:this._toggleAdditionalCameraLocations,text:this.messages.additionalCameraLocations,title:this.messages.additionalCameraLocations}):null}get _measurementToggle(){const{viewModel:{state:e,measureType:t,currentBestFeatureMeasurementImage:i},triangularMeasurementActive:a,id:s}=this;if("image-loaded"!==e||!t||a&&!i)return;this._imageMeasurementToolsLoaderTask||this._loadImageMeasurementResources();const o=this._imageMeasurementToolsLoaderTask?.value;return o?K("calcite-dialog",{bind:this,dragEnabled:!0,escapeDisabled:!0,heading:this._activeMeasurementHeading,id:`${s}-${t}-measurement`,open:!0,placement:"bottom-start",resizable:!0,scale:"s",slot:"dialogs",width:"s",onCalciteDialogBeforeClose:this._clearMeasurements},K(o,{measurementType:t,measurementUnitMessages:this.measurementUnitMessages,messages:this.messages,oiViewModel:this.viewModel})):null}get _renderRoot(){const{viewModel:{state:e},triangularMeasurementActive:t}=this;return K("calcite-panel",{bind:this,class:t?I.viewerContainerMeasurement:I.viewerContainer,heading:this.visibleElements.title?this.messages.title:void 0,loading:e.includes("loading")&&!t},this.visibleElements.menu?this._renderActionBar():null,K("calcite-shell",null,K("calcite-panel",null,this._imageViewer,this._panoramicViewer,this._videoViewer,this._messageBox,this.invalidCameraHeading?null:[this._imageGalleryPanel,this._renderNavigation,this._imageOverlaysPanel()],this._imageEnhancementTools,this._videoEnhancementTools,this._renderSketch()),this._imageViewerTriangular,this._measurementToggle,this._locationToggle,this.invalidCameraHeading?this._renderWarning(this.messages.invalidCameraHeadingWarningTitle,this.messages.invalidCameraHeadingWarningDescription):null))}_currentFootprintToggle(){const{currentCoverageVisible:e,invalidCameraHeading:t}=this,{currentFootprintToggle:i}=this.visibleElements;return i?K("calcite-action",{active:e,bind:this,class:I.currentCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleCurrentCoverage,text:this.messages.currentFootprint,title:this.messages.currentFootprint}):null}get _imageEnhancementTools(){const{imageEnhancementToolActive:e,viewModel:{brightness:t,contrast:i,sharpness:a,state:s}}=this;return e&&"image-loaded"===s?K("calcite-panel",{bind:this,class:I.imageEnhancementWrapper,closable:!0,closed:!e,heading:this.messages.imageEnhancement,key:this.messages.imageEnhancement,onCalcitePanelClose:this._toggleImageEnhancementToolState},K("div",{class:I.imageEnhancementTools},R({title:this.messages.brightness,value:t,max:10,min:-10,ticks:5,handleChange:this._handleBrightnessChange}),R({title:this.messages.contrast,value:i,max:10,min:-10,ticks:5,handleChange:this._handleContrastChange}),R({title:this.messages.sharpness,value:a,max:1,min:0,ticks:.5,step:.1,handleChange:this._handleSharpnessChange})),K("calcite-action",{bind:this,icon:"reset",onclick:this._resetImageTools,slot:"header-actions-end",text:this.messagesCommon.reset,title:this.messagesCommon.reset})):null}get _videoEnhancementTools(){const{videoEnhancementToolActive:e,viewModel:{videoViewModel:t,mode:i},messages:{videoEnhancement:a,brightness:s,contrast:o},messagesCommon:{reset:n}}=this;return e&&"video"===i&&t?K(W,{brightness:t.videoBrightness,constrast:t.videoContrast,handleBrightnessChange:this._handleVideoBrightnessChange,handleContrastChange:this._handleVideoContrastChange,resetTools:this._resetVideoTools,uiStrings:{videoEnhancement:a,brightness:s,contrast:o,reset:n},videoEnhancementToolActive:!0,onClose:this._toggleVideoEnhancementToolState}):null}_imageEnhancementsToggle(){const{state:e,mode:t}=this.viewModel,{imageEnhancement:i}=this.visibleElements;return i&&"video"!==t?K("calcite-action",{active:this.imageEnhancementToolActive,bind:this,disabled:"default"!==t||"image-loaded"!==e,icon:"sliders-horizontal",onclick:this._toggleImageEnhancementToolState,text:this.messages.imageEnhancement,title:this.messages.imageEnhancement}):null}_videoEnhancementsToggle(){const{mode:e}=this.viewModel,{videoEnhancement:t}=this.messages;return"video"===e?K("calcite-action",{active:this.imageEnhancementToolActive,bind:this,disabled:"video"!==e,icon:"sliders-horizontal",onclick:this._toggleVideoEnhancementToolState,text:t,title:t}):null}get _imageGalleryPanel(){const{container:e,galleryOpened:t,imageGalleryEnabled:i}=this;return i&&t&&e?this._imageGalleryContext:null}get _imageGalleryContext(){const{galleryOpened:e,invalidCameraHeading:t}=this;return K("calcite-panel",{bind:this,class:I.carousel,closable:!0,closed:!e,disabled:t,heading:this.messages.imageGallery,key:this.messages.imageGallery,onCalcitePanelClose:this._toggleImageGallery},K("div",{class:I.carouselContainer},this._renderThumbnails))}_imageGalleryToggle(){const{imageGalleryEnabled:e,invalidCameraHeading:t,visibleElements:{imageGallery:i}}=this;return i?K("calcite-action",{active:this.galleryOpened,bind:this,disabled:!e||t,icon:"images",onclick:this._toggleImageGallery,text:this.messages.imageGallery,title:this.messages.imageGallery}):null}get _imageOverlaysComponent(){const{_imageOverlayMessages:e,_imageOverlaysLoaderTask:t,_overlayedLayers:a,dataCaptureEnabled:s,dataCaptureLayer:o,imageOverlaysOpened:n,showCameraLocations:r,showMapFeatures:l,view:d,layer:c}=this;if(!c)return null;const g=c.imageGeometryField?.length?c.imageGeometryField:_,h=c.imageReferenceField?.length?c.imageReferenceField:M;t||(this._imageOverlaysLoaderTask=i(async()=>(await import("./OrientedImageryViewer/components/ImageOverlays.js")).default));const m=this._imageOverlaysLoaderTask?.value;return m?K(m,{closed:!n,dataCaptureEnabled:s,dataCaptureLayer:o,imageGeometryField:g,imageReferenceField:h,messages:e,overlayedLayers:a,showCameraLocations:r,showMapFeatures:l,view:d,onDataCaptureLayerChanged:this._handleDataCaptureLayerChange,onImageOverlaysClosed:this._onImageOverlayClosed,onLayerDeselected:this._handleOverlayLayerDeselect,onLayerSelected:this._handleOverlayLayerSelect,onShowCameraLocationsChanged:this._onShowCameraLocationsChanged,onShowMapFeaturesChanged:this._onShowMapFeaturesChanged}):null}get _imageOverlayMessages(){return{...this.messages,...this.messagesSketch}}get _imageSketchToolsMessages(){return{...this.messagesSketch,...this.messagesCommon}}_imageOverlaysPanel(){const{imageOverlaysOpened:e,viewModel:{state:t}}=this,i=this.classes({[I.imageOverlaysContainer]:!0,[q.hidden]:!e||"image-loaded"!==t});return K("div",{class:i,key:this.messages.imageOverlays},this._imageOverlaysComponent)}_imageOverlaysToggle(){const{viewModel:{state:e},imageOverlaysOpened:t,invalidCameraHeading:i,visibleElements:{imageOverlays:a}}=this;return a?K("calcite-action",{active:t,bind:this,disabled:"image-loaded"!==e||i,icon:"layers",onclick:this._toggleImageOverlays,text:this.messages.imageOverlays,title:this.messages.imageOverlays}):null}get _imageViewer(){const{displayMessage:e,loadImageViewer:t,mode:i,clickAction:a,state:s}=this.viewModel,o=null!=e||"default"!==i||s.includes("loading"),{messages:{end:n,next:r,previous:l,start:d}}=this;return K(D,{afterCreate:t,clickAction:a,navigationEnabled:!o&&null!==this.navigationMode,navigationViewModel:this.viewModel,uiStrings:{end:n,next:r,previous:l,start:d},visible:!o})}get _imageViewerTriangular(){const{messages:e,triangularMeasurementActive:t}=this,{displayMessage:i,storeImageMeasurementViewer:a,mode:s,state:o,clickAction:n}=this.viewModel,r=null!=i||"default"!==s,l=this.classes({[I.viewer]:!r,[I.viewerHidden]:r});return t?K("calcite-panel",{class:I.viewerContainerMeasurement,heading:e.measurementViewerHeading,loading:o.includes("loading")},K("calcite-panel",{bind:this,class:l},K(D,{afterCreate:a,clickAction:n,uiStrings:e}))):null}get _videoViewer(){const{mode:e,loadVideoViewer:t,videoViewModel:i}=this.viewModel,{control:a,reset:s}=this.messagesCommon,{mute:o,unmute:n}=this.messages,r="video"!==e,l=this.classes({[I.viewer]:!r,[I.viewerHidden]:r}),d="esri-image-viewer";return K("calcite-panel",{bind:this,class:l},K("calcite-panel",{afterCreate:t,class:this.classes(q.widget,d)}),K("calcite-slider",{bind:this,labelHandles:!0,labelTicks:!0,max:i?.videoDuration,minLabel:"0",value:i?.currentTime??0,onCalciteSliderChange:this._handleVideoSeek}),K("calcite-action-bar",{expandDisabled:!0,layout:"horizontal"},K("calcite-action-group",null,K("calcite-action",{bind:this,icon:this.activeVideoIcon,onclick:()=>i?.playVideoHandler(),text:"Play",title:i?.videoPaused?a.play:a.pause})),K("calcite-action-group",null,K("calcite-action",{bind:this,icon:"refresh",onclick:()=>i?.rewindVideoHandler(),text:"Rewind",title:s})),K("calcite-action-group",null,K("calcite-action",{bind:this,icon:this.activeAudioIcon,onclick:()=>i?.toggleAudio(),text:"Audio",title:i?.videoMuted?o:n}))))}get _locationToggle(){const{viewModel:{state:e,groundCoordinates:t,groundCoordinatesAccuracy:i,triangulatedPoint:a},imageLocationToolActive:s,triangularMeasurementActive:o,messages:{groundLocation:n,triangulatedLocationHeading:r}}=this;if("image-loaded"!==e||!t||!s)return;let l=t;if(o){if(!a)return;l=a}return K("calcite-dialog",{bind:this,dragEnabled:!0,escapeDisabled:!0,heading:o?r:n,id:n,open:!0,placement:"bottom-start",resizable:!0,scale:"s",slot:"dialogs",width:"s",onCalciteDialogBeforeClose:this._clearImageLocation},K(G,{accuracy:i,groundCoordinates:l,messages:this.messages}))}_mapImageConversionToggle(){const{mapImageConversionToolState:e,viewModel:{state:t},invalidCameraHeading:i,visibleElements:{mapImageConversionTool:a}}=this;return a?K("calcite-action",{active:e,bind:this,disabled:"image-loaded"!==t||i,icon:"image-pin",onclick:this._toggleMapImageConversionToolState,text:this.messages.mapImageConversionTool,title:this.messages.mapImageConversionTool}):null}_measurementToolsToggle(){const{_activeMeasurementIcon:e,measureType:t,viewModel:i,accuracyParametersMissing:a,messages:s,triangularMeasurementActive:o,visibleElements:{measurementTools:n}}=this,{state:r,mode:l}=i,{measurementTools:d,groundDistance:c,groundArea:g,heightAboveGround:h,groundLocation:m,triangulatedDistanceHeading:u,triangulatedAreaHeading:v,triangulatedLocationHeading:p}=s;return n?K("calcite-dropdown",{disabled:a,key:"measurement-tools",maxItems:5,title:d,width:"m"},K("calcite-action",{bind:this,disabled:"image-loaded"!==r||a,icon:e,slot:"trigger",text:d}),K("calcite-dropdown-group",null,K("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-line",key:"distance-measurement",onclick:e=>this._toggleMeasurementSketch(e,"distance"),selected:"distance"===t&&!o},c),K("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-area",key:"area-measurement",onclick:e=>this._toggleMeasurementSketch(e,"area"),selected:"area"===t&&!o},g),K("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-building-height-top-base",key:"height-dropdown",onclick:e=>this._toggleMeasurementSketch(e,"height"),selected:"height"===t},h),K("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"pin-tear",key:"surface-location",onclick:this._toggleLocationTool,selected:!!this.imageLocationToolActive&&!o},m),"default"===l&&K(Q,null,K("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"dual-image-distance",key:"triangular-measurement-distance",selected:!!o&&"distance"===this.measureType,onCalciteDropdownItemSelect:this._toggleTriangularDistanceMeasurements},u),K("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"dual-image-area",key:"triangular-measurement-area",selected:!!o&&"area"===this.measureType,onCalciteDropdownItemSelect:this._toggleTriangularAreaMeasurements},v),K("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"dual-image-location",key:"triangular-location",selected:!!o&&this.imageLocationToolActive,onCalciteDropdownItemSelect:this._toggleTriangularLocation},p)))):null}get _messageBox(){const{messages:e,viewModel:{displayMessage:t,mode:i}}=this;if(!t||"video"===i)return null;const{data:a,key:s,map:o}=t,n=`${o?X(e[s],o):e[s]}`;return K("span",{class:I.messageBox},a?`${n} ${a}`:n)}async _loadNavigationSettings(){return this._navigationSettingsLoaderTask||(this._navigationSettingsLoaderTask=i(async()=>(await import("./OrientedImageryViewer/components/NavigationSettings.js")).default)),await this._navigationSettingsLoaderTask.promise}_navigationToolToggle(){const{state:e}=this.viewModel,{visibleElements:{navigationTool:t},videoLoaded:i}=this;return t?K("calcite-action",{active:this.navigationToolActive,bind:this,disabled:"image-loaded"!==e&&!i||this.invalidCameraHeading,icon:"explore",onclick:this._toggleNavigationTool,text:this.messages.navigationTool,title:this.messages.navigationTool}):null}_directionToolToggle(){const{state:e}=this.viewModel,{visibleElements:{directionalNavigation:t,sequentialNavigation:i}}=this,a=new N;t&&a.push(new $({active:"directional"===this.navigationMode,disabled:"image-loaded"!==e||this.invalidCameraHeading,icon:"i2DExplore",onclick:()=>{this._toggleImageNavigation("directional")},text:this.messages.directionalNavigation,title:this.messages.directionalNavigationDescription})),i&&a.push(new $({active:"sequential"===this.navigationMode,disabled:"image-loaded"!==e||this.invalidCameraHeading||!this.canNavigateSequentially,icon:"reorder-stack",onclick:()=>{this._toggleImageNavigation("sequential")},text:this.messages.sequentialNavigation,title:this.messages.sequentialNavigationDescription}));return t||i?K(B,{actions:a,activeAction:a.items.find(e=>e.active),icon:"absolute-direction",label:this.messages.imageNavigation,scale:"m",title:this.messages.imageNavigation}):null}_openPopupAction(){const{showPopupsAction:e}=this.visibleElements;return e?K("calcite-action",{bind:this,disabled:!this.popupEnabled,icon:"popup",onclick:this._toggleImageAttributes,text:this.messages.showPopups,title:this.messages.showPopups}):null}get _panoramicViewer(){const{displayMessage:e,loadPanoramicViewer:t,mode:i,clickAction:a,state:s}=this.viewModel,{messages:{end:o,next:n,previous:r,start:l}}=this,d=null!=e||"panoramic"!==i||s.includes("loading");return K(v,{afterCreate:t,clickAction:a,navigationEnabled:!d&&null!==this.navigationMode,navigationViewModel:this.viewModel,uiStrings:{end:o,next:n,previous:r,start:l},visible:!d})}_activateTriangulatedImageLocationTool(){this.navigationToolActive=!0,this.imageLocationToolActive=!0}_activateTriangulatedImageLocationWorkflow(e,t){this._closeAllImageTools(),this.imageLocationToolActive=!0,this.triangularMeasurementActive=!e,this.navigationToolActive=!!t||!t}_closeImageToolsAndToggleNavigation(e,t){this._closeAllImageTools(),this.triangularMeasurementActive=!e,this.navigationToolActive=!t}_resetMeasureTypeAndActivateImageLocationTool(){this.measureType=null,this.imageLocationToolActive=!0}_closeAllImageTools(){this.imageEnhancementToolActive=!1,this.navigationToolActive=!1,this.imageOverlaysOpened=!1,this.galleryOpened=!1,this.measureType=null,this.imageLocationToolActive=!1,this.navigationMode=null,this.triangularMeasurementActive=!1,this._settingsToggle&&(this._settingsToggle.expanded=!1,this.viewModel.activeViewer?.ui.remove(this._settingsToggle))}_handleBrightnessChange(e){this.viewModel.brightness=e.currentTarget.value??0}_handleVideoBrightnessChange(e){this.viewModel.videoViewModel?.handleVideoBrightnessChange(e.target.value)}_handleContrastChange(e){this.viewModel.contrast=e.currentTarget.value??0}_handleVideoContrastChange(e){this.viewModel.videoViewModel?.handleVideoContrastChange(e.target.value)}_handleVideoSeek(e){const t=this.viewModel?.videoElement?.content;t&&(t.currentTime=e.target.value,t.play())}_handleSharpnessChange(e){this.viewModel.sharpness=e.currentTarget.value??0}_lazyLoadImage(e,t){e.forEach(async e=>{if(e.isIntersecting){const a=e.target,s=a.getAttribute("data-src"),r=a.getAttribute("data-rotation"),l=a.getAttribute("data-objectid"),d=r?parseFloat(r)%360:0,{layer:c,_galleryController:{signal:g}}=this;if(!s||!l)return;let h;try{h=E(s)?await S(c,l,{signal:g}):await O(s,{signal:g})}catch(i){n(i)||o.getLogger("esri.widgets.OrientedImageryViewer").error("#lazyLoadImage()",i)}finally{t.unobserve(a)}if(!h)return;F(h,a,d)}})}_loadImageFromGallery(e){const{target:t}=e;if(!t)return;const i=t.getAttribute("data-objectid");i&&this.viewModel.currentBestFeature?.attributes.objectId!==Number(i)&&this.viewModel.selectBestFeature(i)}_loadImageMeasurementResources(){this._imageMeasurementToolsLoaderTask=i(async()=>{const{default:e}=await import("./OrientedImageryViewer/components/ImageMeasurementWidget.js");return e})}_loadSketchResources(){this._sketchLoaderTask=i(async()=>(await import("./OrientedImageryViewer/components/SketchTools.js")).default)}_onAdditionalCoverageVisibilityChange(e){this.viewModel.setAdditionalCoverageVisibility(e)}_onAdditionalCameraLocationsVisibility(e){this.viewModel.setAdditionalCameraLocationsVisibility(e)}_onCurrentCoverageVisibilityChange(e){this.viewModel.setCurrentCoverageVisibility(e)}_registerGalleryItem(e){this._galleryObserver.observe(e)}_renderWarning(e,t){const{viewModel:{state:i}}=this;return"image-loaded"===i?K(H,{icon:"exclamation-mark-triangle-f",kind:"warning",message:t,open:!0,title:e,tooltip:t}):null}get _renderNavigation(){const{viewModel:{sectorData:e,navigatorCurrentBestFeature:i,currentBestFeature:a,state:s}}=this;if(!this.container||!a)return null;let o,n,r,l,d;if(i){const{x:e,y:t,direction:a}=i,[s,c,g,h]=T[a];o=`M ${e} ${t} L ${s} ${c} A ${A[2]} ${A[2]} 0 0 1 ${g} ${h} Z`,n=e,l=t,r=T[a][4],d=T[a][5]}const c=e=>{const t=e.target.dataset?.sector;t&&this.viewModel.handleSectorClick(+t)},g=e=>{const t=e.target.dataset;if(!t)return;const{featureIndexInSector:i,sector:a}=t;i&&a&&this.viewModel.handleFeatureClick({sector:a,featureIndexInSector:+i})},h=e=>{e.removeEventListener("click",g)},m=a.attributes.objectId,u=e?.map(e=>e?.items).filter(Boolean).flatMap(e=>e?.map(({x:e,y:t,objectID:i,featureIndexInSector:a,sector:s})=>K("circle",{afterRemoved:h,class:this.classes(I.feature,{selected:m===i}),cx:e,cy:t,"data-feature-index-in-sector":a,"data-sector":s,key:`${I.feature}-${i}`,onclick:g,r:b}))),v=e=>{e.removeEventListener("click",c)},p=this.classes({[I.navigationWrapper]:!0,[I.navigationZoomed]:this._navigationToolExpanded});return this.navigationToolActive&&("image-loaded"===s||this.videoLoaded)?K("div",{bind:this,class:p,key:this.messages.navigationTool},K("svg",{afterCreate:e=>this._storeNavigationToolReference(e),class:t()?f:I.rotateWithAnimation,focusable:"false",height:C,role:"img",width:C,xmlns:"http://www.w3.org/2000/svg"},K("defs",null,K("linearGradient",{gradientUnits:"userSpaceOnUse",id:`${this.id}-coverage-fill`,x1:n,x2:r,y1:l,y2:d},K("stop",{class:I.navigationPathOffset0,offset:0}),K("stop",{class:I.navigationPathOffset1,offset:1}))),K("g",null,K("circle",{class:this.classes(I.sector,I.outerSector),cx:A[3],cy:A[3],onclick:this._scaleNavigationTool,r:A[3]}),K("circle",{class:I.sector,cx:A[3],cy:A[3],r:A[2]}),K("circle",{class:I.sector,cx:A[3],cy:A[3],r:A[1]}),K("circle",{class:I.sector,cx:A[3],cy:A[3],r:A[0]}),K("path",{class:I.pointer,d:"M 56.5 6.06217782649107 L 60 0 L 63.5 6.06217782649107 Z",key:`${I.pointer}-west`}),K("path",{class:this.classes(I.pointer,I.north),d:"M 113.93782217350893 56.5 L 120 60 L 113.93782217350893 63.5 Z",key:`${I.pointer}-north`}),K("path",{class:I.pointer,d:"M 56.5 113.93782217350893 L 60 120 L 63.5 113.93782217350893 Z",key:`${I.pointer}-east`}),K("path",{class:I.pointer,d:"M 6.06217782649107 56.5 L 0 60 L 6.06217782649107 63.5 Z",key:`${I.pointer}-south`}),K("path",{class:this.classes(I.sector,I.sectorSeparator),d:"M 23.937554159486076 23.937554159486076 L 96.06244584051393 96.06244584051393 M 23.937554159486076 96.06244584051393 L 96.06244584051393 23.937554159486076",key:I.sectorSeparator}),y([A[2],A[1],A[0]],A[3],A[3]).map((t,i)=>K("path",{afterRemoved:v,class:this.classes(I.sector,e?.[i]?.length?I.sectorEnabled:I.sectorDisabled),d:t,"data-sector":`${i}`,key:`${I.sector}-${i}`,onclick:c})),K("path",{class:this.classes(I.sector,I.sectorCross),d:"M 56.4 56.4 L 63.53 63.53 M 63.53 56.4 L 56.4 63.53",key:I.sectorCross}),u,a.attributes.cameraPitch>=5&&o?K("path",{class:I.selectedFeaturePath,d:o,fill:`url(#${this.id}-coverage-fill)`,key:I.selectedFeaturePath}):null))):null}_renderSketch(){const{dataCaptureLayer:e,imageOverlaysOpened:t}=this;if(!e||t)return null;if(this._sketchLoaderTask||this._loadSketchResources(),!this._sketchLoaderTask?.value)return null;const{geometryType:i}=e,a="point"===i?"pin":"polyline"===i?"line":"polygon",s=this._sketchLoaderTask.value;return K("div",{class:I.sketchTools},K(s,{icon:a,messages:this._imageSketchToolsMessages,type:i,onAction:this._onAction}))}get _renderThumbnails(){const{currentBestFeature:e,thumbnails:t}=this.viewModel;return e?K("div",{class:I.carouselContent},t?.items.map(({url:t,objectId:i,rotation:a},s)=>K("div",{class:`${I.carouselItemWrapper}${e.attributes.objectId===i?"--selected":""}`,key:`${I.carouselItemWrapper}-${s}`},K("canvas",{afterCreate:this._registerGalleryItem,afterRemoved:this._unregisterGalleryItem,alt:`thumbnail-${i}`,class:I.carouselItem,"data-objectid":`${i}`,"data-rotation":`${a}`,"data-src":t,onclick:this._loadImageFromGallery,onmouseenter:this._highlight,onmouseleave:this._removeHighlight})))):null}_resetImageTools(){this.viewModel.sharpness=this.viewModel.brightness=this.viewModel.contrast=0}_resetVideoTools(){this.viewModel.videoViewModel?.resetVideoEnhancementTools()}_storeNavigationToolReference(e){this._navigationTool=e}_toggleAdditionalCameraLocations(){this.isAdditionalPointSourcesVisible=!this.isAdditionalPointSourcesVisible}_toggleAdditionalCoverage(){this.isAdditionalCoverageVisible=!this.isAdditionalCoverageVisible}_toggleCurrentCoverage(){this.currentCoverageVisible=!this.currentCoverageVisible}_toggleImageEnhancementToolState(e){e.stopPropagation();const t=this.imageEnhancementToolActive;this._closeAllImageTools(),this.imageEnhancementToolActive=!t}_toggleVideoEnhancementToolState(e){e.stopPropagation(),this.videoEnhancementToolActive=!this.videoEnhancementToolActive}_toggleImageOverlays(e){e.stopPropagation();const t=this.imageOverlaysOpened;this._closeAllImageTools(),this.imageOverlaysOpened=!t}_toggleImageGallery(e){e.stopPropagation();const t=this.galleryOpened;this._closeAllImageTools(),this.galleryOpened=!!this.imageGalleryEnabled&&!t}_toggleLocationTool(e){const t=this.imageLocationToolActive,i=this.triangularMeasurementActive&&t;this._closeAllImageTools(),this.imageLocationToolActive=i||!t,e.stopPropagation()}_toggleMeasurementSketch(e,t){e.stopPropagation();const i=this.measureType,a=this.triangularMeasurementActive;this._closeAllImageTools(),this.measureType=i!==t||a?t:null,this.measureType===t&&(this.viewModel.displayNewMeasurementButton=!0)}_toggleNavigationTool(){const e=this.navigationToolActive;this._closeAllImageTools(),this.navigationToolActive=!e}_toggleMapImageConversionToolState(){this.mapImageConversionToolState=!this.mapImageConversionToolState}_toggleTriangularAreaMeasurements(){this._toggleTriangularMeasurements("area")}_toggleTriangularDistanceMeasurements(){this._toggleTriangularMeasurements("distance")}_toggleTriangularLocation(){const e=this.triangularMeasurementActive,t=this.navigationToolActive;e?null===this.measureType?this.imageLocationToolActive?this._closeImageToolsAndToggleNavigation(e,t):this._activateTriangulatedImageLocationTool():this._resetMeasureTypeAndActivateImageLocationTool():this._activateTriangulatedImageLocationWorkflow(e,t)}_toggleTriangularMeasurements(e){const t=this.triangularMeasurementActive,i=this.viewModel.measureType,a=this.navigationToolActive;t?e===i?(this._closeAllImageTools(),this.triangularMeasurementActive=!t,this.navigationToolActive=!a):(this.imageLocationToolActive=!1,this.measureType=e):(this._closeAllImageTools(),this.measureType=e,this.triangularMeasurementActive=!t,this.navigationToolActive=!!a||!a)}_unregisterGalleryItem(e){this._galleryObserver.unobserve(e)}_updateNavigationTool(e){const{previousFeatureAngle:t,bestFeatureAngle:i}=this.viewModel,a=(i-t+540)%360-180;e.style.setProperty(L,`${t}deg`),e.style.setProperty(V,`${t+a}deg`)}async loadBestImage(e){return this.viewModel.loadBestImage(e)}loadImageFromSource(e,t){return this.viewModel.loadImageFromSource(e,t)}async overlayMapFeatures(e,t){return this.removeHandles(`${Y.overlayed}-${e.id}`),this.addHandles(r(()=>e.visible,()=>{this.viewModel.toggleOverlayMapFeatures(e.id,e.visible,this.showMapFeatures)}),`${Y.overlayed}-${e.id}`),this._overlayedLayers.add(e),this.viewModel.overlayMapFeatures(e,t&&this.showMapFeatures)}async plotMapPoint(e){return this.viewModel.plotMapPoint(e)}plotReferencePointOnGround(e){this.viewModel.plotReferencePointOnGround(e)}plotReferencePointOnImage(e){this.viewModel.plotReferencePointOnImage(e)}removeOverlayedGraphicsOnImage(e){this.removeHandles(`${Y.overlayed}-${e}`),this._overlayedLayers.remove(this._overlayedLayers.find(t=>t.id===e)),this.viewModel.removeOverlayedGraphicsOnImage(e)}resetImage(){this.viewModel.resetImage()}render(){return K("div",{class:this.classes(q.widget,k)},this._renderRoot)}async showImageByObjectId(e,t){return this.viewModel.showImageByObjectId(e,t)}async startDataCapture(e){return this.viewModel.startDataCapture(e)}async stopDataCapture(e){return this.viewModel.stopDataCapture(e)}updateSuitabilities(e){this.viewModel.updateSuitabilities(e)}};e([g({readOnly:!0})],ee.prototype,"accuracyParametersMissing",null),e([g()],ee.prototype,"activeLayer",null),e([g()],ee.prototype,"activeVideoIcon",null),e([g()],ee.prototype,"activeAudioIcon",null),e([g()],ee.prototype,"cameraHeadingThreshold",null),e([g()],ee.prototype,"cameraPitchThreshold",null),e([g()],ee.prototype,"canNavigateSequentially",null),e([g()],ee.prototype,"currentBestFeature",null),e([g()],ee.prototype,"currentCoverageVisible",null),e([g()],ee.prototype,"dataCaptureEnabled",void 0),e([g()],ee.prototype,"dataCaptureLayer",null),e([g()],ee.prototype,"disabled",null),e([g()],ee.prototype,"features",null),e([g()],ee.prototype,"imagePointsInView",null),e([g()],ee.prototype,"galleryOpened",void 0),e([g()],ee.prototype,"icon",null),e([g()],ee.prototype,"imageEnhancementToolActive",void 0),e([g()],ee.prototype,"videoEnhancementToolActive",void 0),e([g({readOnly:!0})],ee.prototype,"imageGalleryEnabled",null),e([g()],ee.prototype,"imageLocationToolActive",null),e([g()],ee.prototype,"imageOverlaysOpened",void 0),e([g({readOnly:!0})],ee.prototype,"invalidCameraHeading",null),e([g()],ee.prototype,"isAdditionalCoverageVisible",null),e([g()],ee.prototype,"isAdditionalPointSourcesVisible",null),e([g()],ee.prototype,"mapImageConversionToolState",null),e([g()],ee.prototype,"measureType",null),e([g()],ee.prototype,"layer",null),e([g()],ee.prototype,"navigationToolActive",void 0),e([g()],ee.prototype,"navigationMode",null),e([J(w()),g({type:P})],ee.prototype,"viewModel",void 0),e([g(),Z("esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer")],ee.prototype,"messages",void 0),e([g(),Z("esri/core/t9n/Units")],ee.prototype,"measurementUnitMessages",void 0),e([g(),Z("esri/t9n/common")],ee.prototype,"messagesCommon",void 0),e([g(),Z("esri/widgets/Sketch/t9n/Sketch")],ee.prototype,"messagesSketch",void 0),e([g()],ee.prototype,"pixelMeasurementUnit",void 0),e([g()],ee.prototype,"pixelAreaMeasurementUnit",void 0),e([g({readOnly:!0})],ee.prototype,"popupEnabled",null),e([g()],ee.prototype,"referencePoint",null),e([g()],ee.prototype,"showCameraLocations",void 0),e([g()],ee.prototype,"showMapFeatures",void 0),e([J(["create","delete","redo","undo","update"]),g({readOnly:!0})],ee.prototype,"sketchViewModel",null),e([g()],ee.prototype,"triangularMeasurementActive",null),e([g()],ee.prototype,"videoLoaded",null),e([g()],ee.prototype,"view",null),e([g({type:x,nonNullable:!0})],ee.prototype,"visibleElements",void 0),e([g()],ee.prototype,"determineWorkflowForFeature",null),e([g()],ee.prototype,"updateFootprint",null),e([g()],ee.prototype,"_activeMeasurementIcon",null),e([g()],ee.prototype,"_activeMeasurementHeading",null),e([g()],ee.prototype,"_imageOverlaysLoaderTask",void 0),e([g()],ee.prototype,"_imageMeasurementToolsLoaderTask",void 0),e([g()],ee.prototype,"_navigationSettingsLoaderTask",void 0),e([g()],ee.prototype,"_measurementToggle",null),e([g()],ee.prototype,"_renderRoot",null),e([g()],ee.prototype,"_imageEnhancementTools",null),e([g()],ee.prototype,"_videoEnhancementTools",null),e([g()],ee.prototype,"_imageGalleryPanel",null),e([g()],ee.prototype,"_imageGalleryContext",null),e([g()],ee.prototype,"_imageOverlaysComponent",null),e([g()],ee.prototype,"_imageOverlayMessages",null),e([g()],ee.prototype,"_imageSketchToolsMessages",null),e([g()],ee.prototype,"_imageViewer",null),e([g()],ee.prototype,"_imageViewerTriangular",null),e([g()],ee.prototype,"_videoViewer",null),e([g()],ee.prototype,"_locationToggle",null),e([g()],ee.prototype,"_messageBox",null),e([g()],ee.prototype,"_navigationToolExpanded",void 0),e([g()],ee.prototype,"_navigationTool",void 0),e([g()],ee.prototype,"_panoramicViewer",null),e([g()],ee.prototype,"_renderNavigation",null),e([g()],ee.prototype,"_renderThumbnails",null),e([g()],ee.prototype,"_sketchLoaderTask",void 0),ee=e([h("esri.widgets.OrientedImageryViewer")],ee);const te=ee;export{te as default};
5
+ import{__decorate as e}from"tslib";import"../intl.js";import{prefersReducedMotion as t}from"../core/a11yUtils.js";import{createTask as i}from"../core/asyncUtils.js";import a from"../core/Collection.js";import{deprecatedProperty as s}from"../core/deprecate.js";import o from"../core/Logger.js";import{isAbortError as n}from"../core/promiseUtils.js";import{watch as r,initial as l,syncAndInitial as d,whenOnce as c}from"../core/reactiveUtils.js";import{property as g}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{or as m}from"../layers/orientedImagery/transformations/utils.js";import u from"./Expand.js";import v from"./PanoramicViewer.js";import p from"./Widget.js";import{getAllArcPath as y}from"./OrientedImageryViewer/arcUtils.js";import{getDelegatedEvents as w,defaultImageGeometryField as _,defaultOIObjectIDField as M,segmentArcs as T,featureCircleRadius as b,navigationToolDimensionLength as C,sectorsRadii as A}from"./OrientedImageryViewer/constants.js";import{css as I,navigation as f,navigationToolRotationFrom as L,navigationToolRotationTo as V,root as k}from"./OrientedImageryViewer/css.js";import{loadImageForAttachment as S,getThumbnailPixelBlock as O,isFeatureAttachment as E,renderImageWithRotation as F}from"./OrientedImageryViewer/galleryUtils.js";import P from"./OrientedImageryViewer/OrientedImageryViewerViewModel.js";import x from"./OrientedImageryViewer/OrientedImageryViewerVisibleElements.js";import{loadAlertComponents as j,Alert as H}from"./OrientedImageryViewer/components/Alert.js";import G from"./OrientedImageryViewer/components/ImageLocationWidget.js";import D from"./OrientedImageryViewer/components/ImageViewer.js";import $ from"./OrientedImageryViewer/components/NavigationAction.js";import{loadNavigationActionsComponents as N,NavigationActionsCollection as B,NavigationActions as R}from"./OrientedImageryViewer/components/NavigationActions.js";import{loadVideoEnhancementComponents as W,renderEnhancementSlider as U,VideoEnhancementTools as z}from"./OrientedImageryViewer/components/VideoEnhancementTools.js";import{NoImageLoadedError as q}from"./OrientedImageryViewer/navigation/errors.js";import{loadCalciteComponents as Z}from"./support/componentsUtils.js";import{globalCss as J}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as K}from"./support/decorators/messageBundle.js";import{vmEvent as Q}from"./support/decorators/vmEvent.js";import{tsx as X,tsxFragment as Y}from"./support/jsxFactory.js";import{substitute as ee}from"../intl/substitute.js";const te={overlayed:"overlayed"};let ie=class extends p{constructor(e,t){super(e,t),this.dataCaptureEnabled=!1,this.galleryOpened=!1,this.imageEnhancementToolActive=!1,this.videoEnhancementToolActive=!1,this.imageOverlaysOpened=!1,this.navigationToolActive=!1,this.viewModel=new P,this.messagesCommon=null,this.messagesSketch=null,this.pixelMeasurementUnit="meters",this.pixelAreaMeasurementUnit="square-meters",this.showCameraLocations=!1,this.showMapFeatures=!1,this.visibleElements=new x,this._imageOverlaysLoaderTask=null,this._imageMeasurementToolsLoaderTask=null,this._navigationSettingsLoaderTask=null,this._clearMeasurements=()=>{this.viewModel.measureType=null,this.viewModel.clearPreviousMeasurements()},this._clearImageLocation=()=>{this.imageLocationToolActive=!1},this._navigationToolExpanded=!1,this._navigationTool=null,this._galleryController=new AbortController,this._galleryObserver=new IntersectionObserver(this._lazyLoadImage.bind(this)),this._overlayedLayers=new a,this._previousAction=null,this._handleDataCaptureLayerChange=async e=>{if(this.dataCaptureLayer&&await this.stopDataCapture(!0),this.dataCaptureLayer=this.dataCaptureLayer===e?null:e,this.dataCaptureLayer)return this.startDataCapture(this.dataCaptureLayer)},this._handleNavigationSettingsInputChange=(e,t)=>{this.set(`${e}Threshold`,t)},this._handleNavigationSettingsToggle=e=>{this.viewModel.preserveAngle=e},this._handleOverlayLayerDeselect=e=>{const t=e.layer;t===this.dataCaptureLayer&&(this.stopDataCapture(),this.dataCaptureLayer=null),this.removeOverlayedGraphicsOnImage(`${t.id}`)},this._handleOverlayLayerSelect=e=>{const t=e.layer;this.viewModel.overlayMapFeatures(t,this.showMapFeatures),this.addHandles(r(()=>t.visible,()=>{this.viewModel.toggleOverlayMapFeatures(t.id,t.visible,this.showMapFeatures)}),`${te.overlayed}-${t.id}`)},this._highlight=e=>{const t=e.target?.dataset.objectid;t&&this.viewModel.highlight(t)},this._onAction=e=>{const{target:t}=e,{dataset:{action:i}}=t,{_previousAction:a}=this,s=a?.dataset.action,o=s?.includes("draw")??!1,n="select-feature"===s,r=s!==i;switch(i){case"draw-point":case"draw-polygon":case"draw-polyline":{a&&m(n,o&&r)&&(a.active=!1),t.active=!t.active;const e=i.replace("draw-","");this.viewModel.digitizeCreate(e),this._previousAction=t.active?t:null;break}case"save":this.viewModel.saveDrawing();break;case"select-feature":o&&(this._previousAction.active=!1),t.active=!t.active,this.viewModel.toggleSelection(t.active),this._previousAction=t.active?t:null;break;case"delete-feature":this.viewModel.digitizeDelete()}},this._onImageOverlayClosed=()=>{this.imageOverlaysOpened=!1},this._onShowCameraLocationsChanged=e=>{this.showCameraLocations=e},this._onShowMapFeaturesChanged=e=>{this.showMapFeatures=e},this._removeHighlight=()=>this.viewModel.removeHighlight(),this._restoreOverlays=async()=>Promise.all(this._overlayedLayers.map(e=>this.viewModel.overlayMapFeatures(e,this.showMapFeatures))),this._scaleNavigationTool=()=>{this._navigationToolExpanded=!this._navigationToolExpanded},this._sketchLoaderTask=null,this._settingsToggle=null,this._toggleImageNavigation=async e=>{const t=this.navigationMode;this._closeAllImageTools(),this.navigationMode=t!==e?e:null;const{activeViewer:i}=this.viewModel;if(!i)return;const{mode:a,preserveAngle:s}=this.viewModel;if("default"===a)if("directional"===this.navigationMode){const e=await this._loadNavigationSettings(),t="heading"===s||"both"===s,i="pitch"===s||"both"===s,{messages:a,messagesCommon:o}=this,n=new e({cameraHeadingThreshold:this.cameraHeadingThreshold,cameraPitchThreshold:this.cameraPitchThreshold,uiStrings:{configureNavigation:a.configureNavigation,preserveHeading:a.preserveHeading,preserveHeadingDescription:a.preserveHeadingDescription,preservePitch:a.preservePitch,preservePitchDescription:a.preservePitchDescription,settings:o.settings,thresholdLabel:a.thresholdLabel},onInputChange:this._handleNavigationSettingsInputChange,onToggle:this._handleNavigationSettingsToggle,preserveHeading:t,preservePitch:i});this._settingsToggle=new u({content:n,expandIcon:"configure"}),this.viewModel.activeViewer?.ui.add(this._settingsToggle,{position:"top-left"})}else this._settingsToggle&&(this._settingsToggle.expanded=!1,this.viewModel.activeViewer?.ui.remove(this._settingsToggle))},this._toggleImageAttributes=()=>{this.viewModel.toggleImageAttributes()},this.navigate=async e=>{let t=null;try{const{currentNode:i}=this.viewModel;if(!i)throw new q;t=await this.viewModel.navigate(i,e)}catch(i){n(i)||o.getLogger(this).error("Error occurred while navigating",i)}return t},this._loadImageFromGallery=this._loadImageFromGallery.bind(this),this._registerGalleryItem=this._registerGalleryItem.bind(this),this._unregisterGalleryItem=this._unregisterGalleryItem.bind(this),this.loadImageFromSource=this.loadImageFromSource.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this),this._handleVideoBrightnessChange=this._handleVideoBrightnessChange.bind(this),this._handleVideoContrastChange=this._handleVideoContrastChange.bind(this),this._handleBrightnessChange=this._handleBrightnessChange.bind(this),this._handleContrastChange=this._handleContrastChange.bind(this),this._handleSharpnessChange=this._handleSharpnessChange.bind(this),this._resetVideoTools=this._resetVideoTools.bind(this),this._toggleVideoEnhancementToolState=this._toggleVideoEnhancementToolState.bind(this)}initialize(){this.addHandles([r(()=>[this.viewModel?.bestFeatureAngle,this._navigationTool],([e,t])=>{t&&this._updateNavigationTool(t)},l),r(()=>this.currentCoverageVisible,e=>this._onCurrentCoverageVisibilityChange(e)),r(()=>this.isAdditionalCoverageVisible,e=>this._onAdditionalCoverageVisibilityChange(e)),r(()=>this.isAdditionalPointSourcesVisible,e=>this._onAdditionalCameraLocationsVisibility(e)),r(()=>({features:this.currentBestFeature,showCameraLocations:this.showCameraLocations,state:this.viewModel.state}),({showCameraLocations:e,state:t})=>{"image-loaded"===t&&this.viewModel.overlayCameraLocations(e)},d),r(()=>({feature:this.currentBestFeature,showMapFeatures:this.showMapFeatures,state:this.viewModel.state}),async(e,t)=>{if(e.showMapFeatures!==t?.showMapFeatures&&this.viewModel.toggleAllOverlayMapFeatures(e.showMapFeatures),null!=e.feature&&e.feature!==t?.feature){if(this.viewModel.removeAllOverlayMapFeatures(),await c(()=>"image-loaded"===this.viewModel.state),this.dataCaptureLayer&&this.stopDataCapture(),await this._restoreOverlays(),!this.dataCaptureLayer)return;await this.startDataCapture(this.dataCaptureLayer),this._previousAction?.active&&(this._previousAction.active=!1,this._previousAction=null)}},l)])}loadDependencies(){return Promise.all([N(),W(),Z({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),shell:()=>import("@esri/calcite-components/dist/components/calcite-shell"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider")}),j()])}destroy(){this._galleryController.abort(),this._galleryObserver.disconnect(),this.currentBestFeature=null}get accuracyParametersMissing(){return this.viewModel.accuracyParametersMissing}get activeLayer(){return s(o.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){s(o.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeVideoIcon(){const{videoElement:e,videoViewModel:t}=this.viewModel;return e?.loaded&&t?t.videoPaused?"play":"pause":"play"}get activeAudioIcon(){const{videoElement:e,videoViewModel:t}=this.viewModel;return e?.loaded&&t?.videoMuted?"sound-off":"sound"}get cameraHeadingThreshold(){return this.viewModel.cameraHeadingThreshold}set cameraHeadingThreshold(e){this.viewModel.cameraHeadingThreshold=e}get cameraPitchThreshold(){return this.viewModel.cameraPitchThreshold}set cameraPitchThreshold(e){this.viewModel.cameraPitchThreshold=e}get canNavigateSequentially(){const{layer:e}=this;if(!e)return!1;const{fields:t,sequenceOrderField:i}=e;return t.some(({name:e})=>e.toLowerCase()===`${i??"sequenceorder"}`.toLowerCase())}get currentBestFeature(){return this.viewModel.currentBestFeature}set currentBestFeature(e){this.viewModel.currentBestFeature=e}get currentCoverageVisible(){return this.viewModel.currentCoverageVisible}set currentCoverageVisible(e){this.viewModel.currentCoverageVisible=e}get dataCaptureLayer(){return this.viewModel.dataCaptureLayer}set dataCaptureLayer(e){this.viewModel.dataCaptureLayer=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get displayMessage(){return this.viewModel.displayMessage}get features(){return this.viewModel.features}get imagePointsInView(){return this.viewModel.imagePointsInView}get icon(){return"oriented-imagery-widget"}set icon(e){this._overrideIfSome("icon",e)}get imageGalleryEnabled(){return this.viewModel.imageGalleryEnabled}get imageLocationToolActive(){return this.viewModel.imageLocationToolState}set imageLocationToolActive(e){this.viewModel.imageLocationToolState=e}get invalidCameraHeading(){return this.viewModel.invalidCameraHeading}get isAdditionalCoverageVisible(){return this.viewModel.isAdditionalCoverageVisible}set isAdditionalCoverageVisible(e){this.viewModel.isAdditionalCoverageVisible=e}get isAdditionalPointSourcesVisible(){return this.viewModel.isAdditionalPointSourcesVisible}set isAdditionalPointSourcesVisible(e){this.viewModel.isAdditionalPointSourcesVisible=e}get mapImageConversionToolState(){return this.viewModel.mapImageConversionToolState}set mapImageConversionToolState(e){this.viewModel.mapImageConversionToolState=e}get measureType(){return this.viewModel.measureType}set measureType(e){this.viewModel.measureType=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get navigationMode(){return this.viewModel.navigationMode}set navigationMode(e){this.viewModel.navigationMode=e}get popupEnabled(){const{popupEnabled:e,state:t}=this.viewModel;return("image-loaded"===t||this.videoLoaded)&&e}get referencePoint(){return this.viewModel.referencePoint??null}get sketchViewModel(){return this.viewModel.sketch}get triangularMeasurementActive(){return this.viewModel.triangularMeasurementActive}set triangularMeasurementActive(e){this.viewModel.triangularMeasurementActive=e}get videoLoaded(){const{mode:e,videoElement:t}=this.viewModel;return("video"===e&&!0===t?.loaded)??!1}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set determineWorkflowForFeature(e){this.viewModel.determineWorkflowForFeature=e}get determineWorkflowForFeature(){return this.viewModel.determineWorkflowForFeature}set updateFootprint(e){this.viewModel.updateFootprint=e}get updateFootprint(){return this.viewModel.updateFootprint}_renderActionBar(){return X("calcite-action-bar",{expandDisabled:!0,layout:"horizontal",slot:"action-bar"},X("calcite-action-group",null,this._currentFootprintToggle(),this._additionalFootprintToggle(),this._additionalPointSourcesToggle()),X("calcite-action-group",null,this._directionToolToggle(),this._mapImageConversionToggle(),this._navigationToolToggle(),this._imageEnhancementsToggle(),this._videoEnhancementsToggle()),X("calcite-action-group",null,this._measurementToolsToggle(),this._imageGalleryToggle(),this._imageOverlaysToggle(),this._openPopupAction()))}get _activeMeasurementIcon(){const{measureType:e,imageLocationToolActive:t}=this;if(t)return"pin-tear";switch(e){case"area":return"measure-area";case"height":return"measure-building-height-top-base";default:return"measure-line"}}get _activeMeasurementHeading(){const{measureType:e,messages:t,triangularMeasurementActive:i}=this,{groundArea:a,heightAboveGround:s,groundDistance:o,triangulatedAreaHeading:n,triangulatedDistanceHeading:r}=t;if(i)return"area"===e?n:r;switch(e){case"area":return a;case"height":return s;default:return o}}_additionalFootprintToggle(){const{isAdditionalCoverageVisible:e,invalidCameraHeading:t,visibleElements:{additionalFootprintToggle:i}}=this;return i?X("calcite-action",{active:e,bind:this,class:I.addCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleAdditionalCoverage,text:this.messages.additionalFootprints,title:this.messages.additionalFootprints}):null}_additionalPointSourcesToggle(){const{isAdditionalPointSourcesVisible:e,invalidCameraHeading:t,visibleElements:{additionalCameraLocationsToggle:i}}=this;return i?X("calcite-action",{active:e,bind:this,class:I.addExpPoints,disabled:t,icon:"circle-area",onclick:this._toggleAdditionalCameraLocations,text:this.messages.additionalCameraLocations,title:this.messages.additionalCameraLocations}):null}get _measurementToggle(){const{viewModel:{state:e,measureType:t,currentBestFeatureMeasurementImage:i},triangularMeasurementActive:a,id:s}=this;if("image-loaded"!==e||!t||a&&!i)return;this._imageMeasurementToolsLoaderTask||this._loadImageMeasurementResources();const o=this._imageMeasurementToolsLoaderTask?.value;return o?X("calcite-dialog",{bind:this,dragEnabled:!0,escapeDisabled:!0,heading:this._activeMeasurementHeading,id:`${s}-${t}-measurement`,open:!0,placement:"bottom-start",resizable:!0,scale:"s",slot:"dialogs",width:"s",onCalciteDialogBeforeClose:this._clearMeasurements},X(o,{measurementType:t,measurementUnitMessages:this.measurementUnitMessages,messages:this.messages,oiViewModel:this.viewModel})):null}get _renderRoot(){const{viewModel:{state:e},triangularMeasurementActive:t}=this;return X("calcite-panel",{bind:this,class:t?I.viewerContainerMeasurement:I.viewerContainer,heading:this.visibleElements.title?this.messages.title:void 0,loading:e.includes("loading")&&!t},this.visibleElements.menu?this._renderActionBar():null,X("calcite-shell",null,X("calcite-panel",null,this._imageViewer,this._panoramicViewer,this._videoViewer,this._messageBox,this.invalidCameraHeading?null:[this._imageGalleryPanel,this._renderNavigation,this._imageOverlaysPanel()],this._imageEnhancementTools,this._videoEnhancementTools,this._renderSketch()),this._imageViewerTriangular,this._measurementToggle,this._locationToggle,this.invalidCameraHeading?this._renderWarning(this.messages.invalidCameraHeadingWarningTitle,this.messages.invalidCameraHeadingWarningDescription):null))}_currentFootprintToggle(){const{currentCoverageVisible:e,invalidCameraHeading:t}=this,{currentFootprintToggle:i}=this.visibleElements;return i?X("calcite-action",{active:e,bind:this,class:I.currentCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleCurrentCoverage,text:this.messages.currentFootprint,title:this.messages.currentFootprint}):null}get _imageEnhancementTools(){const{imageEnhancementToolActive:e,viewModel:{brightness:t,contrast:i,sharpness:a,state:s}}=this;return e&&"image-loaded"===s?X("calcite-panel",{bind:this,class:I.imageEnhancementWrapper,closable:!0,closed:!e,heading:this.messages.imageEnhancement,key:this.messages.imageEnhancement,onCalcitePanelClose:this._toggleImageEnhancementToolState},X("div",{class:I.imageEnhancementTools},U({title:this.messages.brightness,value:t,max:10,min:-10,ticks:5,handleChange:this._handleBrightnessChange}),U({title:this.messages.contrast,value:i,max:10,min:-10,ticks:5,handleChange:this._handleContrastChange}),U({title:this.messages.sharpness,value:a,max:1,min:0,ticks:.5,step:.1,handleChange:this._handleSharpnessChange})),X("calcite-action",{bind:this,icon:"reset",onclick:this._resetImageTools,slot:"header-actions-end",text:this.messagesCommon.reset,title:this.messagesCommon.reset})):null}get _videoEnhancementTools(){const{videoEnhancementToolActive:e,viewModel:{videoViewModel:t,mode:i},messages:{videoEnhancement:a,brightness:s,contrast:o},messagesCommon:{reset:n}}=this;return e&&"video"===i&&t?X(z,{brightness:t.videoBrightness,constrast:t.videoContrast,handleBrightnessChange:this._handleVideoBrightnessChange,handleContrastChange:this._handleVideoContrastChange,resetTools:this._resetVideoTools,uiStrings:{videoEnhancement:a,brightness:s,contrast:o,reset:n},videoEnhancementToolActive:!0,onClose:this._toggleVideoEnhancementToolState}):null}_imageEnhancementsToggle(){const{state:e,mode:t}=this.viewModel,{imageEnhancement:i}=this.visibleElements;return i&&"video"!==t?X("calcite-action",{active:this.imageEnhancementToolActive,bind:this,disabled:"default"!==t||"image-loaded"!==e,icon:"sliders-horizontal",onclick:this._toggleImageEnhancementToolState,text:this.messages.imageEnhancement,title:this.messages.imageEnhancement}):null}_videoEnhancementsToggle(){const{mode:e}=this.viewModel,{videoEnhancement:t}=this.messages;return"video"===e?X("calcite-action",{active:this.imageEnhancementToolActive,bind:this,disabled:"video"!==e,icon:"sliders-horizontal",onclick:this._toggleVideoEnhancementToolState,text:t,title:t}):null}get _imageGalleryPanel(){const{container:e,galleryOpened:t,imageGalleryEnabled:i}=this;return i&&t&&e?this._imageGalleryContext:null}get _imageGalleryContext(){const{galleryOpened:e,invalidCameraHeading:t}=this;return X("calcite-panel",{bind:this,class:I.carousel,closable:!0,closed:!e,disabled:t,heading:this.messages.imageGallery,key:this.messages.imageGallery,onCalcitePanelClose:this._toggleImageGallery},X("div",{class:I.carouselContainer},this._renderThumbnails))}_imageGalleryToggle(){const{imageGalleryEnabled:e,invalidCameraHeading:t,visibleElements:{imageGallery:i}}=this;return i?X("calcite-action",{active:this.galleryOpened,bind:this,disabled:!e||t,icon:"images",onclick:this._toggleImageGallery,text:this.messages.imageGallery,title:this.messages.imageGallery}):null}get _imageOverlaysComponent(){const{_imageOverlayMessages:e,_imageOverlaysLoaderTask:t,_overlayedLayers:a,dataCaptureEnabled:s,dataCaptureLayer:o,imageOverlaysOpened:n,showCameraLocations:r,showMapFeatures:l,view:d,layer:c}=this;if(!c)return null;const g=c.imageGeometryField?.length?c.imageGeometryField:_,h=c.imageReferenceField?.length?c.imageReferenceField:M;t||(this._imageOverlaysLoaderTask=i(async()=>(await import("./OrientedImageryViewer/components/ImageOverlays.js")).default));const m=this._imageOverlaysLoaderTask?.value;return m?X(m,{closed:!n,dataCaptureEnabled:s,dataCaptureLayer:o,imageGeometryField:g,imageReferenceField:h,messages:e,overlayedLayers:a,showCameraLocations:r,showMapFeatures:l,view:d,onDataCaptureLayerChanged:this._handleDataCaptureLayerChange,onImageOverlaysClosed:this._onImageOverlayClosed,onLayerDeselected:this._handleOverlayLayerDeselect,onLayerSelected:this._handleOverlayLayerSelect,onShowCameraLocationsChanged:this._onShowCameraLocationsChanged,onShowMapFeaturesChanged:this._onShowMapFeaturesChanged}):null}get _imageOverlayMessages(){return{...this.messages,...this.messagesSketch}}get _imageSketchToolsMessages(){return{...this.messagesSketch,...this.messagesCommon}}_imageOverlaysPanel(){const{imageOverlaysOpened:e,viewModel:{state:t}}=this,i=this.classes({[I.imageOverlaysContainer]:!0,[J.hidden]:!e||"image-loaded"!==t});return X("div",{class:i,key:this.messages.imageOverlays},this._imageOverlaysComponent)}_imageOverlaysToggle(){const{viewModel:{state:e},imageOverlaysOpened:t,invalidCameraHeading:i,visibleElements:{imageOverlays:a}}=this;return a?X("calcite-action",{active:t,bind:this,disabled:"image-loaded"!==e||i,icon:"layers",onclick:this._toggleImageOverlays,text:this.messages.imageOverlays,title:this.messages.imageOverlays}):null}get _imageViewer(){const{displayMessage:e,loadImageViewer:t,mode:i,clickAction:a,state:s}=this.viewModel,o=null!=e||"default"!==i||s.includes("loading"),{messages:{end:n,next:r,previous:l,start:d}}=this;return X(D,{afterCreate:t,clickAction:a,navigationEnabled:!o&&null!==this.navigationMode,navigationViewModel:this.viewModel,uiStrings:{end:n,next:r,previous:l,start:d},visible:!o})}get _imageViewerTriangular(){const{messages:e,triangularMeasurementActive:t}=this,{displayMessage:i,storeImageMeasurementViewer:a,mode:s,state:o,clickAction:n}=this.viewModel,r=null!=i||"default"!==s,l=this.classes({[I.viewer]:!r,[I.viewerHidden]:r});return t?X("calcite-panel",{class:I.viewerContainerMeasurement,heading:e.measurementViewerHeading,loading:o.includes("loading")},X("calcite-panel",{bind:this,class:l},X(D,{afterCreate:a,clickAction:n,uiStrings:e}))):null}get _videoViewer(){const{mode:e,loadVideoViewer:t,videoViewModel:i}=this.viewModel,{control:a,reset:s}=this.messagesCommon,{mute:o,unmute:n}=this.messages,r="video"!==e,l=this.classes({[I.viewer]:!r,[I.viewerHidden]:r}),d="esri-image-viewer";return X("calcite-panel",{bind:this,class:l},X("calcite-panel",{afterCreate:t,class:this.classes(J.widget,d)}),X("calcite-slider",{bind:this,labelHandles:!0,labelTicks:!0,max:i?.videoDuration,minLabel:"0",value:i?.currentTime??0,onCalciteSliderChange:this._handleVideoSeek}),X("calcite-action-bar",{expandDisabled:!0,layout:"horizontal"},X("calcite-action-group",null,X("calcite-action",{bind:this,icon:this.activeVideoIcon,onclick:()=>i?.playVideoHandler(),text:"Play",title:i?.videoPaused?a.play:a.pause})),X("calcite-action-group",null,X("calcite-action",{bind:this,icon:"refresh",onclick:()=>i?.rewindVideoHandler(),text:"Rewind",title:s})),X("calcite-action-group",null,X("calcite-action",{bind:this,icon:this.activeAudioIcon,onclick:()=>i?.toggleAudio(),text:"Audio",title:i?.videoMuted?o:n}))))}get _locationToggle(){const{viewModel:{state:e,groundCoordinates:t,groundCoordinatesAccuracy:i,triangulatedPoint:a},imageLocationToolActive:s,triangularMeasurementActive:o,messages:{groundLocation:n,triangulatedLocationHeading:r}}=this;if("image-loaded"!==e||!t||!s)return;let l=t;if(o){if(!a)return;l=a}return X("calcite-dialog",{bind:this,dragEnabled:!0,escapeDisabled:!0,heading:o?r:n,id:n,open:!0,placement:"bottom-start",resizable:!0,scale:"s",slot:"dialogs",width:"s",onCalciteDialogBeforeClose:this._clearImageLocation},X(G,{accuracy:i,groundCoordinates:l,messages:this.messages}))}_mapImageConversionToggle(){const{mapImageConversionToolState:e,viewModel:{state:t},invalidCameraHeading:i,visibleElements:{mapImageConversionTool:a}}=this;return a?X("calcite-action",{active:e,bind:this,disabled:"image-loaded"!==t||i,icon:"image-pin",onclick:this._toggleMapImageConversionToolState,text:this.messages.mapImageConversionTool,title:this.messages.mapImageConversionTool}):null}_measurementToolsToggle(){const{_activeMeasurementIcon:e,measureType:t,viewModel:i,accuracyParametersMissing:a,messages:s,triangularMeasurementActive:o,visibleElements:{measurementTools:n}}=this,{state:r,mode:l}=i,{measurementTools:d,groundDistance:c,groundArea:g,heightAboveGround:h,groundLocation:m,triangulatedDistanceHeading:u,triangulatedAreaHeading:v,triangulatedLocationHeading:p}=s;return n?X("calcite-dropdown",{disabled:a,key:"measurement-tools",maxItems:5,title:d,width:"m"},X("calcite-action",{bind:this,disabled:"image-loaded"!==r||a,icon:e,slot:"trigger",text:d}),X("calcite-dropdown-group",null,X("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-line",key:"distance-measurement",onclick:e=>this._toggleMeasurementSketch(e,"distance"),selected:"distance"===t&&!o},c),X("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-area",key:"area-measurement",onclick:e=>this._toggleMeasurementSketch(e,"area"),selected:"area"===t&&!o},g),X("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-building-height-top-base",key:"height-dropdown",onclick:e=>this._toggleMeasurementSketch(e,"height"),selected:"height"===t},h),X("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"pin-tear",key:"surface-location",onclick:this._toggleLocationTool,selected:!!this.imageLocationToolActive&&!o},m),"default"===l&&X(Y,null,X("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"dual-image-distance",key:"triangular-measurement-distance",selected:!!o&&"distance"===this.measureType,onCalciteDropdownItemSelect:this._toggleTriangularDistanceMeasurements},u),X("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"dual-image-area",key:"triangular-measurement-area",selected:!!o&&"area"===this.measureType,onCalciteDropdownItemSelect:this._toggleTriangularAreaMeasurements},v),X("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"dual-image-location",key:"triangular-location",selected:!!o&&this.imageLocationToolActive,onCalciteDropdownItemSelect:this._toggleTriangularLocation},p)))):null}get _messageBox(){const{messages:e,viewModel:{displayMessage:t,mode:i}}=this;if(!t||"video"===i)return null;const{data:a,key:s,map:o}=t,n=`${o?ee(e[s],o):e[s]}`;return X("span",{class:I.messageBox},a?`${n} ${a}`:n)}async _loadNavigationSettings(){return this._navigationSettingsLoaderTask||(this._navigationSettingsLoaderTask=i(async()=>(await import("./OrientedImageryViewer/components/NavigationSettings.js")).default)),await this._navigationSettingsLoaderTask.promise}_navigationToolToggle(){const{state:e}=this.viewModel,{visibleElements:{navigationTool:t},videoLoaded:i}=this;return t?X("calcite-action",{active:this.navigationToolActive,bind:this,disabled:"image-loaded"!==e&&!i||this.invalidCameraHeading,icon:"explore",onclick:this._toggleNavigationTool,text:this.messages.navigationTool,title:this.messages.navigationTool}):null}_directionToolToggle(){const{state:e}=this.viewModel,{visibleElements:{directionalNavigation:t,sequentialNavigation:i}}=this,a=new B;t&&a.push(new $({active:"directional"===this.navigationMode,disabled:"image-loaded"!==e||this.invalidCameraHeading,icon:"i2DExplore",onclick:()=>{this._toggleImageNavigation("directional")},text:this.messages.directionalNavigation,title:this.messages.directionalNavigationDescription})),i&&a.push(new $({active:"sequential"===this.navigationMode,disabled:"image-loaded"!==e||this.invalidCameraHeading||!this.canNavigateSequentially,icon:"reorder-stack",onclick:()=>{this._toggleImageNavigation("sequential")},text:this.messages.sequentialNavigation,title:this.messages.sequentialNavigationDescription}));return t||i?X(R,{actions:a,activeAction:a.items.find(e=>e.active),icon:"absolute-direction",label:this.messages.imageNavigation,scale:"m",title:this.messages.imageNavigation}):null}_openPopupAction(){const{showPopupsAction:e}=this.visibleElements;return e?X("calcite-action",{bind:this,disabled:!this.popupEnabled,icon:"popup",onclick:this._toggleImageAttributes,text:this.messages.showPopups,title:this.messages.showPopups}):null}get _panoramicViewer(){const{displayMessage:e,loadPanoramicViewer:t,mode:i,clickAction:a,state:s}=this.viewModel,{messages:{end:o,next:n,previous:r,start:l}}=this,d=null!=e||"panoramic"!==i||s.includes("loading");return X(v,{afterCreate:t,clickAction:a,navigationEnabled:!d&&null!==this.navigationMode,navigationViewModel:this.viewModel,uiStrings:{end:o,next:n,previous:r,start:l},visible:!d})}_activateTriangulatedImageLocationTool(){this.navigationToolActive=!0,this.imageLocationToolActive=!0}_activateTriangulatedImageLocationWorkflow(e,t){this._closeAllImageTools(),this.imageLocationToolActive=!0,this.triangularMeasurementActive=!e,this.navigationToolActive=!!t||!t}_closeImageToolsAndToggleNavigation(e,t){this._closeAllImageTools(),this.triangularMeasurementActive=!e,this.navigationToolActive=!t}_resetMeasureTypeAndActivateImageLocationTool(){this.measureType=null,this.imageLocationToolActive=!0}_closeAllImageTools(){this.imageEnhancementToolActive=!1,this.navigationToolActive=!1,this.imageOverlaysOpened=!1,this.galleryOpened=!1,this.measureType=null,this.imageLocationToolActive=!1,this.navigationMode=null,this.triangularMeasurementActive=!1,this._settingsToggle&&(this._settingsToggle.expanded=!1,this.viewModel.activeViewer?.ui.remove(this._settingsToggle))}_handleBrightnessChange(e){this.viewModel.brightness=e.currentTarget.value??0}_handleVideoBrightnessChange(e){this.viewModel.videoViewModel?.handleVideoBrightnessChange(e.target.value)}_handleContrastChange(e){this.viewModel.contrast=e.currentTarget.value??0}_handleVideoContrastChange(e){this.viewModel.videoViewModel?.handleVideoContrastChange(e.target.value)}_handleVideoSeek(e){const t=this.viewModel?.videoElement?.content;t&&(t.currentTime=e.target.value,t.play())}_handleSharpnessChange(e){this.viewModel.sharpness=e.currentTarget.value??0}_lazyLoadImage(e,t){e.forEach(async e=>{if(e.isIntersecting){const a=e.target,s=a.getAttribute("data-src"),r=a.getAttribute("data-rotation"),l=a.getAttribute("data-objectid"),d=r?parseFloat(r)%360:0,{layer:c,_galleryController:{signal:g}}=this;if(!s||!l)return;let h;try{h=E(s)?await S(c,l,{signal:g}):await O(s,{signal:g})}catch(i){n(i)||o.getLogger("esri.widgets.OrientedImageryViewer").error("#lazyLoadImage()",i)}finally{t.unobserve(a)}if(!h)return;F(h,a,d)}})}_loadImageFromGallery(e){const{target:t}=e;if(!t)return;const i=t.getAttribute("data-objectid");i&&this.viewModel.currentBestFeature?.attributes.objectId!==Number(i)&&this.viewModel.selectBestFeature(i)}_loadImageMeasurementResources(){this._imageMeasurementToolsLoaderTask=i(async()=>{const{default:e}=await import("./OrientedImageryViewer/components/ImageMeasurementWidget.js");return e})}_loadSketchResources(){this._sketchLoaderTask=i(async()=>(await import("./OrientedImageryViewer/components/SketchTools.js")).default)}_onAdditionalCoverageVisibilityChange(e){this.viewModel.setAdditionalCoverageVisibility(e)}_onAdditionalCameraLocationsVisibility(e){this.viewModel.setAdditionalCameraLocationsVisibility(e)}_onCurrentCoverageVisibilityChange(e){this.viewModel.setCurrentCoverageVisibility(e)}_registerGalleryItem(e){this._galleryObserver.observe(e)}_renderWarning(e,t){const{viewModel:{state:i}}=this;return"image-loaded"===i?X(H,{icon:"exclamation-mark-triangle-f",kind:"warning",message:t,open:!0,title:e,tooltip:t}):null}get _renderNavigation(){const{viewModel:{sectorData:e,navigatorCurrentBestFeature:i,currentBestFeature:a,state:s}}=this;if(!this.container||!a)return null;let o,n,r,l,d;if(i){const{x:e,y:t,direction:a}=i,[s,c,g,h]=T[a];o=`M ${e} ${t} L ${s} ${c} A ${A[2]} ${A[2]} 0 0 1 ${g} ${h} Z`,n=e,l=t,r=T[a][4],d=T[a][5]}const c=e=>{const t=e.target.dataset?.sector;t&&this.viewModel.handleSectorClick(+t)},g=e=>{const t=e.target.dataset;if(!t)return;const{featureIndexInSector:i,sector:a}=t;i&&a&&this.viewModel.handleFeatureClick({sector:a,featureIndexInSector:+i})},h=e=>{e.removeEventListener("click",g)},m=a.attributes.objectId,u=e?.map(e=>e?.items).filter(Boolean).flatMap(e=>e?.map(({x:e,y:t,objectID:i,featureIndexInSector:a,sector:s})=>X("circle",{afterRemoved:h,class:this.classes(I.feature,{selected:m===i}),cx:e,cy:t,"data-feature-index-in-sector":a,"data-sector":s,key:`${I.feature}-${i}`,onclick:g,r:b}))),v=e=>{e.removeEventListener("click",c)},p=this.classes({[I.navigationWrapper]:!0,[I.navigationZoomed]:this._navigationToolExpanded});return this.navigationToolActive&&("image-loaded"===s||this.videoLoaded)?X("div",{bind:this,class:p,key:this.messages.navigationTool},X("svg",{afterCreate:e=>this._storeNavigationToolReference(e),class:t()?f:I.rotateWithAnimation,focusable:"false",height:C,role:"img",width:C,xmlns:"http://www.w3.org/2000/svg"},X("defs",null,X("linearGradient",{gradientUnits:"userSpaceOnUse",id:`${this.id}-coverage-fill`,x1:n,x2:r,y1:l,y2:d},X("stop",{class:I.navigationPathOffset0,offset:0}),X("stop",{class:I.navigationPathOffset1,offset:1}))),X("g",null,X("circle",{class:this.classes(I.sector,I.outerSector),cx:A[3],cy:A[3],onclick:this._scaleNavigationTool,r:A[3]}),X("circle",{class:I.sector,cx:A[3],cy:A[3],r:A[2]}),X("circle",{class:I.sector,cx:A[3],cy:A[3],r:A[1]}),X("circle",{class:I.sector,cx:A[3],cy:A[3],r:A[0]}),X("path",{class:I.pointer,d:"M 56.5 6.06217782649107 L 60 0 L 63.5 6.06217782649107 Z",key:`${I.pointer}-west`}),X("path",{class:this.classes(I.pointer,I.north),d:"M 113.93782217350893 56.5 L 120 60 L 113.93782217350893 63.5 Z",key:`${I.pointer}-north`}),X("path",{class:I.pointer,d:"M 56.5 113.93782217350893 L 60 120 L 63.5 113.93782217350893 Z",key:`${I.pointer}-east`}),X("path",{class:I.pointer,d:"M 6.06217782649107 56.5 L 0 60 L 6.06217782649107 63.5 Z",key:`${I.pointer}-south`}),X("path",{class:this.classes(I.sector,I.sectorSeparator),d:"M 23.937554159486076 23.937554159486076 L 96.06244584051393 96.06244584051393 M 23.937554159486076 96.06244584051393 L 96.06244584051393 23.937554159486076",key:I.sectorSeparator}),y([A[2],A[1],A[0]],A[3],A[3]).map((t,i)=>X("path",{afterRemoved:v,class:this.classes(I.sector,e?.[i]?.length?I.sectorEnabled:I.sectorDisabled),d:t,"data-sector":`${i}`,key:`${I.sector}-${i}`,onclick:c})),X("path",{class:this.classes(I.sector,I.sectorCross),d:"M 56.4 56.4 L 63.53 63.53 M 63.53 56.4 L 56.4 63.53",key:I.sectorCross}),u,a.attributes.cameraPitch>=5&&o?X("path",{class:I.selectedFeaturePath,d:o,fill:`url(#${this.id}-coverage-fill)`,key:I.selectedFeaturePath}):null))):null}_renderSketch(){const{dataCaptureLayer:e,imageOverlaysOpened:t}=this;if(!e||t)return null;if(this._sketchLoaderTask||this._loadSketchResources(),!this._sketchLoaderTask?.value)return null;const{geometryType:i}=e,a="point"===i?"pin":"polyline"===i?"line":"polygon",s=this._sketchLoaderTask.value;return X("div",{class:I.sketchTools},X(s,{icon:a,messages:this._imageSketchToolsMessages,type:i,onAction:this._onAction}))}get _renderThumbnails(){const{currentBestFeature:e,thumbnails:t}=this.viewModel;return e?X("div",{class:I.carouselContent},t?.items.map(({url:t,objectId:i,rotation:a},s)=>X("div",{class:`${I.carouselItemWrapper}${e.attributes.objectId===i?"--selected":""}`,key:`${I.carouselItemWrapper}-${s}`},X("canvas",{afterCreate:this._registerGalleryItem,afterRemoved:this._unregisterGalleryItem,alt:`thumbnail-${i}`,class:I.carouselItem,"data-objectid":`${i}`,"data-rotation":`${a}`,"data-src":t,onclick:this._loadImageFromGallery,onmouseenter:this._highlight,onmouseleave:this._removeHighlight})))):null}_resetImageTools(){this.viewModel.sharpness=this.viewModel.brightness=this.viewModel.contrast=0}_resetVideoTools(){this.viewModel.videoViewModel?.resetVideoEnhancementTools()}_storeNavigationToolReference(e){this._navigationTool=e}_toggleAdditionalCameraLocations(){this.isAdditionalPointSourcesVisible=!this.isAdditionalPointSourcesVisible}_toggleAdditionalCoverage(){this.isAdditionalCoverageVisible=!this.isAdditionalCoverageVisible}_toggleCurrentCoverage(){this.currentCoverageVisible=!this.currentCoverageVisible}_toggleImageEnhancementToolState(e){e.stopPropagation();const t=this.imageEnhancementToolActive;this._closeAllImageTools(),this.imageEnhancementToolActive=!t}_toggleVideoEnhancementToolState(e){e.stopPropagation(),this.videoEnhancementToolActive=!this.videoEnhancementToolActive}_toggleImageOverlays(e){e.stopPropagation();const t=this.imageOverlaysOpened;this._closeAllImageTools(),this.imageOverlaysOpened=!t}_toggleImageGallery(e){e.stopPropagation();const t=this.galleryOpened;this._closeAllImageTools(),this.galleryOpened=!!this.imageGalleryEnabled&&!t}_toggleLocationTool(e){const t=this.imageLocationToolActive,i=this.triangularMeasurementActive&&t;this._closeAllImageTools(),this.imageLocationToolActive=i||!t,e.stopPropagation()}_toggleMeasurementSketch(e,t){e.stopPropagation();const i=this.measureType,a=this.triangularMeasurementActive;this._closeAllImageTools(),this.measureType=i!==t||a?t:null,this.measureType===t&&(this.viewModel.displayNewMeasurementButton=!0)}_toggleNavigationTool(){const e=this.navigationToolActive;this._closeAllImageTools(),this.navigationToolActive=!e}_toggleMapImageConversionToolState(){this.mapImageConversionToolState=!this.mapImageConversionToolState}_toggleTriangularAreaMeasurements(){this._toggleTriangularMeasurements("area")}_toggleTriangularDistanceMeasurements(){this._toggleTriangularMeasurements("distance")}_toggleTriangularLocation(){const e=this.triangularMeasurementActive,t=this.navigationToolActive;e?null===this.measureType?this.imageLocationToolActive?this._closeImageToolsAndToggleNavigation(e,t):this._activateTriangulatedImageLocationTool():this._resetMeasureTypeAndActivateImageLocationTool():this._activateTriangulatedImageLocationWorkflow(e,t)}_toggleTriangularMeasurements(e){const t=this.triangularMeasurementActive,i=this.viewModel.measureType,a=this.navigationToolActive;t?e===i?(this._closeAllImageTools(),this.triangularMeasurementActive=!t,this.navigationToolActive=!a):(this.imageLocationToolActive=!1,this.measureType=e):(this._closeAllImageTools(),this.measureType=e,this.triangularMeasurementActive=!t,this.navigationToolActive=!!a||!a)}_unregisterGalleryItem(e){this._galleryObserver.unobserve(e)}_updateNavigationTool(e){const{previousFeatureAngle:t,bestFeatureAngle:i}=this.viewModel,a=(i-t+540)%360-180;e.style.setProperty(L,`${t}deg`),e.style.setProperty(V,`${t+a}deg`)}async loadBestImage(e){return this.viewModel.loadBestImage(e)}loadImageFromSource(e,t){return this.viewModel.loadImageFromSource(e,t)}async overlayMapFeatures(e,t){return this.removeHandles(`${te.overlayed}-${e.id}`),this.addHandles(r(()=>e.visible,()=>{this.viewModel.toggleOverlayMapFeatures(e.id,e.visible,this.showMapFeatures)}),`${te.overlayed}-${e.id}`),this._overlayedLayers.add(e),this.viewModel.overlayMapFeatures(e,t&&this.showMapFeatures)}async plotMapPoint(e){return this.viewModel.plotMapPoint(e)}plotReferencePointOnGround(e){this.viewModel.plotReferencePointOnGround(e)}plotReferencePointOnImage(e){this.viewModel.plotReferencePointOnImage(e)}removeOverlayedGraphicsOnImage(e){this.removeHandles(`${te.overlayed}-${e}`),this._overlayedLayers.remove(this._overlayedLayers.find(t=>t.id===e)),this.viewModel.removeOverlayedGraphicsOnImage(e)}resetImage(){this.viewModel.resetImage()}render(){return X("div",{class:this.classes(J.widget,k)},this._renderRoot)}async showImageByObjectId(e,t){return this.viewModel.showImageByObjectId(e,t)}async startDataCapture(e){return this.viewModel.startDataCapture(e)}async stopDataCapture(e){return this.viewModel.stopDataCapture(e)}updateSuitabilities(e){this.viewModel.updateSuitabilities(e)}};e([g({readOnly:!0})],ie.prototype,"accuracyParametersMissing",null),e([g()],ie.prototype,"activeLayer",null),e([g()],ie.prototype,"activeVideoIcon",null),e([g()],ie.prototype,"activeAudioIcon",null),e([g()],ie.prototype,"cameraHeadingThreshold",null),e([g()],ie.prototype,"cameraPitchThreshold",null),e([g()],ie.prototype,"canNavigateSequentially",null),e([g()],ie.prototype,"currentBestFeature",null),e([g()],ie.prototype,"currentCoverageVisible",null),e([g()],ie.prototype,"dataCaptureEnabled",void 0),e([g()],ie.prototype,"dataCaptureLayer",null),e([g()],ie.prototype,"disabled",null),e([g()],ie.prototype,"features",null),e([g()],ie.prototype,"imagePointsInView",null),e([g()],ie.prototype,"galleryOpened",void 0),e([g()],ie.prototype,"icon",null),e([g()],ie.prototype,"imageEnhancementToolActive",void 0),e([g()],ie.prototype,"videoEnhancementToolActive",void 0),e([g({readOnly:!0})],ie.prototype,"imageGalleryEnabled",null),e([g()],ie.prototype,"imageLocationToolActive",null),e([g()],ie.prototype,"imageOverlaysOpened",void 0),e([g({readOnly:!0})],ie.prototype,"invalidCameraHeading",null),e([g()],ie.prototype,"isAdditionalCoverageVisible",null),e([g()],ie.prototype,"isAdditionalPointSourcesVisible",null),e([g()],ie.prototype,"mapImageConversionToolState",null),e([g()],ie.prototype,"measureType",null),e([g()],ie.prototype,"layer",null),e([g()],ie.prototype,"navigationToolActive",void 0),e([g()],ie.prototype,"navigationMode",null),e([Q(w()),g({type:P})],ie.prototype,"viewModel",void 0),e([g(),K("esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer")],ie.prototype,"messages",void 0),e([g(),K("esri/core/t9n/Units")],ie.prototype,"measurementUnitMessages",void 0),e([g(),K("esri/t9n/common")],ie.prototype,"messagesCommon",void 0),e([g(),K("esri/widgets/Sketch/t9n/Sketch")],ie.prototype,"messagesSketch",void 0),e([g()],ie.prototype,"pixelMeasurementUnit",void 0),e([g()],ie.prototype,"pixelAreaMeasurementUnit",void 0),e([g({readOnly:!0})],ie.prototype,"popupEnabled",null),e([g()],ie.prototype,"referencePoint",null),e([g()],ie.prototype,"showCameraLocations",void 0),e([g()],ie.prototype,"showMapFeatures",void 0),e([Q(["create","delete","redo","undo","update"]),g({readOnly:!0})],ie.prototype,"sketchViewModel",null),e([g()],ie.prototype,"triangularMeasurementActive",null),e([g()],ie.prototype,"videoLoaded",null),e([g()],ie.prototype,"view",null),e([g({type:x,nonNullable:!0})],ie.prototype,"visibleElements",void 0),e([g()],ie.prototype,"determineWorkflowForFeature",null),e([g()],ie.prototype,"updateFootprint",null),e([g()],ie.prototype,"_activeMeasurementIcon",null),e([g()],ie.prototype,"_activeMeasurementHeading",null),e([g()],ie.prototype,"_imageOverlaysLoaderTask",void 0),e([g()],ie.prototype,"_imageMeasurementToolsLoaderTask",void 0),e([g()],ie.prototype,"_navigationSettingsLoaderTask",void 0),e([g()],ie.prototype,"_measurementToggle",null),e([g()],ie.prototype,"_renderRoot",null),e([g()],ie.prototype,"_imageEnhancementTools",null),e([g()],ie.prototype,"_videoEnhancementTools",null),e([g()],ie.prototype,"_imageGalleryPanel",null),e([g()],ie.prototype,"_imageGalleryContext",null),e([g()],ie.prototype,"_imageOverlaysComponent",null),e([g()],ie.prototype,"_imageOverlayMessages",null),e([g()],ie.prototype,"_imageSketchToolsMessages",null),e([g()],ie.prototype,"_imageViewer",null),e([g()],ie.prototype,"_imageViewerTriangular",null),e([g()],ie.prototype,"_videoViewer",null),e([g()],ie.prototype,"_locationToggle",null),e([g()],ie.prototype,"_messageBox",null),e([g()],ie.prototype,"_navigationToolExpanded",void 0),e([g()],ie.prototype,"_navigationTool",void 0),e([g()],ie.prototype,"_panoramicViewer",null),e([g()],ie.prototype,"_renderNavigation",null),e([g()],ie.prototype,"_renderThumbnails",null),e([g()],ie.prototype,"_sketchLoaderTask",void 0),ie=e([h("esri.widgets.OrientedImageryViewer")],ie);const ae=ie;export{ae as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- const e="esri-shadow-cast",i={base:e,timeRange:`${e}__time-range`,timeRangeIndicator:`${e}__time-range__indicator`,datePickerContainer:`${e}__date-picker-container`,datePicker:`${e}__date-picker`,visualization:`${e}__visualization`,visualizationSelect:`${e}__visualization__select`,visualizationConfigHidden:`${e}__visualization__config--hidden`},a=`${e}__label`,t=`${e}__threshold-config`,_={base:t,valueLabel:`${t}__value-label`,discreteBlock:`${t}__discrete-block`,discreteLabel:`${t}__discrete-label`,discreteLabelText:`${t}__discrete-label-text`,discreteLabelOpen:`${t}__discrete-label--open`,discreteLabelEmpty:`${t}__discrete-label--empty`},l=`${e}__duration-config`,n={base:l,radioGroup:`${l}__radio-group`},o=`${e}__discrete-config`,c={base:o},r=`${e}__tooltip`,s={base:r,content:`${r}__content`};export{e as base,i as css,o as discreteConfiguratorBase,c as discreteConfiguratorCss,l as durationConfiguratorBase,n as durationConfiguratorCss,a as label,t as thresholdConfiguratorBase,_ as thresholdConfiguratorCss,r as tooltipBase,s as tooltipCss};
5
+ const e="esri-shadow-cast",i={base:e,timeRange:`${e}__time-range`,timeRangeIndicator:`${e}__time-range__indicator`,datePickerContainer:`${e}__date-picker-container`,datePicker:`${e}__date-picker`,visualization:`${e}__visualization`,visualizationSelect:`${e}__visualization__select`,visualizationConfigHidden:`${e}__visualization__config--hidden`},t=`${e}__threshold-config`,a={base:t,valueLabel:`${t}__value-label`,discreteBlock:`${t}__discrete-block`,discreteLabel:`${t}__discrete-label`,discreteLabelText:`${t}__discrete-label-text`,discreteLabelOpen:`${t}__discrete-label--open`,discreteLabelEmpty:`${t}__discrete-label--empty`},_=`${e}__duration-config`,n={base:_,radioGroup:`${_}__radio-group`},o=`${e}__discrete-config`,c={base:o},l=`${e}__tooltip`,r={base:l,content:`${l}__content`};export{e as base,i as css,o as discreteConfiguratorBase,c as discreteConfiguratorCss,_ as durationConfiguratorBase,n as durationConfiguratorCss,t as thresholdConfiguratorBase,a as thresholdConfiguratorCss,l as tooltipBase,r as tooltipCss};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../core/Collection.js";import{EventedAccessor as i}from"../../core/Evented.js";import n from"../../core/Logger.js";import{after as s,isAbortError as r}from"../../core/promiseUtils.js";import{watch as o,initial as l,syncAndInitial as a,whenOnce as m}from"../../core/reactiveUtils.js";import{offsetDate as u}from"../../core/timeUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import{ensureType as h}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{T as c}from"../../chunks/TimeExtent.js";import{T as f}from"../../chunks/TimeInterval.js";import w from"../../webdoc/Widgets.js";import g from"../../webdoc/widgets/TimeSlider.js";const v=1e4;function T(t){return null!=t&&void 0!==t.count}function x(t){return null!=t&&void 0!==t.interval}function E(t){return null!=t&&void 0!==t.dates}let _=class extends i{constructor(t){super(t),this._animationController=null,this._isViewTimeExtentInitialized=!1,this._timerId=null,this.actions=new e,this.fullTimeExtent=null,this.loop=!1,this.mode="time-window",this.stops={count:10},this.timeExtent=null,this.view=null}initialize(){this.addHandles([o(()=>this.effectiveStops,()=>{this.timeExtent??=this._getDefaultTimeExtent()},l),o(()=>this.view,(t,e)=>{this._unregisterWidget(e),this._registerWidget(t)},a),o(()=>this.timeExtent,t=>{if(!this.view)return;const e=this.view.timeExtent;(t&&!t.isAllTime||e&&!e.isAllTime)&&(t&&e&&t.equals(e)||(this.view.timeExtent=t))},l),o(()=>this.view?.timeExtent,t=>{this._isViewTimeExtentInitialized?(t&&!t.isAllTime||this.timeExtent&&!this.timeExtent.isAllTime)&&(t&&this.timeExtent&&t.equals(this.timeExtent)||(this.timeExtent=t)):this._isViewTimeExtentInitialized=!0})])}destroy(){null!=this._timerId&&(clearInterval(this._timerId),this._timerId=null),this._unregisterWidget(this.view),this.view=null,this._animationController&&(this._animationController.abort(),this._animationController=null)}get effectiveStops(){const{fullTimeExtent:t,stops:e}=this;if(E(e)){const{dates:i}=e;if(!i?.length)return null;const n=i.sort((t,e)=>t.getTime()-e.getTime());if(!t)return n;const{start:s,end:r}=t;if(!s||!r)return n;return n.filter(t=>!(t.getTime()<s.getTime()||t.getTime()>r.getTime()))}if(T(e)){const i=e.timeExtent??t;return this._divideTimeExtentByCount(i,e.count)}if(x(e)){const i=e.timeExtent??t;return this._divideTimeExtentByInterval(i,e.interval)}return[]}set playRate(t){t<=0||t>36e5||("playing"===this.state&&this._startAnimation(),this._set("playRate",t))}get state(){return this.fullTimeExtent?this._animationController?"playing":"ready":"disabled"}get timeExtentValues(){const{mode:t,timeExtent:e}=this;if(!e||e.isAllTime||e.isEmpty)return null;const{start:i,end:n}=e;switch(t){case"cumulative-from-end":case"instant":return i?[i.getTime()]:null;case"cumulative-from-start":return n?[n.getTime()]:null;case"time-window":return i&&n?[i.getTime(),n.getTime()]:null}}next(){this._step({forward:!0,allowRestart:!1})}play(){this._startAnimation()}previous(){this._step({forward:!1,allowRestart:!1})}stop(){this._stopAnimation()}triggerAction(t){this.emit("trigger-action",{action:t})}updateWebDocument(t){const e=new g({currentTimeExtent:this.timeExtent,fullTimeExtent:this.fullTimeExtent,loop:this.loop,numStops:T(this.stops)?this.stops.count:null,numThumbs:"time-window"===this.mode?2:1,stopDelay:this.playRate,stopInterval:x(this.stops)?this.stops.interval:null,stops:E(this.stops)?this.stops.dates:null});t.widgets?t.widgets.timeSlider=e:t.widgets=new w({timeSlider:e})}valuesToTimeExtent(t){if(!t)return null;const e=t.sort((t,e)=>t-e).map(t=>new Date(t)),i=e.length>0?e[0]:null,n=e.length>1?e[1]:null;switch(this.mode){case"time-window":return new c({start:i,end:n});case"instant":return new c({start:i,end:i});case"cumulative-from-start":return new c({start:null,end:i});case"cumulative-from-end":return new c({start:i,end:null});default:return c.allTime}}async _animate(){try{const t=this.view,e=this._animationController?.signal;await Promise.all([s(this.playRate,null,e),t&&m(()=>!t.updating,e)])}catch(t){return r(t)||n.getLogger(this).error(t),void(this._animationController=null)}this._step({forward:!0,allowRestart:!1}),this._animationController&&this._animate()}_divideTimeExtentByCount(t,e=10){if(!t||!e)return[];const{start:i,end:n}=t;if(!i||!n)return[];if(e>v)return this._divideTimeExtentByCount(t);const s=[],r=i.getTime(),o=n.getTime()-r;for(let l=0;l<=e;l++)s.push(new Date(r+l/e*o));return s}_divideTimeExtentByInterval(t,e,i=v){if(!t||!e)return[];const{start:n,end:s}=t;if(!n||!s)return[];const r=s.getTime()-n.getTime(),o=e.toMilliseconds();if(o<=0||r/o>i)return this._divideTimeExtentByCount(t);const l=[],{value:a,unit:m}=e;let p=n;for(;p.getTime()<=s.getTime();)l.push(new Date(p.getTime())),p=u(p,a,m);return l}_getDefaultTimeExtent(){const{effectiveStops:t,mode:e}=this;if(!t||!e)return null;switch(e){case"time-window":return t.length>1?new c({start:t[0],end:t[1]}):null;case"cumulative-from-start":return t.length>0?new c({start:null,end:t[0]}):null;case"cumulative-from-end":return t.length>0?new c({start:t[0],end:null}):null;case"instant":return t.length>0?new c({start:t[0],end:t[0]}):null;default:return null}}_registerWidget(t){if(t){t.persistableViewModels.includes(this)||t.persistableViewModels.add(this)}}_startAnimation(){this._stopAnimation(),this._animationController=new AbortController,this._step({forward:!0,allowRestart:!0}),this._animate()}_step(t){const{forward:e,allowRestart:i}=t,{effectiveStops:n}=this;if(!this.timeExtentValues||!n)return;const s=n.map(t=>t.getTime()),r=this.timeExtentValues.map(t=>{const e=s.indexOf(t);if(-1!==e)return e;const i=s.reduce((e,i)=>Math.abs(i-t)<Math.abs(e-t)?i:e);return s.indexOf(i)}),o=r.map(t=>t+(e?1:-1)),l=o.some(t=>t<0||t>s.length-1),{loop:a,state:m}=this;if(l)if(a||i){const t=Math.min(...r),i=Math.max(...r),n=(e?r.map(e=>e-t):r.map(t=>t+(s.length-1-i))).map(t=>s[t]);this.timeExtent=this.valuesToTimeExtent(n)}else"playing"===m&&this.stop();else{const t=o.map(t=>s[t]);this.timeExtent=this.valuesToTimeExtent(t)}}_stopAnimation(){null!=this._animationController&&(this._animationController.abort(),this._animationController=null)}_unregisterWidget(t){null!=t&&t.persistableViewModels.remove(this)}};t([p()],_.prototype,"_animationController",void 0),t([p({type:e})],_.prototype,"actions",void 0),t([p({readOnly:!0})],_.prototype,"effectiveStops",null),t([p({type:c})],_.prototype,"fullTimeExtent",void 0),t([p({nonNullable:!0})],_.prototype,"loop",void 0),t([p({nonNullable:!0})],_.prototype,"mode",void 0),t([p({nonNullable:!0,value:1e3})],_.prototype,"playRate",null),t([p({readOnly:!0})],_.prototype,"state",null),t([p({cast:t=>t?(x(t)&&(t.interval=h(f,t.interval)),(x(t)||T(t))&&(t.timeExtent=h(c,t.timeExtent)),t):null})],_.prototype,"stops",void 0),t([p({type:c})],_.prototype,"timeExtent",void 0),t([p({readOnly:!0})],_.prototype,"timeExtentValues",null),t([p()],_.prototype,"view",void 0),t([p()],_.prototype,"next",null),t([p()],_.prototype,"play",null),t([p()],_.prototype,"previous",null),t([p()],_.prototype,"stop",null),t([p()],_.prototype,"updateWebDocument",null),_=t([d("esri.widgets.TimeSlider.TimeSliderViewModel")],_);const y=_;export{y as default};
5
+ import{__decorate as t}from"tslib";import e from"../../core/Collection.js";import{EventedAccessor as i}from"../../core/Evented.js";import n from"../../core/Logger.js";import{after as s,isAbortError as r}from"../../core/promiseUtils.js";import{watch as o,initial as l,syncAndInitial as a,whenOnce as m}from"../../core/reactiveUtils.js";import{offsetDate as u}from"../../core/timeUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import{ensureType as h}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{T as c}from"../../chunks/TimeExtent.js";import{T as f}from"../../chunks/TimeInterval.js";import w from"../../webdoc/Widgets.js";import g from"../../webdoc/widgets/TimeSlider.js";const v=1e4;function T(t){return null!=t&&void 0!==t.count}function x(t){return null!=t&&void 0!==t.interval}function E(t){return null!=t&&void 0!==t.dates}let _=class extends i{constructor(t){super(t),this._animationController=null,this._isViewTimeExtentInitialized=!1,this._timerId=null,this.actions=new e,this.fullTimeExtent=null,this.loop=!1,this.mode="time-window",this.stops={count:10},this.timeExtent=null,this.view=null}initialize(){this.addHandles([o(()=>this.effectiveStops,()=>{this.timeExtent??=this._getDefaultTimeExtent()},l),o(()=>this.view,(t,e)=>{this._unregisterWidget(e),this._registerWidget(t)},a),o(()=>this.timeExtent,t=>{if(!this.view)return;const e=this.view.timeExtent;(t&&!t.isAllTime||e&&!e.isAllTime)&&(t&&e&&t.equals(e)||(this.view.timeExtent=t))},l),o(()=>this.view?.timeExtent,t=>{this._isViewTimeExtentInitialized?(t&&!t.isAllTime||this.timeExtent&&!this.timeExtent.isAllTime)&&(t&&this.timeExtent&&t.equals(this.timeExtent)||(this.timeExtent=t)):this._isViewTimeExtentInitialized=!0})])}destroy(){null!=this._timerId&&(clearInterval(this._timerId),this._timerId=null),this._unregisterWidget(this.view),this.view=null,this._animationController&&(this._animationController.abort(),this._animationController=null)}get effectiveStops(){const{fullTimeExtent:t,stops:e}=this;if(E(e)){const{dates:i}=e;if(!i?.length)return null;const n=i.sort((t,e)=>t.getTime()-e.getTime());if(!t)return n;const{start:s,end:r}=t;if(!s||!r)return n;return n.filter(t=>!(t.getTime()<s.getTime()||t.getTime()>r.getTime()))}if(T(e)){const i=e.timeExtent??t;return this._divideTimeExtentByCount(i,e.count)}if(x(e)){const i=e.timeExtent??t;return this._divideTimeExtentByInterval(i,e.interval)}return[]}set playRate(t){t<=0||t>36e5||("playing"===this.state&&this._startAnimation(),this._set("playRate",t))}get state(){return this.fullTimeExtent?this._animationController?"playing":"ready":"disabled"}get timeExtentValues(){const{mode:t,timeExtent:e}=this;if(!e||e.isAllTime||e.isEmpty)return null;const{start:i,end:n}=e;switch(t){case"cumulative-from-end":case"instant":return i?[i.getTime()]:null;case"cumulative-from-start":return n?[n.getTime()]:null;case"time-window":return i&&n?[i.getTime(),n.getTime()]:null}}next(){this._step({forward:!0,allowRestart:!1})}play(){this._startAnimation()}previous(){this._step({forward:!1,allowRestart:!1})}stop(){this._stopAnimation()}triggerAction(t){this.emit("trigger-action",{action:t})}updateWebDocument(t){const e=new g({currentTimeExtent:this.timeExtent,fullTimeExtent:this.fullTimeExtent,loop:this.loop,numStops:T(this.stops)?this.stops.count:null,numThumbs:"time-window"===this.mode?2:1,stopDelay:this.playRate,stopInterval:x(this.stops)?this.stops.interval:null,stops:E(this.stops)?this.stops.dates:null});t.widgets?t.widgets.timeSlider=e:t.widgets=new w({timeSlider:e})}valuesToTimeExtent(t){if(!t)return null;const e=t.sort((t,e)=>t-e).map(t=>new Date(t)),i=e.length>0?e[0]:null,n=e.length>1?e[1]:null;switch(this.mode){case"time-window":return new c({start:i,end:n});case"instant":return new c({start:i,end:i});case"cumulative-from-start":return new c({start:null,end:i});case"cumulative-from-end":return new c({start:i,end:null});default:return c.allTime}}async _animate(){try{const t=this.view,e=this._animationController?.signal;await Promise.all([s(this.playRate,null,e),t&&m(()=>!t.updating,e)])}catch(t){return r(t)||n.getLogger(this).error(t),void(this._animationController=null)}this._step({forward:!0,allowRestart:!1}),this._animationController&&this._animate()}_divideTimeExtentByCount(t,e=10){if(!t||!e)return[];const{start:i,end:n}=t;if(!i||!n)return[];if(e>v)return this._divideTimeExtentByCount(t);const s=[],r=i.getTime(),o=n.getTime()-r;for(let l=0;l<=e;l++)s.push(new Date(r+l/e*o));return s}_divideTimeExtentByInterval(t,e,i=v){if(!t||!e)return[];const{start:n,end:s}=t;if(!n||!s)return[];const r=s.getTime()-n.getTime(),o=e.toMilliseconds();if(o<=0||r/o>i)return this._divideTimeExtentByCount(t);const l=[],{value:a,unit:m}=e;let p=n;for(;p.getTime()<=s.getTime();)l.push(new Date(p)),p=u(p,a,m);return l}_getDefaultTimeExtent(){const{effectiveStops:t,mode:e}=this;if(!t||!e)return null;switch(e){case"time-window":return t.length>1?new c({start:t[0],end:t[1]}):null;case"cumulative-from-start":return t.length>0?new c({start:null,end:t[0]}):null;case"cumulative-from-end":return t.length>0?new c({start:t[0],end:null}):null;case"instant":return t.length>0?new c({start:t[0],end:t[0]}):null;default:return null}}_registerWidget(t){if(t){t.persistableViewModels.includes(this)||t.persistableViewModels.add(this)}}_startAnimation(){this._stopAnimation(),this._animationController=new AbortController,this._step({forward:!0,allowRestart:!0}),this._animate()}_step(t){const{forward:e,allowRestart:i}=t,{effectiveStops:n}=this;if(!this.timeExtentValues||!n)return;const s=n.map(t=>t.getTime()),r=this.timeExtentValues.map(t=>{const e=s.indexOf(t);if(-1!==e)return e;const i=s.reduce((e,i)=>Math.abs(i-t)<Math.abs(e-t)?i:e);return s.indexOf(i)}),o=r.map(t=>t+(e?1:-1)),l=o.some(t=>t<0||t>s.length-1),{loop:a,state:m}=this;if(l)if(a||i){const t=Math.min(...r),i=Math.max(...r),n=(e?r.map(e=>e-t):r.map(t=>t+(s.length-1-i))).map(t=>s[t]);this.timeExtent=this.valuesToTimeExtent(n)}else"playing"===m&&this.stop();else{const t=o.map(t=>s[t]);this.timeExtent=this.valuesToTimeExtent(t)}}_stopAnimation(){null!=this._animationController&&(this._animationController.abort(),this._animationController=null)}_unregisterWidget(t){null!=t&&t.persistableViewModels.remove(this)}};t([p()],_.prototype,"_animationController",void 0),t([p({type:e})],_.prototype,"actions",void 0),t([p({readOnly:!0})],_.prototype,"effectiveStops",null),t([p({type:c})],_.prototype,"fullTimeExtent",void 0),t([p({nonNullable:!0})],_.prototype,"loop",void 0),t([p({nonNullable:!0})],_.prototype,"mode",void 0),t([p({nonNullable:!0,value:1e3})],_.prototype,"playRate",null),t([p({readOnly:!0})],_.prototype,"state",null),t([p({cast:t=>t?(x(t)&&(t.interval=h(f,t.interval)),(x(t)||T(t))&&(t.timeExtent=h(c,t.timeExtent)),t):null})],_.prototype,"stops",void 0),t([p({type:c})],_.prototype,"timeExtent",void 0),t([p({readOnly:!0})],_.prototype,"timeExtentValues",null),t([p()],_.prototype,"view",void 0),t([p()],_.prototype,"next",null),t([p()],_.prototype,"play",null),t([p()],_.prototype,"previous",null),t([p()],_.prototype,"stop",null),t([p()],_.prototype,"updateWebDocument",null),_=t([d("esri.widgets.TimeSlider.TimeSliderViewModel")],_);const y=_;export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import i from"../../Graphic.js";import"../../intl.js";import s from"../../core/Accessor.js";import o from"../../core/Collection.js";import e from"../../core/Error.js";import r from"../../core/Logger.js";import{watch as n}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as l}from"../../core/support/UpdatingHandles.js";import h from"../../layers/GraphicsLayer.js";import y from"../../symbols/LineSymbolMarker.js";import m from"../../symbols/SimpleLineSymbol.js";import{addUniqueLayer as u}from"../../views/draw/support/layerUtils.js";import{onLocaleChange as p}from"../../intl/locale.js";import{fetchMessageBundle as A}from"../../intl/messages.js";const w={noAssociationTypeSpecified:-2147208504};let d=class extends s{constructor(t){super(t),this._internalGraphicsLayerConnectivity=this._createInternalGraphicsLayer("Connectivity Associations (Internal)"),this._internalGraphicsLayerStructuralAttachment=this._createInternalGraphicsLayer("Structural Attachment Associations (Internal)"),this._initialValidationsFinished=!1,this._updatingHandles=new l,this.autoRefreshAssociations=!1,this.connectivityAssociationsLineSymbol=new m({style:"short-dash",width:2,color:[190,159,159,1]}),this.executionError="",this.loadErrors=new o,this.maxAllowableAssociations=250,this.showAssociationsEnabled=!1,this.showArrowsConnectivity=!1,this.showArrowsStructuralAttachment=!1,this.structuralAttachmentAssociationsLineSymbol=new m({style:"short-dash",width:2,color:[159,190,159,1]})}initialize(){const t=async()=>{this.messages||(this.messages=await A("esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations"))};t().then(()=>{this.view||(this.view=null),this.utilityNetwork||(this.utilityNetwork=null),this.addHandles([n(()=>[this.view,this.utilityNetwork],async()=>{const{loadErrors:t,messages:{info:{noUtilityNetwork:i,noView:s}}}=this;this._initialValidationsFinished=!1,t.removeAll();let o=!1,n=!1;this.removeAssociations(),"2d"===this.view?.type?(u(this.view,this._internalGraphicsLayerConnectivity),u(this.view,this._internalGraphicsLayerStructuralAttachment),o=!0):(this.loadErrors.push(s),r.getLogger(this).error(new e("utilityNetworkAssociations:missing-property",s))),"utility"===this.utilityNetwork?.type?n=!0:(this.loadErrors.push(i),r.getLogger(this).error(new e("utilityNetworkAssociations:missing-property",i))),o&&n&&this.showAssociationsEnabled&&await this.showAssociations(),this._internalGraphicsLayerConnectivity.visible=this.includeConnectivityAssociations,this._internalGraphicsLayerStructuralAttachment.visible=this.includeStructuralAttachmentAssociations,this._initialValidationsFinished=!0},{initial:!0}),n(()=>[this.view?.stationary,this.showAssociationsEnabled,this.maxAllowableAssociations],async()=>{this.view?.stationary&&this.showAssociationsEnabled&&(this.includeConnectivityAssociations||this.includeStructuralAttachmentAssociations)&&await this.showAssociations()}),n(()=>[this.showArrowsConnectivity],()=>{const t=this.connectivityAssociationsLineSymbol.clone();t.marker=null,this.showArrowsConnectivity&&(t.marker=new y({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"}));for(const i of this._internalGraphicsLayerConnectivity.graphics)i.symbol=t}),n(()=>[this.showArrowsStructuralAttachment],()=>{const t=this.structuralAttachmentAssociationsLineSymbol.clone();t.marker=null,this.showArrowsStructuralAttachment&&(t.marker=new y({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"}));for(const i of this._internalGraphicsLayerStructuralAttachment.graphics)i.symbol=t}),n(()=>{const{cap:t,color:i,style:s,width:o,marker:e}=this.connectivityAssociationsLineSymbol;return[t,i,s,o,e]},()=>{const t=this.connectivityAssociationsLineSymbol.clone();for(const i of this._internalGraphicsLayerConnectivity.graphics)i.symbol=t;this.showArrowsConnectivity=!1,t.marker=null,this.connectivityAssociationsLineSymbol.marker&&(this.showArrowsConnectivity=!0,t.marker=new y({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"}))}),n(()=>{const{cap:t,color:i,style:s,width:o,marker:e}=this.structuralAttachmentAssociationsLineSymbol;return[t,i,s,o,e]},()=>{const t=this.structuralAttachmentAssociationsLineSymbol.clone();for(const i of this._internalGraphicsLayerStructuralAttachment.graphics)i.symbol=t;this.showArrowsStructuralAttachment=!1,t.marker=null,this.structuralAttachmentAssociationsLineSymbol.marker&&(this.showArrowsStructuralAttachment=!0,t.marker=new y({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"}))}),p(t)])})}destroy(){this._updatingHandles.destroy(),this.view=null,this._removeInternalGraphicsLayers()}set includeConnectivityAssociations(t){this._set("includeConnectivityAssociations",t),this._internalGraphicsLayerConnectivity.visible=t}set includeStructuralAttachmentAssociations(t){this._set("includeStructuralAttachmentAssociations",t),this._internalGraphicsLayerStructuralAttachment.visible=t}get state(){return this.loadErrors.length?"disabled":this._updatingHandles.updating?"executing":""!==this.executionError?"warning":this._initialValidationsFinished?"ready":"loading"}get utilityNetwork(){return this.utilityNetwork}set utilityNetwork(t){this._get("utilityNetwork")!==t&&this._set("utilityNetwork",t)}get view(){return this.view}set view(t){this._get("view")!==t&&this._set("view",t)}removeAssociations(){this._internalGraphicsLayerConnectivity.removeAll(),this._internalGraphicsLayerStructuralAttachment.removeAll()}async showAssociations(){const{messages:{info:{maxAllowableAssociationsExceeded:t,noAssociationsFound:s,noAssociationTypeSpecified:o}},utilityNetwork:r}=this;this._set("executionError","");const n={extent:this.view?.extent,gdbVersion:this.utilityNetwork?.gdbVersion,maxGeometryCount:this.maxAllowableAssociations,moment:this.utilityNetwork?.historicMoment,outSpatialReference:this.view?.spatialReference.clone(),returnConnectivityAssociations:this.includeConnectivityAssociations,returnAttachmentAssociations:this.includeStructuralAttachmentAssociations};this._updatingHandles.addPromise(r?.synthesizeAssociationGeometries(n).then(o=>{let e=[],r=[];return o?.maxGeometryCountExceeded?(this.removeAssociations(),void this._set("executionError",t)):0===o?.associations.length?(this.removeAssociations(),void this._set("executionError",s)):void(o&&(e=o?.associations.filter(({associationType:t})=>"connectivity"===t).map(t=>(this.connectivityAssociationsLineSymbol.marker=null,this.showArrowsConnectivity&&(this.connectivityAssociationsLineSymbol.marker=new y({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"})),new i({geometry:t.geometry.clone(),symbol:this.connectivityAssociationsLineSymbol}))),r=o.associations.filter(({associationType:t})=>"attachment"===t).map(t=>(this.structuralAttachmentAssociationsLineSymbol.marker=null,this.showArrowsStructuralAttachment&&(this.structuralAttachmentAssociationsLineSymbol.marker=new y({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"})),new i({geometry:t.geometry.clone(),symbol:this.structuralAttachmentAssociationsLineSymbol}))),this._internalGraphicsLayerConnectivity.removeAll(),e.length>0&&this._internalGraphicsLayerConnectivity.addMany(e),this._internalGraphicsLayerStructuralAttachment.removeAll(),r.length>0&&this._internalGraphicsLayerStructuralAttachment.addMany(r)))},t=>{let i="Error: "+t;if(t instanceof e&&t.details?.raw)if(t.details.raw.extendedCode===w.noAssociationTypeSpecified)i=o;else i=t.details.message;this._set("executionError",i)}))}_createInternalGraphicsLayer(t){return new h({listMode:"hide",internal:!0,title:t})}_removeInternalGraphicsLayers(){this._internalGraphicsLayerConnectivity&&this._internalGraphicsLayerStructuralAttachment&&this.view?.map&&(this.view.map.remove(this._internalGraphicsLayerConnectivity),this.view.map.remove(this._internalGraphicsLayerStructuralAttachment))}};t([a()],d.prototype,"_initialValidationsFinished",void 0),t([a()],d.prototype,"autoRefreshAssociations",void 0),t([a({type:m,nonNullable:!0})],d.prototype,"connectivityAssociationsLineSymbol",void 0),t([a({readOnly:!0})],d.prototype,"executionError",void 0),t([a({type:Boolean,value:!0})],d.prototype,"includeConnectivityAssociations",null),t([a({type:Boolean,value:!0})],d.prototype,"includeStructuralAttachmentAssociations",null),t([a()],d.prototype,"loadErrors",void 0),t([a()],d.prototype,"maxAllowableAssociations",void 0),t([a()],d.prototype,"messages",void 0),t([a()],d.prototype,"showAssociationsEnabled",void 0),t([a()],d.prototype,"showArrowsConnectivity",void 0),t([a()],d.prototype,"showArrowsStructuralAttachment",void 0),t([a({readOnly:!0})],d.prototype,"state",null),t([a({type:m,nonNullable:!0})],d.prototype,"structuralAttachmentAssociationsLineSymbol",void 0),t([a()],d.prototype,"utilityNetwork",null),t([a()],d.prototype,"view",null),d=t([c("esri.widgets.UtilityNetworkAssociations.UtilityNetworkAssociationsViewModel")],d);const v=d;export{v as default};
5
+ import{__decorate as t}from"tslib";import i from"../../Graphic.js";import"../../intl.js";import s from"../../core/Accessor.js";import o from"../../core/Collection.js";import e from"../../core/Error.js";import r from"../../core/Logger.js";import{watch as n}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as l}from"../../core/support/UpdatingHandles.js";import h from"../../layers/GraphicsLayer.js";import y from"../../symbols/LineSymbolMarker.js";import m from"../../symbols/SimpleLineSymbol.js";import{addUniqueLayer as u}from"../../views/draw/support/layerUtils.js";import{onLocaleChange as p}from"../../intl/locale.js";import{fetchMessageBundle as A}from"../../intl/messages.js";const w={noAssociationTypeSpecified:-2147208504};let d=class extends s{constructor(t){super(t),this._internalGraphicsLayerConnectivity=this._createInternalGraphicsLayer("Connectivity Associations (Internal)"),this._internalGraphicsLayerStructuralAttachment=this._createInternalGraphicsLayer("Structural Attachment Associations (Internal)"),this._initialValidationsFinished=!1,this._updatingHandles=new l,this.autoRefreshAssociations=!1,this.connectivityAssociationsLineSymbol=new m({style:"short-dash",width:2,color:[190,159,159,1]}),this.executionError="",this.loadErrors=new o,this.maxAllowableAssociations=250,this.showAssociationsEnabled=!1,this.showArrowsConnectivity=!1,this.showArrowsStructuralAttachment=!1,this.structuralAttachmentAssociationsLineSymbol=new m({style:"short-dash",width:2,color:[159,190,159,1]})}initialize(){const t=async()=>{this.messages||(this.messages=await A("esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations"))};t().then(()=>{this.view||(this.view=null),this.utilityNetwork||(this.utilityNetwork=null),this.addHandles([n(()=>[this.view,this.utilityNetwork],async()=>{const{loadErrors:t,messages:{info:{noUtilityNetwork:i,noView:s}}}=this;this._initialValidationsFinished=!1,t.removeAll();let o=!1,n=!1;this.removeAssociations(),"2d"===this.view?.type?(u(this.view,this._internalGraphicsLayerConnectivity),u(this.view,this._internalGraphicsLayerStructuralAttachment),o=!0):(this.loadErrors.push(s),r.getLogger(this).error(new e("utilityNetworkAssociations:missing-property",s))),"utility"===this.utilityNetwork?.type?n=!0:(this.loadErrors.push(i),r.getLogger(this).error(new e("utilityNetworkAssociations:missing-property",i))),o&&n&&this.showAssociationsEnabled&&await this.showAssociations(),this._internalGraphicsLayerConnectivity.visible=this.includeConnectivityAssociations,this._internalGraphicsLayerStructuralAttachment.visible=this.includeStructuralAttachmentAssociations,this._initialValidationsFinished=!0},{initial:!0}),n(()=>[this.view?.stationary,this.showAssociationsEnabled,this.maxAllowableAssociations],async()=>{this.view?.stationary&&this.showAssociationsEnabled&&(this.includeConnectivityAssociations||this.includeStructuralAttachmentAssociations)&&await this.showAssociations()}),n(()=>[this.showArrowsConnectivity],()=>{const t=this.connectivityAssociationsLineSymbol.clone();t.marker=null,this.showArrowsConnectivity&&(t.marker=new y({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"}));for(const i of this._internalGraphicsLayerConnectivity.graphics)i.symbol=t}),n(()=>[this.showArrowsStructuralAttachment],()=>{const t=this.structuralAttachmentAssociationsLineSymbol.clone();t.marker=null,this.showArrowsStructuralAttachment&&(t.marker=new y({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"}));for(const i of this._internalGraphicsLayerStructuralAttachment.graphics)i.symbol=t}),n(()=>{const{cap:t,color:i,style:s,width:o,marker:e}=this.connectivityAssociationsLineSymbol;return[t,i,s,o,e]},()=>{const t=this.connectivityAssociationsLineSymbol.clone();for(const i of this._internalGraphicsLayerConnectivity.graphics)i.symbol=t;this.showArrowsConnectivity=!1,t.marker=null,this.connectivityAssociationsLineSymbol.marker&&(this.showArrowsConnectivity=!0,t.marker=new y({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"}))}),n(()=>{const{cap:t,color:i,style:s,width:o,marker:e}=this.structuralAttachmentAssociationsLineSymbol;return[t,i,s,o,e]},()=>{const t=this.structuralAttachmentAssociationsLineSymbol.clone();for(const i of this._internalGraphicsLayerStructuralAttachment.graphics)i.symbol=t;this.showArrowsStructuralAttachment=!1,t.marker=null,this.structuralAttachmentAssociationsLineSymbol.marker&&(this.showArrowsStructuralAttachment=!0,t.marker=new y({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"}))}),p(t)])})}destroy(){this._updatingHandles.destroy(),this.view=null,this._removeInternalGraphicsLayers()}set includeConnectivityAssociations(t){this._set("includeConnectivityAssociations",t),this._internalGraphicsLayerConnectivity.visible=t}set includeStructuralAttachmentAssociations(t){this._set("includeStructuralAttachmentAssociations",t),this._internalGraphicsLayerStructuralAttachment.visible=t}get state(){return this.loadErrors.length?"disabled":this._updatingHandles.updating?"executing":""!==this.executionError?"warning":this._initialValidationsFinished?"ready":"loading"}get utilityNetwork(){return this._get("utilityNetwork")}set utilityNetwork(t){this._get("utilityNetwork")!==t&&this._set("utilityNetwork",t)}get view(){return this._get("view")}set view(t){this._get("view")!==t&&this._set("view",t)}removeAssociations(){this._internalGraphicsLayerConnectivity.removeAll(),this._internalGraphicsLayerStructuralAttachment.removeAll()}async showAssociations(){const{messages:{info:{maxAllowableAssociationsExceeded:t,noAssociationsFound:s,noAssociationTypeSpecified:o}},utilityNetwork:r}=this;this._set("executionError","");const n={extent:this.view?.extent,gdbVersion:this.utilityNetwork?.gdbVersion,maxGeometryCount:this.maxAllowableAssociations,moment:this.utilityNetwork?.historicMoment,outSpatialReference:this.view?.spatialReference.clone(),returnConnectivityAssociations:this.includeConnectivityAssociations,returnAttachmentAssociations:this.includeStructuralAttachmentAssociations};this._updatingHandles.addPromise(r?.synthesizeAssociationGeometries(n).then(o=>{let e=[],r=[];return o?.maxGeometryCountExceeded?(this.removeAssociations(),void this._set("executionError",t)):0===o?.associations.length?(this.removeAssociations(),void this._set("executionError",s)):void(o&&(e=o?.associations.filter(({associationType:t})=>"connectivity"===t).map(t=>(this.connectivityAssociationsLineSymbol.marker=null,this.showArrowsConnectivity&&(this.connectivityAssociationsLineSymbol.marker=new y({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"})),new i({geometry:t.geometry.clone(),symbol:this.connectivityAssociationsLineSymbol}))),r=o.associations.filter(({associationType:t})=>"attachment"===t).map(t=>(this.structuralAttachmentAssociationsLineSymbol.marker=null,this.showArrowsStructuralAttachment&&(this.structuralAttachmentAssociationsLineSymbol.marker=new y({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"})),new i({geometry:t.geometry.clone(),symbol:this.structuralAttachmentAssociationsLineSymbol}))),this._internalGraphicsLayerConnectivity.removeAll(),e.length>0&&this._internalGraphicsLayerConnectivity.addMany(e),this._internalGraphicsLayerStructuralAttachment.removeAll(),r.length>0&&this._internalGraphicsLayerStructuralAttachment.addMany(r)))},t=>{let i="Error: "+t;if(t instanceof e&&t.details?.raw)if(t.details.raw.extendedCode===w.noAssociationTypeSpecified)i=o;else i=t.details.message;this._set("executionError",i)}))}_createInternalGraphicsLayer(t){return new h({listMode:"hide",internal:!0,title:t})}_removeInternalGraphicsLayers(){this._internalGraphicsLayerConnectivity&&this._internalGraphicsLayerStructuralAttachment&&this.view?.map&&(this.view.map.remove(this._internalGraphicsLayerConnectivity),this.view.map.remove(this._internalGraphicsLayerStructuralAttachment))}};t([a()],d.prototype,"_initialValidationsFinished",void 0),t([a()],d.prototype,"autoRefreshAssociations",void 0),t([a({type:m,nonNullable:!0})],d.prototype,"connectivityAssociationsLineSymbol",void 0),t([a({readOnly:!0})],d.prototype,"executionError",void 0),t([a({type:Boolean,value:!0})],d.prototype,"includeConnectivityAssociations",null),t([a({type:Boolean,value:!0})],d.prototype,"includeStructuralAttachmentAssociations",null),t([a()],d.prototype,"loadErrors",void 0),t([a()],d.prototype,"maxAllowableAssociations",void 0),t([a()],d.prototype,"messages",void 0),t([a()],d.prototype,"showAssociationsEnabled",void 0),t([a()],d.prototype,"showArrowsConnectivity",void 0),t([a()],d.prototype,"showArrowsStructuralAttachment",void 0),t([a({readOnly:!0})],d.prototype,"state",null),t([a({type:m,nonNullable:!0})],d.prototype,"structuralAttachmentAssociationsLineSymbol",void 0),t([a()],d.prototype,"utilityNetwork",null),t([a()],d.prototype,"view",null),d=t([c("esri.widgets.UtilityNetworkAssociations.UtilityNetworkAssociationsViewModel")],d);const v=d;export{v as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as r}from"tslib";import t from"../../core/Accessor.js";import o from"../../core/Error.js";import e from"../../core/Logger.js";import{watch as i}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as l}from"../../core/support/UpdatingHandles.js";import n from"../../layers/FeatureLayer.js";import{getOwningPortalUrl as d}from"../../layers/support/layerUtils.js";import c from"../../portal/Portal.js";import{hasUserTypeExtension as u}from"../../portal/support/utils.js";let h=class extends t{constructor(r){super(r),this._updatingHandlesLoad=new l,this._updatingHandlesExecute=new l}initialize(){this.addHandles([i(()=>[this.utilityNetwork,this.view],()=>{this._setUp()},{initial:!0})])}destroy(){this._updatingHandlesLoad.destroy(),this._updatingHandlesExecute.destroy()}get executionError(){return this._executionError}get loadError(){return this._loadError}get state(){return this._updatingHandlesLoad.updating?"loading":this.loadError?"disabled":this._updatingHandlesExecute.updating?"executing":"ready"}get utilityNetwork(){return this.utilityNetwork}set utilityNetwork(r){this._get("utilityNetwork")!==r&&this._set("utilityNetwork",r)}get view(){return this.view}set view(r){this._get("view")!==r&&this._set("view",r)}async executeNamedTraceConfiguration(r){return this._updatingHandlesExecute.addPromise(this._executeNamedTraceConfiguration(r))}async executeTraceConfiguration(r){return this._updatingHandlesExecute.addPromise(this._executeTraceConfiguration(r))}async _executeNamedTraceConfiguration(r){if("disabled"===this.state){const r="trace-analysis-view-model:load-error";throw this._logError(r,this.loadError),new o(r,this.loadError??"")}this._executionError=null;return await this.utilityNetwork.trace(r).catch(r=>{throw this._executionError="trace-error",this._logError("trace-analysis-view-model:execution-error",this.executionError),r})}async _executeTraceConfiguration(r){if("disabled"===this.state){const r="trace-analysis-view-model:load-error";throw this._logError(r,this.loadError),new o(r,this.loadError??"")}this._executionError=null;return await this.utilityNetwork.trace(r).catch(r=>{throw this._executionError="trace-error",this._logError("trace-analysis-view-model:execution-error",this.executionError),r})}_logError(r,t){e.getLogger(this).error(new o(r,t??""))}async _setUp(){const{utilityNetwork:r,view:t}=this;this._updatingHandlesLoad.addPromise((async()=>{this._loadError=null;const e="trace-analysis-view-model:load-error";if(!t)throw this._loadError="no-view",this._logError(e,this.loadError),new o(e,this.loadError??"");if("2d"!==t.type)throw this._loadError="sceneView-not-supported",this._logError(e,this._loadError),new o(e,this.loadError??"");if("utility"!==r?.type)throw this._loadError="no-utility-network",this._logError(e,this.loadError),new o(e,this.loadError??"");r.loaded||await r.load().catch(r=>{throw this._loadError="no-utility-network",this._logError(e,this.loadError),r}),await this._checkUserTypeExtension(r)})())}async _checkUserTypeExtension(r){const t=new n({url:r.networkSystemLayers.dirtyAreasLayerUrl});await t.load();const e=t.version;if(Number(e)<=11.1){const t=await d(r.layerUrl),e=new c({url:t});await e.load();const i=e.user?.username??"";if(!await u(e,i,"utilityNetwork")){const r="trace-analysis-view-model:load-error";throw this._loadError="no-user-type-extension",this._logError(r,this.loadError),new o(r,this.loadError??"")}}}};r([s()],h.prototype,"_executionError",void 0),r([s()],h.prototype,"_loadError",void 0),r([s()],h.prototype,"executionError",null),r([s()],h.prototype,"loadError",null),r([s({readOnly:!0})],h.prototype,"state",null),r([s()],h.prototype,"utilityNetwork",null),r([s()],h.prototype,"view",null),h=r([a("esri.widgets.UtilityNetworkTraceAnalysis.UtilityNetworkTraceAnalysisViewModel")],h);const p=h;export{p as default};
5
+ import{__decorate as r}from"tslib";import t from"../../core/Accessor.js";import o from"../../core/Error.js";import e from"../../core/Logger.js";import{watch as i}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as l}from"../../core/support/UpdatingHandles.js";import n from"../../layers/FeatureLayer.js";import{getOwningPortalUrl as d}from"../../layers/support/layerUtils.js";import c from"../../portal/Portal.js";import{hasUserTypeExtension as u}from"../../portal/support/utils.js";let h=class extends t{constructor(r){super(r),this._updatingHandlesLoad=new l,this._updatingHandlesExecute=new l}initialize(){this.addHandles([i(()=>[this.utilityNetwork,this.view],()=>{this._setUp()},{initial:!0})])}destroy(){this._updatingHandlesLoad.destroy(),this._updatingHandlesExecute.destroy()}get executionError(){return this._executionError}get loadError(){return this._loadError}get state(){return this._updatingHandlesLoad.updating?"loading":this.loadError?"disabled":this._updatingHandlesExecute.updating?"executing":"ready"}get utilityNetwork(){return this._get("utilityNetwork")}set utilityNetwork(r){this._get("utilityNetwork")!==r&&this._set("utilityNetwork",r)}get view(){return this._get("view")}set view(r){this._get("view")!==r&&this._set("view",r)}async executeNamedTraceConfiguration(r){return this._updatingHandlesExecute.addPromise(this._executeNamedTraceConfiguration(r))}async executeTraceConfiguration(r){return this._updatingHandlesExecute.addPromise(this._executeTraceConfiguration(r))}async _executeNamedTraceConfiguration(r){if("disabled"===this.state){const r="trace-analysis-view-model:load-error";throw this._logError(r,this.loadError),new o(r,this.loadError??"")}this._executionError=null;return await this.utilityNetwork.trace(r).catch(r=>{throw this._executionError="trace-error",this._logError("trace-analysis-view-model:execution-error",this.executionError),r})}async _executeTraceConfiguration(r){if("disabled"===this.state){const r="trace-analysis-view-model:load-error";throw this._logError(r,this.loadError),new o(r,this.loadError??"")}this._executionError=null;return await this.utilityNetwork.trace(r).catch(r=>{throw this._executionError="trace-error",this._logError("trace-analysis-view-model:execution-error",this.executionError),r})}_logError(r,t){e.getLogger(this).error(new o(r,t??""))}async _setUp(){const{utilityNetwork:r,view:t}=this;this._updatingHandlesLoad.addPromise((async()=>{this._loadError=null;const e="trace-analysis-view-model:load-error";if(!t)throw this._loadError="no-view",this._logError(e,this.loadError),new o(e,this.loadError??"");if("2d"!==t.type)throw this._loadError="sceneView-not-supported",this._logError(e,this._loadError),new o(e,this.loadError??"");if("utility"!==r?.type)throw this._loadError="no-utility-network",this._logError(e,this.loadError),new o(e,this.loadError??"");r.loaded||await r.load().catch(r=>{throw this._loadError="no-utility-network",this._logError(e,this.loadError),r}),await this._checkUserTypeExtension(r)})())}async _checkUserTypeExtension(r){const t=new n({url:r.networkSystemLayers.dirtyAreasLayerUrl});await t.load();const e=t.version;if(Number(e)<=11.1){const t=await d(r.layerUrl),e=new c({url:t});await e.load();const i=e.user?.username??"";if(!await u(e,i,"utilityNetwork")){const r="trace-analysis-view-model:load-error";throw this._loadError="no-user-type-extension",this._logError(r,this.loadError),new o(r,this.loadError??"")}}}};r([s()],h.prototype,"_executionError",void 0),r([s()],h.prototype,"_loadError",void 0),r([s()],h.prototype,"executionError",null),r([s()],h.prototype,"loadError",null),r([s({readOnly:!0})],h.prototype,"state",null),r([s()],h.prototype,"utilityNetwork",null),r([s()],h.prototype,"view",null),h=r([a("esri.widgets.UtilityNetworkTraceAnalysis.UtilityNetworkTraceAnalysisViewModel")],h);const p=h;export{p as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{property as s}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";import i from"../Slider/SliderViewModel.js";import{formatDateLabel as o,formatNumberLabel as n,getStopChanges as a}from"./support/utils.js";let l=class extends i{constructor(t){super(t),this._initialStopValues=[],this._max=null,this._min=null,this.hasTimeData=!1,this.inputFormatFunction=(t,s)=>"max"===s?this.getUnzoomedMax().toString():"min"===s?this.getUnzoomedMin().toString():t.toString(),this.inputParseFunction=null,this.labelFormatFunction=t=>{if(this.hasTimeData)return o(t);const{max:s,min:e,precision:i}=this,a=s-e>10?2:i;return n(parseFloat(t.toFixed(a)))},this.thumbsConstrained=!1,this.zoomingEnabled=!0}set breaks(t){this._set("breaks",t),this.notifyChange("max"),this.notifyChange("min")}set stops(t){if(t?.length){const{max:s,min:e}=this,i=this.getValuesFromStops(t),o={};null!=e&&i.some(t=>t<e)&&(o.min=Math.min(...i)),null!=s&&i.some(t=>t>s)&&(o.max=Math.max(...i)),this.set({...o}),this._initialStopValues=i}else this._initialStopValues=null;this._set("stops",t||null),this.notifyChange("values")}get labels(){const{values:t}=this,s=t&&t.length?t.map((t,s)=>this.getLabelForValue(t,"value",s)):[],e=this.getUnzoomedMax(),i=this.getUnzoomedMin();return{max:this.getLabelForValue(e,"max"),min:this.getLabelForValue(i,"min"),values:s}}get max(){const{breaks:t}=this;return t?.length?t[t.length-1].max:this.max}set max(t){const{zoomOptions:s}=this;if(null!=s?.max){const e=this.values;let i=s.max;if(t<i&&(i=t,s.max=t),e&&e.length)for(let s=0;s<e.length;s++)t<e[s]&&this.setValue(s,t);this._storeZoomMax(i,t)}else this.updateBreakMax(t),this.setMax(t);this.notifyChange("labels")}get min(){const{breaks:t}=this;return t?.length?t[0].min:this.min}set min(t){const{zoomOptions:s}=this;if(null!=s?.min){const e=this.values;let i=s.min;if(t>i&&(i=t,s.min=t),e&&e.length)for(let s=0;s<e.length;s++)t>e[s]&&this.setValue(s,t);this._storeZoomMin(i,t)}else this.updateBreakMin(t),this.setMin(t);this.notifyChange("labels")}get state(){const{max:t,min:s,values:e}=this;return null!=t&&null!=s&&e.length>0?"ready":"disabled"}get values(){const{breaks:t,stops:s}=this;if(!t&&!s)return[];if(t?.length){const s=t.map(t=>t.max);return s.pop(),s}if(s?.length<2)return[];const e=this.getValuesFromStops();return[e[0],e[e.length-1]]}set zoomOptions(t){const{zoomingEnabled:s,zoomOptions:e}=this;if(s){if(e){const s=null!=this._max?this._max:this.max,e=null!=this._min?this._min:this.min;if(t){const{max:i,min:o}=t,n=null!=i,a=null!=o,l=a?t.min:e,r=a?e:null,h=n?t.max:s,m=n?s:null;this._storeZoomMin(l,r),this._storeZoomMax(h,m)}else this.setMax(s),this.setMin(e),this._min=null,this._max=null}else if(t){const{max:s,min:e}=t;null!=e&&this._storeZoomMin(t.min,this.min),null!=s&&this._storeZoomMax(t.max,this.max)}this._set("zoomOptions",t),this.notifyChange("max"),this.notifyChange("min")}}getStopIndexFromValueIndex(t){const{stops:s}=this,e=this.values[t];if(0===t){return e<=this.values[1]?0:s.length-1}if(1===t){return this.values[0]>=e?0:s.length-1}return null}getStopChanges(t,s){const e=this.stops,i=this.getStopIndexFromValueIndex(t),o=this.getValuesFromStops();o[i]=s;const[n,a]=[o[0],o[o.length-1]].sort((t,s)=>t>s?1:-1),l=a-n,r=e.length-1;return o.map((t,s)=>({index:s,value:this.toPrecision(n+s*l/r)}))}setValue(t,s){const{max:e,min:i,values:o}=this,n=o[t];if(isNaN(s)||n===s||s>e||s<i)return;o[t]=this.toPrecision(s),this._set("values",[...o]);const l=o.slice().sort((t,s)=>t>s?1:-1),r=l[0],h=l[l.length-1],m=a(r,h,this._initialStopValues??[]);this.updateStops(m),this.updateBreaks(),this.notifyChange("labels")}getValuesFromStops(t){const s=t||this.stops;return s?.map(t=>t.hasOwnProperty("ratio")?t.ratio:t.value)}updateBreaks(){const{breaks:t,values:s}=this;t?.length&&s.slice().sort((t,s)=>t>s?1:-1).forEach((s,e)=>{t[e].max=s,null!=t[e+1]&&(t[e+1].min=s)})}updateBreakMax(t){const{breaks:s,max:e,min:i}=this;!isNaN(t)&&e!==t&&null!=i&&t>i&&s?.length&&(s[s.length-1].max=t)}updateBreakMin(t){const{breaks:s,max:e,min:i}=this;!isNaN(t)&&i!==t&&null!=e&&t<e&&s?.length&&(s[0].min=t)}updateStops(t){const{stops:s}=this,e=this.getValuesFromStops();if(e?.length){for(const s of t)e[s.index]=s.value;s.forEach((t,s)=>{t.hasOwnProperty("ratio")?t.ratio=e[s]:t.value=e[s]})}}getUnzoomedMax(){return this.zoomOptions&&null!=this._max?this._max:this.max}getUnzoomedMin(){return this.zoomOptions&&null!=this._min?this._min:this.min}_storeZoomMax(t,s){this._max=s,this.setMax(t)}_storeZoomMin(t,s){this._min=s,this.setMin(t)}};t([s()],l.prototype,"breaks",null),t([s()],l.prototype,"stops",null),t([s()],l.prototype,"hasTimeData",void 0),t([s()],l.prototype,"inputFormatFunction",void 0),t([s()],l.prototype,"inputParseFunction",void 0),t([s()],l.prototype,"labelFormatFunction",void 0),t([s({readOnly:!0})],l.prototype,"labels",null),t([s()],l.prototype,"max",null),t([s()],l.prototype,"min",null),t([s({readOnly:!0})],l.prototype,"state",null),t([s()],l.prototype,"thumbsConstrained",void 0),t([s({readOnly:!0})],l.prototype,"values",null),t([s()],l.prototype,"zoomingEnabled",void 0),t([s()],l.prototype,"zoomOptions",null),l=t([e("esri.widgets.smartMapping.SmartMappingSliderViewModel")],l);const r=l;export{r as default};
5
+ import{__decorate as t}from"tslib";import{property as s}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";import i from"../Slider/SliderViewModel.js";import{formatDateLabel as o,formatNumberLabel as n,getStopChanges as a}from"./support/utils.js";let l=class extends i{constructor(t){super(t),this._initialStopValues=[],this._max=null,this._min=null,this.hasTimeData=!1,this.inputFormatFunction=(t,s)=>"max"===s?this.getUnzoomedMax().toString():"min"===s?this.getUnzoomedMin().toString():t.toString(),this.inputParseFunction=null,this.labelFormatFunction=t=>{if(this.hasTimeData)return o(t);const{max:s,min:e,precision:i}=this,a=s-e>10?2:i;return n(parseFloat(t.toFixed(a)))},this.thumbsConstrained=!1,this.zoomingEnabled=!0}set breaks(t){this._set("breaks",t),this.notifyChange("max"),this.notifyChange("min")}set stops(t){if(t?.length){const{max:s,min:e}=this,i=this.getValuesFromStops(t),o={};null!=e&&i.some(t=>t<e)&&(o.min=Math.min(...i)),null!=s&&i.some(t=>t>s)&&(o.max=Math.max(...i)),this.set({...o}),this._initialStopValues=i}else this._initialStopValues=null;this._set("stops",t||null),this.notifyChange("values")}get labels(){const{values:t}=this,s=t&&t.length?t.map((t,s)=>this.getLabelForValue(t,"value",s)):[],e=this.getUnzoomedMax(),i=this.getUnzoomedMin();return{max:this.getLabelForValue(e,"max"),min:this.getLabelForValue(i,"min"),values:s}}get max(){const{breaks:t}=this;return t?.length?t[t.length-1].max:this._get("max")}set max(t){const{zoomOptions:s}=this;if(null!=s?.max){const e=this.values;let i=s.max;if(t<i&&(i=t,s.max=t),e&&e.length)for(let s=0;s<e.length;s++)t<e[s]&&this.setValue(s,t);this._storeZoomMax(i,t)}else this.updateBreakMax(t),this.setMax(t);this.notifyChange("labels")}get min(){const{breaks:t}=this;return t?.length?t[0].min:this._get("min")}set min(t){const{zoomOptions:s}=this;if(null!=s?.min){const e=this.values;let i=s.min;if(t>i&&(i=t,s.min=t),e&&e.length)for(let s=0;s<e.length;s++)t>e[s]&&this.setValue(s,t);this._storeZoomMin(i,t)}else this.updateBreakMin(t),this.setMin(t);this.notifyChange("labels")}get state(){const{max:t,min:s,values:e}=this;return null!=t&&null!=s&&e.length>0?"ready":"disabled"}get values(){const{breaks:t,stops:s}=this;if(!t&&!s)return[];if(t?.length){const s=t.map(t=>t.max);return s.pop(),s}if(s?.length<2)return[];const e=this.getValuesFromStops();return[e[0],e[e.length-1]]}set zoomOptions(t){const{zoomingEnabled:s,zoomOptions:e}=this;if(s){if(e){const s=null!=this._max?this._max:this.max,e=null!=this._min?this._min:this.min;if(t){const{max:i,min:o}=t,n=null!=i,a=null!=o,l=a?t.min:e,r=a?e:null,h=n?t.max:s,m=n?s:null;this._storeZoomMin(l,r),this._storeZoomMax(h,m)}else this.setMax(s),this.setMin(e),this._min=null,this._max=null}else if(t){const{max:s,min:e}=t;null!=e&&this._storeZoomMin(t.min,this.min),null!=s&&this._storeZoomMax(t.max,this.max)}this._set("zoomOptions",t),this.notifyChange("max"),this.notifyChange("min")}}getStopIndexFromValueIndex(t){const{stops:s}=this,e=this.values[t];if(0===t){return e<=this.values[1]?0:s.length-1}if(1===t){return this.values[0]>=e?0:s.length-1}return null}getStopChanges(t,s){const e=this.stops,i=this.getStopIndexFromValueIndex(t),o=this.getValuesFromStops();o[i]=s;const[n,a]=[o[0],o[o.length-1]].sort((t,s)=>t>s?1:-1),l=a-n,r=e.length-1;return o.map((t,s)=>({index:s,value:this.toPrecision(n+s*l/r)}))}setValue(t,s){const{max:e,min:i,values:o}=this,n=o[t];if(isNaN(s)||n===s||s>e||s<i)return;o[t]=this.toPrecision(s),this._set("values",[...o]);const l=o.slice().sort((t,s)=>t>s?1:-1),r=l[0],h=l[l.length-1],m=a(r,h,this._initialStopValues??[]);this.updateStops(m),this.updateBreaks(),this.notifyChange("labels")}getValuesFromStops(t){const s=t||this.stops;return s?.map(t=>t.hasOwnProperty("ratio")?t.ratio:t.value)}updateBreaks(){const{breaks:t,values:s}=this;t?.length&&s.slice().sort((t,s)=>t>s?1:-1).forEach((s,e)=>{t[e].max=s,null!=t[e+1]&&(t[e+1].min=s)})}updateBreakMax(t){const{breaks:s,max:e,min:i}=this;!isNaN(t)&&e!==t&&null!=i&&t>i&&s?.length&&(s[s.length-1].max=t)}updateBreakMin(t){const{breaks:s,max:e,min:i}=this;!isNaN(t)&&i!==t&&null!=e&&t<e&&s?.length&&(s[0].min=t)}updateStops(t){const{stops:s}=this,e=this.getValuesFromStops();if(e?.length){for(const s of t)e[s.index]=s.value;s.forEach((t,s)=>{t.hasOwnProperty("ratio")?t.ratio=e[s]:t.value=e[s]})}}getUnzoomedMax(){return this.zoomOptions&&null!=this._max?this._max:this.max}getUnzoomedMin(){return this.zoomOptions&&null!=this._min?this._min:this.min}_storeZoomMax(t,s){this._max=s,this.setMax(t)}_storeZoomMin(t,s){this._min=s,this.setMin(t)}};t([s()],l.prototype,"breaks",null),t([s()],l.prototype,"stops",null),t([s()],l.prototype,"hasTimeData",void 0),t([s()],l.prototype,"inputFormatFunction",void 0),t([s()],l.prototype,"inputParseFunction",void 0),t([s()],l.prototype,"labelFormatFunction",void 0),t([s({readOnly:!0})],l.prototype,"labels",null),t([s()],l.prototype,"max",null),t([s()],l.prototype,"min",null),t([s({readOnly:!0})],l.prototype,"state",null),t([s()],l.prototype,"thumbsConstrained",void 0),t([s({readOnly:!0})],l.prototype,"values",null),t([s()],l.prototype,"zoomingEnabled",void 0),t([s()],l.prototype,"zoomOptions",null),l=t([e("esri.widgets.smartMapping.SmartMappingSliderViewModel")],l);const r=l;export{r as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../../Color.js";import{EventedAccessor as i}from"../../../core/Evented.js";import r from"../../../core/Logger.js";import{rad2deg as s}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{when as n,watch as a}from"../../../core/reactiveUtils.js";import{convertUnit as l}from"../../../core/unitUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../geometry/Point.js";import{isLoadedOrLoadFor as d,project as m}from"../../../geometry/projectionUtils.js";import{getResolutionForScale as g}from"../../../geometry/support/scaleUtils.js";import{MeasuredGrid as u}from"../../../grids/MeasuredGrid.js";import{makeDehydratedPoint as v}from"../../../layers/graphics/dehydratedPoint.js";import{defaultUnitPropertyMetadata as y}from"../../../properties/defaultUnit.js";import _ from"../../../symbols/SimpleLineSymbol.js";import w from"../../../symbols/SimpleMarkerSymbol.js";import{minimumPixelsPerStrideForDisplayWhenScalingOff as f}from"../../../views/2d/grid/constants.js";import{getScaleFactor as S,shouldUsePlanar as b,measureMetersPerUnitAtReferencePoint as P}from"../../../views/2d/grid/gridUtils.js";import{DrawGraphicTool2D as j}from"../../../views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js";import"../../../views/2d/interactive/editingTools/ControlPointsTransformTool.js";import"../../../views/2d/interactive/editingTools/TransformTool.js";import"../../../views/2d/interactive/editingTools/MediaTransformToolsWrapper.js";import{ViewEventPriorities as T}from"../../../views/input/InputManager.js";import{KeyBindings as C,sketchKeys as x}from"../../../views/interactive/keybindings.js";import G from"../../../views/interactive/snapping/SnappingOptions.js";import{gridPlacementGraphicSymbol as O}from"../../../views/interactive/snapping/snappingUtils.js";import R from"../../../views/overlay/CrosshairOverlayItem.js";import M from"../../../views/overlay/TextOverlayItem.js";import{loadAutomaticAreaMeasurementUtils as L}from"../../../views/support/automaticAreaMeasurementUtils.js";import{loadAutomaticLengthMeasurementUtils as I}from"../../../views/support/automaticLengthMeasurementUtils.js";import{degreeSymbol as k}from"../../CoordinateConversion/support/formatUtils.js";import{applyColorToGrid as U,gridRotationToDegrees as E}from"./gridUtils.js";const V=Symbol("grid-interactivity");let A=class extends i{constructor(t){super(t),this._drawGraphicTool=null,this._keybindings=null,this._crosshairLabel=null,this._crosshairItem=null,this.snappingManager=null,this.snappingOptions=null,this.view=null,this.placementDisabled=!1,this._mostRecentlyShownGrid=null,this._sketchedVertexCount=0}initialize(){this.addHandles([n(()=>!this.displayEnabled,()=>{this.interactivePlacementState=null}),a(()=>this.view?.viewpoint,()=>{this._renderOverlays()}),a(()=>this.snappingOptions?.gridEnabled,t=>{null!=t&&this.trySetDisplayEnabled(t)}),a(()=>this.view?.grid,(t,e)=>{this._mostRecentlyShownGrid=!t&&e?e:null})])}destroy(){this._resetGridPlacementState(),this._crosshairItem&&(this.view?.overlay?.removeItem(this._crosshairItem),this._crosshairItem=o(this._crosshairItem)),this._crosshairLabel&&(this.view?.overlay?.removeItem(this._crosshairLabel),this._crosshairLabel=o(this._crosshairLabel))}get displayEnabled(){return!!this.view?.grid}get dynamicScaling(){return this.grid?.dynamicScaling??!1}set dynamicScaling(t){this.grid&&(this.grid.dynamicScaling=t)}get grid(){return this.view?.grid??this._mostRecentlyShownGrid}set gridColor(t){if(t?.equals(this.grid?.majorLineColor))return;if(!t)return;const[e,i,r,s]=t.toArray();U(this.grid,[e,i,r,s/255])}get gridColor(){return this.grid?.majorLineColor}get gridControlsEnabled(){return this.displayEnabled&&!this.interactivePlacementState}set interactivePlacementState(t){this._set("interactivePlacementState",t),this._resetGridPlacementState(),t&&this._startGridManipulation(t)}get majorLineInterval(){return this.grid?.majorLineInterval??10}set majorLineInterval(t){this.grid&&(this.grid.majorLineInterval=t<1?1:t>15?15:t)}get rotateWithMap(){return this.grid?.rotateWithMap??!1}set rotateWithMap(t){this.grid&&(this.grid.rotateWithMap=t)}get rotation(){return this.grid?.rotation??-180}set rotation(t){this.grid&&(this.grid.rotation=t)}get snappingEnabled(){return(this.grid&&this.snappingOptions?.gridEnabled)??!1}set snappingEnabled(t){const{snappingOptions:e}=this;e&&(e.gridEnabled=t)}get spacing(){return this.grid?.spacing??1}set spacing(t){this.grid&&t>0&&(this.grid.spacing=t)}get unit(){return this.grid?.units}set unit(t){this.grid&&(this.grid.units=t)}get gridOutOfScale(){return!this.dynamicScaling&&null!=this._pixelsPerStride&&this._pixelsPerStride<f}get effectiveSpacingAfterDynamicScaling(){return this.majorLineInterval<1||!this.dynamicScaling||!this.view||null==this._pixelsPerStride||!this.grid?.spacing?null:this.grid.spacing*S(this.majorLineInterval,this._pixelsPerStride,this.dynamicScaling)}get numericSpacingInputShouldBeVisible(){return!!this.view?.spatialReference&&b(this.view.spatialReference)}get _metersPerSRUnit(){if(!(this.view&&this.displayEnabled&&this.grid&&d(this.grid.center.spatialReference,this.view.spatialReference)))return null;const t=m(this.grid.center,this.view.spatialReference);return P(t)}get _pixelsPerStride(){if(!this.view?.scale||!this.displayEnabled||!this.grid||null==this._metersPerSRUnit)return null;const t=this.grid,{scale:e,spatialReference:i}=this.view;return l(t.spacing,t.units,"meters")/(this._metersPerSRUnit*g(e,i))}get _isPlacing(){if(!this._drawGraphicTool)return!1;const t=this.interactivePlacementState;return"place"===t||"interactive"===t&&0===this._sketchedVertexCount}get _isRotating(){if(!this._drawGraphicTool)return!1;const t=this.interactivePlacementState;return"rotate"===t||"interactive"===t&&1===this._sketchedVertexCount}get _isScaling(){if(!this._drawGraphicTool)return!1;return"interactive"===this.interactivePlacementState&&1===this._sketchedVertexCount}togglePlacementState(t){this.interactivePlacementState=this.interactivePlacementState===t?null:t}trySetDisplayEnabled(t){const{view:e}=this;if(e?.ready)if(!e.grid&&t)if(this._mostRecentlyShownGrid)e.grid=this._mostRecentlyShownGrid;else{const t="imperial"===this.defaultUnit?"feet":"meters";e.grid=new u({units:t,center:e.center??new p,rotateWithMap:!0}),U(this.grid,[115,115,115])}else t||(e.grid=null);else r.getLogger(this).warn("Attempting to enable grid display while view is not ready")}async startPlacement(t){const{view:e,snappingManager:i}=this;if(!e)return;this._set("interactivePlacementState",t),this._sketchedVertexCount=0;const r=new j({view:e,graphicProperties:{attributes:{[O]:O}},sketchOptions:{tooltips:{enabled:!0,visibleElements:{direction:!1,rotation:!1,totalLength:!1,elevation:!1,distance:!1,area:!1}}},geometryType:"polyline",mode:"click",snapToScene:!1,snappingManager:i,forceUniformSize:!0,centered:!1,cursor:"interactive"===this.interactivePlacementState||"place"===this.interactivePlacementState?"none":null,regularVerticesSymbol:void 0,activeVertexSymbol:W,activeLineSymbol:D,graphicSymbol:D,automaticAreaMeasurementUtils:await L(),automaticLengthMeasurementUtils:await I()});if(this._drawGraphicTool=r,e.addAndActivateTool(r),this._renderOverlays(),!this._keybindings){const t=new C;t.add(x.complete,()=>this._onDrawComplete()),t.add(x.vertexAdd,()=>this._drawGraphicTool?.drawOperation.commitStagedVertex()),this._keybindings=t}this.addHandles([r.on("cursor-update",t=>this._onCursorUpdate(t)),r.on("complete",()=>this._onDrawComplete()),r.on("vertex-add",e=>this._onVertexAdd(e,t)),this._keybindings.register(e,T.WIDGET)],V)}async _startGridManipulation(t){const{view:e}=this;if(!e)return void(this.interactivePlacementState=null);const i=new CustomEvent("before-placement",{cancelable:!0});this.emit("before-placement",i),i.defaultPrevented||await this.startPlacement(t)}_onCursorUpdate(t){try{if(this._isPlacing){const e=t.vertices[0].coordinates;return void this._handlePlace(e)}if(this._drawGraphicTool.cursor=null,this._isRotating&&this._handleRotate(t.vertices[0].coordinates),this._isScaling){const t=this._drawGraphicTool?.drawOperation.cursorVertex;this._handleScale(t)}}finally{this._renderOverlays()}}_onDrawComplete(){this._drawGraphicTool.cursor=null,this.interactivePlacementState=null}_onVertexAdd(t,e){const i=t.vertices[0].coordinates;this._isPlacing&&this._handlePlace(i),this._isRotating&&this._sketchedVertexCount>0&&this._handleRotate(i),this._isScaling&&this._sketchedVertexCount>0&&this._handleScale(v(i[0],i[1],void 0,this.view.spatialReference)),this._sketchedVertexCount++,this._drawGraphicTool.cursor=null,2!==this._sketchedVertexCount&&"interactive"===e||(this.interactivePlacementState=null),this._renderOverlays()}_handlePlace(t){const{grid:e,view:i}=this;e&&i&&(e.center=new p({x:t[0],y:t[1],spatialReference:i.spatialReference}))}_handleRotate(t){const{grid:e,view:i}=this;if(!e||!i)return;this._drawGraphicTool?.sketchOptions.tooltips.set("enabled",!1);const{x:r,y:o}=e.center,[n,a]=t,l=i.toScreen(e.center,{pickClosestTarget:!0}),c=l&&i.toMap(l),h=i.toScreen(v(n,a,void 0,i.spatialReference),{pickClosestTarget:!0}),p=h&&i.toMap(h),d=c?c.x:r,m=c?c.y:o,g=d-(p?p.x:n),u=m-(p?p.y:a);if(0===g&&0===u)return;const y=Math.atan2(u,g),_=s(y),w=e.rotateWithMap,f=i.viewpoint.rotation??0,S=w?_:_-f;e.rotation=Math.fround(S)%360}_handleScale(t){const{view:e,grid:i,_drawGraphicTool:r,interactivePlacementState:s,_metersPerSRUnit:o}=this;if(!(t&&e&&i&&r&&o))return;r.sketchOptions.tooltips.enabled=!1;const n="interactive"===s?i.center:r.drawOperation.firstVertex;if(!n||!t)return;const a=e?.toScreen(n),c=a&&e.toMap(a),h=e?.toScreen(t),p=c??n,d=(h&&e.toMap(h))??t,m=Math.sqrt((p.x-d.x)**2+(p.y-d.y)**2),g=l(m*o,"meters",i.units);this.spacing=g}_renderOverlays(){this._renderCrosshairOverlay(),this._renderTextOverlay()}_renderTextOverlay(){const{grid:t,view:e,_drawGraphicTool:i}=this,r=this._getCrosshairLabel();if(!(t&&e?.overlay&&i&&r))return;const s=e.toScreen(t.center,{pickClosestTarget:!0});s&&(r.position=[s.x+12,s.y+12]),this._isRotating?(r.text=`${E(t.rotation)}${k}`,r.visible=!0):r.visible=!1}_renderCrosshairOverlay(){const{grid:t,view:e,_drawGraphicTool:i}=this;if(!t||!e?.overlay||!i)return;const r=this._getCrosshair();if(!r)return;const s=e.toScreen(t.center);s&&(r.x=s.x,r.y=s.y,r.rotation=t.rotateWithMap?e.viewpoint.rotation-t.rotation:-t.rotation,r.visible=!!i)}_getCrosshairLabel(){if(this._crosshairLabel)return this._crosshairLabel;const{grid:t,view:i,_drawGraphicTool:r}=this;if(!t||!i?.overlay||!r)return null;const s=new M({anchor:"top-left",fontSize:10,textColor:new e([21,21,21]),backgroundColor:new e([248,248,248]),padding:8,borderRadius:20});return i.overlay.addItem(s),this._crosshairLabel=s,s}_getCrosshair(){const{_crosshairItem:t,view:e}=this;return e?.overlay?t&&e.overlay.items.includes(t)?t:(this._crosshairItem=new R({color:e.effectiveTheme.accentColor,thickness:4,length:36,visible:!0}),e.overlay?.addItem(this._crosshairItem),this._crosshairItem):null}_resetGridPlacementState(){this.removeHandles(V),this._crosshairItem&&(this._crosshairItem.visible=!1),this._crosshairLabel&&(this._crosshairLabel.visible=!1),this._drawGraphicTool&&(this.view?.activeTool===this._drawGraphicTool&&(this.view.activeTool=null),this.view?.tools.remove(this._drawGraphicTool)),this._drawGraphicTool=o(this._drawGraphicTool)}};t([c(y)],A.prototype,"defaultUnit",void 0),t([c({readOnly:!0})],A.prototype,"displayEnabled",null),t([c()],A.prototype,"dynamicScaling",null),t([c()],A.prototype,"grid",null),t([c()],A.prototype,"gridColor",null),t([c({readOnly:!0})],A.prototype,"gridControlsEnabled",null),t([c()],A.prototype,"interactivePlacementState",null),t([c()],A.prototype,"majorLineInterval",null),t([c()],A.prototype,"rotateWithMap",null),t([c()],A.prototype,"rotation",null),t([c()],A.prototype,"snappingEnabled",null),t([c()],A.prototype,"snappingManager",void 0),t([c({type:G})],A.prototype,"snappingOptions",void 0),t([c()],A.prototype,"spacing",null),t([c()],A.prototype,"unit",null),t([c()],A.prototype,"view",void 0),t([c({readOnly:!0})],A.prototype,"gridOutOfScale",null),t([c({readOnly:!0})],A.prototype,"effectiveSpacingAfterDynamicScaling",null),t([c({readOnly:!0})],A.prototype,"numericSpacingInputShouldBeVisible",null),t([c()],A.prototype,"placementDisabled",void 0),t([c()],A.prototype,"_metersPerSRUnit",null),t([c()],A.prototype,"_pixelsPerStride",null),t([c()],A.prototype,"_isPlacing",null),t([c()],A.prototype,"_isRotating",null),t([c()],A.prototype,"_isScaling",null),t([c()],A.prototype,"_mostRecentlyShownGrid",void 0),t([c()],A.prototype,"_sketchedVertexCount",void 0),A=t([h("esri.widgets.support.GridControls.GridControlsViewModel")],A);const D=new _({width:0}),W=new w({color:e.fromArray([0,0,0,0]),outline:new _({color:e.fromArray([0,0,0,0])})});export{A as default};
5
+ import{__decorate as t}from"tslib";import e from"../../../Color.js";import{EventedAccessor as i}from"../../../core/Evented.js";import r from"../../../core/Logger.js";import{rad2deg as s}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{when as n,watch as a}from"../../../core/reactiveUtils.js";import{convertUnit as l}from"../../../core/unitUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../geometry/Point.js";import{isLoadedOrLoadFor as d,project as m}from"../../../geometry/projectionUtils.js";import{getResolutionForScale as g}from"../../../geometry/support/scaleUtils.js";import{MeasuredGrid as u}from"../../../grids/MeasuredGrid.js";import{makeDehydratedPoint as v}from"../../../layers/graphics/dehydratedPoint.js";import{defaultUnitPropertyMetadata as y}from"../../../properties/defaultUnit.js";import _ from"../../../symbols/SimpleLineSymbol.js";import w from"../../../symbols/SimpleMarkerSymbol.js";import{minimumPixelsPerStrideForDisplayWhenScalingOff as f}from"../../../views/2d/grid/constants.js";import{getScaleFactor as S,shouldUsePlanar as b,measureMetersPerUnitAtReferencePoint as P}from"../../../views/2d/grid/gridUtils.js";import{DrawGraphicTool2D as j}from"../../../views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js";import"../../../views/2d/interactive/editingTools/ControlPointsTransformTool.js";import"../../../views/2d/interactive/editingTools/TransformTool.js";import{ViewEventPriorities as C}from"../../../views/input/InputManager.js";import{KeyBindings as T,sketchKeys as x}from"../../../views/interactive/keybindings.js";import G from"../../../views/interactive/snapping/SnappingOptions.js";import{gridPlacementGraphicSymbol as O}from"../../../views/interactive/snapping/snappingUtils.js";import R from"../../../views/overlay/CrosshairOverlayItem.js";import L from"../../../views/overlay/TextOverlayItem.js";import{loadAutomaticAreaMeasurementUtils as M}from"../../../views/support/automaticAreaMeasurementUtils.js";import{loadAutomaticLengthMeasurementUtils as I}from"../../../views/support/automaticLengthMeasurementUtils.js";import{degreeSymbol as k}from"../../CoordinateConversion/support/formatUtils.js";import{applyColorToGrid as U,gridRotationToDegrees as E}from"./gridUtils.js";const V=Symbol("grid-interactivity");let A=class extends i{constructor(t){super(t),this._drawGraphicTool=null,this._keybindings=null,this._crosshairLabel=null,this._crosshairItem=null,this.snappingManager=null,this.snappingOptions=null,this.view=null,this.placementDisabled=!1,this._mostRecentlyShownGrid=null,this._sketchedVertexCount=0}initialize(){this.addHandles([n(()=>!this.displayEnabled,()=>{this.interactivePlacementState=null}),a(()=>this.view?.viewpoint,()=>{this._renderOverlays()}),a(()=>this.snappingOptions?.gridEnabled,t=>{null!=t&&this.trySetDisplayEnabled(t)}),a(()=>this.view?.grid,(t,e)=>{this._mostRecentlyShownGrid=!t&&e?e:null})])}destroy(){this._resetGridPlacementState(),this._crosshairItem&&(this.view?.overlay?.removeItem(this._crosshairItem),this._crosshairItem=o(this._crosshairItem)),this._crosshairLabel&&(this.view?.overlay?.removeItem(this._crosshairLabel),this._crosshairLabel=o(this._crosshairLabel))}get displayEnabled(){return!!this.view?.grid}get dynamicScaling(){return this.grid?.dynamicScaling??!1}set dynamicScaling(t){this.grid&&(this.grid.dynamicScaling=t)}get grid(){return this.view?.grid??this._mostRecentlyShownGrid}set gridColor(t){if(t?.equals(this.grid?.majorLineColor))return;if(!t)return;const[e,i,r,s]=t.toArray();U(this.grid,[e,i,r,s/255])}get gridColor(){return this.grid?.majorLineColor}get gridControlsEnabled(){return this.displayEnabled&&!this.interactivePlacementState}set interactivePlacementState(t){this._set("interactivePlacementState",t),this._resetGridPlacementState(),t&&this._startGridManipulation(t)}get majorLineInterval(){return this.grid?.majorLineInterval??10}set majorLineInterval(t){this.grid&&(this.grid.majorLineInterval=t<1?1:t>15?15:t)}get rotateWithMap(){return this.grid?.rotateWithMap??!1}set rotateWithMap(t){this.grid&&(this.grid.rotateWithMap=t)}get rotation(){return this.grid?.rotation??-180}set rotation(t){this.grid&&(this.grid.rotation=t)}get snappingEnabled(){return(this.grid&&this.snappingOptions?.gridEnabled)??!1}set snappingEnabled(t){const{snappingOptions:e}=this;e&&(e.gridEnabled=t)}get spacing(){return this.grid?.spacing??1}set spacing(t){this.grid&&t>0&&(this.grid.spacing=t)}get unit(){return this.grid?.units}set unit(t){this.grid&&(this.grid.units=t)}get gridOutOfScale(){return!this.dynamicScaling&&null!=this._pixelsPerStride&&this._pixelsPerStride<f}get effectiveSpacingAfterDynamicScaling(){return this.majorLineInterval<1||!this.dynamicScaling||!this.view||null==this._pixelsPerStride||!this.grid?.spacing?null:this.grid.spacing*S(this.majorLineInterval,this._pixelsPerStride,this.dynamicScaling)}get numericSpacingInputShouldBeVisible(){return!!this.view?.spatialReference&&b(this.view.spatialReference)}get _metersPerSRUnit(){if(!(this.view&&this.displayEnabled&&this.grid&&d(this.grid.center.spatialReference,this.view.spatialReference)))return null;const t=m(this.grid.center,this.view.spatialReference);return P(t)}get _pixelsPerStride(){if(!this.view?.scale||!this.displayEnabled||!this.grid||null==this._metersPerSRUnit)return null;const t=this.grid,{scale:e,spatialReference:i}=this.view;return l(t.spacing,t.units,"meters")/(this._metersPerSRUnit*g(e,i))}get _isPlacing(){if(!this._drawGraphicTool)return!1;const t=this.interactivePlacementState;return"place"===t||"interactive"===t&&0===this._sketchedVertexCount}get _isRotating(){if(!this._drawGraphicTool)return!1;const t=this.interactivePlacementState;return"rotate"===t||"interactive"===t&&1===this._sketchedVertexCount}get _isScaling(){if(!this._drawGraphicTool)return!1;return"interactive"===this.interactivePlacementState&&1===this._sketchedVertexCount}togglePlacementState(t){this.interactivePlacementState=this.interactivePlacementState===t?null:t}trySetDisplayEnabled(t){const{view:e}=this;if(e?.ready)if(!e.grid&&t)if(this._mostRecentlyShownGrid)e.grid=this._mostRecentlyShownGrid;else{const t="imperial"===this.defaultUnit?"feet":"meters";e.grid=new u({units:t,center:e.center??new p,rotateWithMap:!0}),U(this.grid,[115,115,115])}else t||(e.grid=null);else r.getLogger(this).warn("Attempting to enable grid display while view is not ready")}async startPlacement(t){const{view:e,snappingManager:i}=this;if(!e)return;this._set("interactivePlacementState",t),this._sketchedVertexCount=0;const r=new j({view:e,graphicProperties:{attributes:{[O]:O}},sketchOptions:{tooltips:{enabled:!0,visibleElements:{direction:!1,rotation:!1,totalLength:!1,elevation:!1,distance:!1,area:!1}}},geometryType:"polyline",mode:"click",snapToScene:!1,snappingManager:i,forceUniformSize:!0,centered:!1,cursor:"interactive"===this.interactivePlacementState||"place"===this.interactivePlacementState?"none":null,regularVerticesSymbol:void 0,activeVertexSymbol:W,activeLineSymbol:D,graphicSymbol:D,automaticAreaMeasurementUtils:await M(),automaticLengthMeasurementUtils:await I()});if(this._drawGraphicTool=r,e.addAndActivateTool(r),this._renderOverlays(),!this._keybindings){const t=new T;t.add(x.complete,()=>this._onDrawComplete()),t.add(x.vertexAdd,()=>this._drawGraphicTool?.drawOperation.commitStagedVertex()),this._keybindings=t}this.addHandles([r.on("cursor-update",t=>this._onCursorUpdate(t)),r.on("complete",()=>this._onDrawComplete()),r.on("vertex-add",e=>this._onVertexAdd(e,t)),this._keybindings.register(e,C.WIDGET)],V)}async _startGridManipulation(t){const{view:e}=this;if(!e)return void(this.interactivePlacementState=null);const i=new CustomEvent("before-placement",{cancelable:!0});this.emit("before-placement",i),i.defaultPrevented||await this.startPlacement(t)}_onCursorUpdate(t){try{if(this._isPlacing){const e=t.vertices[0].coordinates;return void this._handlePlace(e)}if(this._drawGraphicTool.cursor=null,this._isRotating&&this._handleRotate(t.vertices[0].coordinates),this._isScaling){const t=this._drawGraphicTool?.drawOperation.cursorVertex;this._handleScale(t)}}finally{this._renderOverlays()}}_onDrawComplete(){this._drawGraphicTool.cursor=null,this.interactivePlacementState=null}_onVertexAdd(t,e){const i=t.vertices[0].coordinates;this._isPlacing&&this._handlePlace(i),this._isRotating&&this._sketchedVertexCount>0&&this._handleRotate(i),this._isScaling&&this._sketchedVertexCount>0&&this._handleScale(v(i[0],i[1],void 0,this.view.spatialReference)),this._sketchedVertexCount++,this._drawGraphicTool.cursor=null,2!==this._sketchedVertexCount&&"interactive"===e||(this.interactivePlacementState=null),this._renderOverlays()}_handlePlace(t){const{grid:e,view:i}=this;e&&i&&(e.center=new p({x:t[0],y:t[1],spatialReference:i.spatialReference}))}_handleRotate(t){const{grid:e,view:i}=this;if(!e||!i)return;this._drawGraphicTool?.sketchOptions.tooltips.set("enabled",!1);const{x:r,y:o}=e.center,[n,a]=t,l=i.toScreen(e.center,{pickClosestTarget:!0}),c=l&&i.toMap(l),h=i.toScreen(v(n,a,void 0,i.spatialReference),{pickClosestTarget:!0}),p=h&&i.toMap(h),d=c?c.x:r,m=c?c.y:o,g=d-(p?p.x:n),u=m-(p?p.y:a);if(0===g&&0===u)return;const y=Math.atan2(u,g),_=s(y),w=e.rotateWithMap,f=i.viewpoint.rotation??0,S=w?_:_-f;e.rotation=Math.fround(S)%360}_handleScale(t){const{view:e,grid:i,_drawGraphicTool:r,interactivePlacementState:s,_metersPerSRUnit:o}=this;if(!(t&&e&&i&&r&&o))return;r.sketchOptions.tooltips.enabled=!1;const n="interactive"===s?i.center:r.drawOperation.firstVertex;if(!n||!t)return;const a=e?.toScreen(n),c=a&&e.toMap(a),h=e?.toScreen(t),p=c??n,d=(h&&e.toMap(h))??t,m=Math.sqrt((p.x-d.x)**2+(p.y-d.y)**2),g=l(m*o,"meters",i.units);this.spacing=g}_renderOverlays(){this._renderCrosshairOverlay(),this._renderTextOverlay()}_renderTextOverlay(){const{grid:t,view:e,_drawGraphicTool:i}=this,r=this._getCrosshairLabel();if(!(t&&e?.overlay&&i&&r))return;const s=e.toScreen(t.center,{pickClosestTarget:!0});s&&(r.position=[s.x+12,s.y+12]),this._isRotating?(r.text=`${E(t.rotation)}${k}`,r.visible=!0):r.visible=!1}_renderCrosshairOverlay(){const{grid:t,view:e,_drawGraphicTool:i}=this;if(!t||!e?.overlay||!i)return;const r=this._getCrosshair();if(!r)return;const s=e.toScreen(t.center);s&&(r.x=s.x,r.y=s.y,r.rotation=t.rotateWithMap?e.viewpoint.rotation-t.rotation:-t.rotation,r.visible=!!i)}_getCrosshairLabel(){if(this._crosshairLabel)return this._crosshairLabel;const{grid:t,view:i,_drawGraphicTool:r}=this;if(!t||!i?.overlay||!r)return null;const s=new L({anchor:"top-left",fontSize:10,textColor:new e([21,21,21]),backgroundColor:new e([248,248,248]),padding:8,borderRadius:20});return i.overlay.addItem(s),this._crosshairLabel=s,s}_getCrosshair(){const{_crosshairItem:t,view:e}=this;return e?.overlay?t&&e.overlay.items.includes(t)?t:(this._crosshairItem=new R({color:e.effectiveTheme.accentColor,thickness:4,length:36,visible:!0}),e.overlay?.addItem(this._crosshairItem),this._crosshairItem):null}_resetGridPlacementState(){this.removeHandles(V),this._crosshairItem&&(this._crosshairItem.visible=!1),this._crosshairLabel&&(this._crosshairLabel.visible=!1),this._drawGraphicTool&&(this.view?.activeTool===this._drawGraphicTool&&(this.view.activeTool=null),this.view?.tools.remove(this._drawGraphicTool)),this._drawGraphicTool=o(this._drawGraphicTool)}};t([c(y)],A.prototype,"defaultUnit",void 0),t([c({readOnly:!0})],A.prototype,"displayEnabled",null),t([c()],A.prototype,"dynamicScaling",null),t([c()],A.prototype,"grid",null),t([c()],A.prototype,"gridColor",null),t([c({readOnly:!0})],A.prototype,"gridControlsEnabled",null),t([c()],A.prototype,"interactivePlacementState",null),t([c()],A.prototype,"majorLineInterval",null),t([c()],A.prototype,"rotateWithMap",null),t([c()],A.prototype,"rotation",null),t([c()],A.prototype,"snappingEnabled",null),t([c()],A.prototype,"snappingManager",void 0),t([c({type:G})],A.prototype,"snappingOptions",void 0),t([c()],A.prototype,"spacing",null),t([c()],A.prototype,"unit",null),t([c()],A.prototype,"view",void 0),t([c({readOnly:!0})],A.prototype,"gridOutOfScale",null),t([c({readOnly:!0})],A.prototype,"effectiveSpacingAfterDynamicScaling",null),t([c({readOnly:!0})],A.prototype,"numericSpacingInputShouldBeVisible",null),t([c()],A.prototype,"placementDisabled",void 0),t([c()],A.prototype,"_metersPerSRUnit",null),t([c()],A.prototype,"_pixelsPerStride",null),t([c()],A.prototype,"_isPlacing",null),t([c()],A.prototype,"_isRotating",null),t([c()],A.prototype,"_isScaling",null),t([c()],A.prototype,"_mostRecentlyShownGrid",void 0),t([c()],A.prototype,"_sketchedVertexCount",void 0),A=t([h("esri.widgets.support.GridControls.GridControlsViewModel")],A);const D=new _({width:0}),W=new w({color:e.fromArray([0,0,0,0]),outline:new _({color:e.fromArray([0,0,0,0])})});export{A as default};