@arcgis/core 4.33.0-next.20250424 → 4.33.0-next.20250425

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 (115) hide show
  1. package/analysis/Analysis.js +1 -1
  2. package/analysis/support/AnalysisOriginWebScene.d.ts +1 -1
  3. package/analysis/support/AnalysisOriginWebScene.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/070839cb71c8e764b8d7.js +1 -0
  6. package/assets/esri/core/workers/chunks/19084a293694c5a00cae.js +1 -0
  7. package/assets/esri/core/workers/chunks/{5958af341014e13475d2.js → 2bed8a5ed9ae3760fa2f.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{7ffa68d69c138db1295d.js → 2e3019ce49e972a815ca.js} +1 -1
  9. package/assets/esri/core/workers/chunks/38f5e6a202ce292edd9f.js +1 -0
  10. package/assets/esri/core/workers/chunks/415903f481392c72870f.js +1 -0
  11. package/assets/esri/core/workers/chunks/4351b3e54b309935faed.js +1 -0
  12. package/assets/esri/core/workers/chunks/4da99f058cca83937e9b.js +1 -0
  13. package/assets/esri/core/workers/chunks/5acdd49c5f1a49fdc6e7.js +1 -0
  14. package/assets/esri/core/workers/chunks/968f2f841c011095a6d2.js +1 -0
  15. package/assets/esri/core/workers/chunks/a2676f3f135ad5fdf872.js +1 -0
  16. package/assets/esri/core/workers/chunks/a8430e1e2142f1ce9b92.js +1 -0
  17. package/assets/esri/core/workers/chunks/b53300b46646cfad2526.js +319 -0
  18. package/assets/esri/core/workers/chunks/bf543bdec3da0fe278fb.js +1 -0
  19. package/assets/esri/core/workers/chunks/f52e597dca4b32a81881.js +1 -0
  20. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  21. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  22. package/chunks/ShadowCastAccumulate.glsl.js +13 -9
  23. package/chunks/ShadowCastVisualize.glsl.js +24 -9
  24. package/chunks/lyr3DMain.js +1 -1
  25. package/chunks/lyr3DWorker.js +1 -1
  26. package/interfaces.d.ts +200 -5
  27. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  28. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  29. package/layers/ParquetLayer.js +1 -1
  30. package/layers/mixins/ImageryTileMixin.js +1 -1
  31. package/layers/support/ParquetEncodingLocation.d.ts +4 -0
  32. package/layers/support/ParquetEncodingLocation.js +1 -1
  33. package/layers/support/ParquetEncodingWkb.d.ts +4 -0
  34. package/layers/support/ParquetEncodingWkb.js +1 -1
  35. package/layers/support/RasterStorageInfo.js +1 -1
  36. package/layers/support/layerUtils.js +1 -1
  37. package/layers/support/parquetUtils.d.ts +3 -0
  38. package/layers/support/parquetUtils.js +1 -1
  39. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  40. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  41. package/layers/support/rasterDatasets/RawBlockCache.js +1 -1
  42. package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
  43. package/package.json +2 -2
  44. package/portal/schemas/definitions.js +1 -1
  45. package/portal/schemas/integratedMesh3DTilesLayerItem.js +1 -1
  46. package/support/revision.js +1 -1
  47. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  48. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  49. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  50. package/views/2d/layers/support/MediaLayerInteraction.js +1 -1
  51. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  52. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  53. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  54. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  55. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  56. package/views/3d/layers/Lyr3DWorker.js +1 -1
  57. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  58. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  59. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  60. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
  61. package/views/3d/layers/graphics/pipeline/PipelineCommand.js +1 -1
  62. package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
  63. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  64. package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
  65. package/views/3d/layers/graphics/pipeline/symbolization/Factory.js +5 -0
  66. package/views/3d/layers/graphics/pipeline/symbolization/SimpleFeatureRenderer.js +5 -0
  67. package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
  68. package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
  69. package/views/3d/layers/graphics/pipeline/symbolization/UniqueValueFeatureRenderer.js +1 -1
  70. package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
  71. package/views/3d/webgl/ManagedFBO.js +1 -1
  72. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  73. package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +7 -13
  74. package/views/3d/webgl-engine/core/shaderLibrary/util/BlendColorsPremultiplied.glsl.js +5 -0
  75. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  76. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  77. package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +1 -1
  78. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +1 -1
  79. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechniqueConfiguration.js +5 -0
  80. package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +1 -1
  81. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +1 -1
  82. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +1 -1
  83. package/views/PopupView.js +1 -1
  84. package/views/SelectionManager.js +1 -1
  85. package/views/analysis/analysisViewUtils.js +1 -1
  86. package/views/input/InputManager.js +1 -1
  87. package/views/input/ViewEvents.js +1 -1
  88. package/views/support/selectionUtils.js +1 -1
  89. package/webscene/support/analysisUtils.js +1 -1
  90. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  91. package/widgets/Editor/UpdateWorkflow.js +1 -1
  92. package/widgets/Editor/workflowUtils.js +1 -1
  93. package/widgets/ElevationProfile/ElevationProfileInteraction.js +1 -1
  94. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  95. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  96. package/widgets/FeatureTable.js +1 -1
  97. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  98. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  99. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  100. package/widgets/ShadowCast/ThresholdOptions.js +1 -1
  101. package/widgets/Sketch/SketchViewModel.js +1 -1
  102. package/widgets/VideoPlayer.js +1 -1
  103. package/widgets/support/AnalysisViewModel.js +1 -1
  104. package/assets/esri/core/workers/chunks/0a48b9734ab4c64a6f4f.js +0 -1
  105. package/assets/esri/core/workers/chunks/1427e7953c3d8c87c5e8.js +0 -1
  106. package/assets/esri/core/workers/chunks/146b3699a9e8b1f2dcc2.js +0 -1
  107. package/assets/esri/core/workers/chunks/22f604726529ee6f8c25.js +0 -1
  108. package/assets/esri/core/workers/chunks/8dd26b12c625d20196ed.js +0 -319
  109. package/assets/esri/core/workers/chunks/91f8547a13f0461045ef.js +0 -1
  110. package/assets/esri/core/workers/chunks/931275cfa2c55eb0f504.js +0 -1
  111. package/assets/esri/core/workers/chunks/9f416cc5673665f8c37c.js +0 -1
  112. package/assets/esri/core/workers/chunks/b42ecc7c3eb2fd8d1308.js +0 -1
  113. package/assets/esri/core/workers/chunks/d04efa51da9b4eb3a8a7.js +0 -1
  114. package/assets/esri/core/workers/chunks/d8474dca270b25705699.js +0 -1
  115. package/assets/esri/core/workers/chunks/ed3d1d0465f4a4d8df4a.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 e from"../../Color.js";import t from"../../Graphic.js";import{isSome as r,addMany as a,equals as n}from"../../core/arrayUtils.js";import{createTask as o}from"../../core/asyncUtils.js";import"../../core/has.js";import i from"../../core/Error.js";import{handlesGroup as s,makeHandle as l,abortHandle as c}from"../../core/handleUtils.js";import{clone as u}from"../../core/lang.js";import p from"../../core/Logger.js";import{getOrCreateMapValue as d}from"../../core/MapUtils.js";import{whenOrAbort as f,throwIfAborted as y,debounce as m,isPromiseLike as h}from"../../core/promiseUtils.js";import{watch as g,on as b,whenOnce as w}from"../../core/reactiveUtils.js";import{px2pt as v}from"../../core/screenUtils.js";import{diff as I}from"../../core/accessorSupport/diffUtils.js";import{isSharedTemplateOrMetadata as T,isSharedGroupTemplate as S,isSharedPresetTemplate as j,isStandardFeatureTemplate as F,isSharedFeatureTemplate as k,isSharedTemplate as A}from"../../editing/templateUtils.js";import{getSharedTemplateProvider as U}from"../../editing/sharedTemplates/SharedTemplateProvider.js";import V from"../../layers/GraphicsLayer.js";import{featureHasFields as L,fixFields as M,getDisplayFieldName as O}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as x}from"../../layers/support/layerUtils.js";import{calculateTolerance as z}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as q}from"../../renderers/support/lengthUtils.js";import{isRenderer as P}from"../../renderers/support/typeUtils.js";import{getTransformationType as E,TransformationType as C}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import R from"../../symbols/SimpleFillSymbol.js";import D from"../../symbols/SimpleLineSymbol.js";import G from"../../symbols/SimpleMarkerSymbol.js";import{to3D as B}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as N}from"../../symbols/support/symbolUtils.js";import{getServices as Z}from"../../undoredo/support/Services.js";import{GraphicState as Q}from"../../views/3d/layers/graphics/GraphicState.js";import{defaultDrawingMode as W}from"../../views/draw/DrawingMode.js";import{createQueryGeometry as $}from"../../views/support/drapedUtils.js";import{hitTestSelectSimilarDistance as J,filterGraphicHits as H}from"../../views/support/hitTestSelectUtils.js";import{dependencySort as K}from"./support/dependencySort.js";import{isDrawGraphicTool as X}from"../Sketch/support/sketchUtils.js";const Y=()=>p.getLogger("esri.widgets.Editor.workflowUtils");function _(e){return"update"===e.type}function ee(e){if(!(e&&"renderer"in e&&se(e.renderer)))return{rotation:null,size:null};const t=e.renderer.getVisualVariablesForType("rotation").filter((e=>(!e.axis||"heading"===e.axis)&&e.field&&!e.valueExpression)),r=e.renderer.getVisualVariablesForType("size").filter((e=>e.field&&!e.useSymbolValue&&!e.valueExpression&&E(e)===C.RealWorldSize));return{rotation:1===t.length?t[0]:null,size:1===r.length?r[0]:null}}function te(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&se(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:a}=ee(t);let n=null,o=null;if(r){const e=t.fields?.filter((e=>e.name===r.field)),a=1===e?.length?e[0]:null;n=re(r,a)}if(a){const e=t.fields?.filter((e=>e.name===a.field)),r=1===e?.length?e[0]:null;o=oe(a,r)}return{rotation:n,size:o}}function re(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,a=t?.type??"double",n={initial:0,current:0};return{field:e.field,fieldType:a,getDefaultValue:()=>Promise.resolve(0),getValue:e=>(n.current=n.initial-r*e,ie((n.current+360)%360,a)),setInitialValue:e=>{n.initial=e,n.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function ae(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function ne(e,t,r){if(null==t)return 0;const{symbol:a}=B(t);if(null==a||"web-style"===a.type||"cim"===a.type)return 0;const n=a.symbolLayers.at(0);if(!n)return 0;switch(n.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return Math.min($e.icon,(await e(n,$e.icon))[0])||$e.icon}case"text":return $e.text;case"line":return $e.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return ae(await t(n,e.scale/$e.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/$e.viewScaleSizeFactor;default:return 0}}function oe(e,t){const r=e.axis,a=t?.type??"double",n={initial:0,current:0},o=q[e.valueUnit]??1;let i;return i="area"===e.valueRepresentation?e=>(e*o/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*o/2:e=>e*o,{field:e.field,fieldType:a,getDefaultValue:async(e,t)=>ie(i(await ne(t,e,r)),a),getValue:(e,t)=>(n.initial||(n.initial=t.pixelSizeAt(t.center)),n.current=n.initial*e,ie(n.current,a)),setInitialValue:e=>{n.initial=e,n.current=0},isUpdatingInteractively:!1,displayUnit:Ke(e.valueUnit),axis:e.axis}}function ie(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function se(e){if(!P(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}async function le(e,t,r){const a=await N(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t,scale:r});null!=I(e.symbol,a)&&(e.symbol=a)}function ce(e,t){if(!e||!t)throw new Error("no geometry type");if("multipatch"===e)return{tool:"mesh",createOptions:{mode:"hybrid"}};const r=new Map;r.set("circle",{mode:"freehand"}),r.set("rectangle",{mode:"freehand"});const a={mode:W,optionsPerTool:r};if(T(t)){const n=t.defaultTool,o=S(t)?t.definition?.inputGeometryType??e:e;switch(n){case"freehand":case"stream-line":return{tool:"polyline"===o?"freehandPolyline":"freehandPolygon",createOptions:a};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:a};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===o?"polygon":"polyline",createOptions:a};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:a};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:a};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:a};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:a};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:a};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:a}}}else{const n=t.drawingTool;if("circle"===n||"ellipse"===n)return r.get("circle").preserveAspectRatio="circle"===n,{tool:"circle",createOptions:a};if("rectangle"===n)return{tool:"rectangle",createOptions:a};if("freehand"===n)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:a}}return{tool:e,createOptions:a}}async function ue(e,t,r){const{creationInfo:a,fullTemplate:n}=t;if(!a)throw new i("featureworkflow","No creation info provided.");const o=a.layer,s=Ue(n,a.attributeOverrides),{view:l}=e,c="2d"===l?.type;S(n)||j(n)||await Ve(e,o,s,r,c?l.scale:null);const{capabilities:u}=o;e.layer.elevationInfo=o.elevationInfo;const p=ce(o.geometryType,n);e.defaultCreateOptions={graphicProperties:{attributes:s,sourceLayer:o},mode:p.createOptions.mode,optionsPerTool:p.createOptions.optionsPerTool,preserveAspectRatio:p.createOptions.preserveAspectRatio,hasZ:u.data.supportsZ,defaultZ:(c?u.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==a.geometryToPlace?await e.create(p.tool):await e.place(a.geometryToPlace,{graphicProperties:{attributes:s,sourceLayer:o}})}async function pe(e){return s([await de(e),await fe(e)])}async function de({creationAttributes:e,data:t,sketchViewModel:r,view:a,webStyleCache:n}){const{creationInfo:o}=t,{fullTemplate:i}=t;if(!o||"2d"!==a?.type||S(i)||j(i))return null;const s=m((t=>Ve(r,o.layer,e,n,t)));return g((()=>a.scale),(e=>s(e)))}async function fe({data:t,sketchViewModel:r,view:a}){const{templateExecutorInfo:n}=t;if(!n)return null;const o=r.activeComponent;if(!a||!X(o))return Y().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new V({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});a.map?.add(c);const{executor:u,serviceLayersById:p}=n,d=a.theme?.accentColor??new e([255,165,0,1]);return s([b((()=>o),["cursor-update","vertex-add"],(()=>{c.removeAll();const e=o.graphic?.geometry;if(!e||!ye(e))return;const t=u(e,"digitizing");if(!h(t))for(const r of t.edits){const e=p.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=me(e,d);t&&c.add(t)}}})),l((()=>{a.map.remove(c),c.destroy()}))])}function ye(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":return e.paths[0].length>1;case"polygon":{const t=e.rings[0];return n(t.at(0),t.at(-1))?t.length>2:t.length>1}default:return!1}}function me(e,r){let a=null;switch(e.geometry?.type){case"point":case"multipoint":a=new G({angle:0,color:r,outline:new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:1}),path:"undefined",size:8,style:"circle",xoffset:0,yoffset:0});break;case"polygon":a=new R({color:r,outline:new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":a=new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:2});break;default:return null}return new t({geometry:e.geometry,symbol:a,attributes:{...e.attributes}})}async function he(e,t){const r=await Z(t).load(),a=x(e)?e.parent:e;return r.tablesAndLayersLookup.get(a)}async function ge(e,t){const r=await he(e,t);if(!r)return new Map;const a=new Map;for(const n of r.layersAndTables)d(a,n.layerId,(()=>[])).push(n);return a}function be(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function we(e){const{edits:t,serviceInfo:a,view:n,findOriginalFeature:o}=e,i=ve(a.layersAndTables),s=a.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=Te(t,i,o),p=Se(l,Ie(s,c),c);if(ke(l,p,n),0===p.length)return t;const d=K(p,{continueOnCircularDependency:!0}).map((e=>u.get(e))).filter(r),f=new Map;for(const r of d)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of d){const{layer:e}=r;switch(null==h?h=be(e):h.id!==e.layerId&&(m.push(h),h=be(e)),r.operationType){case"add":case"modify":h.addFeatures.push(r.after);break;case"delete":h.deleteFeatures.push(r.before)}}null!==h&&m.push(h);for(const r of y){const e=r.layer.layerId,t=m.find((t=>t.id===e))??be(r.layer);switch(m.includes(t)||m.push(t),r.operationType){case"add":t.addFeatures.push(r.after);break;case"modify":t.updateFeatures.push(r.after);break;case"delete":t.deleteFeatures.push(r.before);break;case"deleteAttachment":t.deleteAttachments.push(r.attachmentId);break;case"addAttachment":t.addAttachments.push(r.attachment)}}for(const r of m)void 0!==r.deleteAttachments&&0===r.deleteAttachments.length&&delete r.deleteAttachments,void 0!==r.addAttachments&&0===r.addAttachments.length&&delete r.addAttachments;return m}function ve(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function Ie(e,t){const r=new Map;for(const a of e)for(const e of a.relationships??[])if(r.set(je(a,e),""),t.has(e.relatedTableId)){const n=t.get(e.relatedTableId);if(n.length>0)for(const t of n[0].layer.relationships??[])if(t.id===e.id){r.set(je(a,e),t.keyField);break}}return r}function Te(e,t,r){const a=new Map,n=[],o=new Map;let s=1;for(const l of e){const e=[],c=t.get(l.id);if(!c)throw new i("featureworkflow",`Failed to prepare applyEdits payload. Layer with id ${l.id} not found.`);for(const t of l.addFeatures??[])e.push({uniqueId:"T"+s++,operationType:"add",layer:c,after:t});for(const t of l.deleteFeatures??[])e.push({uniqueId:"T"+s++,operationType:"delete",before:t,layer:c});for(const t of l.deleteAttachments??[])e.push({uniqueId:"T"+s++,operationType:"deleteAttachment",attachmentId:t,layer:c});for(const t of l.addAttachments??[])e.push({uniqueId:"T"+s++,operationType:"addAttachment",attachment:t,layer:c});for(const t of l.updateFeatures??[])e.push({uniqueId:"T"+s++,operationType:"modify",before:r(t),after:t,layer:c});a.set(c.layerId,e);for(const t of e)n.push(t),o.set(t.uniqueId,t)}return{allEditData:n,editDataByIdMap:o,editDataByLayerIdMap:a}}function Se(e,t,r){const a=[];for(const n of e){const e=n.layer.relationships??[],{uniqueId:o}=n;for(const i of e){const e=i.keyField;if("origin"===i.role){const s=r.get(i.relatedTableId);if(!s||0===s.length)continue;const l=je(n.layer,i),c=t.get(l);if(void 0===c||""===c)continue;switch(n.operationType){case"add":for(const t of s)t!==n&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===n.after.attributes[e]&&a.push([o,t.uniqueId]));break;case"modify":if(n.before.attributes[e]!==n.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==n&&("delete"===t.operationType?t.before.attributes[c]===n.before.attributes[e]?a.push([r,o]):t.before.attributes[c]===n.after.attributes[e]&&a.push([o,r]):"add"===t.operationType?t.after.attributes[c]===n.after.attributes[e]?a.push([o,r]):t.after.attributes[c]===n.before.attributes[e]&&a.push([r,o]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===n.after.attributes[e]?a.push([o,r]):a.push([r,o]):a.push([o,r])))}break;case"delete":for(const t of s)t!==n&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===n.before.attributes[e]&&a.push([t.uniqueId,o]))}}}}return a}function je(e,t){return`${e.layerId}:${t.id}`}function Fe(e,t){return!!(t?.map&&"utilityNetworks"in t.map&&t.map.utilityNetworks?.length&&t.map.utilityNetworks.some((t=>!(!t.loaded||!e.url?.startsWith(t.featureServiceUrl)||e.layerId!==t.networkSystemLayers.associationsTableId))))}function ke(e,t,r){const a=[];for(const o of e)Fe(o.layer,r)&&a.push(o);if(0===a.length)return;let n=[];for(const o of a){const r=o.layer;switch(o.operationType){case"delete":n=[...Ae(o.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ae(o.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of n)t.push([o.uniqueId,e.uniqueId]);break;case"add":n=[...Ae(o.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ae(o.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of n)t.push([e.uniqueId,o.uniqueId])}}}function Ae(e,t){const r=[],a=t.filter((({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField));for(const n of a){const t=n.layer.globalIdField;("before"in n&&n.before?.attributes[t]===e||"after"in n&&n.after?.attributes[t]===e)&&r.push(n)}return r}function Ue(e,t={}){return S(e)||j(e)?{}:F(e)?{...e.prototype.attributes,...t}:k(e)?{...e.definition?.defaultValues,...t}:{...t}}async function Ve(e,r,a,n,o){const i=new t({sourceLayer:r,attributes:a}),{rotation:s,size:l}=te(i);let c=await N(i,{useSourceLayer:!0,webStyleCache:n,scale:o}),u=!1;for(const t of[l,s]){if(null==t)continue;null==a[t.field]&&(a[t.field]=await t.getDefaultValue(c,e.view),u=!0)}switch(u&&(c=await N(i,{useSourceLayer:!0,webStyleCache:n,scale:o})),c?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=c;break;case"simple-line":case"line-3d":e.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=c;break;case"mesh-3d":e.meshSymbol=c}Le(e.tooltipOptions,l,s)}function Le(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function Me(e,t){return e?.find((e=>e.layer===t))}async function Oe(e,t,r,a){switch(t.type){case"3d":return xe(e,t,r,a);case"2d":return ze(e,t,r,a)}}async function xe(e,t,r,n){if(0===e.length)return[];const{updatable:o,graphicsByLayer:i}=await r.async((async()=>{const{results:a}=await f(J(t,r),n),o=new Map,i=e=>{const t=e.layer,r=o.get(t);if(!r){const e=new Array;return o.set(t,e),e}return r};H(a).forEach((({graphic:e})=>i(e).push(e)));const s=e.filter((({capabilities:e,layer:t})=>e.update.enabled&&o.has(t)));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:o}}));return f(Promise.allSettled(o.map((async({layer:e})=>{const t=i.get(e),r=qe(e);if(t.every((e=>L(r,e))))return t;const o=[];for(const n of t){o.push(n.getObjectId());const e=Object.keys(n.attributes);a(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=o,s.outFields=M(e.fieldsIndex,r),e.queryFeatures(s,{signal:n}).then((({features:e})=>e))}))),n)}async function ze(e,t,r,a){if(0===e.length)return[];const{mapPoint:n}=r;if(null==n)return[];let o=null;const i=await r.async((async()=>{const{results:n}=await f(t.hitTest(r),a);if(0===n.length)return[];const i=new Set;o=H(n),o.forEach((({graphic:e})=>e&&i.add(e.layer)));const s=e.filter((e=>i.has(e.layer)&&e.supportsUpdateWorkflow));return s.length>0&&r.stopPropagation(),s}));return f(Promise.allSettled(i.map((async({layer:e})=>{const i=e.createQuery();i.returnGeometry=!0,i.outFields=qe(e);const s="renderer"in e?z({renderer:e.renderer,pointerType:r.pointerType}):0;i.geometry=$(n,s,t),i.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(i,{signal:a});return o?.forEach((({graphic:t})=>{t.layer!==e||l.some((e=>e.getObjectId()===t.getObjectId()))||l.push(t)})),l}))),a)}function qe(e){return M(e.fieldsIndex,[e.objectIdField,O({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function Pe(e,t,a,n){const o=t.createQuery();o.objectIds=e.map((e=>e.getObjectId())).filter(r),o.outFields=["*"],o.returnM=t.capabilities.data.supportsM,o.returnZ=t.capabilities.data.supportsZ,"scene"===t.type&&null!=t.infoFor3D||(o.outSpatialReference=a);const i=await t.queryFeatures(o,{signal:n});return y(n),i.features}function Ee(e){const t=new Map;for(const r of e){const e=r.sourceLayer,a=x(e)?e.parent:e;d(t,a,(()=>[])).push(r)}return t}async function Ce(e){const{graphic:t,sketchViewModel:r,sourceLayer:a,visualVariables:n}=e;await Re(e);const o={multipleSelectionEnabled:!1};return"point"===a.geometryType&&(o.enableRotation=null!=n.rotation,o.enableScaling=null!=n.size),r.update(t,o)}async function Re(e){const{graphic:t,sketchViewModel:r,sourceLayer:a,visualVariables:n,webStyleCache:o}=e;let i=!1;const{rotation:s,size:l}=n;for(const c of[s,l]){if(null==c)continue;const e=t.getAttribute(c.field);if(null!=e)c.setInitialValue(e);else{const e=await c.getDefaultValue(t.symbol,r.view);c.setInitialValue(e),t.setAttribute(c.field,e),i=!0}}if(i){const e="2d"===r.view?.type?r.view.scale:null;await le(t,o,e)}Le(r.tooltipOptions,l,s),r.layer.elevationInfo=a.elevationInfo}function De(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function Ge(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function Be(e,t,r,a){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const n=t.attributes;let o=!1;const i=a.rotation,s=De(r.toolEventInfo);if(null!=i&&null!=s){const{field:r,getValue:a}=i;if("rotate-stop"===s.type)i.isUpdatingInteractively=!1,i.setInitialValue(t.getAttribute(r));else{i.isUpdatingInteractively=!0;const l=a(s.angle,e);l!==n[r]&&(t.setAttribute(r,l),o=!0)}}const l=a.size,c=Ge(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:a}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const i=a(c.xScale,e);i!==n[r]&&(t.setAttribute(r,i),o=!0)}}return o}async function Ne({feature:e,featureClone:t,visualVariableAttributes:r,sketchViewModel:a,view:n,onUpdate:o,webStyleCache:i,addUpdatingPromise:u,addHandle:p}){await le(t,i,"2d"===n.type?n.scale:null);let d=null;if("2d"===a?.view?.type){const e=m((e=>le(t,i,e)));d=g((()=>a?.view?.scale),(t=>e(t)))}const f=t.sourceLayer,y=_e(n,f);await Ce({graphic:t,sketchViewModel:a,sourceLayer:f,visualVariables:r,webStyleCache:i});let h=null;y.then((e=>h=e)).catch((()=>{}));const b=r.size,v=r.rotation,I=g((()=>e.attributes),(async e=>{let r=!1;for(const a in e){const n=e[a];n!==t.getAttribute(a)&&(t.setAttribute(a,n),null==b||b.isUpdatingInteractively||b.field!==a||b.setInitialValue(n),null==v||v.isUpdatingInteractively||v.field!==a||v.setInitialValue(n),(null==h||h.requiredFields.includes(a))&&(r=!0))}r&&await le(t,i,"2d"===n.type?n.scale:null)})),T=a.on("update",(async e=>{const t=e.graphics[0],s={graphic:t,sketchViewModel:a,sourceLayer:f,visualVariables:r,webStyleCache:i};if("complete"===e.state){if(null===n.activeTool)return Ce(s);const e=new AbortController,t=c(e);return p(t),u(w((()=>null===n.activeTool),e.signal).then((async()=>{if(!e.signal.aborted)return e.abort(),Ce(s)})))}Be(n,t,e,r)&&await le(t,i,"2d"===n.type?n.scale:null),o(tt(t),e)})),S=a.on(["undo","redo"],(async e=>{o(tt(e.graphics[0]),e)}));return s([S,T,l((()=>a.cancel())),I,d])}async function Ze(e,t,r){const a=e.view;e.layer.add(r);const n=t.sourceLayer,i=t.layer,c=t.getAttribute(i.objectIdField);let u=null;function p(e){u?.abort(),u=o((async t=>{const r=await _e(a,n);y(t),r.setVisibility?.(c,e)}))}return await We(a,r),p(!1),s([Qe(a,r,(e=>p(!e))),l((async()=>{p(!0);try{const e=await _e(a,n);await w((()=>!e.updating))}finally{e.layer.remove(r)}}))])}function Qe(e,t,r){if("3d"===e.type){const a=new Q({graphic:t});return s([e.trackGraphicState(a),g((()=>a.displaying),r)])}return g((()=>t.visible),r)}async function We(e,t){if("3d"===e.type){const r=new Q({graphic:t}),a=e.trackGraphicState(r);await w((()=>r.displaying||r.error)),a.remove()}else await w((()=>t.visible))}const $e={icon:v(24),text:v(12),line:v(1),viewScaleSizeFactor:100};function Je(e,t,r){let a=!1;return e.filter((e=>!!a||(a=e===t,a))).map((e=>r[e]()))}function He(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const a=r.layer,n=e.viewModel.getTemplatesForLayer(a);1===n.length&&"scene"!==a.type&&(r.template=n[0],t.shift())}return t}function Ke(e){return"unknown"===e?null:e}function Xe(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}const Ye=e=>/-stop/.test(e)||/vertex-/.test(e),_e=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function et(e){return"createInteractiveEditSession"in e}function tt(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=u(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function rt(e){const t=e.cursor;return e.cursor="progress",l((()=>e.cursor=t))}async function at(e,t){const{template:r}=e;if(null==r)return null;if(A(r))return r.load();if(T(r)){const e=(await import("../../editing/sharedTemplates/SharedTemplate.js")).default,a=U(t,{makeSharedTemplateFromJSON:t=>e.fromJSON(t)}),n=await a.getTemplates({templateIds:[r.templateId],featureService:r.featureService});if(0===n.length)throw new i("editor:failed-to-load-template","Unable to load the provided template");return n[0].load()}return r}function nt(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:a,sourceField:n}=t;e.setAttribute(r,a.getAttribute(n))}}function ot(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach((e=>nt(e.relationships))),t.flatMap((e=>e.edits))):null}export{ke as appendAllUtilityNetworkAssociationRelationships,He as avoidFeatureTemplateSelectionWithOnlyOneItem,et as canCreateInteractiveEditSession,tt as cloneGraphicExceptMesh,ve as createLayerIdMap,Ie as createRelationshipKeyMap,ce as createToolFromGeometryType,Je as createWorkflowSteps,Oe as fetchCandidates,Pe as fetchFullFeatures,Se as findAllDependencies,Ae as findChangesByGlobalId,Me as findLayerInfo,je as generateHashForRelationship,Ue as getCreationAttributes,at as getFullTemplateForCreationInfo,re as getRotationVariableAttribute,ot as getServiceEditsFromWorkflowData,he as getServiceInfoForLayer,ge as getServiceLayersById,oe as getSizeVariableAttribute,te as getVisualVariableAttributes,ee as getVisualVariablesForLayer,Ee as groupFeaturesByLayer,Ye as isTerminalUpdateEventType,_ as isUpdateWorkflow,Fe as isUtilityNetworkAssociationsTable,we as orderEditsByRelationshipDependencies,Xe as prepareAttachmentsForCreateFeaturesWorkflow,nt as setRelationshipFields,Ne as setUpGeometryUpdate,pe as setUpSketchCreateWatchers,Re as setVisualVariablesAndElevationInfoForUpdate,rt as showProgressCursor,$e as sizeDefaults,Ke as sizeVariableUnitToLengthUnit,ue as startCreatingNewFeature,Ce as startUpdatingFeatureGeometry,Ze as swapForEditingSession,le as updateGraphicSymbolWhenRequired,Be as visualVariableInteractiveUpdate,_e as whenEditorLayerView,We as whenGraphicDisplayed};
5
+ import e from"../../Color.js";import t from"../../Graphic.js";import{isSome as r,addMany as a,equals as n}from"../../core/arrayUtils.js";import{createTask as o}from"../../core/asyncUtils.js";import"../../core/has.js";import i from"../../core/Error.js";import{handlesGroup as s,makeHandle as l,abortHandle as c}from"../../core/handleUtils.js";import{clone as u}from"../../core/lang.js";import p from"../../core/Logger.js";import{getOrCreateMapValue as d}from"../../core/MapUtils.js";import{whenOrAbort as f,throwIfAborted as y,debounce as m,isPromiseLike as h}from"../../core/promiseUtils.js";import{watch as g,on as b,whenOnce as w}from"../../core/reactiveUtils.js";import{px2pt as v}from"../../core/screenUtils.js";import{diff as I}from"../../core/accessorSupport/diffUtils.js";import{isSharedTemplateOrMetadata as T,isSharedGroupTemplate as S,isSharedPresetTemplate as j,isStandardFeatureTemplate as F,isSharedFeatureTemplate as k,isSharedTemplate as A}from"../../editing/templateUtils.js";import{getSharedTemplateProvider as U}from"../../editing/sharedTemplates/SharedTemplateProvider.js";import V from"../../layers/GraphicsLayer.js";import{featureHasFields as L,fixFields as M,getDisplayFieldName as O}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as x}from"../../layers/support/layerUtils.js";import{calculateTolerance as z}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as q}from"../../renderers/support/lengthUtils.js";import{isRenderer as P}from"../../renderers/support/typeUtils.js";import{getTransformationType as E,TransformationType as C}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import R from"../../symbols/SimpleFillSymbol.js";import D from"../../symbols/SimpleLineSymbol.js";import G from"../../symbols/SimpleMarkerSymbol.js";import{to3D as B}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as N}from"../../symbols/support/symbolUtils.js";import{getServices as Z}from"../../undoredo/support/Services.js";import{GraphicState as Q}from"../../views/3d/layers/graphics/GraphicState.js";import{defaultDrawingMode as W}from"../../views/draw/DrawingMode.js";import{createQueryGeometry as $}from"../../views/support/drapedUtils.js";import{hitTestSelectSimilarDistance as J,filterGraphicHits as H}from"../../views/support/hitTestSelectUtils.js";import{dependencySort as K}from"./support/dependencySort.js";import{isDrawGraphicTool as X}from"../Sketch/support/sketchUtils.js";const Y=()=>p.getLogger("esri.widgets.Editor.workflowUtils");function _(e){return"update"===e.type}function ee(e){if(!(e&&"renderer"in e&&se(e.renderer)))return{rotation:null,size:null};const t=e.renderer.getVisualVariablesForType("rotation").filter((e=>(!e.axis||"heading"===e.axis)&&e.field&&!e.valueExpression)),r=e.renderer.getVisualVariablesForType("size").filter((e=>e.field&&!e.useSymbolValue&&!e.valueExpression&&E(e)===C.RealWorldSize));return{rotation:1===t.length?t[0]:null,size:1===r.length?r[0]:null}}function te(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&se(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:a}=ee(t);let n=null,o=null;if(r){const e=t.fields?.filter((e=>e.name===r.field)),a=1===e?.length?e[0]:null;n=re(r,a)}if(a){const e=t.fields?.filter((e=>e.name===a.field)),r=1===e?.length?e[0]:null;o=oe(a,r)}return{rotation:n,size:o}}function re(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,a=t?.type??"double",n={initial:0,current:0};return{field:e.field,fieldType:a,getDefaultValue:()=>Promise.resolve(0),getValue:e=>(n.current=n.initial-r*e,ie((n.current+360)%360,a)),setInitialValue:e=>{n.initial=e,n.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function ae(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function ne(e,t,r){if(null==t)return 0;const{symbol:a}=B(t);if(null==a||"web-style"===a.type||"cim"===a.type)return 0;const n=a.symbolLayers.at(0);if(!n)return 0;switch(n.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return Math.min($e.icon,(await e(n,$e.icon))[0])||$e.icon}case"text":return $e.text;case"line":return $e.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return ae(await t(n,e.scale/$e.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/$e.viewScaleSizeFactor;default:return 0}}function oe(e,t){const r=e.axis,a=t?.type??"double",n={initial:0,current:0},o=q[e.valueUnit]??1;let i;return i="area"===e.valueRepresentation?e=>(e*o/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*o/2:e=>e*o,{field:e.field,fieldType:a,getDefaultValue:async(e,t)=>ie(i(await ne(t,e,r)),a),getValue:(e,t)=>(n.initial||(n.initial=t.pixelSizeAt(t.center)),n.current=n.initial*e,ie(n.current,a)),setInitialValue:e=>{n.initial=e,n.current=0},isUpdatingInteractively:!1,displayUnit:Ke(e.valueUnit),axis:e.axis}}function ie(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function se(e){if(!P(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}async function le(e,t,r){const a=await N(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t,scale:r});null!=I(e.symbol,a)&&(e.symbol=a)}function ce(e,t){if(!e||!t)throw new Error("no geometry type");if("multipatch"===e)return{tool:"mesh",createOptions:{mode:"hybrid"}};const r=new Map;r.set("circle",{mode:"freehand"}),r.set("rectangle",{mode:"freehand"});const a={mode:W,optionsPerTool:r};if(T(t)){const n=t.defaultTool,o=S(t)?t.definition?.inputGeometryType??e:e;switch(n){case"freehand":case"stream-line":return{tool:"polyline"===o?"freehandPolyline":"freehandPolygon",createOptions:a};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:a};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===o?"polygon":"polyline",createOptions:a};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:a};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:a};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:a};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:a};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:a};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:a}}}else{const n=t.drawingTool;if("circle"===n||"ellipse"===n)return r.get("circle").preserveAspectRatio="circle"===n,{tool:"circle",createOptions:a};if("rectangle"===n)return{tool:"rectangle",createOptions:a};if("freehand"===n)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:a}}return{tool:e,createOptions:a}}async function ue(e,t,r){const{creationInfo:a,fullTemplate:n}=t;if(!a)throw new i("featureworkflow","No creation info provided.");const o=a.layer,s=Ue(n,a.attributeOverrides),{view:l}=e,c="2d"===l?.type;S(n)||j(n)||await Ve(e,o,s,r,c?l.scale:null);const{capabilities:u}=o;e.layer.elevationInfo=o.elevationInfo;const p=ce(o.geometryType,n);e.defaultCreateOptions={graphicProperties:{attributes:s,sourceLayer:o},mode:p.createOptions.mode,optionsPerTool:p.createOptions.optionsPerTool,preserveAspectRatio:p.createOptions.preserveAspectRatio,hasZ:u.data.supportsZ,defaultZ:(c?u.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==a.geometryToPlace?await e.create(p.tool):await e.place(a.geometryToPlace,{graphicProperties:{attributes:s,sourceLayer:o}})}async function pe(e){return s([await de(e),await fe(e)])}async function de({creationAttributes:e,data:t,sketchViewModel:r,view:a,webStyleCache:n}){const{creationInfo:o}=t,{fullTemplate:i}=t;if(!o||"2d"!==a?.type||S(i)||j(i))return null;const s=m((t=>Ve(r,o.layer,e,n,t)));return g((()=>a.scale),(e=>s(e)))}async function fe({data:t,sketchViewModel:r,view:a}){const{templateExecutorInfo:n}=t;if(!n)return null;const o=r.activeComponent;if(!a||!X(o))return Y().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new V({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});a.map?.add(c);const{executor:u,serviceLayersById:p}=n,d=a.theme?.accentColor??new e([255,165,0,1]);return s([b((()=>o),["cursor-update","vertex-add"],(()=>{c.removeAll();const e=o.graphic?.geometry;if(!e||!ye(e))return;const t=u(e,"digitizing");if(!h(t))for(const r of t.edits){const e=p.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=me(e,d);t&&c.add(t)}}})),l((()=>{a.map.remove(c),c.destroy()}))])}function ye(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":return e.paths[0].length>1;case"polygon":{const t=e.rings[0];return n(t.at(0),t.at(-1))?t.length>2:t.length>1}default:return!1}}function me(e,r){let a=null;switch(e.geometry?.type){case"point":case"multipoint":a=new G({angle:0,color:r,outline:new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:1}),path:"undefined",size:8,style:"circle",xoffset:0,yoffset:0});break;case"polygon":a=new R({color:r,outline:new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":a=new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:2});break;default:return null}return new t({geometry:e.geometry,symbol:a,attributes:{...e.attributes}})}async function he(e,t){const r=await Z(t).load(),a=x(e)?e.parent:e;return r.tablesAndLayersLookup.get(a)}async function ge(e,t){const r=await he(e,t);if(!r)return new Map;const a=new Map;for(const n of r.layersAndTables)d(a,n.layerId,(()=>[])).push(n);return a}function be(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function we(e){const{edits:t,serviceInfo:a,view:n,findOriginalFeature:o}=e,i=ve(a.layersAndTables),s=a.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=Te(t,i,o),p=Se(l,Ie(s,c),c);if(ke(l,p,n),0===p.length)return t;const d=K(p,{continueOnCircularDependency:!0}).map((e=>u.get(e))).filter(r),f=new Map;for(const r of d)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of d){const{layer:e}=r;switch(null==h?h=be(e):h.id!==e.layerId&&(m.push(h),h=be(e)),r.operationType){case"add":case"modify":h.addFeatures.push(r.after);break;case"delete":h.deleteFeatures.push(r.before)}}null!==h&&m.push(h);for(const r of y){const e=r.layer.layerId,t=m.find((t=>t.id===e))??be(r.layer);switch(m.includes(t)||m.push(t),r.operationType){case"add":t.addFeatures.push(r.after);break;case"modify":t.updateFeatures.push(r.after);break;case"delete":t.deleteFeatures.push(r.before);break;case"deleteAttachment":t.deleteAttachments.push(r.attachmentId);break;case"addAttachment":t.addAttachments.push(r.attachment)}}for(const r of m)void 0!==r.deleteAttachments&&0===r.deleteAttachments.length&&delete r.deleteAttachments,void 0!==r.addAttachments&&0===r.addAttachments.length&&delete r.addAttachments;return m}function ve(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function Ie(e,t){const r=new Map;for(const a of e)for(const e of a.relationships??[])if(r.set(je(a,e),""),t.has(e.relatedTableId)){const n=t.get(e.relatedTableId);if(n.length>0)for(const t of n[0].layer.relationships??[])if(t.id===e.id){r.set(je(a,e),t.keyField);break}}return r}function Te(e,t,r){const a=new Map,n=[],o=new Map;let s=1;for(const l of e){const e=[],c=t.get(l.id);if(!c)throw new i("featureworkflow",`Failed to prepare applyEdits payload. Layer with id ${l.id} not found.`);for(const t of l.addFeatures??[])e.push({uniqueId:"T"+s++,operationType:"add",layer:c,after:t});for(const t of l.deleteFeatures??[])e.push({uniqueId:"T"+s++,operationType:"delete",before:t,layer:c});for(const t of l.deleteAttachments??[])e.push({uniqueId:"T"+s++,operationType:"deleteAttachment",attachmentId:t,layer:c});for(const t of l.addAttachments??[])e.push({uniqueId:"T"+s++,operationType:"addAttachment",attachment:t,layer:c});for(const t of l.updateFeatures??[])e.push({uniqueId:"T"+s++,operationType:"modify",before:r(t),after:t,layer:c});a.set(c.layerId,e);for(const t of e)n.push(t),o.set(t.uniqueId,t)}return{allEditData:n,editDataByIdMap:o,editDataByLayerIdMap:a}}function Se(e,t,r){const a=[];for(const n of e){const e=n.layer.relationships??[],{uniqueId:o}=n;for(const i of e){const e=i.keyField;if("origin"===i.role){const s=r.get(i.relatedTableId);if(!s||0===s.length)continue;const l=je(n.layer,i),c=t.get(l);if(void 0===c||""===c)continue;switch(n.operationType){case"add":for(const t of s)t!==n&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===n.after.attributes[e]&&a.push([o,t.uniqueId]));break;case"modify":if(n.before.attributes[e]!==n.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==n&&("delete"===t.operationType?t.before.attributes[c]===n.before.attributes[e]?a.push([r,o]):t.before.attributes[c]===n.after.attributes[e]&&a.push([o,r]):"add"===t.operationType?t.after.attributes[c]===n.after.attributes[e]?a.push([o,r]):t.after.attributes[c]===n.before.attributes[e]&&a.push([r,o]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===n.after.attributes[e]?a.push([o,r]):a.push([r,o]):a.push([o,r])))}break;case"delete":for(const t of s)t!==n&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===n.before.attributes[e]&&a.push([t.uniqueId,o]))}}}}return a}function je(e,t){return`${e.layerId}:${t.id}`}function Fe(e,t){return!!(t?.map&&"utilityNetworks"in t.map&&t.map.utilityNetworks?.length&&t.map.utilityNetworks.some((t=>!(!t.loaded||!e.url?.startsWith(t.featureServiceUrl)||e.layerId!==t.networkSystemLayers.associationsTableId))))}function ke(e,t,r){const a=[];for(const o of e)Fe(o.layer,r)&&a.push(o);if(0===a.length)return;let n=[];for(const o of a){const r=o.layer;switch(o.operationType){case"delete":n=[...Ae(o.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ae(o.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of n)t.push([o.uniqueId,e.uniqueId]);break;case"add":n=[...Ae(o.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ae(o.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of n)t.push([e.uniqueId,o.uniqueId])}}}function Ae(e,t){const r=[],a=t.filter((({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField));for(const n of a){const t=n.layer.globalIdField;("before"in n&&n.before?.attributes[t]===e||"after"in n&&n.after?.attributes[t]===e)&&r.push(n)}return r}function Ue(e,t={}){return S(e)||j(e)?{}:F(e)?{...e.prototype.attributes,...t}:k(e)?{...e.definition?.defaultValues,...t}:{...t}}async function Ve(e,r,a,n,o){const i=new t({sourceLayer:r,attributes:a}),{rotation:s,size:l}=te(i);let c=await N(i,{useSourceLayer:!0,webStyleCache:n,scale:o}),u=!1;for(const t of[l,s]){if(null==t)continue;null==a[t.field]&&(a[t.field]=await t.getDefaultValue(c,e.view),u=!0)}switch(u&&(c=await N(i,{useSourceLayer:!0,webStyleCache:n,scale:o})),c?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=c;break;case"simple-line":case"line-3d":e.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=c;break;case"mesh-3d":e.meshSymbol=c}Le(e.tooltipOptions,l,s)}function Le(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function Me(e,t){return e?.find((e=>e.layer===t))}async function Oe(e,t,r,a){switch(t.type){case"3d":return xe(e,t,r,a);case"2d":return ze(e,t,r,a)}}async function xe(e,t,r,n){if(0===e.length)return[];const{updatable:o,graphicsByLayer:i}=await r.defer((async()=>{const{results:a}=await f(J(t,r),n),o=new Map,i=e=>{const t=e.layer,r=o.get(t);if(!r){const e=new Array;return o.set(t,e),e}return r};H(a).forEach((({graphic:e})=>i(e).push(e)));const s=e.filter((({capabilities:e,layer:t})=>e.update.enabled&&o.has(t)));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:o}}));return f(Promise.allSettled(o.map((async({layer:e})=>{const t=i.get(e),r=qe(e);if(t.every((e=>L(r,e))))return t;const o=[];for(const n of t){o.push(n.getObjectId());const e=Object.keys(n.attributes);a(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=o,s.outFields=M(e.fieldsIndex,r),e.queryFeatures(s,{signal:n}).then((({features:e})=>e))}))),n)}async function ze(e,t,r,a){if(0===e.length)return[];const{mapPoint:n}=r;if(null==n)return[];let o=null;const i=await r.defer((async()=>{const{results:n}=await f(t.hitTest(r),a);if(0===n.length)return[];const i=new Set;o=H(n),o.forEach((({graphic:e})=>e&&i.add(e.layer)));const s=e.filter((e=>i.has(e.layer)&&e.supportsUpdateWorkflow));return s.length>0&&r.stopPropagation(),s}));return f(Promise.allSettled(i.map((async({layer:e})=>{const i=e.createQuery();i.returnGeometry=!0,i.outFields=qe(e);const s="renderer"in e?z({renderer:e.renderer,pointerType:r.pointerType}):0;i.geometry=$(n,s,t),i.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(i,{signal:a});return o?.forEach((({graphic:t})=>{t.layer!==e||l.some((e=>e.getObjectId()===t.getObjectId()))||l.push(t)})),l}))),a)}function qe(e){return M(e.fieldsIndex,[e.objectIdField,O({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function Pe(e,t,a,n){const o=t.createQuery();o.objectIds=e.map((e=>e.getObjectId())).filter(r),o.outFields=["*"],o.returnM=t.capabilities.data.supportsM,o.returnZ=t.capabilities.data.supportsZ,"scene"===t.type&&null!=t.infoFor3D||(o.outSpatialReference=a);const i=await t.queryFeatures(o,{signal:n});return y(n),i.features}function Ee(e){const t=new Map;for(const r of e){const e=r.sourceLayer,a=x(e)?e.parent:e;d(t,a,(()=>[])).push(r)}return t}async function Ce(e){const{graphic:t,sketchViewModel:r,sourceLayer:a,visualVariables:n}=e;await Re(e);const o={multipleSelectionEnabled:!1};return"point"===a.geometryType&&(o.enableRotation=null!=n.rotation,o.enableScaling=null!=n.size),r.update(t,o)}async function Re(e){const{graphic:t,sketchViewModel:r,sourceLayer:a,visualVariables:n,webStyleCache:o}=e;let i=!1;const{rotation:s,size:l}=n;for(const c of[s,l]){if(null==c)continue;const e=t.getAttribute(c.field);if(null!=e)c.setInitialValue(e);else{const e=await c.getDefaultValue(t.symbol,r.view);c.setInitialValue(e),t.setAttribute(c.field,e),i=!0}}if(i){const e="2d"===r.view?.type?r.view.scale:null;await le(t,o,e)}Le(r.tooltipOptions,l,s),r.layer.elevationInfo=a.elevationInfo}function De(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function Ge(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function Be(e,t,r,a){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const n=t.attributes;let o=!1;const i=a.rotation,s=De(r.toolEventInfo);if(null!=i&&null!=s){const{field:r,getValue:a}=i;if("rotate-stop"===s.type)i.isUpdatingInteractively=!1,i.setInitialValue(t.getAttribute(r));else{i.isUpdatingInteractively=!0;const l=a(s.angle,e);l!==n[r]&&(t.setAttribute(r,l),o=!0)}}const l=a.size,c=Ge(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:a}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const i=a(c.xScale,e);i!==n[r]&&(t.setAttribute(r,i),o=!0)}}return o}async function Ne({feature:e,featureClone:t,visualVariableAttributes:r,sketchViewModel:a,view:n,onUpdate:o,webStyleCache:i,addUpdatingPromise:u,addHandle:p}){await le(t,i,"2d"===n.type?n.scale:null);let d=null;if("2d"===a?.view?.type){const e=m((e=>le(t,i,e)));d=g((()=>a?.view?.scale),(t=>e(t)))}const f=t.sourceLayer,y=_e(n,f);await Ce({graphic:t,sketchViewModel:a,sourceLayer:f,visualVariables:r,webStyleCache:i});let h=null;y.then((e=>h=e)).catch((()=>{}));const b=r.size,v=r.rotation,I=g((()=>e.attributes),(async e=>{let r=!1;for(const a in e){const n=e[a];n!==t.getAttribute(a)&&(t.setAttribute(a,n),null==b||b.isUpdatingInteractively||b.field!==a||b.setInitialValue(n),null==v||v.isUpdatingInteractively||v.field!==a||v.setInitialValue(n),(null==h||h.requiredFields.includes(a))&&(r=!0))}r&&await le(t,i,"2d"===n.type?n.scale:null)})),T=a.on("update",(async e=>{const t=e.graphics[0],s={graphic:t,sketchViewModel:a,sourceLayer:f,visualVariables:r,webStyleCache:i};if("complete"===e.state){if(null===n.activeTool)return Ce(s);const e=new AbortController,t=c(e);return p(t),u(w((()=>null===n.activeTool),e.signal).then((async()=>{if(!e.signal.aborted)return e.abort(),Ce(s)})))}Be(n,t,e,r)&&await le(t,i,"2d"===n.type?n.scale:null),o(tt(t),e)})),S=a.on(["undo","redo"],(async e=>{o(tt(e.graphics[0]),e)}));return s([S,T,l((()=>a.cancel())),I,d])}async function Ze(e,t,r){const a=e.view;e.layer.add(r);const n=t.sourceLayer,i=t.layer,c=t.getAttribute(i.objectIdField);let u=null;function p(e){u?.abort(),u=o((async t=>{const r=await _e(a,n);y(t),r.setVisibility?.(c,e)}))}return await We(a,r),p(!1),s([Qe(a,r,(e=>p(!e))),l((async()=>{p(!0);try{const e=await _e(a,n);await w((()=>!e.updating))}finally{e.layer.remove(r)}}))])}function Qe(e,t,r){if("3d"===e.type){const a=new Q({graphic:t});return s([e.trackGraphicState(a),g((()=>a.displaying),r)])}return g((()=>t.visible),r)}async function We(e,t){if("3d"===e.type){const r=new Q({graphic:t}),a=e.trackGraphicState(r);await w((()=>r.displaying||r.error)),a.remove()}else await w((()=>t.visible))}const $e={icon:v(24),text:v(12),line:v(1),viewScaleSizeFactor:100};function Je(e,t,r){let a=!1;return e.filter((e=>!!a||(a=e===t,a))).map((e=>r[e]()))}function He(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const a=r.layer,n=e.viewModel.getTemplatesForLayer(a);1===n.length&&"scene"!==a.type&&(r.template=n[0],t.shift())}return t}function Ke(e){return"unknown"===e?null:e}function Xe(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}const Ye=e=>/-stop/.test(e)||/vertex-/.test(e),_e=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function et(e){return"createInteractiveEditSession"in e}function tt(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=u(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function rt(e){const t=e.cursor;return e.cursor="progress",l((()=>e.cursor=t))}async function at(e,t){const{template:r}=e;if(null==r)return null;if(A(r))return r.load();if(T(r)){const e=(await import("../../editing/sharedTemplates/SharedTemplate.js")).default,a=U(t,{makeSharedTemplateFromJSON:t=>e.fromJSON(t)}),n=await a.getTemplates({templateIds:[r.templateId],featureService:r.featureService});if(0===n.length)throw new i("editor:failed-to-load-template","Unable to load the provided template");return n[0].load()}return r}function nt(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:a,sourceField:n}=t;e.setAttribute(r,a.getAttribute(n))}}function ot(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach((e=>nt(e.relationships))),t.flatMap((e=>e.edits))):null}export{ke as appendAllUtilityNetworkAssociationRelationships,He as avoidFeatureTemplateSelectionWithOnlyOneItem,et as canCreateInteractiveEditSession,tt as cloneGraphicExceptMesh,ve as createLayerIdMap,Ie as createRelationshipKeyMap,ce as createToolFromGeometryType,Je as createWorkflowSteps,Oe as fetchCandidates,Pe as fetchFullFeatures,Se as findAllDependencies,Ae as findChangesByGlobalId,Me as findLayerInfo,je as generateHashForRelationship,Ue as getCreationAttributes,at as getFullTemplateForCreationInfo,re as getRotationVariableAttribute,ot as getServiceEditsFromWorkflowData,he as getServiceInfoForLayer,ge as getServiceLayersById,oe as getSizeVariableAttribute,te as getVisualVariableAttributes,ee as getVisualVariablesForLayer,Ee as groupFeaturesByLayer,Ye as isTerminalUpdateEventType,_ as isUpdateWorkflow,Fe as isUtilityNetworkAssociationsTable,we as orderEditsByRelationshipDependencies,Xe as prepareAttachmentsForCreateFeaturesWorkflow,nt as setRelationshipFields,Ne as setUpGeometryUpdate,pe as setUpSketchCreateWatchers,Re as setVisualVariablesAndElevationInfoForUpdate,rt as showProgressCursor,$e as sizeDefaults,Ke as sizeVariableUnitToLengthUnit,ue as startCreatingNewFeature,Ce as startUpdatingFeatureGeometry,Ze as swapForEditingSession,le as updateGraphicSymbolWhenRequired,Be as visualVariableInteractiveUpdate,_e as whenEditorLayerView,We as whenGraphicDisplayed};
@@ -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 t}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import i from"../../core/Accessor.js";import{createTask as s}from"../../core/asyncUtils.js";import{makeHandle as o}from"../../core/handleUtils.js";import"../../core/has.js";import{destroyMaybe as n,abortMaybe as a}from"../../core/maybe.js";import{ignoreAbortErrors as r,throwIfAborted as l}from"../../core/promiseUtils.js";import{watch as h,syncAndInitial as c,when as p}from"../../core/reactiveUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import _ from"../../layers/GraphicsLayer.js";import m from"../../symbols/CIMSymbol.js";import g from"../../symbols/SimpleLineSymbol.js";import{ViewEventPriorities as v}from"../../views/input/InputManager.js";import{isPolyline as y}from"./support/geometryUtils.js";import I from"../Sketch/SketchViewModel.js";var S,f;function b(t){return"2d"===t?new m({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[5,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],enable:!0,capStyle:"Butt",joinStyle:"Round",width:1.5,color:[0,0,0,255]},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:1.5,color:[255,255,255,255]}]}}}):new g({color:[0,0,0,0]})}!function(t){t.Ready="ready",t.Creating="creating",t.Reshaping="reshaping",t.ReshapingDisabled="reshaping-disabled",t.Selecting="selecting",t.Selected="selected"}(S||(S={})),function(t){t.View="view",t.Main="main",t.Interaction="interaction"}(f||(f={}));let k=class extends i{constructor(t){super(t),this.state=S.Ready,this._pendingStartOptions=null,this._previousInputInfo=null,this._shouldRemoveLastPoint=!1,this._sketchedGraphics=new WeakSet,this._creationToolPromise=null,this._updateToolPromise=null,this._updateDisabled=!1}initialize(){this.addHandles(h((()=>({view:this.tool.viewModel.view,visible:this.tool.visible})),(({view:t,visible:e})=>{null!=t&&e?this._attach(t):this._detach()}),c),f.View)}destroy(){this._detach()}get canStopCreating(){const t=this._geometry,e=this._shouldRemoveLastPoint?3:2;return y(t)&&t.paths.length>0&&t.paths[0].length>=e}get _input(){return this.tool.viewModel.input}set _input(t){this.tool.viewModel.input=t}get _geometry(){return this._input?.geometry}get _visibleAndEditable(){return this.tool.visible&&this.tool.editable}get _view(){return this.tool.viewModel.view}get test(){}start(t={mode:"sketch"}){if(!this.tool.editable)return;const e=this._view;if(null!=e&&e.ready)switch(this._pendingStartOptions=null,this._stopInteraction(),null==this._previousInputInfo&&this._storePreviousInput(this._input),this._setSketchedGraphic(null),t.mode){case"sketch":this._set("state",S.Creating),this._startCreationInteraction();break;case"select":this._set("state",S.Selecting),this._startSelectionInteraction()}else this._pendingStartOptions=t}stop(){this._pendingStartOptions=null,this._stopInteractionAndUpdate(),this._clearPreviousInput()}cancel(){this._pendingStartOptions=null,this._stopInteractionAndUpdate(),this._restorePreviousInput()}clear(){this._stopInteractionAndUpdate(),this._set("state",S.Ready),this._clearPreviousInput(),this._input=null,this._pendingStartOptions=null}isSketchedGraphic(t){return null!=t&&this._sketchedGraphics.has(t)}_attach(t){this._detach();const e={mode:"3d"===t.type?"relative-to-ground":"on-the-ground",offset:null};this._graphicsLayer=new _({listMode:"hide",internal:!0,elevationInfo:e});const i=b(t.type);this._sketchVM=new I({layer:this._graphicsLayer,view:t,defaultCreateOptions:{mode:"click",hasZ:!1},updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{shapeOperation:"none"},enableRotation:!1,enableScaling:!1,enableMoveAllGraphics:!1,enableZ:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"reshape"},polylineSymbol:i,activeLineSymbol:i}),this.addHandles([p((()=>t.ready),(()=>{const t=this._pendingStartOptions;t&&this.start(t)}),c),h((()=>[this._input,this._visibleAndEditable]),(()=>this._update()),c),h((()=>({map:t.map,graphicsLayer:this._graphicsLayer})),(({map:t,graphicsLayer:e})=>{null!=t&&null!=e&&t.add(e),this._update()}),c)],f.Main)}_detach(){this.removeHandles(f.Main),this._sketchVM=n(this._sketchVM),this._creationToolPromise=null,this._updateToolPromise=null;const t=this._view?.map,e=this._graphicsLayer;null!=t&&null!=e&&t.remove(e),this._graphicsLayer=n(this._graphicsLayer),this._shouldRemoveLastPoint=!1,this._set("state",S.Ready)}_startCreationInteraction(){this._stopInteractionAndUpdate();const t=this._view,i=this._sketchVM;if(null==t||null==i)return;this._shouldRemoveLastPoint=!1;const s=i.on("create",(t=>{const e=t.graphic;switch(t.state){case"complete":this._shouldRemoveLastPoint=!1,this._setSketchedGraphic(e),this._stopInteractionAndUpdate(),this._clearPreviousInput();break;case"cancel":this.cancel();break;case"active":this._setSketchedGraphic(e),"cursor-update"===t.toolEventInfo?.type&&(this._shouldRemoveLastPoint=!0);break;case"start":this._setSketchedGraphic(e)}})),n=()=>{s.remove();const t=this.canStopCreating,o=this._geometry?.clone();i.cancel(),this._creationToolPromise=null,null!=o&&t?this._shouldRemoveLastPoint&&this._setSketchedGraphic(new e({geometry:w(o)})):this._input=null};this.removeHandles(f.Interaction),this.addHandles(o(n),f.Interaction),this._creationToolPromise=r(i.create("polyline"))}_startReshapeInteraction(){this._stopInteraction();const t=this._view,e=this._sketchVM;if(null==t||null==e)return;const i=e.on("update",(t=>{const e=t.graphics[0];switch(t.state){case"complete":this._setSketchedGraphic(e),this._stopInteractionAndUpdate(),this._clearPreviousInput();break;case"active":case"start":this._setSketchedGraphic(e)}})),s=()=>{i.remove(),e.cancel(),this._updateToolPromise=null};this.removeHandles(f.Interaction),this.addHandles(o(s),f.Interaction);const n=this._input;n&&(n.visible=!0,this._updateToolPromise=r(e.update(n,{tool:"reshape"})))}_startSelectionInteraction(){this._stopInteraction();const t=this._view;if(null==t)return;const e=t.cursor,i=o((()=>t.cursor=e));t.cursor="crosshair",t.closePopup();let n=null;const r=o((()=>a(n))),h=t.on("immediate-click",(e=>{e.async((async()=>{a(n),n=s((async i=>{const{results:s}=await t.hitTest(e);l(i);const o=s.filter((t=>"graphic"===t.type)).map((t=>t.graphic)).find((t=>null!=t.geometry&&"polyline"===t.geometry.type));o&&(e.preventDefault(),e.stopPropagation(),this._input=o,this._clearPreviousInput(),this._stopInteractionAndUpdate())})),await n.promise}))}),v.TOOL),c=t.on("key-down",(t=>{"Escape"===t.key&&this.cancel()}));this.removeHandles(f.Interaction),this.addHandles([h,c,r,i],f.Interaction),t.ready&&t.focus()}_stopInteraction(){this.removeHandles(f.Interaction)}_stopInteractionAndUpdate(){this.hasHandles(f.Interaction)&&(this._updateDisabled=!0,this._stopInteraction(),this._updateDisabled=!1,this._triggerUpdate())}_triggerUpdate(){this._set("state",S.Ready),this._update()}_update(){if(this._updateDisabled)return;const t=this.state;if(t!==S.Selecting){if(this._visibleAndEditable){if(t===S.Creating||t===S.Reshaping&&this.isSketchedGraphic(this._input))return}else this.cancel();this._set("state",this._getNextState()),this._updateVisuals()}else this.stop()}_getNextState(){return null==this._input?S.Ready:this.isSketchedGraphic(this._input)?this.state===S.Creating?S.Creating:this._visibleAndEditable?S.Reshaping:S.ReshapingDisabled:S.Selected}_updateVisuals(){switch(this.state){case S.Creating:break;case S.Reshaping:this._startReshapeInteraction();break;case S.ReshapingDisabled:{this._stopInteractionAndUpdate();const t=this._input;null!=t&&this.isSketchedGraphic(t)&&(t.visible=!1);break}case S.Ready:case S.Selected:this._stopInteractionAndUpdate();case S.Selecting:}this._updateSketchedGraphic()}_storePreviousInput(t){this._previousInputInfo={graphic:t}}_restorePreviousInput(){const t=this._previousInputInfo;null!=t&&(this._clearPreviousInput(),this._input=t.graphic,this._triggerUpdate())}_clearPreviousInput(){this._previousInputInfo=null}_updateSketchedGraphic(){const t=this._graphicsLayer;if(null==t)return;const e=t.graphics,i=this._input;if(null==i||!this.isSketchedGraphic(i))return void e.removeAll();if(-1===e.indexOf(i))e.removeAll(),e.add(i);else if(1!==e.length){const t=e.filter((t=>t!==i));e.removeMany(t)}}_setSketchedGraphic(t){null!=t&&this._sketchedGraphics.add(t),this._input=t,this._updateSketchedGraphic()}};function w(t){if(y(t)){const e=t.clone();return e.paths=[e.paths[0].slice(0,-1)],e}return t}t([d({nonNullable:!0})],k.prototype,"state",void 0),t([d({nonNullable:!0})],k.prototype,"tool",void 0),t([d()],k.prototype,"canStopCreating",null),t([d()],k.prototype,"_graphicsLayer",void 0),t([d()],k.prototype,"_sketchVM",void 0),t([d()],k.prototype,"_input",null),t([d()],k.prototype,"_geometry",null),t([d()],k.prototype,"_visibleAndEditable",null),t([d()],k.prototype,"_view",null),t([d()],k.prototype,"_shouldRemoveLastPoint",void 0),k=t([u("esri.widgets.ElevationProfile.ElevationProfileInteraction")],k);export{k as ElevationProfileInteraction,S as State};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import i from"../../core/Accessor.js";import{createTask as s}from"../../core/asyncUtils.js";import{makeHandle as o}from"../../core/handleUtils.js";import"../../core/has.js";import{destroyMaybe as n,abortMaybe as a}from"../../core/maybe.js";import{ignoreAbortErrors as r,throwIfAborted as l}from"../../core/promiseUtils.js";import{watch as h,syncAndInitial as c,when as p}from"../../core/reactiveUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import _ from"../../layers/GraphicsLayer.js";import m from"../../symbols/CIMSymbol.js";import g from"../../symbols/SimpleLineSymbol.js";import{ViewEventPriorities as v}from"../../views/input/InputManager.js";import{isPolyline as y}from"./support/geometryUtils.js";import I from"../Sketch/SketchViewModel.js";var f,S;function b(t){return"2d"===t?new m({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[5,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],enable:!0,capStyle:"Butt",joinStyle:"Round",width:1.5,color:[0,0,0,255]},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:1.5,color:[255,255,255,255]}]}}}):new g({color:[0,0,0,0]})}!function(t){t.Ready="ready",t.Creating="creating",t.Reshaping="reshaping",t.ReshapingDisabled="reshaping-disabled",t.Selecting="selecting",t.Selected="selected"}(f||(f={})),function(t){t.View="view",t.Main="main",t.Interaction="interaction"}(S||(S={}));let k=class extends i{constructor(t){super(t),this.state=f.Ready,this._pendingStartOptions=null,this._previousInputInfo=null,this._shouldRemoveLastPoint=!1,this._sketchedGraphics=new WeakSet,this._creationToolPromise=null,this._updateToolPromise=null,this._updateDisabled=!1}initialize(){this.addHandles(h((()=>({view:this.tool.viewModel.view,visible:this.tool.visible})),(({view:t,visible:e})=>{null!=t&&e?this._attach(t):this._detach()}),c),S.View)}destroy(){this._detach()}get canStopCreating(){const t=this._geometry,e=this._shouldRemoveLastPoint?3:2;return y(t)&&t.paths.length>0&&t.paths[0].length>=e}get _input(){return this.tool.viewModel.input}set _input(t){this.tool.viewModel.input=t}get _geometry(){return this._input?.geometry}get _visibleAndEditable(){return this.tool.visible&&this.tool.editable}get _view(){return this.tool.viewModel.view}get test(){}start(t={mode:"sketch"}){if(!this.tool.editable)return;const e=this._view;if(null!=e&&e.ready)switch(this._pendingStartOptions=null,this._stopInteraction(),null==this._previousInputInfo&&this._storePreviousInput(this._input),this._setSketchedGraphic(null),t.mode){case"sketch":this._set("state",f.Creating),this._startCreationInteraction();break;case"select":this._set("state",f.Selecting),this._startSelectionInteraction()}else this._pendingStartOptions=t}stop(){this._pendingStartOptions=null,this._stopInteractionAndUpdate(),this._clearPreviousInput()}cancel(){this._pendingStartOptions=null,this._stopInteractionAndUpdate(),this._restorePreviousInput()}clear(){this._stopInteractionAndUpdate(),this._set("state",f.Ready),this._clearPreviousInput(),this._input=null,this._pendingStartOptions=null}isSketchedGraphic(t){return null!=t&&this._sketchedGraphics.has(t)}_attach(t){this._detach();const e={mode:"3d"===t.type?"relative-to-ground":"on-the-ground",offset:null};this._graphicsLayer=new _({listMode:"hide",internal:!0,elevationInfo:e});const i=b(t.type);this._sketchVM=new I({layer:this._graphicsLayer,view:t,defaultCreateOptions:{mode:"click",hasZ:!1},updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{shapeOperation:"none"},enableRotation:!1,enableScaling:!1,enableMoveAllGraphics:!1,enableZ:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"reshape"},polylineSymbol:i,activeLineSymbol:i}),this.addHandles([p((()=>t.ready),(()=>{const t=this._pendingStartOptions;t&&this.start(t)}),c),h((()=>[this._input,this._visibleAndEditable]),(()=>this._update()),c),h((()=>({map:t.map,graphicsLayer:this._graphicsLayer})),(({map:t,graphicsLayer:e})=>{null!=t&&null!=e&&t.add(e),this._update()}),c)],S.Main)}_detach(){this.removeHandles(S.Main),this._sketchVM=n(this._sketchVM),this._creationToolPromise=null,this._updateToolPromise=null;const t=this._view?.map,e=this._graphicsLayer;null!=t&&null!=e&&t.remove(e),this._graphicsLayer=n(this._graphicsLayer),this._shouldRemoveLastPoint=!1,this._set("state",f.Ready)}_startCreationInteraction(){this._stopInteractionAndUpdate();const t=this._view,i=this._sketchVM;if(null==t||null==i)return;this._shouldRemoveLastPoint=!1;const s=i.on("create",(t=>{const e=t.graphic;switch(t.state){case"complete":this._shouldRemoveLastPoint=!1,this._setSketchedGraphic(e),this._stopInteractionAndUpdate(),this._clearPreviousInput();break;case"cancel":this.cancel();break;case"active":this._setSketchedGraphic(e),"cursor-update"===t.toolEventInfo?.type&&(this._shouldRemoveLastPoint=!0);break;case"start":this._setSketchedGraphic(e)}})),n=()=>{s.remove();const t=this.canStopCreating,o=this._geometry?.clone();i.cancel(),this._creationToolPromise=null,null!=o&&t?this._shouldRemoveLastPoint&&this._setSketchedGraphic(new e({geometry:w(o)})):this._input=null};this.removeHandles(S.Interaction),this.addHandles(o(n),S.Interaction),this._creationToolPromise=r(i.create("polyline"))}_startReshapeInteraction(){this._stopInteraction();const t=this._view,e=this._sketchVM;if(null==t||null==e)return;const i=e.on("update",(t=>{const e=t.graphics[0];switch(t.state){case"complete":this._setSketchedGraphic(e),this._stopInteractionAndUpdate(),this._clearPreviousInput();break;case"active":case"start":this._setSketchedGraphic(e)}})),s=()=>{i.remove(),e.cancel(),this._updateToolPromise=null};this.removeHandles(S.Interaction),this.addHandles(o(s),S.Interaction);const n=this._input;n&&(n.visible=!0,this._updateToolPromise=r(e.update(n,{tool:"reshape"})))}_startSelectionInteraction(){this._stopInteraction();const t=this._view;if(null==t)return;const e=t.cursor,i=o((()=>t.cursor=e));t.cursor="crosshair",t.closePopup();let n=null;const r=o((()=>a(n))),h=t.on("immediate-click",(e=>{e.defer((async()=>{a(n),n=s((async i=>{const{results:s}=await t.hitTest(e);l(i);const o=s.filter((t=>"graphic"===t.type)).map((t=>t.graphic)).find((t=>null!=t.geometry&&"polyline"===t.geometry.type));o&&(e.preventDefault(),e.stopPropagation(),this._input=o,this._clearPreviousInput(),this._stopInteractionAndUpdate())})),await n.promise}))}),v.TOOL),c=t.on("key-down",(t=>{"Escape"===t.key&&this.cancel()}));this.removeHandles(S.Interaction),this.addHandles([h,c,r,i],S.Interaction),t.ready&&t.focus()}_stopInteraction(){this.removeHandles(S.Interaction)}_stopInteractionAndUpdate(){this.hasHandles(S.Interaction)&&(this._updateDisabled=!0,this._stopInteraction(),this._updateDisabled=!1,this._triggerUpdate())}_triggerUpdate(){this._set("state",f.Ready),this._update()}_update(){if(this._updateDisabled)return;const t=this.state;if(t!==f.Selecting){if(this._visibleAndEditable){if(t===f.Creating||t===f.Reshaping&&this.isSketchedGraphic(this._input))return}else this.cancel();this._set("state",this._getNextState()),this._updateVisuals()}else this.stop()}_getNextState(){return null==this._input?f.Ready:this.isSketchedGraphic(this._input)?this.state===f.Creating?f.Creating:this._visibleAndEditable?f.Reshaping:f.ReshapingDisabled:f.Selected}_updateVisuals(){switch(this.state){case f.Creating:break;case f.Reshaping:this._startReshapeInteraction();break;case f.ReshapingDisabled:{this._stopInteractionAndUpdate();const t=this._input;null!=t&&this.isSketchedGraphic(t)&&(t.visible=!1);break}case f.Ready:case f.Selected:this._stopInteractionAndUpdate();case f.Selecting:}this._updateSketchedGraphic()}_storePreviousInput(t){this._previousInputInfo={graphic:t}}_restorePreviousInput(){const t=this._previousInputInfo;null!=t&&(this._clearPreviousInput(),this._input=t.graphic,this._triggerUpdate())}_clearPreviousInput(){this._previousInputInfo=null}_updateSketchedGraphic(){const t=this._graphicsLayer;if(null==t)return;const e=t.graphics,i=this._input;if(null==i||!this.isSketchedGraphic(i))return void e.removeAll();if(-1===e.indexOf(i))e.removeAll(),e.add(i);else if(1!==e.length){const t=e.filter((t=>t!==i));e.removeMany(t)}}_setSketchedGraphic(t){null!=t&&this._sketchedGraphics.add(t),this._input=t,this._updateSketchedGraphic()}};function w(t){if(y(t)){const e=t.clone();return e.paths=[e.paths[0].slice(0,-1)],e}return t}t([d({nonNullable:!0})],k.prototype,"state",void 0),t([d({nonNullable:!0})],k.prototype,"tool",void 0),t([d()],k.prototype,"canStopCreating",null),t([d()],k.prototype,"_graphicsLayer",void 0),t([d()],k.prototype,"_sketchVM",void 0),t([d()],k.prototype,"_input",null),t([d()],k.prototype,"_geometry",null),t([d()],k.prototype,"_visibleAndEditable",null),t([d()],k.prototype,"_view",null),t([d()],k.prototype,"_shouldRemoveLastPoint",void 0),k=t([u("esri.widgets.ElevationProfile.ElevationProfileInteraction")],k);export{k as ElevationProfileInteraction,f as State};
@@ -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"../../Graphic.js";import r from"../../core/Accessor.js";import{createTask as s}from"../../core/asyncUtils.js";import o from"../../core/Collection.js";import{abortMaybe as a}from"../../core/maybe.js";import{ignoreAbortErrors as i,debounce as n}from"../../core/promiseUtils.js";import{watch as l,initial as u}from"../../core/reactiveUtils.js";import{sqlAnd as c}from"../../core/sql.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as p}from"../../core/support/UpdatingHandles.js";import{isLayerFromCatalog as d}from"../../layers/catalog/catalogUtils.js";import{isSubtypeGroupLayer as g,isKnowledgeGraphLayer as m,isSubtypeSublayer as _}from"../../layers/support/layerUtils.js";import{isAssociatedFeatureSupportedLayer as f}from"../Feature/support/featureUtils.js";import{isMapImageLayer as b}from"../FeatureTable/support/tableUtils.js";import{createAssociation as C}from"../support/UtilityNetworkAssociations/utils/createAssociation.js";import{getFeatureTitle as F}from"../support/UtilityNetworkAssociations/utils/getFeatureTitle.js";const A=100,q="association-key";let w=class extends r{constructor(e){super(e),this.graphic=null,this.layer=null,this.map=null,this.utilityNetwork=null,this.associationType=null,this.featureCount=0,this.featureSpatialItems=new o,this.highlightHelper=null,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=30,this.selectedFeature=null,this.association=null,this.filterOptionsVisible=!1,this.filterWhereClause=null,this._rulesTable=null,this._canAssociate=!1,this._whereClause=null,this._setUpItemsTask=null,this._updatingHandlesSetUp=new p,this._queryFeaturesTask=null,this._updatingHandlesQueryFeatures=new p,this._validateAssociationTask=null,this._updatingHandlesAssociation=new p,this._featureIsNotSelected=e=>(this.globalIdField?e.attributes?.[this.globalIdField]??null:null)!==this.globalId,this._cancelQuery=()=>{const{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const e=new AbortController;this._queryAbortController=e,await i(this._query()).catch((()=>this._cancelQuery())),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async e=>{this._cancelQueryFeatureCount();const t=new AbortController;this._queryFeatureCountAbortController=t,await i(this._queryFeatureCount(e)).catch((()=>this._cancelQueryFeatureCount())),this._queryFeatureCountAbortController===t&&(this._queryFeatureCountAbortController=null)},this._queryPageController=async()=>{const e=new AbortController;this._queryPageAbortController=e,await i(this._queryPage()).catch((()=>this._cancelQueryPage())),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryDebounced=n(this._queryController,A),this._queryFeatureCountDebounced=n(this._queryFeatureCountController,A),this._queryPageDebounced=n(this._queryPageController,A)}initialize(){this.addHandles([l((()=>[this.graphic,this.layer,this.map,this.utilityNetwork,this.globalId,this.associationType]),(()=>this._syncLayerItems()),u),l((()=>[this.selectedLayer,this.filterWhereClause,this.featuresPerPage]),(()=>{this.selectedLayer&&this._setUpFeatures()})),l((()=>this.selectedFeature),(()=>{this._setUpAssociation()})),l((()=>this.featurePage),(()=>this._queryPageDebounced()))])}destroy(){this._setUpItemsTask=a(this._setUpItemsTask),this._updatingHandlesSetUp.destroy(),this._queryFeaturesTask=a(this._queryFeaturesTask),this._updatingHandlesQueryFeatures.destroy(),this._validateAssociationTask=a(this._validateAssociationTask),this._updatingHandlesAssociation.destroy(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}get mapTables(){const{map:e}=this;if(!e)return null;const t=new Set;return e.allTables.forEach((e=>this._collectIfValidParent(e,t))),new o([...t])}get mapLayers(){const{map:e}=this;if(!e)return null;const t=new Set;return e.allLayers.forEach((e=>this._collectIfValidParent(e,t))),new o([...t])}get state(){const{canLoadLayers:e,_queryAbortController:t,_queryPageAbortController:r}=this;return e?t||r||this._updatingHandlesQueryFeatures.updating?"querying":this._updatingHandlesSetUp.updating?"loading":"ready":"disabled"}get canAddAssociation(){return!(this.updating||!this.association)&&this._canAssociate}get globalId(){return(this.globalIdField&&this.graphic?.attributes?.[this.globalIdField])??null}get globalIdField(){const{layer:e}=this;return e?.globalIdField??null}get layerItems(){return this._get("layerItems")||new o}get tableItems(){return this._get("tableItems")||new o}get featureItems(){return this._get("featureItems")||new o}set featurePage(e){const{featuresPerPage:t,featureCount:r,featureSpatialItems:s}=this,o=s.length||r,a=1,i=Math.ceil(o/t)||1;this._set("featurePage",Math.min(Math.max(e,a),i))}get featurePage(){return this._get("featurePage")}get canLoadLayers(){const{map:e,utilityNetwork:t,graphic:r,associationType:s}=this;return!!(e&&t&&r&&s)}get canQuery(){const{utilityNetwork:e,graphic:t,associationType:r,selectedLayer:s}=this;return!!(e&&t&&r&&s)}get updating(){return this._updatingHandlesSetUp.updating||this._updatingHandlesAssociation.updating}get selectedLayer(){return this._get("selectedLayer")}set selectedLayer(e){e!==this.selectedLayer&&(this.filterWhereClause=null),this._set("selectedLayer",e)}get queryWhereClause(){const{_whereClause:e,filterWhereClause:t}=this;return c(e,t)}async handleSelectionComplete(e){const{associationType:t,featureSpatialItems:r,graphic:s,_rulesTable:o}=this,{selection:a}=e;if(r.removeAll(),!(t&&s&&o&&a?.length))return;const i=this._convertTypeToDirection(t.type),n=a.filter(this._featureIsNotSelected),l=o.getFeaturesCanAssociateWith(s,n,i),u=await this._processFeatures(l);r.addMany(u)}reset(){this.highlightHelper?.removeAll(),this.featureSpatialItems.removeAll(),this.featurePage=1}_collectIfValidLayer(e,t){f(e)&&!g(e)&&t.add(e)}_collectIfValidParent(e,t){const r=e=>this._collectIfValidLayer(e,t);d(e)||"catalog-footprint"===e.type||(m(e)?(e.layers?.forEach(r),e.tables?.forEach(r)):b(e)?(e.sublayers?.forEach(r),e.subtables?.forEach(r)):g(e)?e.sublayers?.forEach(r):this._collectIfValidLayer(e,t))}async _queryFeatureCount(e){const{selectedLayer:t,_queryFeatureCountAbortController:r}=this;if(this._set("featureCount",0),!t)return;await t.load();const s=t.createQuery();s.returnGeometry=!1,s.where=c(s.where,e);const o=await t.queryFeatureCount(s,{signal:r?.signal});o>0&&this._set("featureCount",o)}async _query(){const{canQuery:e,queryWhereClause:t,_queryAbortController:r,featureItems:s}=this;e&&(this.featurePage=1,s.destroyAll(),this.featureCount&&!this.destroyed&&s.addMany(await this._queryAssociatedFeatures(t,{signal:r?.signal})))}async _queryPage(){const{canQuery:e,queryWhereClause:t,featurePage:r,_queryPageAbortController:s,featureCount:o,featureItems:a}=this;e&&(r<2||!o||a.addMany(await this._queryAssociatedFeatures(t,{signal:s?.signal})))}_convertTypeToDirection(e){switch(e){case"attachment":return[{type:"attachment",direction:"from"}];case"connectivity":return[{type:"junction-junction-connectivity"},{type:"junction-edge-from-connectivity"},{type:"junction-edge-midspan-connectivity"},{type:"junction-edge-to-connectivity"}];case"container":return[{type:"containment",direction:"to"}];case"content":return[{type:"containment",direction:"from"}];case"structure":return[{type:"attachment",direction:"to"}]}}async getRulesTable(){const{utilityNetwork:e}=this;if(!e)return null;if(this._rulesTable)return this._rulesTable;const t=await e.getRulesTable();return await(t?.load()),this._rulesTable=t,t}async _syncLayerItems(){a(this._setUpItemsTask);const{graphic:e,associationType:t,layerItems:r,tableItems:o,canLoadLayers:i}=this,n=s((async s=>{if(this.selectedLayer=null,r.removeAll(),o.removeAll(),!i)return;const a=this.mapLayers?.toArray(),n=this.mapTables?.toArray();if(!a&&!n)return;if(s.aborted)return;const l=await this.getRulesTable(),u=this._convertTypeToDirection(t.type);if(a?.length){const t=l?.getLayersCanAssociateWith(e,a,u);if(s.aborted)return;r.addMany(t||[])}if(n?.length){const t=l?.getLayersCanAssociateWith(e,n,u);if(s.aborted)return;o.addMany(t||[])}}));this._updatingHandlesSetUp.addPromise(n.promise),this._setUpItemsTask=n}async _setUpFeatures(){a(this._queryFeaturesTask);const{graphic:e,associationType:t,selectedLayer:r,canQuery:o}=this;if(!o)return;const i=s((async s=>{const o=await this.getRulesTable(),a=this._convertTypeToDirection(t.type),i=o?.getFeaturesCanAssociateWithClause(e,r,a);this._whereClause=i,s.aborted||(await this._queryFeatureCountDebounced(this.queryWhereClause),await this._queryDebounced())}));this._updatingHandlesQueryFeatures.addPromise(i.promise),this._queryFeaturesTask=i}_determineFromAndTo(e,t,r){return"from"===r?{fromFeature:e,toFeature:t}:{fromFeature:t,toFeature:e}}_determineJunctionEdgeConnectivity(e,t){const{utilityNetwork:r}=this,s=_(e.sourceLayer)?e.sourceLayer.parent:e.sourceLayer,o=_(t.sourceLayer)?t.sourceLayer.parent:t.sourceLayer;if(!(r&&s&&"layerId"in s&&o&&"layerId"in o))return{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"};const a=r.getSourceIdByLayerId(s.layerId),i=r.getSourceIdByLayerId(o.layerId);if(!a||!i)return{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"};const n="junction"===r.getSourceTypeById(a),l="junction"===r.getSourceTypeById(i);return n&&l?{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"}:l?{fromFeature:t,toFeature:e,type:"junction-edge-midspan-connectivity"}:{fromFeature:e,toFeature:t,type:"junction-edge-midspan-connectivity"}}_setUpAssociationHandles(){this.removeHandles(q),this.association&&this.addHandles(l((()=>[this.association?.associationType,this.association?.fromNetworkElement,this.association?.fromNetworkElement?.terminalId,this.association?.toNetworkElement,this.association?.toNetworkElement?.terminalId]),(()=>this.validateAssociation()),u),q)}_setUpAssociation(){const{utilityNetwork:e,graphic:t,selectedFeature:r,associationType:s}=this;if(!(e&&t&&r&&s))return void(this.association=null);const o=this._convertTypeToDirection(s.type);if(o.length>1){const{fromFeature:s,toFeature:o,type:a}=this._determineJunctionEdgeConnectivity(t,r.feature);return this.association=C({fromFeature:s,toFeature:o,utilityNetwork:e,associationType:a}),void this._setUpAssociationHandles()}const{fromFeature:a,toFeature:i}=this._determineFromAndTo(t,r.feature,o[0].direction);this.association=C({fromFeature:a,toFeature:i,utilityNetwork:e,associationType:o[0].type}),this._setUpAssociationHandles()}async _processFeatures(e){return Promise.all(e.map((async e=>{const{sourceLayer:t}=e;if(t&&"getFeatureTitle"in t){return{label:await t.getFeatureTitle(e)||F(e),feature:e}}return{label:F(e),feature:e}})))}async _queryAssociatedFeatures(e,t){const{featuresPerPage:r,layer:s,featurePage:o,featureCount:a,selectedLayer:i}=this,{canQuery:n,globalId:l}=this;if(!n||!s||!i||null==l)return[];const u=((o-1)*r+a)%a,y=r,{historicMoment:h,gdbVersion:p}=i,d=i.createQuery();d.where=c(d.where,e),d.start=u,d.num=y,d.returnGeometry=!1,d.historicMoment=h,d.gdbVersion=p,d.outFields=["*"];const g=await i.queryFeatures(d,{signal:t?.signal});return await this._processFeatures(g.features)}validateAssociation(){a(this._validateAssociationTask);const{utilityNetwork:e,association:t}=this,r=s((async()=>{e&&t&&(this._canAssociate=await e.canAddAssociation(t))}));this._updatingHandlesAssociation.addPromise(r.promise),this._validateAssociationTask=r}};e([y({type:t})],w.prototype,"graphic",void 0),e([y()],w.prototype,"layer",void 0),e([y()],w.prototype,"map",void 0),e([y({readOnly:!0})],w.prototype,"mapTables",null),e([y({readOnly:!0})],w.prototype,"mapLayers",null),e([y()],w.prototype,"utilityNetwork",void 0),e([y()],w.prototype,"associationType",void 0),e([y()],w.prototype,"state",null),e([y({readOnly:!0})],w.prototype,"canAddAssociation",null),e([y({readOnly:!0})],w.prototype,"globalId",null),e([y({readOnly:!0})],w.prototype,"globalIdField",null),e([y()],w.prototype,"featureCount",void 0),e([y({readOnly:!0})],w.prototype,"layerItems",null),e([y({readOnly:!0})],w.prototype,"tableItems",null),e([y({readOnly:!0})],w.prototype,"featureItems",null),e([y()],w.prototype,"featureSpatialItems",void 0),e([y()],w.prototype,"highlightHelper",void 0),e([y()],w.prototype,"_queryAbortController",void 0),e([y()],w.prototype,"_queryPageAbortController",void 0),e([y()],w.prototype,"_queryFeatureCountAbortController",void 0),e([y({value:1})],w.prototype,"featurePage",null),e([y()],w.prototype,"featuresPerPage",void 0),e([y({readOnly:!0})],w.prototype,"canLoadLayers",null),e([y({readOnly:!0})],w.prototype,"canQuery",null),e([y({readOnly:!0})],w.prototype,"updating",null),e([y()],w.prototype,"selectedLayer",null),e([y()],w.prototype,"selectedFeature",void 0),e([y()],w.prototype,"association",void 0),e([y()],w.prototype,"filterOptionsVisible",void 0),e([y()],w.prototype,"filterWhereClause",void 0),e([y()],w.prototype,"queryWhereClause",null),e([y()],w.prototype,"_rulesTable",void 0),e([y()],w.prototype,"_canAssociate",void 0),e([y()],w.prototype,"_whereClause",void 0),w=e([h("esri.widgets.FeatureForm.UtilityNetworkAssociationAddAssociationViewModel")],w);const T=w;export{T as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../core/Accessor.js";import{createTask as s}from"../../core/asyncUtils.js";import o from"../../core/Collection.js";import{abortMaybe as a}from"../../core/maybe.js";import{ignoreAbortErrors as i,debounce as n}from"../../core/promiseUtils.js";import{watch as l,initial as u}from"../../core/reactiveUtils.js";import{sqlAnd as c}from"../../core/sql.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as p}from"../../core/support/UpdatingHandles.js";import{isLayerFromCatalog as d}from"../../layers/catalog/catalogUtils.js";import{isSubtypeGroupLayer as g,isKnowledgeGraphLayer as _,isMapImageLayer as m,isSubtypeSublayer as f}from"../../layers/support/layerUtils.js";import{isAssociatedFeatureSupportedLayer as b}from"../Feature/support/featureUtils.js";import{createAssociation as C}from"../support/UtilityNetworkAssociations/utils/createAssociation.js";import{getFeatureTitle as F}from"../support/UtilityNetworkAssociations/utils/getFeatureTitle.js";const A=100,q="association-key";let w=class extends r{constructor(e){super(e),this.graphic=null,this.layer=null,this.map=null,this.utilityNetwork=null,this.associationType=null,this.featureCount=0,this.featureSpatialItems=new o,this.highlightHelper=null,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=30,this.selectedFeature=null,this.association=null,this.filterOptionsVisible=!1,this.filterWhereClause=null,this._rulesTable=null,this._canAssociate=!1,this._whereClause=null,this._setUpItemsTask=null,this._updatingHandlesSetUp=new p,this._queryFeaturesTask=null,this._updatingHandlesQueryFeatures=new p,this._validateAssociationTask=null,this._updatingHandlesAssociation=new p,this._featureIsNotSelected=e=>(this.globalIdField?e.attributes?.[this.globalIdField]??null:null)!==this.globalId,this._cancelQuery=()=>{const{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const e=new AbortController;this._queryAbortController=e,await i(this._query()).catch((()=>this._cancelQuery())),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async e=>{this._cancelQueryFeatureCount();const t=new AbortController;this._queryFeatureCountAbortController=t,await i(this._queryFeatureCount(e)).catch((()=>this._cancelQueryFeatureCount())),this._queryFeatureCountAbortController===t&&(this._queryFeatureCountAbortController=null)},this._queryPageController=async()=>{const e=new AbortController;this._queryPageAbortController=e,await i(this._queryPage()).catch((()=>this._cancelQueryPage())),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryDebounced=n(this._queryController,A),this._queryFeatureCountDebounced=n(this._queryFeatureCountController,A),this._queryPageDebounced=n(this._queryPageController,A)}initialize(){this.addHandles([l((()=>[this.graphic,this.layer,this.map,this.utilityNetwork,this.globalId,this.associationType]),(()=>this._syncLayerItems()),u),l((()=>[this.selectedLayer,this.filterWhereClause,this.featuresPerPage]),(()=>{this.selectedLayer&&this._setUpFeatures()})),l((()=>this.selectedFeature),(()=>{this._setUpAssociation()})),l((()=>this.featurePage),(()=>this._queryPageDebounced()))])}destroy(){this._setUpItemsTask=a(this._setUpItemsTask),this._updatingHandlesSetUp.destroy(),this._queryFeaturesTask=a(this._queryFeaturesTask),this._updatingHandlesQueryFeatures.destroy(),this._validateAssociationTask=a(this._validateAssociationTask),this._updatingHandlesAssociation.destroy(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}get mapTables(){const{map:e}=this;if(!e)return null;const t=new Set;return e.allTables.forEach((e=>this._collectIfValidParent(e,t))),new o([...t])}get mapLayers(){const{map:e}=this;if(!e)return null;const t=new Set;return e.allLayers.forEach((e=>this._collectIfValidParent(e,t))),new o([...t])}get state(){const{canLoadLayers:e,_queryAbortController:t,_queryPageAbortController:r}=this;return e?t||r||this._updatingHandlesQueryFeatures.updating?"querying":this._updatingHandlesSetUp.updating?"loading":"ready":"disabled"}get canAddAssociation(){return!(this.updating||!this.association)&&this._canAssociate}get globalId(){return(this.globalIdField&&this.graphic?.attributes?.[this.globalIdField])??null}get globalIdField(){const{layer:e}=this;return e?.globalIdField??null}get layerItems(){return this._get("layerItems")||new o}get tableItems(){return this._get("tableItems")||new o}get featureItems(){return this._get("featureItems")||new o}set featurePage(e){const{featuresPerPage:t,featureCount:r,featureSpatialItems:s}=this,o=s.length||r,a=1,i=Math.ceil(o/t)||1;this._set("featurePage",Math.min(Math.max(e,a),i))}get featurePage(){return this._get("featurePage")}get canLoadLayers(){const{map:e,utilityNetwork:t,graphic:r,associationType:s}=this;return!!(e&&t&&r&&s)}get canQuery(){const{utilityNetwork:e,graphic:t,associationType:r,selectedLayer:s}=this;return!!(e&&t&&r&&s)}get updating(){return this._updatingHandlesSetUp.updating||this._updatingHandlesAssociation.updating}get selectedLayer(){return this._get("selectedLayer")}set selectedLayer(e){e!==this.selectedLayer&&(this.filterWhereClause=null),this._set("selectedLayer",e)}get queryWhereClause(){const{_whereClause:e,filterWhereClause:t}=this;return c(e,t)}async handleSelectionComplete(e){const{associationType:t,featureSpatialItems:r,graphic:s,_rulesTable:o}=this,{selection:a}=e;if(r.removeAll(),!(t&&s&&o&&a?.length))return;const i=this._convertTypeToDirection(t.type),n=a.filter(this._featureIsNotSelected),l=o.getFeaturesCanAssociateWith(s,n,i),u=await this._processFeatures(l);r.addMany(u)}reset(){this.highlightHelper?.removeAll(),this.featureSpatialItems.removeAll(),this.featurePage=1}_collectIfValidLayer(e,t){b(e)&&!g(e)&&t.add(e)}_collectIfValidParent(e,t){const r=e=>this._collectIfValidLayer(e,t);d(e)||"catalog-footprint"===e.type||(_(e)?(e.layers?.forEach(r),e.tables?.forEach(r)):m(e)?(e.sublayers?.forEach(r),e.subtables?.forEach(r)):g(e)?e.sublayers?.forEach(r):this._collectIfValidLayer(e,t))}async _queryFeatureCount(e){const{selectedLayer:t,_queryFeatureCountAbortController:r}=this;if(this._set("featureCount",0),!t)return;await t.load();const s=t.createQuery();s.returnGeometry=!1,s.where=c(s.where,e);const o=await t.queryFeatureCount(s,{signal:r?.signal});o>0&&this._set("featureCount",o)}async _query(){const{canQuery:e,queryWhereClause:t,_queryAbortController:r,featureItems:s}=this;e&&(this.featurePage=1,s.destroyAll(),this.featureCount&&!this.destroyed&&s.addMany(await this._queryAssociatedFeatures(t,{signal:r?.signal})))}async _queryPage(){const{canQuery:e,queryWhereClause:t,featurePage:r,_queryPageAbortController:s,featureCount:o,featureItems:a}=this;e&&(r<2||!o||a.addMany(await this._queryAssociatedFeatures(t,{signal:s?.signal})))}_convertTypeToDirection(e){switch(e){case"attachment":return[{type:"attachment",direction:"from"}];case"connectivity":return[{type:"junction-junction-connectivity"},{type:"junction-edge-from-connectivity"},{type:"junction-edge-midspan-connectivity"},{type:"junction-edge-to-connectivity"}];case"container":return[{type:"containment",direction:"to"}];case"content":return[{type:"containment",direction:"from"}];case"structure":return[{type:"attachment",direction:"to"}]}}async getRulesTable(){const{utilityNetwork:e}=this;if(!e)return null;if(this._rulesTable)return this._rulesTable;const t=await e.getRulesTable();return await(t?.load()),this._rulesTable=t,t}async _syncLayerItems(){a(this._setUpItemsTask);const{graphic:e,associationType:t,layerItems:r,tableItems:o,canLoadLayers:i}=this,n=s((async s=>{if(this.selectedLayer=null,r.removeAll(),o.removeAll(),!i)return;const a=this.mapLayers?.toArray(),n=this.mapTables?.toArray();if(!a&&!n)return;if(s.aborted)return;const l=await this.getRulesTable(),u=this._convertTypeToDirection(t.type);if(a?.length){const t=l?.getLayersCanAssociateWith(e,a,u);if(s.aborted)return;r.addMany(t||[])}if(n?.length){const t=l?.getLayersCanAssociateWith(e,n,u);if(s.aborted)return;o.addMany(t||[])}}));this._updatingHandlesSetUp.addPromise(n.promise),this._setUpItemsTask=n}async _setUpFeatures(){a(this._queryFeaturesTask);const{graphic:e,associationType:t,selectedLayer:r,canQuery:o}=this;if(!o)return;const i=s((async s=>{const o=await this.getRulesTable(),a=this._convertTypeToDirection(t.type),i=o?.getFeaturesCanAssociateWithClause(e,r,a);this._whereClause=i,s.aborted||(await this._queryFeatureCountDebounced(this.queryWhereClause),await this._queryDebounced())}));this._updatingHandlesQueryFeatures.addPromise(i.promise),this._queryFeaturesTask=i}_determineFromAndTo(e,t,r){return"from"===r?{fromFeature:e,toFeature:t}:{fromFeature:t,toFeature:e}}_determineJunctionEdgeConnectivity(e,t){const{utilityNetwork:r}=this,s=f(e.sourceLayer)?e.sourceLayer.parent:e.sourceLayer,o=f(t.sourceLayer)?t.sourceLayer.parent:t.sourceLayer;if(!(r&&s&&"layerId"in s&&o&&"layerId"in o))return{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"};const a=r.getSourceIdByLayerId(s.layerId),i=r.getSourceIdByLayerId(o.layerId);if(!a||!i)return{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"};const n="junction"===r.getSourceTypeById(a),l="junction"===r.getSourceTypeById(i);return n&&l?{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"}:l?{fromFeature:t,toFeature:e,type:"junction-edge-midspan-connectivity"}:{fromFeature:e,toFeature:t,type:"junction-edge-midspan-connectivity"}}_setUpAssociationHandles(){this.removeHandles(q),this.association&&this.addHandles(l((()=>[this.association?.associationType,this.association?.fromNetworkElement,this.association?.fromNetworkElement?.terminalId,this.association?.toNetworkElement,this.association?.toNetworkElement?.terminalId]),(()=>this.validateAssociation()),u),q)}_setUpAssociation(){const{utilityNetwork:e,graphic:t,selectedFeature:r,associationType:s}=this;if(!(e&&t&&r&&s))return void(this.association=null);const o=this._convertTypeToDirection(s.type);if(o.length>1){const{fromFeature:s,toFeature:o,type:a}=this._determineJunctionEdgeConnectivity(t,r.feature);return this.association=C({fromFeature:s,toFeature:o,utilityNetwork:e,associationType:a}),void this._setUpAssociationHandles()}const{fromFeature:a,toFeature:i}=this._determineFromAndTo(t,r.feature,o[0].direction);this.association=C({fromFeature:a,toFeature:i,utilityNetwork:e,associationType:o[0].type}),this._setUpAssociationHandles()}async _processFeatures(e){return Promise.all(e.map((async e=>{const{sourceLayer:t}=e;if(t&&"getFeatureTitle"in t){return{label:await t.getFeatureTitle(e)||F(e),feature:e}}return{label:F(e),feature:e}})))}async _queryAssociatedFeatures(e,t){const{featuresPerPage:r,layer:s,featurePage:o,featureCount:a,selectedLayer:i}=this,{canQuery:n,globalId:l}=this;if(!n||!s||!i||null==l)return[];const u=((o-1)*r+a)%a,y=r,{historicMoment:h,gdbVersion:p}=i,d=i.createQuery();d.where=c(d.where,e),d.start=u,d.num=y,d.returnGeometry=!1,d.historicMoment=h,d.gdbVersion=p,d.outFields=["*"];const g=await i.queryFeatures(d,{signal:t?.signal});return await this._processFeatures(g.features)}validateAssociation(){a(this._validateAssociationTask);const{utilityNetwork:e,association:t}=this,r=s((async()=>{e&&t&&(this._canAssociate=await e.canAddAssociation(t))}));this._updatingHandlesAssociation.addPromise(r.promise),this._validateAssociationTask=r}};e([y({type:t})],w.prototype,"graphic",void 0),e([y()],w.prototype,"layer",void 0),e([y()],w.prototype,"map",void 0),e([y({readOnly:!0})],w.prototype,"mapTables",null),e([y({readOnly:!0})],w.prototype,"mapLayers",null),e([y()],w.prototype,"utilityNetwork",void 0),e([y()],w.prototype,"associationType",void 0),e([y()],w.prototype,"state",null),e([y({readOnly:!0})],w.prototype,"canAddAssociation",null),e([y({readOnly:!0})],w.prototype,"globalId",null),e([y({readOnly:!0})],w.prototype,"globalIdField",null),e([y()],w.prototype,"featureCount",void 0),e([y({readOnly:!0})],w.prototype,"layerItems",null),e([y({readOnly:!0})],w.prototype,"tableItems",null),e([y({readOnly:!0})],w.prototype,"featureItems",null),e([y()],w.prototype,"featureSpatialItems",void 0),e([y()],w.prototype,"highlightHelper",void 0),e([y()],w.prototype,"_queryAbortController",void 0),e([y()],w.prototype,"_queryPageAbortController",void 0),e([y()],w.prototype,"_queryFeatureCountAbortController",void 0),e([y({value:1})],w.prototype,"featurePage",null),e([y()],w.prototype,"featuresPerPage",void 0),e([y({readOnly:!0})],w.prototype,"canLoadLayers",null),e([y({readOnly:!0})],w.prototype,"canQuery",null),e([y({readOnly:!0})],w.prototype,"updating",null),e([y()],w.prototype,"selectedLayer",null),e([y()],w.prototype,"selectedFeature",void 0),e([y()],w.prototype,"association",void 0),e([y()],w.prototype,"filterOptionsVisible",void 0),e([y()],w.prototype,"filterWhereClause",void 0),e([y()],w.prototype,"queryWhereClause",null),e([y()],w.prototype,"_rulesTable",void 0),e([y()],w.prototype,"_canAssociate",void 0),e([y()],w.prototype,"_whereClause",void 0),w=e([h("esri.widgets.FeatureForm.UtilityNetworkAssociationAddAssociationViewModel")],w);const T=w;export{T 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{isGroupColumn as t}from"./columnUtils.js";import{loadCalciteComponents as e}from"../../support/componentsUtils.js";const n={action:"EsriFeatureTableActionColumn",attachments:"EsriFeatureTableAttachmentsColumn",relationship:"EsriFeatureTableRelationshipColumn"},i=()=>e({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon")}),o=()=>Promise.all([e({input:()=>import("@esri/calcite-components/dist/components/calcite-input"),option:()=>import("@esri/calcite-components/dist/components/calcite-option"),select:()=>import("@esri/calcite-components/dist/components/calcite-select"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker")}),i()]),r=()=>Promise.all([e({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar")}),o()]);function c(t){return null!=t&&"object"==typeof t&&"createQuery"in t&&"getField"in t&&"queryFeatureCount"in t&&"queryFeatures"in t&&"queryObjectIds"in t&&"capabilities"in t&&"fields"in t&&"fieldsIndex"in t&&"id"in t&&"load"in t&&"objectIdField"in t&&"type"in t&&"when"in t}function s(t){return c(t)&&"queryAttachments"in t}function a(t){return s(t)&&"addAttachment"in t&&"deleteAttachments"in t&&"updateAttachment"in t}function l(t){return c(t)&&"editingEnabled"in t&&"applyEdits"in t}function p(t){return c(t)&&"relationships"in t&&"queryRelatedFeatures"in t&&"queryRelatedFeaturesCount"in t}function u(t){return null!=t&&"object"==typeof t&&"type"in t&&"map-image"===t.type}function m(t,e,n){if(e?.map)return d(t,[...e.map.allLayers,...e.map.allTables],n)}function d(t,e,{relatedTableId:n}){const i="scene"===t.type&&t.associatedLayer?t.associatedLayer.url:t.url,o=e=>!(!p(e)||e===t)&&("sublayer"===e.type&&e.layer?.url===t.url?e.id===n:i===e.url&&e.layerId===n);if("sublayer"===t.type&&u(t.parent)){const e=e=>p(e)&&e!==t&&e.id===n,i=t.parent,o=i.sublayers?.find(e)||i.subtables?.find(e);if(p(o))return o}let r=null;for(const c of e)if(u(c)){const t=c.sublayers?.find(o)||c.subtables?.find(o);if(t){r=t;break}}else if(o(c)){r=c;break}if(p(r))return r}function f(t,e){return null!=t&&Number.isInteger(t)&&t>-1&&t<e}function y(t){return null==t||0===t.trim().length}function b(t,e){return(t.relationships??[]).filter((t=>!(t.id===e&&"one-to-one"===t.cardinality))).map((({id:t})=>({relationshipId:t})))}function h(t,e){return t.relationships?.find((({id:t})=>t===e))}function w(t,e){return null==e?null:t?.fields?.find((t=>e.toLowerCase()===t.name?.toLowerCase()))}function F(t,e){return e.some((e=>!("group"!==e.type||!F(t,e.columnTemplates))||e.fieldName===t))}function g(e,n){return n?.some((n=>!(!t(n)||!g(e,n.columns))||n.fieldName===e))??!1}function C(t,e){return`${t.id}-${e}`}export{w as findField,m as findRelatedLayer,d as findRelatedLayerInSources,h as findRelationship,b as getRelationshipIdsToShow,C as getTableHighlightKey,g as hasColumnForField,F as hasTemplateForField,y as isEmptyStringOrWhitespace,c as isIFeatureTableSupportedLayer,s as isIFeatureTableSupportedLayerWithAttachments,a as isIFeatureTableSupportedLayerWithAttachmentsEditing,l as isIFeatureTableSupportedLayerWithEditing,p as isIFeatureTableSupportedLayerWithRelationships,u as isMapImageLayer,f as isPageIndexValid,i as loadColumnComponents,o as loadEditorColumnComponents,r as loadFieldColumnComponents,n as uniqueColumnNames};
5
+ import{isMapImageLayer as t}from"../../../layers/support/layerUtils.js";import{isGroupColumn as e}from"./columnUtils.js";import{loadCalciteComponents as n}from"../../support/componentsUtils.js";const i={action:"EsriFeatureTableActionColumn",attachments:"EsriFeatureTableAttachmentsColumn",relationship:"EsriFeatureTableRelationshipColumn"},o=()=>n({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon")}),r=()=>Promise.all([n({input:()=>import("@esri/calcite-components/dist/components/calcite-input"),option:()=>import("@esri/calcite-components/dist/components/calcite-option"),select:()=>import("@esri/calcite-components/dist/components/calcite-select"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker")}),o()]),c=()=>Promise.all([n({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar")}),r()]);function s(t){return null!=t&&"object"==typeof t&&"createQuery"in t&&"getField"in t&&"queryFeatureCount"in t&&"queryFeatures"in t&&"queryObjectIds"in t&&"capabilities"in t&&"fields"in t&&"fieldsIndex"in t&&"id"in t&&"load"in t&&"objectIdField"in t&&"type"in t&&"when"in t}function a(t){return s(t)&&"queryAttachments"in t}function l(t){return a(t)&&"addAttachment"in t&&"deleteAttachments"in t&&"updateAttachment"in t}function p(t){return s(t)&&"editingEnabled"in t&&"applyEdits"in t}function u(t){return s(t)&&"relationships"in t&&"queryRelatedFeatures"in t&&"queryRelatedFeaturesCount"in t}function m(t,e,n){if(e?.map)return d(t,[...e.map.allLayers,...e.map.allTables],n)}function d(e,n,{relatedTableId:i}){const o="scene"===e.type&&e.associatedLayer?e.associatedLayer.url:e.url,r=t=>!(!u(t)||t===e)&&("sublayer"===t.type&&t.layer?.url===e.url?t.id===i:o===t.url&&t.layerId===i);if("sublayer"===e.type&&t(e.parent)){const t=t=>u(t)&&t!==e&&t.id===i,n=e.parent,o=n.sublayers?.find(t)||n.subtables?.find(t);if(u(o))return o}let c=null;for(const s of n)if(t(s)){const t=s.sublayers?.find(r)||s.subtables?.find(r);if(t){c=t;break}}else if(r(s)){c=s;break}if(u(c))return c}function f(t,e){return null!=t&&Number.isInteger(t)&&t>-1&&t<e}function y(t){return null==t||0===t.trim().length}function b(t,e){return(t.relationships??[]).filter((t=>!(t.id===e&&"one-to-one"===t.cardinality))).map((({id:t})=>({relationshipId:t})))}function h(t,e){return t.relationships?.find((({id:t})=>t===e))}function w(t,e){return null==e?null:t?.fields?.find((t=>e.toLowerCase()===t.name?.toLowerCase()))}function F(t,e){return e.some((e=>!("group"!==e.type||!F(t,e.columnTemplates))||e.fieldName===t))}function g(t,n){return n?.some((n=>!(!e(n)||!g(t,n.columns))||n.fieldName===t))??!1}function C(t,e){return`${t.id}-${e}`}export{w as findField,m as findRelatedLayer,d as findRelatedLayerInSources,h as findRelationship,b as getRelationshipIdsToShow,C as getTableHighlightKey,g as hasColumnForField,F as hasTemplateForField,y as isEmptyStringOrWhitespace,s as isIFeatureTableSupportedLayer,a as isIFeatureTableSupportedLayerWithAttachments,l as isIFeatureTableSupportedLayerWithAttachmentsEditing,p as isIFeatureTableSupportedLayerWithEditing,u as isIFeatureTableSupportedLayerWithRelationships,f as isPageIndexValid,o as loadColumnComponents,r as loadEditorColumnComponents,c as loadFieldColumnComponents,i as uniqueColumnNames};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{watch as i,sync as l,initial as o,on as n}from"../core/reactiveUtils.js";import{formatFileSize as s}from"../core/unitFormatUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import{isLayerFromCatalog as c}from"../layers/catalog/catalogUtils.js";import{isKnowledgeGraphLayer as d,isSubtypeGroupLayer as h}from"../layers/support/layerUtils.js";import p from"../tables/AttributeTableTemplate.js";import m from"./Widget.js";import{isSupportedImage as u,getCalciteIconForAttachment as g}from"./Attachments/support/attachmentUtils.js";import{loadPromptComponents as w,Prompt as b}from"./Editor/components/Prompt.js";import v from"./FeatureTable/ColumnMenuVisibleElements.js";import y from"./FeatureTable/FeatureTableViewModel.js";import f from"./FeatureTable/VisibleElements.js";import{isGroupColumn as _}from"./FeatureTable/support/columnUtils.js";import{loadFieldColumnComponents as M,isIFeatureTableSupportedLayer as A,isIFeatureTableSupportedLayerWithAttachments as C,getRelationshipIdsToShow as S,isMapImageLayer as T}from"./FeatureTable/support/tableUtils.js";import{loadCalciteComponents as E}from"./support/componentsUtils.js";import{globalCss as I}from"./support/globalCss.js";import{getIconForLayer as V}from"./support/iconUtils.js";import{renderingSanitizer as R,storeNode as x,discardNode as k}from"./support/widgetUtils.js";import{messageBundle as D}from"./support/decorators/messageBundle.js";import{vmEvent as P}from"./support/decorators/vmEvent.js";import{tsx as F}from"./support/jsxFactory.js";import{substitute as L}from"../intl/substitute.js";var j;const O="esri-feature-table",z=`${O}__prompt`,$=`${O}__attachments-view`,U={base:O,content:`${O}__content`,menuPopover:`${O}__menu-popover`,layerDropdownMenu:`${O}__layer-switcher-menu`,tableContainer:`${O}__table-container`,tableContainerWithAttachments:`${O}__table-container--attachments`,tableNavigation:`${O}__table-navigation`,attachmentsView:$,attachmentsViewContent:`${$}__content`,attachmentsViewDropArea:`${$}__drop-area`,attachmentsViewIcon:`${$}__icon`,attachmentsViewInformation:`${$}__information`,attachmentsViewList:`${$}__list`,attachmentsViewListFileSize:`${$}__list__filesize`,attachmentsViewListItemDelete:`${$}__list-item--delete`,attachmentsViewListThumbnail:`${$}__list__thumbnail`,expanded:`${O}__expanded`,collapsed:`${O}__collapsed`,promptContainer:z,promptHeader:`${z}__header`,promptHeading:`${z}__header__heading`,promptMessage:`${z}__message`,promptDivider:`${z}__divider`,promptActions:`${z}__actions`},B={attachment:"attachment",chevronDown:"chevron-down",chevronLeft:"chevron-left",chevronRight:"chevron-right",clearSelection:"clear-selection",downloadTo:"download-to",exclamationMarkTriangle:"exclamation-mark-triangle",exportToCSV:"file-csv",folderOpen:"folder-open",delete:"trash",launch:"launch",layers:"layers",moveUp:"move-up",plus:"plus",refresh:"refresh",replaceImage:"replace-image",save:"save",showAll:"selection-x",showColumn:"show-column",showSelected:"selection-filter",upload:"upload",zoomToSelection:"zoom-to-object"};let H=j=class extends m{constructor(e,t){super(e,t),this._attachmentsInput=null,this._columnVisibilityActions=new Map,this.attachmentsList=null,this.description=null,this.disabled=!1,this.menuConfig=null,this.title=null,this.viewModel=new y,this.visibleElements=new f,this._showDeletePrompt=this._showDeletePrompt.bind(this),this._onDeleteSelectionClick=this._onDeleteSelectionClick.bind(this)}initialize(){this.addHandles([i((()=>[this.isQueryingOrSyncing,this.editingEnabled]),(()=>this.scheduleRender())),i((()=>[this._effectiveVisibleElements,this._effectiveVisibleElements.columnDescriptions,this._effectiveVisibleElements.columnMenus,this._effectiveVisibleElements.columnMenuItems,this.columns.length]),(()=>{this.columns.forEach((e=>e.visibleElements=this._effectiveVisibleElements)),this.refreshCellContent()}),l),i((()=>this._effectiveVisibleElements.selectionColumn),(e=>{this.grid&&(this.grid.selectionColumnEnabled=e)}),o),n((()=>this.viewModel),"show-related-table",(e=>this._onShowRelatedTable(e))),i((()=>this.editingEnabled),(()=>{const{attachmentsViewOptions:e}=this;this.clearPrompt(),e&&(e.form?.reset(),e.candidates=null)}))])}loadDependencies(){return Promise.all([E({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),alert:()=>import("@esri/calcite-components/dist/components/calcite-alert"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),pagination:()=>import("@esri/calcite-components/dist/components/calcite-pagination"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover"),progress:()=>import("@esri/calcite-components/dist/components/calcite-progress"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")}),w(),M()])}destroy(){this.drainRelatedTables(),this.clearPrompt()}get _effectiveDescription(){const{description:e}=this;return null!=e?R.sanitize("function"==typeof e?e():e):void 0}get _effectiveLayers(){const{layer:e,layers:t}=this,i=t?.length?t.filter(A):[],l=i.length?i:[...this._viewLayers];return e&&!l.includes(e)&&l.push(e),l}get _effectiveTitle(){const{layer:e,messages:t,state:i,highlightIds:l,title:o,size:n}=this;if(o)return R.sanitize("function"==typeof o?o():o);if(!e)return t.noLayer;switch(i){case"disabled":return t.errorLayer;case"ready":case"loading":return t.loading;case"error":return t.errorData}return L(t.header,{title:R.sanitize(e.title),count:n,selected:l.length})}get _effectiveVisibleElements(){return this.visibleElementsOverride??this.visibleElements}get _filteredTables(){const e=this.relatedTables.toArray(),t=1===e.length;return this.allRelatedTablesVisible?e:t?[e[0]]:this._shouldShowAttachmentsView?e.slice(-1):e.slice(-2)}get _hasAttachmentsViewError(){return null!=this.attachmentsViewOptions.error}get _hasCustomMenuItems(){return!!this.menuConfig?.items?.length}get _hasDefaultMenuItems(){return!!(this._showClearSelectionAction||this._showDeleteSelectionAction||this._showExportSelectionToCSVAction||this._showRefreshDataAction||this._showZoomToSelectionAction||this._showSelectedRecordsShowSelectedAction||this._showSelectedRecordsShowAllAction||this._showColumnsVisibilityAction)}get _shouldShowGrid(){return this.allRelatedTablesVisible||1===this.relatedTables.length&&!this._shouldShowAttachmentsView}get _shouldShowMenu(){const{header:e,menu:t}=this._effectiveVisibleElements;return!(!e||!t||!this._hasDefaultMenuItems&&!this._hasCustomMenuItems)}get _shouldShowAttachmentsView(){return!(null==this.attachmentsViewOptions.objectId&&!this.relatedTables.some((e=>null!=e.attachmentsViewOptions.objectId)))}get _showClearSelectionAction(){return!(!this.highlightIds.length||!this._effectiveVisibleElements.menuItems?.clearSelection||this.relatedTables.length)}get _showColumnsVisibilityAction(){const{header:e,menu:t,menuItems:i}=this._effectiveVisibleElements;return!(!(e&&t&&i?.toggleColumns)||this.showRelatedTableCallback||this.allRelatedTablesVisible||this._shouldShowAttachmentsView)}get _showDeleteSelectionAction(){return!(!(this.editingEnabled&&this.highlightIds.length&&this._effectiveVisibleElements.menuItems?.deleteSelection&&this.layer?.capabilities?.operations?.supportsDelete)||this.relatedTables.length)}get _showExportSelectionToCSVAction(){return!(!(this._effectiveVisibleElements.menuItems.exportSelectionToCSV&&this.layer&&this.highlightIds.length)||this.relatedTables.length)}get _showLayerDropdown(){return!(!this._effectiveLayers.length||!this._effectiveVisibleElements.layerDropdown)}get _shouldShowNavigationBar(){const e=!!this.relatedTable||this._shouldShowAttachmentsView;return!this.tableParent&&e}get _showRefreshDataAction(){return!!this._effectiveVisibleElements.menuItems?.refreshData}get _showSelectedRecordsShowSelectedAction(){const e=this.objectIds.length,t=this.highlightIds.length;return!(!t||!this._effectiveVisibleElements.menuItems?.selectedRecordsShowSelectedToggle||e&&t===e||this.relatedTables.length)}get _showSelectedRecordsShowAllAction(){return!(!this._effectiveVisibleElements.menuItems?.selectedRecordsShowAllToggle||!this.objectIds.length||this.relatedTables.length)}get _showZoomToSelectionAction(){return!(!this.view||!this.highlightIds.length||this.effectiveTable.layer?.isTable||!this._effectiveVisibleElements.menuItems?.zoomToSelection)}get _viewLayers(){const e=this.view?.map;if(!e)return[];const t=new Set,i=e=>{!A(e)||h(e)||t.has(e)||(e.load(),t.add(e))},l=e=>{c(e)||"catalog-footprint"===e.type||(d(e)?(e.load(),e.layers?.forEach(i),e.tables?.forEach(i)):T(e)?(e.loadAll(),e.sublayers?.forEach(i),e.subtables?.forEach(i)):h(e)?(e.loadAll(),e.sublayers?.forEach(i)):i(e))};return e.allLayers.forEach(l),e.allTables.forEach(l),[...t.values()]}get grid(){return this.viewModel.grid}get actionColumnConfig(){return this.viewModel.actionColumnConfig}set actionColumnConfig(e){this.viewModel.actionColumnConfig=e}get activeFilters(){return this.viewModel.activeFilters}get activeSortOrders(){return this.viewModel.activeSortOrders}get allColumns(){return this.viewModel.allColumns}get allRelatedTablesVisible(){return this.viewModel.allRelatedTablesVisible}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get attachmentsViewOptions(){return this.viewModel.attachmentsViewOptions}set attachmentsViewOptions(e){this.viewModel.attachmentsViewOptions=e}get attributeTableTemplate(){return this.viewModel.attributeTableTemplate}set attributeTableTemplate(e){this.viewModel.attributeTableTemplate=e}get autoRefreshEnabled(){return this.viewModel.autoRefreshEnabled}set autoRefreshEnabled(e){this.viewModel.autoRefreshEnabled=e}get clearPrompt(){return this.viewModel.clearPrompt}set clearPrompt(e){this.viewModel.clearPrompt=e}get columnPerformanceModeEnabled(){return this.viewModel.columnPerformanceModeEnabled}set columnPerformanceModeEnabled(e){this.viewModel.columnPerformanceModeEnabled=e}get columnReorderingEnabled(){return this.viewModel.columnReorderingEnabled}set columnReorderingEnabled(e){this.viewModel.columnReorderingEnabled=e}get columns(){return this.viewModel.columns}get definitionExpression(){return this.viewModel.definitionExpression}set definitionExpression(e){this.viewModel.definitionExpression=e}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get effectiveSize(){return this.viewModel.effectiveSize}get effectiveTable(){return this.relatedTable||this}get filterGeometry(){return this.viewModel.filterGeometry}set filterGeometry(e){this.viewModel.filterGeometry=e}get filterBySelectionEnabled(){return this.viewModel.filterBySelectionEnabled}set filterBySelectionEnabled(e){this.viewModel.filterBySelectionEnabled=e}get hiddenFields(){return this.viewModel.hiddenFields}set hiddenFields(e){this.viewModel.hiddenFields=e}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(e){this.viewModel.highlightEnabled=e}get highlightIds(){return this.viewModel.highlightIds}set highlightIds(e){this.viewModel.highlightIds=e}get icon(){return"table"}set icon(e){this._overrideIfSome("icon",e)}get initialSize(){return this.viewModel.initialSize}set initialSize(e){this.viewModel.initialSize=e}get isQueryingOrSyncing(){return this.viewModel.isQueryingOrSyncing}get isSyncingAttachments(){return this.viewModel.isSyncingAttachments}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get layers(){return this.viewModel.layers}set layers(e){this.viewModel.layers=e}get layerView(){return this.viewModel.layerView}get maxSize(){return this.viewModel.maxSize}set maxSize(e){this.viewModel.maxSize=e}get messages(){return this.viewModel.messages}set messages(e){this.viewModel.messages=e}get messagesCommon(){return this.viewModel.messagesCommon}set messagesCommon(e){this.viewModel.messagesCommon=e}get messagesUnits(){return this.viewModel.messagesUnits}set messagesUnits(e){this.viewModel.messagesUnits=e}get messagesURIUtils(){return this.viewModel.messagesURIUtils}set messagesURIUtils(e){this.viewModel.messagesURIUtils=e}get multipleSelectionEnabled(){return this.viewModel.multipleSelectionEnabled}set multipleSelectionEnabled(e){this.viewModel.multipleSelectionEnabled=e}get multiSortEnabled(){return this.viewModel.multiSortEnabled}set multiSortEnabled(e){this.viewModel.multiSortEnabled=e}get multipleSortPriority(){return this.viewModel.multipleSortPriority}set multipleSortPriority(e){this.viewModel.multipleSortPriority=e}get noDataMessage(){return this.viewModel.noDataMessage}set noDataMessage(e){this.viewModel.noDataMessage=e}get objectIds(){return this.viewModel.objectIds}set objectIds(e){this.viewModel.objectIds=e}get outFields(){return this.viewModel.outFields}set outFields(e){this.viewModel.outFields=e}get pageCount(){return this.viewModel.pageCount}get pageIndex(){return this.viewModel.pageIndex}set pageIndex(e){this.viewModel.pageIndex=e}get pageSize(){return this.viewModel.pageSize}set pageSize(e){this.viewModel.pageSize=e}get paginationEnabled(){return this.viewModel.paginationEnabled}set paginationEnabled(e){this.viewModel.paginationEnabled=e}get prompt(){return this.viewModel.prompt}set prompt(e){this.viewModel.prompt=e}get relatedRecordsEnabled(){return this.viewModel.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.viewModel.relatedRecordsEnabled=e}get relatedTable(){return this.viewModel.relatedTable}get relatedTables(){return this.viewModel.relatedTables}set relatedTables(e){this.viewModel.relatedTables=e}get relationship(){return this.viewModel.relationship}get relationshipColumnConfigs(){return this.viewModel.relationshipColumnConfigs}set relationshipColumnConfigs(e){this.viewModel.relationshipColumnConfigs=e}get relationshipConfig(){return this.viewModel.relationshipConfig}set relationshipConfig(e){this.viewModel.relationshipConfig=e}get relationshipInfos(){return this.viewModel.relationshipInfos}get returnGeometryEnabled(){return this.viewModel.returnGeometryEnabled}set returnGeometryEnabled(e){this.viewModel.returnGeometryEnabled=e}get returnMEnabled(){return this.viewModel.returnMEnabled}set returnMEnabled(e){this.viewModel.returnMEnabled=e}get returnZEnabled(){return this.viewModel.returnZEnabled}set returnZEnabled(e){this.viewModel.returnZEnabled=e}get rowHighlightIds(){return this.viewModel.rowHighlightIds}set rowHighlightIds(e){this.viewModel.rowHighlightIds=e}get selectionSource(){return this.viewModel.selectionSource}set selectionSource(e){this.viewModel.selectionSource=e}get showAllRelatedTables(){return this.viewModel.showAllRelatedTables}set showAllRelatedTables(e){this.viewModel.showAllRelatedTables=e}get showPrompt(){return this.viewModel.showPrompt}set showPrompt(e){this.viewModel.showPrompt=e}get showRelatedTableCallback(){return this.viewModel.showRelatedTableCallback}set showRelatedTableCallback(e){this.viewModel.showRelatedTableCallback=e}get size(){return this.viewModel.size}get state(){return this.viewModel.state}get supportsAddAttachments(){return this.viewModel.supportsAddAttachments}get supportsAttachments(){return this.viewModel.supportsAttachments}get supportsDeleteAttachments(){return this.viewModel.supportsDeleteAttachments}get supportsResizeAttachments(){return this.viewModel.supportsResizeAttachments}get supportsUpdateAttachments(){return this.viewModel.supportsUpdateAttachments}get tableController(){return this.viewModel.tableController}set tableController(e){this.viewModel.tableController=e}get tableParent(){return this.viewModel.tableParent}set tableParent(e){this.viewModel.tableParent=e}get tableTemplate(){return this.viewModel.tableTemplate}set tableTemplate(e){this.viewModel.tableTemplate=e}get tableTemplateOverride(){return this.viewModel.tableTemplateOverride}set tableTemplateOverride(e){this.viewModel.tableTemplateOverride=e}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(e){this.viewModel.timeExtent=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visibleElementsOverride(){const{attachmentsViewOptions:e,relatedTable:t,tableController:i,visibleElements:l}=this,{columnDescriptions:o,columnMenus:n,tooltips:s}=l,a=null!=e.objectId;if(t)return new f({columnDescriptions:o,columnMenus:n,tooltips:s,close:l.close,header:l.header,layerDropdown:l.layerDropdown,layerDropdownIcons:l.layerDropdownIcons,menu:l.menu,menuItems:l.menuItems,progress:l.progress,selectionColumn:!1,columnMenuItems:new v({sortAscending:!1,sortDescending:!1})});if(i){const e=i.relatedTable===this,t=i.allRelatedTablesVisible,r=e&&l.selectionColumn&&!t&&!a,c=e&&!t&&!a;return new f({columnDescriptions:o,columnMenus:n,tooltips:s,selectionColumn:r,close:!1,header:!1,layerDropdown:!1,menu:!1,progress:!1,columnMenuItems:new v({sortAscending:c,sortDescending:c})})}return a?new f({columnDescriptions:o,columnMenus:n,tooltips:s,close:l.close,header:l.header,layerDropdown:l.layerDropdown,layerDropdownIcons:l.layerDropdownIcons,menu:l.menu,menuItems:l.menuItems,progress:l.progress,selectionColumn:!1,columnMenuItems:new v({sortAscending:!1,sortDescending:!1})}):null}clearSelectionFilter(){this.viewModel.clearSelectionFilter()}async deleteAttachments(e,t,i){null!=e&&t?.length&&(i?this._showDeleteAttachmentPrompt(e,t):await this.viewModel.deleteAttachments(e,t))}deleteSelection(e){return this.highlightIds.length?e?(this._showDeletePrompt(),this.scheduleRender(),Promise.resolve()):this.viewModel.deleteSelection():Promise.resolve()}async downloadAttachmentById(e,t){return this.viewModel.downloadAttachmentById(e,t)}drainRelatedTables(){this.viewModel.drainRelatedTables()}exportSelectionToCSV(e){return this.viewModel.exportSelectionToCSV(e)}filterBySelection(){this.viewModel.filterBySelection()}findColumn(e){return this.viewModel.findColumn(e)}goToPage(e){this.viewModel.goToPage(e)}hideColumn(e){this.grid?.hideColumn(e)}nextPage(){this.viewModel.nextPage()}previousPage(){this.viewModel.previousPage()}async refresh(){await this.viewModel.refresh()}refreshCellContent(){this.viewModel.refreshCellContent()}async saveAttachmentsViewForm(){await this.viewModel.saveAttachmentsViewForm()}showAllColumns(){this.viewModel.showAllColumns()}showColumn(e){this.grid?.showColumn(e)}sortColumn(e,t){this.viewModel.sortColumn(e,t)}scrollLeft(){this.viewModel.scrollLeft()}scrollToBottom(){this.viewModel.scrollToBottom()}scrollToIndex(e){this.viewModel.scrollToIndex(e)}scrollToRow(e){this.viewModel.scrollToRow(e)}scrollToTop(){this.viewModel.scrollToTop()}toggleColumnVisibility(e){this.viewModel.toggleColumnVisibility(e)}zoomToSelection(){this.effectiveTable.viewModel.zoomToSelection()}render(){const{_effectiveVisibleElements:e,isQueryingOrSyncing:t,menuConfig:i,state:l}=this;return F("div",{bind:this,class:this.classes(U.base,I.widget)},F("calcite-panel",{bind:this,class:U.content,closable:e.close,description:this._effectiveDescription,disabled:this.disabled||"disabled"===l&&!this._effectiveLayers?.length,heading:e.header?this._effectiveTitle:void 0,loading:"loading"===l,menuOpen:!!i?.open,overlayPositioning:"fixed",onCalcitePanelClose:e=>{e.currentTarget.closed=!1,this.emit("close")}},e.progress?F("calcite-progress",{type:t?"indeterminate":"determinate"}):null,this._showLayerDropdown?this._renderLayerDropdown():null,this._renderColumnVisibilityAction(),this._renderHeaderMenuActions(),this._renderNavigationBar(),this._renderTables(),this._renderError()),this._renderColumnVisibilityPopover(),this._renderPrompt())}_renderTables(){const{grid:e,relatedTables:t}=this,i=this.classes(U.tableContainer);if(t.length){const l=this.classes(U.base,this.allRelatedTablesVisible?U.expanded:U.collapsed,this._shouldShowAttachmentsView?U.tableContainerWithAttachments:void 0);return F("div",{class:i},F("calcite-panel",{overlayPositioning:"fixed"},F("div",null,[this._shouldShowGrid?F("div",{class:l},e?.render(),this._renderPagination()):void 0,...this._filteredTables.map((e=>{const i=t.indexOf(e);return F("div",{class:l,key:`related-${i}`},e.render())})),,])))}return null!=this.attachmentsViewOptions.objectId?F("div",{class:i},F("calcite-panel",{overlayPositioning:"fixed"},F("div",null,[F("div",{class:this.classes(U.base,U.collapsed)},e?.render(),this._renderPagination()),this._renderAttachmentsView()]))):[F("div",{class:i},e?.render()),this._renderPagination()]}_renderPagination(){if(this.paginationEnabled)return F("calcite-pagination",{pageSize:1,startItem:this.pageIndex+1,totalItems:this.pageCount,onCalcitePaginationChange:e=>this.goToPage(e.currentTarget.startItem-1)})}_renderError(){const{messages:e}=this;return F("calcite-alert",{autoClose:!0,autoCloseDuration:"fast",icon:B.exclamationMarkTriangle,kind:"danger",label:e.errorOccured,open:this._hasAttachmentsViewError,slot:"alerts",onCalciteAlertClose:()=>{this.attachmentsViewOptions.error=null}},F("span",{slot:"message"},e.errorOccured))}_renderPrompt(){return this.prompt?F(b,{...this.prompt,headingLevel:2}):void 0}_showDeletePrompt(){const{messages:e,messagesCommon:t}=this,i=L(e.deleteSelectionCount,{count:this.highlightIds.length});this.showPrompt({title:i,message:e.deleteRecordsRemoved,context:"danger",actions:{primary:{label:t.delete,action:this._onDeleteSelectionClick},secondary:{label:e.keepRecords,action:()=>this.clearPrompt()}}})}_showDeleteAttachmentPrompt(e,t){const{messages:i,messagesCommon:l}=this,o=L(i.deleteAttachmentCount,{count:t.length});this.showPrompt({title:o,message:i.deleteAttachmentConfirmation,context:"danger",actions:{primary:{label:l.delete,action:async()=>{try{await this.deleteAttachments(e,t,!1)}finally{this.clearPrompt()}}},secondary:{label:l.cancel,action:()=>this.clearPrompt()}}})}async _onDeleteSelectionClick(){try{await this.viewModel.deleteSelection()}finally{this.clearPrompt()}}_renderHeaderMenuAction(e){const{disabled:t,hidden:i,icon:l,text:o,clickFunction:n}=e;if(!i)return F("calcite-action",{disabled:t??this.menuConfig?.disabled,icon:l??void 0,key:o,onclick:()=>n(),slot:"header-menu-actions",text:o,textEnabled:!0,title:o})}_renderHeaderMenuActions(){return this._shouldShowMenu?[this._renderDefaultHeaderMenuActions(),this._renderCustomHeaderMenuActions()]:[]}_renderDefaultHeaderMenuActions(){if(!this._hasDefaultMenuItems)return[];const{messages:e}=this;return[this._showRefreshDataAction&&{icon:B.refresh,text:e.refreshData,clickFunction:()=>this.refresh()},this._showDeleteSelectionAction&&{icon:B.delete,text:e.deleteSelection,clickFunction:()=>this.deleteSelection(!0)},this._showClearSelectionAction&&{icon:B.clearSelection,text:e.clearSelection,clickFunction:()=>this.highlightIds?.removeAll()},this._showZoomToSelectionAction&&{icon:B.zoomToSelection,text:e.zoomToSelection,clickFunction:()=>this.zoomToSelection()},this._showSelectedRecordsShowSelectedAction&&{icon:B.showSelected,text:e.showSelected,clickFunction:()=>{const{objectIds:e}=this;e.removeAll(),e.addMany(this.highlightIds.toArray())}},this._showSelectedRecordsShowAllAction&&{icon:B.showAll,text:e.showAllRecords,clickFunction:()=>this.objectIds.removeAll()},this._showExportSelectionToCSVAction&&{icon:B.exportToCSV,text:e.exportSelectionCSV,clickFunction:()=>this.exportSelectionToCSV()}].filter(t).map((e=>e&&this._renderHeaderMenuAction(e)))}_renderCustomHeaderMenuActions(){return this.menuConfig?.items?.map((({disabled:e,hidden:t,icon:i,label:l,clickFunction:o})=>this._renderHeaderMenuAction({hidden:"function"==typeof t?t():t,icon:i,text:l,disabled:e,clickFunction:e=>o(e)})))??[]}_renderColumnVisibilityAction(){if(!this._showColumnsVisibilityAction)return[];const{_columnVisibilityActions:e,effectiveTable:t,id:i}=this,l=this.messages.toggleColumns;return F("calcite-action",{afterCreate:t=>e.set(i,t),afterRemoved:()=>e.delete(i),appearance:"transparent",bind:this,disabled:t.menuConfig?.disabled,icon:B.showColumn,id:`${i}__toggle-columns-action`,slot:"header-actions-end",text:l},this._effectiveVisibleElements.tooltips?F("calcite-tooltip",{closeOnClick:!0,overlayPositioning:"fixed",placement:"bottom-end",slot:"tooltip"},l):null)}_renderColumnVisibilityPopover(){if(!this._showColumnsVisibilityAction||this.effectiveTable.menuConfig?.disabled)return;const{effectiveTable:e}=this,t=this.messages.toggleColumns;return F("calcite-popover",{autoClose:!0,class:U.menuPopover,label:t,overlayPositioning:"fixed",placement:"top-end",pointerDisabled:!0,referenceElement:this._columnVisibilityActions.get(this.id)},F("calcite-list",{displayMode:"nested",filterEnabled:!0,filterPlaceholder:t,label:t,selectionMode:"multiple"},e.columns.toArray().map((t=>{const i=_(t)?t.columns?.map((t=>this._renderColumnListItem({column:t,table:e,ignoreSelect:!0}))):void 0;return this._renderColumnListItem({column:t,table:e,items:i})}))))}_renderColumnListItem(e){const{column:t,table:i,items:l,ignoreSelect:o}=e,{effectiveLabel:n,fieldName:s,hidden:a}=t;return F("calcite-list-item",{expanded:!(!l?.length||a)||void 0,key:`toggle-columns__item-${s}`,label:n,selected:!a,value:s,onCalciteListItemSelect:e=>{o&&e.stopPropagation(),i.toggleColumnVisibility(e.currentTarget.value)}},l)}_renderLayerDropdown(){const e=this.messages.selectALayer;return F("div",{class:U.layerDropdownMenu,key:`${this.id}-layerDropdown`,slot:"header-actions-start"},F("calcite-dropdown",{bind:this,maxItems:5,overlayPositioning:"fixed",placement:"bottom-start"},F("calcite-action",{icon:B.layers,slot:"trigger",text:e,title:e}),F("calcite-dropdown-group",{selectionMode:"single"},this._effectiveLayers.map(((e,t)=>this._renderLayerDropdownItem(e,t)))??null)))}_renderLayerDropdownItem(e,t){const i=this.visibleElements.layerDropdownIcons;return F("calcite-dropdown-item",{iconStart:i?V(e):void 0,key:`dropdown-item-${t}`,label:e.title??"",selected:e===this.layer,value:e.id,onCalciteDropdownItemSelect:()=>{this.layer=e}},e.title)}_onRelatedNavigationItemClick(e){this.viewModel.drainRelatedTablesAboveIndex(e)}_collapseRelatedTable(e){this.viewModel.collapseRelatedTable(this.effectiveTable,e)}_onShowRelatedTable(e){this.showRelatedTableCallback||(this._collapseRelatedTable(e),this._createRelatedTable(e))}async _createRelatedTable(e){const{editingEnabled:t,effectiveTable:i,paginationEnabled:l,pageSize:o,view:n,viewModel:s}=this,{layer:a,objectId:r,relatedLayer:c,relationshipId:d}=e;await a.load();const h=this.attachmentsEnabled&&C(a),p=new j({layer:a,attachmentsEnabled:h,editingEnabled:t,paginationEnabled:l,pageSize:o,relatedRecordsEnabled:!0,relationshipConfig:{objectId:r,relatedLayer:c,relationshipId:d},relationshipColumnConfigs:S(a,d),tableController:this,tableParent:i,view:n,showRelatedTableCallback:e=>s.emit("show-related-table",e)});this.relatedTables.add(p),this.scheduleRender()}_renderAttachmentsView(){const{attachmentInfos:e,mode:t,objectId:i}=this.attachmentsViewOptions;return"file"!==t&&e.length&&null!=i?this._renderAttachmentsViewList():this._renderAttachmentsViewFilePane()}_renderAttachmentsViewFilePane(){const{attachmentsViewOptions:e,isSyncingAttachments:t,supportsAddAttachments:i,messages:l,messagesUnits:o}=this,{attachmentId:n,attachmentInfos:a,candidates:r,objectId:c}=e,d=a.find((e=>e.id===n)),h=a.length,p=r?.length,m=d?F("calcite-label",{alignment:"center",key:"replace-file-node",scale:"l"},l.replaceFile):void 0,u=p?void 0:F("calcite-label",{alignment:"center",key:"message-node",scale:"m"},i?null==c?l.noFeature:l.dragAndDropToUpload:l.editingRestricted),g=Array.from(r??[]).pop(),w=g?F("calcite-label",{key:"filename-node"},g.name):void 0,b=i&&null!=c,v=b&&p,y=F("input",{afterCreate:x,afterRemoved:k,afterUpdate:x,bind:this,"data-node-ref":"_attachmentsInput",files:r,hidden:!0,name:"attachment",onchange:e=>this._onAttachmentsViewCandidateChange(e),type:"file"}),f=b?F("calcite-button",{appearance:"outline-fill",bind:this,disabled:t,iconStart:B.folderOpen,key:"select-node",loading:!1,onclick:()=>{this._attachmentsInput?.click()},width:"full"},l.selectFile):void 0,_=v?F("calcite-button",{appearance:"outline-fill",bind:this,disabled:t,iconStart:B.save,key:"save-node",loading:t,onclick:()=>{this.saveAttachmentsViewForm()},width:"full"},d?l.updateAttachment:l.addAttachment):void 0,M=h||p?F("calcite-button",{appearance:"transparent",bind:this,disabled:t,key:"cancel-node",onclick:()=>{this._attachmentsInput&&(this._attachmentsInput.value=""),e.reset(),e.attachmentInfos?.length&&(e.mode="list")},width:"full"},this.messagesCommon.cancel):void 0;return[F("div",{class:U.attachmentsView,key:"attachments-view"},F("div",{class:U.attachmentsViewContent,key:"attachments-view-content"},F("div",{bind:this,class:U.attachmentsViewDropArea,ondragover:e=>e.preventDefault(),ondrop:this._onAttachmentsViewDrop},F("calcite-icon",{class:U.attachmentsViewIcon,icon:B.upload,scale:"l"}),m,u,F("form",{afterCreate:t=>e.form=t,afterRemoved:()=>e.form=null,bind:this,key:"attachments-form"},F("fieldset",null,w,y,f,_,M)))),null!=c&&null!=d?F("div",{class:U.attachmentsViewInformation,key:"information"},this._renderAttachmentsViewThumbnail(d,200),F("label",{key:"file-label"},l.fileName),F("span",{key:"file-span"},d.name),F("label",{key:"size-label"},l.size),F("span",{key:"size-span"},s(o,d.size??0))):void 0)]}_renderAttachmentsViewList(){const{attachmentsViewOptions:e,isSyncingAttachments:t,messages:i,messagesUnits:l,supportsDeleteAttachments:o,supportsUpdateAttachments:n}=this,{attachmentInfos:a,objectId:r}=e;return F("calcite-list",{afterCreate:x,afterRemoved:k,afterUpdate:x,bind:this,class:U.attachmentsViewList,"data-node-ref":"attachmentsList",key:`attachments-list-${r}`,label:i?.attachments,loading:t,ondragover:e=>e.preventDefault(),ondrop:this._onAttachmentsViewDrop,selectionMode:"multiple",onCalciteListChange:()=>this.scheduleRender()},...a?.map((t=>{const{id:a,name:c,size:d,url:h}=t,p=s(l,d??0);return F("calcite-list-item",{afterRemoved:()=>this.scheduleRender(),key:`attachment-${a}`,label:c,value:a},this._renderAttachmentsViewListThumbnail(t),F("span",{class:U.attachmentsViewListFileSize,slot:"actions-end",title:p},p),F("calcite-action",{appearance:"transparent",icon:B.downloadTo,key:`download-attachment-${a}`,label:`${c}`,onclick:e=>{e.preventDefault(),this.downloadAttachmentById(r??-1,a)},slot:"actions-end",text:i.downloadAttachment,title:i.downloadAttachment}),n&&null!=r?F("calcite-action",{appearance:"transparent",disabled:!n,icon:B.replaceImage,key:`replace-attachment-${a}`,label:`${c}`,onclick:()=>{e.mode="file",e.attachmentId=a},slot:"actions-end",text:i.updateAttachment,title:i.updateAttachment}):void 0,F("calcite-action",{appearance:"transparent",icon:B.launch,key:`launch-attachment-${a}`,label:`${c}`,onclick:()=>{h&&window.open(h,"_blank")},slot:"actions-end",text:i.viewAttachment,title:i.viewAttachment}),o&&null!=r?F("calcite-action",{appearance:"transparent",class:U.attachmentsViewListItemDelete,disabled:!o,icon:B.delete,key:`delete-attachment-${a}`,label:`${c}`,onclick:()=>{this.deleteAttachments(r,[a],!0)},slot:"actions-end",text:i.deleteAttachment,title:i.deleteAttachment}):void 0)})))}_renderAttachmentsViewListThumbnail(e){return F("div",{class:U.attachmentsViewListThumbnail,slot:"content-start"},F("a",{href:e.url??"",rel:"noreferrer",target:"_blank"},this._renderAttachmentsViewThumbnail(e)))}_renderAttachmentsViewThumbnail(e,t=64){const{contentType:i,name:l,size:o,url:n}=e,s=`${n}${n?.includes("?")?"&":"?"}w=${t}&s=${o}`;return this.supportsResizeAttachments&&u(i)?F("img",{alt:l,key:`thumbnail-image-${l}`,src:s,title:l}):F("calcite-icon",{icon:g(i),key:`thumbnail-icon-${l}`,scale:"l",textLabel:l,title:l})}_onAttachmentsViewCandidateChange({target:e}){this.attachmentsViewOptions.candidates=e?.files}_onAttachmentsViewDrop(e){e.preventDefault(),(this.supportsAddAttachments||this.supportsUpdateAttachments)&&this.attachmentsViewOptions.set({mode:"file",candidates:e.dataTransfer?.files})}_renderNavigationBar(){const{effectiveTable:e,messages:t,messagesCommon:i,relatedTable:l,relatedTables:o}=this;if(!this._shouldShowNavigationBar)return;const{attachmentsList:n,attachmentsViewOptions:s,layer:a,supportsAddAttachments:r,supportsDeleteAttachments:c}=e;if(!a)return;const{attachmentInfos:d,objectId:h}=s,p=null!=h,m=d.length,u=n?.selectedItems?.length??0,g=`${a.objectIdField}: ${h}`,w=L(t.selectedCount,{count:u}),b=L(t.attachmentsCount,{count:m}),v=p?F("calcite-action",{bind:this,icon:B.chevronRight,iconFlipRtl:!0,key:"navigation-feature",onclick:()=>e.scrollToRow(h),text:g,textEnabled:!0,title:g}):void 0,y=p?F("calcite-action",{icon:B.chevronRight,iconFlipRtl:!0,key:"navigation-attachments-label",label:b,onclick:()=>{m>0&&(s.mode="list")},text:b,textEnabled:!0,title:b}):void 0,f=p?F("calcite-chip",{closable:!0,closed:0===u,key:"navigation-chip",kind:"inverse",label:w,selected:!0,title:w,value:"selected",onCalciteChipClose:()=>n?.selectedItems?.forEach((e=>e.selected=!1))},w):void 0,_=l?F("calcite-label",{layout:"inline"},t.showAllTables,F("calcite-switch",{checked:this.allRelatedTablesVisible,onCalciteSwitchChange:e=>this.showAllRelatedTables=!!e.currentTarget.checked})):void 0,M=p&&"list"===s.mode&&null!=h&&u&&c?F("calcite-action",{icon:B.delete,iconFlipRtl:!0,key:"attachments-trash-all",onclick:()=>{e.deleteAttachments(h,n?.selectedItems?.map((e=>e.value))??[],!0)},text:i.delete,textEnabled:!0,title:L(t.deleteAttachmentCount,{count:u})}):void 0,A=p&&"list"===s.mode&&r?F("calcite-action",{bind:this,icon:B.plus,iconFlipRtl:!0,key:"attachments-add",onclick:()=>{s.attachmentId=null,s.mode="file"},text:t.addAttachment,textEnabled:!0,title:t.addAttachment}):void 0;return F("div",{class:U.tableNavigation,key:"table-nav"},F("calcite-action",{icon:B.moveUp,iconFlipRtl:!0,key:"go-back",onclick:()=>{l&&this.drainRelatedTables(),e.attachmentsViewOptions.objectId=null},text:this.layer?.title??"",textEnabled:!1,title:l?t.exitRelatedRecords:t.exitAttachments}),o.toArray().map(((e,t)=>this._renderRelatedTableNavigationAction(e,t))),v,y,F("div",null,f,_,M,A))}_renderRelatedTableNavigationAction(e,t){const i=this._getLabelForRelatedTableNavigationAction(e);return F("calcite-action",{icon:B.chevronRight,iconFlipRtl:!0,key:t,onclick:()=>this._onRelatedNavigationItemClick(t),text:i,textEnabled:!0,title:e.layer?.title||""})}_getLabelForRelatedTableNavigationAction(e){const t=e.layer?.title;if(!t)return"";const{relatedTables:i}=this;if(i.length<=1)return t;return i.indexOf(e)!==i.length-1&&t.length>20?`${t.slice(0,20)}...`:t}};e([a()],H.prototype,"_attachmentsInput",void 0),e([a()],H.prototype,"_columnVisibilityActions",void 0),e([a()],H.prototype,"_effectiveDescription",null),e([a()],H.prototype,"_effectiveLayers",null),e([a()],H.prototype,"_effectiveTitle",null),e([a()],H.prototype,"_effectiveVisibleElements",null),e([a()],H.prototype,"_filteredTables",null),e([a()],H.prototype,"_hasAttachmentsViewError",null),e([a()],H.prototype,"_hasCustomMenuItems",null),e([a()],H.prototype,"_hasDefaultMenuItems",null),e([a()],H.prototype,"_shouldShowGrid",null),e([a()],H.prototype,"_shouldShowMenu",null),e([a()],H.prototype,"_shouldShowAttachmentsView",null),e([a()],H.prototype,"_showClearSelectionAction",null),e([a()],H.prototype,"_showColumnsVisibilityAction",null),e([a()],H.prototype,"_showDeleteSelectionAction",null),e([a()],H.prototype,"_showExportSelectionToCSVAction",null),e([a()],H.prototype,"_showLayerDropdown",null),e([a()],H.prototype,"_shouldShowNavigationBar",null),e([a()],H.prototype,"_showRefreshDataAction",null),e([a()],H.prototype,"_showSelectedRecordsShowSelectedAction",null),e([a()],H.prototype,"_showSelectedRecordsShowAllAction",null),e([a()],H.prototype,"_showZoomToSelectionAction",null),e([a()],H.prototype,"_viewLayers",null),e([a()],H.prototype,"attachmentsList",void 0),e([a({readOnly:!0})],H.prototype,"grid",null),e([a()],H.prototype,"actionColumnConfig",null),e([a({readOnly:!0})],H.prototype,"activeFilters",null),e([a({readOnly:!0})],H.prototype,"activeSortOrders",null),e([a()],H.prototype,"allColumns",null),e([a({readOnly:!0})],H.prototype,"allRelatedTablesVisible",null),e([a()],H.prototype,"attachmentsEnabled",null),e([a()],H.prototype,"attachmentsViewOptions",null),e([a({type:p})],H.prototype,"attributeTableTemplate",null),e([a()],H.prototype,"autoRefreshEnabled",null),e([a()],H.prototype,"clearPrompt",null),e([a()],H.prototype,"columnPerformanceModeEnabled",null),e([a()],H.prototype,"columnReorderingEnabled",null),e([a({readOnly:!0})],H.prototype,"columns",null),e([a()],H.prototype,"definitionExpression",null),e([a()],H.prototype,"description",void 0),e([a()],H.prototype,"disabled",void 0),e([a()],H.prototype,"editingEnabled",null),e([a()],H.prototype,"effectiveSize",null),e([a()],H.prototype,"effectiveTable",null),e([a()],H.prototype,"filterGeometry",null),e([a()],H.prototype,"filterBySelectionEnabled",null),e([a()],H.prototype,"hiddenFields",null),e([a()],H.prototype,"highlightEnabled",null),e([a()],H.prototype,"highlightIds",null),e([a()],H.prototype,"icon",null),e([a()],H.prototype,"initialSize",null),e([a()],H.prototype,"isQueryingOrSyncing",null),e([a()],H.prototype,"isSyncingAttachments",null),e([a()],H.prototype,"label",null),e([a()],H.prototype,"layer",null),e([a()],H.prototype,"layers",null),e([a()],H.prototype,"layerView",null),e([a()],H.prototype,"maxSize",null),e([a(),D("esri/widgets/FeatureTable/t9n/FeatureTable")],H.prototype,"messages",null),e([a(),D("esri/t9n/common")],H.prototype,"messagesCommon",null),e([a(),D("esri/core/t9n/Units")],H.prototype,"messagesUnits",null),e([a(),D("esri/widgets/support/t9n/uriUtils")],H.prototype,"messagesURIUtils",null),e([a()],H.prototype,"menuConfig",void 0),e([a()],H.prototype,"multipleSelectionEnabled",null),e([a()],H.prototype,"multiSortEnabled",null),e([a()],H.prototype,"multipleSortPriority",null),e([a()],H.prototype,"noDataMessage",null),e([a()],H.prototype,"objectIds",null),e([a()],H.prototype,"outFields",null),e([a()],H.prototype,"pageCount",null),e([a()],H.prototype,"pageIndex",null),e([a()],H.prototype,"pageSize",null),e([a()],H.prototype,"paginationEnabled",null),e([a()],H.prototype,"prompt",null),e([a()],H.prototype,"relatedRecordsEnabled",null),e([a()],H.prototype,"relatedTable",null),e([a()],H.prototype,"relatedTables",null),e([a()],H.prototype,"relationship",null),e([a()],H.prototype,"relationshipColumnConfigs",null),e([a()],H.prototype,"relationshipConfig",null),e([a()],H.prototype,"relationshipInfos",null),e([a()],H.prototype,"returnGeometryEnabled",null),e([a()],H.prototype,"returnMEnabled",null),e([a()],H.prototype,"returnZEnabled",null),e([a()],H.prototype,"rowHighlightIds",null),e([a()],H.prototype,"selectionSource",null),e([a()],H.prototype,"showAllRelatedTables",null),e([a()],H.prototype,"showPrompt",null),e([a()],H.prototype,"showRelatedTableCallback",null),e([a()],H.prototype,"size",null),e([a({readOnly:!0})],H.prototype,"state",null),e([a()],H.prototype,"supportsAddAttachments",null),e([a()],H.prototype,"supportsAttachments",null),e([a()],H.prototype,"supportsDeleteAttachments",null),e([a()],H.prototype,"supportsResizeAttachments",null),e([a()],H.prototype,"supportsUpdateAttachments",null),e([a({constructOnly:!0})],H.prototype,"tableController",null),e([a({constructOnly:!0})],H.prototype,"tableParent",null),e([a()],H.prototype,"tableTemplate",null),e([a()],H.prototype,"tableTemplateOverride",null),e([a()],H.prototype,"title",void 0),e([a()],H.prototype,"timeExtent",null),e([a()],H.prototype,"timeZone",null),e([a()],H.prototype,"view",null),e([a({type:y}),P(["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder","show-related-table"])],H.prototype,"viewModel",void 0),e([a({type:f,nonNullable:!0})],H.prototype,"visibleElements",void 0),e([a({type:f})],H.prototype,"visibleElementsOverride",null),H=j=e([r("esri.widgets.FeatureTable")],H);const N=H;export{N as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{watch as i,sync as l,initial as o,on as n}from"../core/reactiveUtils.js";import{formatFileSize as s}from"../core/unitFormatUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import{isLayerFromCatalog as c}from"../layers/catalog/catalogUtils.js";import{isKnowledgeGraphLayer as d,isMapImageLayer as h,isSubtypeGroupLayer as p}from"../layers/support/layerUtils.js";import m from"../tables/AttributeTableTemplate.js";import u from"./Widget.js";import{isSupportedImage as g,getCalciteIconForAttachment as w}from"./Attachments/support/attachmentUtils.js";import{loadPromptComponents as b,Prompt as v}from"./Editor/components/Prompt.js";import y from"./FeatureTable/ColumnMenuVisibleElements.js";import f from"./FeatureTable/FeatureTableViewModel.js";import _ from"./FeatureTable/VisibleElements.js";import{isGroupColumn as M}from"./FeatureTable/support/columnUtils.js";import{loadFieldColumnComponents as A,isIFeatureTableSupportedLayer as C,isIFeatureTableSupportedLayerWithAttachments as S,getRelationshipIdsToShow as T}from"./FeatureTable/support/tableUtils.js";import{loadCalciteComponents as E}from"./support/componentsUtils.js";import{globalCss as I}from"./support/globalCss.js";import{getIconForLayer as V}from"./support/iconUtils.js";import{renderingSanitizer as R,storeNode as x,discardNode as k}from"./support/widgetUtils.js";import{messageBundle as D}from"./support/decorators/messageBundle.js";import{vmEvent as P}from"./support/decorators/vmEvent.js";import{tsx as F}from"./support/jsxFactory.js";import{substitute as L}from"../intl/substitute.js";var j;const O="esri-feature-table",z=`${O}__prompt`,$=`${O}__attachments-view`,U={base:O,content:`${O}__content`,menuPopover:`${O}__menu-popover`,layerDropdownMenu:`${O}__layer-switcher-menu`,tableContainer:`${O}__table-container`,tableContainerWithAttachments:`${O}__table-container--attachments`,tableNavigation:`${O}__table-navigation`,attachmentsView:$,attachmentsViewContent:`${$}__content`,attachmentsViewDropArea:`${$}__drop-area`,attachmentsViewIcon:`${$}__icon`,attachmentsViewInformation:`${$}__information`,attachmentsViewList:`${$}__list`,attachmentsViewListFileSize:`${$}__list__filesize`,attachmentsViewListItemDelete:`${$}__list-item--delete`,attachmentsViewListThumbnail:`${$}__list__thumbnail`,expanded:`${O}__expanded`,collapsed:`${O}__collapsed`,promptContainer:z,promptHeader:`${z}__header`,promptHeading:`${z}__header__heading`,promptMessage:`${z}__message`,promptDivider:`${z}__divider`,promptActions:`${z}__actions`},B={attachment:"attachment",chevronDown:"chevron-down",chevronLeft:"chevron-left",chevronRight:"chevron-right",clearSelection:"clear-selection",downloadTo:"download-to",exclamationMarkTriangle:"exclamation-mark-triangle",exportToCSV:"file-csv",folderOpen:"folder-open",delete:"trash",launch:"launch",layers:"layers",moveUp:"move-up",plus:"plus",refresh:"refresh",replaceImage:"replace-image",save:"save",showAll:"selection-x",showColumn:"show-column",showSelected:"selection-filter",upload:"upload",zoomToSelection:"zoom-to-object"};let H=j=class extends u{constructor(e,t){super(e,t),this._attachmentsInput=null,this._columnVisibilityActions=new Map,this.attachmentsList=null,this.description=null,this.disabled=!1,this.menuConfig=null,this.title=null,this.viewModel=new f,this.visibleElements=new _,this._showDeletePrompt=this._showDeletePrompt.bind(this),this._onDeleteSelectionClick=this._onDeleteSelectionClick.bind(this)}initialize(){this.addHandles([i((()=>[this.isQueryingOrSyncing,this.editingEnabled]),(()=>this.scheduleRender())),i((()=>[this._effectiveVisibleElements,this._effectiveVisibleElements.columnDescriptions,this._effectiveVisibleElements.columnMenus,this._effectiveVisibleElements.columnMenuItems,this.columns.length]),(()=>{this.columns.forEach((e=>e.visibleElements=this._effectiveVisibleElements)),this.refreshCellContent()}),l),i((()=>this._effectiveVisibleElements.selectionColumn),(e=>{this.grid&&(this.grid.selectionColumnEnabled=e)}),o),n((()=>this.viewModel),"show-related-table",(e=>this._onShowRelatedTable(e))),i((()=>this.editingEnabled),(()=>{const{attachmentsViewOptions:e}=this;this.clearPrompt(),e&&(e.form?.reset(),e.candidates=null)}))])}loadDependencies(){return Promise.all([E({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),alert:()=>import("@esri/calcite-components/dist/components/calcite-alert"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),pagination:()=>import("@esri/calcite-components/dist/components/calcite-pagination"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover"),progress:()=>import("@esri/calcite-components/dist/components/calcite-progress"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")}),b(),A()])}destroy(){this.drainRelatedTables(),this.clearPrompt()}get _effectiveDescription(){const{description:e}=this;return null!=e?R.sanitize("function"==typeof e?e():e):void 0}get _effectiveLayers(){const{layer:e,layers:t}=this,i=t?.length?t.filter(C):[],l=i.length?i:[...this._viewLayers];return e&&!l.includes(e)&&l.push(e),l}get _effectiveTitle(){const{layer:e,messages:t,state:i,highlightIds:l,title:o,size:n}=this;if(o)return R.sanitize("function"==typeof o?o():o);if(!e)return t.noLayer;switch(i){case"disabled":return t.errorLayer;case"ready":case"loading":return t.loading;case"error":return t.errorData}return L(t.header,{title:R.sanitize(e.title),count:n,selected:l.length})}get _effectiveVisibleElements(){return this.visibleElementsOverride??this.visibleElements}get _filteredTables(){const e=this.relatedTables.toArray(),t=1===e.length;return this.allRelatedTablesVisible?e:t?[e[0]]:this._shouldShowAttachmentsView?e.slice(-1):e.slice(-2)}get _hasAttachmentsViewError(){return null!=this.attachmentsViewOptions.error}get _hasCustomMenuItems(){return!!this.menuConfig?.items?.length}get _hasDefaultMenuItems(){return!!(this._showClearSelectionAction||this._showDeleteSelectionAction||this._showExportSelectionToCSVAction||this._showRefreshDataAction||this._showZoomToSelectionAction||this._showSelectedRecordsShowSelectedAction||this._showSelectedRecordsShowAllAction||this._showColumnsVisibilityAction)}get _shouldShowGrid(){return this.allRelatedTablesVisible||1===this.relatedTables.length&&!this._shouldShowAttachmentsView}get _shouldShowMenu(){const{header:e,menu:t}=this._effectiveVisibleElements;return!(!e||!t||!this._hasDefaultMenuItems&&!this._hasCustomMenuItems)}get _shouldShowAttachmentsView(){return!(null==this.attachmentsViewOptions.objectId&&!this.relatedTables.some((e=>null!=e.attachmentsViewOptions.objectId)))}get _showClearSelectionAction(){return!(!this.highlightIds.length||!this._effectiveVisibleElements.menuItems?.clearSelection||this.relatedTables.length)}get _showColumnsVisibilityAction(){const{header:e,menu:t,menuItems:i}=this._effectiveVisibleElements;return!(!(e&&t&&i?.toggleColumns)||this.showRelatedTableCallback||this.allRelatedTablesVisible||this._shouldShowAttachmentsView)}get _showDeleteSelectionAction(){return!(!(this.editingEnabled&&this.highlightIds.length&&this._effectiveVisibleElements.menuItems?.deleteSelection&&this.layer?.capabilities?.operations?.supportsDelete)||this.relatedTables.length)}get _showExportSelectionToCSVAction(){return!(!(this._effectiveVisibleElements.menuItems.exportSelectionToCSV&&this.layer&&this.highlightIds.length)||this.relatedTables.length)}get _showLayerDropdown(){return!(!this._effectiveLayers.length||!this._effectiveVisibleElements.layerDropdown)}get _shouldShowNavigationBar(){const e=!!this.relatedTable||this._shouldShowAttachmentsView;return!this.tableParent&&e}get _showRefreshDataAction(){return!!this._effectiveVisibleElements.menuItems?.refreshData}get _showSelectedRecordsShowSelectedAction(){const e=this.objectIds.length,t=this.highlightIds.length;return!(!t||!this._effectiveVisibleElements.menuItems?.selectedRecordsShowSelectedToggle||e&&t===e||this.relatedTables.length)}get _showSelectedRecordsShowAllAction(){return!(!this._effectiveVisibleElements.menuItems?.selectedRecordsShowAllToggle||!this.objectIds.length||this.relatedTables.length)}get _showZoomToSelectionAction(){return!(!this.view||!this.highlightIds.length||this.effectiveTable.layer?.isTable||!this._effectiveVisibleElements.menuItems?.zoomToSelection)}get _viewLayers(){const e=this.view?.map;if(!e)return[];const t=new Set,i=e=>{!C(e)||p(e)||t.has(e)||(e.load(),t.add(e))},l=e=>{c(e)||"catalog-footprint"===e.type||(d(e)?(e.load(),e.layers?.forEach(i),e.tables?.forEach(i)):h(e)?(e.loadAll(),e.sublayers?.forEach(i),e.subtables?.forEach(i)):p(e)?(e.loadAll(),e.sublayers?.forEach(i)):i(e))};return e.allLayers.forEach(l),e.allTables.forEach(l),[...t.values()]}get grid(){return this.viewModel.grid}get actionColumnConfig(){return this.viewModel.actionColumnConfig}set actionColumnConfig(e){this.viewModel.actionColumnConfig=e}get activeFilters(){return this.viewModel.activeFilters}get activeSortOrders(){return this.viewModel.activeSortOrders}get allColumns(){return this.viewModel.allColumns}get allRelatedTablesVisible(){return this.viewModel.allRelatedTablesVisible}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get attachmentsViewOptions(){return this.viewModel.attachmentsViewOptions}set attachmentsViewOptions(e){this.viewModel.attachmentsViewOptions=e}get attributeTableTemplate(){return this.viewModel.attributeTableTemplate}set attributeTableTemplate(e){this.viewModel.attributeTableTemplate=e}get autoRefreshEnabled(){return this.viewModel.autoRefreshEnabled}set autoRefreshEnabled(e){this.viewModel.autoRefreshEnabled=e}get clearPrompt(){return this.viewModel.clearPrompt}set clearPrompt(e){this.viewModel.clearPrompt=e}get columnPerformanceModeEnabled(){return this.viewModel.columnPerformanceModeEnabled}set columnPerformanceModeEnabled(e){this.viewModel.columnPerformanceModeEnabled=e}get columnReorderingEnabled(){return this.viewModel.columnReorderingEnabled}set columnReorderingEnabled(e){this.viewModel.columnReorderingEnabled=e}get columns(){return this.viewModel.columns}get definitionExpression(){return this.viewModel.definitionExpression}set definitionExpression(e){this.viewModel.definitionExpression=e}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get effectiveSize(){return this.viewModel.effectiveSize}get effectiveTable(){return this.relatedTable||this}get filterGeometry(){return this.viewModel.filterGeometry}set filterGeometry(e){this.viewModel.filterGeometry=e}get filterBySelectionEnabled(){return this.viewModel.filterBySelectionEnabled}set filterBySelectionEnabled(e){this.viewModel.filterBySelectionEnabled=e}get hiddenFields(){return this.viewModel.hiddenFields}set hiddenFields(e){this.viewModel.hiddenFields=e}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(e){this.viewModel.highlightEnabled=e}get highlightIds(){return this.viewModel.highlightIds}set highlightIds(e){this.viewModel.highlightIds=e}get icon(){return"table"}set icon(e){this._overrideIfSome("icon",e)}get initialSize(){return this.viewModel.initialSize}set initialSize(e){this.viewModel.initialSize=e}get isQueryingOrSyncing(){return this.viewModel.isQueryingOrSyncing}get isSyncingAttachments(){return this.viewModel.isSyncingAttachments}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get layers(){return this.viewModel.layers}set layers(e){this.viewModel.layers=e}get layerView(){return this.viewModel.layerView}get maxSize(){return this.viewModel.maxSize}set maxSize(e){this.viewModel.maxSize=e}get messages(){return this.viewModel.messages}set messages(e){this.viewModel.messages=e}get messagesCommon(){return this.viewModel.messagesCommon}set messagesCommon(e){this.viewModel.messagesCommon=e}get messagesUnits(){return this.viewModel.messagesUnits}set messagesUnits(e){this.viewModel.messagesUnits=e}get messagesURIUtils(){return this.viewModel.messagesURIUtils}set messagesURIUtils(e){this.viewModel.messagesURIUtils=e}get multipleSelectionEnabled(){return this.viewModel.multipleSelectionEnabled}set multipleSelectionEnabled(e){this.viewModel.multipleSelectionEnabled=e}get multiSortEnabled(){return this.viewModel.multiSortEnabled}set multiSortEnabled(e){this.viewModel.multiSortEnabled=e}get multipleSortPriority(){return this.viewModel.multipleSortPriority}set multipleSortPriority(e){this.viewModel.multipleSortPriority=e}get noDataMessage(){return this.viewModel.noDataMessage}set noDataMessage(e){this.viewModel.noDataMessage=e}get objectIds(){return this.viewModel.objectIds}set objectIds(e){this.viewModel.objectIds=e}get outFields(){return this.viewModel.outFields}set outFields(e){this.viewModel.outFields=e}get pageCount(){return this.viewModel.pageCount}get pageIndex(){return this.viewModel.pageIndex}set pageIndex(e){this.viewModel.pageIndex=e}get pageSize(){return this.viewModel.pageSize}set pageSize(e){this.viewModel.pageSize=e}get paginationEnabled(){return this.viewModel.paginationEnabled}set paginationEnabled(e){this.viewModel.paginationEnabled=e}get prompt(){return this.viewModel.prompt}set prompt(e){this.viewModel.prompt=e}get relatedRecordsEnabled(){return this.viewModel.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.viewModel.relatedRecordsEnabled=e}get relatedTable(){return this.viewModel.relatedTable}get relatedTables(){return this.viewModel.relatedTables}set relatedTables(e){this.viewModel.relatedTables=e}get relationship(){return this.viewModel.relationship}get relationshipColumnConfigs(){return this.viewModel.relationshipColumnConfigs}set relationshipColumnConfigs(e){this.viewModel.relationshipColumnConfigs=e}get relationshipConfig(){return this.viewModel.relationshipConfig}set relationshipConfig(e){this.viewModel.relationshipConfig=e}get relationshipInfos(){return this.viewModel.relationshipInfos}get returnGeometryEnabled(){return this.viewModel.returnGeometryEnabled}set returnGeometryEnabled(e){this.viewModel.returnGeometryEnabled=e}get returnMEnabled(){return this.viewModel.returnMEnabled}set returnMEnabled(e){this.viewModel.returnMEnabled=e}get returnZEnabled(){return this.viewModel.returnZEnabled}set returnZEnabled(e){this.viewModel.returnZEnabled=e}get rowHighlightIds(){return this.viewModel.rowHighlightIds}set rowHighlightIds(e){this.viewModel.rowHighlightIds=e}get selectionSource(){return this.viewModel.selectionSource}set selectionSource(e){this.viewModel.selectionSource=e}get showAllRelatedTables(){return this.viewModel.showAllRelatedTables}set showAllRelatedTables(e){this.viewModel.showAllRelatedTables=e}get showPrompt(){return this.viewModel.showPrompt}set showPrompt(e){this.viewModel.showPrompt=e}get showRelatedTableCallback(){return this.viewModel.showRelatedTableCallback}set showRelatedTableCallback(e){this.viewModel.showRelatedTableCallback=e}get size(){return this.viewModel.size}get state(){return this.viewModel.state}get supportsAddAttachments(){return this.viewModel.supportsAddAttachments}get supportsAttachments(){return this.viewModel.supportsAttachments}get supportsDeleteAttachments(){return this.viewModel.supportsDeleteAttachments}get supportsResizeAttachments(){return this.viewModel.supportsResizeAttachments}get supportsUpdateAttachments(){return this.viewModel.supportsUpdateAttachments}get tableController(){return this.viewModel.tableController}set tableController(e){this.viewModel.tableController=e}get tableParent(){return this.viewModel.tableParent}set tableParent(e){this.viewModel.tableParent=e}get tableTemplate(){return this.viewModel.tableTemplate}set tableTemplate(e){this.viewModel.tableTemplate=e}get tableTemplateOverride(){return this.viewModel.tableTemplateOverride}set tableTemplateOverride(e){this.viewModel.tableTemplateOverride=e}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(e){this.viewModel.timeExtent=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visibleElementsOverride(){const{attachmentsViewOptions:e,relatedTable:t,tableController:i,visibleElements:l}=this,{columnDescriptions:o,columnMenus:n,tooltips:s}=l,a=null!=e.objectId;if(t)return new _({columnDescriptions:o,columnMenus:n,tooltips:s,close:l.close,header:l.header,layerDropdown:l.layerDropdown,layerDropdownIcons:l.layerDropdownIcons,menu:l.menu,menuItems:l.menuItems,progress:l.progress,selectionColumn:!1,columnMenuItems:new y({sortAscending:!1,sortDescending:!1})});if(i){const e=i.relatedTable===this,t=i.allRelatedTablesVisible,r=e&&l.selectionColumn&&!t&&!a,c=e&&!t&&!a;return new _({columnDescriptions:o,columnMenus:n,tooltips:s,selectionColumn:r,close:!1,header:!1,layerDropdown:!1,menu:!1,progress:!1,columnMenuItems:new y({sortAscending:c,sortDescending:c})})}return a?new _({columnDescriptions:o,columnMenus:n,tooltips:s,close:l.close,header:l.header,layerDropdown:l.layerDropdown,layerDropdownIcons:l.layerDropdownIcons,menu:l.menu,menuItems:l.menuItems,progress:l.progress,selectionColumn:!1,columnMenuItems:new y({sortAscending:!1,sortDescending:!1})}):null}clearSelectionFilter(){this.viewModel.clearSelectionFilter()}async deleteAttachments(e,t,i){null!=e&&t?.length&&(i?this._showDeleteAttachmentPrompt(e,t):await this.viewModel.deleteAttachments(e,t))}deleteSelection(e){return this.highlightIds.length?e?(this._showDeletePrompt(),this.scheduleRender(),Promise.resolve()):this.viewModel.deleteSelection():Promise.resolve()}async downloadAttachmentById(e,t){return this.viewModel.downloadAttachmentById(e,t)}drainRelatedTables(){this.viewModel.drainRelatedTables()}exportSelectionToCSV(e){return this.viewModel.exportSelectionToCSV(e)}filterBySelection(){this.viewModel.filterBySelection()}findColumn(e){return this.viewModel.findColumn(e)}goToPage(e){this.viewModel.goToPage(e)}hideColumn(e){this.grid?.hideColumn(e)}nextPage(){this.viewModel.nextPage()}previousPage(){this.viewModel.previousPage()}async refresh(){await this.viewModel.refresh()}refreshCellContent(){this.viewModel.refreshCellContent()}async saveAttachmentsViewForm(){await this.viewModel.saveAttachmentsViewForm()}showAllColumns(){this.viewModel.showAllColumns()}showColumn(e){this.grid?.showColumn(e)}sortColumn(e,t){this.viewModel.sortColumn(e,t)}scrollLeft(){this.viewModel.scrollLeft()}scrollToBottom(){this.viewModel.scrollToBottom()}scrollToIndex(e){this.viewModel.scrollToIndex(e)}scrollToRow(e){this.viewModel.scrollToRow(e)}scrollToTop(){this.viewModel.scrollToTop()}toggleColumnVisibility(e){this.viewModel.toggleColumnVisibility(e)}zoomToSelection(){this.effectiveTable.viewModel.zoomToSelection()}render(){const{_effectiveVisibleElements:e,isQueryingOrSyncing:t,menuConfig:i,state:l}=this;return F("div",{bind:this,class:this.classes(U.base,I.widget)},F("calcite-panel",{bind:this,class:U.content,closable:e.close,description:this._effectiveDescription,disabled:this.disabled||"disabled"===l&&!this._effectiveLayers?.length,heading:e.header?this._effectiveTitle:void 0,loading:"loading"===l,menuOpen:!!i?.open,overlayPositioning:"fixed",onCalcitePanelClose:e=>{e.currentTarget.closed=!1,this.emit("close")}},e.progress?F("calcite-progress",{type:t?"indeterminate":"determinate"}):null,this._showLayerDropdown?this._renderLayerDropdown():null,this._renderColumnVisibilityAction(),this._renderHeaderMenuActions(),this._renderNavigationBar(),this._renderTables(),this._renderError()),this._renderColumnVisibilityPopover(),this._renderPrompt())}_renderTables(){const{grid:e,relatedTables:t}=this,i=this.classes(U.tableContainer);if(t.length){const l=this.classes(U.base,this.allRelatedTablesVisible?U.expanded:U.collapsed,this._shouldShowAttachmentsView?U.tableContainerWithAttachments:void 0);return F("div",{class:i},F("calcite-panel",{overlayPositioning:"fixed"},F("div",null,[this._shouldShowGrid?F("div",{class:l},e?.render(),this._renderPagination()):void 0,...this._filteredTables.map((e=>{const i=t.indexOf(e);return F("div",{class:l,key:`related-${i}`},e.render())})),,])))}return null!=this.attachmentsViewOptions.objectId?F("div",{class:i},F("calcite-panel",{overlayPositioning:"fixed"},F("div",null,[F("div",{class:this.classes(U.base,U.collapsed)},e?.render(),this._renderPagination()),this._renderAttachmentsView()]))):[F("div",{class:i},e?.render()),this._renderPagination()]}_renderPagination(){if(this.paginationEnabled)return F("calcite-pagination",{pageSize:1,startItem:this.pageIndex+1,totalItems:this.pageCount,onCalcitePaginationChange:e=>this.goToPage(e.currentTarget.startItem-1)})}_renderError(){const{messages:e}=this;return F("calcite-alert",{autoClose:!0,autoCloseDuration:"fast",icon:B.exclamationMarkTriangle,kind:"danger",label:e.errorOccured,open:this._hasAttachmentsViewError,slot:"alerts",onCalciteAlertClose:()=>{this.attachmentsViewOptions.error=null}},F("span",{slot:"message"},e.errorOccured))}_renderPrompt(){return this.prompt?F(v,{...this.prompt,headingLevel:2}):void 0}_showDeletePrompt(){const{messages:e,messagesCommon:t}=this,i=L(e.deleteSelectionCount,{count:this.highlightIds.length});this.showPrompt({title:i,message:e.deleteRecordsRemoved,context:"danger",actions:{primary:{label:t.delete,action:this._onDeleteSelectionClick},secondary:{label:e.keepRecords,action:()=>this.clearPrompt()}}})}_showDeleteAttachmentPrompt(e,t){const{messages:i,messagesCommon:l}=this,o=L(i.deleteAttachmentCount,{count:t.length});this.showPrompt({title:o,message:i.deleteAttachmentConfirmation,context:"danger",actions:{primary:{label:l.delete,action:async()=>{try{await this.deleteAttachments(e,t,!1)}finally{this.clearPrompt()}}},secondary:{label:l.cancel,action:()=>this.clearPrompt()}}})}async _onDeleteSelectionClick(){try{await this.viewModel.deleteSelection()}finally{this.clearPrompt()}}_renderHeaderMenuAction(e){const{disabled:t,hidden:i,icon:l,text:o,clickFunction:n}=e;if(!i)return F("calcite-action",{disabled:t??this.menuConfig?.disabled,icon:l??void 0,key:o,onclick:()=>n(),slot:"header-menu-actions",text:o,textEnabled:!0,title:o})}_renderHeaderMenuActions(){return this._shouldShowMenu?[this._renderDefaultHeaderMenuActions(),this._renderCustomHeaderMenuActions()]:[]}_renderDefaultHeaderMenuActions(){if(!this._hasDefaultMenuItems)return[];const{messages:e}=this;return[this._showRefreshDataAction&&{icon:B.refresh,text:e.refreshData,clickFunction:()=>this.refresh()},this._showDeleteSelectionAction&&{icon:B.delete,text:e.deleteSelection,clickFunction:()=>this.deleteSelection(!0)},this._showClearSelectionAction&&{icon:B.clearSelection,text:e.clearSelection,clickFunction:()=>this.highlightIds?.removeAll()},this._showZoomToSelectionAction&&{icon:B.zoomToSelection,text:e.zoomToSelection,clickFunction:()=>this.zoomToSelection()},this._showSelectedRecordsShowSelectedAction&&{icon:B.showSelected,text:e.showSelected,clickFunction:()=>{const{objectIds:e}=this;e.removeAll(),e.addMany(this.highlightIds.toArray())}},this._showSelectedRecordsShowAllAction&&{icon:B.showAll,text:e.showAllRecords,clickFunction:()=>this.objectIds.removeAll()},this._showExportSelectionToCSVAction&&{icon:B.exportToCSV,text:e.exportSelectionCSV,clickFunction:()=>this.exportSelectionToCSV()}].filter(t).map((e=>e&&this._renderHeaderMenuAction(e)))}_renderCustomHeaderMenuActions(){return this.menuConfig?.items?.map((({disabled:e,hidden:t,icon:i,label:l,clickFunction:o})=>this._renderHeaderMenuAction({hidden:"function"==typeof t?t():t,icon:i,text:l,disabled:e,clickFunction:e=>o(e)})))??[]}_renderColumnVisibilityAction(){if(!this._showColumnsVisibilityAction)return[];const{_columnVisibilityActions:e,effectiveTable:t,id:i}=this,l=this.messages.toggleColumns;return F("calcite-action",{afterCreate:t=>e.set(i,t),afterRemoved:()=>e.delete(i),appearance:"transparent",bind:this,disabled:t.menuConfig?.disabled,icon:B.showColumn,id:`${i}__toggle-columns-action`,slot:"header-actions-end",text:l},this._effectiveVisibleElements.tooltips?F("calcite-tooltip",{closeOnClick:!0,overlayPositioning:"fixed",placement:"bottom-end",slot:"tooltip"},l):null)}_renderColumnVisibilityPopover(){if(!this._showColumnsVisibilityAction||this.effectiveTable.menuConfig?.disabled)return;const{effectiveTable:e}=this,t=this.messages.toggleColumns;return F("calcite-popover",{autoClose:!0,class:U.menuPopover,label:t,overlayPositioning:"fixed",placement:"top-end",pointerDisabled:!0,referenceElement:this._columnVisibilityActions.get(this.id)},F("calcite-list",{displayMode:"nested",filterEnabled:!0,filterPlaceholder:t,label:t,selectionMode:"multiple"},e.columns.toArray().map((t=>{const i=M(t)?t.columns?.map((t=>this._renderColumnListItem({column:t,table:e,ignoreSelect:!0}))):void 0;return this._renderColumnListItem({column:t,table:e,items:i})}))))}_renderColumnListItem(e){const{column:t,table:i,items:l,ignoreSelect:o}=e,{effectiveLabel:n,fieldName:s,hidden:a}=t;return F("calcite-list-item",{expanded:!(!l?.length||a)||void 0,key:`toggle-columns__item-${s}`,label:n,selected:!a,value:s,onCalciteListItemSelect:e=>{o&&e.stopPropagation(),i.toggleColumnVisibility(e.currentTarget.value)}},l)}_renderLayerDropdown(){const e=this.messages.selectALayer;return F("div",{class:U.layerDropdownMenu,key:`${this.id}-layerDropdown`,slot:"header-actions-start"},F("calcite-dropdown",{bind:this,maxItems:5,overlayPositioning:"fixed",placement:"bottom-start"},F("calcite-action",{icon:B.layers,slot:"trigger",text:e,title:e}),F("calcite-dropdown-group",{selectionMode:"single"},this._effectiveLayers.map(((e,t)=>this._renderLayerDropdownItem(e,t)))??null)))}_renderLayerDropdownItem(e,t){const i=this.visibleElements.layerDropdownIcons;return F("calcite-dropdown-item",{iconStart:i?V(e):void 0,key:`dropdown-item-${t}`,label:e.title??"",selected:e===this.layer,value:e.id,onCalciteDropdownItemSelect:()=>{this.layer=e}},e.title)}_onRelatedNavigationItemClick(e){this.viewModel.drainRelatedTablesAboveIndex(e)}_collapseRelatedTable(e){this.viewModel.collapseRelatedTable(this.effectiveTable,e)}_onShowRelatedTable(e){this.showRelatedTableCallback||(this._collapseRelatedTable(e),this._createRelatedTable(e))}async _createRelatedTable(e){const{editingEnabled:t,effectiveTable:i,paginationEnabled:l,pageSize:o,view:n,viewModel:s}=this,{layer:a,objectId:r,relatedLayer:c,relationshipId:d}=e;await a.load();const h=this.attachmentsEnabled&&S(a),p=new j({layer:a,attachmentsEnabled:h,editingEnabled:t,paginationEnabled:l,pageSize:o,relatedRecordsEnabled:!0,relationshipConfig:{objectId:r,relatedLayer:c,relationshipId:d},relationshipColumnConfigs:T(a,d),tableController:this,tableParent:i,view:n,showRelatedTableCallback:e=>s.emit("show-related-table",e)});this.relatedTables.add(p),this.scheduleRender()}_renderAttachmentsView(){const{attachmentInfos:e,mode:t,objectId:i}=this.attachmentsViewOptions;return"file"!==t&&e.length&&null!=i?this._renderAttachmentsViewList():this._renderAttachmentsViewFilePane()}_renderAttachmentsViewFilePane(){const{attachmentsViewOptions:e,isSyncingAttachments:t,supportsAddAttachments:i,messages:l,messagesUnits:o}=this,{attachmentId:n,attachmentInfos:a,candidates:r,objectId:c}=e,d=a.find((e=>e.id===n)),h=a.length,p=r?.length,m=d?F("calcite-label",{alignment:"center",key:"replace-file-node",scale:"l"},l.replaceFile):void 0,u=p?void 0:F("calcite-label",{alignment:"center",key:"message-node",scale:"m"},i?null==c?l.noFeature:l.dragAndDropToUpload:l.editingRestricted),g=Array.from(r??[]).pop(),w=g?F("calcite-label",{key:"filename-node"},g.name):void 0,b=i&&null!=c,v=b&&p,y=F("input",{afterCreate:x,afterRemoved:k,afterUpdate:x,bind:this,"data-node-ref":"_attachmentsInput",files:r,hidden:!0,name:"attachment",onchange:e=>this._onAttachmentsViewCandidateChange(e),type:"file"}),f=b?F("calcite-button",{appearance:"outline-fill",bind:this,disabled:t,iconStart:B.folderOpen,key:"select-node",loading:!1,onclick:()=>{this._attachmentsInput?.click()},width:"full"},l.selectFile):void 0,_=v?F("calcite-button",{appearance:"outline-fill",bind:this,disabled:t,iconStart:B.save,key:"save-node",loading:t,onclick:()=>{this.saveAttachmentsViewForm()},width:"full"},d?l.updateAttachment:l.addAttachment):void 0,M=h||p?F("calcite-button",{appearance:"transparent",bind:this,disabled:t,key:"cancel-node",onclick:()=>{this._attachmentsInput&&(this._attachmentsInput.value=""),e.reset(),e.attachmentInfos?.length&&(e.mode="list")},width:"full"},this.messagesCommon.cancel):void 0;return[F("div",{class:U.attachmentsView,key:"attachments-view"},F("div",{class:U.attachmentsViewContent,key:"attachments-view-content"},F("div",{bind:this,class:U.attachmentsViewDropArea,ondragover:e=>e.preventDefault(),ondrop:this._onAttachmentsViewDrop},F("calcite-icon",{class:U.attachmentsViewIcon,icon:B.upload,scale:"l"}),m,u,F("form",{afterCreate:t=>e.form=t,afterRemoved:()=>e.form=null,bind:this,key:"attachments-form"},F("fieldset",null,w,y,f,_,M)))),null!=c&&null!=d?F("div",{class:U.attachmentsViewInformation,key:"information"},this._renderAttachmentsViewThumbnail(d,200),F("label",{key:"file-label"},l.fileName),F("span",{key:"file-span"},d.name),F("label",{key:"size-label"},l.size),F("span",{key:"size-span"},s(o,d.size??0))):void 0)]}_renderAttachmentsViewList(){const{attachmentsViewOptions:e,isSyncingAttachments:t,messages:i,messagesUnits:l,supportsDeleteAttachments:o,supportsUpdateAttachments:n}=this,{attachmentInfos:a,objectId:r}=e;return F("calcite-list",{afterCreate:x,afterRemoved:k,afterUpdate:x,bind:this,class:U.attachmentsViewList,"data-node-ref":"attachmentsList",key:`attachments-list-${r}`,label:i?.attachments,loading:t,ondragover:e=>e.preventDefault(),ondrop:this._onAttachmentsViewDrop,selectionMode:"multiple",onCalciteListChange:()=>this.scheduleRender()},...a?.map((t=>{const{id:a,name:c,size:d,url:h}=t,p=s(l,d??0);return F("calcite-list-item",{afterRemoved:()=>this.scheduleRender(),key:`attachment-${a}`,label:c,value:a},this._renderAttachmentsViewListThumbnail(t),F("span",{class:U.attachmentsViewListFileSize,slot:"actions-end",title:p},p),F("calcite-action",{appearance:"transparent",icon:B.downloadTo,key:`download-attachment-${a}`,label:`${c}`,onclick:e=>{e.preventDefault(),this.downloadAttachmentById(r??-1,a)},slot:"actions-end",text:i.downloadAttachment,title:i.downloadAttachment}),n&&null!=r?F("calcite-action",{appearance:"transparent",disabled:!n,icon:B.replaceImage,key:`replace-attachment-${a}`,label:`${c}`,onclick:()=>{e.mode="file",e.attachmentId=a},slot:"actions-end",text:i.updateAttachment,title:i.updateAttachment}):void 0,F("calcite-action",{appearance:"transparent",icon:B.launch,key:`launch-attachment-${a}`,label:`${c}`,onclick:()=>{h&&window.open(h,"_blank")},slot:"actions-end",text:i.viewAttachment,title:i.viewAttachment}),o&&null!=r?F("calcite-action",{appearance:"transparent",class:U.attachmentsViewListItemDelete,disabled:!o,icon:B.delete,key:`delete-attachment-${a}`,label:`${c}`,onclick:()=>{this.deleteAttachments(r,[a],!0)},slot:"actions-end",text:i.deleteAttachment,title:i.deleteAttachment}):void 0)})))}_renderAttachmentsViewListThumbnail(e){return F("div",{class:U.attachmentsViewListThumbnail,slot:"content-start"},F("a",{href:e.url??"",rel:"noreferrer",target:"_blank"},this._renderAttachmentsViewThumbnail(e)))}_renderAttachmentsViewThumbnail(e,t=64){const{contentType:i,name:l,size:o,url:n}=e,s=`${n}${n?.includes("?")?"&":"?"}w=${t}&s=${o}`;return this.supportsResizeAttachments&&g(i)?F("img",{alt:l,key:`thumbnail-image-${l}`,src:s,title:l}):F("calcite-icon",{icon:w(i),key:`thumbnail-icon-${l}`,scale:"l",textLabel:l,title:l})}_onAttachmentsViewCandidateChange({target:e}){this.attachmentsViewOptions.candidates=e?.files}_onAttachmentsViewDrop(e){e.preventDefault(),(this.supportsAddAttachments||this.supportsUpdateAttachments)&&this.attachmentsViewOptions.set({mode:"file",candidates:e.dataTransfer?.files})}_renderNavigationBar(){const{effectiveTable:e,messages:t,messagesCommon:i,relatedTable:l,relatedTables:o}=this;if(!this._shouldShowNavigationBar)return;const{attachmentsList:n,attachmentsViewOptions:s,layer:a,supportsAddAttachments:r,supportsDeleteAttachments:c}=e;if(!a)return;const{attachmentInfos:d,objectId:h}=s,p=null!=h,m=d.length,u=n?.selectedItems?.length??0,g=`${a.objectIdField}: ${h}`,w=L(t.selectedCount,{count:u}),b=L(t.attachmentsCount,{count:m}),v=p?F("calcite-action",{bind:this,icon:B.chevronRight,iconFlipRtl:!0,key:"navigation-feature",onclick:()=>e.scrollToRow(h),text:g,textEnabled:!0,title:g}):void 0,y=p?F("calcite-action",{icon:B.chevronRight,iconFlipRtl:!0,key:"navigation-attachments-label",label:b,onclick:()=>{m>0&&(s.mode="list")},text:b,textEnabled:!0,title:b}):void 0,f=p?F("calcite-chip",{closable:!0,closed:0===u,key:"navigation-chip",kind:"inverse",label:w,selected:!0,title:w,value:"selected",onCalciteChipClose:()=>n?.selectedItems?.forEach((e=>e.selected=!1))},w):void 0,_=l?F("calcite-label",{layout:"inline"},t.showAllTables,F("calcite-switch",{checked:this.allRelatedTablesVisible,onCalciteSwitchChange:e=>this.showAllRelatedTables=!!e.currentTarget.checked})):void 0,M=p&&"list"===s.mode&&null!=h&&u&&c?F("calcite-action",{icon:B.delete,iconFlipRtl:!0,key:"attachments-trash-all",onclick:()=>{e.deleteAttachments(h,n?.selectedItems?.map((e=>e.value))??[],!0)},text:i.delete,textEnabled:!0,title:L(t.deleteAttachmentCount,{count:u})}):void 0,A=p&&"list"===s.mode&&r?F("calcite-action",{bind:this,icon:B.plus,iconFlipRtl:!0,key:"attachments-add",onclick:()=>{s.attachmentId=null,s.mode="file"},text:t.addAttachment,textEnabled:!0,title:t.addAttachment}):void 0;return F("div",{class:U.tableNavigation,key:"table-nav"},F("calcite-action",{icon:B.moveUp,iconFlipRtl:!0,key:"go-back",onclick:()=>{l&&this.drainRelatedTables(),e.attachmentsViewOptions.objectId=null},text:this.layer?.title??"",textEnabled:!1,title:l?t.exitRelatedRecords:t.exitAttachments}),o.toArray().map(((e,t)=>this._renderRelatedTableNavigationAction(e,t))),v,y,F("div",null,f,_,M,A))}_renderRelatedTableNavigationAction(e,t){const i=this._getLabelForRelatedTableNavigationAction(e);return F("calcite-action",{icon:B.chevronRight,iconFlipRtl:!0,key:t,onclick:()=>this._onRelatedNavigationItemClick(t),text:i,textEnabled:!0,title:e.layer?.title||""})}_getLabelForRelatedTableNavigationAction(e){const t=e.layer?.title;if(!t)return"";const{relatedTables:i}=this;if(i.length<=1)return t;return i.indexOf(e)!==i.length-1&&t.length>20?`${t.slice(0,20)}...`:t}};e([a()],H.prototype,"_attachmentsInput",void 0),e([a()],H.prototype,"_columnVisibilityActions",void 0),e([a()],H.prototype,"_effectiveDescription",null),e([a()],H.prototype,"_effectiveLayers",null),e([a()],H.prototype,"_effectiveTitle",null),e([a()],H.prototype,"_effectiveVisibleElements",null),e([a()],H.prototype,"_filteredTables",null),e([a()],H.prototype,"_hasAttachmentsViewError",null),e([a()],H.prototype,"_hasCustomMenuItems",null),e([a()],H.prototype,"_hasDefaultMenuItems",null),e([a()],H.prototype,"_shouldShowGrid",null),e([a()],H.prototype,"_shouldShowMenu",null),e([a()],H.prototype,"_shouldShowAttachmentsView",null),e([a()],H.prototype,"_showClearSelectionAction",null),e([a()],H.prototype,"_showColumnsVisibilityAction",null),e([a()],H.prototype,"_showDeleteSelectionAction",null),e([a()],H.prototype,"_showExportSelectionToCSVAction",null),e([a()],H.prototype,"_showLayerDropdown",null),e([a()],H.prototype,"_shouldShowNavigationBar",null),e([a()],H.prototype,"_showRefreshDataAction",null),e([a()],H.prototype,"_showSelectedRecordsShowSelectedAction",null),e([a()],H.prototype,"_showSelectedRecordsShowAllAction",null),e([a()],H.prototype,"_showZoomToSelectionAction",null),e([a()],H.prototype,"_viewLayers",null),e([a()],H.prototype,"attachmentsList",void 0),e([a({readOnly:!0})],H.prototype,"grid",null),e([a()],H.prototype,"actionColumnConfig",null),e([a({readOnly:!0})],H.prototype,"activeFilters",null),e([a({readOnly:!0})],H.prototype,"activeSortOrders",null),e([a()],H.prototype,"allColumns",null),e([a({readOnly:!0})],H.prototype,"allRelatedTablesVisible",null),e([a()],H.prototype,"attachmentsEnabled",null),e([a()],H.prototype,"attachmentsViewOptions",null),e([a({type:m})],H.prototype,"attributeTableTemplate",null),e([a()],H.prototype,"autoRefreshEnabled",null),e([a()],H.prototype,"clearPrompt",null),e([a()],H.prototype,"columnPerformanceModeEnabled",null),e([a()],H.prototype,"columnReorderingEnabled",null),e([a({readOnly:!0})],H.prototype,"columns",null),e([a()],H.prototype,"definitionExpression",null),e([a()],H.prototype,"description",void 0),e([a()],H.prototype,"disabled",void 0),e([a()],H.prototype,"editingEnabled",null),e([a()],H.prototype,"effectiveSize",null),e([a()],H.prototype,"effectiveTable",null),e([a()],H.prototype,"filterGeometry",null),e([a()],H.prototype,"filterBySelectionEnabled",null),e([a()],H.prototype,"hiddenFields",null),e([a()],H.prototype,"highlightEnabled",null),e([a()],H.prototype,"highlightIds",null),e([a()],H.prototype,"icon",null),e([a()],H.prototype,"initialSize",null),e([a()],H.prototype,"isQueryingOrSyncing",null),e([a()],H.prototype,"isSyncingAttachments",null),e([a()],H.prototype,"label",null),e([a()],H.prototype,"layer",null),e([a()],H.prototype,"layers",null),e([a()],H.prototype,"layerView",null),e([a()],H.prototype,"maxSize",null),e([a(),D("esri/widgets/FeatureTable/t9n/FeatureTable")],H.prototype,"messages",null),e([a(),D("esri/t9n/common")],H.prototype,"messagesCommon",null),e([a(),D("esri/core/t9n/Units")],H.prototype,"messagesUnits",null),e([a(),D("esri/widgets/support/t9n/uriUtils")],H.prototype,"messagesURIUtils",null),e([a()],H.prototype,"menuConfig",void 0),e([a()],H.prototype,"multipleSelectionEnabled",null),e([a()],H.prototype,"multiSortEnabled",null),e([a()],H.prototype,"multipleSortPriority",null),e([a()],H.prototype,"noDataMessage",null),e([a()],H.prototype,"objectIds",null),e([a()],H.prototype,"outFields",null),e([a()],H.prototype,"pageCount",null),e([a()],H.prototype,"pageIndex",null),e([a()],H.prototype,"pageSize",null),e([a()],H.prototype,"paginationEnabled",null),e([a()],H.prototype,"prompt",null),e([a()],H.prototype,"relatedRecordsEnabled",null),e([a()],H.prototype,"relatedTable",null),e([a()],H.prototype,"relatedTables",null),e([a()],H.prototype,"relationship",null),e([a()],H.prototype,"relationshipColumnConfigs",null),e([a()],H.prototype,"relationshipConfig",null),e([a()],H.prototype,"relationshipInfos",null),e([a()],H.prototype,"returnGeometryEnabled",null),e([a()],H.prototype,"returnMEnabled",null),e([a()],H.prototype,"returnZEnabled",null),e([a()],H.prototype,"rowHighlightIds",null),e([a()],H.prototype,"selectionSource",null),e([a()],H.prototype,"showAllRelatedTables",null),e([a()],H.prototype,"showPrompt",null),e([a()],H.prototype,"showRelatedTableCallback",null),e([a()],H.prototype,"size",null),e([a({readOnly:!0})],H.prototype,"state",null),e([a()],H.prototype,"supportsAddAttachments",null),e([a()],H.prototype,"supportsAttachments",null),e([a()],H.prototype,"supportsDeleteAttachments",null),e([a()],H.prototype,"supportsResizeAttachments",null),e([a()],H.prototype,"supportsUpdateAttachments",null),e([a({constructOnly:!0})],H.prototype,"tableController",null),e([a({constructOnly:!0})],H.prototype,"tableParent",null),e([a()],H.prototype,"tableTemplate",null),e([a()],H.prototype,"tableTemplateOverride",null),e([a()],H.prototype,"title",void 0),e([a()],H.prototype,"timeExtent",null),e([a()],H.prototype,"timeZone",null),e([a()],H.prototype,"view",null),e([a({type:f}),P(["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder","show-related-table"])],H.prototype,"viewModel",void 0),e([a({type:_,nonNullable:!0})],H.prototype,"visibleElements",void 0),e([a({type:_})],H.prototype,"visibleElementsOverride",null),H=j=e([r("esri.widgets.FeatureTable")],H);const N=H;export{N 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"../../../Map.js";import r from"../../../core/Error.js";import i from"../../../core/Evented.js";import s from"../../../core/Logger.js";import{clamp as a}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{isAbortError as n}from"../../../core/promiseUtils.js";import{watch as m,syncAndInitial as l,initial as h}from"../../../core/reactiveUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{rotate as p,intersect as g,nearestCoordinate as y}from"../../../geometry/geometryEngine.js";import u from"../../../geometry/Point.js";import _ from"../../../geometry/Polygon.js";import f from"../../../geometry/SpatialReference.js";import v from"../../../layers/GraphicsLayer.js";import R from"../../../layers/ImageryTileLayer.js";import x from"../../../layers/support/RasterFunction.js";import{convolutionKernel as w}from"../../../layers/support/rasterFunctionConstants.js";import C from"../../../layers/support/TileInfo.js";import I from"../../../views/MapView.js";import{getResolutionToScaleFactor as b}from"../../../views/2d/viewpointUtils.js";import{logAndThrow as j,getMissingPropertyErrorName as P,getMissingPropertyErrorMessage as S,castImageSource as k}from"../utils.js";const E={click:"click-handle",enhancements:"enhancements-handle",rotation:"rotation-handle"};let L=class extends i.EventedAccessor{constructor(e){super(e),this._imageChanged=!1,this._panConstraint=null,this._image=null,this._loadController=null,this._overlays=new v({blendMode:"source-atop"}),this._map=new t,this.autoLoad=!1,this.clickAction="none",this.error=null,this.imageSource=null,this.imageRotation=0,this.state="ready",this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._createImageHandles=()=>{this.removeHandles(E.enhancements),this.addHandles(m((()=>[this.brightness,this.contrast,this.sharpness]),(([e,t,r])=>{this.image?.loaded&&(this.image.effect=`contrast(${10*(t+10)}%) brightness(${10*(e+10)}%)`,this.sharpenImage(this.image,r))}),l))},this._createPanConstraint=()=>{const{image:e,imageRenderer:t}=this,r=r=>{if(!(e&&t&&r.targetGeometry&&e.serviceRasterInfo))return r;const{extent:i}=e.serviceRasterInfo,{constraints:s,rotation:a,width:o,height:n}=t,{extent:m}=p(_.fromExtent(i),a),{width:l,height:h}=m,c=r.targetGeometry.clone(),d=s.scaleToZoom(r.scale),g=1/2**d,u=o/n;let f=g*l,v=g*h;d&&(l/o>h/n?v=f/u:f=v*u);const R=m.clone();return R.xmin+=f/2,R.xmax-=f/2,R.ymin+=v/2,R.ymax-=v/2,r.targetGeometry=y(R,c).coordinate,this.state="image-loaded",r};return{constrain:r,applyPanConstraint:r}},this._createResizeHandles=e=>{e.removeHandles("resize"),e.addHandles(m((()=>{if(!this.imageRenderer.ready)return;const{extent:t}=e.serviceRasterInfo,{width:r,height:i,rotation:s}=this.imageRenderer,{extent:a}=p(_.fromExtent(t),s),{width:o,height:n}=a;return Math.max(o/r,n/i)}),(e=>{if(!this.imageRenderer||null==e)return;const{constraints:t,scale:r,spatialReference:i}=this.imageRenderer,s=t.minScale,a=b(i),o=.25*a,n=a*e;let m=n;const l=[];for(;m>o;)l.push(m),m/=2;l.push(m);const{lods:h}=C.create({scales:l});if(t.set({minScale:n,lods:h}),this._imageChanged)return this.imageRenderer.scale=n,void(this._imageChanged=!1);this.imageRenderer.scale=Math.abs(r-s)<=1e-6?n:r}),l),"resize")},this._loadImageInternal=(e,t={})=>{this.state="image-loading",this.clearImage(),this.error=null,this._imageChanged=!0;const r="string"==typeof e,i=r?void 0:e.datasetFormat,a=r?e:e.url,{customParameters:o,options:m}=t;return this._image=new R({ioConfig:{skipExtensions:["aux.xml","jgw"],skipMapInfo:!0,datasetFormat:i},url:a,customParameters:o}),this._image.when((async e=>{this._updatePanConstraint(),this._createResizeHandles(e),this._map.add(e),this.state="image-loaded"}),(t=>{n(t)?this.state="image-load-aborted":(this.state="image-load-error",this.error=t,s.getLogger(this).error(`error occurred while loading image ${r?e:JSON.stringify(e)}`,t),this.imageSource=null)})),this._image.load(m)},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadImage(this._loadController)},this._updatePanConstraint=()=>{this._panConstraint&&this.imageRenderer.constraints.customConstraints.remove(this._panConstraint),this._panConstraint=this._createPanConstraint(),this.imageRenderer.constraints.customConstraints.add(this._panConstraint)},this.addGraphic=(e,t)=>{this._overlays.graphics.add(e,t)},this.addManyGraphics=e=>{this._overlays.addMany(e)},this.clearGraphics=()=>{this._overlays.graphics.removeAll()},this.clearImage=()=>{this.image&&(this._map.layers.remove(this.image),this._image=o(this._image))},this.loadImage=e=>{const{customParameters:t,imageSource:i}=this;return i?this._loadImageInternal(i,{customParameters:t,options:e}):j(this.declaredClass,new r(P("image-viewer"),S("ImageViewerViewModel","imageSource")))},this.removeGraphic=e=>{this._overlays.remove(e)},this.removeManyGraphics=e=>{this._overlays.removeMany(e)},this._imageRenderer=new I({constraints:{snapToZoom:!0,rotationEnabled:!1},map:this._map,popupEnabled:!1,spatialReference:f.WebMercator,ui:{components:["zoom"]}})}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([m((()=>this.imageSource),(e=>{e&&this.autoLoad&&this._loadWithController()}),l),m((()=>this.image?.loaded),(()=>{this._createImageHandles()})),m((()=>this.imageRotation),(()=>{this._rotateImage()})),m((()=>this.imageRenderer.map),((e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)}),h),m((()=>this.imageRenderer.map.allLayers.length),(e=>{e&&this.imageRenderer.map.layers.reorder(this._overlays,e-1)}),l),m((()=>this.clickAction),(e=>{this.removeHandles(E.click),"none"!==e&&this.addHandles(this.imageRenderer.on("click",(t=>{if(this.image?.loaded&&this.imageRenderer.ready)switch(e){case"emit":t.stopPropagation(),this.emit("click",t);break;case"hittest":t.stopPropagation(),t.async((async()=>{const e=await this.imageRenderer.hitTest(t.screenPoint,{include:this._overlays});this.emit("hittest-response",e)}));break;case"pixel-location":{if(t.stopPropagation(),!this.image?.serviceRasterInfo||!t.mapPoint)return void this.emit("pixel-location",null);const{extent:e,pixelSize:r}=this.image.serviceRasterInfo,i=(t.mapPoint.x-e.xmin)*r.x,s=(e.ymax-t.mapPoint.y)*r.y,a=new u({x:i,y:s,spatialReference:e.spatialReference});this.emit("pixel-location",a);break}}})))}),l)])}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",a(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",a(e,-10,10))}get image(){return this._image}get imagePointsInView(){const{extent:e,ready:t}=this.imageRenderer,r=this.imageRotation,i=this.image?.fullExtent,s=this.image?.serviceRasterInfo,a=!0===this._imageRenderer.allLayerViews.find((({layer:e})=>e===this.image))?.attached;if(!(t&&e&&i&&s&&a))return null;const o=p(_.fromExtent(e),r),n=_.fromExtent(i),m=g(o,n),{rings:l}=m;return l.flat().map((([e,t])=>({x:(e-s.extent.xmin)*s.pixelSize.x,y:(s.extent.ymax-t)*s.pixelSize.y})))}get imageSize(){const{image:e}=this;if(!e?.raster)return null;const{width:t,height:r}=e.raster.rasterInfo;return[t,r]}get imageRenderer(){return this._imageRenderer}get imageView(){return this.imageRenderer.allLayerViews.find((e=>e.layer===this.image))}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",a(e,0,1))}_rotateImage(){this.imageRenderer.constraints.rotationEnabled=!0,this.imageRenderer.rotation=this.imageRotation,this.imageRenderer.constraints.rotationEnabled=!1}sharpenImage(e,t){if(!t)return void(e.rasterFunction=null);const r=[0,-1*t,0,-1*t,4*t+1,-1*t,0,-1*t,0],i=new x({functionName:"Convolution",functionArguments:{type:w.userDefined,cols:3,rows:3,kernel:r,convolutionType:w.userDefined}});e.rasterFunction=i}};e([c()],L.prototype,"_image",void 0),e([c()],L.prototype,"_imageRenderer",void 0),e([c()],L.prototype,"_loadController",void 0),e([c()],L.prototype,"_overlays",void 0),e([c()],L.prototype,"_map",void 0),e([c({type:Boolean})],L.prototype,"autoLoad",void 0),e([c({type:Number})],L.prototype,"brightness",null),e([c()],L.prototype,"clickAction",void 0),e([c({type:Number})],L.prototype,"contrast",null),e([c({type:Object})],L.prototype,"customParameters",void 0),e([c({type:r})],L.prototype,"error",void 0),e([c({readOnly:!0})],L.prototype,"image",null),e([c({readOnly:!0})],L.prototype,"imagePointsInView",null),e([c({readOnly:!0})],L.prototype,"imageSize",null),e([c({cast:k})],L.prototype,"imageSource",void 0),e([c({readOnly:!0})],L.prototype,"imageRenderer",null),e([c({type:Number})],L.prototype,"imageRotation",void 0),e([c()],L.prototype,"imageView",null),e([c({type:Number})],L.prototype,"sharpness",null),e([c()],L.prototype,"state",void 0),L=e([d("esri.widgets.OrientedImageryViewer.components.ImageViewerViewModel")],L);const M=L;export{M as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Map.js";import r from"../../../core/Error.js";import i from"../../../core/Evented.js";import s from"../../../core/Logger.js";import{clamp as a}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{isAbortError as n}from"../../../core/promiseUtils.js";import{watch as m,syncAndInitial as l,initial as h}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{rotate as p,intersect as g,nearestCoordinate as u}from"../../../geometry/geometryEngine.js";import y from"../../../geometry/Point.js";import _ from"../../../geometry/Polygon.js";import f from"../../../geometry/SpatialReference.js";import v from"../../../layers/GraphicsLayer.js";import R from"../../../layers/ImageryTileLayer.js";import x from"../../../layers/support/RasterFunction.js";import{convolutionKernel as w}from"../../../layers/support/rasterFunctionConstants.js";import C from"../../../layers/support/TileInfo.js";import I from"../../../views/MapView.js";import{getResolutionToScaleFactor as b}from"../../../views/2d/viewpointUtils.js";import{logAndThrow as j,getMissingPropertyErrorName as P,getMissingPropertyErrorMessage as S,castImageSource as k}from"../utils.js";const E={click:"click-handle",enhancements:"enhancements-handle",rotation:"rotation-handle"};let L=class extends i.EventedAccessor{constructor(e){super(e),this._imageChanged=!1,this._panConstraint=null,this._image=null,this._loadController=null,this._overlays=new v({blendMode:"source-atop"}),this._map=new t,this.autoLoad=!1,this.clickAction="none",this.error=null,this.imageSource=null,this.imageRotation=0,this.state="ready",this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._createImageHandles=()=>{this.removeHandles(E.enhancements),this.addHandles(m((()=>[this.brightness,this.contrast,this.sharpness]),(([e,t,r])=>{this.image?.loaded&&(this.image.effect=`contrast(${10*(t+10)}%) brightness(${10*(e+10)}%)`,this.sharpenImage(this.image,r))}),l))},this._createPanConstraint=()=>{const{image:e,imageRenderer:t}=this,r=r=>{if(!(e&&t&&r.targetGeometry&&e.serviceRasterInfo))return r;const{extent:i}=e.serviceRasterInfo,{constraints:s,rotation:a,width:o,height:n}=t,{extent:m}=p(_.fromExtent(i),a),{width:l,height:h}=m,d=r.targetGeometry.clone(),c=s.scaleToZoom(r.scale),g=1/2**c,y=o/n;let f=g*l,v=g*h;c&&(l/o>h/n?v=f/y:f=v*y);const R=m.clone();return R.xmin+=f/2,R.xmax-=f/2,R.ymin+=v/2,R.ymax-=v/2,r.targetGeometry=u(R,d).coordinate,this.state="image-loaded",r};return{constrain:r,applyPanConstraint:r}},this._createResizeHandles=e=>{e.removeHandles("resize"),e.addHandles(m((()=>{if(!this.imageRenderer.ready)return;const{extent:t}=e.serviceRasterInfo,{width:r,height:i,rotation:s}=this.imageRenderer,{extent:a}=p(_.fromExtent(t),s),{width:o,height:n}=a;return Math.max(o/r,n/i)}),(e=>{if(!this.imageRenderer||null==e)return;const{constraints:t,scale:r,spatialReference:i}=this.imageRenderer,s=t.minScale,a=b(i),o=.25*a,n=a*e;let m=n;const l=[];for(;m>o;)l.push(m),m/=2;l.push(m);const{lods:h}=C.create({scales:l});if(t.set({minScale:n,lods:h}),this._imageChanged)return this.imageRenderer.scale=n,void(this._imageChanged=!1);this.imageRenderer.scale=Math.abs(r-s)<=1e-6?n:r}),l),"resize")},this._loadImageInternal=(e,t={})=>{this.state="image-loading",this.clearImage(),this.error=null,this._imageChanged=!0;const r="string"==typeof e,i=r?void 0:e.datasetFormat,a=r?e:e.url,{customParameters:o,options:m}=t;return this._image=new R({ioConfig:{skipExtensions:["aux.xml","jgw"],skipMapInfo:!0,datasetFormat:i},url:a,customParameters:o}),this._image.when((async e=>{this._updatePanConstraint(),this._createResizeHandles(e),this._map.add(e),this.state="image-loaded"}),(t=>{n(t)?this.state="image-load-aborted":(this.state="image-load-error",this.error=t,s.getLogger(this).error(`error occurred while loading image ${r?e:JSON.stringify(e)}`,t),this.imageSource=null)})),this._image.load(m)},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadImage(this._loadController)},this._updatePanConstraint=()=>{this._panConstraint&&this.imageRenderer.constraints.customConstraints.remove(this._panConstraint),this._panConstraint=this._createPanConstraint(),this.imageRenderer.constraints.customConstraints.add(this._panConstraint)},this.addGraphic=(e,t)=>{this._overlays.graphics.add(e,t)},this.addManyGraphics=e=>{this._overlays.addMany(e)},this.clearGraphics=()=>{this._overlays.graphics.removeAll()},this.clearImage=()=>{this.image&&(this._map.layers.remove(this.image),this._image=o(this._image))},this.loadImage=e=>{const{customParameters:t,imageSource:i}=this;return i?this._loadImageInternal(i,{customParameters:t,options:e}):j(this.declaredClass,new r(P("image-viewer"),S("ImageViewerViewModel","imageSource")))},this.removeGraphic=e=>{this._overlays.remove(e)},this.removeManyGraphics=e=>{this._overlays.removeMany(e)},this._imageRenderer=new I({constraints:{snapToZoom:!0,rotationEnabled:!1},map:this._map,popupEnabled:!1,spatialReference:f.WebMercator,ui:{components:["zoom"]}})}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([m((()=>this.imageSource),(e=>{e&&this.autoLoad&&this._loadWithController()}),l),m((()=>this.image?.loaded),(()=>{this._createImageHandles()})),m((()=>this.imageRotation),(()=>{this._rotateImage()})),m((()=>this.imageRenderer.map),((e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)}),h),m((()=>this.imageRenderer.map.allLayers.length),(e=>{e&&this.imageRenderer.map.layers.reorder(this._overlays,e-1)}),l),m((()=>this.clickAction),(e=>{this.removeHandles(E.click),"none"!==e&&this.addHandles(this.imageRenderer.on("click",(t=>{if(this.image?.loaded&&this.imageRenderer.ready)switch(e){case"emit":t.stopPropagation(),this.emit("click",t);break;case"hittest":t.stopPropagation(),t.defer((async()=>{const e=await this.imageRenderer.hitTest(t.screenPoint,{include:this._overlays});this.emit("hittest-response",e)}));break;case"pixel-location":{if(t.stopPropagation(),!this.image?.serviceRasterInfo||!t.mapPoint)return void this.emit("pixel-location",null);const{extent:e,pixelSize:r}=this.image.serviceRasterInfo,i=(t.mapPoint.x-e.xmin)*r.x,s=(e.ymax-t.mapPoint.y)*r.y,a=new y({x:i,y:s,spatialReference:e.spatialReference});this.emit("pixel-location",a);break}}})))}),l)])}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",a(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",a(e,-10,10))}get image(){return this._image}get imagePointsInView(){const{extent:e,ready:t}=this.imageRenderer,r=this.imageRotation,i=this.image?.fullExtent,s=this.image?.serviceRasterInfo,a=!0===this._imageRenderer.allLayerViews.find((({layer:e})=>e===this.image))?.attached;if(!(t&&e&&i&&s&&a))return null;const o=p(_.fromExtent(e),r),n=_.fromExtent(i),m=g(o,n),{rings:l}=m;return l.flat().map((([e,t])=>({x:(e-s.extent.xmin)*s.pixelSize.x,y:(s.extent.ymax-t)*s.pixelSize.y})))}get imageSize(){const{image:e}=this;if(!e?.raster)return null;const{width:t,height:r}=e.raster.rasterInfo;return[t,r]}get imageRenderer(){return this._imageRenderer}get imageView(){return this.imageRenderer.allLayerViews.find((e=>e.layer===this.image))}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",a(e,0,1))}_rotateImage(){this.imageRenderer.constraints.rotationEnabled=!0,this.imageRenderer.rotation=this.imageRotation,this.imageRenderer.constraints.rotationEnabled=!1}sharpenImage(e,t){if(!t)return void(e.rasterFunction=null);const r=[0,-1*t,0,-1*t,4*t+1,-1*t,0,-1*t,0],i=new x({functionName:"Convolution",functionArguments:{type:w.userDefined,cols:3,rows:3,kernel:r,convolutionType:w.userDefined}});e.rasterFunction=i}};e([d()],L.prototype,"_image",void 0),e([d()],L.prototype,"_imageRenderer",void 0),e([d()],L.prototype,"_loadController",void 0),e([d()],L.prototype,"_overlays",void 0),e([d()],L.prototype,"_map",void 0),e([d({type:Boolean})],L.prototype,"autoLoad",void 0),e([d({type:Number})],L.prototype,"brightness",null),e([d()],L.prototype,"clickAction",void 0),e([d({type:Number})],L.prototype,"contrast",null),e([d({type:Object})],L.prototype,"customParameters",void 0),e([d({type:r})],L.prototype,"error",void 0),e([d({readOnly:!0})],L.prototype,"image",null),e([d({readOnly:!0})],L.prototype,"imagePointsInView",null),e([d({readOnly:!0})],L.prototype,"imageSize",null),e([d({cast:k})],L.prototype,"imageSource",void 0),e([d({readOnly:!0})],L.prototype,"imageRenderer",null),e([d({type:Number})],L.prototype,"imageRotation",void 0),e([d()],L.prototype,"imageView",null),e([d({type:Number})],L.prototype,"sharpness",null),e([d()],L.prototype,"state",void 0),L=e([c("esri.widgets.OrientedImageryViewer.components.ImageViewerViewModel")],L);const M=L;export{M as default};