@arcgis/core 5.2.0-next.114 → 5.2.0-next.115

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 (85) hide show
  1. package/Graphic.d.ts +5 -3
  2. package/applications/Urban/LineImagePattern3D.js +1 -1
  3. package/arcgisGlobal.d.ts +1 -0
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/02f94f9d704f03ddb5c6.js +1 -0
  6. package/assets/esri/core/workers/chunks/{c517e732cab41093b2e0.js → 0312c40d94b248ad71e3.js} +1 -1
  7. package/assets/esri/core/workers/chunks/0463c807b37f01bbc35c.js +1 -0
  8. package/assets/esri/core/workers/chunks/0ff13f7a18b0123d253e.js +1 -0
  9. package/assets/esri/core/workers/chunks/2e0fd0536408053ac6f5.js +1 -0
  10. package/assets/esri/core/workers/chunks/{6b264006b96cbf93d8ed.js → 48d3da636be15581fd7d.js} +1 -1
  11. package/assets/esri/core/workers/chunks/515fe302743c0b46f7e0.js +1 -0
  12. package/assets/esri/core/workers/chunks/{982a396bd4fffa62e911.js → 526cc64ae46dec3fbeda.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{d13cf2e8b24e978ea77c.js → 7243d5721bb6a7329055.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{785206da3962ba23de16.js → 84b89c523d3e16a5ee46.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{484b3e2a220c440ccbb4.js → 9b92c41907e2da80c288.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{4d2553219ffd223b0e90.js → a774006be107e449bc29.js} +1 -1
  17. package/assets/esri/core/workers/chunks/b45ebb1b64ee7314375e.js +1 -0
  18. package/assets/esri/core/workers/chunks/{e0f417992889a6c41095.js → baa8bce361a2677533ec.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{96ebf76661b12128ddd5.js → be4de7111bc21bc69de1.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{e164acd876bbd42ed658.js → f18ee2eaa96d103627a6.js} +1 -1
  21. package/chunks/RibbonLine.glsl.js +63 -58
  22. package/config.js +1 -1
  23. package/core/screenUtils.js +1 -1
  24. package/core/units.js +1 -1
  25. package/graphic/getGraphicOriginTitle.d.ts +10 -0
  26. package/graphic/getGraphicOriginTitle.js +2 -0
  27. package/kernel.js +1 -1
  28. package/layers/MapNotesLayer.js +1 -1
  29. package/layers/raster/functions/rasterProjectionHelper.js +1 -1
  30. package/layers/support/Field.js +1 -1
  31. package/layers/support/TimeSeriesInfo.d.ts +1 -1
  32. package/layers/support/featurePopupQueryUtils.js +1 -1
  33. package/layers/support/timeSeriesUtils.js +1 -1
  34. package/layers/support/types.d.ts +1 -1
  35. package/layers/types.d.ts +1 -2
  36. package/package.json +2 -2
  37. package/portal/schemas/definitions.js +1 -1
  38. package/rest/support/OutDistance.d.ts +19 -18
  39. package/rest/support/Query.d.ts +48 -18
  40. package/smartMapping/renderers/support/utils.js +1 -1
  41. package/support/revision.js +1 -1
  42. package/symbols/patterns/LinePattern3D.js +1 -1
  43. package/symbols/patterns/LineStylePattern3D.js +1 -1
  44. package/symbols/patterns/LineTemplatePattern3D.js +1 -1
  45. package/symbols/patterns/utils.js +1 -1
  46. package/views/2d/engine/webgl/util/DimensionMatcher.js +1 -1
  47. package/views/2d/layers/graphics/GraphicStore.js +1 -1
  48. package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
  49. package/views/2d/support/clippingUtils.js +1 -1
  50. package/views/2d/support/hitTestUtils.js +1 -1
  51. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  52. package/views/3d/webgl-engine/lib/AttributeView.js +2 -0
  53. package/views/3d/webgl-engine/lib/attributeViewUtils.js +2 -0
  54. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  55. package/views/3d/webgl-engine/materials/HUDMaterialBaseInstance.js +1 -1
  56. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  57. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  58. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  59. package/views/PopupView.d.ts +64 -2
  60. package/views/View2D.js +1 -1
  61. package/views/layers/FeatureLikeLayerView.js +1 -1
  62. package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
  63. package/widgets/BasemapLayerList/BasemapLayerListViewModel.js +1 -1
  64. package/widgets/BasemapLayerList.js +1 -1
  65. package/widgets/CatalogLayerList/CatalogLayerListViewModel.d.ts +2 -1
  66. package/widgets/CatalogLayerList/CatalogLayerListViewModel.js +1 -1
  67. package/widgets/CatalogLayerList/CatalogLayerListVisibleElements.d.ts +5 -1
  68. package/widgets/CatalogLayerList/types.d.ts +12 -1
  69. package/widgets/CatalogLayerList.d.ts +2 -1
  70. package/widgets/CatalogLayerList.js +1 -1
  71. package/widgets/LayerList.js +1 -1
  72. package/widgets/TableList/ListItem.d.ts +2 -0
  73. package/widgets/TableList/ListItemPanel.d.ts +4 -0
  74. package/widgets/TableList/TableListViewModel.d.ts +4 -0
  75. package/widgets/TableList/TableListViewModel.js +1 -1
  76. package/widgets/TableList/TableListVisibleElements.d.ts +6 -1
  77. package/widgets/TableList/types.d.ts +12 -1
  78. package/widgets/TableList.d.ts +3 -0
  79. package/widgets/TableList.js +1 -1
  80. package/assets/esri/core/workers/chunks/078ed48eb055dd213ee6.js +0 -1
  81. package/assets/esri/core/workers/chunks/1004e77593dfa506cd5d.js +0 -1
  82. package/assets/esri/core/workers/chunks/510a190a6f0a60ae38c3.js +0 -1
  83. package/assets/esri/core/workers/chunks/cd0f5cd0fefe7f49e3d8.js +0 -1
  84. package/assets/esri/core/workers/chunks/e6fb7b93cf73b05b1079.js +0 -1
  85. package/assets/esri/core/workers/chunks/f86ea5cf4814b458d50b.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as s,Seconds as n}from"../../../../core/time.js";import{copy as a,set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as c,subtract as p,dot as u,scale as m,add as h,copy as f,length as d,distance as g,lerp as _,transformMat4 as b,normalize as S}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPoints as w,distance2 as E,closestLineSegmentPoint as v,projectPoint as x,projectPointFraction as T,create as z}from"../../../../geometry/support/lineSegment.js";import{fromPoints as j,signedDistance as L,getNormal as C,create as A}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as M,BufferViewFloat as V,BufferViewVec4Unorm8 as F,BufferViewVec4f16 as R,BufferViewUint32 as O}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as B,isColor as U,isDepth as I,isColorHighlightOLIDOrDepth as N,is2DGeometryOutput as k}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as W}from"../effects/geometry/olidUtils.js";import D from"../lib/GLMaterial.js";import{LineMaterial as Y}from"../lib/LineMaterial.js";import{projectWorldLineSegmentToRenderScreen as J,screenPolygonIntersectsBufferedSegment as q}from"../lib/screenPolygonOverlapUtils.js";import{Hit as X,DrapedHit as G}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as H}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as K,assert as Q}from"../lib/Util.js";import{isImagePattern as Z}from"./lineStippleUtils.js";import{VisualVariablePassParameters as $}from"./VisualVariablePassParameters.js";import{writeColor as ee}from"./internal/bufferWriterUtils.js";import{n as te}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as ie,getTextureBufferLayout as re}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as se}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as ne}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as ae}from"../../../../webscene/support/AlphaCutoff.js";class oe extends Y{constructor(e,t){super(e,ce),this.produces=new Map([[2,e=>B(e)||U(e)&&8===this.parameters.renderOccluded],[3,e=>I(e)],[10,e=>N(e)&&8===this.parameters.renderOccluded],[11,e=>N(e)&&8===this.parameters.renderOccluded],[4,e=>U(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>U(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>k(e)]]),this._configuration=new ne(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,r=i&&this.parameters.isImagePattern(),s=t&&(this.parameters.worldSized||r);this._configuration.draped=t,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=ge(this.parameters.join,i),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&de(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!s,this._configuration.worldSized=s,this._configuration.imagePattern=r}get visible(){return this.parameters.color[3]>=ae||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>ae}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e},i,r,s,n,a){if(!i.options.selectionMode)return;const o=this._getLineSize(e,!0),l=r[0],c=r[1],p=he(o,a,this.parameters.worldSized);let u=Number.MAX_VALUE,m=0;for(const h of fe(Pe,ye,this.parameters,e)){const e=l-Pe[0],i=c-Pe[1],r=ye[0]-Pe[0],s=ye[1]-Pe[1],n=t((r*e+s*i)/(r*r+s*s),0,1),a=r*n-e,o=s*n-i,p=a*a+o*o;p<u&&(u=p,m=h)}u<p*p&&s(n.distance,n.renderDistance,n.normal,m)}intersectRay(t,i,r,s,n,o){const{options:l,camera:_,rayBegin:b,rayEnd:S}=r;if(!l.selectionMode||!t.visible||!_)return;if(!K(i))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=t.attributes,y=P.get("position").data,x=this._getLineSize(P),T=ze;a(T,r.point);const z=x*_.pixelRatio,A=Ye*_.pixelRatio,M=z/2+A;c(Ue[0],T[0]-M,T[1]+M,0),c(Ue[1],T[0]+M,T[1]+M,0),c(Ue[2],T[0]+M,T[1]-M,0),c(Ue[3],T[0]-M,T[1]-M,0);for(let e=0;e<4;e++)if(!_.unprojectFromRenderScreen(Ue[e],Ie[e]))return;j(_.eye,Ie[0],Ie[1],Ne),j(_.eye,Ie[1],Ie[2],ke),j(_.eye,Ie[2],Ie[3],We),j(_.eye,Ie[3],Ie[0],De);let V=Number.MAX_VALUE,F=0;for(const e of this._forEachTransformedLineSegment(be,Se,y,i,me(this.parameters,P))){if(L(Ne,be)<0&&L(Ne,Se)<0||L(ke,be)<0&&L(ke,Se)<0||L(We,be)<0&&L(We,Se)<0||L(De,be)<0&&L(De,Se)<0)continue;const t=_.projectToRenderScreen(be,je),i=_.projectToRenderScreen(Se,Le);if(null==t||null==i)continue;if(t[2]<0&&i[2]>0){p(xe,be,Se);const e=_.frustum,i=-L(e[4],be)/u(xe,C(e[4]));if(m(xe,xe,i),h(be,be,xe),!_.projectToRenderScreen(be,t))continue}else if(t[2]>0&&i[2]<0){p(xe,Se,be);const e=_.frustum,t=-L(e[4],Se)/u(xe,C(e[4]));if(m(xe,xe,t),h(Se,Se,xe),!_.projectToRenderScreen(Se,i))continue}else if(t[2]<0&&i[2]<0)continue;t[2]=0,i[2]=0;const r=w(t,i,Fe),s=E(r,T);if(!(s>=V)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(r,be,Se,T,_,x,A);if(s>=e*e)continue}V=s,f(Me,be),f(Ve,Se),F=e}}if(V<M*M){let e=Number.MAX_VALUE;if(v(w(Me,Ve,Fe),w(b,S,Re),Te)){p(Te,Te,b);const t=d(Te);m(Te,Te,1/t),e=t/g(b,S)}o(e,e,Te,F)}}intersectScreenPolygon(t,i,r,s){const{options:n,camera:a,screenPolygonPrimitiveProcessor:o}=r;if(!n.selectionMode||!t.visible)return null;if(!K(i))return e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix"),null;const l=t.attributes,c=l.get("position").data,p=this._getLineSize(l),u=Ye,m=u*a.pixelRatio,h=new X(4);for(const e of this._forEachTransformedLineSegment(be,Se,c,i,me(this.parameters,l)))for(const[t,i]of o.processLineSegment(Je,be,Se)){if(!J(a,t,i,je,Le))continue;const r=w(je,Le,Fe);let n=p/2+u;this.parameters.screenSizePerspective&&(_(ze,je,Le,.5),n=Math.max(n,this.computeScreenSizePerspectiveWidth(r,t,i,ze,a,p,m)/a.pixelRatio)),a.renderToScreen(je,Ce),a.renderToScreen(Le,Ae),q(s,Ce,Ae,n)&&(x(w(t,i,Re),a.eye,we),h.updateIfCloserFromValues(g(a.eye,we),e,we,null))}return h}intersectScreenPolygonDraped({attributes:e},t,i,r,s){if(!i.options.selectionMode)return null;const n=he(this._getLineSize(e,!0),s,this.parameters.worldSized);for(const a of fe(Pe,ye,this.parameters,e,t))if(q(r,Pe,ye,n))return new G(a);return null}createBufferWriter(){return new pe(ie(this.parameters),re(this.parameters),this.parameters)}createGLMaterial(e){return new le(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:s(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,i,r,s,n,a){const o=T(e,r);_(we,t,i,o),b(Ee,we,s.viewMatrix);const l=d(Ee),c=this.computeCameraAbsCosAngle(we,s,this._configuration.spherical);_e.update(c,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return _e.apply(n)*s.pixelRatio/2+a}computeCameraAbsCosAngle(e,t,i){return i?S(Te,e):c(Te,0,0,1),p(ve,e,t.eye),S(ve,ve),Math.abs(u(Te,ve))}_getLineSize(e,i=!1){let r=this.parameters.width;if(this.parameters.vvSize){const s=e.get("sizeFeatureAttribute").data[0];Number.isNaN(s)?i&&(r*=this.parameters.vvSize.fallback[0]):r*=t(this.parameters.vvSize.offset[0]+s*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has("size")&&(r*=e.get("size").data[0]);return r}*_forEachTransformedLineSegment(e,t,i,r,s){const n=s?i.length-2:i.length-5;for(let a=0;a<n;a+=3){e[0]=i[a]+r[12],e[1]=i[a+1]+r[13],e[2]=i[a+2]+r[14];const s=(a+3)%i.length;t[0]=i[s]+r[12],t[1]=i[s+1]+r[13],t[2]=i[s+2]+r[14],yield a/3}}}class le extends D{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(se,e)}}class ce extends ${constructor(){super(...arguments),this._width=0,this.color=y,this.join="miter",this.cap=0,this.miterLimit=5,this.shadingEnabled=!1,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=n(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=n(0),this.endTime=n(1/0),this.worldSized=!1}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return Z(this.stipplePattern)&&null!=this.stippleTexture}}class pe{constructor(e,t,i){this.layout=e,this.textureBufferLayout=t,this._parameters=i,this.numJoinSubdivisions=ge(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return me(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3+(this._isClosed(e)?3:2)}elementCount(e){const t=2,i=e.get("position").indices.length/2+1,r=this._isClosed(e);let s=r?2:2*t;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,i,r,s,n){null!=n&&this._writeTextureBuffer(e,i,n),null!=r&&this._writeVertexBuffer(e,i,r,s)}_writeTextureBuffer(e,t,i){const r=t.get("position"),s=r.data.length/3,n=this._isClosed(t),{buffer:a,offset:o}=i,l=a.getField("position",M),c=a.getField("u0",V),p=a.getField("sizeFeatureAttribute",V),u=a.getField("size",V),m=a.getField("colorFeatureAttribute",V),h=a.getField("color",F),d=a.getField("olidColor",F),_=a.getField("timeStamps",R),b=a.getField("opacityFeatureAttribute",V),S=t.get("sizeFeatureAttribute")?.data,P=t.get("size")?.data,y=t.get("colorFeatureAttribute")?.data,w=t.get("color")?.data,E=t.get("opacityFeatureAttribute")?.data,v=t.get("distanceToStart")?.data,x=t.get("timeStamps");Q(null!==l,"Expected valid position field in texture buffer"),Q(null!==c,"Expected valid u0 field in texture buffer");let T=0;for(let j=0;j<s;++j){this._getTransformedPosition(Be,r.data,j,e),j>0&&(null!=v?T=v[j]??T:T+=g(Oe,Be));const t=o+j+1;if(l.setVec(t,Be),c.set(t,T),f(Oe,Be),p&&p.set(t,1===S?.length?S[0]:S?.[j]??0),u&&u.set(t,1===P?.length?P[0]:P?.[j]??1),m&&m.set(t,1===y?.length?y[0]:y?.[j]??0),h)if(null!=w){const e=Math.min(4*j,w.length-4);h.setValues(t,w[e],w[e+1],w[e+2],w[e+3])}else h.setValues(t,1,1,1,1);b&&b.set(t,1===E?.length?E[0]:E?.[j]??0)}if(null!=_&&null!=x){Q(4===x.size);const e=x.data;for(let t=0;t<s;++t){const i=4*t,r=o+t+1;_.set(r,0,e[i]),_.set(r,1,e[i+1]),_.set(r,2,e[i+2]),_.set(r,3,e[i+3])}}if(n){const e=o,t=o+1,i=o+2,r=o+s,n=r+1,p=r+2;a.copyItem(r,e),a.copyItem(t,n),a.copyItem(i,p),l.getVec(r,Oe),l.getVec(t,Be);const u=v?.[s]??T+g(Oe,Be);c.set(n,u)}else{const e=o,t=o+1,i=o+s,r=i+1;a.copyItem(t,e),a.copyItem(i,r)}const z=t.get("olidColor");W()&&null!=z&&null!=d&&ee(z,4,d,o)}_writeVertexBuffer(e,t,i,r){const{buffer:s,offset:n}=i,{layout:a}=this,o=t.get("position"),l=o.indices,c=o.data.length/3,p=this._isClosed(t),u=c+(p?3:2);l&&l.length!==2*(c-1)&&console.warn("RibbonLineMaterial does not support indices");const m=s.getField("textureElementIndex",O);Q(null!=m,"Missing texture buffer index field"),Q(null!=r,"Using a texture layout, but the texture range for this instance was not provided");const h=r.from;Q(r.numElements===u,"Expected number of elements in TextureBuffer to equal number of points");const f=new Float32Array(s.buffer),d=new Float16Array(s.buffer),g=new Uint32Array(s.buffer),_=a.stride/4;let b=n*_;const S=b,P=f.BYTES_PER_ELEMENT/d.BYTES_PER_ELEMENT,y=(e,t,i)=>{const r=i+1;g[b]=h+r,b++;let s=b*P;d[s++]=e,d[s++]=t,b=Math.ceil(s/P)};b+=_;let w=0,E=0;p?(w=0,E=c):(y(1,-4,0),y(1,4,0),w=1,E=c-1);for(let v=w;v<E;v++){y(0,-1,v),y(0,1,v);const e=this.numJoinSubdivisions;for(let t=0;t<e;++t){const i=(t+1)/(e+1);y(i,-1,v),y(i,1,v)}y(1,-2,v),y(1,2,v)}p?(y(0,-1,E),y(0,1,E)):(y(0,-5,E),y(0,5,E)),ue(f,S+_,f,S,_);b=ue(f,b-_,f,b,_),this._parameters.wireframe&&this._addWireframeVertices(s,S,b,_)}_getTransformedPosition(e,t,i,r){const s=3*i;c(e,t[s+0],t[s+1],t[s+2]),r&&b(e,e,r)}_addWireframeVertices(e,t,i,r){const s=new Uint8Array(e.buffer,i*Float32Array.BYTES_PER_ELEMENT),n=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(i-t)*Float32Array.BYTES_PER_ELEMENT),a=r*Float32Array.BYTES_PER_ELEMENT;let o=0;const l=e=>o=ue(n,e,s,o,a);for(let c=0;c<=n.length-4*a;c+=2*a)l(c),l(c+2*a),l(c+1*a),l(c+2*a),l(c+1*a),l(c+3*a)}}function ue(e,t,i,r,s){for(let n=0;n<s;n++)i[r++]=e[t++];return r}function me(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function he(e,t,i){return i?e/2+Ye*t:(e/2+Ye)*t}function*fe(e,t,i,r,s){const n=r.get("position").data,l=me(i,r)?n.length-2:n.length-5,c=s?.[0]??0,p=s?.[1]??0;o(e,n[0]+c,n[1]+p);for(let u=3;u<l+3;u+=3){const i=u%n.length;o(t,n[i]+c,n[i+1]+p),yield u/3,a(e,t)}}function de(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function ge(e,t){const i=t?1:0;switch(e){case"miter":case"bevel":return i;case"round":return te+i}}const _e=new H,be=P(),Se=P(),Pe=l(),ye=l(),we=P(),Ee=P(),ve=P(),xe=P(),Te=P(),ze=P(),je=i(),Le=i(),Ce=r(),Ae=r(),Me=P(),Ve=P(),Fe=z(),Re=z(),Oe=P(),Be=P(),Ue=[i(),i(),i(),i()],Ie=[P(),P(),P(),P()],Ne=A(),ke=A(),We=A(),De=A(),Ye=4,Je=[P(),P()];export{ce as Parameters,oe as RibbonLineMaterial};
2
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as s,Seconds as n}from"../../../../core/time.js";import{copy as a,set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as c,subtract as p,dot as u,scale as m,add as h,copy as f,length as d,distance as g,lerp as b,transformMat4 as _,normalize as S}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPoints as E,distance2 as w,closestLineSegmentPoint as v,projectPoint as x,projectPointFraction as T,create as z}from"../../../../geometry/support/lineSegment.js";import{fromPoints as j,signedDistance as L,getNormal as A,create as C}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as M,BufferViewFloat as V,BufferViewVec4Unorm8 as O,BufferViewVec4f16 as F,BufferViewUint32 as R}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as B,isColor as I,isDepth as U,isColorHighlightOLIDOrDepth as N,is2DGeometryOutput as k}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as W}from"../effects/geometry/olidUtils.js";import D from"../lib/GLMaterial.js";import{LineMaterial as Y}from"../lib/LineMaterial.js";import{projectWorldLineSegmentToRenderScreen as J,screenPolygonIntersectsBufferedSegment as q}from"../lib/screenPolygonOverlapUtils.js";import{Hit as G,DrapedHit as X}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as H}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as K,assert as Q}from"../lib/Util.js";import{isImagePattern as Z}from"./lineStippleUtils.js";import{VisualVariablePassParameters as $}from"./VisualVariablePassParameters.js";import{writeColor as ee}from"./internal/bufferWriterUtils.js";import{n as te}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as ie,getTextureBufferLayout as re}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as se}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as ne}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as ae}from"../../../../webscene/support/AlphaCutoff.js";class oe extends Y{constructor(e,t){super(e,ce),this.produces=new Map([[2,e=>B(e)||I(e)&&8===this.parameters.renderOccluded],[3,e=>U(e)],[10,e=>N(e)&&8===this.parameters.renderOccluded],[11,e=>N(e)&&8===this.parameters.renderOccluded],[4,e=>I(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>I(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>k(e)]]),this._configuration=new ne(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,r=i&&this.parameters.isImagePattern(),s=t&&(this.parameters.worldSized||r);this._configuration.draped=t,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=ge(this.parameters.join,i),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&de(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.pbrMode=this.parameters.shadingEnabled?2:0,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!s,this._configuration.worldSized=s,this._configuration.imagePattern=r,I(e.output)&&this.parameters.shadingEnabled?(this._configuration.receiveAmbientOcclusion=null!=e.ssao,this._configuration.receiveGlobalIllumination=e.globalIlluminationEnabled):this._configuration.receiveAmbientOcclusion=this._configuration.receiveGlobalIllumination=!1}get visible(){return this.parameters.color[3]>=ae||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>ae}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e},i,r,s,n,a){if(!i.options.selectionMode)return;const o=this._getLineSize(e,!0),l=r[0],c=r[1],p=he(o,a,this.parameters.worldSized);let u=Number.MAX_VALUE,m=0;for(const h of fe(Pe,ye,this.parameters,e)){const e=l-Pe[0],i=c-Pe[1],r=ye[0]-Pe[0],s=ye[1]-Pe[1],n=t((r*e+s*i)/(r*r+s*s),0,1),a=r*n-e,o=s*n-i,p=a*a+o*o;p<u&&(u=p,m=h)}u<p*p&&s(n.distance,n.renderDistance,n.normal,m)}intersectRay(t,i,r,s,n,o){const{options:l,camera:b,rayBegin:_,rayEnd:S}=r;if(!l.selectionMode||!t.visible||!b)return;if(!K(i))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=t.attributes,y=P.get("position").data,x=this._getLineSize(P),T=ze;a(T,r.point);const z=x*b.pixelRatio,C=Ye*b.pixelRatio,M=z/2+C;c(Ie[0],T[0]-M,T[1]+M,0),c(Ie[1],T[0]+M,T[1]+M,0),c(Ie[2],T[0]+M,T[1]-M,0),c(Ie[3],T[0]-M,T[1]-M,0);for(let e=0;e<4;e++)if(!b.unprojectFromRenderScreen(Ie[e],Ue[e]))return;j(b.eye,Ue[0],Ue[1],Ne),j(b.eye,Ue[1],Ue[2],ke),j(b.eye,Ue[2],Ue[3],We),j(b.eye,Ue[3],Ue[0],De);let V=Number.MAX_VALUE,O=0;for(const e of this._forEachTransformedLineSegment(_e,Se,y,i,me(this.parameters,P))){if(L(Ne,_e)<0&&L(Ne,Se)<0||L(ke,_e)<0&&L(ke,Se)<0||L(We,_e)<0&&L(We,Se)<0||L(De,_e)<0&&L(De,Se)<0)continue;const t=b.projectToRenderScreen(_e,je),i=b.projectToRenderScreen(Se,Le);if(null==t||null==i)continue;if(t[2]<0&&i[2]>0){p(xe,_e,Se);const e=b.frustum,i=-L(e[4],_e)/u(xe,A(e[4]));if(m(xe,xe,i),h(_e,_e,xe),!b.projectToRenderScreen(_e,t))continue}else if(t[2]>0&&i[2]<0){p(xe,Se,_e);const e=b.frustum,t=-L(e[4],Se)/u(xe,A(e[4]));if(m(xe,xe,t),h(Se,Se,xe),!b.projectToRenderScreen(Se,i))continue}else if(t[2]<0&&i[2]<0)continue;t[2]=0,i[2]=0;const r=E(t,i,Oe),s=w(r,T);if(!(s>=V)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(r,_e,Se,T,b,x,C);if(s>=e*e)continue}V=s,f(Me,_e),f(Ve,Se),O=e}}if(V<M*M){let e=Number.MAX_VALUE;if(v(E(Me,Ve,Oe),E(_,S,Fe),Te)){p(Te,Te,_);const t=d(Te);m(Te,Te,1/t),e=t/g(_,S)}o(e,e,Te,O)}}intersectScreenPolygon(t,i,r,s){const{options:n,camera:a,screenPolygonPrimitiveProcessor:o}=r;if(!n.selectionMode||!t.visible)return null;if(!K(i))return e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix"),null;const l=t.attributes,c=l.get("position").data,p=this._getLineSize(l),u=Ye,m=u*a.pixelRatio,h=new G(4);for(const e of this._forEachTransformedLineSegment(_e,Se,c,i,me(this.parameters,l)))for(const[t,i]of o.processLineSegment(Je,_e,Se)){if(!J(a,t,i,je,Le))continue;const r=E(je,Le,Oe);let n=p/2+u;this.parameters.screenSizePerspective&&(b(ze,je,Le,.5),n=Math.max(n,this.computeScreenSizePerspectiveWidth(r,t,i,ze,a,p,m)/a.pixelRatio)),a.renderToScreen(je,Ae),a.renderToScreen(Le,Ce),q(s,Ae,Ce,n)&&(x(E(t,i,Fe),a.eye,Ee),h.updateIfCloserFromValues(g(a.eye,Ee),e,Ee,null))}return h}intersectScreenPolygonDraped({attributes:e},t,i,r,s){if(!i.options.selectionMode)return null;const n=he(this._getLineSize(e,!0),s,this.parameters.worldSized);for(const a of fe(Pe,ye,this.parameters,e,t))if(q(r,Pe,ye,n))return new X(a);return null}createBufferWriter(){return new pe(ie(this.parameters),re(this.parameters),this.parameters)}createGLMaterial(e){return new le(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:s(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,i,r,s,n,a){const o=T(e,r);b(Ee,t,i,o),_(we,Ee,s.viewMatrix);const l=d(we),c=this.computeCameraAbsCosAngle(Ee,s,this._configuration.spherical);be.update(c,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return be.apply(n)*s.pixelRatio/2+a}computeCameraAbsCosAngle(e,t,i){return i?S(Te,e):c(Te,0,0,1),p(ve,e,t.eye),S(ve,ve),Math.abs(u(Te,ve))}_getLineSize(e,i=!1){let r=this.parameters.width;if(this.parameters.vvSize){const s=e.get("sizeFeatureAttribute").data[0];Number.isNaN(s)?i&&(r*=this.parameters.vvSize.fallback[0]):r*=t(this.parameters.vvSize.offset[0]+s*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has("size")&&(r*=e.get("size").data[0]);return r}*_forEachTransformedLineSegment(e,t,i,r,s){const n=s?i.length-2:i.length-5;for(let a=0;a<n;a+=3){e[0]=i[a]+r[12],e[1]=i[a+1]+r[13],e[2]=i[a+2]+r[14];const s=(a+3)%i.length;t[0]=i[s]+r[12],t[1]=i[s+1]+r[13],t[2]=i[s+2]+r[14],yield a/3}}}class le extends D{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(se,e)}}class ce extends ${constructor(){super(...arguments),this._width=0,this.color=y,this.join="miter",this.cap=0,this.miterLimit=5,this.shadingEnabled=!1,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=n(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=n(0),this.endTime=n(1/0),this.worldSized=!1}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return Z(this.stipplePattern)&&null!=this.stippleTexture}}class pe{constructor(e,t,i){this.layout=e,this.textureBufferLayout=t,this._parameters=i,this.numJoinSubdivisions=ge(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return me(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3+(this._isClosed(e)?3:2)}elementCount(e){const t=2,i=e.get("position").indices.length/2+1,r=this._isClosed(e);let s=r?2:2*t;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,i,r,s,n){null!=n&&this._writeTextureBuffer(e,i,n),null!=r&&this._writeVertexBuffer(e,i,r,s)}_writeTextureBuffer(e,t,i){const r=t.get("position"),s=r.data.length/3,n=this._isClosed(t),{buffer:a,offset:o}=i,l=a.getField("position",M),c=a.getField("u0",V),p=a.getField("sizeFeatureAttribute",V),u=a.getField("size",V),m=a.getField("colorFeatureAttribute",V),h=a.getField("color",O),d=a.getField("olidColor",O),b=a.getField("timeStamps",F),_=a.getField("opacityFeatureAttribute",V),S=t.get("sizeFeatureAttribute")?.data,P=t.get("size")?.data,y=t.get("colorFeatureAttribute")?.data,E=t.get("color")?.data,w=t.get("opacityFeatureAttribute")?.data,v=t.get("distanceToStart")?.data,x=t.get("timeStamps");Q(null!==l,"Expected valid position field in texture buffer"),Q(null!==c,"Expected valid u0 field in texture buffer");let T=0;for(let j=0;j<s;++j){this._getTransformedPosition(Be,r.data,j,e),j>0&&(null!=v?T=v[j]??T:T+=g(Re,Be));const t=o+j+1;if(l.setVec(t,Be),c.set(t,T),f(Re,Be),p&&p.set(t,1===S?.length?S[0]:S?.[j]??0),u&&u.set(t,1===P?.length?P[0]:P?.[j]??1),m&&m.set(t,1===y?.length?y[0]:y?.[j]??0),h)if(null!=E){const e=Math.min(4*j,E.length-4);h.setValues(t,E[e],E[e+1],E[e+2],E[e+3])}else h.setValues(t,1,1,1,1);_&&_.set(t,1===w?.length?w[0]:w?.[j]??0)}if(null!=b&&null!=x){Q(4===x.size);const e=x.data;for(let t=0;t<s;++t){const i=4*t,r=o+t+1;b.set(r,0,e[i]),b.set(r,1,e[i+1]),b.set(r,2,e[i+2]),b.set(r,3,e[i+3])}}if(n){const e=o,t=o+1,i=o+2,r=o+s,n=r+1,p=r+2;a.copyItem(r,e),a.copyItem(t,n),a.copyItem(i,p),l.getVec(r,Re),l.getVec(t,Be);const u=v?.[s]??T+g(Re,Be);c.set(n,u)}else{const e=o,t=o+1,i=o+s,r=i+1;a.copyItem(t,e),a.copyItem(i,r)}const z=t.get("olidColor");W()&&null!=z&&null!=d&&ee(z,4,d,o)}_writeVertexBuffer(e,t,i,r){const{buffer:s,offset:n}=i,{layout:a}=this,o=t.get("position"),l=o.indices,c=o.data.length/3,p=this._isClosed(t),u=c+(p?3:2);l&&l.length!==2*(c-1)&&console.warn("RibbonLineMaterial does not support indices");const m=s.getField("textureElementIndex",R);Q(null!=m,"Missing texture buffer index field"),Q(null!=r,"Using a texture layout, but the texture range for this instance was not provided");const h=r.from;Q(r.numElements===u,"Expected number of elements in TextureBuffer to equal number of points");const f=new Float32Array(s.buffer),d=new Float16Array(s.buffer),g=new Uint32Array(s.buffer),b=a.stride/4;let _=n*b;const S=_,P=f.BYTES_PER_ELEMENT/d.BYTES_PER_ELEMENT,y=(e,t,i)=>{const r=i+1;g[_]=h+r,_++;let s=_*P;d[s++]=e,d[s++]=t,_=Math.ceil(s/P)};_+=b;let E=0,w=0;p?(E=0,w=c):(y(1,-4,0),y(1,4,0),E=1,w=c-1);for(let v=E;v<w;v++){y(0,-1,v),y(0,1,v);const e=this.numJoinSubdivisions;for(let t=0;t<e;++t){const i=(t+1)/(e+1);y(i,-1,v),y(i,1,v)}y(1,-2,v),y(1,2,v)}p?(y(0,-1,w),y(0,1,w)):(y(0,-5,w),y(0,5,w)),ue(f,S+b,f,S,b);_=ue(f,_-b,f,_,b),this._parameters.wireframe&&this._addWireframeVertices(s,S,_,b)}_getTransformedPosition(e,t,i,r){const s=3*i;c(e,t[s+0],t[s+1],t[s+2]),r&&_(e,e,r)}_addWireframeVertices(e,t,i,r){const s=new Uint8Array(e.buffer,i*Float32Array.BYTES_PER_ELEMENT),n=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(i-t)*Float32Array.BYTES_PER_ELEMENT),a=r*Float32Array.BYTES_PER_ELEMENT;let o=0;const l=e=>o=ue(n,e,s,o,a);for(let c=0;c<=n.length-4*a;c+=2*a)l(c),l(c+2*a),l(c+1*a),l(c+2*a),l(c+1*a),l(c+3*a)}}function ue(e,t,i,r,s){for(let n=0;n<s;n++)i[r++]=e[t++];return r}function me(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function he(e,t,i){return i?e/2+Ye*t:(e/2+Ye)*t}function*fe(e,t,i,r,s){const n=r.get("position").data,l=me(i,r)?n.length-2:n.length-5,c=s?.[0]??0,p=s?.[1]??0;o(e,n[0]+c,n[1]+p);for(let u=3;u<l+3;u+=3){const i=u%n.length;o(t,n[i]+c,n[i+1]+p),yield u/3,a(e,t)}}function de(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function ge(e,t){const i=t?1:0;switch(e){case"miter":case"bevel":return i;case"round":return te+i}}const be=new H,_e=P(),Se=P(),Pe=l(),ye=l(),Ee=P(),we=P(),ve=P(),xe=P(),Te=P(),ze=P(),je=i(),Le=i(),Ae=r(),Ce=r(),Me=P(),Ve=P(),Oe=z(),Fe=z(),Re=P(),Be=P(),Ie=[i(),i(),i(),i()],Ue=[P(),P(),P(),P()],Ne=C(),ke=C(),We=C(),De=C(),Ye=4,Je=[P(),P()];export{ce as Parameters,oe as RibbonLineMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/LineStipple.glsl.js";import"../core/shaderLibrary/shading/MarkerSizing.glsl.js";import"../core/shaderLibrary/shading/NormalUtils.glsl.js";import"../core/shaderLibrary/shading/PiUtils.glsl.js";import"../core/shaderLibrary/shading/PositionOutsideClipSpace.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/NoPerspective.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float2BindUniform.js";import"../core/shaderModules/Float4BindUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatBindUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Matrix4BindUniform.js";import"./alphaCutoff.glsl.js";import"./AnimatedLine.glsl.js";import"./OutputColorHighlightOLID.glsl.js";import"./RibbonLineTextureBuffer.glsl.js";import"../../../webgl/ShaderBuilder.js";export{b as build,n as numRoundJoinSubdivisions}from"../../../../chunks/RibbonLine.glsl.js";
2
+ import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/LineStipple.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/MarkerSizing.glsl.js";import"../core/shaderLibrary/shading/NormalUtils.glsl.js";import"../core/shaderLibrary/shading/PiUtils.glsl.js";import"../core/shaderLibrary/shading/PositionOutsideClipSpace.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/NoPerspective.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float2BindUniform.js";import"../core/shaderModules/Float4BindUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatBindUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Matrix4BindUniform.js";import"./alphaCutoff.glsl.js";import"./AnimatedLine.glsl.js";import"./OutputColorHighlightOLID.glsl.js";import"./RibbonLineTextureBuffer.glsl.js";import"../../../webgl/ShaderBuilder.js";export{b as build,n as numRoundJoinSubdivisions}from"../../../../chunks/RibbonLine.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as e}from"../materials/TriangleTechniqueConfiguration.js";const i=16,s=8;class r extends e{constructor(o){super(),this.spherical=o,this.capType=0,this.emissionSource=0,this.animation=2,this.polygonOffsetIndex=0,this.numJoinSubdivisions=1,this.writeDepth=!1,this.shadingEnabled=!1,this.draped=!1,this.stippleEnabled=!1,this.stippleOffColorEnabled=!1,this.stipplePreferContinuous=!0,this.roundJoins=!1,this.applyMarkerOffset=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.falloffEnabled=!1,this.innerColorEnabled=!1,this.hasOccludees=!1,this.occluder=!1,this.wireframe=!1,this.hasScreenSizePerspective=!1,this.worldSized=!1,this.imagePattern=!1,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.hasSliceTranslatedView=!0,this.overlayEnabled=!1,this.snowCover=!1,this.renderOccluded=!1,this.pbrMode=0,this.receiveAmbientOcclusion=!1,this.receiveGlobalIllumination=!1,this.useCustomDTRExponentForWater=!1,this.hasColorTexture=!1,this.useFillLights=!1}get hasAnimation(){return 0!==this.animation}}o([t({count:3})],r.prototype,"capType",void 0),o([t({count:8})],r.prototype,"emissionSource",void 0),o([t({count:4})],r.prototype,"animation",void 0),o([t({count:i})],r.prototype,"polygonOffsetIndex",void 0),o([t({count:s})],r.prototype,"numJoinSubdivisions",void 0),o([t()],r.prototype,"writeDepth",void 0),o([t()],r.prototype,"shadingEnabled",void 0),o([t()],r.prototype,"draped",void 0),o([t()],r.prototype,"stippleEnabled",void 0),o([t()],r.prototype,"stippleOffColorEnabled",void 0),o([t()],r.prototype,"stipplePreferContinuous",void 0),o([t()],r.prototype,"roundJoins",void 0),o([t()],r.prototype,"applyMarkerOffset",void 0),o([t()],r.prototype,"hasVVSize",void 0),o([t()],r.prototype,"hasVVColor",void 0),o([t()],r.prototype,"hasVVOpacity",void 0),o([t()],r.prototype,"falloffEnabled",void 0),o([t()],r.prototype,"innerColorEnabled",void 0),o([t()],r.prototype,"hasOccludees",void 0),o([t()],r.prototype,"occluder",void 0),o([t()],r.prototype,"wireframe",void 0),o([t()],r.prototype,"hasScreenSizePerspective",void 0),o([t()],r.prototype,"worldSized",void 0),o([t()],r.prototype,"imagePattern",void 0);export{s as NUM_JOIN_SUBDIVISION_COUNT,i as POLYGON_OFFSET_INDEX_COUNT,r as RibbonLineTechniqueConfiguration};
2
+ import{__decorate as o}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as e}from"../materials/TriangleTechniqueConfiguration.js";const i=16,r=8;class s extends e{constructor(o){super(),this.spherical=o,this.capType=0,this.pbrMode=0,this.emissionSource=0,this.animation=2,this.polygonOffsetIndex=0,this.numJoinSubdivisions=1,this.writeDepth=!1,this.shadingEnabled=!1,this.draped=!1,this.stippleEnabled=!1,this.stippleOffColorEnabled=!1,this.stipplePreferContinuous=!0,this.roundJoins=!1,this.applyMarkerOffset=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.falloffEnabled=!1,this.innerColorEnabled=!1,this.hasOccludees=!1,this.occluder=!1,this.wireframe=!1,this.hasScreenSizePerspective=!1,this.worldSized=!1,this.imagePattern=!1,this.receiveAmbientOcclusion=!0,this.receiveGlobalIllumination=!0,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.hasSliceTranslatedView=!0,this.overlayEnabled=!1,this.snowCover=!1,this.renderOccluded=!1,this.useCustomDTRExponentForWater=!1,this.hasColorTexture=!1,this.useFillLights=!1}get hasAnimation(){return 0!==this.animation}}o([t({count:3})],s.prototype,"capType",void 0),o([t({count:8})],s.prototype,"pbrMode",void 0),o([t({count:8})],s.prototype,"emissionSource",void 0),o([t({count:4})],s.prototype,"animation",void 0),o([t({count:i})],s.prototype,"polygonOffsetIndex",void 0),o([t({count:r})],s.prototype,"numJoinSubdivisions",void 0),o([t()],s.prototype,"writeDepth",void 0),o([t()],s.prototype,"shadingEnabled",void 0),o([t()],s.prototype,"draped",void 0),o([t()],s.prototype,"stippleEnabled",void 0),o([t()],s.prototype,"stippleOffColorEnabled",void 0),o([t()],s.prototype,"stipplePreferContinuous",void 0),o([t()],s.prototype,"roundJoins",void 0),o([t()],s.prototype,"applyMarkerOffset",void 0),o([t()],s.prototype,"hasVVSize",void 0),o([t()],s.prototype,"hasVVColor",void 0),o([t()],s.prototype,"hasVVOpacity",void 0),o([t()],s.prototype,"falloffEnabled",void 0),o([t()],s.prototype,"innerColorEnabled",void 0),o([t()],s.prototype,"hasOccludees",void 0),o([t()],s.prototype,"occluder",void 0),o([t()],s.prototype,"wireframe",void 0),o([t()],s.prototype,"hasScreenSizePerspective",void 0),o([t()],s.prototype,"worldSized",void 0),o([t()],s.prototype,"imagePattern",void 0),o([t()],s.prototype,"receiveAmbientOcclusion",void 0),o([t()],s.prototype,"receiveGlobalIllumination",void 0);export{r as NUM_JOIN_SUBDIVISION_COUNT,i as POLYGON_OFFSET_INDEX_COUNT,s as RibbonLineTechniqueConfiguration};
@@ -1,4 +1,5 @@
1
1
  import type Graphic from "../Graphic.js";
2
+ import type GraphicOrigin from "../graphic/GraphicOrigin.js";
2
3
  import type Popup from "../widgets/Popup.js";
3
4
  import type { AbortOptions } from "../core/promiseUtils.js";
4
5
  import type { ScreenPoint, ScreenRect } from "../core/types.js";
@@ -252,12 +253,73 @@ export type ViewPopupOpenOptions = Pick<PopupOpenOptions, "actions" | "content"
252
253
  * @since 5.1
253
254
  */
254
255
  export interface FetchPopupFeaturesOptions extends AbortOptions {
256
+ /**
257
+ * Collects diagnostics about the execution of [fetchPopupFeatures()](https://developers.arcgis.com/javascript/latest/references/core/views/PopupView/#fetchPopupFeatures).
258
+ * See [FetchPopupFeaturesDiagnostics](https://developers.arcgis.com/javascript/latest/references/core/views/PopupView/#FetchPopupFeaturesDiagnostics) for details.
259
+ *
260
+ * @since 5.2
261
+ * @example
262
+ * Check whether all matching popup features were returned.
263
+ * ```ts
264
+ * const diagnostics: FetchPopupFeaturesDiagnostics = {};
265
+ *
266
+ * const features = await Array.fromAsync(
267
+ * view.fetchPopupFeatures(event.screenPoint, { diagnostics })
268
+ * );
269
+ *
270
+ * if (diagnostics.layerLimitExceeded?.size) {
271
+ * console.warn(
272
+ * "Some matching popup features were omitted.",
273
+ * Array.from(diagnostics.layerLimitExceeded, (origin) => getGraphicOriginTitle(origin)),
274
+ * );
275
+ * }
276
+ * ```
277
+ */
278
+ diagnostics?: FetchPopupFeaturesDiagnostics;
255
279
  /**
256
280
  * The type of pointer coming from the input event.
257
- * It influences the tolerence when querying for features on services.
258
- * A `touch` pointer uses a larger tolerence than `mouse` or `pen`.
281
+ * It influences the tolerance when querying for features on services.
282
+ * A `touch` pointer uses a larger tolerance than `mouse` or `pen`.
259
283
  */
260
284
  pointerType?: PointerType;
261
285
  /** A default popup template is automatically used if no `popupTemplate` is defined for a feature's origin */
262
286
  defaultPopupTemplateEnabled?: boolean;
287
+ }
288
+
289
+ /**
290
+ * Diagnostics collected while fetching popup features.
291
+ *
292
+ * [fetchPopupFeatures()](https://developers.arcgis.com/javascript/latest/references/core/views/PopupView/#fetchPopupFeatures) updates this caller-provided object as its async generator is consumed.
293
+ *
294
+ * @see [FetchPopupFeaturesOptions](https://developers.arcgis.com/javascript/latest/references/core/views/PopupView/#FetchPopupFeaturesOptions)
295
+ * @since 5.2
296
+ */
297
+ export interface FetchPopupFeaturesDiagnostics {
298
+ /**
299
+ * Graphic origins whose layers could not process all matching features because their number exceeded the maximum the
300
+ * layer could process. For each origin, features up to that maximum can be returned, but features beyond it are not
301
+ * returned. The set is created the first time this maximum is exceeded.
302
+ *
303
+ * Applications can use this information to tell users that results were omitted, log the condition, or ask users
304
+ * to narrow the search area.
305
+ *
306
+ * @since 5.2
307
+ * @example
308
+ * Check whether all matching popup features were returned.
309
+ * ```ts
310
+ * const diagnostics: FetchPopupFeaturesDiagnostics = {};
311
+ *
312
+ * const features = await Array.fromAsync(
313
+ * view.fetchPopupFeatures(event.screenPoint, { diagnostics })
314
+ * );
315
+ *
316
+ * if (diagnostics.layerLimitExceeded?.size) {
317
+ * console.warn(
318
+ * "Some matching popup features were omitted.",
319
+ * Array.from(diagnostics.layerLimitExceeded, (origin) => getGraphicOriginTitle(origin)),
320
+ * );
321
+ * }
322
+ * ```
323
+ */
324
+ layerLimitExceeded?: Set<GraphicOrigin>;
263
325
  }
package/views/View2D.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{isScreenPoint as p,screenRectToPolygon as h,createScreenPoint as g}from"../core/screenUtils.js";import{property as d,cast as u,subclass as c}from"../core/accessorSupport/decorators.js";import{ensureClass as m}from"../core/accessorSupport/ensureType.js";import{initialize as y}from"../core/workers/workers.js";import f from"../geometry/Point.js";import w from"../geometry/Polygon.js";import{isLoadedOrLoadFor as V}from"../geometry/projectionUtils.js";import v from"../layers/support/TileInfo.js";import{BreakpointsOwner as M}from"./BreakpointsOwner.js";import{DOMContainer as _}from"./DOMContainer.js";import{PopupView as b}from"./PopupView.js";import S from"./View.js";import{Viewport2DBaseMixin as R}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as j}from"./Viewport2DMixin.js";import T from"./2d/AnimationManager.js";import{layerView2DImporter as O}from"./2d/layerViewModuleImportUtils.js";import k from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as L}from"./2d/viewpointUtils.js";import{importAnalysisViewModule as C}from"./2d/analysis/analysisViewModuleImportUtils.js";import x from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as D}from"./2d/layers/support/util.js";import{hitTest as P,getHitTestLayerViews as z}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as A,takeScreenshot as E}from"./2d/support/screenshotUtils.js";import{Timeline as I}from"./2d/support/Timeline.js";import U from"./navigation/Navigation.js";import G from"./navigation/NavigationActionMap.js";import F from"./support/AnalysisViewManager.js";import q from"./ui/DefaultUI.js";import W from"./ui/2d/DefaultUI2D.js";import{RenderingContextOptions as N}from"./webgl/RenderingContextOptions.js";import{isWebMap as B}from"../webmap/utils.js";import H from"../webmap/background/ColorBackground.js";let Z,K,Q,J,X,Y;async function $(){const[,{GraphicsView2D:e,GraphicContainer:t,MapViewNavigation:i,MagnifierView2D:r,GridView2D:s,Stage:a}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);K=e,Q=t,J=i,X=r,Y=s,Z=a}let ee=class extends(j(R(M(b(_(S)))))){get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this._magnifierView=null,this._gridView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.navigation=new U({actionMap:new G({dragTertiary:"none"})}),this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.analysisViewManager=new F({importAnalysisViewModule:e=>C(e),view:this}),this.floors=new i,this.grid=null,this.map=null,this.timeline=new I,this.type="2d",this.view2dType=null,this.ui=new W,this.test={takeScreenshot:async e=>A(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},y()}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new x(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get defaultsFromMapSettings(){return{required:{extent:!1,heightModelInfo:!1,tileInfo:!0},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get scheduler(){return this.frameTask.scheduler}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return V(t.spatialReference,i)}get analyses(){return super.analyses}set analyses(e){super.analyses=e}get background(){return B(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get constraints(){return super.constraints}set constraints(e){super.constraints=e}get extent(){return super.extent}set extent(e){super.extent=e}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resizeAlign(){return super.resizeAlign}set resizeAlign(e){super.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return super.rotation}set rotation(e){super.rotation=e}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get spatialReference(){return super.spatialReference}set spatialReference(e){super.spatialReference=e}get spatialReferenceLocked(){return this._get("spatialReferenceLocked")}set spatialReferenceLocked(e){this.stage&&a.getLogger(this).warn("spatialReferenceLocked cannot be changed after the view has become ready"),this._set("spatialReferenceLocked",e)}get tileInfo(){return this.featuresTilingScheme?.tileInfo}get updating(){if(this.destroying||this.destroyed)return!1;const{analysisViewManager:e,allLayerViews:t,frameTask:i,graphicsView:r,inputManager:s,layerViewManager:a,magnifier:n,map:o,ready:l,rendering:p,selectionManager:h,stationary:g,toolViewManager:d,updatingHandles:u,stage:c}=this,m=o?.basemap,y=o?.ground,f="loading"===m?.loadStatus||"loading"===y?.loadStatus||!!o?.allLayers?.some(e=>e.parent!==y&&!e.isFulfilled()),w=!c||c.updating,V=!u||u.updating,v=!e||e.updating,M=!d||d.updating,_=!s||s.updating,b=!r||r.updating,S=!i||i.updating,R=!a||a.updating,j=!h||h.updating,T=!(!n.visible||null===n.position||!this._magnifierView?.updatingHandles.updating),O=t.some(e=>e.updating&&!e.destroyed);return!l||!g||p||f||O||T||V||v||S||M||_||R||b||j||w}get viewpoint(){return super.viewpoint}set viewpoint(e){super.viewpoint=e}get visibleArea(){const e=this.stateManager.visibleArea;return e?new w({rings:[e.map(e=>[e[0],e[1]])],spatialReference:this.spatialReference}):e}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}async hitTest(e,t){return P(this,e,t)}async takeScreenshot(e){return E(this._getScreenshotView(e),e)}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}toScreen(e,t){return this.stateManager.toScreen(e,t)}async whenAnalysisView(e){if(null==e.parent)throw new s("view:no-analysisview-for-analysis","The analysis does not exist in view.analyses",{analysis:e});return this.analysisViewManager.whenAnalysisView(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}zoomIn(){return super.zoomIn()}zoomOut(){return super.zoomOut()}forceDOMReadyCycle(){this.forceReadyCycle()}getWebDocumentSpatialReference(){return this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties.spatialReference:null}getDefaultTimeZone(){return B(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return B(this.map)?this.map.initialViewProperties.timeExtent:null}getSurface(){return this.surface}hasLayerViewModule(e){return O.hasLayerViewModule(e)}importLayerView(e){return O.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=p(e)?this.toMap(e):h(this,e),i=p(e)?e:g(e.x+e.width/2,e.y+e.height/2),r=this.toMap(i),s=await this.hitTest(e),a=z(this,e),n=new globalThis.Map(a.map(e=>[e.layer.uid,e])),o=[];let l=0,d=0;for(;l<s.results.length||d<a.length;){const e=s.results.at(l);if(e&&"graphic"!==e.type){++l;continue}const i=n.get((e?.layer??e?.graphic.layer)?.uid);if((!e||i)&&d<a.length&&a.at(d)!==i){const e=a.at(d);"fetchPopupFeaturesAtTarget"in e&&o.push({geometry:t,layerView:e}),++d}else e&&(o.push({graphic:e.graphic,layerView:i}),++l)}return{hits:o,location:r}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}loadAsyncDependencies(){return $()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,g=l?.rotation??0,d=l?.scale||p&&L(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),u=o.center??h,c=o.rotation??g,m=o.scale??d;return u&&m?new t({targetGeometry:u,scale:m,rotation:c}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=this._createFeaturesTilingScheme(),i=new Z(this._getOrCreateRenderCanvas(),{contextOptions:new N(this.deactivatedWebGLExtensions,this.debugWebGLExtensions),featuresTilingScheme:t,renderingOptions:this.renderingOptions,timeline:this.timeline});this.stage=i,this._magnifierView=new X,this._magnifierView.magnifier=this.magnifier,this._gridView=new Y;const r=new T({view:this});this._set("animationManager",r);const s=new J({view:this,animationManager:r});this._set("mapViewNavigation",s),this._setupSpatialReferenceDependentProperties(t),this.addHandles([this.rootLayerViews.on("change",()=>this._updateStageChildren()),i.on("webgl-error",e=>this.fatalError=e.error),o(()=>this.stationary,e=>i.stationary=e,l),o(()=>this.background,e=>{i.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color},l),o(()=>this.magnifier,e=>this._magnifierView.magnifier=e,l),o(()=>this.grid,e=>this._gridView.grid=e,l),o(()=>this.renderingOptions,e=>i.renderingOptions=e,l),o(()=>this.highlights.items.map(e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})),()=>{i.highlightGradient=D(i.highlightGradient,this.highlights.items)},l),o(()=>this.state.id,()=>i.state=this.state,l),o(()=>this.animationsEnabled,e=>this.stage.animationsEnabled=e,l)],"map-view"),this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach(e=>e(this)),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this._magnifierView.destroy(),this._gridView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._gridView=null,this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach(e=>{this.stage.addChild(e.container)});const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView),this.stage.addChild(this._gridView)}_setupSpatialReferenceDependentProperties(e=this._createFeaturesTilingScheme()){this._set("featuresTilingScheme",e),this.stage.labelManager.featuresTilingScheme=e;const t=new K({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new Q(e,!0)});this._set("graphicsView",t)}_createFeaturesTilingScheme(){return new k(v.create({spatialReference:this.spatialReference,size:512,numLODs:36}))}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}static{this.type="2d"}};e([d()],ee.prototype,"_magnifierView",void 0),e([d()],ee.prototype,"_gridView",void 0),e([d({constructOnly:!0})],ee.prototype,"deactivatedWebGLExtensions",void 0),e([d({constructOnly:!0})],ee.prototype,"debugWebGLExtensions",void 0),e([d({readOnly:!0})],ee.prototype,"featuresTilingScheme",void 0),e([d({readOnly:!0})],ee.prototype,"graphicsTileStore",null),e([d()],ee.prototype,"graphicsView",void 0),e([d()],ee.prototype,"constraintsInfo",null),e([d()],ee.prototype,"initialExtentRequired",null),e([d({type:U,nonNullable:!0})],ee.prototype,"navigation",void 0),e([d()],ee.prototype,"renderingOptions",void 0),e([d({constructOnly:!0})],ee.prototype,"supersampleScreenshotsEnabled",void 0),e([d()],ee.prototype,"defaultsFromMapSettings",null),e([d({readOnly:!0})],ee.prototype,"typeSpecificPreconditionsReady",null),e([d()],ee.prototype,"analysisViewManager",void 0),e([d({type:H})],ee.prototype,"background",null),e([d({type:f})],ee.prototype,"center",null),e([d({type:i})],ee.prototype,"floors",void 0),e([d()],ee.prototype,"grid",void 0),e([d()],ee.prototype,"map",void 0),e([d()],ee.prototype,"padding",null),e([d({readOnly:!0})],ee.prototype,"rendering",null),e([d({readOnly:!0})],ee.prototype,"resolution",null),e([d()],ee.prototype,"scale",null),e([d({type:Boolean,value:!1})],ee.prototype,"spatialReferenceLocked",null),e([d({readOnly:!0})],ee.prototype,"tileInfo",null),e([d({type:I,readOnly:!0})],ee.prototype,"timeline",void 0),e([d({readOnly:!0})],ee.prototype,"type",void 0),e([d({type:Boolean,readOnly:!0})],ee.prototype,"updating",null),e([d({readOnly:!0})],ee.prototype,"view2dType",void 0),e([d({readOnly:!0})],ee.prototype,"visibleArea",null),e([d()],ee.prototype,"zoom",null),e([d({readOnly:!0})],ee.prototype,"navigating",null),e([d(),u(e=>e instanceof q?e:m(W,e))],ee.prototype,"ui",void 0),ee=e([c("esri.views.View2D")],ee);const te=ee;export{te as default};
2
+ import{__decorate as e}from"tslib";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{isScreenPoint as p,screenRectToPolygon as h,createScreenPoint as g}from"../core/screenUtils.js";import{property as d,cast as u,subclass as c}from"../core/accessorSupport/decorators.js";import{ensureClass as m}from"../core/accessorSupport/ensureType.js";import{initialize as y}from"../core/workers/workers.js";import f from"../geometry/Point.js";import w from"../geometry/Polygon.js";import{isLoadedOrLoadFor as V}from"../geometry/projectionUtils.js";import v from"../layers/support/TileInfo.js";import{BreakpointsOwner as M}from"./BreakpointsOwner.js";import{DOMContainer as _}from"./DOMContainer.js";import{PopupView as b}from"./PopupView.js";import S from"./View.js";import{Viewport2DBaseMixin as R}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as j}from"./Viewport2DMixin.js";import T from"./2d/AnimationManager.js";import{layerView2DImporter as L}from"./2d/layerViewModuleImportUtils.js";import O from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as k}from"./2d/viewpointUtils.js";import{importAnalysisViewModule as C}from"./2d/analysis/analysisViewModuleImportUtils.js";import x from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as D}from"./2d/layers/support/util.js";import{hitTest as P}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as z,takeScreenshot as A}from"./2d/support/screenshotUtils.js";import{Timeline as E}from"./2d/support/Timeline.js";import I from"./navigation/Navigation.js";import U from"./navigation/NavigationActionMap.js";import G from"./support/AnalysisViewManager.js";import F from"./ui/DefaultUI.js";import q from"./ui/2d/DefaultUI2D.js";import{RenderingContextOptions as W}from"./webgl/RenderingContextOptions.js";import{isWebMap as N}from"../webmap/utils.js";import B from"../webmap/background/ColorBackground.js";let H,Z,K,Q,J,X;async function Y(){const[,{GraphicsView2D:e,GraphicContainer:t,MapViewNavigation:i,MagnifierView2D:r,GridView2D:s,Stage:a}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);Z=e,K=t,Q=i,J=r,X=s,H=a}let $=class extends(j(R(M(b(_(S)))))){get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this._magnifierView=null,this._gridView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.navigation=new I({actionMap:new U({dragTertiary:"none"})}),this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.analysisViewManager=new G({importAnalysisViewModule:e=>C(e),view:this}),this.floors=new i,this.grid=null,this.map=null,this.timeline=new E,this.type="2d",this.view2dType=null,this.ui=new q,this.test={takeScreenshot:async e=>z(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},y()}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new x(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get defaultsFromMapSettings(){return{required:{extent:!1,heightModelInfo:!1,tileInfo:!0},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get scheduler(){return this.frameTask.scheduler}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return V(t.spatialReference,i)}get analyses(){return super.analyses}set analyses(e){super.analyses=e}get background(){return N(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get constraints(){return super.constraints}set constraints(e){super.constraints=e}get extent(){return super.extent}set extent(e){super.extent=e}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resizeAlign(){return super.resizeAlign}set resizeAlign(e){super.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return super.rotation}set rotation(e){super.rotation=e}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get spatialReference(){return super.spatialReference}set spatialReference(e){super.spatialReference=e}get spatialReferenceLocked(){return this._get("spatialReferenceLocked")}set spatialReferenceLocked(e){this.stage&&a.getLogger(this).warn("spatialReferenceLocked cannot be changed after the view has become ready"),this._set("spatialReferenceLocked",e)}get tileInfo(){return this.featuresTilingScheme?.tileInfo}get updating(){if(this.destroying||this.destroyed)return!1;const{analysisViewManager:e,allLayerViews:t,frameTask:i,graphicsView:r,inputManager:s,layerViewManager:a,magnifier:n,map:o,ready:l,rendering:p,selectionManager:h,stationary:g,toolViewManager:d,updatingHandles:u,stage:c}=this,m=o?.basemap,y=o?.ground,f="loading"===m?.loadStatus||"loading"===y?.loadStatus||!!o?.allLayers?.some(e=>e.parent!==y&&!e.isFulfilled()),w=!c||c.updating,V=!u||u.updating,v=!e||e.updating,M=!d||d.updating,_=!s||s.updating,b=!r||r.updating,S=!i||i.updating,R=!a||a.updating,j=!h||h.updating,T=!(!n.visible||null===n.position||!this._magnifierView?.updatingHandles.updating),L=t.some(e=>e.updating&&!e.destroyed);return!l||!g||p||f||L||T||V||v||S||M||_||R||b||j||w}get viewpoint(){return super.viewpoint}set viewpoint(e){super.viewpoint=e}get visibleArea(){const e=this.stateManager.visibleArea;return e?new w({rings:[e.map(e=>[e[0],e[1]])],spatialReference:this.spatialReference}):e}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}async hitTest(e,t){return P(this,e,t)}async takeScreenshot(e){return A(this._getScreenshotView(e),e)}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}toScreen(e,t){return this.stateManager.toScreen(e,t)}async whenAnalysisView(e){if(null==e.parent)throw new s("view:no-analysisview-for-analysis","The analysis does not exist in view.analyses",{analysis:e});return this.analysisViewManager.whenAnalysisView(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}zoomIn(){return super.zoomIn()}zoomOut(){return super.zoomOut()}forceDOMReadyCycle(){this.forceReadyCycle()}getWebDocumentSpatialReference(){return this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties.spatialReference:null}getDefaultTimeZone(){return N(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return N(this.map)?this.map.initialViewProperties.timeExtent:null}getSurface(){return this.surface}hasLayerViewModule(e){return L.hasLayerViewModule(e)}importLayerView(e){return L.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=p(e)?this.toMap(e):h(this,e),i=p(e)?e:g(e.x+e.width/2,e.y+e.height/2),r=this.toMap(i),s=await this.hitTest(e),a=new Set(this.allLayerViews),n=this.allLayerViews.filter(e=>!e.suspended&&a.has(e)).reverse(),o=new globalThis.Map(n.map(e=>[e.layer.uid,e])),l=[];let d=0,u=0;for(;d<s.results.length||u<n.length;){const e=s.results.at(d);if(e&&"graphic"!==e.type){++d;continue}const i=o.get((e?.layer??e?.graphic.layer)?.uid);if((!e||i)&&u<n.length&&n.at(u)!==i){const e=n.at(u);"fetchPopupFeaturesAtTarget"in e&&l.push({geometry:t,layerView:e}),++u}else e&&(l.push({graphic:e.graphic,layerView:i}),++d)}return{hits:l,location:r}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}loadAsyncDependencies(){return Y()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,g=l?.rotation??0,d=l?.scale||p&&k(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),u=o.center??h,c=o.rotation??g,m=o.scale??d;return u&&m?new t({targetGeometry:u,scale:m,rotation:c}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=this._createFeaturesTilingScheme(),i=new H(this._getOrCreateRenderCanvas(),{contextOptions:new W(this.deactivatedWebGLExtensions,this.debugWebGLExtensions),featuresTilingScheme:t,renderingOptions:this.renderingOptions,timeline:this.timeline});this.stage=i,this._magnifierView=new J,this._magnifierView.magnifier=this.magnifier,this._gridView=new X;const r=new T({view:this});this._set("animationManager",r);const s=new Q({view:this,animationManager:r});this._set("mapViewNavigation",s),this._setupSpatialReferenceDependentProperties(t),this.addHandles([this.rootLayerViews.on("change",()=>this._updateStageChildren()),i.on("webgl-error",e=>this.fatalError=e.error),o(()=>this.stationary,e=>i.stationary=e,l),o(()=>this.background,e=>{i.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color},l),o(()=>this.magnifier,e=>this._magnifierView.magnifier=e,l),o(()=>this.grid,e=>this._gridView.grid=e,l),o(()=>this.renderingOptions,e=>i.renderingOptions=e,l),o(()=>this.highlights.items.map(e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})),()=>{i.highlightGradient=D(i.highlightGradient,this.highlights.items)},l),o(()=>this.state.id,()=>i.state=this.state,l),o(()=>this.animationsEnabled,e=>this.stage.animationsEnabled=e,l)],"map-view"),this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach(e=>e(this)),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this._magnifierView.destroy(),this._gridView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._gridView=null,this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach(e=>{this.stage.addChild(e.container)});const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView),this.stage.addChild(this._gridView)}_setupSpatialReferenceDependentProperties(e=this._createFeaturesTilingScheme()){this._set("featuresTilingScheme",e),this.stage.labelManager.featuresTilingScheme=e;const t=new Z({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new K(e,!0)});this._set("graphicsView",t)}_createFeaturesTilingScheme(){return new O(v.create({spatialReference:this.spatialReference,size:512,numLODs:36}))}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}static{this.type="2d"}};e([d()],$.prototype,"_magnifierView",void 0),e([d()],$.prototype,"_gridView",void 0),e([d({constructOnly:!0})],$.prototype,"deactivatedWebGLExtensions",void 0),e([d({constructOnly:!0})],$.prototype,"debugWebGLExtensions",void 0),e([d({readOnly:!0})],$.prototype,"featuresTilingScheme",void 0),e([d({readOnly:!0})],$.prototype,"graphicsTileStore",null),e([d()],$.prototype,"graphicsView",void 0),e([d()],$.prototype,"constraintsInfo",null),e([d()],$.prototype,"initialExtentRequired",null),e([d({type:I,nonNullable:!0})],$.prototype,"navigation",void 0),e([d()],$.prototype,"renderingOptions",void 0),e([d({constructOnly:!0})],$.prototype,"supersampleScreenshotsEnabled",void 0),e([d()],$.prototype,"defaultsFromMapSettings",null),e([d({readOnly:!0})],$.prototype,"typeSpecificPreconditionsReady",null),e([d()],$.prototype,"analysisViewManager",void 0),e([d({type:B})],$.prototype,"background",null),e([d({type:f})],$.prototype,"center",null),e([d({type:i})],$.prototype,"floors",void 0),e([d()],$.prototype,"grid",void 0),e([d()],$.prototype,"map",void 0),e([d()],$.prototype,"padding",null),e([d({readOnly:!0})],$.prototype,"rendering",null),e([d({readOnly:!0})],$.prototype,"resolution",null),e([d()],$.prototype,"scale",null),e([d({type:Boolean,value:!1})],$.prototype,"spatialReferenceLocked",null),e([d({readOnly:!0})],$.prototype,"tileInfo",null),e([d({type:E,readOnly:!0})],$.prototype,"timeline",void 0),e([d({readOnly:!0})],$.prototype,"type",void 0),e([d({type:Boolean,readOnly:!0})],$.prototype,"updating",null),e([d({readOnly:!0})],$.prototype,"view2dType",void 0),e([d({readOnly:!0})],$.prototype,"visibleArea",null),e([d()],$.prototype,"zoom",null),e([d({readOnly:!0})],$.prototype,"navigating",null),e([d(),u(e=>e instanceof F?e:m(q,e))],$.prototype,"ui",void 0),$=e([c("esri.views.View2D")],$);const ee=$;export{ee as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../core/has.js";import t from"../../core/Logger.js";import{getOrCreateMapValue as i}from"../../core/MapUtils.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{watch as s,syncAndInitial as l,on as n,whenOnce as a}from"../../core/reactiveUtils.js";import{sqlOr as o,sqlIn as u,sqlAnd as d}from"../../core/sql.js";import{property as p,subclass as f}from"../../core/accessorSupport/decorators.js";import{getPopupProvider as h}from"../../graphic/getPopupProvider.js";import{getFeatureIdInfoFieldNames as y}from"../../layers/graphics/data/FeatureIdInfo.js";import{systemIsSpatialFieldName as c}from"../../layers/knowledgeGraph/constants.js";import{getEffectiveDisplayFilter as m}from"../../layers/support/displayFilterUtils.js";import F from"../../layers/support/FeatureEffect.js";import g from"../../layers/support/FeatureFilter.js";import{getSignedInUser as I,layerRequiresGeometryZM as b}from"../../layers/support/featureLayerUtils.js";import{fetchFeaturePopupFeatures as v,loadFeaturePopupArcadeModules as w}from"../../layers/support/featurePopupQueryUtils.js";import{fixFields as x,unpackFieldNames as E,collectLabelingFields as R,collectElevationFields as _,collectFilterFields as q,collectFeatureReductionFields as j,collectOrderByInfos as O,collectFields as C,collectTrackInfoFields as k,collectDisplayFilterFields as Z,collectField as M,featureHasFields as U}from"../../layers/support/fieldUtils.js";import{getFloorFilterClause as P}from"../../layers/support/floorFilterUtils.js";import{collectRelativeTimeFields as T}from"../../layers/support/relativeTimeQueryUtils.js";import{getUtilityNetworkFields as L}from"../../networks/support/networkFieldUtils.js";import S from"../../rest/support/Query.js";import{createFeatureIdInfo as D}from"../2d/layers/features/layerAdapters/featureServiceUtils.js";import H from"./LayerView.js";import{getFetchPopupTemplate as N,getRequiredFields as Q}from"./support/popupUtils.js";import{WhereClauseVisitor as G}from"./support/WhereClauseVisitor.js";let V=class extends H{constructor(){super(...arguments),this._updatingRequiredPromise=null,this._defaultReturnZ=!1,this.hasZ=!1,this.hasM=!1,this.filter=null,this.layer=null,this.requiresCurrentUser=!1,this.requiredFields=[],this.view=null}initialize(){this.addHandles([s(()=>{const e=this.layer,t=this.view;return[e&&"elevationInfo"in e?e.elevationInfo?.featureExpressionInfo:null,e&&"displayField"in e?e.displayField:null,e&&"timeInfo"in e&&e.timeInfo,e&&"renderer"in e&&e.renderer,e&&"returnZ"in e&&e.returnZ,e&&"returnM"in e&&e.returnM,e&&"capabilities"in e&&e.capabilities,e&&"labelingInfo"in e&&e.labelingInfo,e&&"floorInfo"in e&&e.floorInfo,t?.requiredFieldsOptions?.featureTitleFields&&e&&"featureTitleFields"in e&&e.featureTitleFields,t?.requiredFieldsOptions?.utilityNetworkFields&&L(t,e),e&&"displayFilterInfo"in e&&e.displayFilterInfo,this.displayFilterEnabled,this.filter,this.featureEffect,this.timeExtent,this._getHighlightFilterGroups(),"knowledge-graph-sublayer"===e?.type&&"link-chart"===e.parentCompositeLayer?.type&&e.parentCompositeLayer.linkChart?.linkChartProperties.nonspatialDataDisplay?.mode]},()=>this._handleChange(),l),n(()=>this.view?.floors,"change",()=>this._handleChange()),n(()=>(this.layer&&"displayFilterInfo"in this.layer?this.layer.displayFilterInfo:null)?.filters,"change",()=>this._handleChange()),n(()=>this.layer&&"sublayers"in this.layer?this.layer.sublayers:null,"change",()=>this._handleChange())])}get availableFields(){if(!this.layer)return[];const{layer:e,layer:{fieldsIndex:t},requiredFields:i}=this;return"outFields"in e&&e.outFields?x(t,[...E(t,e.outFields),...i]):x(t,i)}get displayFilterEnabled(){return(this.view?.displayFilterEnabled??!0)&&(!("displayFilterEnabled"in this.layer)||(this.layer?.displayFilterEnabled??!0))}get effectiveDisplayFilter(){const e=this.layer;return"displayFilterInfo"in e&&this.displayFilterEnabled&&e.displayFilterInfo?m(e.displayFilterInfo,this.view):null}get effectiveDisplayFilterClause(){const e=this.effectiveDisplayFilter?.where??null;return e&&this.hasHighlight?o(e,u(this.layer.objectIdField,this.highlightIds)):e}get featureEffect(){return this.layer&&"featureEffect"in this.layer?this.layer.featureEffect:null}set featureEffect(e){this._override("featureEffect",e)}get highlightOptions(){}set highlightOptions(e){}get maximumNumberOfFeatures(){return 0}set maximumNumberOfFeatures(e){t.getLogger(this).error("#maximumNumberOfFeatures=","Setting maximum number of features is not supported")}get maximumNumberOfFeaturesExceeded(){return!1}get signedInUser(){return this.layer?.url?I(this.layer.url):Promise.resolve(null)}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference},t=null!=this.filter?this.filter.createQuery(e):new S(e);if("floorInfo"in this.layer&&this.layer.floorInfo&&(t.where=d(t.where,P(this))),this.displayFilterEnabled&&(t.where=d(t.where,this.effectiveDisplayFilter?.where)),null!=this.timeExtent&&(t.timeExtent=null!=t.timeExtent?t.timeExtent.intersection(this.timeExtent):this.timeExtent.clone()),"capabilities"in this.layer){const e=this.layer.capabilities?.data;"returnZ"in this.layer&&e?.supportsZ&&null!=this.layer.returnZ&&(t.returnZ=this.layer.returnZ),"returnM"in this.layer&&e?.supportsM&&null!=this.layer.returnM&&(t.returnM=this.layer.returnM)}return"unplacedAnnotationsVisible"in this.layer&&!this.layer.unplacedAnnotationsVisible&&(t.where=d(t.where,`${this.layer.statusField} = 0`)),t}createAggregateQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return new S(e)}async patchFeaturesForPopup(e,t){const r=[],s=new Set,l=new Map;for(const a of e){const e=i(l,a.origin,()=>{const e=h(a.origin);return N(e,{...t,checkPopupEnabled:!0})});e&&(r.push(a),s.add(e))}if(0===r.length||0===s.size)return[];const n=await this._createPopupQuery(s,t);return await v(this.layer,r,n,{hasRequiredFields:(e,t)=>this._popupFeatureHasRequiredFields(e,t),...t})}_handleChange(){const e=Promise.all([a(()=>!("reloading"in this.layer&&this.layer.reloading)),this._updateRequiredFields(),this._updateClientWhereClauseRequirements(),this._updateHasZM()]).then(()=>{});return this._updatingRequiredPromise=e,e.then(()=>{this._updatingRequiredPromise===e&&(this._updatingRequiredPromise=null)}),e}async _updateClientWhereClauseRequirements(){if(!this.layer||!this.view)return;const{layer:e}=this,i=new G(e.fieldsIndex);if(i.visitFilter(this.filter),"featureReduction"in e&&i.visitFeatureReduction(e.featureReduction),"labelingInfo"in e&&i.visitLabelingInfo(e.labelsVisible,e.labelingInfo),"trackInfo"in e&&i.visitTrackInfo(e.trackInfo),"2d"===this.view.type){i.visitFilter(this.featureEffect?.filter),"featureReduction"in e&&i.visitFeatureReduction(e.featureReduction),"displayFilterInfo"in e&&i.visitDisplayFilter(this.displayFilterEnabled,e.displayFilterInfo);for(const e of this._getHighlightFilterGroups())for(const t of e.filters)i.visitFilter(t)}if("subtype-group"===e.type)for(const t of e.sublayers)i.visitLabelingInfo(t.labelsVisible,t.labelingInfo);"definitionExpression"in e&&"capabilities"in e&&e.capabilities?.query.relativeTimeBinWindow&&i.visitRelativeTimeQuery(e.definitionExpression);try{const e=await i.finish();this._set("requiresCurrentUser",e.requiresCurrentUser)}catch(r){t.getLogger(this).error(r)}}async _updateRequiredFields(){if(!this.layer||!this.view)return;const e="3d"===this.view.type,{layer:i,layer:{fieldsIndex:r}}=this,s="renderer"in i&&i.renderer,l="orderBy"in i&&i.orderBy,n="featureReduction"in i?i.featureReduction:null,a=new Set,o=[s?s.collectRequiredFields(a,r):null,R(a,i),e&&"elevationInfo"in i?_(a,i):null,null!=this.filter?q(a,i,this.filter):null,e||null==this.featureEffect?null:q(a,i,this.featureEffect.filter),!e&&n?j(a,i,n):null,e&&"catalog-footprint"!==i.type||!l?null:O(a,i,l),"definitionExpression"in i&&"capabilities"in i&&i.capabilities?.query.relativeTimeBinWindow?T(a,i.fieldsIndex,i.definitionExpression):null];if(!e)for(const t of this._getHighlightFilterGroups())for(const e of t.filters)o.push(q(a,i,e));if("timeInfo"in i&&i.timeInfo&&this.timeExtent&&C(a,i.fieldsIndex,[i.timeInfo.startField,i.timeInfo.endField]),"timeInfo"in i&&i.timeInfo&&"trackInfo"in i&&i.trackInfo){const{trackInfo:e}=i;C(a,i.fieldsIndex,[i.timeInfo.trackIdField]),"feature"!==i.type&&"startTimeField"!==e.timeField||C(a,i.fieldsIndex,[i.timeInfo.startField]),"endTimeField"===e.timeField&&C(a,i.fieldsIndex,[i.timeInfo.endField]),await k(a,i)}if("floorInfo"in i&&i.floorInfo&&C(a,i.fieldsIndex,[i.floorInfo.floorField]),"featureTitleFields"in i&&this.view?.requiredFieldsOptions?.featureTitleFields&&i.featureTitleFields&&C(a,i.fieldsIndex,i.featureTitleFields),"feature"===i.type&&i.globalIdField&&this.view?.requiredFieldsOptions?.globalIdField&&C(a,i.fieldsIndex,[i.globalIdField]),"feature"!==i.type&&"subtype-group"!==i.type||!this.view?.requiredFieldsOptions?.utilityNetworkFields||C(a,i.fieldsIndex,L(this.view,i)),this.displayFilterEnabled&&"displayFilterInfo"in i&&o.push(Z(a,i,i.displayFilterInfo)),"feature"===i.type&&e&&null!=i.infoFor3D&&(null==i.globalIdField&&t.getLogger(this).error("globalIdField missing on 3DObjectFeatureLayer"),C(a,i.fieldsIndex,[i.globalIdField])),"subtype-group"===i.type){M(a,r,i.subtypeField);const e=i.sublayers.map(e=>Promise.all([e.renderer?.collectRequiredFields(a,r),R(a,e)]));o.push(Promise.all(e))}if("annotation-feature"===i.type&&C(a,r,[i.subtypeField,i.elementField,i.statusField]),"dimension-feature"===i.type&&C(a,r,i.symbolFields),"catalog-footprint"===i.type&&i.parent){const e=i.parent;C(a,r,[e.itemNameField,e.itemSourceField,e.itemTypeField,e.maxScaleField,e.minScaleField])}"knowledge-graph-sublayer"===i.type&&"link-chart"===i.parentCompositeLayer?.type&&M(a,r,c);const u=await Promise.allSettled(o);if(e)M(a,r,i.objectIdField);else for(const t of y(D(i)))M(a,r,t);e&&"displayField"in i&&i.displayField&&M(a,r,i.displayField);for(const p of u)"rejected"===p.status&&t.getLogger(this).error(p.reason);const d=Array.from(a).sort();this._set("requiredFields",d)}async _updateHasZM(){const{layer:e}=this;if(!e||!this.view)return;let t=!1,i=!1;if("capabilities"in e&&e.capabilities){const{data:r}=e.capabilities;t=r.supportsZ,i=r.supportsM}this._set("hasZ",t),this._set("hasM",i);const{returnZ:r,returnM:s}=await b(e);t&&=r??this._defaultReturnZ,i&&=s??!1,this.hasZ!==t&&this._set("hasZ",t),this.hasM!==i&&this._set("hasM",i)}_popupFeatureHasRequiredFields(e,t){return U(e,t)}async _createPopupQuery(e,t){const i=this.layer.createQuery(),s=new Set;let l="point"===this.layer.geometryType;for(const n of e){if(!l){const e=await w(n);r(t),l=(e&&e.arcadeUtils.hasGeometryOperations(n))??!1}const e=await Q(this.layer,n);r(t);for(const t of e)s.add(t)}return i.where="1=1",i.returnGeometry=l,i.returnZ=l,i.returnM=l,i.outFields=Array.from(s),i.outSpatialReference=this.view.spatialReference,"floorInfo"in this.layer&&this.layer.floorInfo&&(i.where=d(i.where,P(this))),i}canResume(){return!!super.canResume()&&(null==this.timeExtent||!this.timeExtent.isEmpty)}_getHighlightFilterGroups(){return[]}getTest(){}get test(){}};e([p()],V.prototype,"_updatingRequiredPromise",void 0),e([p()],V.prototype,"_defaultReturnZ",void 0),e([p({readOnly:!0})],V.prototype,"availableFields",null),e([p({readOnly:!0})],V.prototype,"hasZ",void 0),e([p({readOnly:!0})],V.prototype,"hasM",void 0),e([p({readOnly:!0})],V.prototype,"displayFilterEnabled",null),e([p({readOnly:!0})],V.prototype,"effectiveDisplayFilter",null),e([p({readOnly:!0})],V.prototype,"effectiveDisplayFilterClause",null),e([p({type:F})],V.prototype,"featureEffect",null),e([p({type:g})],V.prototype,"filter",void 0),e([p()],V.prototype,"layer",void 0),e([p({type:Number})],V.prototype,"maximumNumberOfFeatures",null),e([p({readOnly:!0,type:Boolean})],V.prototype,"maximumNumberOfFeaturesExceeded",null),e([p()],V.prototype,"requiresCurrentUser",void 0),e([p({readOnly:!0})],V.prototype,"requiredFields",void 0),e([p({readOnly:!0})],V.prototype,"signedInUser",null),e([p()],V.prototype,"view",void 0),V=e([f("esri.views.layers.FeatureLikeLayerView")],V);const A=V;export{A as default};
2
+ import{__decorate as e}from"tslib";import"../../core/has.js";import t from"../../core/Logger.js";import{getOrCreateMapValue as i}from"../../core/MapUtils.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{watch as s,syncAndInitial as l,on as n,whenOnce as a}from"../../core/reactiveUtils.js";import{sqlOr as o,sqlIn as u,sqlAnd as d}from"../../core/sql.js";import{property as p,subclass as f}from"../../core/accessorSupport/decorators.js";import{getPopupProvider as h}from"../../graphic/getPopupProvider.js";import{getFeatureIdInfoFieldNames as y}from"../../layers/graphics/data/FeatureIdInfo.js";import{systemIsSpatialFieldName as c}from"../../layers/knowledgeGraph/constants.js";import{getEffectiveDisplayFilter as m}from"../../layers/support/displayFilterUtils.js";import F from"../../layers/support/FeatureEffect.js";import g from"../../layers/support/FeatureFilter.js";import{getSignedInUser as I,layerRequiresGeometryZM as b}from"../../layers/support/featureLayerUtils.js";import{fetchFeaturePopupFeatures as v,loadFeaturePopupArcadeModules as w}from"../../layers/support/featurePopupQueryUtils.js";import{fixFields as x,unpackFieldNames as E,collectLabelingFields as R,collectElevationFields as _,collectFilterFields as q,collectFeatureReductionFields as j,collectOrderByInfos as O,collectFields as C,collectTrackInfoFields as k,collectDisplayFilterFields as Z,collectField as M,featureHasFields as U}from"../../layers/support/fieldUtils.js";import{getFloorFilterClause as L}from"../../layers/support/floorFilterUtils.js";import{collectRelativeTimeFields as P}from"../../layers/support/relativeTimeQueryUtils.js";import{getUtilityNetworkFields as T}from"../../networks/support/networkFieldUtils.js";import S from"../../rest/support/Query.js";import{createFeatureIdInfo as D}from"../2d/layers/features/layerAdapters/featureServiceUtils.js";import H from"./LayerView.js";import{getFetchPopupTemplate as N,getRequiredFields as Q}from"./support/popupUtils.js";import{WhereClauseVisitor as G}from"./support/WhereClauseVisitor.js";let V=class extends H{constructor(){super(...arguments),this._updatingRequiredPromise=null,this._defaultReturnZ=!1,this.hasZ=!1,this.hasM=!1,this.filter=null,this.layer=null,this.requiresCurrentUser=!1,this.requiredFields=[],this.view=null}initialize(){this.addHandles([s(()=>{const e=this.layer,t=this.view;return[e&&"elevationInfo"in e?e.elevationInfo?.featureExpressionInfo:null,e&&"displayField"in e?e.displayField:null,e&&"timeInfo"in e&&e.timeInfo,e&&"renderer"in e&&e.renderer,e&&"returnZ"in e&&e.returnZ,e&&"returnM"in e&&e.returnM,e&&"capabilities"in e&&e.capabilities,e&&"labelingInfo"in e&&e.labelingInfo,e&&"floorInfo"in e&&e.floorInfo,t?.requiredFieldsOptions?.featureTitleFields&&e&&"featureTitleFields"in e&&e.featureTitleFields,t?.requiredFieldsOptions?.utilityNetworkFields&&T(t,e),e&&"displayFilterInfo"in e&&e.displayFilterInfo,this.displayFilterEnabled,this.filter,this.featureEffect,this.timeExtent,this._getHighlightFilterGroups(),"knowledge-graph-sublayer"===e?.type&&"link-chart"===e.parentCompositeLayer?.type&&e.parentCompositeLayer.linkChart?.linkChartProperties.nonspatialDataDisplay?.mode]},()=>this._handleChange(),l),n(()=>this.view?.floors,"change",()=>this._handleChange()),n(()=>(this.layer&&"displayFilterInfo"in this.layer?this.layer.displayFilterInfo:null)?.filters,"change",()=>this._handleChange()),n(()=>this.layer&&"sublayers"in this.layer?this.layer.sublayers:null,"change",()=>this._handleChange())])}get availableFields(){if(!this.layer)return[];const{layer:e,layer:{fieldsIndex:t},requiredFields:i}=this;return"outFields"in e&&e.outFields?x(t,[...E(t,e.outFields),...i]):x(t,i)}get displayFilterEnabled(){return(this.view?.displayFilterEnabled??!0)&&(!("displayFilterEnabled"in this.layer)||(this.layer?.displayFilterEnabled??!0))}get effectiveDisplayFilter(){const e=this.layer;return"displayFilterInfo"in e&&this.displayFilterEnabled&&e.displayFilterInfo?m(e.displayFilterInfo,this.view):null}get effectiveDisplayFilterClause(){const e=this.effectiveDisplayFilter?.where??null;return e&&this.hasHighlight?o(e,u(this.layer.objectIdField,this.highlightIds)):e}get featureEffect(){return this.layer&&"featureEffect"in this.layer?this.layer.featureEffect:null}set featureEffect(e){this._override("featureEffect",e)}get highlightOptions(){}set highlightOptions(e){}get maximumNumberOfFeatures(){return 0}set maximumNumberOfFeatures(e){t.getLogger(this).error("#maximumNumberOfFeatures=","Setting maximum number of features is not supported")}get maximumNumberOfFeaturesExceeded(){return!1}get signedInUser(){return this.layer?.url?I(this.layer.url):Promise.resolve(null)}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference},t=null!=this.filter?this.filter.createQuery(e):new S(e);if("floorInfo"in this.layer&&this.layer.floorInfo&&(t.where=d(t.where,L(this))),this.displayFilterEnabled&&(t.where=d(t.where,this.effectiveDisplayFilter?.where)),null!=this.timeExtent&&(t.timeExtent=null!=t.timeExtent?t.timeExtent.intersection(this.timeExtent):this.timeExtent.clone()),"capabilities"in this.layer){const e=this.layer.capabilities?.data;"returnZ"in this.layer&&e?.supportsZ&&null!=this.layer.returnZ&&(t.returnZ=this.layer.returnZ),"returnM"in this.layer&&e?.supportsM&&null!=this.layer.returnM&&(t.returnM=this.layer.returnM)}return"unplacedAnnotationsVisible"in this.layer&&!this.layer.unplacedAnnotationsVisible&&(t.where=d(t.where,`${this.layer.statusField} = 0`)),t}createAggregateQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return new S(e)}async patchFeaturesForPopup(e,t){const r=[],s=new Set,l=new Map;for(const a of e){const e=i(l,a.origin,()=>{const e=h(a.origin);return N(e,{...t,checkPopupEnabled:!0})});e&&(r.push(a),s.add(e))}if(0===r.length||0===s.size)return[];const n=await this._createPopupQuery(s,t);return await v(this.layer,r,n,{hasRequiredFields:(e,t)=>this._popupFeatureHasRequiredFields(e,t),onExceededTransferLimit:e=>{const i=t?.diagnostics;if(i&&e.length){i.layerLimitExceeded??=new Set;for(const t of e)t.origin&&i.layerLimitExceeded.add(t.origin)}},...t})}_handleChange(){const e=Promise.all([a(()=>!("reloading"in this.layer&&this.layer.reloading)),this._updateRequiredFields(),this._updateClientWhereClauseRequirements(),this._updateHasZM()]).then(()=>{});return this._updatingRequiredPromise=e,e.then(()=>{this._updatingRequiredPromise===e&&(this._updatingRequiredPromise=null)}),e}async _updateClientWhereClauseRequirements(){if(!this.layer||!this.view)return;const{layer:e}=this,i=new G(e.fieldsIndex);if(i.visitFilter(this.filter),"featureReduction"in e&&i.visitFeatureReduction(e.featureReduction),"labelingInfo"in e&&i.visitLabelingInfo(e.labelsVisible,e.labelingInfo),"trackInfo"in e&&i.visitTrackInfo(e.trackInfo),"2d"===this.view.type){i.visitFilter(this.featureEffect?.filter),"featureReduction"in e&&i.visitFeatureReduction(e.featureReduction),"displayFilterInfo"in e&&i.visitDisplayFilter(this.displayFilterEnabled,e.displayFilterInfo);for(const e of this._getHighlightFilterGroups())for(const t of e.filters)i.visitFilter(t)}if("subtype-group"===e.type)for(const t of e.sublayers)i.visitLabelingInfo(t.labelsVisible,t.labelingInfo);"definitionExpression"in e&&"capabilities"in e&&e.capabilities?.query.relativeTimeBinWindow&&i.visitRelativeTimeQuery(e.definitionExpression);try{const e=await i.finish();this._set("requiresCurrentUser",e.requiresCurrentUser)}catch(r){t.getLogger(this).error(r)}}async _updateRequiredFields(){if(!this.layer||!this.view)return;const e="3d"===this.view.type,{layer:i,layer:{fieldsIndex:r}}=this,s="renderer"in i&&i.renderer,l="orderBy"in i&&i.orderBy,n="featureReduction"in i?i.featureReduction:null,a=new Set,o=[s?s.collectRequiredFields(a,r):null,R(a,i),e&&"elevationInfo"in i?_(a,i):null,null!=this.filter?q(a,i,this.filter):null,e||null==this.featureEffect?null:q(a,i,this.featureEffect.filter),!e&&n?j(a,i,n):null,e&&"catalog-footprint"!==i.type||!l?null:O(a,i,l),"definitionExpression"in i&&"capabilities"in i&&i.capabilities?.query.relativeTimeBinWindow?P(a,i.fieldsIndex,i.definitionExpression):null];if(!e)for(const t of this._getHighlightFilterGroups())for(const e of t.filters)o.push(q(a,i,e));if("timeInfo"in i&&i.timeInfo&&this.timeExtent&&C(a,i.fieldsIndex,[i.timeInfo.startField,i.timeInfo.endField]),"timeInfo"in i&&i.timeInfo&&"trackInfo"in i&&i.trackInfo){const{trackInfo:e}=i;C(a,i.fieldsIndex,[i.timeInfo.trackIdField]),"feature"!==i.type&&"startTimeField"!==e.timeField||C(a,i.fieldsIndex,[i.timeInfo.startField]),"endTimeField"===e.timeField&&C(a,i.fieldsIndex,[i.timeInfo.endField]),await k(a,i)}if("floorInfo"in i&&i.floorInfo&&C(a,i.fieldsIndex,[i.floorInfo.floorField]),"featureTitleFields"in i&&this.view?.requiredFieldsOptions?.featureTitleFields&&i.featureTitleFields&&C(a,i.fieldsIndex,i.featureTitleFields),"feature"===i.type&&i.globalIdField&&this.view?.requiredFieldsOptions?.globalIdField&&C(a,i.fieldsIndex,[i.globalIdField]),"feature"!==i.type&&"subtype-group"!==i.type||!this.view?.requiredFieldsOptions?.utilityNetworkFields||C(a,i.fieldsIndex,T(this.view,i)),this.displayFilterEnabled&&"displayFilterInfo"in i&&o.push(Z(a,i,i.displayFilterInfo)),"feature"===i.type&&e&&null!=i.infoFor3D&&(null==i.globalIdField&&t.getLogger(this).error("globalIdField missing on 3DObjectFeatureLayer"),C(a,i.fieldsIndex,[i.globalIdField])),"subtype-group"===i.type){M(a,r,i.subtypeField);const e=i.sublayers.map(e=>Promise.all([e.renderer?.collectRequiredFields(a,r),R(a,e)]));o.push(Promise.all(e))}if("annotation-feature"===i.type&&C(a,r,[i.subtypeField,i.elementField,i.statusField]),"dimension-feature"===i.type&&C(a,r,i.symbolFields),"catalog-footprint"===i.type&&i.parent){const e=i.parent;C(a,r,[e.itemNameField,e.itemSourceField,e.itemTypeField,e.maxScaleField,e.minScaleField])}"knowledge-graph-sublayer"===i.type&&"link-chart"===i.parentCompositeLayer?.type&&M(a,r,c);const u=await Promise.allSettled(o);if(e)M(a,r,i.objectIdField);else for(const t of y(D(i)))M(a,r,t);e&&"displayField"in i&&i.displayField&&M(a,r,i.displayField);for(const p of u)"rejected"===p.status&&t.getLogger(this).error(p.reason);const d=Array.from(a).sort();this._set("requiredFields",d)}async _updateHasZM(){const{layer:e}=this;if(!e||!this.view)return;let t=!1,i=!1;if("capabilities"in e&&e.capabilities){const{data:r}=e.capabilities;t=r.supportsZ,i=r.supportsM}this._set("hasZ",t),this._set("hasM",i);const{returnZ:r,returnM:s}=await b(e);t&&=r??this._defaultReturnZ,i&&=s??!1,this.hasZ!==t&&this._set("hasZ",t),this.hasM!==i&&this._set("hasM",i)}_popupFeatureHasRequiredFields(e,t){return U(e,t)}async _createPopupQuery(e,t){const i=this.layer.createQuery(),s=new Set;let l="point"===this.layer.geometryType;for(const n of e){if(!l){const e=await w(n);r(t),l=(e&&e.arcadeUtils.hasGeometryOperations(n))??!1}const e=await Q(this.layer,n);r(t);for(const t of e)s.add(t)}return i.where="1=1",i.returnGeometry=l,i.returnZ=l,i.returnM=l,i.outFields=Array.from(s),i.outSpatialReference=this.view.spatialReference,"floorInfo"in this.layer&&this.layer.floorInfo&&(i.where=d(i.where,L(this))),i}canResume(){return!!super.canResume()&&(null==this.timeExtent||!this.timeExtent.isEmpty)}_getHighlightFilterGroups(){return[]}getTest(){}get test(){}};e([p()],V.prototype,"_updatingRequiredPromise",void 0),e([p()],V.prototype,"_defaultReturnZ",void 0),e([p({readOnly:!0})],V.prototype,"availableFields",null),e([p({readOnly:!0})],V.prototype,"hasZ",void 0),e([p({readOnly:!0})],V.prototype,"hasM",void 0),e([p({readOnly:!0})],V.prototype,"displayFilterEnabled",null),e([p({readOnly:!0})],V.prototype,"effectiveDisplayFilter",null),e([p({readOnly:!0})],V.prototype,"effectiveDisplayFilterClause",null),e([p({type:F})],V.prototype,"featureEffect",null),e([p({type:g})],V.prototype,"filter",void 0),e([p()],V.prototype,"layer",void 0),e([p({type:Number})],V.prototype,"maximumNumberOfFeatures",null),e([p({readOnly:!0,type:Boolean})],V.prototype,"maximumNumberOfFeaturesExceeded",null),e([p()],V.prototype,"requiresCurrentUser",void 0),e([p({readOnly:!0})],V.prototype,"requiredFields",void 0),e([p({readOnly:!0})],V.prototype,"signedInUser",null),e([p()],V.prototype,"view",void 0),V=e([f("esri.views.layers.FeatureLikeLayerView")],V);const A=V;export{A as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Color.js";import r from"../../../core/Accessor.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Error.js";import has from"../../../core/has.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{debounce as a,throwIfAborted as l,ignoreAbortErrors as n}from"../../../core/promiseUtils.js";import{on as p}from"../../../core/reactiveUtils.js";import{sqlAnd as u}from"../../../core/sql.js";import{getMetersPerUnitForSR as c}from"../../../core/units.js";import{property as h,subclass as y}from"../../../core/accessorSupport/decorators.js";import d from"../../../geometry/Extent.js";import{getResolutionForScale as m}from"../../../geometry/support/scaleUtils.js";import{collectFields as f}from"../../../layers/support/fieldUtils.js";import{getLayerFloorFilterClause as g}from"../../../layers/support/floorFilterUtils.js";import{calculateTolerance as b}from"../../../renderers/support/clickToleranceUtils.js";import{identify as w}from"../../../rest/identify.js";import v from"../../../rest/support/IdentifyParameters.js";import{loadArcade as x}from"../../../support/loadArcade.js";import _ from"../../../symbols/SimpleMarkerSymbol.js";import{getRequiredFields as G,getFetchPopupTemplate as S}from"./popupUtils.js";let F=null;function j(e,t){return"tile"===t.type||"map-image"===t.type}let V=class extends r{constructor(e){super(e),this._featuresResolutions=new WeakMap,this.highlightGraphics=null,this.highlightGraphicUpdated=null,this.updateHighlightedFeatures=a(async e=>{this.destroyed||await this.updatingHandles.consumePromise(this._updateHighlightedFeaturesGeometries(e))})}initialize(){const e=e=>{for(const t of e){const{sourceLayer:e}=t;null!=e&&"geometryType"in e&&"point"===e.geometryType&&t.visible&&(t.visible=!1,this.highlightGraphicUpdated?.({graphic:t,property:"visible",oldValue:!0,newValue:!1}))}this.updatingHandles.consumePromise(this._updateHighlightedFeaturesSymbols(e)),n(this.updateHighlightedFeatures(this._highlightGeometriesResolution))};this.addHandles([p(()=>this.highlightGraphics,"change",t=>e(t.added),{onListenerAdd:t=>e(t)})])}async fetchPopupFeaturesAtTarget(e,t){const{layerView:{layer:r,view:{scale:i}}}=this,o=P(r.sublayers,i,t);if(!o.length)return[];if(await R(o))return this._fetchPopupFeaturesUsingQueries(e,o,t);if((r.capabilities?.operations?.supportsIdentify&&r.version>=10.5)??!0)return this._fetchPopupFeaturesUsingIdentify(e,o,t);throw new s("fetchPopupFeatures:not-supported","query operation is disabled for this service",{layer:r})}clearHighlights(){this.highlightGraphics?.removeAll()}async _updateHighlightedFeaturesSymbols(e){for(const t of e)this._updateSymbology(t)}_updateSymbology(e){if("point"===e.geometry?.type)return this._updatePointSymbology(e)}_setGraphicSymbol(e,t){if(!t)return;const r=e.symbol;e.symbol=t,this.highlightGraphicUpdated?.({graphic:e,property:"symbol",oldValue:r,newValue:t})}_updatePointSymbology(e){const r=e.sourceLayer&&"renderer"in e.sourceLayer&&e.sourceLayer.renderer,{highlightGraphicUpdated:i,highlightGraphics:s,layerView:{view:o}}=this,a=e=>{e.visible||(e.visible=!0,i?.({graphic:e,property:"visible",oldValue:!1,newValue:!0}))};r&&"getSymbolAsync"in r?r.getSymbolAsync(e).then(async i=>{i||=new _;let l=null;const n="visualVariables"in r?r.visualVariables?.find(e=>"size"===e.type):void 0;n&&(F||(F=(await(import("../../../renderers/visualVariables/support/visualVariableUtils.js"))).getSize),l=F(n,e,{view:o.type,scale:o.scale,shape:"simple-marker"===i.type?i.style:null})),l||="width"in i&&"height"in i&&null!=i.width&&null!=i.height?Math.max(i.width,i.height):"size"in i?i.size:16,s?.includes(e)&&(this._setGraphicSymbol(e,new _({style:"square",size:l,color:new t([255,255,255,1/255]),xoffset:"xoffset"in i?i.xoffset:0,yoffset:"yoffset"in i?i.yoffset:0})),a(e))}):a(e)}get _updateContext(){const{layerView:{layer:e},highlightGraphics:t,highlightGraphicUpdated:r}=this;return r&&t?.length&&e.capabilities.operations.supportsQuery?{highlightGraphicUpdated:r,highlightGraphics:t}:null}get highlightFeaturesActive(){return!!this._updateContext}async _updateHighlightedFeaturesGeometries(e){this._highlightGeometriesResolution=e;const t=this._updateContext;if(!t)return;const r=this._getTargetResolution(e),i=new Map,{highlightGraphics:s,highlightGraphicUpdated:a}=t;for(const u of s)if(!this._featuresResolutions.has(u)||this._featuresResolutions.get(u)>r){const e=u.sourceLayer;o(i,e,()=>new Map).set(u.getObjectId(),u)}const{layerView:{view:l}}=this,n=Array.from(i,([e,t])=>{const i=e.createQuery();return i.objectIds=[...t.keys()],i.outFields=[e.objectIdField],i.returnGeometry=!0,i.maxAllowableOffset=r,i.outSpatialReference=l.spatialReference,e.queryFeatures(i)}),p=await Promise.all(n);if(!this.destroyed)for(const{features:o}of p)for(const e of o){const t=e.sourceLayer,o=i.get(t).get(e.getObjectId());if(o&&s.includes(o)){const t=o.geometry;o.geometry=e.geometry,a({graphic:o,property:"geometry",oldValue:t,newValue:o.geometry}),this._featuresResolutions.set(o,r)}}}_getTargetResolution(e){const t=e*c(this.layerView.view.spatialReference),r=t/16;return r<=10?0:e/t*r}async _fetchPopupFeaturesUsingIdentify(e,t,r){const i=await this._createIdentifyParameters(e,t,r);if(null==i)return[];const{results:s}=await w(this.layerView.layer.parsedUrl,i,r);return s.map(e=>e.feature)}async _createIdentifyParameters(e,t,r){const{floors:i,layer:s,timeExtent:o,view:{spatialReference:a,scale:l}}=this.layerView;if(!t.length)return null;let n,p;await Promise.all(t.map(({sublayer:e})=>e.load(r).catch(()=>{}))),"point"===e.type?(n=Math.min(has("mapservice-popup-identify-max-tolerance"),s.allSublayers.reduce((e,t)=>t.renderer?b({renderer:t.renderer,pointerType:r?.pointerType}):e,2)),p=this.createFetchPopupFeaturesQueryGeometry(e,n)):(n=2,p=e.extent);const u=m(l,a),c=Math.ceil(p.width/u),h=new d({xmin:p.center.x-u*c,ymin:p.center.y-u*c,xmax:p.center.x+u*c,ymax:p.center.y+u*c,spatialReference:p.spatialReference});return new v({floors:i,gdbVersion:"gdbVersion"in s?s.gdbVersion:void 0,geometry:e,height:c,layerOption:"popup",mapExtent:h,returnGeometry:!0,spatialReference:a,sublayers:s.sublayers,timeExtent:o,tolerance:n,width:c})}async _fetchPopupFeaturesUsingQueries(e,t,r){const{layerView:{floors:s,timeExtent:o,view:{scale:a,spatialReference:n}}}=this,p=t.map(async({sublayer:t,popupTemplate:i})=>{if(await t.load(r).catch(()=>{}),t.capabilities&&!t.capabilities.operations.supportsQuery)return[];const p=t.createQuery();let c;if("point"===e.type){const i=b({renderer:t.renderer,pointerType:r?.pointerType});c=this.createFetchPopupFeaturesQueryGeometry(e,i)}else c=e;const h=new Set,[y]=await Promise.all([G(t,i),t.renderer?.collectRequiredFields(h,t.fieldsIndex)]);l(r),f(h,t.fieldsIndex,y);const d=Array.from(h).sort();p.geometry=c,p.outFields=d,p.timeExtent=o;const w=g(s,t);if(p.where=u(p.where,w),t.capabilities?.query.supportsOrderBy&&t.orderBy?.[0]){const e=t.orderBy[0],r=!e.valueExpression&&e.field,i="ascending"===e.order?"asc":"desc";r&&(p.orderByFields=[`${r} ${i}`])}const v=await U(i);l(r);const x="point"===t.geometryType||v?.arcadeUtils.hasGeometryOperations(i)?0:this._getTargetResolution(m(a,n));x&&(p.maxAllowableOffset=x);let{features:_}=await t.queryFeatures(p,r);_=await A(t,_,r);for(const e of _)this._featuresResolutions.set(e,x);return _});return(await Promise.allSettled(p)).reduce((e,t)=>"fulfilled"===t.status?[...e,...t.value]:e,[]).filter(i)}};function P(e,t,r){const i=[];if(!e)return i;const s=e=>{const o=0===e.minScale||t<=e.minScale,a=0===e.maxScale||t>=e.maxScale;if(e.visible&&o&&a)if(e.sublayers)e.sublayers.forEach(s);else if(e.popupEnabled){const t=S(e,{...r,defaultPopupTemplateEnabled:!1});null!=t&&i.unshift({sublayer:e,popupTemplate:t})}};return e.map(s),i}function U(e){return e.expressionInfos?.length||Array.isArray(e.content)&&e.content.some(e=>"expression"===e.type)?x():Promise.resolve()}async function R(e){return(await Promise.allSettled(e.map(({sublayer:e})=>e.load().catch(()=>{}).then(()=>e.capabilities?.operations?.supportsQuery??!1)))).every(e=>"fulfilled"===e.status&&e.value)}async function A(e,t,r){const i=e.renderer;return i&&"defaultSymbol"in i&&!i.defaultSymbol&&(t=i.valueExpression?await Promise.all(t.map(e=>i.getSymbolAsync(e,r).then(t=>t?e:null))).then(e=>e.filter(e=>null!=e)):t.filter(e=>null!=i.getSymbol(e))),t}e([h({constructOnly:!0})],V.prototype,"createFetchPopupFeaturesQueryGeometry",void 0),e([h({constructOnly:!0})],V.prototype,"layerView",void 0),e([h({constructOnly:!0})],V.prototype,"highlightGraphics",void 0),e([h({constructOnly:!0})],V.prototype,"highlightGraphicUpdated",void 0),e([h({constructOnly:!0})],V.prototype,"updatingHandles",void 0),e([h()],V.prototype,"_updateContext",null),V=e([y("esri.views.layers.support.MapServiceLayerViewHelper")],V);export{V as MapServiceLayerViewHelper,P as collectPopupProviders,j as isMapServiceLayerView};
2
+ import{__decorate as e}from"tslib";import t from"../../../Color.js";import r from"../../../core/Accessor.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Error.js";import has from"../../../core/has.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{debounce as a,throwIfAborted as l,ignoreAbortErrors as n}from"../../../core/promiseUtils.js";import{on as p}from"../../../core/reactiveUtils.js";import{sqlAnd as c}from"../../../core/sql.js";import{getMetersPerUnitForSR as u}from"../../../core/units.js";import{property as h,subclass as y}from"../../../core/accessorSupport/decorators.js";import d from"../../../geometry/Extent.js";import{getResolutionForScale as m}from"../../../geometry/support/scaleUtils.js";import{collectFields as f}from"../../../layers/support/fieldUtils.js";import{getLayerFloorFilterClause as g}from"../../../layers/support/floorFilterUtils.js";import{calculateTolerance as b}from"../../../renderers/support/clickToleranceUtils.js";import{identify as w}from"../../../rest/identify.js";import v from"../../../rest/support/IdentifyParameters.js";import{loadArcade as x}from"../../../support/loadArcade.js";import S from"../../../symbols/SimpleMarkerSymbol.js";import{getRequiredFields as _,getFetchPopupTemplate as G}from"./popupUtils.js";let F=null;function j(e,t){return"tile"===t.type||"map-image"===t.type}let V=class extends r{constructor(e){super(e),this._featuresResolutions=new WeakMap,this.highlightGraphics=null,this.highlightGraphicUpdated=null,this.updateHighlightedFeatures=a(async e=>{this.destroyed||await this.updatingHandles.consumePromise(this._updateHighlightedFeaturesGeometries(e))})}initialize(){const e=e=>{for(const t of e){const{sourceLayer:e}=t;null!=e&&"geometryType"in e&&"point"===e.geometryType&&t.visible&&(t.visible=!1,this.highlightGraphicUpdated?.({graphic:t,property:"visible",oldValue:!0,newValue:!1}))}this.updatingHandles.consumePromise(this._updateHighlightedFeaturesSymbols(e)),n(this.updateHighlightedFeatures(this._highlightGeometriesResolution))};this.addHandles([p(()=>this.highlightGraphics,"change",t=>e(t.added),{onListenerAdd:t=>e(t)})])}async fetchPopupFeaturesAtTarget(e,t){const{layerView:{layer:r,view:{scale:i}}}=this,o=P(r.sublayers,i,t);if(!o.length)return[];if(await R(o))return this._fetchPopupFeaturesUsingQueries(e,o,t);if((r.capabilities?.operations?.supportsIdentify&&r.version>=10.5)??!0)return this._fetchPopupFeaturesUsingIdentify(e,o,t);throw new s("fetchPopupFeatures:not-supported","query operation is disabled for this service",{layer:r})}clearHighlights(){this.highlightGraphics?.removeAll()}async _updateHighlightedFeaturesSymbols(e){for(const t of e)this._updateSymbology(t)}_updateSymbology(e){if("point"===e.geometry?.type)return this._updatePointSymbology(e)}_setGraphicSymbol(e,t){if(!t)return;const r=e.symbol;e.symbol=t,this.highlightGraphicUpdated?.({graphic:e,property:"symbol",oldValue:r,newValue:t})}_updatePointSymbology(e){const r=e.sourceLayer&&"renderer"in e.sourceLayer&&e.sourceLayer.renderer,{highlightGraphicUpdated:i,highlightGraphics:s,layerView:{view:o}}=this,a=e=>{e.visible||(e.visible=!0,i?.({graphic:e,property:"visible",oldValue:!1,newValue:!0}))};r&&"getSymbolAsync"in r?r.getSymbolAsync(e).then(async i=>{i||=new S;let l=null;const n="visualVariables"in r?r.visualVariables?.find(e=>"size"===e.type):void 0;n&&(F||(F=(await(import("../../../renderers/visualVariables/support/visualVariableUtils.js"))).getSize),l=F(n,e,{view:o.type,scale:o.scale,shape:"simple-marker"===i.type?i.style:null})),l||="width"in i&&"height"in i&&null!=i.width&&null!=i.height?Math.max(i.width,i.height):"size"in i?i.size:16,s?.includes(e)&&(this._setGraphicSymbol(e,new S({style:"square",size:l,color:new t([255,255,255,1/255]),xoffset:"xoffset"in i?i.xoffset:0,yoffset:"yoffset"in i?i.yoffset:0})),a(e))}):a(e)}get _updateContext(){const{layerView:{layer:e},highlightGraphics:t,highlightGraphicUpdated:r}=this;return r&&t?.length&&e.capabilities.operations.supportsQuery?{highlightGraphicUpdated:r,highlightGraphics:t}:null}get highlightFeaturesActive(){return!!this._updateContext}async _updateHighlightedFeaturesGeometries(e){this._highlightGeometriesResolution=e;const t=this._updateContext;if(!t)return;const r=this._getTargetResolution(e),i=new Map,{highlightGraphics:s,highlightGraphicUpdated:a}=t;for(const c of s)if(!this._featuresResolutions.has(c)||this._featuresResolutions.get(c)>r){const e=c.sourceLayer;o(i,e,()=>new Map).set(c.getObjectId(),c)}const{layerView:{view:l}}=this,n=Array.from(i,([e,t])=>{const i=e.createQuery();return i.objectIds=[...t.keys()],i.outFields=[e.objectIdField],i.returnGeometry=!0,i.maxAllowableOffset=r,i.outSpatialReference=l.spatialReference,e.queryFeatures(i)}),p=await Promise.all(n);if(!this.destroyed)for(const{features:o}of p)for(const e of o){const t=e.sourceLayer,o=i.get(t).get(e.getObjectId());if(o&&s.includes(o)){const t=o.geometry;o.geometry=e.geometry,a({graphic:o,property:"geometry",oldValue:t,newValue:o.geometry}),this._featuresResolutions.set(o,r)}}}_getTargetResolution(e){const t=e*u(this.layerView.view.spatialReference),r=t/16;return r<=10?0:e/t*r}async _fetchPopupFeaturesUsingIdentify(e,t,r){const i=await this._createIdentifyParameters(e,t,r);if(null==i)return[];const{results:s,exceededTransferLimit:o}=await w(this.layerView.layer.parsedUrl,i,r);if(o)for(const{sublayer:a}of t){const e=a.graphicOrigin;e&&r?.diagnostics&&(r.diagnostics.layerLimitExceeded??=new Set).add(e)}return s.map(e=>e.feature)}async _createIdentifyParameters(e,t,r){const{floors:i,layer:s,timeExtent:o,view:{spatialReference:a,scale:l}}=this.layerView;if(!t.length)return null;let n,p;await Promise.all(t.map(({sublayer:e})=>e.load(r).catch(()=>{}))),"point"===e.type?(n=Math.min(has("mapservice-popup-identify-max-tolerance"),s.allSublayers.reduce((e,t)=>t.renderer?b({renderer:t.renderer,pointerType:r?.pointerType}):e,2)),p=this.createFetchPopupFeaturesQueryGeometry(e,n)):(n=2,p=e.extent);const c=m(l,a),u=Math.ceil(p.width/c),h=new d({xmin:p.center.x-c*u,ymin:p.center.y-c*u,xmax:p.center.x+c*u,ymax:p.center.y+c*u,spatialReference:p.spatialReference});return new v({floors:i,gdbVersion:"gdbVersion"in s?s.gdbVersion:void 0,geometry:e,height:u,layerOption:"popup",mapExtent:h,returnGeometry:!0,spatialReference:a,sublayers:s.sublayers,timeExtent:o,tolerance:n,width:u})}async _fetchPopupFeaturesUsingQueries(e,t,r){const{layerView:{floors:s,timeExtent:o,view:{scale:a,spatialReference:n}}}=this,p=t.map(async({sublayer:t,popupTemplate:i})=>{if(await t.load(r).catch(()=>{}),t.capabilities&&!t.capabilities.operations.supportsQuery)return[];const p=t.createQuery();let u;if("point"===e.type){const i=b({renderer:t.renderer,pointerType:r?.pointerType});u=this.createFetchPopupFeaturesQueryGeometry(e,i)}else u=e;const h=new Set,[y]=await Promise.all([_(t,i),t.renderer?.collectRequiredFields(h,t.fieldsIndex)]);l(r),f(h,t.fieldsIndex,y);const d=Array.from(h).sort();p.geometry=u,p.outFields=d,p.timeExtent=o;const w=g(s,t);if(p.where=c(p.where,w),t.capabilities?.query.supportsOrderBy&&t.orderBy?.[0]){const e=t.orderBy[0],r=!e.valueExpression&&e.field,i="ascending"===e.order?"asc":"desc";r&&(p.orderByFields=[`${r} ${i}`])}const v=await U(i);l(r);const x="point"===t.geometryType||v?.arcadeUtils.hasGeometryOperations(i)?0:this._getTargetResolution(m(a,n));x&&(p.maxAllowableOffset=x);const S=await t.queryFeatures(p,r);let{features:G}=S;if(S.exceededTransferLimit){const e=t.graphicOrigin;e&&r?.diagnostics&&(r.diagnostics.layerLimitExceeded??=new Set).add(e)}G=await T(t,G,r);for(const e of G)this._featuresResolutions.set(e,x);return G});return(await Promise.allSettled(p)).reduce((e,t)=>"fulfilled"===t.status?[...e,...t.value]:e,[]).filter(i)}};function P(e,t,r){const i=[];if(!e)return i;const s=e=>{const o=0===e.minScale||t<=e.minScale,a=0===e.maxScale||t>=e.maxScale;if(e.visible&&o&&a)if(e.sublayers)e.sublayers.forEach(s);else if(e.popupEnabled){const t=G(e,{...r,defaultPopupTemplateEnabled:!1});null!=t&&i.unshift({sublayer:e,popupTemplate:t})}};return e.map(s),i}function U(e){return e.expressionInfos?.length||Array.isArray(e.content)&&e.content.some(e=>"expression"===e.type)?x():Promise.resolve()}async function R(e){return(await Promise.allSettled(e.map(({sublayer:e})=>e.load().catch(()=>{}).then(()=>e.capabilities?.operations?.supportsQuery??!1)))).every(e=>"fulfilled"===e.status&&e.value)}async function T(e,t,r){const i=e.renderer;return i&&"defaultSymbol"in i&&!i.defaultSymbol&&(t=i.valueExpression?await Promise.all(t.map(e=>i.getSymbolAsync(e,r).then(t=>t?e:null))).then(e=>e.filter(e=>null!=e)):t.filter(e=>null!=i.getSymbol(e))),t}e([h({constructOnly:!0})],V.prototype,"createFetchPopupFeaturesQueryGeometry",void 0),e([h({constructOnly:!0})],V.prototype,"layerView",void 0),e([h({constructOnly:!0})],V.prototype,"highlightGraphics",void 0),e([h({constructOnly:!0})],V.prototype,"highlightGraphicUpdated",void 0),e([h({constructOnly:!0})],V.prototype,"updatingHandles",void 0),e([h()],V.prototype,"_updateContext",null),V=e([y("esri.views.layers.support.MapServiceLayerViewHelper")],V);export{V as MapServiceLayerViewHelper,P as collectPopupProviders,j as isMapServiceLayerView};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import{deprecateUnnecessaryViewModel as s}from"../../core/deprecate.js";import{EventedAccessor as i}from"../../core/Evented.js";import a from"../../core/Logger.js";import{watch as r,initial as l}from"../../core/reactiveUtils.js";import{property as n,subclass as o}from"../../core/accessorSupport/decorators.js";import m from"../LayerList/ListItem.js";import{getItemLayers as c,findLayerListMode as h}from"../LayerList/support/layerListUtils.js";const d={view:"view",basemap:"basemap",baseLayers:"base-layers",referenceLayers:"reference-layers",baseLayersListMode:"reference-layers-list-mode",referenceLayersListMode:"base-layers-list-mode",baseLayerViews:"base-layer-views",referenceLayerViews:"reference-layer-views",children:"children"},p="hide",y=t.ofType(m);let b=class extends i{constructor(e){super(e),this.baseItems=new y,this.baseListItemCreatedFunction=null,this.checkPublishStatusEnabled=!1,this.listModeDisabled=!1,this.referenceListItemCreatedFunction=null,this.referenceItems=new y,this.view=null,e?.suppressDeprecationWarning||s(a.getLogger(this),"Basemap Layer List (Next)","arcgis-basemap-layer-list-next",{see:"https://esriurl.com/arcgis-basemap-layer-list-next/",version:"5.2"}),this._compileBaseList=this._compileBaseList.bind(this),this._compileReferenceList=this._compileReferenceList.bind(this)}normalizeCtorArgs(e){const{suppressDeprecationWarning:t,...s}=e??{};return s}initialize(){this.addHandles([r(()=>[this.view?.map?.basemap,!0===this.view?.ready,this.view?.basemapView],()=>this._watchBasemapLayers(),l),r(()=>[this.baseListItemCreatedFunction,this.checkPublishStatusEnabled,this.listModeDisabled],()=>this._baseListItemCreatedFunctionChanged()),r(()=>[this.referenceListItemCreatedFunction,this.checkPublishStatusEnabled,this.listModeDisabled],()=>this._referenceListItemCreatedFunctionChanged())],d.view)}destroy(){this.view=null,this._removeAllBaseItems(),this._removeAllReferenceItems()}get basemapTitle(){return this.view?.map?.basemap?.title??null}set basemapTitle(e){this._override("basemapTitle",e)}get state(){return this.view?.ready?"ready":this.view?"loading":"disabled"}get totalBaseItems(){return this.baseItems.flatten(e=>e.children).length}get totalReferenceItems(){return this.referenceItems.flatten(e=>e.children).length}triggerAction(e,t){e&&!e.disabled&&this.emit("trigger-action",{action:e,item:t})}moveListItem({targetItem:e,fromParentItem:t,toParentItem:s,from:i,to:a,newIndex:r}){const l=e?.layer;if(!l||"subtype-sublayer"===l.type||"sublayer"===l.type)return;const n=this.view?.map?.basemap,o=n?.baseLayers,m=n?.referenceLayers,h=t?c(t):"base"===i?o:m,d=s?c(s):"base"===a?o:m;if(!h||!d)return;const{baseItems:p,referenceItems:y}=this,b="base"===i?p:y,L="base"===a?p:y,f=t?.children||b,u=s?.children||L,I=d.length-r;e.parent=s||null,f.remove(e),h.remove(l),u.includes(e)||u.add(e,I),d.includes(l)||d.add(l,I),this._compileLists()}_createItemChangeHandles({items:e,key:t,callback:s}){this.removeHandles(t),s(),e&&this.addHandles(e.on("change",()=>s()),t)}_createListItem({layer:e,type:t}){const{view:s,baseListItemCreatedFunction:i,referenceListItemCreatedFunction:a,checkPublishStatusEnabled:r,listModeDisabled:l}=this;return new m({layer:e,checkPublishStatusEnabled:r,listItemCreatedFunction:"base"===t?i:a,listModeDisabled:l,view:s})}_watchLayersListMode({layers:e,key:t,callback:s}){this.removeHandles(t),e&&!this.listModeDisabled&&this.addHandles(r(()=>e.filter(e=>"listMode"in e).map(e=>e.listMode).toArray(),()=>s()),t)}_getViewableLayers(e){return e?this.listModeDisabled?e:e.filter(e=>h(e)!==p):void 0}_compileListItems({layers:e,items:t,key:s,type:i,callback:a}){this._watchLayersListMode({layers:e,key:s,callback:a});const r=this._getViewableLayers(e);r?.length?(this._createNewItems({type:i,items:t,layers:r}),this._removeItems({items:t,layers:r}),this._sortItems(t,r)):"base"===i?this._removeAllBaseItems():this._removeAllReferenceItems()}_compileReferenceList(){const{referenceItems:e}=this,t=this.view?.map?.basemap?.referenceLayers;this._compileListItems({type:"reference",layers:t,items:e,key:d.referenceLayersListMode,callback:this._compileReferenceList})}_compileBaseList(){const{baseItems:e}=this,t=this.view?.map?.basemap?.baseLayers;this._compileListItems({type:"base",layers:t,items:e,key:d.baseLayersListMode,callback:this._compileBaseList})}_compileLists(){this._compileReferenceList(),this._compileBaseList()}_createNewItems({items:e,layers:t,type:s}){t?.forEach(t=>{e.some(e=>e.layer===t)||e.add(this._createListItem({type:s,layer:t}))})}_removeItems({items:e,layers:t}){e&&e.forEach(s=>{if(!s)return;const i=t?.some(e=>s.layer===e);i||(this.removeHandles(`${d.children}-${s.uid}`),e.remove(s),s.destroy())})}_sortItems(e,t){e&&t&&e.sort((e,s)=>{const i=t.indexOf(e.layer),a=t.indexOf(s.layer);return i>a?-1:i<a?1:0})}_removeAllBaseItems(){this.baseItems.drain(e=>{this.removeHandles(`${d.children}-${e.uid}`),e.destroy()})}_removeAllReferenceItems(){this.referenceItems.drain(e=>{this.removeHandles(`${d.children}-${e.uid}`),e.destroy()})}_baseListItemCreatedFunctionChanged(){this._removeAllBaseItems(),this._compileLists()}_referenceListItemCreatedFunctionChanged(){this._removeAllReferenceItems(),this._compileLists()}_watchBasemapLayers(){const{view:e}=this;if(this.removeHandles([d.baseLayers,d.referenceLayers,d.basemap,d.baseLayerViews,d.referenceLayerViews]),!e?.ready)return this._removeAllBaseItems(),void this._removeAllReferenceItems();this._compileLists(),this.addHandles([r(()=>this.view?.map?.basemap?.baseLayers,e=>this._createItemChangeHandles({items:e,key:d.baseLayers,callback:this._compileBaseList}),l),r(()=>this.view?.map?.basemap?.referenceLayers,e=>this._createItemChangeHandles({items:e,key:d.referenceLayers,callback:this._compileReferenceList}),l),r(()=>this.view?.basemapView?.baseLayerViews,e=>this._createItemChangeHandles({items:e,key:d.baseLayerViews,callback:this._compileBaseList}),l),r(()=>this.view?.basemapView?.referenceLayerViews,e=>this._createItemChangeHandles({items:e,key:d.referenceLayerViews,callback:this._compileReferenceList}),l)],d.basemap)}};e([n({type:y,readOnly:!0})],b.prototype,"baseItems",void 0),e([n()],b.prototype,"basemapTitle",null),e([n()],b.prototype,"baseListItemCreatedFunction",void 0),e([n()],b.prototype,"checkPublishStatusEnabled",void 0),e([n({nonNullable:!0})],b.prototype,"listModeDisabled",void 0),e([n()],b.prototype,"referenceListItemCreatedFunction",void 0),e([n({type:y,readOnly:!0})],b.prototype,"referenceItems",void 0),e([n({readOnly:!0})],b.prototype,"state",null),e([n()],b.prototype,"totalBaseItems",null),e([n()],b.prototype,"totalReferenceItems",null),e([n()],b.prototype,"view",void 0),b=e([o("esri.widgets.BasemapLayerList.BasemapLayerListViewModel")],b);const L=b;export{L as default};
2
+ import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import{deprecateUnnecessaryViewModel as s}from"../../core/deprecate.js";import{EventedAccessor as i}from"../../core/Evented.js";import a from"../../core/Logger.js";import{watch as r,initial as l}from"../../core/reactiveUtils.js";import{property as n,subclass as o}from"../../core/accessorSupport/decorators.js";import m from"../LayerList/ListItem.js";import{getItemLayers as c,findLayerListMode as h}from"../LayerList/support/layerListUtils.js";const d={view:"view",basemap:"basemap",baseLayers:"base-layers",referenceLayers:"reference-layers",baseLayersListMode:"reference-layers-list-mode",referenceLayersListMode:"base-layers-list-mode",baseLayerViews:"base-layer-views",referenceLayerViews:"reference-layer-views",children:"children"},p="hide",y=t.ofType(m);let b=class extends i{constructor(e){super(e),this.baseItems=new y,this.baseListItemCreatedFunction=null,this.checkPublishStatusEnabled=!1,this.listModeDisabled=!1,this.referenceListItemCreatedFunction=null,this.referenceItems=new y,this.view=null,e?.suppressDeprecationWarning||s(a.getLogger(this),"Basemap Layer List (Next)","arcgis-basemap-layer-list-next",{version:"5.2"}),this._compileBaseList=this._compileBaseList.bind(this),this._compileReferenceList=this._compileReferenceList.bind(this)}normalizeCtorArgs(e){const{suppressDeprecationWarning:t,...s}=e??{};return s}initialize(){this.addHandles([r(()=>[this.view?.map?.basemap,!0===this.view?.ready,this.view?.basemapView],()=>this._watchBasemapLayers(),l),r(()=>[this.baseListItemCreatedFunction,this.checkPublishStatusEnabled,this.listModeDisabled],()=>this._baseListItemCreatedFunctionChanged()),r(()=>[this.referenceListItemCreatedFunction,this.checkPublishStatusEnabled,this.listModeDisabled],()=>this._referenceListItemCreatedFunctionChanged())],d.view)}destroy(){this.view=null,this._removeAllBaseItems(),this._removeAllReferenceItems()}get basemapTitle(){return this.view?.map?.basemap?.title??null}set basemapTitle(e){this._override("basemapTitle",e)}get state(){return this.view?.ready?"ready":this.view?"loading":"disabled"}get totalBaseItems(){return this.baseItems.flatten(e=>e.children).length}get totalReferenceItems(){return this.referenceItems.flatten(e=>e.children).length}triggerAction(e,t){e&&!e.disabled&&this.emit("trigger-action",{action:e,item:t})}moveListItem({targetItem:e,fromParentItem:t,toParentItem:s,from:i,to:a,newIndex:r}){const l=e?.layer;if(!l||"subtype-sublayer"===l.type||"sublayer"===l.type)return;const n=this.view?.map?.basemap,o=n?.baseLayers,m=n?.referenceLayers,h=t?c(t):"base"===i?o:m,d=s?c(s):"base"===a?o:m;if(!h||!d)return;const{baseItems:p,referenceItems:y}=this,b="base"===i?p:y,L="base"===a?p:y,f=t?.children||b,u=s?.children||L,I=d.length-r;e.parent=s||null,f.remove(e),h.remove(l),u.includes(e)||u.add(e,I),d.includes(l)||d.add(l,I),this._compileLists()}_createItemChangeHandles({items:e,key:t,callback:s}){this.removeHandles(t),s(),e&&this.addHandles(e.on("change",()=>s()),t)}_createListItem({layer:e,type:t}){const{view:s,baseListItemCreatedFunction:i,referenceListItemCreatedFunction:a,checkPublishStatusEnabled:r,listModeDisabled:l}=this;return new m({layer:e,checkPublishStatusEnabled:r,listItemCreatedFunction:"base"===t?i:a,listModeDisabled:l,view:s})}_watchLayersListMode({layers:e,key:t,callback:s}){this.removeHandles(t),e&&!this.listModeDisabled&&this.addHandles(r(()=>e.filter(e=>"listMode"in e).map(e=>e.listMode).toArray(),()=>s()),t)}_getViewableLayers(e){return e?this.listModeDisabled?e:e.filter(e=>h(e)!==p):void 0}_compileListItems({layers:e,items:t,key:s,type:i,callback:a}){this._watchLayersListMode({layers:e,key:s,callback:a});const r=this._getViewableLayers(e);r?.length?(this._createNewItems({type:i,items:t,layers:r}),this._removeItems({items:t,layers:r}),this._sortItems(t,r)):"base"===i?this._removeAllBaseItems():this._removeAllReferenceItems()}_compileReferenceList(){const{referenceItems:e}=this,t=this.view?.map?.basemap?.referenceLayers;this._compileListItems({type:"reference",layers:t,items:e,key:d.referenceLayersListMode,callback:this._compileReferenceList})}_compileBaseList(){const{baseItems:e}=this,t=this.view?.map?.basemap?.baseLayers;this._compileListItems({type:"base",layers:t,items:e,key:d.baseLayersListMode,callback:this._compileBaseList})}_compileLists(){this._compileReferenceList(),this._compileBaseList()}_createNewItems({items:e,layers:t,type:s}){t?.forEach(t=>{e.some(e=>e.layer===t)||e.add(this._createListItem({type:s,layer:t}))})}_removeItems({items:e,layers:t}){e&&e.forEach(s=>{if(!s)return;const i=t?.some(e=>s.layer===e);i||(this.removeHandles(`${d.children}-${s.uid}`),e.remove(s),s.destroy())})}_sortItems(e,t){e&&t&&e.sort((e,s)=>{const i=t.indexOf(e.layer),a=t.indexOf(s.layer);return i>a?-1:i<a?1:0})}_removeAllBaseItems(){this.baseItems.drain(e=>{this.removeHandles(`${d.children}-${e.uid}`),e.destroy()})}_removeAllReferenceItems(){this.referenceItems.drain(e=>{this.removeHandles(`${d.children}-${e.uid}`),e.destroy()})}_baseListItemCreatedFunctionChanged(){this._removeAllBaseItems(),this._compileLists()}_referenceListItemCreatedFunctionChanged(){this._removeAllReferenceItems(),this._compileLists()}_watchBasemapLayers(){const{view:e}=this;if(this.removeHandles([d.baseLayers,d.referenceLayers,d.basemap,d.baseLayerViews,d.referenceLayerViews]),!e?.ready)return this._removeAllBaseItems(),void this._removeAllReferenceItems();this._compileLists(),this.addHandles([r(()=>this.view?.map?.basemap?.baseLayers,e=>this._createItemChangeHandles({items:e,key:d.baseLayers,callback:this._compileBaseList}),l),r(()=>this.view?.map?.basemap?.referenceLayers,e=>this._createItemChangeHandles({items:e,key:d.referenceLayers,callback:this._compileReferenceList}),l),r(()=>this.view?.basemapView?.baseLayerViews,e=>this._createItemChangeHandles({items:e,key:d.baseLayerViews,callback:this._compileBaseList}),l),r(()=>this.view?.basemapView?.referenceLayerViews,e=>this._createItemChangeHandles({items:e,key:d.referenceLayerViews,callback:this._compileReferenceList}),l)],d.basemap)}};e([n({type:y,readOnly:!0})],b.prototype,"baseItems",void 0),e([n()],b.prototype,"basemapTitle",null),e([n()],b.prototype,"baseListItemCreatedFunction",void 0),e([n()],b.prototype,"checkPublishStatusEnabled",void 0),e([n({nonNullable:!0})],b.prototype,"listModeDisabled",void 0),e([n()],b.prototype,"referenceListItemCreatedFunction",void 0),e([n({type:y,readOnly:!0})],b.prototype,"referenceItems",void 0),e([n({readOnly:!0})],b.prototype,"state",null),e([n()],b.prototype,"totalBaseItems",null),e([n()],b.prototype,"totalReferenceItems",null),e([n()],b.prototype,"view",void 0),b=e([o("esri.widgets.BasemapLayerList.BasemapLayerListViewModel")],b);const L=b;export{L as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../core/Collection.js";import{deprecateWidget as i}from"../core/deprecate.js";import{IdentifiableMixin as s}from"../core/Identifiable.js";import o from"../core/Logger.js";import l from"../core/ReactiveMap.js";import{on as r,initial as a,watch as n,syncAndInitial as d}from"../core/reactiveUtils.js";import{property as c,subclass as p}from"../core/accessorSupport/decorators.js";import m from"./Widget.js";import h from"./BasemapLayerList/BasemapLayerListViewModel.js";import u from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as g}from"./BasemapLayerList/css.js";import f from"./LayerList/LayerListItem.js";import y from"./LayerList/ListItem.js";import{minFilterItems as _,getItem as b,getLayerType as L,removeDestroyedListItems as v,setFilterPredicate as I,sortLayersToIds as w,sortChildLayersToIds as F}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as E}from"./support/componentsUtils.js";import{globalCss as C}from"./support/globalCss.js";import{incrementHeadingLevel as T}from"./support/Heading.js";import{calciteListFilterProps as M}from"./support/listUtils.js";import{tsx as P,messageBundle as O,vmEvent as A}from"./support/widget.js";import{setFocus as B}from"./support/widgetUtils.js";const R=t.ofType(y),k="nested",D=".*\\S+.*",x="data-basemap-layer-type";let N=class extends(s(m)){constructor(e,s){super(e,s),this._baseListEl=null,this._referenceListEl=null,this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._focusEditingFlowItem=!1,this._layerListMap=new l,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`basemap-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder="",this.baseFilterPredicate=null,this.baseFilterText="",this.referenceFilterPredicate=null,this.referenceFilterText="",this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=_,this.openedLayers=new t,this.openedLayerLists=new t,this.tableList=null,this.selectedItems=new R,this.selectionMode="none",this.tileOptions=null,this.viewModel=new h({suppressDeprecationWarning:!0}),this.visibilityAppearance="default",this.visibleElements=new u,this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{const o="pull"===s?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=b(e);if(!l?.sortable)return!1;const r=b(t),a=L(t),n=b(i),d=L(i),c=!!a&&!!d&&a===d,p={selected:l,from:r,to:n},m=t.group,h=i.group,u=r?.layer?.type??"",g=n?.layer?.type??"",f=new Set(["map-image","catalog","knowledge-graph"]),y="sublayer";return m&&h&&"function"==typeof o?o.call(null,p):c&&!f.has(u)&&!f.has(g)&&l?.layer?.type!==y},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find(e=>e.classList?.contains(g.item));this._activeItem=b(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:s,dragEl:o,newIndex:l}=e;if(!s||!i||t?.newIndex===l&&t?.dragEl===o&&t?.toEl===i&&t?.fromEl===s)return;this._lastDragDetail=e,this._selectedDragItemLayerUid=o.value;const r=s,a=i;if(r===a){const e=Array.from(s.children).filter(e=>e?.matches("calcite-list-item")).map(e=>e.value);return void this._sortLayers(r,e)}null!=l&&this._moveLayerFromChildList({toEl:a,fromEl:r,dragEl:o,newIndex:l})},this.announceDeprecation=()=>{i(o.getLogger(this),"Basemap Layer List (Next)","arcgis-basemap-layer-list-next",{version:"5.0"})}}initialize(){this.addHandles([r(()=>this.openedLayers,"change",()=>this._handleOpenedLayersChange(),a),n(()=>[this.viewModel.referenceItems.toArray(),this.viewModel.baseItems.toArray()],()=>v(this.selectedItems),d),n(()=>[this.baseFilterPredicate,this._baseListEl],()=>I(this._baseListEl,this.baseFilterPredicate)),n(()=>[this.referenceFilterPredicate,this._referenceListEl],()=>I(this._referenceListEl,this.referenceFilterPredicate))])}loadDependencies(){return E({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._tooltipReferenceMap.clear(),this._destroyOpenedLayerLists()}get _visibleBaseItems(){return this.baseItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _visibleReferenceItems(){return this.referenceItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _openedPanelItems(){return this._visibleReferenceItems.concat(this._visibleBaseItems).flatten(e=>e.children).filter(({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)}get _totalBaseItems(){return this.viewModel.baseItems.flatten(e=>e.children.filter(e=>"catalog-dynamic-group"!==e.layer?.type)).length}get _totalReferenceItems(){return this.viewModel.referenceItems.flatten(e=>e.children.filter(e=>"catalog-dynamic-group"!==e.layer?.type)).length}get _baseFilterEnabled(){return this._totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this._totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map((t,i)=>this._renderLayerFlowItem(t,i===e.length-1))}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{state:e}=this.viewModel,t={[C.hidden]:"loading"===e,[C.disabled]:"disabled"===e};return P("div",{class:this.classes(g.base,C.widget,C.panel,t)},this._renderItems())}async _createCatalogLayerList(e){const{default:t}=await(import("./CatalogLayerList.js")),{headingLevel:i,catalogOptions:s,view:o,filterPlaceholder:l,minFilterItems:r,selectionMode:a,visibilityAppearance:n,_onCatalogOpen:d,_onTablesOpen:c,layerTablesEnabled:p}=this;return new t({headingLevel:i,view:o,filterPlaceholder:l,minFilterItems:r,selectionMode:a,visibilityAppearance:n,...s,catalogLayer:e,layerTablesEnabled:p,onCatalogOpen:d,onTablesOpen:c})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await(import("./TableList.js")),{headingLevel:i,selectionMode:s,dragEnabled:o}=this;return new t({headingLevel:i,selectionMode:s,dragEnabled:o,...this._getTableListParams(e)})}async _createFlowList(e,t){const{_layerListMap:i}=this,s=i.get(e);if(s)return s;const o="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,o),o}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const s=new AbortController,{signal:o}=s;this._openedLayersController=s,e.forEach((i,s)=>{t.includes(s)||(i.destroy(),e.delete(s))});const l=await Promise.all(t.map(e=>this._createFlowList(e,o)));if(o.aborted)return;i.removeAll(),i.addMany(l);const r=i.at(-1);r?"catalogLayer"in r?(this._set("catalogLayerList",r),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",r)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){return e?P("calcite-tooltip",{key:`tooltip-${e.layer?.uid}`,overlayPositioning:"fixed",referenceElement:this._tooltipReferenceMap.get(e.layer?.uid),topLayerDisabled:this.topLayerDisabled},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter(e=>!e.hidden).toArray().map(e=>this._renderItemTooltipNodes(e))}_renderItemTooltips(){return this._visibleReferenceItems.concat(this._visibleBaseItems)?.toArray().map(e=>this._renderItemTooltipNodes(e))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,B(e))}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map(({title:i,panel:s},o)=>{const l=()=>this._handlePanelFlowItemBack(s);return P("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:i,heading:s.title,headingLevel:this.headingLevel,key:`flow-panel-${s.uid}`,selected:!t.length&&o===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),l()}},s.render(),P("calcite-button",{appearance:"transparent",slot:"footer-start",width:"full",onclick:l},this.messagesCommon.back))})}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,B(e))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,B(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,B(e))}_renderItem(e,t,i,s){return P(f,{activeItem:this._activeItem,canMove:this._canMove,css:g,displayMode:k,dragDisabled:t,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:i,parentTitles:s,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:s}){const o=b(i),l=b(e),r=b(t),a=j(t),n=j(e);a&&n&&this.viewModel.moveListItem({targetItem:o,fromParentItem:r,toParentItem:l,newIndex:s,from:a,to:n})}_handleCalciteListDragEnd({fromEl:e,dragEl:t,oldIndex:i}){null!=i&&e.insertBefore(t,e.children[i])}_sortLayers(e,t){if(e)if(e===this._referenceListEl||e===this._baseListEl){const i=e===this._referenceListEl?"reference":"base",s="base"===i?this.view?.map?.basemap?.baseLayers:"reference"===i?this.view?.map?.basemap?.referenceLayers:null;w(s,t)}else{const i=b(e);if(!i)return;F(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const s=e.target.selectedItems.map(e=>b(e)).filter(Boolean);i.removeAll(),i.addMany(s)}_renderEditingInput(){const{messages:e}=this,{basemapTitle:t}=this.viewModel;return P("div",{class:g.editing},P("calcite-label",null,e.basemapTitle,P("calcite-input",{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:"basemaptitle",pattern:D,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:"text",value:t??void 0})))}_renderCancelButton(){const{messagesCommon:{cancel:e}}=this;return P("calcite-button",{appearance:"outline",bind:this,label:e,slot:"footer",title:e,width:"full",onclick:this._toggleEditingTitle},e)}_renderSubmitButton(){const{messagesCommon:e}=this;return P("calcite-button",{label:e.form.submit,slot:"footer",title:e.form.submit,type:"submit",width:"full"},e.form.ok)}_renderEditingFlowItem(){return this.editingTitle?P("calcite-flow-item",{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,selected:0===this.openedLayers.length&&0===this._openedPanelItems.length,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton()):null}_renderEditTitleButton(){const{editingTitle:e,visibleElements:t,messagesCommon:i}=this,s=i.edit;return t.editTitleButton&&!e?P("calcite-action",{bind:this,icon:"pencil",slot:"header-actions-end",text:s,title:s,onclick:this._toggleEditingTitle}):null}_renderNoLayersInfoMessage(e){return P("div",{slot:"message"},e)}_renderNoLayersInfo(e,t){return P("div",{class:g.itemMessage},P("calcite-notice",{icon:"information",key:t,kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(e)))}_renderItems(){const{collapsed:e,visible:t,visibleElements:{closeButton:i,collapseButton:s,heading:o,flow:l},messages:r,viewModel:a}=this,n=[P("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!t,collapsed:e,collapsible:s,heading:o?a.basemapTitle??r.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!this.editingTitle&&0===this.openedLayers.length&&0===this._openedPanelItems.length,onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(),this._renderBaseSection()),this._renderEditingFlowItem(),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems],d=l?P("calcite-flow",{key:"root-flow"},n):n;return t?[this.editingTitle?P("form",{bind:this,class:g.editingForm,onsubmit:this._formSubmit},d):d,this._renderItemTooltips()]:null}_renderLayerFlowItem(e,t){const{messages:i,openedLayers:s}=this,o=e.title||this.messages.untitledLayer;return P("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:o,heading:i["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),s.pop();const t=s.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderList(e,t,i){const{messages:s,dragEnabled:o,selectionMode:l,filterPlaceholder:r,baseFilterText:a,referenceFilterText:n,_baseFilterEnabled:d,_referenceFilterEnabled:c,_rootGroupUid:p}=this,m="reference"===t?s.noReferenceLayers:s.noBaseLayers,h="reference"===t?c:d;return P("calcite-block",{class:g.section,collapsible:!0,expanded:!0,heading:"reference"===t?s.referenceHeading:s.baseHeading,headingLevel:T(this.headingLevel),key:`block-${t}`},e?.length?null:this._renderNoLayersInfo(m,t),P("calcite-list",{afterCreate:e=>{"reference"===t?this._referenceListEl=e:this._baseListEl=e,e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{"reference"===t?this._referenceListEl=null:this._baseListEl=null,e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),displayMode:k,filterProps:M,[x]:t,"data-layer-type":p,dragEnabled:o,filterEnabled:h,filterPlaceholder:r,filterText:h?"reference"===t?n:a:"",group:p,key:`list-${t}`,label:s.widgetLabel,selectionAppearance:"border",selectionMode:l,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this["reference"===t?"referenceFilterText":"baseFilterText"]=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail),onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem},e?.toArray().map(e=>this._renderItem(e,i)),h?P("div",{class:g.filterNoResults,slot:"filter-no-results"},P("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(m))):null))}_renderBaseSection(){const{_visibleBaseItems:e}=this;return this.visibleElements.baseLayers?this._renderList(e,"base",1===e?.length):null}_renderReferenceSection(){return this.visibleElements.referenceLayers?this._renderList(this._visibleReferenceItems,"reference",!1):null}_toggleEditingTitle(){const{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();const t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};function j(e){return e?.closest(`[${x}]`)?.getAttribute(x)}e([c()],N.prototype,"_baseListEl",void 0),e([c()],N.prototype,"_referenceListEl",void 0),e([c()],N.prototype,"_activeItem",void 0),e([c()],N.prototype,"_tooltipReferenceMap",void 0),e([c()],N.prototype,"_focusRootFlowItem",void 0),e([c()],N.prototype,"_focusPanelFlowItem",void 0),e([c()],N.prototype,"_focusLayerFlowItem",void 0),e([c()],N.prototype,"_focusEditingFlowItem",void 0),e([c()],N.prototype,"_layerListMap",void 0),e([c()],N.prototype,"_visibleBaseItems",null),e([c()],N.prototype,"_visibleReferenceItems",null),e([c()],N.prototype,"_openedPanelItems",null),e([c()],N.prototype,"_totalBaseItems",null),e([c()],N.prototype,"_totalReferenceItems",null),e([c()],N.prototype,"_baseFilterEnabled",null),e([c()],N.prototype,"_referenceFilterEnabled",null),e([c()],N.prototype,"_renderedOpenLayerFlowItems",null),e([c()],N.prototype,"basemapTitle",null),e([c({readOnly:!0})],N.prototype,"catalogLayerList",void 0),e([c()],N.prototype,"catalogOptions",void 0),e([c()],N.prototype,"collapsed",void 0),e([c()],N.prototype,"dragEnabled",void 0),e([c()],N.prototype,"editingTitle",void 0),e([c()],N.prototype,"filterPlaceholder",void 0),e([c()],N.prototype,"baseFilterPredicate",void 0),e([c()],N.prototype,"baseFilterText",void 0),e([c()],N.prototype,"referenceFilterPredicate",void 0),e([c()],N.prototype,"referenceFilterText",void 0),e([c()],N.prototype,"listItemCanGiveFunction",void 0),e([c()],N.prototype,"listItemCanReceiveFunction",void 0),e([c()],N.prototype,"baseListItemCreatedFunction",null),e([c()],N.prototype,"headingLevel",void 0),e([c()],N.prototype,"icon",null),e([c()],N.prototype,"knowledgeGraphOptions",void 0),e([c()],N.prototype,"label",null),e([c()],N.prototype,"layerTablesEnabled",void 0),e([c()],N.prototype,"mapImageOptions",void 0),e([c(),O("esri/widgets/BasemapLayerList/t9n/BasemapLayerList")],N.prototype,"messages",void 0),e([c(),O("esri/t9n/common")],N.prototype,"messagesCommon",void 0),e([c()],N.prototype,"minFilterItems",void 0),e([c({readOnly:!0})],N.prototype,"openedLayers",void 0),e([c({readOnly:!0})],N.prototype,"openedLayerLists",void 0),e([c()],N.prototype,"referenceListItemCreatedFunction",null),e([c({readOnly:!0})],N.prototype,"tableList",void 0),e([c({readOnly:!0})],N.prototype,"baseItems",null),e([c({readOnly:!0})],N.prototype,"referenceItems",null),e([c({type:R})],N.prototype,"selectedItems",void 0),e([c()],N.prototype,"selectionMode",void 0),e([c()],N.prototype,"tileOptions",void 0),e([c()],N.prototype,"view",null),e([A("trigger-action"),c({type:h})],N.prototype,"viewModel",void 0),e([c()],N.prototype,"visibilityAppearance",void 0),e([c({type:u,nonNullable:!0})],N.prototype,"visibleElements",void 0),N=e([p("esri.widgets.BasemapLayerList")],N);const U=N;export{U as default};
2
+ import{__decorate as e}from"tslib";import t from"../core/Collection.js";import{deprecateWidget as i}from"../core/deprecate.js";import{IdentifiableMixin as s}from"../core/Identifiable.js";import o from"../core/Logger.js";import l from"../core/ReactiveMap.js";import{on as r,initial as n,watch as a,syncAndInitial as d}from"../core/reactiveUtils.js";import{property as c,subclass as p}from"../core/accessorSupport/decorators.js";import m from"./Widget.js";import h from"./BasemapLayerList/BasemapLayerListViewModel.js";import u from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as g}from"./BasemapLayerList/css.js";import f from"./LayerList/LayerListItem.js";import y from"./LayerList/ListItem.js";import{minFilterItems as _,getItem as b,getLayerType as L,removeDestroyedListItems as v,setFilterPredicate as I,sortLayersToIds as w,sortChildLayersToIds as F}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as E}from"./support/componentsUtils.js";import{globalCss as C}from"./support/globalCss.js";import{incrementHeadingLevel as T}from"./support/Heading.js";import{calciteListFilterProps as M}from"./support/listUtils.js";import{tsx as P,messageBundle as O,vmEvent as A}from"./support/widget.js";import{setFocus as B}from"./support/widgetUtils.js";const R=t.ofType(y),k="nested",D=".*\\S+.*",x="data-basemap-layer-type";let N=class extends(s(m)){constructor(e,s){super(e,s),this._baseListEl=null,this._referenceListEl=null,this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._focusEditingFlowItem=!1,this._layerListMap=new l,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`basemap-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder="",this.baseFilterPredicate=null,this.baseFilterText="",this.referenceFilterPredicate=null,this.referenceFilterText="",this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=_,this.openedLayers=new t,this.openedLayerLists=new t,this.tableList=null,this.selectedItems=new R,this.selectionMode="none",this.tileOptions=null,this.viewModel=new h({suppressDeprecationWarning:!0}),this.visibilityAppearance="default",this.visibleElements=new u,this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{const o="pull"===s?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=b(e);if(!l?.sortable)return!1;const r=b(t),n=L(t),a=b(i),d=L(i),c=!!n&&!!d&&n===d,p={selected:l,from:r,to:a},m=t.group,h=i.group,u=r?.layer?.type??"",g=a?.layer?.type??"",f=new Set(["map-image","catalog","knowledge-graph"]),y="sublayer";return m&&h&&"function"==typeof o?o.call(null,p):c&&!f.has(u)&&!f.has(g)&&l?.layer?.type!==y},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find(e=>e.classList?.contains(g.item));this._activeItem=b(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:s,dragEl:o,newIndex:l}=e;if(!s||!i||t?.newIndex===l&&t?.dragEl===o&&t?.toEl===i&&t?.fromEl===s)return;this._lastDragDetail=e,this._selectedDragItemLayerUid=o.value;const r=s,n=i;if(r===n){const e=Array.from(s.children).filter(e=>e?.matches("calcite-list-item")).map(e=>e.value);return void this._sortLayers(r,e)}null!=l&&this._moveLayerFromChildList({toEl:n,fromEl:r,dragEl:o,newIndex:l})},this.announceDeprecation=()=>{i(o.getLogger(this),"Basemap Layer List (Next)","arcgis-basemap-layer-list-next",{version:"5.0"})}}initialize(){this.addHandles([r(()=>this.openedLayers,"change",()=>this._handleOpenedLayersChange(),n),a(()=>[this.viewModel.referenceItems.toArray(),this.viewModel.baseItems.toArray()],()=>v(this.selectedItems),d),a(()=>[this.baseFilterPredicate,this._baseListEl],()=>I(this._baseListEl,this.baseFilterPredicate)),a(()=>[this.referenceFilterPredicate,this._referenceListEl],()=>I(this._referenceListEl,this.referenceFilterPredicate))])}loadDependencies(){return E({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._tooltipReferenceMap.clear(),this._destroyOpenedLayerLists()}get _visibleBaseItems(){return this.baseItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _visibleReferenceItems(){return this.referenceItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _openedPanelItems(){return this._visibleReferenceItems.concat(this._visibleBaseItems).flatten(e=>e.children).filter(({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)}get _totalBaseItems(){return this.viewModel.baseItems.flatten(e=>e.children.filter(e=>"catalog-dynamic-group"!==e.layer?.type)).length}get _totalReferenceItems(){return this.viewModel.referenceItems.flatten(e=>e.children.filter(e=>"catalog-dynamic-group"!==e.layer?.type)).length}get _baseFilterEnabled(){return this._totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this._totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map((t,i)=>this._renderLayerFlowItem(t,i===e.length-1))}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{state:e}=this.viewModel,t={[C.hidden]:"loading"===e,[C.disabled]:"disabled"===e};return P("div",{class:this.classes(g.base,C.widget,C.panel,t)},this._renderItems())}async _createCatalogLayerList(e){const{default:t}=await(import("./CatalogLayerList.js")),{headingLevel:i,catalogOptions:s,view:o,filterPlaceholder:l,minFilterItems:r,selectionMode:n,visibilityAppearance:a,_onCatalogOpen:d,_onTablesOpen:c,layerTablesEnabled:p}=this;return new t({headingLevel:i,view:o,filterPlaceholder:l,minFilterItems:r,selectionMode:n,visibilityAppearance:a,...s,catalogLayer:e,layerTablesEnabled:p,onCatalogOpen:d,onTablesOpen:c,suppressDeprecationWarning:!0})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await(import("./TableList.js")),{headingLevel:i,selectionMode:s,dragEnabled:o}=this;return new t({headingLevel:i,selectionMode:s,dragEnabled:o,...this._getTableListParams(e)})}async _createFlowList(e,t){const{_layerListMap:i}=this,s=i.get(e);if(s)return s;const o="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,o),o}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const s=new AbortController,{signal:o}=s;this._openedLayersController=s,e.forEach((i,s)=>{t.includes(s)||(i.destroy(),e.delete(s))});const l=await Promise.all(t.map(e=>this._createFlowList(e,o)));if(o.aborted)return;i.removeAll(),i.addMany(l);const r=i.at(-1);r?"catalogLayer"in r?(this._set("catalogLayerList",r),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",r)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){return e?P("calcite-tooltip",{key:`tooltip-${e.layer?.uid}`,overlayPositioning:"fixed",referenceElement:this._tooltipReferenceMap.get(e.layer?.uid),topLayerDisabled:this.topLayerDisabled},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter(e=>!e.hidden).toArray().map(e=>this._renderItemTooltipNodes(e))}_renderItemTooltips(){return this._visibleReferenceItems.concat(this._visibleBaseItems)?.toArray().map(e=>this._renderItemTooltipNodes(e))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,B(e))}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map(({title:i,panel:s},o)=>{const l=()=>this._handlePanelFlowItemBack(s);return P("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:i,heading:s.title,headingLevel:this.headingLevel,key:`flow-panel-${s.uid}`,selected:!t.length&&o===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),l()}},s.render(),P("calcite-button",{appearance:"transparent",slot:"footer-start",width:"full",onclick:l},this.messagesCommon.back))})}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,B(e))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,B(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,B(e))}_renderItem(e,t,i,s){return P(f,{activeItem:this._activeItem,canMove:this._canMove,css:g,displayMode:k,dragDisabled:t,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:i,parentTitles:s,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:s}){const o=b(i),l=b(e),r=b(t),n=j(t),a=j(e);n&&a&&this.viewModel.moveListItem({targetItem:o,fromParentItem:r,toParentItem:l,newIndex:s,from:n,to:a})}_handleCalciteListDragEnd({fromEl:e,dragEl:t,oldIndex:i}){null!=i&&e.insertBefore(t,e.children[i])}_sortLayers(e,t){if(e)if(e===this._referenceListEl||e===this._baseListEl){const i=e===this._referenceListEl?"reference":"base",s="base"===i?this.view?.map?.basemap?.baseLayers:"reference"===i?this.view?.map?.basemap?.referenceLayers:null;w(s,t)}else{const i=b(e);if(!i)return;F(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const s=e.target.selectedItems.map(e=>b(e)).filter(Boolean);i.removeAll(),i.addMany(s)}_renderEditingInput(){const{messages:e}=this,{basemapTitle:t}=this.viewModel;return P("div",{class:g.editing},P("calcite-label",null,e.basemapTitle,P("calcite-input",{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:"basemaptitle",pattern:D,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:"text",value:t??void 0})))}_renderCancelButton(){const{messagesCommon:{cancel:e}}=this;return P("calcite-button",{appearance:"outline",bind:this,label:e,slot:"footer",title:e,width:"full",onclick:this._toggleEditingTitle},e)}_renderSubmitButton(){const{messagesCommon:e}=this;return P("calcite-button",{label:e.form.submit,slot:"footer",title:e.form.submit,type:"submit",width:"full"},e.form.ok)}_renderEditingFlowItem(){return this.editingTitle?P("calcite-flow-item",{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,selected:0===this.openedLayers.length&&0===this._openedPanelItems.length,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton()):null}_renderEditTitleButton(){const{editingTitle:e,visibleElements:t,messagesCommon:i}=this,s=i.edit;return t.editTitleButton&&!e?P("calcite-action",{bind:this,icon:"pencil",slot:"header-actions-end",text:s,title:s,onclick:this._toggleEditingTitle}):null}_renderNoLayersInfoMessage(e){return P("div",{slot:"message"},e)}_renderNoLayersInfo(e,t){return P("div",{class:g.itemMessage},P("calcite-notice",{icon:"information",key:t,kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(e)))}_renderItems(){const{collapsed:e,visible:t,visibleElements:{closeButton:i,collapseButton:s,heading:o,flow:l},messages:r,viewModel:n}=this,a=[P("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!t,collapsed:e,collapsible:s,heading:o?n.basemapTitle??r.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!this.editingTitle&&0===this.openedLayers.length&&0===this._openedPanelItems.length,onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(),this._renderBaseSection()),this._renderEditingFlowItem(),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems],d=l?P("calcite-flow",{key:"root-flow"},a):a;return t?[this.editingTitle?P("form",{bind:this,class:g.editingForm,onsubmit:this._formSubmit},d):d,this._renderItemTooltips()]:null}_renderLayerFlowItem(e,t){const{messages:i,openedLayers:s}=this,o=e.title||this.messages.untitledLayer;return P("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:o,heading:i["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),s.pop();const t=s.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderList(e,t,i){const{messages:s,dragEnabled:o,selectionMode:l,filterPlaceholder:r,baseFilterText:n,referenceFilterText:a,_baseFilterEnabled:d,_referenceFilterEnabled:c,_rootGroupUid:p}=this,m="reference"===t?s.noReferenceLayers:s.noBaseLayers,h="reference"===t?c:d;return P("calcite-block",{class:g.section,collapsible:!0,expanded:!0,heading:"reference"===t?s.referenceHeading:s.baseHeading,headingLevel:T(this.headingLevel),key:`block-${t}`},e?.length?null:this._renderNoLayersInfo(m,t),P("calcite-list",{afterCreate:e=>{"reference"===t?this._referenceListEl=e:this._baseListEl=e,e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{"reference"===t?this._referenceListEl=null:this._baseListEl=null,e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),displayMode:k,filterProps:M,[x]:t,"data-layer-type":p,dragEnabled:o,filterEnabled:h,filterPlaceholder:r,filterText:h?"reference"===t?a:n:"",group:p,key:`list-${t}`,label:s.widgetLabel,selectionAppearance:"border",selectionMode:l,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this["reference"===t?"referenceFilterText":"baseFilterText"]=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail),onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem},e?.toArray().map(e=>this._renderItem(e,i)),h?P("div",{class:g.filterNoResults,slot:"filter-no-results"},P("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(m))):null))}_renderBaseSection(){const{_visibleBaseItems:e}=this;return this.visibleElements.baseLayers?this._renderList(e,"base",1===e?.length):null}_renderReferenceSection(){return this.visibleElements.referenceLayers?this._renderList(this._visibleReferenceItems,"reference",!1):null}_toggleEditingTitle(){const{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();const t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};function j(e){return e?.closest(`[${x}]`)?.getAttribute(x)}e([c()],N.prototype,"_baseListEl",void 0),e([c()],N.prototype,"_referenceListEl",void 0),e([c()],N.prototype,"_activeItem",void 0),e([c()],N.prototype,"_tooltipReferenceMap",void 0),e([c()],N.prototype,"_focusRootFlowItem",void 0),e([c()],N.prototype,"_focusPanelFlowItem",void 0),e([c()],N.prototype,"_focusLayerFlowItem",void 0),e([c()],N.prototype,"_focusEditingFlowItem",void 0),e([c()],N.prototype,"_layerListMap",void 0),e([c()],N.prototype,"_visibleBaseItems",null),e([c()],N.prototype,"_visibleReferenceItems",null),e([c()],N.prototype,"_openedPanelItems",null),e([c()],N.prototype,"_totalBaseItems",null),e([c()],N.prototype,"_totalReferenceItems",null),e([c()],N.prototype,"_baseFilterEnabled",null),e([c()],N.prototype,"_referenceFilterEnabled",null),e([c()],N.prototype,"_renderedOpenLayerFlowItems",null),e([c()],N.prototype,"basemapTitle",null),e([c({readOnly:!0})],N.prototype,"catalogLayerList",void 0),e([c()],N.prototype,"catalogOptions",void 0),e([c()],N.prototype,"collapsed",void 0),e([c()],N.prototype,"dragEnabled",void 0),e([c()],N.prototype,"editingTitle",void 0),e([c()],N.prototype,"filterPlaceholder",void 0),e([c()],N.prototype,"baseFilterPredicate",void 0),e([c()],N.prototype,"baseFilterText",void 0),e([c()],N.prototype,"referenceFilterPredicate",void 0),e([c()],N.prototype,"referenceFilterText",void 0),e([c()],N.prototype,"listItemCanGiveFunction",void 0),e([c()],N.prototype,"listItemCanReceiveFunction",void 0),e([c()],N.prototype,"baseListItemCreatedFunction",null),e([c()],N.prototype,"headingLevel",void 0),e([c()],N.prototype,"icon",null),e([c()],N.prototype,"knowledgeGraphOptions",void 0),e([c()],N.prototype,"label",null),e([c()],N.prototype,"layerTablesEnabled",void 0),e([c()],N.prototype,"mapImageOptions",void 0),e([c(),O("esri/widgets/BasemapLayerList/t9n/BasemapLayerList")],N.prototype,"messages",void 0),e([c(),O("esri/t9n/common")],N.prototype,"messagesCommon",void 0),e([c()],N.prototype,"minFilterItems",void 0),e([c({readOnly:!0})],N.prototype,"openedLayers",void 0),e([c({readOnly:!0})],N.prototype,"openedLayerLists",void 0),e([c()],N.prototype,"referenceListItemCreatedFunction",null),e([c({readOnly:!0})],N.prototype,"tableList",void 0),e([c({readOnly:!0})],N.prototype,"baseItems",null),e([c({readOnly:!0})],N.prototype,"referenceItems",null),e([c({type:R})],N.prototype,"selectedItems",void 0),e([c()],N.prototype,"selectionMode",void 0),e([c()],N.prototype,"tileOptions",void 0),e([c()],N.prototype,"view",null),e([A("trigger-action"),c({type:h})],N.prototype,"viewModel",void 0),e([c()],N.prototype,"visibilityAppearance",void 0),e([c({type:u,nonNullable:!0})],N.prototype,"visibleElements",void 0),N=e([p("esri.widgets.BasemapLayerList")],N);const U=N;export{U as default};
@@ -12,8 +12,9 @@ export interface CatalogLayerListViewModelProperties extends Partial<Pick<Catalo
12
12
  export interface CatalogLayerListViewModelEvents extends LayerListViewModelEvents {}
13
13
 
14
14
  /**
15
- * Provides the logic for the [CatalogLayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/CatalogLayerList/) widget and [component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-catalog-layer-list/).
15
+ * Provides the logic for the [CatalogLayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/CatalogLayerList/) widget and [Catalog Layer List component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-catalog-layer-list/).
16
16
  *
17
+ * @deprecated since version 5.2. Use the [Catalog Layer List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-catalog-layer-list-next/) component instead.
17
18
  * @since 4.30
18
19
  * @see [CatalogLayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/CatalogLayerList/) widget
19
20
  * @see [Catalog Layer List component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-catalog-layer-list/)