@arcgis/core 4.33.0-next.20250601 → 4.33.0-next.20250603

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 (87) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0039dee1337160366112.js +1 -0
  3. package/assets/esri/core/workers/chunks/0155e6806621f3588ffa.js +1 -0
  4. package/assets/esri/core/workers/chunks/074498a4d685223ec058.js +1 -0
  5. package/assets/esri/core/workers/chunks/18011c691e0aca4144dd.js +1 -0
  6. package/assets/esri/core/workers/chunks/1f315f0eeb26dad1addd.js +1 -0
  7. package/assets/esri/core/workers/chunks/3b63edcd34f832ac7bd8.js +1 -0
  8. package/assets/esri/core/workers/chunks/464c15b2779f9b803a06.js +1 -0
  9. package/assets/esri/core/workers/chunks/47cbed70c7eeb72e0203.js +1 -0
  10. package/assets/esri/core/workers/chunks/49089731ecfe7e8bb2f6.js +1 -0
  11. package/assets/esri/core/workers/chunks/5e539ce4751bcfa57145.js +1 -0
  12. package/assets/esri/core/workers/chunks/{5222523fff30d07f88de.js → 6a86fee4e945e61d9639.js} +1 -1
  13. package/assets/esri/core/workers/chunks/6d90887dc605261dd7b3.js +1 -0
  14. package/assets/esri/core/workers/chunks/7317346ed8d7c5bb859d.js +1 -0
  15. package/assets/esri/core/workers/chunks/74276044cb75b51967f2.js +1 -0
  16. package/assets/esri/core/workers/chunks/7fa46d1e9fcd8c0c6302.js +1 -0
  17. package/assets/esri/core/workers/chunks/91d484960df25ec9554b.js +1 -0
  18. package/assets/esri/core/workers/chunks/948c5454881e661c3bdc.js +1 -0
  19. package/assets/esri/core/workers/chunks/a693cd3af2e995972252.js +1 -0
  20. package/assets/esri/core/workers/chunks/aaa564c84ee8ea36fbb4.js +1 -0
  21. package/assets/esri/core/workers/chunks/af0d7a7cbbaad47a49c6.js +1 -0
  22. package/assets/esri/core/workers/chunks/af2f2df3c43b49ad1a70.js +1 -0
  23. package/assets/esri/core/workers/chunks/b09539a4b491a90a6bbe.js +1 -0
  24. package/assets/esri/core/workers/chunks/{1db026cc25338dbc208e.js → c6fa79ce324122e08dbb.js} +1 -1
  25. package/assets/esri/core/workers/chunks/c8856370bae65d9eeb2b.js +1 -0
  26. package/assets/esri/core/workers/chunks/{614bc3f05873b37af091.js → cc37bfa72c34bc2ef993.js} +1 -1
  27. package/assets/esri/core/workers/chunks/cfc5e0ec9b0290407383.js +1 -0
  28. package/assets/esri/core/workers/chunks/{06877ea5b9df7de89aff.js → d0372bac0c5f4fbed468.js} +1 -1
  29. package/assets/esri/core/workers/chunks/d28d874c1337b69fedc0.js +1 -0
  30. package/assets/esri/core/workers/chunks/{0fd826e7f64a37aaaa1e.js → d942cb9cf82b1c056979.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{32537e2b014bc3d82f5c.js → dea3e131bbd48cc48e1a.js} +17 -17
  32. package/assets/esri/core/workers/chunks/df84863cb0600f658541.js +1 -0
  33. package/assets/esri/core/workers/chunks/e0ae33206f519b159b49.js +1 -0
  34. package/assets/esri/core/workers/chunks/e7589c39b13295af8f1d.js +1 -0
  35. package/assets/esri/core/workers/chunks/eb23ce385b0d18959c7c.js +1 -0
  36. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  37. package/interfaces.d.ts +28 -41
  38. package/layers/VideoLayer.js +1 -1
  39. package/layers/video/videoUtils.js +1 -1
  40. package/package.json +1 -1
  41. package/support/revision.js +1 -1
  42. package/symbols/cim/animationUtils.js +1 -1
  43. package/symbols/cim/cimAnalyzer.js +1 -1
  44. package/symbols/support/cimSymbolUtils.js +1 -1
  45. package/undoredo/support/Services.js +1 -1
  46. package/views/2d/engine/vectorTiles/decluttering/SymbolDeclutterer.js +1 -1
  47. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedPolyMeshWriters.js +1 -1
  48. package/views/2d/engine/webgl/shaderGraph/techniques/animated/attributes.js +1 -1
  49. package/views/2d/layers/VideoLayerView2D.js +1 -1
  50. package/views/3d/FocusAreasView.js +1 -1
  51. package/views/SelectionManager.js +1 -1
  52. package/widgets/Editor/EditorViewModel.js +1 -1
  53. package/widgets/Editor/support/SketchController.js +1 -1
  54. package/widgets/FeatureForm/VisibleElements.js +1 -1
  55. package/widgets/FeatureForm.js +1 -1
  56. package/widgets/Sketch/SketchViewModel.js +1 -1
  57. package/widgets/VideoPlayer/VideoPlayerViewModel.js +1 -1
  58. package/widgets/VideoPlayer/components/SettingsButton.js +1 -1
  59. package/widgets/VideoPlayer.js +1 -1
  60. package/assets/esri/core/workers/chunks/21de4516bf5c9630edfd.js +0 -1
  61. package/assets/esri/core/workers/chunks/248a198f97871a8d6dd6.js +0 -1
  62. package/assets/esri/core/workers/chunks/2c9a228d8e53d688fe5e.js +0 -1
  63. package/assets/esri/core/workers/chunks/2dbd18df5c691c8d0a61.js +0 -1
  64. package/assets/esri/core/workers/chunks/34f55bb89ddf26b10260.js +0 -1
  65. package/assets/esri/core/workers/chunks/3bec10a4f01757590c1c.js +0 -1
  66. package/assets/esri/core/workers/chunks/53e8c061f36516c3c3e4.js +0 -1
  67. package/assets/esri/core/workers/chunks/5a01bd7a9ee24be7bac4.js +0 -1
  68. package/assets/esri/core/workers/chunks/66e4cb2479bed1384ed5.js +0 -1
  69. package/assets/esri/core/workers/chunks/7174150bf7595c22f976.js +0 -1
  70. package/assets/esri/core/workers/chunks/74d18c22fa1c178bd9df.js +0 -1
  71. package/assets/esri/core/workers/chunks/77dbb1d5d5e1a6ced932.js +0 -1
  72. package/assets/esri/core/workers/chunks/8249b5de5c15461a6787.js +0 -1
  73. package/assets/esri/core/workers/chunks/8385c13ac10e595374cb.js +0 -1
  74. package/assets/esri/core/workers/chunks/85efb318cda7260221ae.js +0 -1
  75. package/assets/esri/core/workers/chunks/8b86c75426c55b29ebed.js +0 -1
  76. package/assets/esri/core/workers/chunks/8c4b26d86483646c70d2.js +0 -1
  77. package/assets/esri/core/workers/chunks/a036503087baa1f9fd00.js +0 -1
  78. package/assets/esri/core/workers/chunks/a61fa2853307830ec577.js +0 -1
  79. package/assets/esri/core/workers/chunks/ba015f4f72714820a12f.js +0 -1
  80. package/assets/esri/core/workers/chunks/c3d95f7f4370486eed2c.js +0 -1
  81. package/assets/esri/core/workers/chunks/c3df693d1bce8f189fa2.js +0 -1
  82. package/assets/esri/core/workers/chunks/cefcecbeef4f0a46f58c.js +0 -1
  83. package/assets/esri/core/workers/chunks/e7bebf0d272cc3922982.js +0 -1
  84. package/assets/esri/core/workers/chunks/f1e87720b425d7fb348a.js +0 -1
  85. package/assets/esri/core/workers/chunks/f2863c501d62dece5fdd.js +0 -1
  86. package/assets/esri/core/workers/chunks/f9e1b73976027e17cd03.js +0 -1
  87. package/assets/esri/core/workers/chunks/fd207a40faf882d3b2a3.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{VectorTile as e}from"../VectorTile.js";import{fadeDuration as t}from"./config.js";import{effectFlag0 as o,filterFlag0 as i}from"../../webgl/definitions.js";function s(e){return(e.uniqueSymbol?.show&&e.uniqueSymbol?.lastShow)??!1}function r(e,t){if(e.priority-t.priority)return e.priority-t.priority;if(s(e)&&!s(t))return-1;if(s(t)&&!s(e))return 1;const o=e.tile.key,i=t.tile.key;return o.world-i.world?o.world-i.world:o.level-i.level?o.level-i.level:o.row-i.row?o.row-i.row:o.col-i.col?o.col-i.col:e.xTile-t.xTile?e.xTile-t.xTile:e.yTile-t.yTile}class n{get running(){return this._running}constructor(e,t,o,i,s,r,n,l){this.selectionMode=e,this._visibleTiles=t,this._symbolRepository=o,this._styleRepository=i,this._createCollisionJob=s,this._assignTileSymbolsOpacity=r,this._symbolLayerSorter=n,this._isLayerVisible=l,this._selectionJob=null,this._selectionJobCompleted=!1,this._collisionJob=null,this._collisionJobCompleted=!1,this._opacityJob=null,this._opacityJobCompleted=!1,this._running=!0}setScreenSize(e,t){this._screenWidth===e&&this._screenHeight===t||this.restart(),this._screenWidth=e,this._screenHeight=t}restart(){this._selectionJob=null,this._selectionJobCompleted=!1,this._collisionJob=null,this._collisionJobCompleted=!1,this._opacityJob=null,this._opacityJobCompleted=!1,this._running=!0}continue(e){if(this._selectionJob||(this._selectionJob=this._createSelectionJob()),!this._selectionJobCompleted){const t=performance.now();if(!this._selectionJob.work(e))return!1;if(this._selectionJobCompleted=!0,0===(e=Math.max(0,e-(performance.now()-t))))return!1}if(this._collisionJob||(this._collisionJob=this._createCollisionJob(this._selectionJob.sortedSymbols,this._screenWidth,this._screenHeight)),!this._collisionJobCompleted){const t=performance.now();if(!this._collisionJob.work(e))return!1;if(this._collisionJobCompleted=!0,0===(e=Math.max(0,e-(performance.now()-t))))return!1}if(this._opacityJob||(this._opacityJob=this._createOpacityJob()),!this._opacityJobCompleted){const t=performance.now();if(!this._opacityJob.work(e))return!1;if(this._opacityJobCompleted=!0,0===(e=Math.max(0,e-(performance.now()-t))))return!1}return this._running=!1,!0}_isFeatureFiltered(e,t,s){const r=t.getFilterFlags(e),n=r&i,l=null==s.featureEffect||s.featureEffect.excludedLabelsVisible||r&o;return!(n&&l)}_getFiltered(){let e;if(this._styleRepository?.layerContexts)for(const t of this._symbolRepository.uniqueSymbols){const o=this._styleRepository.layerContexts?.get(t.styleLayerUID);if(o?.attributeView)for(const i of t.uniqueSymbols){e??=new Set;const t=o.attributeView,s=o.layerView;this._isFeatureFiltered(i.id,t,s)&&e.add(i.id)}}return e}_resetSelection(){for(let e=0;e<this._symbolRepository.uniqueSymbols.length;e++){const t=this._symbolRepository.uniqueSymbols[e];for(let e=0;e<t.uniqueSymbols.length;e++){const o=t.uniqueSymbols[e];for(const e of o.tileSymbols)e.selectedForRendering=!1}}}_createSelectionJob(){const e="feature-tile"===this.selectionMode?c:a,t=this._symbolRepository.uniqueSymbols;this._resetSelection();const o=[];let i=0,s=0;const n=this._isLayerVisible,l=this._getFiltered(),h=this._styleRepository?.layerContexts;function y(c){let a;const y=performance.now();for(;s<t.length;s++,i=0){const r=t[s],u=r.styleLayerUID;let f=0;if(h){const e=h.get(u).layerView;f=e.view.allLayerViews.items.indexOf(e)}if(!n(u)){o[s]||(o[s]={styleLayerUID:u,layerOrder:f,symbols:[]});continue}o[s]||={styleLayerUID:u,symbols:[],layerOrder:f};const b=o[s];for(;i<r.uniqueSymbols.length;i++){if(a=r.uniqueSymbols[i],i%100==99&&performance.now()-y>c)return!1;if(a.lastShow=a.show,a.id&&l?.has(a.id)){a.show=!1,a.parts[0].show=!1,a.parts[1].show=!1;continue}const t=e(a);if(t){t.selectedForRendering=!0,b.symbols.push(t),a.show=!0;for(const e of a.parts)e.show=!0}else a.show=!1}}for(const e of o)e.symbols.sort(r);return o.sort(((e,t)=>t.layerOrder-e.layerOrder)),!0}const u=this._symbolLayerSorter;return{work:y,get sortedSymbols(){return o.sort(u)}}}_createOpacityJob(){const t=this._assignTileSymbolsOpacity,o=this._visibleTiles;let i=0;function s(e,o){for(const t of e.symbols.values())l(t,o);t(e,o);for(const t of e.childrenTiles)s(t,o)}return{work(r){const n=performance.now();for(;i<o.length;i++){if(performance.now()-n>r)return!1;const l=o[i];if(null!=l.parentTile)continue;const c=performance.now();l instanceof e?s(l,c):t(l,c)}return!0}}}}function l(e,o){for(const i of e){const e=i.uniqueSymbol;for(const i of e.parts){const s=i.targetOpacity>.5?1:-1;i.startOpacity+=s*((o-i.startTime)/t),i.startOpacity=Math.min(Math.max(i.startOpacity,0),1),i.startTime=o,i.targetOpacity=e.show&&i.show?1:0}}}function c(e){let t=null,o=null,i=null;for(const s of e.tileSymbols){const e=s.tile;e.isReady&&e.isCoverage?t=s:e.isReady?o=s:e.rendering&&(i=s)}return t??o??i}function a(e){let t=null,o=!1,i=!1;for(const s of e.tileSymbols)if(!i||!o){const e=s.tile;(!t||e.isCoverage||e.neededForCoverage&&!o)&&(t=s,(e.neededForCoverage||e.isCoverage)&&(i=!0),e.isCoverage&&(o=!0))}return i?t:null}export{n as SymbolDeclutterer};
5
+ import{VectorTile as e}from"../VectorTile.js";import{fadeDuration as t}from"./config.js";import{effectFlag0 as o,filterFlag0 as i}from"../../webgl/definitions.js";function s(e){return(e.uniqueSymbol?.show&&e.uniqueSymbol?.lastShow)??!1}function r(e,t){if(e.priority-t.priority)return e.priority-t.priority;if(s(e)&&!s(t))return-1;if(s(t)&&!s(e))return 1;const o=e.tile.key,i=t.tile.key;return o.world-i.world?o.world-i.world:o.level-i.level?o.level-i.level:o.row-i.row?o.row-i.row:o.col-i.col?o.col-i.col:e.xTile-t.xTile?e.xTile-t.xTile:e.yTile-t.yTile}class n{get running(){return this._running}constructor(e,t,o,i,s,r,n,l){this.selectionMode=e,this._visibleTiles=t,this._symbolRepository=o,this._styleRepository=i,this._createCollisionJob=s,this._assignTileSymbolsOpacity=r,this._symbolLayerSorter=n,this._isLayerVisible=l,this._selectionJob=null,this._selectionJobCompleted=!1,this._collisionJob=null,this._collisionJobCompleted=!1,this._opacityJob=null,this._opacityJobCompleted=!1,this._running=!0}setScreenSize(e,t){this._screenWidth===e&&this._screenHeight===t||this.restart(),this._screenWidth=e,this._screenHeight=t}restart(){this._selectionJob=null,this._selectionJobCompleted=!1,this._collisionJob=null,this._collisionJobCompleted=!1,this._opacityJob=null,this._opacityJobCompleted=!1,this._running=!0}continue(e){if(this._selectionJob||(this._selectionJob=this._createSelectionJob()),!this._selectionJobCompleted){const t=performance.now();if(!this._selectionJob.work(e))return!1;if(this._selectionJobCompleted=!0,0===(e=Math.max(0,e-(performance.now()-t))))return!1}if(this._collisionJob||(this._collisionJob=this._createCollisionJob(this._selectionJob.sortedSymbols,this._screenWidth,this._screenHeight)),!this._collisionJobCompleted){const t=performance.now();if(!this._collisionJob.work(e))return!1;if(this._collisionJobCompleted=!0,0===(e=Math.max(0,e-(performance.now()-t))))return!1}if(this._opacityJob||(this._opacityJob=this._createOpacityJob()),!this._opacityJobCompleted){const t=performance.now();if(!this._opacityJob.work(e))return!1;if(this._opacityJobCompleted=!0,0===(e=Math.max(0,e-(performance.now()-t))))return!1}return this._running=!1,!0}_isFeatureFiltered(e,t,s){const r=t.getFilterFlags(e),n=r&i,l=null==s.featureEffect||s.featureEffect.excludedLabelsVisible||r&o;return!(n&&l)}_getFilteredByLayer(){let e;if(this._styleRepository?.layerContexts)for(const t of this._symbolRepository.uniqueSymbols){const o=this._styleRepository.layerContexts?.get(t.styleLayerUID);if(o?.attributeView)for(const i of t.uniqueSymbols){e??=new Map,e.get(t.styleLayerUID)||e.set(t.styleLayerUID,new Set);const s=e.get(t.styleLayerUID),r=o.attributeView,n=o.layerView;this._isFeatureFiltered(i.id,r,n)&&s.add(i.id)}}return e}_resetSelection(){for(let e=0;e<this._symbolRepository.uniqueSymbols.length;e++){const t=this._symbolRepository.uniqueSymbols[e];for(let e=0;e<t.uniqueSymbols.length;e++){const o=t.uniqueSymbols[e];for(const e of o.tileSymbols)e.selectedForRendering=!1}}}_createSelectionJob(){const e="feature-tile"===this.selectionMode?c:a,t=this._symbolRepository.uniqueSymbols;this._resetSelection();const o=[];let i=0,s=0;const n=this._isLayerVisible,l=this._getFilteredByLayer(),y=this._styleRepository?.layerContexts;function h(c){let a;const h=performance.now();for(;s<t.length;s++,i=0){const r=t[s],u=r.styleLayerUID,f=l?.get(u);let b=0;if(y){const e=y.get(u).layerView;b=e.view.allLayerViews.items.indexOf(e)}if(!n(u)){o[s]||(o[s]={styleLayerUID:u,layerOrder:b,symbols:[]});continue}o[s]||={styleLayerUID:u,symbols:[],layerOrder:b};const m=o[s];for(;i<r.uniqueSymbols.length;i++){if(a=r.uniqueSymbols[i],i%100==99&&performance.now()-h>c)return!1;if(a.lastShow=a.show,a.id&&f?.has(a.id)){a.show=!1,a.parts[0].show=!1,a.parts[1].show=!1;continue}const t=e(a);if(t){t.selectedForRendering=!0,m.symbols.push(t),a.show=!0;for(const e of a.parts)e.show=!0}else a.show=!1}}for(const e of o)e.symbols.sort(r);return o.sort(((e,t)=>t.layerOrder-e.layerOrder)),!0}const u=this._symbolLayerSorter;return{work:h,get sortedSymbols(){return o.sort(u)}}}_createOpacityJob(){const t=this._assignTileSymbolsOpacity,o=this._visibleTiles;let i=0;function s(e,o){for(const t of e.symbols.values())l(t,o);t(e,o);for(const t of e.childrenTiles)s(t,o)}return{work(r){const n=performance.now();for(;i<o.length;i++){if(performance.now()-n>r)return!1;const l=o[i];if(null!=l.parentTile)continue;const c=performance.now();l instanceof e?s(l,c):t(l,c)}return!0}}}}function l(e,o){for(const i of e){const e=i.uniqueSymbol;for(const i of e.parts){const s=i.targetOpacity>.5?1:-1;i.startOpacity+=s*((o-i.startTime)/t),i.startOpacity=Math.min(Math.max(i.startOpacity,0),1),i.startTime=o,i.targetOpacity=e.show&&i.show?1:0}}}function c(e){let t=null,o=null,i=null;for(const s of e.tileSymbols){const e=s.tile;e.isReady&&e.isCoverage?t=s:e.isReady?o=s:e.rendering&&(i=s)}return t??o??i}function a(e){let t=null,o=!1,i=!1;for(const s of e.tileSymbols)if(!i||!o){const e=s.tile;(!t||e.isCoverage||e.neededForCoverage&&!o)&&(t=s,(e.neededForCoverage||e.isCoverage)&&(i=!0),e.isCoverage&&(o=!0))}return i?t:null}export{n as SymbolDeclutterer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{LineCapStyle as s,LineJoinStyle as i}from"../../../../../../../symbols/cim/enums.js";import"../../../definitions.js";import{LineTessellation as r}from"../../../TurboLine.js";import{clipLinesMarshall as n,triangulate as o}from"../../../mesh/templates/templateUtils.js";import{AAnimatedMeshWriter as a}from"./AnimatedMeshWriter.js";import{lineLength as h,noTiming as m,zoomRange as l,segmentDirection as u,normal as c,accumulatedDistance as d,sizing as p,animationPointerAndBaseSizeAndReferenceSize as f,tlbr as x,offset as _,pos as g,bitset as P,id as y,noLineLength as v}from"./attributes.js";import{createComputedAnimatedMeshParams as L}from"./ComputedAnimatedParams.js";import{processLineCapInput as W,processLineJoinInput as b}from"../fill/meshWriterUtils.js";import{LineTessellationParams as w}from"../line/LineMeshWriter.js";class j extends a{_write(t,e){const s=e.readGeometryForDisplay();if(!s)return;const i=this.evaluatedMeshParams.sprite,{textureBinding:r}=i;t.recordStart(this.instanceId,this.attributeLayout,r);const n=e.getDisplayId();this._writePoly(t,n,s),t.recordEnd()}}class C extends j{constructor(){super(...arguments),this.vertexSpec={createComputedParams:L,attributes:{id:y,bitset:P,pos:g,offset:_.fill,tlbr:x,animationPointerAndBaseSizeAndReferenceSize:f,sizing:p},optionalAttributes:{zoomRange:l,value1Position2Value2:m,lineLength:v}}}_writePoly(t,e,s){const i=[];if(!o(i,s))return;const r=t.vertexCount();s.forEachVertex(((s,i)=>{this._writeVertex(t,e,s,i)})),t.indexEnsureSize(i.length);for(const n of i)t.indexWrite(r+n)}}class z{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0,this.pathLength=0}}const T=65535;class S extends j{constructor(){super(...arguments),this.vertexSpec={createComputedParams:L,attributes:{id:y,bitset:P,pos:g,offset:_.line,tlbr:x,animationPointerAndBaseSizeAndReferenceSize:f,sizing:p,accumulatedDistance:d,normal:c,segmentDirection:u},optionalAttributes:{zoomRange:l,value1Position2Value2:m,lineLength:h}},this._tessParams=new w,this._currentWrite=new z,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:T,textured:!1},this._lineLength=0,this._lineTessellator=new r(((t,e,s,i,r,n,o,a,h,m,l)=>this._writeTesselatedVertex(t,e,s,i,r,n,o,a,h,m,l,this._lineLength)),this._writeTriangle.bind(this),!1)}_writePoly(r,o,a){const h=64,m=!1,l=n(e.fromOptimized(a,"esriGeometryPolyline"),h);if(null==l)return;const{_currentWrite:u,_tessellationOptions:c}=this,{baseSize:d,capType:p,joinType:f,miterLimit:x}=this.evaluatedMeshParams,_=t(.5*d);c.halfWidth=_,c.capType=W(p||s.Round),c.joinType=b(f||i.Round),c.miterLimit=x||2,u.out=r,u.id=o,u.vertexCount=0,u.indexCount=0,u.vertexFrom=r.vertexCount(),u.vertexBounds=1;for(const{line:t,start:e,pathLength:s}of l){c.initialDistance=e%T,u.pathLength=s,this._lineLength=0;for(let e=1;e<t.length;e++){const s=t[e].x-t[e-1].x,i=t[e].y-t[e-1].y;this._lineLength+=Math.sqrt(s*s+i*i)}this._lineTessellator.tessellate(t,c,m)}}_writeTesselatedVertex(t,e,s,i,r,n,o,a,h,m,l,u){const{out:c,id:d,vertexBounds:p,pathLength:f}=this._currentWrite;return this.hasEffects&&c.recordBounds(t,e,p,p),this._tessParams.extrusionOffsetX=o,this._tessParams.extrusionOffsetY=a,this._tessParams.normalX=h,this._tessParams.normalY=m,this._tessParams.directionX=r,this._tessParams.directionY=n,this._tessParams.distance=l,this._tessParams.pathLength=f,this._tessParams.lineLength=u,this._writeVertex(c,d,t,e,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(t,e,s){const{out:i}=this._currentWrite;i.indexEnsureSize(3),i.indexWrite(t),i.indexWrite(e),i.indexWrite(s),this._currentWrite.indexCount+=3}}export{j as AAnimatedPolyMeshWriter,C as AnimatedFillMeshWriter,S as AnimatedLineMeshWriter};
5
+ import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{LineCapStyle as i,LineJoinStyle as s}from"../../../../../../../symbols/cim/enums.js";import"../../../definitions.js";import{LineTessellation as r}from"../../../TurboLine.js";import{clipLinesMarshall as n,triangulate as o}from"../../../mesh/templates/templateUtils.js";import{AAnimatedMeshWriter as a}from"./AnimatedMeshWriter.js";import{lineLength as h,noTiming as m,zoomRange as l,segmentDirection as u,normal as c,accumulatedDistance as d,sizing as p,animationPointerAndBaseSizeAndReferenceSize as f,tlbr as x,offset as _,pos as g,bitset as P,id as v,noLineLength as L}from"./attributes.js";import{createComputedAnimatedMeshParams as y}from"./ComputedAnimatedParams.js";import{processLineCapInput as W,processLineJoinInput as b}from"../fill/meshWriterUtils.js";import{LineTessellationParams as w}from"../line/LineMeshWriter.js";class C extends a{_write(t,i,s){const r=s??e.fromFeatureSetReaderCIM(i);if(!r)return;const n=this.evaluatedMeshParams.sprite,{textureBinding:o}=n;t.recordStart(this.instanceId,this.attributeLayout,o);const a=i.getDisplayId();this._writePoly(t,a,r.asOptimized()),t.recordEnd()}}class j extends C{constructor(){super(...arguments),this.vertexSpec={createComputedParams:y,attributes:{id:v,bitset:P,pos:g,offset:_.fill,tlbr:x,animationPointerAndBaseSizeAndReferenceSize:f,sizing:p},optionalAttributes:{zoomRange:l,value1Position2Value2:m,lineLength:L}}}_writePoly(t,e,i){const s=[];if(!o(s,i))return;const r=t.vertexCount();i.forEachVertex(((i,s)=>{this._writeVertex(t,e,i,s)})),t.indexEnsureSize(s.length);for(const n of s)t.indexWrite(r+n)}}class z{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0,this.pathLength=0}}const S=65535;class T extends C{constructor(){super(...arguments),this.vertexSpec={createComputedParams:y,attributes:{id:v,bitset:P,pos:g,offset:_.line,tlbr:x,animationPointerAndBaseSizeAndReferenceSize:f,sizing:p,accumulatedDistance:d,normal:c,segmentDirection:u},optionalAttributes:{zoomRange:l,value1Position2Value2:m,lineLength:h}},this._tessParams=new w,this._currentWrite=new z,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:S,textured:!1},this._lineLength=0,this._lineTessellator=new r(((t,e,i,s,r,n,o,a,h,m,l)=>this._writeTesselatedVertex(t,e,i,s,r,n,o,a,h,m,l,this._lineLength)),this._writeTriangle.bind(this),!1)}_writePoly(r,o,a){const h=64,m=!1,l=n(e.fromOptimized(a,"esriGeometryPolyline"),h);if(null==l)return;const{_currentWrite:u,_tessellationOptions:c}=this,{baseSize:d,capType:p,joinType:f,miterLimit:x}=this.evaluatedMeshParams,_=t(.5*d);c.halfWidth=_,c.capType=W(p||i.Round),c.joinType=b(f||s.Round),c.miterLimit=x||2,u.out=r,u.id=o,u.vertexCount=0,u.indexCount=0,u.vertexFrom=r.vertexCount(),u.vertexBounds=1;for(const{line:t,start:e,pathLength:i}of l){c.initialDistance=e%S,u.pathLength=i,this._lineLength=0;for(let e=1;e<t.length;e++){const i=t[e].x-t[e-1].x,s=t[e].y-t[e-1].y;this._lineLength+=Math.sqrt(i*i+s*s)}this._lineTessellator.tessellate(t,c,m)}}_writeTesselatedVertex(t,e,i,s,r,n,o,a,h,m,l,u){const{out:c,id:d,vertexBounds:p,pathLength:f}=this._currentWrite;return this.hasEffects&&c.recordBounds(t,e,p,p),this._tessParams.extrusionOffsetX=o,this._tessParams.extrusionOffsetY=a,this._tessParams.normalX=h,this._tessParams.normalY=m,this._tessParams.directionX=r,this._tessParams.directionY=n,this._tessParams.distance=l,this._tessParams.pathLength=f,this._tessParams.lineLength=u,this._writeVertex(c,d,t,e,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(t,e,i){const{out:s}=this._currentWrite;s.indexEnsureSize(3),s.indexWrite(t),s.indexWrite(e),s.indexWrite(i),this._currentWrite.indexCount+=3}}export{C as AAnimatedPolyMeshWriter,j as AnimatedFillMeshWriter,T as AnimatedLineMeshWriter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{minMaxZoomPrecisionFactor as t,spritePadding as e}from"../../../definitions.js";import{assert as o}from"../../../animations/utils.js";import{packAnimatedBitset as i}from"./AnimatedMeshWriter.js";import{getMinMaxZoom as c}from"../fill/meshWriterUtils.js";import{DataType as n}from"../../../../../../webgl/enums.js";const a={type:n.SHORT,count:2,packPrecisionFactor:t,pack:({scaleInfo:t},{tileInfo:e})=>c(t,e)},s={type:n.FLOAT,count:4,packPrecisionFactor:1,packTessellation:({value1Position2Value2:t})=>(o(t),t)},p={type:n.FLOAT,count:4,packPrecisionFactor:1,packTessellation:()=>[0,0,0,1]},r={type:n.FLOAT,count:1,packPrecisionFactor:1,pack:()=>0},l={type:n.FLOAT,count:1,packPrecisionFactor:1,packTessellation:({lineLength:t})=>t},k={type:n.UNSIGNED_SHORT,count:1,packTessellation:({distance:t})=>t},u={type:n.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:t,directionY:e})=>[t,e]},T={type:n.FLOAT,count:2,packPrecisionFactor:16,packTessellation:({normalX:t,normalY:e})=>[t,e]},m={type:n.UNSIGNED_BYTE,count:3,pack:"id"},y={type:n.UNSIGNED_BYTE,count:1,pack:i},F={type:n.SHORT,count:2,pack:"position",packPrecisionFactor:1},f={marker:{type:n.FLOAT,count:2,packAlternating:{count:4,pack:({texelDimensions:t})=>[[-.5*t[0],-.5*t[1]],[.5*t[0],-.5*t[1]],[-.5*t[0],.5*t[1]],[.5*t[0],.5*t[1]]]}},line:{type:n.FLOAT,count:2,packTessellation:({extrusionOffsetX:t,extrusionOffsetY:e},{baseSize:o})=>[t*o/2,e*o/2]},fill:{type:n.FLOAT,count:2,packTessellation:()=>[0,0]}},O={marker:{type:n.SHORT,count:2,packPrecisionFactor:1,packAlternating:{count:4,packTessellation:({texXmax:t,texXmin:e,texYmax:o,texYmin:i})=>[[e,i],[t,i],[e,o],[t,o]]}}},S={type:n.UNSIGNED_SHORT,count:4,pack:({sprite:t})=>{const{rect:o,width:i,height:c}=t,n=o.x+e,a=o.y+e;return[n+1,a+1,n+i-1,a+c-1]}},d={type:n.UNSIGNED_SHORT,count:4,packPrecisionFactor:1,pack:({animations:t,baseSize:e,referenceSize:o})=>[t.dataColumn,t.dataRow,e,o]},x={type:n.UNSIGNED_SHORT,count:4,packPrecisionFactor:8,pack:({strokeWidth:t,pixelDimensions:e,baseSize:o,sprite:i,sizeRatio:c})=>{const n=Math.max(o*i.width/i.height,o),a=i.sdfDecodeCoeff*n*c;return[e[0],e[1],t,a]}},N={type:n.BYTE,count:1,packTessellation:({angle:t})=>t};export{k as accumulatedDistance,N as angle,d as animationPointerAndBaseSizeAndReferenceSize,y as bitset,m as id,l as lineLength,r as noLineLength,p as noTiming,T as normal,f as offset,F as pos,u as segmentDirection,x as sizing,S as tlbr,O as uv,s as value1Position2Value2,a as zoomRange};
5
+ import{minMaxZoomPrecisionFactor as t,spritePadding as e}from"../../../definitions.js";import{assert as o}from"../../../animations/utils.js";import{packAnimatedBitset as i}from"./AnimatedMeshWriter.js";import{getMinMaxZoom as c}from"../fill/meshWriterUtils.js";import{DataType as n}from"../../../../../../webgl/enums.js";const a={type:n.SHORT,count:2,packPrecisionFactor:t,pack:({scaleInfo:t},{tileInfo:e})=>c(t,e)},s={type:n.FLOAT,count:4,packPrecisionFactor:1,packTessellation:({value1Position2Value2:t})=>(o(t),t)},p={type:n.FLOAT,count:4,packPrecisionFactor:1,packTessellation:()=>[0,0,0,1]},r={type:n.FLOAT,count:1,packPrecisionFactor:1,pack:()=>0},l={type:n.FLOAT,count:1,packPrecisionFactor:1,packTessellation:({lineLength:t})=>t},k={type:n.UNSIGNED_SHORT,count:1,packTessellation:({distance:t})=>t},u={type:n.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:t,directionY:e})=>[t,e]},T={type:n.FLOAT,count:2,packPrecisionFactor:16,packTessellation:({normalX:t,normalY:e})=>[t,e]},m={type:n.UNSIGNED_BYTE,count:3,pack:"id"},y={type:n.UNSIGNED_BYTE,count:1,pack:i},F={type:n.SHORT,count:2,pack:"position",packPrecisionFactor:1},f={marker:{type:n.FLOAT,count:2,packAlternating:{count:4,pack:({texelDimensions:t})=>[[-.5*t[0],-.5*t[1]],[.5*t[0],-.5*t[1]],[-.5*t[0],.5*t[1]],[.5*t[0],.5*t[1]]]}},line:{type:n.FLOAT,count:2,packTessellation:({extrusionOffsetX:t,extrusionOffsetY:e},{baseSize:o})=>[t*o/2,e*o/2]},fill:{type:n.FLOAT,count:2,packTessellation:()=>[0,0]}},O={marker:{type:n.SHORT,count:2,packPrecisionFactor:1,packAlternating:{count:4,packTessellation:({texXmax:t,texXmin:e,texYmax:o,texYmin:i})=>[[e,i],[t,i],[e,o],[t,o]]}}},S={type:n.UNSIGNED_SHORT,count:4,pack:({sprite:t})=>{const{rect:o,width:i,height:c}=t,n=o.x+e,a=o.y+e;return[n+1,a+1,n+i-1,a+c-1]}},d={type:n.UNSIGNED_SHORT,count:4,packPrecisionFactor:4,pack:({animations:t,baseSize:e,referenceSize:o})=>[t.dataColumn,t.dataRow,e,o]},x={type:n.UNSIGNED_SHORT,count:4,packPrecisionFactor:8,pack:({strokeWidth:t,pixelDimensions:e,baseSize:o,sprite:i,sizeRatio:c})=>{const n=Math.max(o*i.width/i.height,o),a=i.sdfDecodeCoeff*n*c;return[e[0],e[1],t,a]}},N={type:n.BYTE,count:1,packTessellation:({angle:t})=>t};export{k as accumulatedDistance,N as angle,d as animationPointerAndBaseSizeAndReferenceSize,y as bitset,m as id,l as lineLength,r as noLineLength,p as noTiming,T as normal,f as offset,F as pos,u as segmentDirection,x as sizing,S as tlbr,O as uv,s as value1Position2Value2,a as zoomRange};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import r from"../../../Graphic.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{watch as s,initial as l}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import n from"../../../layers/GraphicsLayer.js";import m from"../../../layers/support/TelemetryDisplay.js";import y from"../../../symbols/SimpleFillSymbol.js";import h from"../../../symbols/SimpleLineSymbol.js";import p from"../../../symbols/SimpleMarkerSymbol.js";import{applyCIMSymbolRotation as c,applyCIMSymbolColor as b}from"../../../symbols/support/cimSymbolUtils.js";import{symbolTypes as u}from"../../../symbols/support/typeUtils.js";import f from"../engine/webgl/OverlayContainer.js";import d from"../engine/webgl/OverlayMultipoint.js";import{LayerView2DMixin as g}from"./LayerView2D.js";import S from"./graphics/GraphicContainer.js";import _ from"./graphics/GraphicsView2D.js";import C from"../../layers/LayerView.js";const L=new t([255,127,0]),v=10005;let T=class extends(g(C)){constructor(){super(...arguments),this._graphicsLayer=new n,this._frameOutlineGraphic=new r({symbol:new y({outline:{type:"simple-line",color:L}})}),this._frameCenterGraphic=new r({symbol:new p({color:L,style:"cross"})}),this._sensorTrailGraphic=new r({symbol:new h({color:L})}),this._sensorSightlineGraphic=new r({symbol:new h({color:L})}),this._sensorLocationGraphic=new r({symbol:new p({color:L})}),this._overlayContainer=null,this._sensorLocationSymbolType=null,this.layer=null,this.sensorLocationSymbol=null,this.symbolAngle=0,this.visibleTelemetryElements=null}destroy(){this._graphicsLayer=i(this._graphicsLayer)}initialize(){this._sensorLocationSymbolType=this.layer?.sensorSymbol.type,this._graphicsLayer.graphics.addMany([this._frameCenterGraphic,this._frameOutlineGraphic,this._sensorLocationGraphic,this._sensorSightlineGraphic,this._sensorTrailGraphic]),this.visibleTelemetryElements=new m({frame:this.layer.telemetryDisplay?.frame??!1,frameCenter:this.layer.telemetryDisplay?.frameCenter??!0,frameOutline:this.layer.telemetryDisplay?.frameOutline??!0,lineOfSight:this.layer.telemetryDisplay?.lineOfSight??!0,sensorLocation:this.layer.telemetryDisplay?.sensorLocation??!0,sensorTrail:this.layer.telemetryDisplay?.sensorTrail??!0})}attach(){this._overlayContainer=new f,this.container.addChild(this._overlayContainer),this._addOverlayMultipoint(),this.graphicsView=new _({requestUpdateCallback:()=>this.requestUpdate(),view:this.view,graphics:this._graphicsLayer.graphics,container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this.graphicsView.container),this.addAttachHandles(this._graphicsLayer.on("graphic-update",this.graphicsView.graphicUpdateHandler)),this.addAttachHandles([s((()=>[this.layer.telemetryDisplay?.frame,this.layer.telemetryDisplay?.frameCenter,this.layer.telemetryDisplay?.frameOutline,this.layer.telemetryDisplay?.sensorLocation,this.layer.telemetryDisplay?.sensorTrail,this.layer.telemetryDisplay?.lineOfSight]),(()=>this._updateVisibleTelemetryElements()),l),s((()=>[this.layer.telemetry,this.visibleTelemetryElements?.frameCenter,this.visibleTelemetryElements?.frameOutline,this.visibleTelemetryElements?.sensorLocation,this.visibleTelemetryElements?.sensorTrail,this.visibleTelemetryElements?.lineOfSight]),(()=>this._updateGraphicGeometries()),l),s((()=>this.layer.metadata),(()=>this._updateSensorLocationSymbolAngle()),l),s((()=>this.layer?.frameCenterSymbol),(()=>this._updateFrameCenterSymbol()),l),s((()=>this.layer?.frameOutlineSymbol),(()=>this._updateFrameOutlineSymbol()),l),s((()=>this.layer?.sensorSightLineSymbol),(()=>this._updateSensorSightlineSymbol()),l),s((()=>this.layer?.sensorSymbol),(()=>this._updateSensorLocationSymbol()),l),s((()=>this.layer?.sensorTrailSymbol),(()=>this._updateSensorTrailSymbol()),l),s((()=>this.layer?.telemetryColor),(()=>this._updateTelemetryColor()),l)])}detach(){this._overlayContainer.removeAllChildren(),this.container.removeAllChildren(),this.graphicsView=i(this.graphicsView)}supportsSpatialReference(e){return!0}moveEnd(){}viewChange(){this.graphicsView.viewChange()}update(e){this.graphicsView.processUpdate(e)}isUpdating(){return!this.graphicsView||this.graphicsView.updating}_updateVisibleTelemetryElements(){this.visibleTelemetryElements&&this.layer.telemetryDisplay&&(this.visibleTelemetryElements.frame=this.layer.telemetryDisplay.frame,this.visibleTelemetryElements.frameCenter=this.layer.telemetryDisplay.frameCenter,this.visibleTelemetryElements.frameOutline=this.layer.telemetryDisplay.frameOutline,this.visibleTelemetryElements.lineOfSight=this.layer.telemetryDisplay.lineOfSight,this.visibleTelemetryElements.sensorLocation=this.layer.telemetryDisplay.sensorLocation,this.visibleTelemetryElements.sensorTrail=this.layer.telemetryDisplay.sensorTrail)}_updateGraphicGeometries(){const{telemetry:e}=this.layer,{visibleTelemetryElements:t}=this;e&&t&&(t.frameOutline&&e.frameOutline?this._frameOutlineGraphic.geometry=this.layer.telemetry.frameOutline:this._frameOutlineGraphic.geometry=null,t.sensorTrail&&e.sensorTrail?this._sensorTrailGraphic.geometry=this.layer.telemetry.sensorTrail:this._sensorTrailGraphic.geometry=null,t.lineOfSight&&e.lineOfSight?this._sensorSightlineGraphic.geometry=this.layer.telemetry.lineOfSight:this._sensorSightlineGraphic.geometry=null,t.sensorLocation&&e.sensorLocation?this._sensorLocationGraphic.geometry=this.layer.telemetry.sensorLocation:this._sensorLocationGraphic.geometry=null,t.frameCenter&&e.frameCenter?this._frameCenterGraphic.geometry=this.layer.telemetry.frameCenter:this._frameCenterGraphic.geometry=null)}_updateSensorLocationSymbolAngle(){if(!this.layer?.metadata?.size||!this._sensorLocationGraphic.symbol)return;const e=this.layer?.metadata?.get(v);if(!e?.value||"number"!=typeof e?.value)return;this.symbolAngle=Math.round(e?.value);const t=this._sensorLocationGraphic.symbol.clone();"simple-marker"===t.type||"picture-marker"===t.type?t.angle=this.symbolAngle:"cim"===t.type&&c(t,this.symbolAngle,!0),this._sensorLocationGraphic.symbol=t}_updateSensorLocationSymbolColor(){if(!this._sensorLocationGraphic?.symbol)return;const e=this._sensorLocationGraphic.symbol.clone();"simple-marker"===e.type?(e.color=this.layer?.telemetryColor||L,e.outline.color=this.layer.telemetryColor):"picture-marker"===e.type?e.color=this.layer?.telemetryColor||L:"cim"===e.type&&(e.color=this.layer?.telemetryColor||L,e?.color&&b(e,e.color||L)),this._sensorLocationGraphic.symbol=e.clone()}_updateTelemetryColor(){this._frameOutlineGraphic.symbol.outline.color=this.layer?.telemetryColor||L,this._sensorTrailGraphic.symbol.color=this.layer?.telemetryColor||L,this._sensorSightlineGraphic.symbol.color=this.layer?.telemetryColor||L,this._frameCenterGraphic.symbol.color=this.layer?.telemetryColor||L,this._updateSensorLocationSymbolColor()}_updateSensorLocationSymbol(){switch(this._sensorLocationSymbolType){case"simple-marker":case"picture-marker":case"cim":this.sensorLocationSymbol=this.layer.sensorSymbol,this._sensorLocationGraphic.symbol=this.sensorLocationSymbol}}_updateFrameCenterSymbol(){this.layer?.frameCenterSymbol&&(this._frameCenterGraphic.symbol=this.layer.frameCenterSymbol.clone())}_updateFrameOutlineSymbol(){this.layer?.frameOutlineSymbol&&(this._frameOutlineGraphic.symbol=this.layer.frameOutlineSymbol.clone())}_updateSensorSightlineSymbol(){this.layer?.sensorSightLineSymbol&&(this._sensorSightlineGraphic.symbol=this.layer.sensorSightLineSymbol.clone())}_updateSensorTrailSymbol(){this.layer?.sensorTrailSymbol&&(this._sensorTrailGraphic.symbol=this.layer.sensorTrailSymbol.clone())}async _addOverlayMultipoint(){if(!this.layer.videoElement)return;const e=new d(this.layer.videoElement);this.addAttachHandles([s((()=>[this.layer.frameHorizonPoints,this.layer.groundControlPoints,this.layer.frameOpacity,this.layer.telemetryDisplay?.frame]),(()=>{const{visibleTelemetryElements:t}=this;e.frameHorizonPoints=this.layer.frameHorizonPoints,e.groundControlPoints=this.layer.groundControlPoints,e.opacity=this.layer.frameOpacity,e.visible=t?.frame??!1}),l)]),this._overlayContainer.addChild(e),this.view.stage.requestRender()}};e([o()],T.prototype,"graphicsView",void 0),e([o()],T.prototype,"layer",void 0),e([o({types:u})],T.prototype,"sensorLocationSymbol",void 0),e([o()],T.prototype,"symbolAngle",void 0),e([o({type:m})],T.prototype,"visibleTelemetryElements",void 0),T=e([a("esri.views.2d.layers.VideoLayerView2D")],T);const G=T;export{G as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,initial as l}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import n from"../../../layers/GraphicsLayer.js";import m from"../../../layers/support/TelemetryDisplay.js";import y from"../../../symbols/SimpleFillSymbol.js";import h from"../../../symbols/SimpleLineSymbol.js";import p from"../../../symbols/SimpleMarkerSymbol.js";import{applyCIMSymbolRotation as c}from"../../../symbols/support/cimSymbolUtils.js";import{symbolTypes as b}from"../../../symbols/support/typeUtils.js";import S from"../engine/webgl/OverlayContainer.js";import f from"../engine/webgl/OverlayMultipoint.js";import{LayerView2DMixin as u}from"./LayerView2D.js";import g from"./graphics/GraphicContainer.js";import d from"./graphics/GraphicsView2D.js";import _ from"../../layers/LayerView.js";const L=new t([255,127,0]),v=10005;let T=class extends(u(_)){constructor(){super(...arguments),this._graphicsLayer=new n,this._frameOutlineGraphic=new i({symbol:new y({outline:{type:"simple-line",color:L}})}),this._frameCenterGraphic=new i({symbol:new p({color:L,style:"cross"})}),this._sensorTrailGraphic=new i({symbol:new h({color:L})}),this._sensorSightlineGraphic=new i({symbol:new h({color:L})}),this._sensorLocationGraphic=new i({symbol:new p({color:L})}),this._overlayContainer=null,this._sensorLocationSymbolType=null,this.layer=null,this.sensorLocationSymbol=null,this.symbolAngle=0,this.visibleTelemetryElements=null}destroy(){this._graphicsLayer=s(this._graphicsLayer)}initialize(){this._sensorLocationSymbolType=this.layer?.sensorSymbol.type,this._graphicsLayer.graphics.addMany([this._frameCenterGraphic,this._frameOutlineGraphic,this._sensorLocationGraphic,this._sensorSightlineGraphic,this._sensorTrailGraphic]),this.visibleTelemetryElements=new m({frame:this.layer.telemetryDisplay?.frame??!1,frameCenter:this.layer.telemetryDisplay?.frameCenter??!0,frameOutline:this.layer.telemetryDisplay?.frameOutline??!0,lineOfSight:this.layer.telemetryDisplay?.lineOfSight??!0,sensorLocation:this.layer.telemetryDisplay?.sensorLocation??!0,sensorTrail:this.layer.telemetryDisplay?.sensorTrail??!0})}attach(){this._overlayContainer=new S,this.container.addChild(this._overlayContainer),this._addOverlayMultipoint(),this.graphicsView=new d({requestUpdateCallback:()=>this.requestUpdate(),view:this.view,graphics:this._graphicsLayer.graphics,container:new g(this.view.featuresTilingScheme)}),this.container.addChild(this.graphicsView.container),this.addAttachHandles(this._graphicsLayer.on("graphic-update",this.graphicsView.graphicUpdateHandler)),this.addAttachHandles([r((()=>[this.layer.telemetryDisplay?.frame,this.layer.telemetryDisplay?.frameCenter,this.layer.telemetryDisplay?.frameOutline,this.layer.telemetryDisplay?.sensorLocation,this.layer.telemetryDisplay?.sensorTrail,this.layer.telemetryDisplay?.lineOfSight]),(()=>this._updateVisibleTelemetryElements()),l),r((()=>[this.layer.telemetry,this.visibleTelemetryElements?.frameCenter,this.visibleTelemetryElements?.frameOutline,this.visibleTelemetryElements?.sensorLocation,this.visibleTelemetryElements?.sensorTrail,this.visibleTelemetryElements?.lineOfSight]),(()=>this._updateGraphicGeometries()),l),r((()=>this.layer.metadata),(()=>this._updateSensorLocationSymbolAngle()),l),r((()=>this.layer?.frameCenterSymbol),(()=>this._updateFrameCenterSymbol()),l),r((()=>this.layer?.frameOutlineSymbol),(()=>this._updateFrameOutlineSymbol()),l),r((()=>this.layer?.sensorSightLineSymbol),(()=>this._updateSensorSightlineSymbol()),l),r((()=>this.layer?.sensorSymbol),(()=>this._updateSensorLocationSymbol()),l),r((()=>this.layer?.sensorTrailSymbol),(()=>this._updateSensorTrailSymbol()),l),r((()=>this.symbolAngle),(()=>this._updateSensorLocationSymbol()),l)])}detach(){this._overlayContainer.removeAllChildren(),this.container.removeAllChildren(),this.graphicsView=s(this.graphicsView)}supportsSpatialReference(e){return!0}moveEnd(){}viewChange(){this.graphicsView.viewChange()}update(e){this.graphicsView.processUpdate(e)}isUpdating(){return!this.graphicsView||this.graphicsView.updating}_updateVisibleTelemetryElements(){this.visibleTelemetryElements&&this.layer.telemetryDisplay&&(this.visibleTelemetryElements.frame=this.layer.telemetryDisplay.frame,this.visibleTelemetryElements.frameCenter=this.layer.telemetryDisplay.frameCenter,this.visibleTelemetryElements.frameOutline=this.layer.telemetryDisplay.frameOutline,this.visibleTelemetryElements.lineOfSight=this.layer.telemetryDisplay.lineOfSight,this.visibleTelemetryElements.sensorLocation=this.layer.telemetryDisplay.sensorLocation,this.visibleTelemetryElements.sensorTrail=this.layer.telemetryDisplay.sensorTrail)}_updateGraphicGeometries(){const{telemetry:e}=this.layer,{visibleTelemetryElements:t}=this;e&&t&&(t.frameOutline&&e.frameOutline?this._frameOutlineGraphic.geometry=this.layer.telemetry.frameOutline:this._frameOutlineGraphic.geometry=null,t.sensorTrail&&e.sensorTrail?this._sensorTrailGraphic.geometry=this.layer.telemetry.sensorTrail:this._sensorTrailGraphic.geometry=null,t.lineOfSight&&e.lineOfSight?this._sensorSightlineGraphic.geometry=this.layer.telemetry.lineOfSight:this._sensorSightlineGraphic.geometry=null,t.sensorLocation&&e.sensorLocation?this._sensorLocationGraphic.geometry=this.layer.telemetry.sensorLocation:this._sensorLocationGraphic.geometry=null,t.frameCenter&&e.frameCenter?this._frameCenterGraphic.geometry=this.layer.telemetry.frameCenter:this._frameCenterGraphic.geometry=null)}_updateSensorLocationSymbolAngle(){if(!this.layer?.metadata?.size)return;const e=this.layer?.metadata?.get(v);e?.value&&"number"==typeof e?.value&&(this.symbolAngle=Math.round(e?.value))}_updateSensorLocationSymbol(){switch(this._sensorLocationSymbolType){case"simple-marker":this.sensorLocationSymbol=this.layer.sensorSymbol.clone(),this.sensorLocationSymbol.angle=this.symbolAngle,this._sensorLocationGraphic.symbol=this.sensorLocationSymbol.clone();break;case"picture-marker":this.sensorLocationSymbol=this.layer.sensorSymbol,this.sensorLocationSymbol.angle=this.symbolAngle,this._sensorLocationGraphic.symbol=this.sensorLocationSymbol;break;case"cim":this.sensorLocationSymbol=this.layer.sensorSymbol,c(this.sensorLocationSymbol,this.symbolAngle,!0),this._sensorLocationGraphic.symbol=this.sensorLocationSymbol}}_updateFrameCenterSymbol(){this.layer?.frameCenterSymbol&&(this._frameCenterGraphic.symbol=this.layer.frameCenterSymbol.clone())}_updateFrameOutlineSymbol(){this.layer?.frameOutlineSymbol&&(this._frameOutlineGraphic.symbol=this.layer.frameOutlineSymbol.clone())}_updateSensorSightlineSymbol(){this.layer?.sensorSightLineSymbol&&(this._sensorSightlineGraphic.symbol=this.layer.sensorSightLineSymbol.clone())}_updateSensorTrailSymbol(){this.layer?.sensorTrailSymbol&&(this._sensorTrailGraphic.symbol=this.layer.sensorTrailSymbol.clone())}async _addOverlayMultipoint(){if(!this.layer.videoElement)return;const e=new f(this.layer.videoElement);this.addAttachHandles([r((()=>[this.layer.frameHorizonPoints,this.layer.groundControlPoints,this.layer.frameOpacity,this.layer.telemetryDisplay?.frame]),(()=>{const{visibleTelemetryElements:t}=this;e.frameHorizonPoints=this.layer.frameHorizonPoints,e.groundControlPoints=this.layer.groundControlPoints,e.opacity=this.layer.frameOpacity,e.visible=t?.frame??!1}),l)]),this._overlayContainer.addChild(e),this.view.stage.requestRender()}};e([o()],T.prototype,"graphicsView",void 0),e([o()],T.prototype,"layer",void 0),e([o({types:b})],T.prototype,"sensorLocationSymbol",void 0),e([o()],T.prototype,"symbolAngle",void 0),e([o({type:m})],T.prototype,"visibleTelemetryElements",void 0),T=e([a("esri.views.2d.layers.VideoLayerView2D")],T);const w=T;export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import o from"../../core/Accessor.js";import{equals as r}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import{mapCollection as t}from"../../core/mapCollectionUtils.js";import{destroyMaybe as i}from"../../core/maybe.js";import{watch as n,syncAndInitial as a}from"../../core/reactiveUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{e as c}from"../../chunks/earcut.js";import{create as p}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as u}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../geometry/ellipsoidUtils.js";import f from"../../geometry/Point.js";import{e as h}from"../../chunks/densifyOperator.js";import{computeTranslationToOriginAndRotation as g}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as y}from"../../geometry/support/DoubleArray.js";import{earth as w}from"../../geometry/support/Ellipsoid.js";import{newIndexArray as v}from"../../geometry/support/Indices.js";import{t as j}from"../../chunks/vec3.js";import{ViewingMode as _}from"../ViewingMode.js";import{ElevationContext as A}from"./layers/graphics/ElevationContext.js";import{extrudePolygon as b}from"./layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{computeCentroid as R}from"./layers/graphics/graphicUtils.js";import{geometryToRenderInfo as C}from"./support/renderInfoUtils/polygon.js";import{FocusAreaColorNode as x}from"./webgl-engine/effects/focusArea/FocusAreaColorNode.js";import{FocusAreaGeometry as N,FocusAreaMaskNode as k}from"./webgl-engine/effects/focusArea/FocusAreaMaskNode.js";import{FocusAreaOutlineItem as H}from"./webgl-engine/effects/focusArea/FocusAreaOutlineItem.js";const M=-2e4,U=65e5;let V=class extends o{constructor(e){super(e),this._volumes=new Map,this._elevationContext=new A,this._outlineMap=new s}initialize(){this.addHandles([n((()=>this.polygons),(e=>this._updateVolumes(e)),a)]),this._outlineMap=t((()=>this.areas?.areas),(e=>new H({area:e,view:this.view})),{recycleItems:!0})}destroy(){this.removeAllHandles(),this._outlineMap.destroy()}get areas(){return this.view.map?.focusAreas}get enabledAreas(){return this.areas?.areas.toArray().filter((({enabled:e})=>e))??[]}get style(){return this.areas?.style??"bright"}get polygons(){return this.enabledAreas.reduce(((e,o)=>e.concat(o.geometries.toArray())),new Array)}containsGeometry(e){if(0===this.polygons.length)return!0;const o=new f(e);return this.polygons.some((e=>e.contains(o)))}_updateVolumes(e){this._extrude(e),this._ensureRenderNodes()}_extrude(e){if(!this.view.renderCoordsHelper||r(Array.from(this._volumes.keys()),e))return;const o=U-M,s=u(),t=this.view.renderCoordsHelper.viewingMode===_.Global,i=p(),n=p();t||this.view.renderCoordsHelper.worldUpAtPosition([0,0,0],s);const a=new Map;for(const r of e){const e=this._volumes.get(r);if(e){a.set(r,e);continue}const l=R(r);if(null==l)continue;const m=h(r,d(this.view.spatialReference).radius/w.radius*5e5,{unit:"meters"});g(m.spatialReference,[l.x,l.y,0],i,this.view.renderCoordsHelper.spatialReference);const p=this.view.renderCoordsHelper.worldUpAtPosition([i[12],i[13],i[14]],P);n[12]=-i[12],n[13]=-i[13],n[14]=-i[14];const u=C(m,this.view.elevationProvider,this.view.renderCoordsHelper,this._elevationContext),{polygons:f,mapPositions:_,position:A}=u,x=new Array;for(const r of f){const e=r.count,a=c(r.mapPositions,r.holeIndices,3);if(0===a.length)continue;const l=a.length,m=6*e,u=m+l,d=y(3*m),f=v(u),h=v(l);b(A,_,a,r,d,null,null,null,f,h,o,s,t),j(d,d,n);const g=new N(d,h,f,o,[i[12]+M*p[0],i[13]+M*p[1],i[14]+M*p[2]]);x.push(g)}a.set(r,x)}this._volumes=a,this._maskRenderNode?.updateGeometries()}_ensureRenderNodes(){this.view.stage&&(0===this.volumes.size?(this._maskRenderNode=i(this._maskRenderNode),this._colorRenderNode=i(this._colorRenderNode)):(this._maskRenderNode??=new k({focusAreasView:this}),this._colorRenderNode??=new x({focusAreasView:this}),this.view.stage.renderView.requestRender()))}get volumes(){return this._volumes}};e([l()],V.prototype,"_volumes",void 0),e([l({constructOnly:!0})],V.prototype,"view",void 0),V=e([m("esri.views.3d.FocusAreasView")],V);const P=u();export{V as FocusAreasView};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import o from"../../core/Accessor.js";import{equals as r}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import{mapCollection as t}from"../../core/mapCollectionUtils.js";import{destroyMaybe as i}from"../../core/maybe.js";import{watch as n,syncAndInitial as a}from"../../core/reactiveUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{e as c}from"../../chunks/earcut.js";import{create as p}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as u}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../geometry/ellipsoidUtils.js";import h from"../../geometry/Point.js";import{e as f}from"../../chunks/densifyOperator.js";import{computeTranslationToOriginAndRotation as g}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as y}from"../../geometry/support/DoubleArray.js";import{earth as w}from"../../geometry/support/Ellipsoid.js";import{newIndexArray as v}from"../../geometry/support/Indices.js";import{t as j}from"../../chunks/vec3.js";import{ViewingMode as _}from"../ViewingMode.js";import{ElevationContext as A}from"./layers/graphics/ElevationContext.js";import{extrudePolygon as b}from"./layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{computeCentroid as R}from"./layers/graphics/graphicUtils.js";import{geometryToRenderInfo as C}from"./support/renderInfoUtils/polygon.js";import{FocusAreaColorNode as x}from"./webgl-engine/effects/focusArea/FocusAreaColorNode.js";import{FocusAreaGeometry as N,FocusAreaMaskNode as k}from"./webgl-engine/effects/focusArea/FocusAreaMaskNode.js";import{FocusAreaOutlineItem as M}from"./webgl-engine/effects/focusArea/FocusAreaOutlineItem.js";const H=1e7;let U=class extends o{constructor(e){super(e),this._volumes=new Map,this._elevationContext=new A,this._outlineMap=new s}initialize(){this.addHandles([n((()=>this.polygons),(e=>this._updateVolumes(e)),a)]),this._outlineMap=t((()=>this.areas?.areas),(e=>new M({area:e,view:this.view})),{recycleItems:!0})}destroy(){this.removeAllHandles(),this._outlineMap.destroy()}get areas(){return this.view.map?.focusAreas}get enabledAreas(){return this.areas?.areas.toArray().filter((({enabled:e})=>e))??[]}get style(){return this.areas?.style??"bright"}get polygons(){return this.enabledAreas.reduce(((e,o)=>e.concat(o.geometries.toArray())),new Array)}containsGeometry(e){if(0===this.polygons.length)return!0;const o=new h(e);return this.polygons.some((e=>e.contains(o)))}_updateVolumes(e){this._extrude(e),this._ensureRenderNodes()}_extrude(e){if(!this.view.renderCoordsHelper||r(Array.from(this._volumes.keys()),e))return;const o=H/this.view.renderCoordsHelper.unitInMeters,s=u(),t=this.view.renderCoordsHelper.viewingMode===_.Global,i=p(),n=p();t||this.view.renderCoordsHelper.worldUpAtPosition([0,0,0],s);const a=new Map;for(const r of e){const e=this._volumes.get(r);if(e){a.set(r,e);continue}const l=R(r);if(null==l)continue;const m=f(r,d(this.view.spatialReference).radius/w.radius*5e5,{unit:"meters"});g(m.spatialReference,[l.x,l.y,0],i,this.view.renderCoordsHelper.spatialReference),n[12]=-i[12],n[13]=-i[13],n[14]=-i[14];const p=C(m,this.view.elevationProvider,this.view.renderCoordsHelper,this._elevationContext),{polygons:u,mapPositions:h,position:_}=p,A=new Array;for(const r of u){const e=r.count,a=c(r.mapPositions,r.holeIndices,3);if(0===a.length)continue;const l=a.length,m=6*e,p=m+l,u=y(3*m),d=v(p),f=v(l);b(_,h,a,r,u,null,null,null,d,f,o,s,t),j(u,u,n);const g=new N(u,f,d,o,[i[12],i[13],i[14]]);A.push(g);const w=y(3*m),R=v(p),C=v(l);b(_,h,a,r,w,null,null,null,R,C,-o/4,s,t),j(w,w,n);const x=new N(w,C,R,-o,[i[12],i[13],i[14]]);A.push(x)}a.set(r,A)}this._volumes=a,this._maskRenderNode?.updateGeometries()}_ensureRenderNodes(){this.view.stage&&(0===this.volumes.size?(this._maskRenderNode=i(this._maskRenderNode),this._colorRenderNode=i(this._colorRenderNode)):(this._maskRenderNode??=new k({focusAreasView:this}),this._colorRenderNode??=new x({focusAreasView:this}),this.view.stage.renderView.requestRender()))}get volumes(){return this._volumes}};e([l()],U.prototype,"_volumes",void 0),e([l({constructOnly:!0})],U.prototype,"view",void 0),U=e([m("esri.views.3d.FocusAreasView")],U);export{U as FocusAreasView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{difference as t}from"../core/arrayUtils.js";import s from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import i from"../core/Evented.js";import n from"../core/Logger.js";import{getOrCreateMapValue as r}from"../core/MapUtils.js";import{removeMaybe as l}from"../core/maybe.js";import c from"../core/ReactiveMap.js";import{watch as a,on as h,initial as u}from"../core/reactiveUtils.js";import{symmetricDifference as d}from"../core/SetUtils.js";import{property as f}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeSublayer as g,isSubtypeGroupLayer as y,isKnowledgeGraphLayer as m,isMapImageLayer as _}from"../layers/support/layerUtils.js";import v from"../rest/support/Query.js";import{isSelectableLayer as w}from"./support/selectionUtils.js";let S=class extends i.EventedAccessor{constructor(e){super(e),this._selectionMap=new c,this._sources=new s,this._trashCan=[],this._layerEditHandles=new s,this._vizTaskId=0,this.view=null,this.showHighlight=!0,this.highlightName="default"}initialize(){this.addHandles([a((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),a((()=>this.view),(e=>{e?.when().then((()=>this.syncSources()))}),u),h((()=>this.sources),"change",(e=>{const t=this._selectionMap;for(const s of e.removed)t.delete(s);this._refreshListeners(),this._refreshVisualization()}),{onListenerAdd:()=>this._refreshListeners()})])}destroy(){this._layerEditHandles.drain(l)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._sources}set sources(e){o(e,this._sources)}syncSources(){const e=new Set,t=this.view?.map;if(!t)return;const s=t=>{m(t)?(t.layers?.forEach(s),t.tables?.forEach(s)):_(t)?(t.sublayers?.forEach(s),t.subtables?.forEach(s)):y(t)?t.sublayers?.forEach(s):w(t)&&e.add(t)};t.allLayers.forEach(s),t.allTables.forEach(s),this.sources=[...e]}async getSelectedFeatures(e,t={},s="layerView"){const{view:o,selections:i}=this;if(!o&&"layerView"===s)return n.getLogger(this).warn("Cannot query layer views without a view."),[];const r=e?.length?i.filter((t=>e.includes(t.layer))):i,l=[];return r.forEach((async e=>{const{layer:i,selection:n}=e;if(!n.length)return;const r=g(i)?i.parent:i;if(null==r)return;if("layer"===s)return void l.push(F(r,n,t));if(b(r)||!o||!E(r))return;const c=await o.whenLayerView(r).catch((()=>null));c&&l.push(F(c,n,t))})),(await Promise.all(l)).filter((e=>null!=e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let o=!1;const i=e.current.concat(e.added);for(const t of i){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(w(e)||g(e))&&null!==i){const t=r(s,e,(()=>[]));t.includes(i)||(t.push(i),o=!0)}}for(const t of e.removed){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(w(e)||g(e))&&null!==i){const t=s.get(e),n=t?.indexOf(i);void 0!==n&&n>=0&&(t?.splice(n,1),o=!0)}}if(o){const{_selectionMap:e,_trashCan:o}=this,i=[];for(const[n,r]of s){const s=e.get(n);void 0!==s&&o.push(s),e.set(n,{selection:r}),i.push({layer:n,selection:r,...t(void 0!==s?s.selection:[],r)})}this._onSelectionChange(i)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),o=void 0!==s?[...s.selection]:[];for(const i of t)o.includes(i)||o.push(i);this._setSelection(e,o)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const o=[];for(const i of s.selection)t.includes(i)||o.push(i);this._setSelection(e,o)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const o=new Set(s.selection),i=new Set(t),n=d(o,i);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,o]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...o.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){if(null==this.view||null==this.sources)return;for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{sources:e,view:t,_selectionMap:s,showHighlight:o}=this,i=this._vizTaskId;for(const n of e){const e=s.get(n),r=g(n)?n.parent:n;if(null!=r&&E(r)){if(b(r))continue;t.whenLayerView(r).then((t=>{e?.highlightHandle?.remove(),null!=e&&o&&i===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,this.highlightName))})).catch((()=>{e?.highlightHandle?.remove()}))}}}_refreshListeners(){this._layerEditHandles.drain(l);const e=new Set(this.sources.map((e=>g(e)?e.parent:e)));for(const t of e)w(t)&&"on"in t&&t.on&&this._layerEditHandles.push(t.on("edits",(e=>this._onLayerEdit(e,t))))}_onLayerEdit(e,t){if(y(t))this._onParentLayerEdit(e,t);else if(e.deletedFeatures.length&&this._selectionMap.has(t)){const s=[];e.deletedFeatures.forEach((({error:e,objectId:t})=>{null!=t&&null==e&&s.push(t)})),this.removeFromSelection(t,s)}}_onParentLayerEdit(e,t){const{deletedFeatures:s,edits:o,updatedFeatures:i}=e;if(o?.updateFeatures?.forEach((e=>{const s=e.getObjectId()??e.attributes[t.objectIdField];if(null==s)return;if(i.find((e=>e.objectId===s))?.error)return;const o=t.findSublayerForFeature(e);if(!w(o))return;const n=t.sublayers.find((e=>!(!w(e)||!this.getSelection(e)?.includes(s))));w(n)&&n!==o&&(this.removeFromSelection(n,[s]),this.appendToSelection(o,[s]))})),s.length){const e=[];s.forEach((({error:t,objectId:s})=>{null!=s&&null==t&&e.push(s)})),t.sublayers.forEach((t=>{w(t)&&this._selectionMap.has(t)&&this.removeFromSelection(t,e)}))}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const o=this._selectionMap.get(e);if(void 0===o||!M(o,{selection:s})){void 0!==o&&this._trashCan.push(o),this._selectionMap.set(e,{selection:[...s]});const i={layer:e,selection:[...s],...t(void 0!==o?o.selection:[],s)};this._onSelectionChange([i])}}};e([f({readOnly:!0,nonNullable:!0})],S.prototype,"selections",null),e([f({readOnly:!0,nonNullable:!0})],S.prototype,"count",null),e([f()],S.prototype,"view",void 0),e([f({readOnly:!0,nonNullable:!0})],S.prototype,"hasSelection",null),e([f()],S.prototype,"showHighlight",void 0),e([f()],S.prototype,"sources",null),e([f()],S.prototype,"highlightName",void 0),S=e([p("esri.views.SelectionManager")],S);const b=e=>g(e)?!0===e.parent?.isTable:e.isTable,j=e=>void 0!==e.layer,E=e=>void 0!==e?.when,M=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],o=[...t.selection];if(s.length!==o.length)return!1;s.sort(),o.sort();for(let e=0;e<s.length;e++)if(s[e]!==o[e])return!1}return!0},F=async(e,t,s={})=>{let o;if(j(e)){const i=e;o=void 0===i?null:await i.queryFeatures(new v({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const i=e;o=void 0===i?null:await i.queryFeatures(new v({...s,objectIds:t})).then((e=>({data:e,layer:i})))}return o},L=S;export{L as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{difference as t}from"../core/arrayUtils.js";import s from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import i from"../core/Evented.js";import n from"../core/Logger.js";import{getOrCreateMapValue as r}from"../core/MapUtils.js";import{removeMaybe as l}from"../core/maybe.js";import c from"../core/ReactiveMap.js";import{watch as a,on as h,initial as u}from"../core/reactiveUtils.js";import{symmetricDifference as d}from"../core/SetUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeSublayer as g,isSubtypeGroupLayer as y,isKnowledgeGraphLayer as m,isMapImageLayer as _}from"../layers/support/layerUtils.js";import v from"../rest/support/Query.js";import{isSelectableLayer as w}from"./support/selectionUtils.js";let S=class extends i.EventedAccessor{constructor(e){super(e),this._selectionMap=new c,this._sources=new s,this._trashCan=[],this._layerEditHandles=new s,this._vizTaskId=0,this.view=null,this.showHighlight=!0,this.highlightName="default"}initialize(){this.addHandles([a((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),a((()=>this.view),(e=>{e?.when().then((()=>this.syncSources()))}),u),h((()=>this.sources),"change",(e=>{const t=this._selectionMap,s=[];for(const o of e.removed){const e=t.get(o);e&&(t.delete(o),e.highlightHandle?.remove(),s.push({layer:o,selection:[],added:[],removed:[...e.selection]}))}this._refreshListeners(),s.length&&this._onSelectionChange(s)}),{onListenerAdd:()=>this._refreshListeners()})])}destroy(){this.clear(),this._layerEditHandles.drain(l)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._sources}set sources(e){o(e,this._sources)}syncSources(){const e=new Set,t=this.view?.map;if(!t)return;const s=t=>{m(t)?(t.layers?.forEach(s),t.tables?.forEach(s)):_(t)?(t.sublayers?.forEach(s),t.subtables?.forEach(s)):y(t)?t.sublayers?.forEach(s):w(t)&&e.add(t)};t.allLayers.forEach(s),t.allTables.forEach(s),this.sources=[...e]}async getSelectedFeatures(e,t={},s="layerView"){const{view:o,selections:i}=this;if(!o&&"layerView"===s)return n.getLogger(this).warn("Cannot query layer views without a view."),[];const r=e?.length?i.filter((t=>e.includes(t.layer))):i,l=[];return r.forEach((async e=>{const{layer:i,selection:n}=e;if(!n.length)return;const r=g(i)?i.parent:i;if(null==r)return;if("layer"===s)return void l.push(F(r,n,t));if(b(r)||!o||!E(r))return;const c=await o.whenLayerView(r).catch((()=>null));c&&l.push(F(c,n,t))})),(await Promise.all(l)).filter((e=>null!=e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let o=!1;const i=e.current.concat(e.added);for(const t of i){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(w(e)||g(e))&&null!==i){const t=r(s,e,(()=>[]));t.includes(i)||(t.push(i),o=!0)}}for(const t of e.removed){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(w(e)||g(e))&&null!==i){const t=s.get(e),n=t?.indexOf(i);void 0!==n&&n>=0&&(t?.splice(n,1),o=!0)}}if(o){const{_selectionMap:e,_trashCan:o}=this,i=[];for(const[n,r]of s){const s=e.get(n);void 0!==s&&o.push(s),e.set(n,{selection:r}),i.push({layer:n,selection:r,...t(void 0!==s?s.selection:[],r)})}this._onSelectionChange(i)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),o=void 0!==s?[...s.selection]:[];for(const i of t)o.includes(i)||o.push(i);this._setSelection(e,o)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const o=[];for(const i of s.selection)t.includes(i)||o.push(i);this._setSelection(e,o)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const o=new Set(s.selection),i=new Set(t),n=d(o,i);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,o]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...o.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}if(null==this.view)return;const{sources:e,view:t,_selectionMap:s,showHighlight:o}=this,i=this._vizTaskId;for(const n of e){const e=s.get(n),r=g(n)?n.parent:n;if(null!=r&&E(r)){if(b(r))continue;t.whenLayerView(r).then((t=>{e?.highlightHandle?.remove(),null!=e&&o&&i===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,this.highlightName))})).catch((()=>{e?.highlightHandle?.remove()}))}}}_refreshListeners(){this._layerEditHandles.drain(l);const e=new Set(this.sources.map((e=>g(e)?e.parent:e)));for(const t of e)w(t)&&"on"in t&&t.on&&this._layerEditHandles.push(t.on("edits",(e=>this._onLayerEdit(e,t))))}_onLayerEdit(e,t){if(y(t))this._onParentLayerEdit(e,t);else if(e.deletedFeatures.length&&this._selectionMap.has(t)){const s=[];e.deletedFeatures.forEach((({error:e,objectId:t})=>{null!=t&&null==e&&s.push(t)})),this.removeFromSelection(t,s)}}_onParentLayerEdit(e,t){const{deletedFeatures:s,edits:o,updatedFeatures:i}=e;if(o?.updateFeatures?.forEach((e=>{const s=e.getObjectId()??e.attributes[t.objectIdField];if(null==s)return;if(i.find((e=>e.objectId===s))?.error)return;const o=t.findSublayerForFeature(e);if(!w(o))return;const n=t.sublayers.find((e=>!(!w(e)||!this.getSelection(e)?.includes(s))));w(n)&&n!==o&&(this.removeFromSelection(n,[s]),this.appendToSelection(o,[s]))})),s.length){const e=[];s.forEach((({error:t,objectId:s})=>{null!=s&&null==t&&e.push(s)})),t.sublayers.forEach((t=>{w(t)&&this._selectionMap.has(t)&&this.removeFromSelection(t,e)}))}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const o=this._selectionMap.get(e);if(void 0===o||!M(o,{selection:s})){void 0!==o&&this._trashCan.push(o),this._selectionMap.set(e,{selection:[...s]});const i={layer:e,selection:[...s],...t(void 0!==o?o.selection:[],s)};this._onSelectionChange([i])}}};e([p()],S.prototype,"_selectionMap",void 0),e([p()],S.prototype,"_sources",void 0),e([p({readOnly:!0,nonNullable:!0})],S.prototype,"selections",null),e([p({readOnly:!0,nonNullable:!0})],S.prototype,"count",null),e([p()],S.prototype,"view",void 0),e([p({readOnly:!0,nonNullable:!0})],S.prototype,"hasSelection",null),e([p()],S.prototype,"showHighlight",void 0),e([p()],S.prototype,"sources",null),e([p()],S.prototype,"highlightName",void 0),S=e([f("esri.views.SelectionManager")],S);const b=e=>g(e)?!0===e.parent?.isTable:e.isTable,j=e=>void 0!==e.layer,E=e=>void 0!==e?.when,M=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],o=[...t.selection];if(s.length!==o.length)return!1;s.sort(),o.sort();for(let e=0;e<s.length;e++)if(s[e]!==o[e])return!1}return!0},F=async(e,t,s={})=>{let o;if(j(e)){const i=e;o=void 0===i?null:await i.queryFeatures(new v({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const i=e;o=void 0===i?null:await i.queryFeatures(new v({...s,objectIds:t})).then((e=>({data:e,layer:i})))}return o},L=S;export{L as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{isSome as t}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import{deprecatedFunction as r}from"../../core/deprecate.js";import s from"../../core/Error.js";import o from"../../core/Evented.js";import{makeHandle as n}from"../../core/handleUtils.js";import l from"../../core/Logger.js";import{destroyMaybe as p,abortMaybe as d,removeMaybe as c}from"../../core/maybe.js";import{throwIfAborted as u,createResolver as h}from"../../core/promiseUtils.js";import{watch as w,on as f,when as m,syncAndInitial as y,initial as g,sync as k,whenOnce as v}from"../../core/reactiveUtils.js";import{property as _}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as W}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as M}from"../../core/support/UpdatingHandles.js";import{getTemplatesForLayers as F}from"../../editing/templateUtils.js";import E from"../../layers/GraphicsLayer.js";import{isEditableLayer as b}from"../../layers/support/editableLayers.js";import{isFeatureLayer as V,isSubtypeGroupLayer as T,getOwningPortalUrl as I}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as L}from"../../portal/support/urlUtils.js";import A from"../../views/SelectionManager.js";import U from"../../views/interactive/sketch/SketchOptions.js";import{SnappingManager as S}from"../../views/interactive/snapping/SnappingManager.js";import C from"../../views/interactive/snapping/SnappingOptions.js";import{isSelectableLayer as O}from"../../views/support/selectionUtils.js";import j from"../Attachments/AttachmentsViewModel.js";import P from"./CreateFeaturesWorkflow.js";import R from"./UpdateFeaturesWorkflow.js";import H from"./UpdateWorkflow.js";import{getLayersFromWorkflow as G,isCreateFeaturesWorkflow as D,isUpdateRecordWorkflow as x,isUpdateFeaturesWorkflow as B,isUpdateWorkflow as q,whenEditorLayerView as N}from"./workflowUtils.js";import Q from"./support/EditorItem.js";import{makeTemplateGroupInfoForLayer as z}from"../FeatureTemplates/featureTemplatesUtils.js";import Z from"../FeatureTemplates/FeatureTemplatesViewModel.js";import $ from"../Sketch/SketchViewModel.js";import J from"../Spinner/SpinnerViewModel.js";import{goTo as K}from"../support/goToUtils.js";import{isFeatureItem as X,isLayerItem as Y}from"../support/SelectionList/selectionListUtils.js";import ee from"../support/SelectionList/SelectionListViewModel.js";import te from"../support/SelectionToolbar/SelectionToolbarViewModel.js";function ie(e,t){return e?.find((e=>e.layer===t))}let ae=class extends o.EventedAccessor{constructor(e){super(e),this._templatesByLayer=new Map,this._sketchEventListenerHandle=null,this._sketchGraphicsLayer=new E({listMode:"hide",internal:!0}),this._snappingManager=null,this._updateItemsTask=null,this._updateTemplatesTask=null,this._updatingHandles=new M,this._featureTemplatesViewModelIsRestricted=!1,this.activeWorkflow=null,this._activityQueue=new a,this.editorItems=new a,this.failures=[],this.hideTemplatesForInactiveLayers=!1,this.attachmentsViewModel=new j({capabilities:{editing:!0}}),this.featureTemplatesViewModel=new Z({disabledItemFunction:({layer:e})=>this._itemIsSuspended(e)}),this.layerInfos=null,this.ownSketchViewModel=new $({layer:this._sketchGraphicsLayer}),this.selectionListViewModel=new ee,this.selectionManager=new A,this.selectionToolbarViewModel=new te({persistSelection:!1,returnGeometry:!1}),this.sketchOptions=new U,this.snappingOptions=new C({attributeRulesEnabled:!0}),this.spinnerViewModel=new J,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.back=async()=>{this.selectionToolbarViewModel.cancel(),"viewing-selection-list"!==this.state?this.canGoBack&&(this.activeWorkflow?.hasPreviousStep?await this.activeWorkflow.back(this.showDiscardEditsPrompt):await this._cancelWorkflow({force:!this.hasPendingEdits})):this.effectiveSelectionManager.clear()},this.saveWorkflow=async()=>await(this.activeWorkflow?.save()),this.selectFeature=(e,t=!1)=>{const i=this.activeWorkflow;this._candidateCommitted||"update"!==i?.type||(i.data.rootFeature=e,t&&(i.next(),this._candidateCommitted=!0))}}initialize(){this.addHandles([w((()=>{const e=this.view,t=e?.map?.editableLayers.toArray(),i=e?.allLayerViews,a=i?.filter((e=>!!t?.includes(e.layer)));return[t,a,this.layerInfos]}),(()=>this._updateEditorItems()),y),w((()=>this.hideTemplatesForInactiveLayers),(()=>this.syncFeatureTemplates())),f((()=>this.activeWorkflow),"cancel",(()=>this.emit("workflow-cancel"))),f((()=>this.activeWorkflow),"commit",(()=>this.emit("workflow-commit"))),f((()=>this.activeWorkflow),"complete",(()=>{this.emit("workflow-commit"),this._set("activeWorkflow",null)})),m((()=>this.view?.map),(e=>e.add(this._sketchGraphicsLayer)),g),f((()=>this.editorItems),"change",(()=>this._afterEditorItemsChange())),w((()=>[this.canCreate,this.canUpdateVisible]),(()=>this._afterEditorItemsChange())),w((()=>this.page),((e,t)=>{const i=[...this.pageStack];if(-1===i.indexOf(e))i.push(e);else for(;i.length&&i.at(-1)!==e;)i.pop();this.pageStack=i}),y),m((()=>"awaiting-update-feature-candidate"===this.state),(()=>this._candidateCommitted=!1)),f((()=>this.featureTemplatesViewModel),"select",(async({item:e,oldItem:t})=>{const{activeWorkflow:i}=this;if(i){if("update"===i.type&&"awaiting-feature-creation-info"===i.activeWorkflow?.stepId)return;try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{return void this.featureTemplatesViewModel.select(t,{emit:!1})}}if(!e)return;const a={layer:e.layer,template:e.template};if(e.supportsUpload)return this.featureTemplatesViewModel.select(t,{emit:!1}),this.startCreateFeaturesWorkflow(a);this.startCreateFeaturesWorkflowAtFeatureCreation(a)})),w((()=>[this.view,this.featureTemplatesViewModel]),(([e,t])=>{t.view=e}),y),f((()=>this.view),"key-down",(e=>{"Escape"===e.key&&this.activeWorkflow?.keyboardCancellationEnabled&&(e.stopPropagation(),this.back())})),f((()=>this.sketchViewModel),["create","delete","update"],(e=>{const{activeWorkflow:t}=this,i="update"===t?.type,a=G(t),r=i?t?.activeWorkflow?.parentLayer:void 0,s=`sketch-${e.type}`;this.emit(s,{type:s,detail:e,layer:a[0],layers:a,parentLayer:r})}),k),w((()=>this.view),(e=>{if(this._snappingManager=p(this._snappingManager),!e)return;const t=this.snappingOptions;this._snappingManager=new S({view:e,options:t}),this.ownSketchViewModel.snappingManager=this._snappingManager}),y),w((()=>this.snappingOptions),(e=>{this._snappingManager&&(this._snappingManager.options=e)}),y),f((()=>this.selectionToolbarViewModel),"complete",(e=>this._onSelectionComplete(e))),w((()=>({view:this.view,selectionManager:this.effectiveSelectionManager,selectionListViewModel:this.selectionListViewModel,selectionToolbarViewModel:this.selectionToolbarViewModel})),(({view:e,selectionManager:t,selectionListViewModel:i,selectionToolbarViewModel:a})=>{t.view=e,i.view=e,a.view=e}),y),w((()=>this.effectiveSelectionManager),(e=>{this.selectionListViewModel.selectionManager=e,this.selectionToolbarViewModel.selectionManager=e}),y)])}destroy(){this._cancelWorkflow({warnIfNoWorkflow:!1}).then((()=>{this.view?.map?.remove(this._sketchGraphicsLayer),this.view=null})),this._updateItemsTask=d(this._updateItemsTask),this._updatingHandles.destroy(),this._sketchEventListenerHandle=c(this._sketchEventListenerHandle)}get _featureTemplatesLayersAndTables(){const e=new a;for(const t of this.editorItems){const i=this.hideTemplatesForInactiveLayers&&!t.visible;t.supportsCreateFeaturesWorkflow&&!i&&e.push(t.layer)}return e}get activeFeatureCount(){const e=this.activeLeafWorkflow;return D(e)?e.pendingFeatures.length:x(e)&&e.data.edits.feature?1:B(e)?e.data.features.length:0}get activeLeafWorkflow(){const e=this.activeWorkflow;return e&&q(e)?e.activeWorkflow??e:e}get canCreate(){return this.editorItems.some((e=>e.supportsCreateFeaturesWorkflow))}get canCreateVisible(){return!!this.featureTemplatesLayers.length}get canUpdate(){return this.editorItems.some((e=>e.supportsUpdateWorkflow))}get canUpdateVisible(){return this.editorItems.some((e=>e.supportsUpdateWorkflow&&e.visible))}get featureTemplatesLayers(){return this._featureTemplatesLayersAndTables.filter((e=>"scene"===e.type||!e.isTable))}get effectiveSelectionManager(){return this.selectionManager}get featureFormViewModel(){const{activeWorkflow:e}=this;return"update"===e?.type?e.activeFeatureFormViewModel:"create-features"===e?.type?e.featureFormViewModel:null}get formViewModel(){const{activeWorkflow:e}=this;return"update"===e?.type?e.activeFeatureFormViewModel:"create-features"===e?.type?e.featureFormViewModel:"update-features"===e?.type?e.formViewModel:null}get utilityNetworkAssociationAddAssociationViewModel(){const{activeWorkflow:e}=this;return"update"===e?.type?e.activeUtilityNetworkAssociationAddAssociationViewModel:null}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get sketchViewModel(){const{activeWorkflow:e}=this;return"update"===e?.type?e.activeSketchViewModel:"create-features"===e?.type?e.sketchViewModel:this.ownSketchViewModel}get state(){if(!this.view?.ready)return"disabled";const e=this.attachmentsViewModel.mode;if("add"===e)return"adding-attachment";if("edit"===e)return"editing-attachment";const{activeWorkflow:t}=this,i=!t?.stepId;return this.effectiveSelectionManager.count&&i?"viewing-selection-list":i?"ready":"update"===t.type&&t.activeWorkflow?.stepId?t.activeWorkflow.stepId:t.stepId}get syncing(){return this._activityQueue.length>0}get updating(){return this._updatingHandles.updating||!0===this.activeWorkflow?.updating}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}set view(e){this.ownSketchViewModel.view=e,this.spinnerViewModel.view=e,this._set("view",e)}get canZoomTo(){const e=this.sketchViewModel,t=e?.createGraphic?.geometry?.type;return!(!e?.updateGraphics?.length&&"multipoint"!==t)}get page(){const{activeWorkflow:e,state:t}=this;if("update"===e?.type&&null!=e?.activeWorkflow?.featureFormViewModel?.associatedLayer)return"viewing-associated-features";if("update"===e?.type&&null!=e?.activeWorkflow?.featureFormViewModel?.associationId)return"viewing-associated-layers";if("update"===e?.type&&"awaiting-feature-to-update"===e.stepId)return"ready";if("create-features"===e?.type&&0===e.numPendingFeatures){const t=e.data.upload;if(t)return"default"===t.state?"ready":"creating-features-upload-details"}return t??"disabled"}get featureFormDisabled(){const{activeWorkflow:e}=this;return"update"===e?.type&&(!1===e.activeEditorItem?.capabilities.update.attributes||!0===e.activeFeatureFormViewModel?.disabled)}get featureFormHasAssociation(){return!!this.featureFormViewModel?.activeAssociation}get canGoBack(){return null!=this.activeWorkflow&&!this.syncing}get shouldShowDeleteButton(){const{activeWorkflow:e}=this;return!this.featureFormDisabled&&(q(e)&&e.activeEditorItem?.capabilities.delete.enabled||B(e)&&e.data.editorItems.every((e=>e.capabilities.delete.enabled)))}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}get snappingManager(){return this._snappingManager}getTemplatesForLayer(e){return this._templatesByLayer.get(e)??[]}async startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.startCreateFeaturesWorkflow()}async startCreateFeaturesWorkflowAtFeatureCreation(e){return this.startCreateFeaturesWorkflow(e,"creating-features")}async startCreateFeaturesWorkflow(e,t="awaiting-feature-creation-info"){if(await v((()=>!this.updating)),!this.canCreate)throw new s("editing:unsupported-workflow","Creating features is unsupported or disabled.");const i=this._createUpdatingResolver();try{await this._cancelWorkflow();const i=this._createCreateFeaturesWorkflow(e,t);this._set("activeWorkflow",i),await i.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{i.resolve()}}async startCreateFeaturesWorkflowAtFeatureEdit(e){await v((()=>!this.updating));const t=this._createUpdatingResolver();try{const{initialFeature:t}=e,i=t.sourceLayer=t.layer,a=i?this.findEditorItemForLayer(i):void 0;if(!a?.supportsCreateFeaturesWorkflow)throw new s("editing:unsupported-workflow","Creating features is unsupported or disabled for this layer.");await this._cancelWorkflow();const r=this._createCreateFeaturesWorkflow({initialFeature:t,layer:a.layer,maxFeatures:1},"creating-features");this._set("activeWorkflow",r),await r.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startUpdateFeaturesWorkflow(e){if(await v((()=>!this.updating)),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update features workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow();const t=this._createUpdateFeaturesWorkflow(e);this._set("activeWorkflow",t),await t.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startUpdateWorkflowAtFeatureSelection(){if(await v((()=>!this.updating)),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const e=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateWorkflow();this._set("activeWorkflow",e),await e.start()}catch(t){this._logErrorAndCancelWorkflow(t)}finally{e.resolve()}}async startUpdateWorkflowAtMultipleFeatureSelection(e){if(await v((()=>!this.updating)),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow();const t=this._createUpdateWorkflow("awaiting-update-feature-candidate");t.data.candidates=e,this._set("activeWorkflow",t),await t.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startUpdateWorkflowAtFeatureEdit(e){if(await v((()=>!this.updating)),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow();const t=this._createUpdateWorkflow("editing-existing-feature");t.data.rootFeature=e,t.addHandles(f((()=>t),"commit",(()=>{t.destroy(),this.activeWorkflow===t&&this._set("activeWorkflow",null)}))),this._set("activeWorkflow",t),await t.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startUpdateWorkflowWithActiveSelection(){const{selectionListViewModel:e}=this;if(!e.visibleFeatureCount)throw new s("editing:missing-selection","Unable to determine visible selection.");if(e.visibleLayerCount>1)throw new s("editing:features-different-layers","Cannot start workflow with features from different layers.");const t=e.activeLayerItem??e.layerItems.find((e=>e.total>0));if(!t)throw new s("editing:no-layer-item","Unable to determine source layer of active selection.");const i=t.selection.map((e=>e.graphic));1===i.length?this.startUpdateWorkflowAtFeatureEdit(i[0]):this.startUpdateFeaturesWorkflow(i)}async deleteFeatureFromWorkflow(){r(l.getLogger(this),"EditorViewModel.deleteFeatureFromWorkflow is deprecated. Use EditorViewModel.deleteFeatures instead.",{version:"4.33",replacement:"EditorViewModel.deleteFeatures",warnOnce:!0}),await this.deleteFeatures()}async deleteFeatures(){const e=this.activeWorkflow;return q(e)?e.deleteActiveFeature():B(e)?e.deleteAndCommit():void this._logError("editing:unsupported-workflow","Deleting features requires an active update workflow.")}async deleteAssociationFromWorkflow(){const{activeWorkflow:e}=this;e&&"update"===e.type?await e.deleteActiveAssociation():this._logError("editing:unsupported-workflow","Deleting an association requires an active update workflow.")}async cancelWorkflow(e){return this._cancelWorkflow({warnIfNoWorkflow:!0,...e})}findEditorItemForLayer(e){return this.editorItems.find((t=>t.layer===e))}itemHasInvalidFormTemplate(e){return null!=e&&!0===this.findEditorItemForLayer(e.layer)?.hasInvalidFormTemplate}syncFeatureTemplates(){this._featureTemplatesViewModelIsRestricted||this._updateTemplates()}zoomTo(e){const i=this.sketchViewModel,a=e?e.geometry:i?.updateGraphics.length?i?.updateGraphics.toArray().map((e=>e.geometry)).filter(t):i?.createGraphic?.geometry;a&&this.view&&K(this.view,a)}async toggleUpdateWorkflow(){this.canUpdate&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(this.activeWorkflow&&"awaiting-feature-to-update"===this.state?await this.cancelWorkflow({force:!0}):await this.startUpdateWorkflowAtFeatureSelection()))}async onSelectionListItemSelect(e){X(e)&&this.startUpdateWorkflowAtFeatureEdit(e.graphic)}async onSelectionListMenuItemSelect(e){if(X(e))this.startUpdateWorkflowAtFeatureEdit(e.graphic);else if(Y(e)){const t=e.selection.map((e=>e.graphic));1===t.length?this.startUpdateWorkflowAtFeatureEdit(t[0]):this.startUpdateFeaturesWorkflow(t)}}restrictFeatureTemplatesViewModelToLayer(e){return this._featureTemplatesViewModelIsRestricted=!0,this._setFeatureTemplatesViewModelLayers([e]),n((()=>{this._featureTemplatesViewModelIsRestricted=!1,this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)}))}async _getEditorItemCandidates(e){const{view:t}=this;if(!t?.map)return[];const{map:i}=t,a=i.editableLayers.toArray(),r=i.allTables.toArray().filter((e=>V(e)||T(e)));return await Promise.allSettled([...a.flatMap((e=>this._getLayerLoadPromise(e))),...r.flatMap((e=>this._getLayerLoadPromise(e)))]),u(e),[...a.reverse(),...r.reverse()].filter((e=>b(e)&&("mesh"!==e.geometryType||"3d"===t.type))).flatMap((e=>"subtype-group"===e.type?e.sublayers.toArray():e))}_getLayerLoadPromise(e){return T(e)?e.loadAll():e.load()}_drainEditorItems(){this.editorItems.drain((e=>e.destroy()))}_updateEditorItems(){d(this._updateItemsTask);const{view:e}=this,t=i((async t=>{if(!e?.map||!e?.allLayerViews)return;const i=await this._getEditorItemCandidates(t);if(!i.length)return void this._drainEditorItems();const a=[],r=[],s=[],{layerInfos:o}=this;for(const l of i){const t=ie(o,l),i=await N(e,l).catch((()=>null));(t?a:i?r:s).push(new Q({layer:l,layerInfo:t,layerView:i}))}o?.length&&a.sort(((e,t)=>o.findIndex((({layer:t})=>t===e.layer))-o.findIndex((({layer:e})=>e===t.layer))));const n=[...a,...r,...s];t.aborted||(this._drainEditorItems(),this.editorItems.addMany(n))}));this._updatingHandles.addPromise(t.promise),this._updateItemsTask=t}_updateTemplates(){d(this._updateTemplatesTask);const e=i((async e=>{const t=this._templatesByLayer,i=this._featureTemplatesLayersAndTables.filter((e=>!t.has(e)));if(i.length>0){const a=await F(i.toArray(),this.view,e);for(const{layer:e,templates:i}of a)t.set(e,i)}this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)}));this._updatingHandles.addPromise(e.promise),this._updateTemplatesTask=e}_setFeatureTemplatesViewModelLayers(e){const t=this._templatesByLayer,i=[];for(const a of e){const e=t.get(a);e&&e.length>0&&i.push(z(a,e))}this.featureTemplatesViewModel.templateInfos=i}_afterEditorItemsChange(){const{activeWorkflow:e}=this;if(this.syncFeatureTemplates(),this._syncSelectionSources(),!e)return;const{stepId:t}=e;"create-features"!==e.type?"update"===e.type&&("awaiting-feature-to-update"===t&&!this.canUpdateVisible||"awaiting-update-feature-candidate"===t&&!e.hasUpdatableCandidates)&&this._cancelWorkflow():"awaiting-feature-creation-info"!==t||this.canCreate||this._cancelWorkflow()}async _cancelWorkflow(e){const t=this.activeWorkflow;if(!t)return void(e?.warnIfNoWorkflow&&this._logError("editing:no-active-workflow","There is no active workflow to cancel."));if(!e||!1!==e.force){this.emit("workflow-cancel"),this._set("activeWorkflow",null);try{await t.cancel(e)}finally{t.destroy()}}else try{await t.cancel(e),this._set("activeWorkflow",null),t.destroy()}catch(i){}}_createCreateFeaturesWorkflow(e,t){return P.create({viewModel:this,creationInfo:e,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:t,applyEditsCallback:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureServiceCallback:(e,t,i)=>this._applyEditsFeatureService(e,t,i),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)})}_createUpdateFeaturesWorkflow(e){const t=R.create({viewModel:this,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,features:e,applyEdits:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureService:(e,t,i)=>this._applyEditsFeatureService(e,t,i)});return t.addHandles(f((()=>t),"commit",(()=>{t.destroy(),this.activeWorkflow===t&&this._set("activeWorkflow",null)}))),t}_createUpdateWorkflow(e){return H.create({viewModel:this,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:e,applyEditsCallback:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureServiceCallback:(e,t,i)=>this._applyEditsFeatureService(e,t,i),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)})}_addAttachments(e,t){const i=t.map((t=>this._addAttachment(e,t.feature,t.attachment)))??[];return Promise.all(i)}async _addAttachment(e,t,i){let a=null;if(!("addAttachment"in e)||null==e.capabilities?.attachment)throw new s("editor:attachments-not-supported","Adding attachments is not supported for this layer type");return await this._queueOperation((async()=>(a=await(e.addAttachment?.(t,i).catch((e=>{throw e?.error||e})))??null,a))),a}async _applyEdits(e,t,i){let a=null;const r=e.url?await I(e.url):null,s={returnServiceEditsOption:(!r||!L(r))&&!RegExp("/hosted/","i").test(e.url)?"original-and-current-features":void 0,...i};return await this._queueOperation((async()=>{const{view:i}=this;if(!i)return null;const r=await N(i,e).catch((()=>null));return a=await e.applyEdits(t,s),r&&await v((()=>!r.updating)),a})),a}async _applyEditsFeatureService(e,t,i){let a=null;return await this._queueOperation((async()=>a=await e.applyEdits(t,i))),a}_queueOperation(e){this._activityQueue.push(e);const t=(e,t)=>{const i=t.indexOf(e);i>-1&&t.splice(i,1)};return e().then((e=>(Array.isArray(e)?e.forEach((e=>this._handleEditsResultError(e))):this._handleEditsResultError(e),e))).catch((i=>{this._logError("editing:operation-error","An error occurred.",{error:i});const a={error:i,retry:()=>(t(a,this.failures),this._queueOperation(e)),cancel:()=>{t(a,this.failures)}};this._set("failures",[...this.failures,a])})).then((()=>{t(e,this._activityQueue)}))}_handleEditsResultError(e){if(null!=e&&"error"in e&&null!=e.error)throw e.error;if(null!=e&&"addFeatureResults"in e){const{addFeatureResults:t,deleteFeatureResults:i,updateFeatureResults:a}=e,r=t.find((e=>!!e.error))||a.find((e=>!!e.error))||i.find((e=>!!e.error));if(r)throw r.error}}_createUpdatingResolver(){const e=h();return this._updatingHandles.addPromise(e.promise),e}_logErrorAndCancelWorkflow(e){const{name:t,message:i,details:a}=e;this._logError(t??"editing:workflow-start-failed",i??void 0,a??e),this._cancelWorkflow({force:!0})}_itemIsSuspended(e){const t=this.findEditorItemForLayer(e);return null!=t&&(!t.visible||t.disabled)}_logError(e,t,i){l.getLogger(this).error(new s(e,t,i))}_syncSelectionSources(){const{selectionManager:e}=this,t=[];this.editorItems.forEach((e=>{O(e.layer)&&e.supportsUpdateWorkflow&&t.push(e.layer)})),e.sources.removeAll(),e.sources.addMany(t)}async _onSelectionComplete(e){if(e.aborted)return;const{operationType:t,selection:i}=e,{effectiveSelectionManager:a}=this,r="ready"===this.state,s=1===i.length;if(r&&s&&(0===a.count&&"add"===t||"replace"===t))return this.startUpdateWorkflowAtFeatureEdit(i[0]);switch(t){case"remove":a.updateSelection({current:[],added:[],removed:i});break;case"replace":a.clear(),a.updateSelection({current:i,added:[],removed:[]});break;case"add":a.updateSelection({current:i,added:[],removed:[]})}}};e([_()],ae.prototype,"_featureTemplatesLayersAndTables",null),e([_()],ae.prototype,"_snappingManager",void 0),e([_()],ae.prototype,"activeFeatureCount",null),e([_({readOnly:!0})],ae.prototype,"activeWorkflow",void 0),e([_()],ae.prototype,"activeLeafWorkflow",null),e([_({readOnly:!0})],ae.prototype,"_activityQueue",void 0),e([_({readOnly:!0})],ae.prototype,"canCreate",null),e([_()],ae.prototype,"canCreateVisible",null),e([_({readOnly:!0})],ae.prototype,"canUpdate",null),e([_()],ae.prototype,"canUpdateVisible",null),e([_()],ae.prototype,"featureTemplatesLayers",null),e([_()],ae.prototype,"editorItems",void 0),e([_()],ae.prototype,"effectiveSelectionManager",null),e([_({readOnly:!0})],ae.prototype,"failures",void 0),e([_()],ae.prototype,"hideTemplatesForInactiveLayers",void 0),e([_({type:j})],ae.prototype,"attachmentsViewModel",void 0),e([_()],ae.prototype,"featureFormViewModel",null),e([_()],ae.prototype,"formViewModel",null),e([_()],ae.prototype,"utilityNetworkAssociationAddAssociationViewModel",null),e([_({type:Z})],ae.prototype,"featureTemplatesViewModel",void 0),e([_()],ae.prototype,"labelOptions",null),e([_()],ae.prototype,"layerInfos",void 0),e([_()],ae.prototype,"ownSketchViewModel",void 0),e([_()],ae.prototype,"selectionListViewModel",void 0),e([_()],ae.prototype,"selectionManager",void 0),e([_()],ae.prototype,"selectionToolbarViewModel",void 0),e([_()],ae.prototype,"sketchOptions",void 0),e([_()],ae.prototype,"sketchViewModel",null),e([_({type:C,nonNullable:!0})],ae.prototype,"snappingOptions",void 0),e([_()],ae.prototype,"spinnerViewModel",void 0),e([_()],ae.prototype,"state",null),e([_({readOnly:!0})],ae.prototype,"syncing",null),e([_()],ae.prototype,"updating",null),e([_()],ae.prototype,"tooltipOptions",null),e([_()],ae.prototype,"valueOptions",null),e([_()],ae.prototype,"view",null),e([_()],ae.prototype,"canZoomTo",null),e([_()],ae.prototype,"pageStack",void 0),e([_()],ae.prototype,"showDiscardEditsPrompt",void 0),e([_()],ae.prototype,"_candidateCommitted",void 0),e([_()],ae.prototype,"page",null),e([_()],ae.prototype,"featureFormDisabled",null),e([_()],ae.prototype,"featureFormHasAssociation",null),e([_()],ae.prototype,"canGoBack",null),e([_()],ae.prototype,"shouldShowDeleteButton",null),e([_()],ae.prototype,"hasPendingEdits",null),e([_()],ae.prototype,"snappingManager",null),ae=e([W("esri.widgets.Editor.EditorViewModel")],ae);const re=ae;export{re as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{isSome as t}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import{deprecatedFunction as r}from"../../core/deprecate.js";import s from"../../core/Error.js";import o from"../../core/Evented.js";import{makeHandle as n}from"../../core/handleUtils.js";import l from"../../core/Logger.js";import{destroyMaybe as c,abortMaybe as p,removeMaybe as d}from"../../core/maybe.js";import{throwIfAborted as u,createResolver as h}from"../../core/promiseUtils.js";import{watch as w,on as f,when as m,syncAndInitial as y,initial as g,sync as k,whenOnce as v}from"../../core/reactiveUtils.js";import{property as _}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as W}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as M}from"../../core/support/UpdatingHandles.js";import{getTemplatesForLayers as F}from"../../editing/templateUtils.js";import E from"../../layers/GraphicsLayer.js";import{isEditableLayer as b}from"../../layers/support/editableLayers.js";import{isFeatureLayer as V,isSubtypeGroupLayer as T,getOwningPortalUrl as I}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as L}from"../../portal/support/urlUtils.js";import S from"../../views/SelectionManager.js";import A from"../../views/interactive/sketch/SketchOptions.js";import{SnappingManager as U}from"../../views/interactive/snapping/SnappingManager.js";import C from"../../views/interactive/snapping/SnappingOptions.js";import{isSelectableLayer as O}from"../../views/support/selectionUtils.js";import j from"../Attachments/AttachmentsViewModel.js";import P from"./CreateFeaturesWorkflow.js";import R from"./UpdateFeaturesWorkflow.js";import H from"./UpdateWorkflow.js";import{getLayersFromWorkflow as G,isCreateFeaturesWorkflow as D,isUpdateRecordWorkflow as x,isUpdateFeaturesWorkflow as B,isUpdateWorkflow as q,whenEditorLayerView as N}from"./workflowUtils.js";import Q from"./support/EditorItem.js";import{makeTemplateGroupInfoForLayer as z}from"../FeatureTemplates/featureTemplatesUtils.js";import Z from"../FeatureTemplates/FeatureTemplatesViewModel.js";import $ from"../Sketch/SketchViewModel.js";import J from"../Spinner/SpinnerViewModel.js";import{goTo as K}from"../support/goToUtils.js";import{isFeatureItem as X,isLayerItem as Y}from"../support/SelectionList/selectionListUtils.js";import ee from"../support/SelectionList/SelectionListViewModel.js";import te from"../support/SelectionToolbar/SelectionToolbarViewModel.js";function ie(e,t){return e?.find((e=>e.layer===t))}let ae=class extends o.EventedAccessor{constructor(e){super(e),this._templatesByLayer=new Map,this._sketchEventListenerHandle=null,this._sketchGraphicsLayer=new E({listMode:"hide",internal:!0}),this._snappingManager=null,this._updateItemsTask=null,this._updateTemplatesTask=null,this._updatingHandles=new M,this._featureTemplatesViewModelIsRestricted=!1,this.activeWorkflow=null,this._activityQueue=new a,this.editorItems=new a,this.failures=[],this.hideTemplatesForInactiveLayers=!1,this.attachmentsViewModel=new j({capabilities:{editing:!0}}),this.featureTemplatesViewModel=new Z({disabledItemFunction:({layer:e})=>this._itemIsSuspended(e)}),this.layerInfos=null,this.ownSketchViewModel=new $({layer:this._sketchGraphicsLayer}),this.selectionListViewModel=new ee,this.selectionManager=new S,this.selectionToolbarViewModel=new te({persistSelection:!1,returnGeometry:!1}),this.sketchOptions=new A,this.snappingOptions=new C({attributeRulesEnabled:!0}),this.spinnerViewModel=new J,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.back=async()=>{this.selectionToolbarViewModel.cancel(),"viewing-selection-list"!==this.state?this.canGoBack&&(this.activeWorkflow?.hasPreviousStep?await this.activeWorkflow.back(this.showDiscardEditsPrompt):await this._cancelWorkflow({force:!this.hasPendingEdits})):this.effectiveSelectionManager.clear()},this.saveWorkflow=async()=>await(this.activeWorkflow?.save()),this.selectFeature=(e,t=!1)=>{const i=this.activeWorkflow;this._candidateCommitted||"update"!==i?.type||(i.data.rootFeature=e,t&&(i.next(),this._candidateCommitted=!0))}}initialize(){this.addHandles([w((()=>{const e=this.view,t=e?.map?.editableLayers.toArray(),i=e?.allLayerViews,a=i?.filter((e=>!!t?.includes(e.layer)));return[t,a,this.layerInfos]}),(()=>this._updateEditorItems()),y),w((()=>this.hideTemplatesForInactiveLayers),(()=>this.syncFeatureTemplates())),w((()=>this._selectionSources),(()=>this._syncSelectionSources()),g),f((()=>this.activeWorkflow),"cancel",(()=>this.emit("workflow-cancel"))),f((()=>this.activeWorkflow),"commit",(()=>this.emit("workflow-commit"))),f((()=>this.activeWorkflow),"complete",(()=>{this.emit("workflow-commit"),this._set("activeWorkflow",null)})),w((()=>this.activeWorkflow),(e=>this.selectionManager.showHighlight=!e)),m((()=>this.view?.map),(e=>e.add(this._sketchGraphicsLayer)),g),f((()=>this.editorItems),"change",(()=>this._afterEditorItemsChange())),w((()=>[this.canCreate,this.canUpdateVisible]),(()=>this._afterEditorItemsChange())),w((()=>this.page),((e,t)=>{const i=[...this.pageStack];if(-1===i.indexOf(e))i.push(e);else for(;i.length&&i.at(-1)!==e;)i.pop();this.pageStack=i}),y),m((()=>"awaiting-update-feature-candidate"===this.state),(()=>this._candidateCommitted=!1)),f((()=>this.featureTemplatesViewModel),"select",(async({item:e,oldItem:t})=>{const{activeWorkflow:i}=this;if(i){if("update"===i.type&&"awaiting-feature-creation-info"===i.activeWorkflow?.stepId)return;try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{return void this.featureTemplatesViewModel.select(t,{emit:!1})}}if(!e)return;const a={layer:e.layer,template:e.template};if(e.supportsUpload)return this.featureTemplatesViewModel.select(t,{emit:!1}),this.startCreateFeaturesWorkflow(a);this.startCreateFeaturesWorkflowAtFeatureCreation(a)})),w((()=>[this.view,this.featureTemplatesViewModel]),(([e,t])=>{t.view=e}),y),f((()=>this.view),"key-down",(e=>{"Escape"===e.key&&this.activeWorkflow?.keyboardCancellationEnabled&&(e.stopPropagation(),this.back())})),f((()=>this.sketchViewModel),["create","delete","update"],(e=>{const{activeWorkflow:t}=this,i="update"===t?.type,a=G(t),r=i?t?.activeWorkflow?.parentLayer:void 0,s=`sketch-${e.type}`;this.emit(s,{type:s,detail:e,layer:a[0],layers:a,parentLayer:r})}),k),w((()=>this.view),(e=>{if(this._snappingManager=c(this._snappingManager),!e)return;const t=this.snappingOptions;this._snappingManager=new U({view:e,options:t}),this.ownSketchViewModel.snappingManager=this._snappingManager}),y),w((()=>this.snappingOptions),(e=>{this._snappingManager&&(this._snappingManager.options=e)}),y),f((()=>this.selectionToolbarViewModel),"complete",(e=>this._onSelectionComplete(e))),w((()=>({view:this.view,selectionManager:this.effectiveSelectionManager,selectionListViewModel:this.selectionListViewModel,selectionToolbarViewModel:this.selectionToolbarViewModel})),(({view:e,selectionManager:t,selectionListViewModel:i,selectionToolbarViewModel:a})=>{t.view=e,i.view=e,a.view=e}),y),w((()=>this.effectiveSelectionManager),(e=>{this.selectionListViewModel.selectionManager=e,this.selectionToolbarViewModel.selectionManager=e}),y)])}destroy(){this._cancelWorkflow({warnIfNoWorkflow:!1}).then((()=>{this.view?.map?.remove(this._sketchGraphicsLayer),this.view=null})),this._updateItemsTask=p(this._updateItemsTask),this._updatingHandles.destroy(),this._sketchEventListenerHandle=d(this._sketchEventListenerHandle),this.selectionManager.destroy()}get _featureTemplatesLayersAndTables(){const e=new a;for(const t of this.editorItems){const i=this.hideTemplatesForInactiveLayers&&!t.visible;t.supportsCreateFeaturesWorkflow&&!i&&e.push(t.layer)}return e}get _selectionSources(){const e=new a;for(const t of this.editorItems)O(t.layer)&&t.supportsUpdateWorkflow&&t.visible&&e.push(t.layer);return e}get activeFeatureCount(){const e=this.activeLeafWorkflow;return D(e)?e.pendingFeatures.length:x(e)&&e.data.edits.feature?1:B(e)?e.data.features.length:0}get activeLeafWorkflow(){const e=this.activeWorkflow;return e&&q(e)?e.activeWorkflow??e:e}get canCreate(){return this.editorItems.some((e=>e.supportsCreateFeaturesWorkflow))}get canCreateVisible(){return!!this.featureTemplatesLayers.length}get canUpdate(){return this.editorItems.some((e=>e.supportsUpdateWorkflow))}get canUpdateVisible(){return this.editorItems.some((e=>e.supportsUpdateWorkflow&&e.visible))}get featureTemplatesLayers(){return this._featureTemplatesLayersAndTables.filter((e=>"scene"===e.type||!e.isTable))}get effectiveSelectionManager(){return this.selectionManager}get featureFormViewModel(){const{activeWorkflow:e}=this;return"update"===e?.type?e.activeFeatureFormViewModel:"create-features"===e?.type?e.featureFormViewModel:null}get formViewModel(){const{activeWorkflow:e}=this;return"update"===e?.type?e.activeFeatureFormViewModel:"create-features"===e?.type?e.featureFormViewModel:"update-features"===e?.type?e.formViewModel:null}get utilityNetworkAssociationAddAssociationViewModel(){const{activeWorkflow:e}=this;return"update"===e?.type?e.activeUtilityNetworkAssociationAddAssociationViewModel:null}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get sketchViewModel(){const{activeWorkflow:e}=this;return"update"===e?.type?e.activeSketchViewModel:"create-features"===e?.type?e.sketchViewModel:this.ownSketchViewModel}get state(){if(!this.view?.ready)return"disabled";const e=this.attachmentsViewModel.mode;if("add"===e)return"adding-attachment";if("edit"===e)return"editing-attachment";const{activeWorkflow:t}=this,i=!t?.stepId;return this.effectiveSelectionManager.count&&i?"viewing-selection-list":i?"ready":"update"===t.type&&t.activeWorkflow?.stepId?t.activeWorkflow.stepId:t.stepId}get syncing(){return this._activityQueue.length>0}get updating(){return this._updatingHandles.updating||!0===this.activeWorkflow?.updating}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}set view(e){this.ownSketchViewModel.view=e,this.spinnerViewModel.view=e,this._set("view",e)}get canZoomTo(){const e=this.sketchViewModel,t=e?.createGraphic?.geometry?.type;return!(!e?.updateGraphics?.length&&"multipoint"!==t)}get page(){const{activeWorkflow:e,state:t}=this;if("update"===e?.type&&null!=e?.activeWorkflow?.featureFormViewModel?.associatedLayer)return"viewing-associated-features";if("update"===e?.type&&null!=e?.activeWorkflow?.featureFormViewModel?.associationId)return"viewing-associated-layers";if("update"===e?.type&&"awaiting-feature-to-update"===e.stepId)return"ready";if("create-features"===e?.type&&0===e.numPendingFeatures){const t=e.data.upload;if(t)return"default"===t.state?"ready":"creating-features-upload-details"}return t??"disabled"}get featureFormDisabled(){const{activeWorkflow:e}=this;return"update"===e?.type&&(!1===e.activeEditorItem?.capabilities.update.attributes||!0===e.activeFeatureFormViewModel?.disabled)}get featureFormHasAssociation(){return!!this.featureFormViewModel?.activeAssociation}get canGoBack(){return null!=this.activeWorkflow&&!this.syncing}get shouldShowDeleteButton(){const{activeWorkflow:e}=this;return!this.featureFormDisabled&&(q(e)&&e.activeEditorItem?.capabilities.delete.enabled||B(e)&&e.data.editorItems.every((e=>e.capabilities.delete.enabled)))}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}get snappingManager(){return this._snappingManager}getTemplatesForLayer(e){return this._templatesByLayer.get(e)??[]}async startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.startCreateFeaturesWorkflow()}async startCreateFeaturesWorkflowAtFeatureCreation(e){return this.startCreateFeaturesWorkflow(e,"creating-features")}async startCreateFeaturesWorkflow(e,t="awaiting-feature-creation-info"){if(await v((()=>!this.updating)),!this.canCreate)throw new s("editing:unsupported-workflow","Creating features is unsupported or disabled.");const i=this._createUpdatingResolver();try{await this._cancelWorkflow();const i=this._createCreateFeaturesWorkflow(e,t);this._set("activeWorkflow",i),await i.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{i.resolve()}}async startCreateFeaturesWorkflowAtFeatureEdit(e){await v((()=>!this.updating));const t=this._createUpdatingResolver();try{const{initialFeature:t}=e,i=t.sourceLayer=t.layer,a=i?this.findEditorItemForLayer(i):void 0;if(!a?.supportsCreateFeaturesWorkflow)throw new s("editing:unsupported-workflow","Creating features is unsupported or disabled for this layer.");await this._cancelWorkflow();const r=this._createCreateFeaturesWorkflow({initialFeature:t,layer:a.layer,maxFeatures:1},"creating-features");this._set("activeWorkflow",r),await r.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startUpdateFeaturesWorkflow(e){if(await v((()=>!this.updating)),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update features workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow();const t=this._createUpdateFeaturesWorkflow(e);this._set("activeWorkflow",t),await t.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startUpdateWorkflowAtFeatureSelection(){if(await v((()=>!this.updating)),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const e=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateWorkflow();this._set("activeWorkflow",e),await e.start()}catch(t){this._logErrorAndCancelWorkflow(t)}finally{e.resolve()}}async startUpdateWorkflowAtMultipleFeatureSelection(e){if(await v((()=>!this.updating)),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow();const t=this._createUpdateWorkflow("awaiting-update-feature-candidate");t.data.candidates=e,this._set("activeWorkflow",t),await t.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startUpdateWorkflowAtFeatureEdit(e){if(await v((()=>!this.updating)),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow();const t=this._createUpdateWorkflow("editing-existing-feature");t.data.rootFeature=e,t.addHandles(f((()=>t),"commit",(()=>{t.destroy(),this.activeWorkflow===t&&this._set("activeWorkflow",null)}))),this._set("activeWorkflow",t),await t.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startUpdateWorkflowWithActiveSelection(){const{selectionListViewModel:e}=this;if(!e.visibleFeatureCount)throw new s("editing:missing-selection","Unable to determine visible selection.");if(e.visibleLayerCount>1)throw new s("editing:features-different-layers","Cannot start workflow with features from different layers.");const t=e.activeLayerItem??e.layerItems.find((e=>e.total>0));if(!t)throw new s("editing:no-layer-item","Unable to determine source layer of active selection.");const i=t.selection.map((e=>e.graphic));1===i.length?this.startUpdateWorkflowAtFeatureEdit(i[0]):this.startUpdateFeaturesWorkflow(i)}async deleteFeatureFromWorkflow(){r(l.getLogger(this),"EditorViewModel.deleteFeatureFromWorkflow is deprecated. Use EditorViewModel.deleteFeatures instead.",{version:"4.33",replacement:"EditorViewModel.deleteFeatures",warnOnce:!0}),await this.deleteFeatures()}async deleteFeatures(){const e=this.activeWorkflow;return q(e)?e.deleteActiveFeature():B(e)?e.deleteAndCommit():void this._logError("editing:unsupported-workflow","Deleting features requires an active update workflow.")}async deleteAssociationFromWorkflow(){const{activeWorkflow:e}=this;e&&"update"===e.type?await e.deleteActiveAssociation():this._logError("editing:unsupported-workflow","Deleting an association requires an active update workflow.")}async cancelWorkflow(e){return this._cancelWorkflow({warnIfNoWorkflow:!0,...e})}findEditorItemForLayer(e){return this.editorItems.find((t=>t.layer===e))}itemHasInvalidFormTemplate(e){return null!=e&&!0===this.findEditorItemForLayer(e.layer)?.hasInvalidFormTemplate}syncFeatureTemplates(){this._featureTemplatesViewModelIsRestricted||this._updateTemplates()}zoomTo(e){const i=this.sketchViewModel,a=e?e.geometry:i?.updateGraphics.length?i?.updateGraphics.toArray().map((e=>e.geometry)).filter(t):i?.createGraphic?.geometry;a&&this.view&&K(this.view,a)}async toggleUpdateWorkflow(){this.canUpdate&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(this.activeWorkflow&&"awaiting-feature-to-update"===this.state?await this.cancelWorkflow({force:!0}):await this.startUpdateWorkflowAtFeatureSelection()))}async onSelectionListItemSelect(e){X(e)&&this.startUpdateWorkflowAtFeatureEdit(e.graphic)}async onSelectionListMenuItemSelect(e){if(X(e))this.startUpdateWorkflowAtFeatureEdit(e.graphic);else if(Y(e)){const t=e.selection.map((e=>e.graphic));1===t.length?this.startUpdateWorkflowAtFeatureEdit(t[0]):this.startUpdateFeaturesWorkflow(t)}}restrictFeatureTemplatesViewModelToLayer(e){return this._featureTemplatesViewModelIsRestricted=!0,this._setFeatureTemplatesViewModelLayers([e]),n((()=>{this._featureTemplatesViewModelIsRestricted=!1,this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)}))}async _getEditorItemCandidates(e){const{view:t}=this;if(!t?.map)return[];const{map:i}=t,a=i.editableLayers.toArray(),r=i.allTables.toArray().filter((e=>V(e)||T(e)));return await Promise.allSettled([...a.flatMap((e=>this._getLayerLoadPromise(e))),...r.flatMap((e=>this._getLayerLoadPromise(e)))]),u(e),[...a.reverse(),...r.reverse()].filter((e=>b(e)&&("mesh"!==e.geometryType||"3d"===t.type))).flatMap((e=>"subtype-group"===e.type?e.sublayers.toArray():e))}_getLayerLoadPromise(e){return T(e)?e.loadAll():e.load()}_drainEditorItems(){this.editorItems.drain((e=>e.destroy()))}_updateEditorItems(){p(this._updateItemsTask);const{view:e}=this,t=i((async t=>{if(!e?.map||!e?.allLayerViews)return;const i=await this._getEditorItemCandidates(t);if(!i.length)return void this._drainEditorItems();const a=[],r=[],s=[],{layerInfos:o}=this;for(const l of i){const t=ie(o,l),i=await N(e,l).catch((()=>null));(t?a:i?r:s).push(new Q({layer:l,layerInfo:t,layerView:i}))}o?.length&&a.sort(((e,t)=>o.findIndex((({layer:t})=>t===e.layer))-o.findIndex((({layer:e})=>e===t.layer))));const n=[...a,...r,...s];t.aborted||(this._drainEditorItems(),this.editorItems.addMany(n))}));this._updatingHandles.addPromise(t.promise),this._updateItemsTask=t}_updateTemplates(){p(this._updateTemplatesTask);const e=i((async e=>{const t=this._templatesByLayer,i=this._featureTemplatesLayersAndTables.filter((e=>!t.has(e)));if(i.length>0){const a=await F(i.toArray(),this.view,e);for(const{layer:e,templates:i}of a)t.set(e,i)}this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)}));this._updatingHandles.addPromise(e.promise),this._updateTemplatesTask=e}_setFeatureTemplatesViewModelLayers(e){const t=this._templatesByLayer,i=[];for(const a of e){const e=t.get(a);e&&e.length>0&&i.push(z(a,e))}this.featureTemplatesViewModel.templateInfos=i}_afterEditorItemsChange(){const{activeWorkflow:e}=this;if(this.syncFeatureTemplates(),!e)return;const{stepId:t}=e;"create-features"!==e.type?"update"===e.type&&("awaiting-feature-to-update"===t&&!this.canUpdateVisible||"awaiting-update-feature-candidate"===t&&!e.hasUpdatableCandidates)&&this._cancelWorkflow():"awaiting-feature-creation-info"!==t||this.canCreate||this._cancelWorkflow()}async _cancelWorkflow(e){const t=this.activeWorkflow;if(!t)return void(e?.warnIfNoWorkflow&&this._logError("editing:no-active-workflow","There is no active workflow to cancel."));if(!e||!1!==e.force){this.emit("workflow-cancel"),this._set("activeWorkflow",null);try{await t.cancel(e)}finally{t.destroy()}}else try{await t.cancel(e),this._set("activeWorkflow",null),t.destroy()}catch(i){}}_createCreateFeaturesWorkflow(e,t){return P.create({viewModel:this,creationInfo:e,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:t,applyEditsCallback:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureServiceCallback:(e,t,i)=>this._applyEditsFeatureService(e,t,i),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)})}_createUpdateFeaturesWorkflow(e){const t=R.create({viewModel:this,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,features:e,applyEdits:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureService:(e,t,i)=>this._applyEditsFeatureService(e,t,i)});return t.addHandles(f((()=>t),"commit",(()=>{t.destroy(),this.activeWorkflow===t&&this._set("activeWorkflow",null)}))),t}_createUpdateWorkflow(e){return H.create({viewModel:this,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:e,applyEditsCallback:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureServiceCallback:(e,t,i)=>this._applyEditsFeatureService(e,t,i),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)})}_addAttachments(e,t){const i=t.map((t=>this._addAttachment(e,t.feature,t.attachment)))??[];return Promise.all(i)}async _addAttachment(e,t,i){let a=null;if(!("addAttachment"in e)||null==e.capabilities?.attachment)throw new s("editor:attachments-not-supported","Adding attachments is not supported for this layer type");return await this._queueOperation((async()=>(a=await(e.addAttachment?.(t,i).catch((e=>{throw e?.error||e})))??null,a))),a}async _applyEdits(e,t,i){let a=null;const r=e.url?await I(e.url):null,s={returnServiceEditsOption:(!r||!L(r))&&!RegExp("/hosted/","i").test(e.url)?"original-and-current-features":void 0,...i};return await this._queueOperation((async()=>{const{view:i}=this;if(!i)return null;const r=await N(i,e).catch((()=>null));return a=await e.applyEdits(t,s),r&&await v((()=>!r.updating)),a})),a}async _applyEditsFeatureService(e,t,i){let a=null;return await this._queueOperation((async()=>a=await e.applyEdits(t,i))),a}_queueOperation(e){this._activityQueue.push(e);const t=(e,t)=>{const i=t.indexOf(e);i>-1&&t.splice(i,1)};return e().then((e=>(Array.isArray(e)?e.forEach((e=>this._handleEditsResultError(e))):this._handleEditsResultError(e),e))).catch((i=>{this._logError("editing:operation-error","An error occurred.",{error:i});const a={error:i,retry:()=>(t(a,this.failures),this._queueOperation(e)),cancel:()=>{t(a,this.failures)}};this._set("failures",[...this.failures,a])})).then((()=>{t(e,this._activityQueue)}))}_handleEditsResultError(e){if(null!=e&&"error"in e&&null!=e.error)throw e.error;if(null!=e&&"addFeatureResults"in e){const{addFeatureResults:t,deleteFeatureResults:i,updateFeatureResults:a}=e,r=t.find((e=>!!e.error))||a.find((e=>!!e.error))||i.find((e=>!!e.error));if(r)throw r.error}}_createUpdatingResolver(){const e=h();return this._updatingHandles.addPromise(e.promise),e}_logErrorAndCancelWorkflow(e){const{name:t,message:i,details:a}=e;this._logError(t??"editing:workflow-start-failed",i??void 0,a??e),this._cancelWorkflow({force:!0})}_itemIsSuspended(e){const t=this.findEditorItemForLayer(e);return null!=t&&(!t.visible||t.disabled)}_logError(e,t,i){l.getLogger(this).error(new s(e,t,i))}_syncSelectionSources(){this.selectionManager.sources.items=this._selectionSources.toArray()}async _onSelectionComplete(e){if(e.aborted)return;const{operationType:t,selection:i}=e,{effectiveSelectionManager:a}=this,r="ready"===this.state,s=1===i.length;if(r&&s&&(0===a.count&&"add"===t||"replace"===t))return this.startUpdateWorkflowAtFeatureEdit(i[0]);switch(t){case"remove":a.updateSelection({current:[],added:[],removed:i});break;case"replace":a.clear(),a.updateSelection({current:i,added:[],removed:[]});break;case"add":a.updateSelection({current:i,added:[],removed:[]})}}};e([_()],ae.prototype,"_featureTemplatesLayersAndTables",null),e([_()],ae.prototype,"_snappingManager",void 0),e([_()],ae.prototype,"_selectionSources",null),e([_()],ae.prototype,"activeFeatureCount",null),e([_({readOnly:!0})],ae.prototype,"activeWorkflow",void 0),e([_()],ae.prototype,"activeLeafWorkflow",null),e([_({readOnly:!0})],ae.prototype,"_activityQueue",void 0),e([_({readOnly:!0})],ae.prototype,"canCreate",null),e([_()],ae.prototype,"canCreateVisible",null),e([_({readOnly:!0})],ae.prototype,"canUpdate",null),e([_()],ae.prototype,"canUpdateVisible",null),e([_()],ae.prototype,"featureTemplatesLayers",null),e([_()],ae.prototype,"editorItems",void 0),e([_()],ae.prototype,"effectiveSelectionManager",null),e([_({readOnly:!0})],ae.prototype,"failures",void 0),e([_()],ae.prototype,"hideTemplatesForInactiveLayers",void 0),e([_({type:j})],ae.prototype,"attachmentsViewModel",void 0),e([_()],ae.prototype,"featureFormViewModel",null),e([_()],ae.prototype,"formViewModel",null),e([_()],ae.prototype,"utilityNetworkAssociationAddAssociationViewModel",null),e([_({type:Z})],ae.prototype,"featureTemplatesViewModel",void 0),e([_()],ae.prototype,"labelOptions",null),e([_()],ae.prototype,"layerInfos",void 0),e([_()],ae.prototype,"ownSketchViewModel",void 0),e([_()],ae.prototype,"selectionListViewModel",void 0),e([_()],ae.prototype,"selectionManager",void 0),e([_()],ae.prototype,"selectionToolbarViewModel",void 0),e([_()],ae.prototype,"sketchOptions",void 0),e([_()],ae.prototype,"sketchViewModel",null),e([_({type:C,nonNullable:!0})],ae.prototype,"snappingOptions",void 0),e([_()],ae.prototype,"spinnerViewModel",void 0),e([_()],ae.prototype,"state",null),e([_({readOnly:!0})],ae.prototype,"syncing",null),e([_()],ae.prototype,"updating",null),e([_()],ae.prototype,"tooltipOptions",null),e([_()],ae.prototype,"valueOptions",null),e([_()],ae.prototype,"view",null),e([_()],ae.prototype,"canZoomTo",null),e([_()],ae.prototype,"pageStack",void 0),e([_()],ae.prototype,"showDiscardEditsPrompt",void 0),e([_()],ae.prototype,"_candidateCommitted",void 0),e([_()],ae.prototype,"page",null),e([_()],ae.prototype,"featureFormDisabled",null),e([_()],ae.prototype,"featureFormHasAssociation",null),e([_()],ae.prototype,"canGoBack",null),e([_()],ae.prototype,"shouldShowDeleteButton",null),e([_()],ae.prototype,"hasPendingEdits",null),e([_()],ae.prototype,"snappingManager",null),ae=e([W("esri.widgets.Editor.EditorViewModel")],ae);const re=ae;export{re as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Error.js";import{abortHandle as r}from"../../../core/handleUtils.js";import{debounce as a}from"../../../core/promiseUtils.js";import{whenOnce as o,watch as n}from"../../../core/reactiveUtils.js";import{first as l}from"../../../core/SetUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../core/support/UpdatingHandles.js";import d from"../../../layers/GraphicsLayer.js";import u from"../../../views/interactive/sketch/SketchOptions.js";import{getVisualVariablesForLayer as y,updateGraphicSymbolWhenRequired as m,setVisualVariablesAndElevationInfoForUpdate as w,swapForEditingSession as g,visualVariableInteractiveUpdate as f,getSizeVariableAttribute as v,getRotationVariableAttribute as _}from"../workflowUtils.js";import b from"../../Sketch/SketchViewModel.js";const k=Symbol();let L=class extends t{constructor(e){super(e),this.features=[],this.sketchOptions=new u,this.snappingManager=null,this.sourceLayer=null,this.view=null,this.viewModel=null,this._sketchGraphics=new Map,this._sketchLayer=null,this._updatingHandles=new h,this._visualVariableAttributes=new Map,this._visualVariablesForLayer=null,this._webStyleCache=new Map}async initialize(){this._visualVariablesForLayer=y(this.sourceLayer),this._initializeSketchGraphics(),this._initializeSketchLayer(),await this._updatingHandles.addPromise(this._initializeSketchViewModel())}destroy(){const{_sketchLayer:e,view:t}=this;t?.destroyed||t?.map.remove(e),e.destroy(),this.viewModel.destroy()}get updating(){return this._updatingHandles.updating}async enter(){throw new Error("enter() not implemented")}async exit(){throw new Error("exit() not implemented")}notifyAttributesChanged({features:e,fieldName:t}){const i=this._webStyleCache,s=this.view.scale,r=this._updatingHandles;for(const a of e){const e=this._sketchGraphics.get(a),o=a.getAttribute(t);if(!e||e.getAttribute(t)===o)continue;e.setAttribute(t,o);const n=this._visualVariableAttributes.get(a);null==n?.size||n.size.isUpdatingInteractively||n.size.field!==t||n.size.setInitialValue(o),null==n?.rotation||n.rotation.isUpdatingInteractively||n.rotation.field!==t||n.rotation.setInitialValue(o),r.addPromise(m(e,i,s))}}async startUpdatingFeatures(e,t,s){const{_sketchGraphics:a,sourceLayer:n,view:l,viewModel:c,_webStyleCache:p}=this,h=e.map((e=>a.get(e))).filter(i),d={multipleSelectionEnabled:!1};this.removeHandles(k),c.complete();let u=null;if(1===e.length){const t=e[0],i=this._visualVariableAttributes.get(t);!(!i?.rotation&&!i?.size)&&(w({sketchViewModel:c,graphic:h[0],sourceLayer:n,visualVariables:i,webStyleCache:p}),"point"===n.geometryType&&(d.enableRotation=null!=i.rotation,d.enableScaling=null!=i.size,u=async e=>{const r=e.graphics[0];f(l,r,e,i)&&(s?.([{feature:t,attributes:r.attributes}],e),await m(r,p,"2d"===l.type?l.scale:null))}))}const y=()=>c.update(h,d),g=c.on("update",(s=>{if("complete"===s.state){if(null===l.activeTool)return void y();const e=new AbortController,t=r(e);return this.addHandles(t,k),void this._updatingHandles.addPromise(o((()=>null===l.activeTool),e.signal).then((async()=>{e.signal.aborted||(e.abort(),await y())})))}const n=e.map((e=>{const t=a.get(e);return t?{feature:e,geometry:t.geometry}:null})).filter(i);t(n,s),u?.(s)}));await y(),this.addHandles(g,k),c.addHandles(g)}_initializeSketchGraphics(){const{features:e,_sketchGraphics:t,sourceLayer:i,_visualVariableAttributes:s}=this,r=this._visualVariablesForLayer,a=r.rotation?.field,o=r.size?.field,n={rotation:a?i.getField(a):null,size:o?i.getField(o):null},l=!(!n.rotation&&!n.size);for(const c of e)t.set(c,c.clone()),l&&s.set(c,z(r,n))}_initializeSketchLayer(){const{view:e}=this,t=new d({elevationInfo:this.sourceLayer.elevationInfo,internal:!0,listMode:"hide"});this._sketchLayer=t,e.map.add(t),this._updatingHandles.addPromise(e.whenLayerView(t))}async _initializeSketchViewModel(){const{_sketchGraphics:e,view:t,_webStyleCache:i}=this,s=Array.from(e.entries()),r=new b({allowDeleteKey:!1,layer:this._sketchLayer,sketchOptions:this.sketchOptions,snappingManager:this.snappingManager,updateOnGraphicClick:!1,view:this.view});this.viewModel=r;const o=a((e=>Promise.all(s.map((([,t])=>m(t,i,e))))));await o("2d"===t.type?t.scale:null),"2d"===t.type&&this.addHandles(n((()=>t.scale),(e=>o(e)))),this.addHandles(await Promise.all(s.map((([e,t])=>g(r,e,t)))))}};function S({features:e,sketchOptions:t,snappingManager:i,view:r}){const a=new Set(e.map((e=>e.sourceLayer)));if(1!==a.size)throw new s("editor:features-must-belong-to-same-layer","All features must belong to the same layer.");const o=l(a);return new L({view:r,features:e,sketchOptions:t,snappingManager:i,sourceLayer:o})}function z({rotation:e,size:t},i){return{rotation:e?_(e,i.rotation):null,size:t?v(t,i.size):null}}e([c()],L.prototype,"features",void 0),e([c()],L.prototype,"sketchOptions",void 0),e([c()],L.prototype,"snappingManager",void 0),e([c()],L.prototype,"sourceLayer",void 0),e([c()],L.prototype,"updating",null),e([c()],L.prototype,"view",void 0),e([c()],L.prototype,"viewModel",void 0),e([c()],L.prototype,"_sketchGraphics",void 0),e([c()],L.prototype,"_sketchLayer",void 0),e([c()],L.prototype,"_visualVariablesForLayer",void 0),L=e([p("esri.widgets.Editor.support.SketchController")],L);export{L as SketchController,S as createSketchController};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Error.js";import{abortHandle as r}from"../../../core/handleUtils.js";import{debounce as a}from"../../../core/promiseUtils.js";import{whenOnce as o,watch as n}from"../../../core/reactiveUtils.js";import{first as l}from"../../../core/SetUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../core/support/UpdatingHandles.js";import d from"../../../layers/GraphicsLayer.js";import u from"../../../views/interactive/sketch/SketchOptions.js";import{getVisualVariablesForLayer as y,updateGraphicSymbolWhenRequired as m,setVisualVariablesAndElevationInfoForUpdate as w,swapForEditingSession as g,visualVariableInteractiveUpdate as f,getSizeVariableAttribute as v,getRotationVariableAttribute as _}from"../workflowUtils.js";import b from"../../Sketch/SketchViewModel.js";const k=Symbol();let L=class extends t{constructor(e){super(e),this.features=[],this.sketchOptions=new u,this.snappingManager=null,this.sourceLayer=null,this.view=null,this.viewModel=null,this._sketchGraphics=new Map,this._sketchLayer=null,this._updatingHandles=new h,this._visualVariableAttributes=new Map,this._visualVariablesForLayer=null,this._webStyleCache=new Map}async initialize(){this._visualVariablesForLayer=y(this.sourceLayer),this._initializeSketchGraphics(),this._initializeSketchLayer(),await this._updatingHandles.addPromise(this._initializeSketchViewModel())}destroy(){const{_sketchLayer:e,view:t}=this;t?.destroyed||t?.map.remove(e),e.destroy(),this.viewModel.destroy()}get updating(){return this._updatingHandles.updating}async enter(){throw new Error("enter() not implemented")}async exit(){throw new Error("exit() not implemented")}notifyAttributesChanged({features:e,fieldName:t}){const i=this._webStyleCache,s=this.view.scale,r=this._updatingHandles;for(const a of e){const e=this._sketchGraphics.get(a),o=a.getAttribute(t);if(!e||e.getAttribute(t)===o)continue;e.setAttribute(t,o);const n=this._visualVariableAttributes.get(a);null==n?.size||n.size.isUpdatingInteractively||n.size.field!==t||n.size.setInitialValue(o),null==n?.rotation||n.rotation.isUpdatingInteractively||n.rotation.field!==t||n.rotation.setInitialValue(o),r.addPromise(m(e,i,s))}}async startUpdatingFeatures(e,t,s){const{_sketchGraphics:a,sourceLayer:n,view:l,viewModel:c,_webStyleCache:p}=this,h=e.map((e=>a.get(e))).filter(i),d={};this.removeHandles(k),c.complete();let u=null;if(1===e.length){const t=e[0],i=this._visualVariableAttributes.get(t);!(!i?.rotation&&!i?.size)&&(w({sketchViewModel:c,graphic:h[0],sourceLayer:n,visualVariables:i,webStyleCache:p}),"point"===n.geometryType&&(d.enableRotation=null!=i.rotation,d.enableScaling=null!=i.size,u=async e=>{const r=e.graphics[0];f(l,r,e,i)&&(s?.([{feature:t,attributes:r.attributes}],e),await m(r,p,"2d"===l.type?l.scale:null))}))}else d.tool="move";const y=()=>c.update(h,d),g=c.on("update",(s=>{if("complete"===s.state){if(null===l.activeTool)return void y();const e=new AbortController,t=r(e);return this.addHandles(t,k),void this._updatingHandles.addPromise(o((()=>null===l.activeTool),e.signal).then((async()=>{e.signal.aborted||(e.abort(),await y())})))}const n=e.map((e=>{const t=a.get(e);return t?{feature:e,geometry:t.geometry}:null})).filter(i);t(n,s),u?.(s)}));await y(),this.addHandles(g,k),c.addHandles(g)}_initializeSketchGraphics(){const{features:e,_sketchGraphics:t,sourceLayer:i,_visualVariableAttributes:s}=this,r=this._visualVariablesForLayer,a=r.rotation?.field,o=r.size?.field,n={rotation:a?i.getField(a):null,size:o?i.getField(o):null},l=!(!n.rotation&&!n.size);for(const c of e)t.set(c,c.clone()),l&&s.set(c,z(r,n))}_initializeSketchLayer(){const{view:e}=this,t=new d({elevationInfo:this.sourceLayer.elevationInfo,internal:!0,listMode:"hide"});this._sketchLayer=t,e.map.add(t),this._updatingHandles.addPromise(e.whenLayerView(t))}async _initializeSketchViewModel(){const{_sketchGraphics:e,view:t,_webStyleCache:i}=this,s=Array.from(e.entries()),r=new b({allowDeleteKey:!1,defaultUpdateOptions:{multipleSelectionEnabled:!1},layer:this._sketchLayer,sketchOptions:this.sketchOptions,snappingManager:this.snappingManager,updateOnGraphicClick:!1,view:this.view});this.viewModel=r;const o=a((e=>Promise.all(s.map((([,t])=>m(t,i,e))))));await o("2d"===t.type?t.scale:null),"2d"===t.type&&this.addHandles(n((()=>t.scale),(e=>o(e)))),this.addHandles(await Promise.all(s.map((([e,t])=>g(r,e,t)))))}};function S({features:e,sketchOptions:t,snappingManager:i,view:r}){const a=new Set(e.map((e=>e.sourceLayer)));if(1!==a.size)throw new s("editor:features-must-belong-to-same-layer","All features must belong to the same layer.");const o=l(a);return new L({view:r,features:e,sketchOptions:t,snappingManager:i,sourceLayer:o})}function z({rotation:e,size:t},i){return{rotation:e?_(e,i.rotation):null,size:t?v(t,i.size):null}}e([c()],L.prototype,"features",void 0),e([c()],L.prototype,"sketchOptions",void 0),e([c()],L.prototype,"snappingManager",void 0),e([c()],L.prototype,"sourceLayer",void 0),e([c()],L.prototype,"updating",null),e([c()],L.prototype,"view",void 0),e([c()],L.prototype,"viewModel",void 0),e([c()],L.prototype,"_sketchGraphics",void 0),e([c()],L.prototype,"_sketchLayer",void 0),e([c()],L.prototype,"_visualVariablesForLayer",void 0),L=e([p("esri.widgets.Editor.support.SketchController")],L);export{L as SketchController,S as createSketchController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../chunks/tslib.es6.js";import s from"../../core/Accessor.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";let t=class extends s{constructor(o){super(o),this.associationDetails=!0}};o([r({type:Boolean,nonNullable:!0})],t.prototype,"associationDetails",void 0),t=o([e("esri.widgets.FeatureForm.VisibleElements")],t);const c=t;export{c as default};
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import s from"../../core/Accessor.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";let t=class extends s{constructor(o){super(o),this.associationDetails=!0,this.readOnlyNotice=!0}};o([e({type:Boolean,nonNullable:!0})],t.prototype,"associationDetails",void 0),o([e({type:Boolean,nonNullable:!0})],t.prototype,"readOnlyNotice",void 0),t=o([r("esri.widgets.FeatureForm.VisibleElements")],t);const a=t;export{a as default};