@arcgis/core 4.31.2 → 4.31.4

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.
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import"../../../geometry.js";import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as n}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as r}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{a,g as o}from"../../../chunks/vec32.js";import i from"../../../geometry/Circle.js";import s from"../../../geometry/Mesh.js";import{projectWithZConversion as c}from"../../../geometry/projection.js";import{earth as f}from"../../../geometry/support/Ellipsoid.js";import{wrap as l}from"../../../geometry/support/lineSegment.js";import m from"../../../geometry/support/MeshComponent.js";import{MeshVertexAttributes as u}from"../../../geometry/support/MeshVertexAttributes.js";import{intersectLineSegmentClamp as p,create as h,fromArray as y}from"../../../geometry/support/plane.js";import{isWebMercator as g}from"../../../geometry/support/spatialReferenceUtils.js";import{getWebMercatorScalingFactor as x,createRotationMatrixFromHPR as w,transformMat3 as M,scaleAndAddWithFactor as d,scaleWithFactor as R,computeHFOVAndVFOV as j,projectiveTransform as P}from"../transformations/utils.js";import v from"../../../geometry/Polygon.js";import A from"../../../geometry/SpatialReference.js";import D from"../../../geometry/Multipoint.js";const b=Math.PI/180;function z(e){return e.isSpherical?O(e):V(e)}function V(e){const{horizontalFieldOfView:t,verticalFieldOfView:n,geometry:r,cameraHeading:a}=e,o=x(r.y,r.spatialReference);let i=e.cameraPitch,s=e.cameraRoll??0,c=150;t>150&&(i=90,s=0,c=5);const f=Math.ceil(t/c),l=F(f,a,t);let m=e.farDistance?e.farDistance*o:e.cameraHeight*o/Math.cos(i*b);e.cameraPitch+n/2>=90&&(m=(e.farDistance||20)*o);const u=new v({spatialReference:r?.spatialReference});u.imageID=e.objectId;let p=null;for(const h of l)p=H(h,i,e.cameraHeight,r,m,o,n,t,f,u,s,e.nearDistance);return p.imageID=e.objectId,{polygon:u,frustum:p}}function F(e,t,n){const r=[];if(e%2==0)for(let a=0;a<e/2;a++)r.push(t-n/e*(a+.5),t+n/e*(a+.5));else{r.push(t);for(let a=1;a<e/2;a++)r.push(t-n/e*a,t+n/e*a)}return r.sort(),r}function H(e,i,s,c,f,l,m,u,p,h,y=0,g=0){const x=r(t(),w([e,i,y??0])),j=q({cameraHeight:s,cameraPitch:i,farDistance:f,location:c,horizontalFieldOfView:u,nearDistance:g,verticalFieldOfView:m},x),P=M([0,0,-1],x),{x:v,y:A}=c,D=d([v,A,s],P,f,l),z=2*Math.tan(m*b/2)*f,V=2*Math.tan(u/p*b/2)*f,F=M([0,1,0],x),H=M([1,0,0],x),O=R(F,z/2,l),S=R(H,V/2,l),U=a(n(),O,S),C=o(n(),O,S),k=I([o(n(),D,U),o(n(),D,C),a(n(),D,U),a(n(),D,C)],s,c,l);return k.push(k[0]),h.addRing(k),j}function I(e,t,n,r){return e.map((e=>C(e,t,n,r)))}function O(e){const{geometry:t,farDistance:n,objectId:r,nearDistance:a,cameraHeight:o}=e,c=x(t.y,t.spatialReference),f=new i({center:t.clone(),radius:n*c});if(f.imageID=r,a){const e=new i({center:t.clone(),radius:a*c});f.addRing(e.rings[0])}const l=t.clone();l.z=o-n*c;const m=s.createSphere(l,{size:2*n*c});return m.imageID=r,{polygon:f,frustum:m}}function S(e,t){return e.contains(t)}function U(e,t){return Math.sign(e)!==Math.sign(t)}function q(e,t,r){const{cameraHeight:i,cameraPitch:c,farDistance:f,location:l,horizontalFieldOfView:m,nearDistance:p,verticalFieldOfView:h}=e,y=E(l),g=c+h/2>=90==!1,x=2*Math.tan(h*b/2)*p,w=2*Math.tan(m*b/2)*p,j=2*Math.tan(h*b/2)*f,P=2*Math.tan(m*b/2)*f;let v,A;A=[0,0,-1],A=M(A,t),v=d([l.x,l.y,i],A,f,y),g&&(v[2]=0);const D=d([l.x,l.y,i],A,p,y);let z=[0,1,0];z=M(z,t);let V=[1,0,0];V=M(V,t);let F=[],H=[];p?(H=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],F=F.concat(o(n(),D,a(n(),R(z,x/2,y),R(V,w/2,y)))),F=F.concat(o(n(),D,o(n(),R(z,x/2,y),R(V,w/2,y)))),F=F.concat(a(n(),D,a(n(),R(z,x/2,y),R(V,w/2,y)))),F=F.concat(a(n(),D,o(n(),R(z,x/2,y),R(V,w/2,y))))):(F=[l.x,l.y,i],H=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),F=F.concat(o(n(),v,a(n(),R(z,j/2,y),R(V,P/2,y)))),F=F.concat(o(n(),v,o(n(),R(z,j/2,y),R(V,P/2,y)))),F=F.concat(a(n(),v,a(n(),R(z,j/2,y),R(V,P/2,y)))),F=F.concat(a(n(),v,o(n(),R(z,j/2,y),R(V,P/2,y))));const I=new u({position:Float64Array.from(F)});return new s({vertexAttributes:I,components:H,spatialReference:l.spatialReference})}function C(e,t,r,o){{const i=Math.sqrt((e[2]-t)**2+(Math.sqrt((e[0]-r.x)**2+(e[1]-r.y)**2)/o)**2)*o,s=R(a(n(),[e[0],e[1],e[2]],[r.x,r.y,t]),1/i,1/o),c=t/(t-e[2]),f={x:(1-c)*r.x+c*e[0],y:(1-c)*r.y+c*e[1],z:(1-c)*t+c*e[2]},l=Math.sqrt((f.z-t)**2+(Math.sqrt((f.x-r.x)**2+(f.y-r.y)**2)/o)**2)*o,m=R(a(n(),[f.x,f.y,f.z],[r.x,r.y,t]),1/l,1/o);return U(s[0],m[0])&&U(s[1],m[1])&&U(s[2],m[2])||e[2]>=0?[e[0],e[1],0]:[f.x,f.y,f.z]}}function k(e){const{spatialReference:t,x:n,y:r}=e.geometry,{cameraHeading:a,cameraPitch:o,farDistance:i,nearDistance:s}=e,c=E(e.geometry),f=new v({spatialReference:t}),l=Math.abs(1.44*i*c);let m=Math.abs(1.44*s*c);(o<20||null==a)&&(m=l);const u=[];return u[0]={x:n+l*Math.sin((a-45)*b),y:r+l*Math.cos((a-45)*b)},u[1]={x:n+l*Math.sin((a+45)*b),y:r+l*Math.cos((a+45)*b)},u[2]={x:n+m*Math.sin((a+135)*b),y:r+m*Math.cos((a+135)*b)},u[3]={x:n+m*Math.sin((a+225)*b),y:r+m*Math.cos((a+225)*b)},f.addRing([[u[0].x,u[0].y,0],[u[1].x,u[1].y,0],[u[2].x,u[2].y,0],[u[3].x,u[3].y,0],[u[0].x,u[0].y,0]]),f}function E(e){return e&&g(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/f.radius))):1}function L(e,t){const r=1+t/100;if("esri.geometry.Circle"===e.declaredClass){const{radius:t,center:n}=e,a=new i({radius:t*r,center:n});return e.rings.length>1&&a.addRing(e.rings[1]),a}if("esri.geometry.Polygon"===e.declaredClass){const t=new v({spatialReference:e.spatialReference}),o=e.centroid;if(o){const i=[];for(let t=0;t<e.rings[0].length;t++){const s=Math.sqrt((o.x-e.rings[0][t][0])**2+(o.y-e.rings[0][t][1])**2),c=R(a(n(),[e.rings[0][t][0],e.rings[0][t][1],0],[o.x,o.y,0]),1/s,1),f=d([o.x,o.y,0],c,s*r,1);i.push({x:f[0],y:f[1]})}t.addRing([[i[0].x,i[0].y,0],[i[1].x,i[1].y,0],[i[2].x,i[2].y,0],[i[3].x,i[3].y,0],[i[0].x,i[0].y,0]])}return t}return e}async function W(e,t,n){const{cameraHeight:r,cameraLocation:a,cameraPitch:o,frustumVertices:i,horizontalFieldOfView:s,imageHeight:c,imageWidth:f,inSRS:l,outSRS:m,verticalFieldOfView:u,cameraRoll:p,imageRotation:h,options:y}=n,g=new A(l),x=new A(m),w=j(s,u,p??0),M=i.length>15;return o+w.vfov/2>=90?await N(i,e,f,c,g,x,M,h,y):await B(i,e,t,a,r,M,g,x,y)}async function B(e,t,n,r,a,o,i,c,f){const l=G(e,t,n,r,a);if(!l)return;const{farPlane:m,nearPlane:p}=l,h=await Q([...p?.vertexPositions??e.slice(0,3),...m.vertexPositions],i,c,f);return new s({vertexAttributes:new u({position:h}),components:Z(Y(o)),spatialReference:c})}function G(e,t,n,r,a){const o=X(e),i=X(e,"near");if(!o)return;const{coefficients:s}=o,c=t.length;for(let f=0;f<c;f++){const e=T([n[f][0],n[f][1]],s),t=n[f];t[2]=(t[2]>=0?e:t[2])??0;const c=[t[0]-r[0],t[1]-r[1],t[2]-(r[2]??a)];K(r,c,f,i),J(r,c,f,o,n,e)}return{farPlane:o,nearPlane:i}}function J(e,t,r,a,o,i){const{coefficients:s,vertexPositions:c}=a;if(null!=i&&i>=0)c.splice(3*r,3,...o[r]);else{const a=n();p(s,l(e,t),a)&&c.splice(3*r,3,...a)}}function K(e,t,r,a){if(!a)return;const o=n();p(a.coefficients,l(e,t),o)&&a.vertexPositions.splice(3*r,3,...o)}async function N(e,t,n,r,a,o,i,c=0,f){const l=Math.cos((c??0)*b),m=Math.sin((c??0)*b),p=Math.abs(n*l+r*m),h=Math.abs(n*-m+r*l);let y,g,x=i?new Array:[e[0],e[1],e[2]],w=new Array;const M=t.length;for(let s=0;s<M;s++){const a=[p/2,h/2],o=t[s];g=[(o[0]-a[0])*l-(o[1]-a[1])*m+a[0],(o[0]-a[0])*m+(o[1]-a[1])*l+a[1]],i?(y=P([g[0],g[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[0],e[1],e[2]],[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]]]),x=x.concat(...y),y=P([g[0],g[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[12],e[13],e[14]],[e[15],e[16],e[17]],[e[18],e[19],e[20]],[e[21],e[22],e[23]]]),w=w.concat(...y)):(y=P([g[0],g[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]],[e[12],e[13],e[14]]]),x=x.concat(...y))}x=x.concat(w);const d=await Q(x,a,o,f);return new s({vertexAttributes:new u({position:d}),components:Z(Y(i)),spatialReference:o})}async function Q(t,n,r,a){if(n.equals(r))return t;const o=t.reduce(((e,t,n)=>{const r=Math.floor(n/3);return e[r]||(e[r]=new Array),e[r].push(t),e}),new Array),{points:i}=await c(new D(o,n),r,a);return e(a),i.flat()}function T(e,t){if(t)return(-t[3]-t[0]*e[0]-t[1]*e[1])/t[2]}function X(e,t="far"){const n=h();let r;switch(t){case"far":if(r=Array.from(15===e.length?e.slice(3):e.slice(12)),y(n,r,!1))return{coefficients:n,vertexPositions:r};break;case"near":if(r=Array.from(e.slice(0,12)),15===e.length||!y(n,r,!1))return;return{coefficients:n,vertexPositions:r}}}const Y=e=>e?[{faces:new Uint32Array([4,0,3,4,7,3])},{faces:new Uint32Array([5,1,2,5,6,2])},{faces:new Uint32Array([4,0,1,4,5,1])},{faces:new Uint32Array([6,2,3,6,7,3])}]:[{faces:new Uint32Array([0,1,2,0,2,3,0,3,4,0,4,1])}],Z=e=>e.map((e=>new m(e)));export{S as checkIfPolygonContainsSelectedPoint,k as computePolygonForInspection,z as createCoveragePolygon,I as limitZToGround,Q as projectVertices,L as resizePolygon,W as updateFrustum};
5
+ import"../../../geometry.js";import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as n}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{a as o,g as a}from"../../../chunks/vec32.js";import i from"../../../geometry/Circle.js";import c from"../../../geometry/Mesh.js";import{projectWithZConversion as s}from"../../../geometry/projection.js";import{earth as f}from"../../../geometry/support/Ellipsoid.js";import l from"../../../geometry/support/MeshComponent.js";import{MeshVertexAttributes as m}from"../../../geometry/support/MeshVertexAttributes.js";import{intersectRay as u,create as h,fromArray as p}from"../../../geometry/support/plane.js";import{isWebMercator as y}from"../../../geometry/support/spatialReferenceUtils.js";import{getWebMercatorScalingFactor as g,createRotationMatrixFromHPR as x,transformMat3 as d,scaleAndAddWithFactor as w,scaleWithFactor as M,computeHFOVAndVFOV as R,projectiveTransform as j}from"../transformations/utils.js";import v from"../../../geometry/Polygon.js";import P from"../../../geometry/SpatialReference.js";import D from"../../../geometry/Multipoint.js";const b=Math.PI/180;function A(e){return e.isSpherical?H(e):I(e)}function I(e){const{horizontalFieldOfView:t,verticalFieldOfView:r,geometry:n,cameraHeading:o}=e,a=g(n.y,n.spatialReference);let i=e.cameraPitch,c=e.cameraRoll??0,s=150;t>150&&(i=90,c=0,s=5);const f=Math.ceil(t/s),l=z(f,o,t);let m=e.farDistance?e.farDistance*a:e.cameraHeight*a/Math.cos(i*b);e.cameraPitch+r/2>=90&&(m=(e.farDistance||20)*a);const u=new v({spatialReference:n?.spatialReference});u.imageID=e.objectId;let h=null;for(const p of l)h=V(p,i,e.cameraHeight,n,m,a,r,t,f,u,c,e.nearDistance);return h.imageID=e.objectId,{polygon:u,frustum:h}}function z(e,t,r){const n=[];if(e%2==0)for(let o=0;o<e/2;o++)n.push(t-r/e*(o+.5),t+r/e*(o+.5));else{n.push(t);for(let o=1;o<e/2;o++)n.push(t-r/e*o,t+r/e*o)}return n.sort(),n}function V(e,i,c,s,f,l,m,u,h,p,y=0,g=0){const R=n(t(),x([e,i,y??0])),j=q({cameraHeight:c,cameraPitch:i,farDistance:f,location:s,horizontalFieldOfView:u,nearDistance:g,verticalFieldOfView:m},R),v=d([0,0,-1],R),{x:P,y:D}=s,A=w([P,D,c],v,f,l),I=2*Math.tan(m*b/2)*f,z=2*Math.tan(u/h*b/2)*f,V=d([0,1,0],R),H=d([1,0,0],R),O=M(V,I/2,l),S=M(H,z/2,l),C=o(r(),O,S),U=a(r(),O,S),E=F([a(r(),A,C),a(r(),A,U),o(r(),A,C),o(r(),A,U)],c,s,l);return E.push(E[0]),p.addRing(E),j}function F(e,t,r,n){return e.map((e=>C(e,t,r,n)))}function H(e){const{geometry:t,farDistance:r,objectId:n,nearDistance:o,cameraHeight:a}=e,s=g(t.y,t.spatialReference),f=new i({center:t.clone(),radius:r*s});if(f.imageID=n,o){const e=new i({center:t.clone(),radius:o*s});f.addRing(e.rings[0])}const l=t.clone();l.z=a-r*s;const m=c.createSphere(l,{size:2*r*s});return m.imageID=n,{polygon:f,frustum:m}}function O(e,t){return e.contains(t)}function S(e,t){return Math.sign(e)!==Math.sign(t)}function q(e,t,n){const{cameraHeight:i,cameraPitch:s,farDistance:f,location:l,horizontalFieldOfView:u,nearDistance:h,verticalFieldOfView:p}=e,y=E(l),g=s+p/2>=90==!1,x=2*Math.tan(p*b/2)*h,R=2*Math.tan(u*b/2)*h,j=2*Math.tan(p*b/2)*f,v=2*Math.tan(u*b/2)*f;let P,D;D=[0,0,-1],D=d(D,t),P=w([l.x,l.y,i],D,f,y),g&&(P[2]=0);const A=w([l.x,l.y,i],D,h,y);let I=[0,1,0];I=d(I,t);let z=[1,0,0];z=d(z,t);let V=[],F=[];h?(F=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],V=V.concat(a(r(),A,o(r(),M(I,x/2,y),M(z,R/2,y)))),V=V.concat(a(r(),A,a(r(),M(I,x/2,y),M(z,R/2,y)))),V=V.concat(o(r(),A,o(r(),M(I,x/2,y),M(z,R/2,y)))),V=V.concat(o(r(),A,a(r(),M(I,x/2,y),M(z,R/2,y))))):(V=[l.x,l.y,i],F=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),V=V.concat(a(r(),P,o(r(),M(I,j/2,y),M(z,v/2,y)))),V=V.concat(a(r(),P,a(r(),M(I,j/2,y),M(z,v/2,y)))),V=V.concat(o(r(),P,o(r(),M(I,j/2,y),M(z,v/2,y)))),V=V.concat(o(r(),P,a(r(),M(I,j/2,y),M(z,v/2,y))));const H=new m({position:Float64Array.from(V)});return new c({vertexAttributes:H,components:F,spatialReference:l.spatialReference})}function C(e,t,n,a){{const i=Math.sqrt((e[2]-t)**2+(Math.sqrt((e[0]-n.x)**2+(e[1]-n.y)**2)/a)**2)*a,c=M(o(r(),[e[0],e[1],e[2]],[n.x,n.y,t]),1/i,1/a),s=t/(t-e[2]),f={x:(1-s)*n.x+s*e[0],y:(1-s)*n.y+s*e[1],z:(1-s)*t+s*e[2]},l=Math.sqrt((f.z-t)**2+(Math.sqrt((f.x-n.x)**2+(f.y-n.y)**2)/a)**2)*a,m=M(o(r(),[f.x,f.y,f.z],[n.x,n.y,t]),1/l,1/a);return S(c[0],m[0])&&S(c[1],m[1])&&S(c[2],m[2])||e[2]>=0?[e[0],e[1],0]:[f.x,f.y,f.z]}}function U(e){const{spatialReference:t,x:r,y:n}=e.geometry,{cameraHeading:o,cameraPitch:a,farDistance:i,nearDistance:c}=e,s=E(e.geometry),f=new v({spatialReference:t}),l=Math.abs(1.44*i*s);let m=Math.abs(1.44*c*s);(a<20||null==o)&&(m=l);const u=[];return u[0]={x:r+l*Math.sin((o-45)*b),y:n+l*Math.cos((o-45)*b)},u[1]={x:r+l*Math.sin((o+45)*b),y:n+l*Math.cos((o+45)*b)},u[2]={x:r+m*Math.sin((o+135)*b),y:n+m*Math.cos((o+135)*b)},u[3]={x:r+m*Math.sin((o+225)*b),y:n+m*Math.cos((o+225)*b)},f.addRing([[u[0].x,u[0].y,0],[u[1].x,u[1].y,0],[u[2].x,u[2].y,0],[u[3].x,u[3].y,0],[u[0].x,u[0].y,0]]),f}function E(e){return e&&y(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/f.radius))):1}function k(e,t){const n=1+t/100;if("esri.geometry.Circle"===e.declaredClass){const{radius:t,center:r}=e,o=new i({radius:t*n,center:r});return e.rings.length>1&&o.addRing(e.rings[1]),o}if("esri.geometry.Polygon"===e.declaredClass){const t=new v({spatialReference:e.spatialReference}),a=e.centroid;if(a){const i=[];for(let t=0;t<e.rings[0].length;t++){const c=Math.sqrt((a.x-e.rings[0][t][0])**2+(a.y-e.rings[0][t][1])**2),s=M(o(r(),[e.rings[0][t][0],e.rings[0][t][1],0],[a.x,a.y,0]),1/c,1),f=w([a.x,a.y,0],s,c*n,1);i.push({x:f[0],y:f[1]})}t.addRing([[i[0].x,i[0].y,0],[i[1].x,i[1].y,0],[i[2].x,i[2].y,0],[i[3].x,i[3].y,0],[i[0].x,i[0].y,0]])}return t}return e}async function L(e,t,r){const{cameraHeight:n,cameraLocation:o,cameraPitch:a,frustumVertices:i,horizontalFieldOfView:c,imageHeight:s,imageWidth:f,inSRS:l,outSRS:m,verticalFieldOfView:u,cameraRoll:h,options:p}=r,y=new P(l),g=new P(m),x=R(c,u,h??0),d=i.length>15;return a+x.vfov/2>=90?await K(i,e,f,s,y,g,d,p):await W(i,e,t,o,n,d,y,g,p)}async function W(e,t,r,n,o,a,i,s,f){const l=B(e,t,r,n,o);if(!l)return;const{farPlane:u,nearPlane:h}=l,p=await N([...h?.vertexPositions??e.slice(0,3),...u.vertexPositions],i,s,f),y=Z(p);return new c({vertexAttributes:new m({position:p}),components:Y(a?T(y,!0):X(y,!0)),spatialReference:s})}function B(e,t,r,n,o){const a=Q(e),i=Q(e,"near");if(!a)return;const c=t.length;for(let s=0;s<c;s++){const e=Array.from(r[s]),t=[e[0]-n[0],e[1]-n[1],e[2]-(n[2]??o)];J(n,t,s,i),G(n,t,s,a)}return{farPlane:a,nearPlane:i}}function G(e,t,n,o){const{coefficients:a,vertexPositions:i}=o,c=r();u(a,{origin:e,direction:t},c)&&i.splice(3*n,3,...c)}function J(e,t,n,o){if(!o)return;const a=r();u(o.coefficients,{origin:e,direction:t},a)&&o.vertexPositions.splice(3*n,3,...a)}async function K(e,t,r,n,o,a,i,s){let f,l=i?new Array:[e[0],e[1],e[2]],u=new Array;for(const c of t)i?(f=j([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[0],e[1],e[2]],[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]]]),l=l.concat(...f),f=j([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[12],e[13],e[14]],[e[15],e[16],e[17]],[e[18],e[19],e[20]],[e[21],e[22],e[23]]]),u=u.concat(...f)):(f=j([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]],[e[12],e[13],e[14]]]),l=l.concat(...f));l=l.concat(u);const h=await N(l,o,a,s),p=Z(h);return new c({vertexAttributes:new m({position:h}),components:Y(i?T(p,!0):X(p,!0)),spatialReference:a})}async function N(t,r,n,o){if(r.equals(n))return t;const a=t.reduce(((e,t,r)=>{const n=Math.floor(r/3);return e[n]||(e[n]=new Array),e[n].push(t),e}),new Array),{points:i}=await s(new D(a,r),n,o);return e(o),i.flat()}function Q(e,t="far"){const r=h();let n;switch(t){case"far":if(n=Array.from(15===e.length?e.slice(3):e.slice(12)),p(r,n,!0))return{coefficients:r,vertexPositions:n};break;case"near":if(n=Array.from(e.slice(0,12)),15===e.length||!p(r,n,!0))return;return{coefficients:r,vertexPositions:n}}}const T=(e,t=!1)=>{if(t&&e-2<=4||e<=4||e%2!=0)throw new Error("Invalid number of vertices");const r=[],n=e/2,o=Math.round((t?e-2:e)/2);for(let a=0;a<o;a++){const o=a+n,i=t?o+1:o,c=i%e,s=(t?o:i+1)%e;r.push({faces:new Uint32Array([a,s,c,a,a+1,c])})}return r};function X(e,t=!1){if(e<3||t&&e-1<3)throw new Error("Invalid number of vertices");const r=[],n=t?e-2:e-1;for(let o=0;o<n;o++)r.push({faces:new Uint32Array([0,o+1,o+2])});return r}const Y=e=>e.map((e=>new l(e))),Z=e=>e.length/3;export{O as checkIfPolygonContainsSelectedPoint,U as computePolygonForInspection,A as createCoveragePolygon,F as limitZToGround,N as projectVertices,k as resizePolygon,L as updateFrustum};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{id as e}from"../../kernel.js";import{symbolTypesRenderer as t}from"../../symbols.js";import{resultOrAbort as r}from"../../core/asyncUtils.js";import n from"../../core/Error.js";import{JSONMap as o}from"../../core/jsonMap.js";import{parseWhereClause as s}from"../../core/sql.js";import{normalizeGlobalID as i}from"../../core/uuid.js";import{createTypeReader as a}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import{CodedValue as u}from"./CodedValue.js";import c from"./CodedValueDomain.js";import{queryAllJSON as l}from"./featureQueryAll.js";import{getOwningPortalUrl as p}from"./layerUtils.js";import d from"../../renderers/SimpleRenderer.js";import f from"../../renderers/UniqueValueRenderer.js";import y from"../../rest/support/AttachmentQuery.js";import m from"../../rest/support/Query.js";import h from"../../rest/support/RelationshipQuery.js";const w=new o({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"});async function b(e,t,r,o){const s=await T(e);if(await g(e,t,o),!s.addAttachment)throw new n(o,"Layer source does not support addAttachment capability");return s.addAttachment(t,r)}function g(e,t,r){const{attributes:o}=t,{objectIdField:s}=e;return e.capabilities?.data?.supportsAttachment?t?o?s&&o[s]?Promise.resolve():Promise.reject(new n(r,`feature is missing the identifying attribute ${s}`)):Promise.reject(new n(r,"'attributes' are required on a feature to query attachments")):Promise.reject(new n(r,"A feature is required to add/delete/update attachments")):Promise.reject(new n(r,"this layer doesn't support attachments"))}async function I(e,t,r,o,s){const i=await T(e);if(await g(e,t,s),!i.updateAttachment)throw new n(s,"Layer source does not support updateAttachment capability");return i.updateAttachment(t,r,o)}async function j(e,t,r){const{applyEdits:n}=await import("../graphics/editingSupport.js"),o=await e.load();let s=r;return"feature"===o.type&&o.infoFor3D&&null!=t.deleteFeatures&&null!=o.globalIdField&&(s={...s,globalIdToObjectId:await H(o,t.deleteFeatures,o.globalIdField)}),n(o,o.source,t,r)}async function F(e,t,r){const{uploadAssets:n}=await import("../graphics/editingSupport.js"),o=await e.load();return n(o,o.source,t,r)}async function q(e,t,r,o){const s=await T(e);if(await g(e,t,o),!s.deleteAttachments)throw new n(o,"Layer source does not support deleteAttachments capability");return s.deleteAttachments(t,r)}async function x(e,t,r){const o=(await e.load({signal:t?.signal})).source;if(!o.fetchRecomputedExtents)throw new n(r,"Layer source does not support fetchUpdates capability");return o.fetchRecomputedExtents(t)}async function A(e,t,r,o){t=y.from(t),await e.load();const s=e.source,i=e.capabilities;if(!i?.data?.supportsAttachment)throw new n(o,"this layer doesn't support attachments");const{attachmentTypes:a,objectIds:u,globalIds:c,num:l,size:p,start:d,where:f}=t;if(!i?.operations?.supportsQueryAttachments){if(a?.length>0||c?.length>0||p?.length>0||l||d||f)throw new n(o,"when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",t)}if(!(u?.length||c?.length||f))throw new n(o,"'objectIds', 'globalIds', or 'where' are required to perform attachment query",t);if(!s.queryAttachments)throw new n(o,"Layer source does not support queryAttachments capability",t);return s.queryAttachments(t)}async function v(e,t,r,o){const s=await T(e);if(!s.queryObjectIds)throw new n(o,"Layer source does not support queryObjectIds capability");return s.queryObjectIds(m.from(t)??e.createQuery(),r)}async function S(e,t,r,o){const s=await T(e);if(!s.queryFeatureCount)throw new n(o,"Layer source does not support queryFeatureCount capability");return s.queryFeatureCount(m.from(t)??e.createQuery(),r)}async function O(e,t,r,o){const s=await T(e);if(!s.queryExtent)throw new n(o,"Layer source does not support queryExtent capability");return s.queryExtent(m.from(t)??e.createQuery(),r)}async function P(e,t,r,o){const s=await T(e);if(!s.queryRelatedFeatures)throw new n(o,"Layer source does not support queryRelatedFeatures capability");return s.queryRelatedFeatures(h.from(t),r)}async function E(e,t,r,o){const s=await T(e);if(!s.queryRelatedFeaturesCount)throw new n(o,"Layer source does not support queryRelatedFeaturesCount capability");return s.queryRelatedFeaturesCount(h.from(t),r)}async function L(e){const t=e.source;if(t?.refresh)try{const{dataChanged:r,updates:n}=await t.refresh();if(null!=n&&(e.sourceJSON={...e.sourceJSON,...n},e.read(n,{origin:"service",url:e.parsedUrl})),r)return!0}catch{}if(e.definitionExpression)try{return(await s(e.definitionExpression,e.fieldsIndex)).hasDateFunctions}catch{}return!1}function C(e){const t=new m,r=e.capabilities?.data,n=e.capabilities?.query;t.historicMoment=e.historicMoment,t.gdbVersion=e.gdbVersion,t.returnGeometry=!0,n&&(t.compactGeometryEnabled=n.supportsCompactGeometry,t.defaultSpatialReferenceEnabled=n.supportsDefaultSpatialReference),r&&(r.supportsZ&&null!=e.returnZ&&(t.returnZ=e.returnZ),r.supportsM&&null!=e.returnM&&(t.returnM=e.returnM)),t.outFields=["*"];const{timeOffset:o,timeExtent:s}=e;return t.timeExtent=null!=o&&null!=s?s.offset(-o.value,o.unit):s||null,t.multipatchOption="multipatch"===e.geometryType?"xyFootprint":null,t}function R(e){const{globalIdField:t,fields:r}=e;if(t)return t;if(r)for(const n of r)if("esriFieldTypeGlobalID"===n.type)return n.name}function M(e){const{objectIdField:t,fields:r}=e;if(t)return t;if(r)for(const n of r)if("esriFieldTypeOID"===n.type)return n.name}function V(e){return e.currentVersion?e.currentVersion:e.hasOwnProperty("capabilities")||e.hasOwnProperty("drawingInfo")||e.hasOwnProperty("hasAttachments")||e.hasOwnProperty("htmlPopupType")||e.hasOwnProperty("relationships")||e.hasOwnProperty("timeInfo")||e.hasOwnProperty("typeIdField")||e.hasOwnProperty("types")?10:9.3}function D(e,t){const{subtypes:r,subtypeField:n}=e;if(!t?.attributes||!r?.length||!n)return null;const o=t.attributes[n];return null==o?null:r.find((e=>e.code===o))}function G(e,t){const{fieldsIndex:r,subtypeField:n}=e,{name:o}=r.get(t)??{};if(!o)return null;if((n&&r.get(n)?.name)===o&&e.subtypes?.length){const t=e.subtypes.map((e=>new u({code:e.code,name:e.name})));if(t?.length)return new c({codedValues:t})}return null}function Q(e,t){const{fieldsIndex:r}=e,{name:n}=r.get(t)??{};if(!n)return null;if(("typeIdField"in e?r.get(e.typeIdField)?.name:null)===n&&"types"in e&&e.types?.length){const t=e.types.map((e=>new u({code:e.id,name:e.name})));return new c({codedValues:t})}return null}async function T(e){return(await e.load()).source}async function U(t,r){if(!e)return;if(e.findCredential(t))return;let n;try{const o=await p(t,r);o&&(n=await e.checkSignInStatus(`${o}/sharing`))}catch(o){}if(n)try{const n=null!=r?r.signal:null;await e.getCredential(t,{signal:n})}catch(o){}}async function k(e,t,r){const n=e.parsedUrl?.path;n&&e.authenticationTriggerEvent===t&&await U(n,r)}function J(e){return!B(e)&&(e.userHasUpdateItemPrivileges||e.editingEnabled)}const N=a({types:t});function $(e,t){if(e.defaultSymbol)return e.types?.length?new f({defaultSymbol:N(e.defaultSymbol,e,t),field:e.typeIdField,uniqueValueInfos:e.types.map((e=>({id:e.id,symbol:N(e.symbol,e,t)})))}):new d({symbol:N(e.defaultSymbol,e,t)})}function Z(e){let t=e.sourceJSON?.cacheMaxAge;if(!t)return!1;const r=e.editingInfo?.lastEditDate?.getTime();return null==r||(t*=1e3,Date.now()-r<t)}async function H(e,t,n){if(null==t)return null;const o=[],{objectIdField:s}=e;if(t.forEach((e=>{let t=null;if("attributes"in e){const{attributes:r}=e;t={globalId:r[n],objectId:null!=r[s]&&-1!==r[s]?r[s]:null}}else t={globalId:e.globalId,objectId:null!=e.objectId&&-1!==e.objectId?e.objectId:null};null!=t.globalId&&(null!=t.objectId&&-1!==t.objectId||o.push(t.globalId))})),0===o.length)return null;const a=e.createQuery();a.where=o.map((e=>`${n}='${e}'`)).join(" OR "),a.returnGeometry=!1,a.outFields=[s,n],a.cacheHint=!1;const u=await r(l(e,a));if(!u.ok)return null;const c=new Map,p=u.value.features;for(const r of p){const e=r.attributes[n],t=r.attributes[s];null!=e&&null!=t&&-1!==t&&c.set(i(e),t)}return c}function z(e,t,r){if(!t||!r||!e)return null;const n=r.getAttribute(t);return null==n?null:e.find((e=>{const{id:t}=e;return null!=t&&t.toString()===n.toString()}))??null}function B(e){return e.sourceJSON?.isMultiServicesView||K(e)}function K(e){return!!e.sourceJSON?.capabilities?.toLowerCase().split(",").map((e=>e.trim())).includes("map")}function W(e,t,r){const o=t?.queryBins;if(!o)throw new n(r,"Layer source does not support binning");switch(e.binParameters.type){case"auto-interval":if(!o.supportsAutoInterval)throw new n(r,"Layer source does not support auto-interval binning");break;case"date":if(!o.supportsDate)throw new n(r,"Layer source does not support date binning");break;case"fixed-boundaries":if(!o.supportsFixedBoundaries)throw new n(r,"Layer source does not support fixed-boundaries binning");break;case"fixed-interval":if(!o.supportsFixedInterval)throw new n(r,"Layer source does not support fixed-interval binning")}const s=o?.supportedStatistics;if(e.outStatistics&&s){const t=new Map([["count","count"],["sum","sum"],["min","min"],["max","max"],["avg","avg"],["stddev","stddev"],["var","var"],["percentile-continuous","percentileContinuous"],["percentile-discrete","percentileDiscrete"],["centroid-aggregate","centroid"],["convex-hull-aggregate","convexHull"],["envelope-aggregate","envelope"]]);for(const{statisticType:o}of e.outStatistics){const e=t.get(o);if(e&&!s[e])throw new n(r,`Layer source does not support ${o} statistic type`)}}}export{b as addAttachment,j as applyEdits,G as computeDomainFromSubtypes,Q as computeDomainFromTypes,J as computeEffectiveEditingEnabled,$ as createDefaultRenderer,C as createQuery,q as deleteAttachments,U as ensureCredentialIfSignedIn,k as ensureLayerCredential,x as fetchRecomputedExtents,w as geometryTypeKebabDict,D as getFeatureSubtype,z as getFeatureType,H as getGlobalIdToObjectIdMap,L as hasDataChanged,Z as isLayerCacheStale,A as queryAttachments,O as queryExtent,S as queryFeatureCount,v as queryObjectIds,P as queryRelatedFeatures,E as queryRelatedFeaturesCount,R as readGlobalIdField,M as readObjectIdField,V as readVersion,B as supportsQueryOnly,I as updateAttachment,F as uploadAssets,W as validateBinsQuery};
5
+ import{id as e}from"../../kernel.js";import{symbolTypesRenderer as t}from"../../symbols.js";import{resultOrAbort as r}from"../../core/asyncUtils.js";import n from"../../core/Error.js";import{JSONMap as o}from"../../core/jsonMap.js";import{parseWhereClause as s}from"../../core/sql.js";import{normalizeGlobalID as i}from"../../core/uuid.js";import{createTypeReader as a}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import{CodedValue as u}from"./CodedValue.js";import c from"./CodedValueDomain.js";import{queryAllJSON as l}from"./featureQueryAll.js";import{isStringField as p,isIntegerField as d}from"./fieldUtils.js";import{getOwningPortalUrl as f}from"./layerUtils.js";import y from"../../renderers/SimpleRenderer.js";import m from"../../renderers/UniqueValueRenderer.js";import h from"../../rest/support/AttachmentQuery.js";import w from"../../rest/support/Query.js";import b from"../../rest/support/RelationshipQuery.js";const g=new o({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"});async function I(e,t,r,o){const s=await N(e);if(await j(e,t,o),!s.addAttachment)throw new n(o,"Layer source does not support addAttachment capability");return s.addAttachment(t,r)}function j(e,t,r){const{attributes:o}=t,{objectIdField:s}=e;return e.capabilities?.data?.supportsAttachment?t?o?s&&o[s]?Promise.resolve():Promise.reject(new n(r,`feature is missing the identifying attribute ${s}`)):Promise.reject(new n(r,"'attributes' are required on a feature to query attachments")):Promise.reject(new n(r,"A feature is required to add/delete/update attachments")):Promise.reject(new n(r,"this layer doesn't support attachments"))}async function F(e,t,r,o,s){const i=await N(e);if(await j(e,t,s),!i.updateAttachment)throw new n(s,"Layer source does not support updateAttachment capability");return i.updateAttachment(t,r,o)}async function q(e,t,r){const{applyEdits:n}=await import("../graphics/editingSupport.js"),o=await e.load();let s=r;return"feature"===o.type&&o.infoFor3D&&null!=t.deleteFeatures&&null!=o.globalIdField&&(s={...s,globalIdToObjectId:await K(o,t.deleteFeatures,o.globalIdField)}),n(o,o.source,t,r)}async function x(e,t,r){const{uploadAssets:n}=await import("../graphics/editingSupport.js"),o=await e.load();return n(o,o.source,t,r)}async function A(e,t,r,o){const s=await N(e);if(await j(e,t,o),!s.deleteAttachments)throw new n(o,"Layer source does not support deleteAttachments capability");return s.deleteAttachments(t,r)}async function v(e,t,r){const o=(await e.load({signal:t?.signal})).source;if(!o.fetchRecomputedExtents)throw new n(r,"Layer source does not support fetchUpdates capability");return o.fetchRecomputedExtents(t)}async function S(e,t,r,o){t=h.from(t),await e.load();const s=e.source,i=e.capabilities;if(!i?.data?.supportsAttachment)throw new n(o,"this layer doesn't support attachments");const{attachmentTypes:a,objectIds:u,globalIds:c,num:l,size:p,start:d,where:f}=t;if(!i?.operations?.supportsQueryAttachments){if(a?.length>0||c?.length>0||p?.length>0||l||d||f)throw new n(o,"when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",t)}if(!(u?.length||c?.length||f))throw new n(o,"'objectIds', 'globalIds', or 'where' are required to perform attachment query",t);if(!s.queryAttachments)throw new n(o,"Layer source does not support queryAttachments capability",t);return s.queryAttachments(t)}async function O(e,t,r,o){const s=await N(e);if(!s.queryObjectIds)throw new n(o,"Layer source does not support queryObjectIds capability");return s.queryObjectIds(w.from(t)??e.createQuery(),r)}async function P(e,t,r,o){const s=await N(e);if(!s.queryFeatureCount)throw new n(o,"Layer source does not support queryFeatureCount capability");return s.queryFeatureCount(w.from(t)??e.createQuery(),r)}async function E(e,t,r,o){const s=await N(e);if(!s.queryExtent)throw new n(o,"Layer source does not support queryExtent capability");return s.queryExtent(w.from(t)??e.createQuery(),r)}async function L(e,t,r,o){const s=await N(e);if(!s.queryRelatedFeatures)throw new n(o,"Layer source does not support queryRelatedFeatures capability");return s.queryRelatedFeatures(b.from(t),r)}async function C(e,t,r,o){const s=await N(e);if(!s.queryRelatedFeaturesCount)throw new n(o,"Layer source does not support queryRelatedFeaturesCount capability");return s.queryRelatedFeaturesCount(b.from(t),r)}async function R(e){const t=e.source;if(t?.refresh)try{const{dataChanged:r,updates:n}=await t.refresh();if(null!=n&&(e.sourceJSON={...e.sourceJSON,...n},e.read(n,{origin:"service",url:e.parsedUrl})),r)return!0}catch{}if(e.definitionExpression)try{return(await s(e.definitionExpression,e.fieldsIndex)).hasDateFunctions}catch{}return!1}function M(e){const t=new w,r=e.capabilities?.data,n=e.capabilities?.query;t.historicMoment=e.historicMoment,t.gdbVersion=e.gdbVersion,t.returnGeometry=!0,n&&(t.compactGeometryEnabled=n.supportsCompactGeometry,t.defaultSpatialReferenceEnabled=n.supportsDefaultSpatialReference),r&&(r.supportsZ&&null!=e.returnZ&&(t.returnZ=e.returnZ),r.supportsM&&null!=e.returnM&&(t.returnM=e.returnM)),t.outFields=["*"];const{timeOffset:o,timeExtent:s}=e;return t.timeExtent=null!=o&&null!=s?s.offset(-o.value,o.unit):s||null,t.multipatchOption="multipatch"===e.geometryType?"xyFootprint":null,t}function V(e){const{globalIdField:t,fields:r}=e;if(t)return t;if(r)for(const n of r)if("esriFieldTypeGlobalID"===n.type)return n.name}function D(e){const{objectIdField:t,fields:r}=e;if(t)return t;if(r)for(const n of r)if("esriFieldTypeOID"===n.type)return n.name}function G(e){return e.currentVersion?e.currentVersion:e.hasOwnProperty("capabilities")||e.hasOwnProperty("drawingInfo")||e.hasOwnProperty("hasAttachments")||e.hasOwnProperty("htmlPopupType")||e.hasOwnProperty("relationships")||e.hasOwnProperty("timeInfo")||e.hasOwnProperty("typeIdField")||e.hasOwnProperty("types")?10:9.3}function Q(e,t){const{subtypes:r,subtypeField:n}=e;if(!t?.attributes||!r?.length||!n)return null;const o=t.attributes[n];return null==o?null:r.find((e=>e.code===o))}function T(e,t){const{fieldsIndex:r,subtypeField:n}=e,{name:o,type:s}=r.get(t)??{};if(!o)return null;if((n&&r.get(n)?.name)===o&&e.subtypes?.length){const t=e.subtypes.map((e=>new u({code:k(e.code,s),name:e.name})));if(t?.length)return new c({codedValues:t})}return null}function U(e,t){const{fieldsIndex:r}=e,{name:n,type:o}=r.get(t)??{};if(!n)return null;if(("typeIdField"in e?r.get(e.typeIdField)?.name:null)===n&&"types"in e&&e.types?.length){const t=e.types.map((e=>new u({code:k(e.id,o),name:e.name})));return new c({codedValues:t})}return null}function k(e,t){return t?p({type:t})&&"number"==typeof e?`${e}`:d({type:t})&&"string"==typeof e?Number.parseInt(e,10):e:e}async function N(e){return(await e.load()).source}async function $(t,r){if(!e)return;if(e.findCredential(t))return;let n;try{const o=await f(t,r);o&&(n=await e.checkSignInStatus(`${o}/sharing`))}catch(o){}if(n)try{const n=null!=r?r.signal:null;await e.getCredential(t,{signal:n})}catch(o){}}async function J(e,t,r){const n=e.parsedUrl?.path;n&&e.authenticationTriggerEvent===t&&await $(n,r)}function Z(e){return!X(e)&&(e.userHasUpdateItemPrivileges||e.editingEnabled)}const H=a({types:t});function z(e,t){if(e.defaultSymbol)return e.types?.length?new m({defaultSymbol:H(e.defaultSymbol,e,t),field:e.typeIdField,uniqueValueInfos:e.types.map((e=>({id:e.id,symbol:H(e.symbol,e,t)})))}):new y({symbol:H(e.defaultSymbol,e,t)})}function B(e){let t=e.sourceJSON?.cacheMaxAge;if(!t)return!1;const r=e.editingInfo?.lastEditDate?.getTime();return null==r||(t*=1e3,Date.now()-r<t)}async function K(e,t,n){if(null==t)return null;const o=[],{objectIdField:s}=e;if(t.forEach((e=>{let t=null;if("attributes"in e){const{attributes:r}=e;t={globalId:r[n],objectId:null!=r[s]&&-1!==r[s]?r[s]:null}}else t={globalId:e.globalId,objectId:null!=e.objectId&&-1!==e.objectId?e.objectId:null};null!=t.globalId&&(null!=t.objectId&&-1!==t.objectId||o.push(t.globalId))})),0===o.length)return null;const a=e.createQuery();a.where=o.map((e=>`${n}='${e}'`)).join(" OR "),a.returnGeometry=!1,a.outFields=[s,n],a.cacheHint=!1;const u=await r(l(e,a));if(!u.ok)return null;const c=new Map,p=u.value.features;for(const r of p){const e=r.attributes[n],t=r.attributes[s];null!=e&&null!=t&&-1!==t&&c.set(i(e),t)}return c}function W(e,t,r){if(!t||!r||!e)return null;const n=r.getAttribute(t);return null==n?null:e.find((e=>{const{id:t}=e;return null!=t&&t.toString()===n.toString()}))??null}function X(e){return e.sourceJSON?.isMultiServicesView||Y(e)}function Y(e){return!!e.sourceJSON?.capabilities?.toLowerCase().split(",").map((e=>e.trim())).includes("map")}function _(e,t,r){const o=t?.queryBins;if(!o)throw new n(r,"Layer source does not support binning");switch(e.binParameters.type){case"auto-interval":if(!o.supportsAutoInterval)throw new n(r,"Layer source does not support auto-interval binning");break;case"date":if(!o.supportsDate)throw new n(r,"Layer source does not support date binning");break;case"fixed-boundaries":if(!o.supportsFixedBoundaries)throw new n(r,"Layer source does not support fixed-boundaries binning");break;case"fixed-interval":if(!o.supportsFixedInterval)throw new n(r,"Layer source does not support fixed-interval binning")}const s=o?.supportedStatistics;if(e.outStatistics&&s){const t=new Map([["count","count"],["sum","sum"],["min","min"],["max","max"],["avg","avg"],["stddev","stddev"],["var","var"],["percentile-continuous","percentileContinuous"],["percentile-discrete","percentileDiscrete"],["centroid-aggregate","centroid"],["convex-hull-aggregate","convexHull"],["envelope-aggregate","envelope"]]);for(const{statisticType:o}of e.outStatistics){const e=t.get(o);if(e&&!s[e])throw new n(r,`Layer source does not support ${o} statistic type`)}}}export{I as addAttachment,q as applyEdits,T as computeDomainFromSubtypes,U as computeDomainFromTypes,Z as computeEffectiveEditingEnabled,z as createDefaultRenderer,M as createQuery,A as deleteAttachments,$ as ensureCredentialIfSignedIn,J as ensureLayerCredential,v as fetchRecomputedExtents,g as geometryTypeKebabDict,Q as getFeatureSubtype,W as getFeatureType,K as getGlobalIdToObjectIdMap,R as hasDataChanged,B as isLayerCacheStale,S as queryAttachments,E as queryExtent,P as queryFeatureCount,O as queryObjectIds,L as queryRelatedFeatures,C as queryRelatedFeaturesCount,V as readGlobalIdField,D as readObjectIdField,G as readVersion,X as supportsQueryOnly,F as updateAttachment,x as uploadAssets,_ as validateBinsQuery};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.31.2",
3
+ "version": "4.31.4",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- const b="20241114",d="b4d9444bbe7bad37d65e78a285498f955cb78956";export{b as buildDate,d as commitHash};
5
+ const d="20241118",f="fbfe150d1e815fa4780069dcc5f49b0d03d44667";export{d as buildDate,f as commitHash};
package/widgets/Editor.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{deprecatedProperty as t}from"../core/deprecate.js";import s from"../core/Logger.js";import{mappedFind as o}from"../core/maybe.js";import{createResolver as i}from"../core/promiseUtils.js";import{watch as r,initial as a,on as n,when as l}from"../core/reactiveUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import p from"../views/interactive/sketch/SketchValueOptions.js";import c from"./Attachments.js";import h from"./FeatureForm.js";import u from"./FeatureTemplates.js";import g from"./Spinner.js";import w from"./Widget.js";import{css as f}from"./Editor/css.js";import v from"./Editor/EditorViewModel.js";import{isModelUpload as _}from"./Editor/modelUploadUtils.js";import y from"./Editor/VisibleElements.js";import{loadCreateFeaturesPanelContentComponents as k,CreateFeaturesPanelContent as F}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as M,FeatureList as b}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as A,FooterActions as W}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as C,Notice as E}from"./Editor/components/Notices.js";import{loadPanelContentComponents as P,PanelContent as T,PanelContentSection as j,PanelContentMessage as L}from"./Editor/components/PanelContent.js";import{PanelToolbar as I,loadPanelToolbarComponents as U}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as S,Prompt as O}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as D,UpdateFeaturePanelContent as x}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as V,UploadDetails as B}from"./Editor/components/UploadDetails.js";import{renderItem as G}from"./FeatureTemplates/ItemList.js";import{loadCalciteComponents as R}from"./support/componentsUtils.js";import{globalCss as q}from"./support/globalCss.js";import{incrementHeadingLevel as H,Heading as N}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as z}from"./support/decorators/messageBundle.js";import{vmEvent as $}from"./support/decorators/vmEvent.js";import{tsx as J}from"./support/jsxFactory.js";import{substitute as K}from"../intl/substitute.js";let Q=class extends w{constructor(e,t){super(e,t),this._featureForm=new h,this._attachments=new c({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._featureTemplates=new u({enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?J("calcite-icon",{class:f.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new g,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.supportingWidgetDefaults=null,this.viewModel=new v,this.visibleElements=new y,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureForm=()=>this._featureForm.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSelectIcon=()=>J("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t},...s)=>{const{visibleElements:o}=this;return J("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,onCalciteFlowItemBack:this._onBack},o.settingsMenu?J(I,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:o}):null,...s)},this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this;return"create-features"===t?.type&&_(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):this._showPromptAndWait({title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing})},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteFeatureFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepFeature,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then((()=>e.back())))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then((()=>e.back())))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this.addHandles([r((()=>H(this.headingLevel)),(e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e}),a),n((()=>this.viewModel.activeWorkflow),"cancel-request",(({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then((t=>t?e.allow():e.deny()))})),l((()=>this.viewModel.featureFormViewModel),(e=>{this._featureForm.viewModel=e}),a),r((()=>this.viewModel),(e=>{this._attachments.viewModel=e?.attachmentsViewModel??null,this._featureTemplates.viewModel=e?.featureTemplatesViewModel??null,this._spinner.viewModel=e?.spinnerViewModel??null,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt}),a),r((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,s),e?.ui.add(this._spinner,{key:s,position:"manual"})}),a),r((()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel]),(([e])=>{e&&(this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel?.set(e.sketch))}),a),l((()=>this._attachments?.error),(e=>this._onAttachmentsError(e))),l((()=>this.viewModel?.failures),(e=>{const{messages:t}=this,[{error:s,retry:o,cancel:i}]=e;this._showPrompt({title:t.errorWarningTitle,message:K(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{o(),this._clearPrompt()}},secondary:{label:t.ignore,action:()=>{i(),this._clearPrompt()}}}})})),r((()=>this.viewModel?.state),(e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}})),r((()=>this.viewModel.featureFormDisabled),(e=>this._featureForm.disabled=e))])}destroy(){this._attachments.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy()}loadDependencies(){return Promise.all([R({"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js")}),k(),M(),A(),C(),P(),U(),S(),D(),V()])}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get _loading(){const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting}get activeWorkflow(){return this.viewModel.activeWorkflow}get allowedWorkflows(){return this.viewModel.allowedWorkflows}set allowedWorkflows(e){t(s.getLogger(this),"allowedWorkflows",{replacement:"visibleElements",version:"4.29",warnOnce:!0}),this.viewModel.allowedWorkflows=e}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{viewModel:e}=this,t=this.classes(f.base,q.widget,q.panel);return e?J("div",{class:t,key:"base"},J("calcite-flow",{key:"flow"},e.pageStack.map((e=>this._renderPage(e)))),this._prompt?J(O,{...this._prompt,headingLevel:this.headingLevel}):void 0):J("div",{class:t,key:"empty"})}_renderPage(e){switch(e){case"disabled":break;case"ready":return this._renderReady();case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo();case"creating-features-upload-details":return this._renderUploadDetails();case"creating-features":return this._renderCreatingFeatures();case"editing-existing-feature":case"editing-attributes":return this._renderUpdateFeature();case"awaiting-update-feature-candidate":return this._renderFeatureList();case"adding-attachment":return this._renderAttachmentAdding();case"editing-attachment":return this._renderAttachmentEditing()}return J("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(){const{EditorPanel:e,messages:t}=this;return J(e,{heading:t.selectTemplate,key:"templates-panel"},J(T,{key:"feature-templates"},J(j,null,this._renderFeatureTemplates())))}_renderUploadDetails(){const{EditorPanel:e,activeWorkflow:t,messages:s}=this;if("create-features"!==t?.type)return null;const o=t.data.upload;return o?J(e,{heading:s.createFeatures,key:"upload-details-panel"},J(B,{helpMessage:this._helpMessage,messages:s,upload:o})):null}_renderCreatingFeatures(){const{EditorPanel:e,activeWorkflow:t,messages:s,messagesCommon:o,headingLevel:i,viewModel:r}=this;if(!t)return null;const a="create-features"===t.type&&t.numPendingFeatures>0||"update"===t.type&&"create-features"===t?.activeWorkflow?.type&&t.activeWorkflow?.numPendingFeatures>0;return J(e,{heading:s.createFeatures,key:"create-features-panel"},a?J(x,{editorViewModel:r,headingLevel:i,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderFeatureForm:this._renderFeatureForm,onDelete:this._onDelete,onSave:this._onSave}):J(F,{helpMessage:this._helpMessage}))}_renderUpdateFeature(){const{EditorPanel:e,messages:t,messagesCommon:s,headingLevel:o,viewModel:i}=this;return J(e,{heading:t.editFeature,key:"update-feature-panel"},J(x,{editorViewModel:i,headingLevel:o,messages:t,messagesCommon:s,renderAttachments:this._renderAttachments,renderFeatureForm:this._renderFeatureForm,onDelete:this._onDelete,onSave:this._onSave}))}_renderCustomTemplateGroupContent(e){const{messages:t,viewModel:s}=this,i=o(e.group.items,(e=>s.itemHasInvalidFormTemplate(e)?t.formFieldCreateError:void 0));return i?J(E,{kind:"warning",message:i}):null}_renderAttachmentAdding(){const{EditorPanel:e,_attachments:t,messages:s,messagesCommon:o}=this;return J(e,{heading:s.addAttachment,key:"attachment-adding-panel"},J(T,{key:"attachments"},this._renderAttachments()),J(W,{buttons:[{label:t.submitting?o.cancel:o.add,disabled:t.submitting||!t.selectedFile,onClick:this._onAttachmentAdd}]}))}_renderAttachmentEditing(){const{EditorPanel:e,_attachments:t,activeWorkflow:s,messages:o,messagesCommon:i}=this;return s?J(e,{heading:o.editAttachment,key:"attachment-editing-panel"},J(T,{key:"attachments"},this._renderAttachments()),s.shouldAllowAttachmentEditing?J(W,{buttons:[{label:i.update,disabled:t.submitting||!t.selectedFile,onClick:this._onAttachmentUpdate},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:t.submitting,label:i.delete}]}):void 0):null}_renderReady(){const{EditorPanel:e,messages:t,viewModel:s,visibleElements:o}=this,i=this._helpMessage;return J(e,{heading:t.widgetLabel,key:"landing-panel"},J(T,{key:"landing-content"},s.editorItems.length?[o.editFeaturesSection?J(j,{key:"edit-actions"},this._renderUpdateActions()):null,o.createFeaturesSection&&s.canCreateVisible?J(j,{key:"create-actions"},this._renderCreateActions()):null]:J(L,{key:"no-content"},t.noEditableLayers)),i?J("div",{class:f.helpMessage,key:"footer-actions",slot:"footer"},i):void 0)}get _helpMessage(){const{activeWorkflow:e,messages:t,view:s}=this,o=e?.helpMessage;return o?t["3d"===s?.type?"helpMessages3d":"helpMessages2d"]?.[o]:void 0}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:s}=this,o={id:"select",label:t.select};return J("div",{class:f.updateActions,key:"update-actions"},J(N,{level:H(this.headingLevel)},e.editFeatures),J("calcite-list",{class:f.updateActionsList,selectionAppearance:"border",selectionMode:"single"},G({disabled:!s.canUpdateVisible,grouped:!1,item:o,selectedItem:"awaiting-feature-to-update"===s.activeWorkflow?.stepId?o:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return J("div",{key:"create-actions"},J(N,{level:H(this.headingLevel)},this.messages.createFeatures),J("div",{class:f.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(){const{EditorPanel:e,viewModel:t}=this,{activeWorkflow:s}=t;if("update"!==s?.type)return null;const o=s.data.candidates,i=K(this.messages.multipleFeaturesTemplate,{total:o.length});return J(e,{heading:i,key:"feature-list"},J(b,{editorItems:t.editorItems,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:s,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,s)=>t.selectFeature(e,s)}))}_showPromptAndWait({title:e,message:t,yesLabel:s,noLabel:o}){const r=i(),{view:a}=this,n=a?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:s,action:()=>r.resolve(!0)},secondary:{label:o,action:()=>r.resolve(!1)}}}),r.promise.finally((()=>{this._clearPrompt(),n&&a?.focus()}))}};e([d()],Q.prototype,"_featureForm",void 0),e([d()],Q.prototype,"_attachments",void 0),e([d()],Q.prototype,"_featureTemplates",void 0),e([d()],Q.prototype,"_filterText",void 0),e([d()],Q.prototype,"_prompt",void 0),e([d()],Q.prototype,"_spinner",void 0),e([d()],Q.prototype,"_deleteButtonCommonInfo",null),e([d()],Q.prototype,"_loading",null),e([d({readOnly:!0})],Q.prototype,"activeWorkflow",null),e([d()],Q.prototype,"allowedWorkflows",null),e([d()],Q.prototype,"headingLevel",void 0),e([d()],Q.prototype,"hideTemplatesForInactiveLayers",null),e([d()],Q.prototype,"icon",null),e([d()],Q.prototype,"label",null),e([d()],Q.prototype,"labelOptions",null),e([d()],Q.prototype,"layerInfos",null),e([d(),z("esri/widgets/Editor/t9n/Editor")],Q.prototype,"messages",void 0),e([d(),z("esri/t9n/common")],Q.prototype,"messagesCommon",void 0),e([d(),z("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],Q.prototype,"messagesTemplates",void 0),e([d()],Q.prototype,"snappingOptions",null),e([d()],Q.prototype,"tooltipOptions",null),e([d()],Q.prototype,"supportingWidgetDefaults",void 0),e([d({type:p,nonNullable:!0})],Q.prototype,"valueOptions",null),e([d()],Q.prototype,"view",null),e([d(),$(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],Q.prototype,"viewModel",void 0),e([d({type:y,nonNullable:!0})],Q.prototype,"visibleElements",void 0),e([d()],Q.prototype,"_helpMessage",null),Q=e([m("esri.widgets.Editor")],Q);const X=Q;export{X as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{deprecatedProperty as t}from"../core/deprecate.js";import{handlesGroup as s,makeHandle as o}from"../core/handleUtils.js";import i from"../core/Logger.js";import{mappedFind as r}from"../core/maybe.js";import{createResolver as a}from"../core/promiseUtils.js";import{watch as n,initial as l,on as d,when as m,syncAndInitial as c}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import u from"../views/interactive/sketch/SketchValueOptions.js";import g from"./Attachments.js";import w from"./FeatureForm.js";import f from"./FeatureTemplates.js";import v from"./Spinner.js";import _ from"./Widget.js";import{css as y}from"./Editor/css.js";import k from"./Editor/EditorViewModel.js";import{isModelUpload as F}from"./Editor/modelUploadUtils.js";import M from"./Editor/VisibleElements.js";import{loadCreateFeaturesPanelContentComponents as b,CreateFeaturesPanelContent as A}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as W,FeatureList as C}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as E,FooterActions as T}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as P,Notice as j}from"./Editor/components/Notices.js";import{loadPanelContentComponents as L,PanelContent as I,PanelContentSection as U,PanelContentMessage as S}from"./Editor/components/PanelContent.js";import{PanelToolbar as D,loadPanelToolbarComponents as O}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as x,Prompt as V}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as B,UpdateFeaturePanelContent as G}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as R,UploadDetails as q}from"./Editor/components/UploadDetails.js";import{renderItem as H}from"./FeatureTemplates/ItemList.js";import{loadCalciteComponents as N}from"./support/componentsUtils.js";import{globalCss as z}from"./support/globalCss.js";import{incrementHeadingLevel as $,Heading as J}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as K}from"./support/decorators/messageBundle.js";import{vmEvent as Q}from"./support/decorators/vmEvent.js";import{tsx as X}from"./support/jsxFactory.js";import{substitute as Y}from"../intl/substitute.js";let Z=class extends _{constructor(e,t){super(e,t),this._featureForm=new w,this._attachments=new g({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._featureTemplates=new f({enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?X("calcite-icon",{class:y.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new v,this._loading=!1,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.supportingWidgetDefaults=null,this.viewModel=new k,this.visibleElements=new M,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureForm=()=>this._featureForm.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSelectIcon=()=>X("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t},...s)=>{const{visibleElements:o}=this;return X("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,onCalciteFlowItemBack:this._onBack},o.settingsMenu?X(D,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:o}):null,...s)},this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this;return"create-features"===t?.type&&F(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):this._showPromptAndWait({title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing})},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteFeatureFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepFeature,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then((()=>e.back())))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then((()=>e.back())))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this.addHandles([n((()=>$(this.headingLevel)),(e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e}),l),d((()=>this.viewModel.activeWorkflow),"cancel-request",(({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then((t=>t?e.allow():e.deny()))})),m((()=>this.viewModel.featureFormViewModel),(e=>{this._featureForm.viewModel=e}),l),n((()=>this.viewModel),(e=>{this._attachments.viewModel=e?.attachmentsViewModel??null,this._featureTemplates.viewModel=e?.featureTemplatesViewModel??null,this._spinner.viewModel=e?.spinnerViewModel??null,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt}),l),n((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,s),e?.ui.add(this._spinner,{key:s,position:"manual"})}),l),n((()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel]),(([e])=>{e&&(this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel?.set(e.sketch))}),l),m((()=>this._attachments?.error),(e=>this._onAttachmentsError(e))),m((()=>this.viewModel?.failures),(e=>{const{messages:t}=this,[{error:s,retry:o,cancel:i}]=e;this._showPrompt({title:t.errorWarningTitle,message:Y(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{o(),this._clearPrompt()}},secondary:{label:t.ignore,action:()=>{i(),this._clearPrompt()}}}})})),n((()=>this.viewModel?.state),(e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}})),n((()=>this.viewModel.featureFormDisabled),(e=>this._featureForm.disabled=e)),this._connectDelayedLoading()])}destroy(){this._attachments.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy()}loadDependencies(){return Promise.all([N({"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js")}),b(),W(),E(),P(),L(),O(),x(),B(),R()])}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}_connectDelayedLoading(){const e=250;let t;return s([n((()=>{const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting}),(s=>{clearTimeout(t),t=void 0,s?t=setTimeout((()=>{clearTimeout(t),t=void 0,this._loading=s}),e):this._loading=s}),c),o((()=>clearTimeout(t)))])}get activeWorkflow(){return this.viewModel.activeWorkflow}get allowedWorkflows(){return this.viewModel.allowedWorkflows}set allowedWorkflows(e){t(i.getLogger(this),"allowedWorkflows",{replacement:"visibleElements",version:"4.29",warnOnce:!0}),this.viewModel.allowedWorkflows=e}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{viewModel:e}=this,t=this.classes(y.base,z.widget,z.panel);return e?X("div",{class:t,key:"base"},X("calcite-flow",{key:"flow"},e.pageStack.map((e=>this._renderPage(e)))),this._prompt?X(V,{...this._prompt,headingLevel:this.headingLevel}):void 0):X("div",{class:t,key:"empty"})}_renderPage(e){switch(e){case"disabled":break;case"ready":return this._renderReady();case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo();case"creating-features-upload-details":return this._renderUploadDetails();case"creating-features":return this._renderCreatingFeatures();case"editing-existing-feature":case"editing-attributes":return this._renderUpdateFeature();case"awaiting-update-feature-candidate":return this._renderFeatureList();case"adding-attachment":return this._renderAttachmentAdding();case"editing-attachment":return this._renderAttachmentEditing()}return X("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(){const{EditorPanel:e,messages:t}=this;return X(e,{heading:t.selectTemplate,key:"templates-panel"},X(I,{key:"feature-templates"},X(U,null,this._renderFeatureTemplates())))}_renderUploadDetails(){const{EditorPanel:e,activeWorkflow:t,messages:s}=this;if("create-features"!==t?.type)return null;const o=t.data.upload;return o?X(e,{heading:s.createFeatures,key:"upload-details-panel"},X(q,{helpMessage:this._helpMessage,messages:s,upload:o})):null}_renderCreatingFeatures(){const{EditorPanel:e,activeWorkflow:t,messages:s,messagesCommon:o,headingLevel:i,viewModel:r}=this;if(!t)return null;const a="create-features"===t.type&&t.numPendingFeatures>0||"update"===t.type&&"create-features"===t?.activeWorkflow?.type&&t.activeWorkflow?.numPendingFeatures>0;return X(e,{heading:s.createFeatures,key:"create-features-panel"},a?X(G,{editorViewModel:r,headingLevel:i,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderFeatureForm:this._renderFeatureForm,onDelete:this._onDelete,onSave:this._onSave}):X(A,{helpMessage:this._helpMessage}))}_renderUpdateFeature(){const{EditorPanel:e,messages:t,messagesCommon:s,headingLevel:o,viewModel:i}=this;return X(e,{heading:t.editFeature,key:"update-feature-panel"},X(G,{editorViewModel:i,headingLevel:o,messages:t,messagesCommon:s,renderAttachments:this._renderAttachments,renderFeatureForm:this._renderFeatureForm,onDelete:this._onDelete,onSave:this._onSave}))}_renderCustomTemplateGroupContent(e){const{messages:t,viewModel:s}=this,o=r(e.group.items,(e=>s.itemHasInvalidFormTemplate(e)?t.formFieldCreateError:void 0));return o?X(j,{kind:"warning",message:o}):null}_renderAttachmentAdding(){const{EditorPanel:e,_attachments:t,messages:s,messagesCommon:o}=this;return X(e,{heading:s.addAttachment,key:"attachment-adding-panel"},X(I,{key:"attachments"},this._renderAttachments()),X(T,{buttons:[{label:t.submitting?o.cancel:o.add,disabled:t.submitting||!t.selectedFile,onClick:this._onAttachmentAdd}]}))}_renderAttachmentEditing(){const{EditorPanel:e,_attachments:t,activeWorkflow:s,messages:o,messagesCommon:i}=this;return s?X(e,{heading:o.editAttachment,key:"attachment-editing-panel"},X(I,{key:"attachments"},this._renderAttachments()),s.shouldAllowAttachmentEditing?X(T,{buttons:[{label:i.update,disabled:t.submitting||!t.selectedFile,onClick:this._onAttachmentUpdate},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:t.submitting,label:i.delete}]}):void 0):null}_renderReady(){const{EditorPanel:e,messages:t,viewModel:s,visibleElements:o}=this,i=this._helpMessage;return X(e,{heading:t.widgetLabel,key:"landing-panel"},X(I,{key:"landing-content"},s.editorItems.length?[o.editFeaturesSection?X(U,{key:"edit-actions"},this._renderUpdateActions()):null,o.createFeaturesSection&&s.canCreateVisible?X(U,{key:"create-actions"},this._renderCreateActions()):null]:X(S,{key:"no-content"},t.noEditableLayers)),i?X("div",{class:y.helpMessage,key:"footer-actions",slot:"footer"},i):void 0)}get _helpMessage(){const{activeWorkflow:e,messages:t,view:s}=this,o=e?.helpMessage;return o?t["3d"===s?.type?"helpMessages3d":"helpMessages2d"]?.[o]:void 0}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:s}=this,o={id:"select",label:t.select};return X("div",{class:y.updateActions,key:"update-actions"},X(J,{level:$(this.headingLevel)},e.editFeatures),X("calcite-list",{class:y.updateActionsList,selectionAppearance:"border",selectionMode:"single"},H({disabled:!s.canUpdateVisible,grouped:!1,item:o,selectedItem:"awaiting-feature-to-update"===s.activeWorkflow?.stepId?o:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return X("div",{key:"create-actions"},X(J,{level:$(this.headingLevel)},this.messages.createFeatures),X("div",{class:y.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(){const{EditorPanel:e,viewModel:t}=this,{activeWorkflow:s}=t;if("update"!==s?.type)return null;const o=s.data.candidates,i=Y(this.messages.multipleFeaturesTemplate,{total:o.length});return X(e,{heading:i,key:"feature-list"},X(C,{editorItems:t.editorItems,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:s,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,s)=>t.selectFeature(e,s)}))}_showPromptAndWait({title:e,message:t,yesLabel:s,noLabel:o}){const i=a(),{view:r}=this,n=r?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:s,action:()=>i.resolve(!0)},secondary:{label:o,action:()=>i.resolve(!1)}}}),i.promise.finally((()=>{this._clearPrompt(),n&&r?.focus()}))}};e([p()],Z.prototype,"_featureForm",void 0),e([p()],Z.prototype,"_attachments",void 0),e([p()],Z.prototype,"_featureTemplates",void 0),e([p()],Z.prototype,"_filterText",void 0),e([p()],Z.prototype,"_prompt",void 0),e([p()],Z.prototype,"_spinner",void 0),e([p()],Z.prototype,"_deleteButtonCommonInfo",null),e([p()],Z.prototype,"_loading",void 0),e([p({readOnly:!0})],Z.prototype,"activeWorkflow",null),e([p()],Z.prototype,"allowedWorkflows",null),e([p()],Z.prototype,"headingLevel",void 0),e([p()],Z.prototype,"hideTemplatesForInactiveLayers",null),e([p()],Z.prototype,"icon",null),e([p()],Z.prototype,"label",null),e([p()],Z.prototype,"labelOptions",null),e([p()],Z.prototype,"layerInfos",null),e([p(),K("esri/widgets/Editor/t9n/Editor")],Z.prototype,"messages",void 0),e([p(),K("esri/t9n/common")],Z.prototype,"messagesCommon",void 0),e([p(),K("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],Z.prototype,"messagesTemplates",void 0),e([p()],Z.prototype,"snappingOptions",null),e([p()],Z.prototype,"tooltipOptions",null),e([p()],Z.prototype,"supportingWidgetDefaults",void 0),e([p({type:u,nonNullable:!0})],Z.prototype,"valueOptions",null),e([p()],Z.prototype,"view",null),e([p(),Q(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],Z.prototype,"viewModel",void 0),e([p({type:M,nonNullable:!0})],Z.prototype,"visibleElements",void 0),e([p()],Z.prototype,"_helpMessage",null),Z=e([h("esri.widgets.Editor")],Z);const ee=Z;export{ee as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Logger.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{convertDateFormatToIntlOptions as o}from"../../intl/date.js";import{convertNumberFormatToIntlOptions as l,formatNumber as r}from"../../intl/number.js";import{isEditableLayer as a}from"../../layers/support/editableLayers.js";import{validateFieldValue as s,isTimeOnlyField as u,isIntegerField as p,isNumericField as d,isStringField as c,isDateOnlyField as m,isTimestampOffsetField as f}from"../../layers/support/fieldUtils.js";import{isAnyDateField as h}from"../../smartMapping/support/utils.js";import{getTimeZoneFormattingOptions as g,system as y}from"../../time/timeZoneUtils.js";import v from"../FeatureForm/FieldInput.js";import F from"./Grid/EditorColumn.js";import{isEmptyStringOrWhitespace as _}from"./support/tableUtils.js";import{dateFieldsWithStringFieldValue as C,getLabelForDateFieldValue as D,valueIsInRange as b,dateTimeIsInRange as x,getUnixFieldValueFromDateComponents as I,getISOFieldValueFromDateComponents as E,normalizeTimeOnlyString as w,prepareISOFieldValueForDateComponents as T,prepareUnixFieldValueForDateComponents as V}from"../support/dateUtils.js";import{renderingSanitizer as L,setFocus as O}from"../support/widgetUtils.js";const Z={cancelEdit:"Escape"},R="esri-column",j={input:`${R}__cell-input`,inputContainer:`${R}__cell__input-container`},N=o("short-date-short-time"),S=o("short-date"),A={useGrouping:!0,maximumFractionDigits:20};let U=class extends F{constructor(e){super(e),this._activeFieldInput=null,this.cellValueFormatFunction=({root:e,rowData:t,value:i})=>{const{formatFunction:n}=this;if(n&&t){const{index:o,item:{attachments:l,feature:r,relatedRecords:a}}=t;return n({attachments:l,column:this,feature:r,field:this.field,index:o,relatedRecords:a,value:L.sanitize(i),virtualIndex:this.getVirtualRowIndex(e)})}if(null===i)return"&nbsp;";const{field:o}=this,a=this._getDomainForFeature(t?.item?.feature);if(a){const e=this._getComputedDomain(i,a);if("date"===o.type&&"range"===a.type)return this._formatDateValueForDisplay(o,e);if(this._isNumericField&&"range"===a.type){const e=this.template?.format,t=e?l(e):A;return r(parseFloat(i),t)}return C.has(o.type)?"range"===a.type?L.sanitize(D(o,e)):L.sanitize(e):e}if("date"===o.type||C.has(o.type))return this._formatDateValueForDisplay(o,i);if(this._isNumericField){const e=this.template?.format,t=e?l(e):A;return r(parseFloat(i),t)}return L.sanitize(i)},this.cellValueValidatorFunction=({oldValue:e,value:i})=>{const{_effectiveRange:n,field:o}=this,{max:l,min:r}=n;if(this.effectiveRequired&&(null==i||""===i))return!1;if(this._isNumericField&&(s(o,i)||!b({max:l,min:r,value:i})))return t.getLogger(this).warn("value-exceeds-valid-range","Field value exceeds valid range. Attempted edit was rejected."),!1;if(this._isAnyDateOrTimeField){const e=o.type;if(!x({type:e,range:n,value:i}))return!1}return e!==i},this.field=null,this.formatFunction=null,this.inputRenderFunction=async({root:e,column:i,rowData:n})=>{if(this.editInfo||!this.effectiveEditable)return;const o=this.getCellValue(n),{field:l}=this;if("big-integer"===l.type&&s(l,o))return void t.getLogger(this).warn("value-exceeds-valid-range","Field value is beyond supported limit. Editing is disabled for this field value.");const r=n?.item.feature;if(!r)return;this._activeFieldInput=this._setUpFieldInput(r,o);const a=document.createElement("div");a.classList.add(j.inputContainer);const u=[],p="coded-value"===this._effectiveDomain?.type;if(this._isAnyDateOrTimeField&&!p){const e=document.createElement("div"),t=this._setUpDateComponents(o),i=this._setUpDateActionBar();t.forEach((t=>e.appendChild(t))),a.appendChild(e),a.appendChild(i),u.push(...t)}else{const e=this.createInputElement({value:o});a.appendChild(e),u.push(e)}this._set("editInfo",{column:i,inputs:u,root:e,rowData:n,oldValue:o}),this.removeCellContent(e),e.appendChild(a),this._syncRowEditingState(e,!0),this.grid?.generateCellPartNames();const d=u[0];await O(d),"selectText"in d&&await d.selectText()},this.layer=null,this.parseInputValueFunction=({inputs:e})=>{const{editInfo:t,field:i,includeTime:n}=this;if(!t||!e.length)return null;const o=e[0];if(this._isAnyDateOrTimeField){const{timeZone:l}=this.effectiveTimeZoneOptions,r=t.oldValue??void 0;if("coded-value"===this._effectiveDomain?.type)return null!=o.value?parseFloat(o.value):null;switch(i.type){case"date-only":{const e=o.value;return""!==e?e:null}case"time-only":{const e=w(o.value);return""!==e?e:null}case"timestamp-offset":{const t=n?e[1]:void 0,i=e.at(-1);return E({oldValue:r,dateComponent:o,timeComponent:t,timeZoneComponent:i,defaultTimeZone:l})}case"date":{const{max:t,min:i}=this._effectiveRange;return I({oldValue:r,dateComponent:o,timeComponent:e[1],timeZone:l,max:t,min:i})}}return null}const l=o.value,{effectiveRequired:r}=this;return r||null!=l&&""!==l?this._isNumericField?parseFloat(l):this._isStringField?l.trim():l:null},this.sortable=!0,this.store=null,this.template=null,this.view=null}get _effectiveDomain(){const e=this._activeFieldInput?.feature;return e?this._getDomainForFeature(e):null}get _effectiveRange(){return this._activeFieldInput?.range??{max:null,min:null}}get _isAnyDateOrTimeField(){const{field:e}=this;return h(e)||u(e)}get _isIntegerField(){return p(this.field)}get _isNumericField(){return d(this.field)}get _isStringField(){return c(this.field)}get _isSubtypeField(){const{layer:e}=this;if(e?.subtypeField){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.fieldName}return!1}get alias(){return this.field?.alias}get defaultValue(){return this.field?.defaultValue}get effectiveDescription(){const{description:e,field:t}=this,i=t.description,n=_(e)?_(i)?null:i:e;return null==n?null:L.sanitize(n)}get effectiveEditable(){const{editable:e,field:t,layer:i,tableEditingEnabled:n}=this;if(!t||!i)return!1;const o=a(i),l=i.effectiveCapabilities??i.capabilities,r=l?.operations?.supportsUpdate;return!!(t.editable&&o&&r&&"oid"!==t.type&&n)&&e}get effectiveLabel(){return L.sanitize(this.label||this.alias||this.fieldName)}get effectiveRequired(){return!this.nullable||this._isSubtypeField||this._activeFieldInput?.required||this.required}get effectiveTimeZoneOptions(){const{layer:e,field:t}=this;if(!e||"date"!==t?.type&&"timestamp-offset"!==t?.type)return{timeZone:void 0,timeZoneName:void 0};const{tableTimeZone:i,timeZone:n,view:l}=this;return g(e.preferredTimeZone||null,!!e.datesInUnknownTimezone,n??i??l?.timeZone??y,o("short-time"),t.type)}get includeTime(){const{field:e,template:t}=this;return"time-only"===e.type||"date-only"!==e.type&&(!t?.input||"includeTime"in t.input&&!1!==t.input.includeTime)}get loadingMessage(){return this.messages?.loading||"..."}get maxLength(){const{field:e,template:t}=this,i=e?.length??-1,n=t?.input&&"maxLength"in t.input?t.input.maxLength:null;return null!=n&&!isNaN(n)&&n>=-1&&(-1===i||n<=i)?n:i}get minLength(){const{template:e,maxLength:t}=this,i=e?.input&&"minLength"in e.input?e.input.minLength:null;return t&&i<=t?i:null}get name(){return this.field?.name}get nullable(){return!1!==this.field.nullable}get shouldShowPrompt(){return this._isSubtypeField}createInputElement({value:e}){const{_effectiveDomain:t,maxLength:i,minLength:n,effectiveRequired:o}=this;let l;if("coded-value"===t?.type)l=this.createCalciteSelect(e,t.codedValues.map((({code:e,name:t})=>({value:e,name:t})))),l.addEventListener("calciteSelectChange",(()=>this.onInputBlur(l)));else if(this._isNumericField){const{_effectiveRange:{max:t,min:i}}=this;l=document.createElement("calcite-input"),l.type="number",this._isIntegerField&&(l.step=1),null!=t&&(l.max=t),null!=i&&(l.min=i),l.status=b({max:t,min:i,value:e})?"idle":"invalid"}else l=document.createElement("calcite-input"),l.addEventListener("calciteInputChange",(()=>this.onInputBlur(l))),i>-1&&(l.maxLength=i),n>0&&(l.minLength=n);return l.classList.add(j.input),l.required=o,l.value=e,l.onkeydown=e=>{e.key===Z.cancelEdit&&this.onInputBlur(l,!0)},l.onblur=()=>this.onInputBlur(l),l}onEditComplete(){const e=this.editInfo?.root;e&&this._syncRowEditingState(e,!1),this._activeFieldInput=null,super.onEditComplete()}_clearActiveEditValues(){this.editInfo?.inputs?.forEach((e=>e.value=""))}_setUpDateActionBar(){const{messagesCommon:e}=this,t=e?.cancel??"",i=e?.clear??"",n=e?.save??"",o=document.createElement("calcite-action-bar");return o.expandDisabled=!0,o.layout="horizontal",o.appendChild(this.createCalciteAction({text:n,icon:"save",onclick:()=>this.submit()})),this.effectiveRequired||o.appendChild(this.createCalciteAction({text:i,icon:"trash",onclick:()=>{this._clearActiveEditValues(),this.submit()}})),o.appendChild(this.createCalciteAction({text:t,icon:"x",onclick:()=>this.cancel()})),o}_formatDateValueForDisplay(e,t){const{timeZone:i,timeZoneName:n}=this.effectiveTimeZoneOptions;return null!=t?D(e,t,{...this._getDateFormatOptions(),timeZone:i,timeZoneName:n}):null}_setUpDateComponents(e){const{_effectiveRange:{max:t,min:i,rawMax:n,rawMin:o},field:l,effectiveRequired:r}=this,a=this._getDateFieldValuesForComponents(l,e),s=[];if(h(l)){const e=this.createDateComponent(),u=m(l)||f(l)?n:t,p=m(l)||f(l)?o:i,d=this._getDateFieldValuesForComponents(l,u??null),c=this._getDateFieldValuesForComponents(l,p??null);e.value=a.date??"",e.max=d.date??"",e.min=c.date??"",e.required=r,e.addEventListener("calciteInputDatePickerOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}if(this.includeTime){const e=this.createTimeComponent();e.value=a.time??"",e.required=r,e.addEventListener("calciteInputTimePickerOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}if("timestamp-offset"===l.type){const e=this.createTimeZoneComponent();e.value=a.timeZoneOffset??"0",e.addEventListener("calciteInputTimeZoneOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}return s}_onDateComponentOpen(e){this.editInfo?.inputs.forEach((t=>{t!==e&&"open"in t&&(t.open=!1)}))}_syncRowEditingState(e,t=!1){const i=this.grid?.getRowContainingNode(e);i&&(t?i.setAttribute("editing","true"):i.removeAttribute("editing"))}_getDateFieldValuesForComponents(e,t){switch(e.type){case"date":return V(t,this.effectiveTimeZoneOptions.timeZone);case"date-only":return{date:t};case"time-only":return{time:t};case"timestamp-offset":return T(t);default:return{}}}_setUpFieldInput(e,t){const{field:i,layer:n,effectiveTimeZoneOptions:{timeZone:o}}=this,l=new v({feature:e,field:i,initialFeature:e.clone(),layer:n,timeZone:o});return l.set("value",t),l}_isDomainCompatible(e){if(!e)return!1;const{_isNumericField:t,_isStringField:i}=this,{type:n}=e;if("coded-value"===n){const n=typeof e.codedValues[0].code;if("string"===n&&i||"number"===n&&t)return!0}return!("range"!==n||!t)}_getDomainForFeature(e){const{fieldName:t,layer:i,template:n}=this;return e&&i?.getFieldDomain?"wfs"===i.type||"geojson"===i.type||"csv"===i.type||"knowledge-graph-sublayer"===i.type?null:n?.domain&&this._isDomainCompatible(n.domain)?n.domain:i.getFieldDomain(t,{feature:e}):null}_getComputedDomain(e,t){if(!t)return null;if("range"===t.type)return e;if("coded-value"===t.type){const i=t.codedValues.filter((t=>t.hasOwnProperty("code")&&t.code===e));return i&&i.length?i[0].name:e}return null}_getDateFormatOptions(){const{template:e}=this,t=e?.format?.dateFormat;return t?o(t):e?.input&&"includeTime"in e.input&&!1===e.input.includeTime?S:N}};e([i()],U.prototype,"_effectiveDomain",null),e([i()],U.prototype,"_activeFieldInput",void 0),e([i()],U.prototype,"_effectiveRange",null),e([i()],U.prototype,"_isAnyDateOrTimeField",null),e([i()],U.prototype,"_isIntegerField",null),e([i()],U.prototype,"_isNumericField",null),e([i()],U.prototype,"_isStringField",null),e([i()],U.prototype,"_isSubtypeField",null),e([i({readOnly:!0})],U.prototype,"alias",null),e([i()],U.prototype,"cellValueFormatFunction",void 0),e([i()],U.prototype,"cellValueValidatorFunction",void 0),e([i({readOnly:!0})],U.prototype,"defaultValue",null),e([i()],U.prototype,"effectiveDescription",null),e([i()],U.prototype,"effectiveEditable",null),e([i()],U.prototype,"effectiveLabel",null),e([i()],U.prototype,"effectiveRequired",null),e([i()],U.prototype,"effectiveTimeZoneOptions",null),e([i()],U.prototype,"field",void 0),e([i()],U.prototype,"formatFunction",void 0),e([i()],U.prototype,"includeTime",null),e([i()],U.prototype,"inputRenderFunction",void 0),e([i()],U.prototype,"layer",void 0),e([i({readOnly:!0})],U.prototype,"loadingMessage",null),e([i()],U.prototype,"maxLength",null),e([i()],U.prototype,"minLength",null),e([i({readOnly:!0})],U.prototype,"name",null),e([i({readOnly:!0})],U.prototype,"nullable",null),e([i()],U.prototype,"parseInputValueFunction",void 0),e([i()],U.prototype,"shouldShowPrompt",null),e([i()],U.prototype,"sortable",void 0),e([i()],U.prototype,"store",void 0),e([i()],U.prototype,"template",void 0),e([i()],U.prototype,"view",void 0),U=e([n("esri.widgets.FeatureTable.FieldColumn")],U);const q=U;export{q as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Logger.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{convertDateFormatToIntlOptions as o}from"../../intl/date.js";import{convertNumberFormatToIntlOptions as l,formatNumber as r}from"../../intl/number.js";import{isEditableLayer as a}from"../../layers/support/editableLayers.js";import{computeDomainFromTypes as s}from"../../layers/support/featureLayerUtils.js";import{validateFieldValue as u,isTimeOnlyField as p,isIntegerField as d,isNumericField as c,isStringField as m,isDateOnlyField as f,isTimestampOffsetField as h}from"../../layers/support/fieldUtils.js";import{isAnyDateField as g}from"../../smartMapping/support/utils.js";import{getTimeZoneFormattingOptions as y,system as v}from"../../time/timeZoneUtils.js";import F from"../FeatureForm/FieldInput.js";import _ from"./Grid/EditorColumn.js";import{isEmptyStringOrWhitespace as C}from"./support/tableUtils.js";import{dateFieldsWithStringFieldValue as b,getLabelForDateFieldValue as D,valueIsInRange as x,dateTimeIsInRange as I,getUnixFieldValueFromDateComponents as E,getISOFieldValueFromDateComponents as w,normalizeTimeOnlyString as T,prepareISOFieldValueForDateComponents as V,prepareUnixFieldValueForDateComponents as L}from"../support/dateUtils.js";import{renderingSanitizer as O,setFocus as Z}from"../support/widgetUtils.js";const R={cancelEdit:"Escape"},j="esri-column",N={input:`${j}__cell-input`,inputContainer:`${j}__cell__input-container`},S=o("short-date-short-time"),A=o("short-date"),U={useGrouping:!0,maximumFractionDigits:20};let q=class extends _{constructor(e){super(e),this._activeFieldInput=null,this.cellValueFormatFunction=({root:e,rowData:t,value:i})=>{const{formatFunction:n}=this;if(n&&t){const{index:o,item:{attachments:l,feature:r,relatedRecords:a}}=t;return n({attachments:l,column:this,feature:r,field:this.field,index:o,relatedRecords:a,value:O.sanitize(i),virtualIndex:this.getVirtualRowIndex(e)})}if(null===i)return"&nbsp;";const{field:o}=this,a=this._getDomainForFeature(t?.item?.feature);if(a){const e=this._getComputedDomain(i,a);if("date"===o.type&&"range"===a.type)return this._formatDateValueForDisplay(o,e);if(this._isNumericField&&"range"===a.type){const e=this.template?.format,t=e?l(e):U;return r(parseFloat(i),t)}return b.has(o.type)?"range"===a.type?O.sanitize(D(o,e)):O.sanitize(e):e}if("date"===o.type||b.has(o.type))return this._formatDateValueForDisplay(o,i);if(this._isNumericField){const e=this.template?.format,t=e?l(e):U;return r(parseFloat(i),t)}return O.sanitize(i)},this.cellValueValidatorFunction=({oldValue:e,value:i})=>{const{_effectiveRange:n,field:o}=this,{max:l,min:r}=n;if(this.effectiveRequired&&(null==i||""===i))return!1;if(this._isNumericField&&(u(o,i)||!x({max:l,min:r,value:i})))return t.getLogger(this).warn("value-exceeds-valid-range","Field value exceeds valid range. Attempted edit was rejected."),!1;if(this._isAnyDateOrTimeField){const e=o.type;if(!I({type:e,range:n,value:i}))return!1}return e!==i},this.field=null,this.formatFunction=null,this.inputRenderFunction=async({root:e,column:i,rowData:n})=>{if(this.editInfo||!this.effectiveEditable)return;const o=this.getCellValue(n),{field:l}=this;if("big-integer"===l.type&&u(l,o))return void t.getLogger(this).warn("value-exceeds-valid-range","Field value is beyond supported limit. Editing is disabled for this field value.");const r=n?.item.feature;if(!r)return;this._activeFieldInput=this._setUpFieldInput(r,o);const a=document.createElement("div");a.classList.add(N.inputContainer);const s=[],p="coded-value"===this._effectiveDomain?.type;if(this._isAnyDateOrTimeField&&!p){const e=document.createElement("div"),t=this._setUpDateComponents(o),i=this._setUpDateActionBar();t.forEach((t=>e.appendChild(t))),a.appendChild(e),a.appendChild(i),s.push(...t)}else{const e=this.createInputElement({value:o});a.appendChild(e),s.push(e)}this._set("editInfo",{column:i,inputs:s,root:e,rowData:n,oldValue:o}),this.removeCellContent(e),e.appendChild(a),this._syncRowEditingState(e,!0),this.grid?.generateCellPartNames();const d=s[0];await Z(d),"selectText"in d&&await d.selectText()},this.layer=null,this.parseInputValueFunction=({inputs:e})=>{const{editInfo:t,field:i,includeTime:n}=this;if(!t||!e.length)return null;const o=e[0];if(this._isAnyDateOrTimeField){const{timeZone:l}=this.effectiveTimeZoneOptions,r=t.oldValue??void 0;if("coded-value"===this._effectiveDomain?.type)return null!=o.value?parseFloat(o.value):null;switch(i.type){case"date-only":{const e=o.value;return""!==e?e:null}case"time-only":{const e=T(o.value);return""!==e?e:null}case"timestamp-offset":{const t=n?e[1]:void 0,i=e.at(-1);return w({oldValue:r,dateComponent:o,timeComponent:t,timeZoneComponent:i,defaultTimeZone:l})}case"date":{const{max:t,min:i}=this._effectiveRange;return E({oldValue:r,dateComponent:o,timeComponent:e[1],timeZone:l,max:t,min:i})}}return null}const l=o.value,{effectiveRequired:r}=this;return r||null!=l&&""!==l?this._isNumericField?parseFloat(l):this._isStringField?l.trim():l:null},this.sortable=!0,this.store=null,this.template=null,this.view=null}get _effectiveDomain(){const e=this._activeFieldInput?.feature;return e?this._getDomainForFeature(e):null}get _effectiveRange(){return this._activeFieldInput?.range??{max:null,min:null}}get _isAnyDateOrTimeField(){const{field:e}=this;return g(e)||p(e)}get _isIntegerField(){return d(this.field)}get _isNumericField(){return c(this.field)}get _isStringField(){return m(this.field)}get _isSubtypeField(){const{layer:e}=this;if(e?.subtypeField){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.fieldName}return!1}get alias(){return this.field?.alias}get defaultValue(){return this.field?.defaultValue}get effectiveDescription(){const{description:e,field:t}=this,i=t.description,n=C(e)?C(i)?null:i:e;return null==n?null:O.sanitize(n)}get effectiveEditable(){const{editable:e,field:t,layer:i,tableEditingEnabled:n}=this;if(!t||!i)return!1;const o=a(i),l=i.effectiveCapabilities??i.capabilities,r=l?.operations?.supportsUpdate;return!!(t.editable&&o&&r&&"oid"!==t.type&&n)&&e}get effectiveLabel(){return O.sanitize(this.label||this.alias||this.fieldName)}get effectiveRequired(){return!this.nullable||this._isSubtypeField||this._activeFieldInput?.required||this.required}get effectiveTimeZoneOptions(){const{layer:e,field:t}=this;if(!e||"date"!==t?.type&&"timestamp-offset"!==t?.type)return{timeZone:void 0,timeZoneName:void 0};const{tableTimeZone:i,timeZone:n,view:l}=this;return y(e.preferredTimeZone||null,!!e.datesInUnknownTimezone,n??i??l?.timeZone??v,o("short-time"),t.type)}get includeTime(){const{field:e,template:t}=this;return"time-only"===e.type||"date-only"!==e.type&&(!t?.input||"includeTime"in t.input&&!1!==t.input.includeTime)}get loadingMessage(){return this.messages?.loading||"..."}get maxLength(){const{field:e,template:t}=this,i=e?.length??-1,n=t?.input&&"maxLength"in t.input?t.input.maxLength:null;return null!=n&&!isNaN(n)&&n>=-1&&(-1===i||n<=i)?n:i}get minLength(){const{template:e,maxLength:t}=this,i=e?.input&&"minLength"in e.input?e.input.minLength:null;return t&&i<=t?i:null}get name(){return this.field?.name}get nullable(){return!1!==this.field.nullable}get shouldShowPrompt(){return this._isSubtypeField}createInputElement({value:e}){const{_effectiveDomain:t,maxLength:i,minLength:n,effectiveRequired:o}=this;let l;if("coded-value"===t?.type)l=this.createCalciteSelect(e,t.codedValues.map((({code:e,name:t})=>({value:e,name:t})))),l.addEventListener("calciteSelectChange",(()=>this.onInputBlur(l)));else if(this._isNumericField){const{_effectiveRange:{max:t,min:i}}=this;l=document.createElement("calcite-input"),l.type="number",this._isIntegerField&&(l.step=1),null!=t&&(l.max=t),null!=i&&(l.min=i),l.status=x({max:t,min:i,value:e})?"idle":"invalid"}else l=document.createElement("calcite-input"),l.addEventListener("calciteInputChange",(()=>this.onInputBlur(l))),i>-1&&(l.maxLength=i),n>0&&(l.minLength=n);return l.classList.add(N.input),l.required=o,l.value=e,l.onkeydown=e=>{e.key===R.cancelEdit&&this.onInputBlur(l,!0)},l.onblur=()=>this.onInputBlur(l),l}onEditComplete(){const e=this.editInfo?.root;e&&this._syncRowEditingState(e,!1),this._activeFieldInput=null,super.onEditComplete()}_clearActiveEditValues(){this.editInfo?.inputs?.forEach((e=>e.value=""))}_setUpDateActionBar(){const{messagesCommon:e}=this,t=e?.cancel??"",i=e?.clear??"",n=e?.save??"",o=document.createElement("calcite-action-bar");return o.expandDisabled=!0,o.layout="horizontal",o.appendChild(this.createCalciteAction({text:n,icon:"save",onclick:()=>this.submit()})),this.effectiveRequired||o.appendChild(this.createCalciteAction({text:i,icon:"trash",onclick:()=>{this._clearActiveEditValues(),this.submit()}})),o.appendChild(this.createCalciteAction({text:t,icon:"x",onclick:()=>this.cancel()})),o}_formatDateValueForDisplay(e,t){const{timeZone:i,timeZoneName:n}=this.effectiveTimeZoneOptions;return null!=t?D(e,t,{...this._getDateFormatOptions(),timeZone:i,timeZoneName:n}):null}_setUpDateComponents(e){const{_effectiveRange:{max:t,min:i,rawMax:n,rawMin:o},field:l,effectiveRequired:r}=this,a=this._getDateFieldValuesForComponents(l,e),s=[];if(g(l)){const e=this.createDateComponent(),u=f(l)||h(l)?n:t,p=f(l)||h(l)?o:i,d=this._getDateFieldValuesForComponents(l,u??null),c=this._getDateFieldValuesForComponents(l,p??null);e.value=a.date??"",e.max=d.date??"",e.min=c.date??"",e.required=r,e.addEventListener("calciteInputDatePickerOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}if(this.includeTime){const e=this.createTimeComponent();e.value=a.time??"",e.required=r,e.addEventListener("calciteInputTimePickerOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}if("timestamp-offset"===l.type){const e=this.createTimeZoneComponent();e.value=a.timeZoneOffset??"0",e.addEventListener("calciteInputTimeZoneOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}return s}_onDateComponentOpen(e){this.editInfo?.inputs.forEach((t=>{t!==e&&"open"in t&&(t.open=!1)}))}_syncRowEditingState(e,t=!1){const i=this.grid?.getRowContainingNode(e);i&&(t?i.setAttribute("editing","true"):i.removeAttribute("editing"))}_getDateFieldValuesForComponents(e,t){switch(e.type){case"date":return L(t,this.effectiveTimeZoneOptions.timeZone);case"date-only":return{date:t};case"time-only":return{time:t};case"timestamp-offset":return V(t);default:return{}}}_setUpFieldInput(e,t){const{field:i,layer:n,effectiveTimeZoneOptions:{timeZone:o}}=this,l=new F({feature:e,field:i,initialFeature:e.clone(),layer:n,timeZone:o});return l.set("value",t),l}_isDomainCompatible(e){if(!e)return!1;const{_isNumericField:t,_isStringField:i}=this,{type:n}=e;if("coded-value"===n){const n=typeof e.codedValues[0].code;if("string"===n&&i||"number"===n&&t)return!0}return!("range"!==n||!t)}_getDomainForFeature(e){const{fieldName:t,layer:i,template:n}=this;if(!e||!i?.getFieldDomain)return null;if("wfs"===i.type||"geojson"===i.type||"csv"===i.type||"knowledge-graph-sublayer"===i.type)return null;if(n?.domain&&this._isDomainCompatible(n.domain))return n.domain;if("feature"!==i.type&&"subtype-group"!==i.type&&null==i.getField(t)?.domain){const e=s(i,t);if(e)return e}return i.getFieldDomain(t,{feature:e})}_getComputedDomain(e,t){if(!t)return null;if("range"===t.type)return e;if("coded-value"===t.type){const i=t.codedValues.filter((t=>t.hasOwnProperty("code")&&t.code===e));return i&&i.length?i[0].name:e}return null}_getDateFormatOptions(){const{template:e}=this,t=e?.format?.dateFormat;return t?o(t):e?.input&&"includeTime"in e.input&&!1===e.input.includeTime?A:S}};e([i()],q.prototype,"_effectiveDomain",null),e([i()],q.prototype,"_activeFieldInput",void 0),e([i()],q.prototype,"_effectiveRange",null),e([i()],q.prototype,"_isAnyDateOrTimeField",null),e([i()],q.prototype,"_isIntegerField",null),e([i()],q.prototype,"_isNumericField",null),e([i()],q.prototype,"_isStringField",null),e([i()],q.prototype,"_isSubtypeField",null),e([i({readOnly:!0})],q.prototype,"alias",null),e([i()],q.prototype,"cellValueFormatFunction",void 0),e([i()],q.prototype,"cellValueValidatorFunction",void 0),e([i({readOnly:!0})],q.prototype,"defaultValue",null),e([i()],q.prototype,"effectiveDescription",null),e([i()],q.prototype,"effectiveEditable",null),e([i()],q.prototype,"effectiveLabel",null),e([i()],q.prototype,"effectiveRequired",null),e([i()],q.prototype,"effectiveTimeZoneOptions",null),e([i()],q.prototype,"field",void 0),e([i()],q.prototype,"formatFunction",void 0),e([i()],q.prototype,"includeTime",null),e([i()],q.prototype,"inputRenderFunction",void 0),e([i()],q.prototype,"layer",void 0),e([i({readOnly:!0})],q.prototype,"loadingMessage",null),e([i()],q.prototype,"maxLength",null),e([i()],q.prototype,"minLength",null),e([i({readOnly:!0})],q.prototype,"name",null),e([i({readOnly:!0})],q.prototype,"nullable",null),e([i()],q.prototype,"parseInputValueFunction",void 0),e([i()],q.prototype,"shouldShowPrompt",null),e([i()],q.prototype,"sortable",void 0),e([i()],q.prototype,"store",void 0),e([i()],q.prototype,"template",void 0),e([i()],q.prototype,"view",void 0),q=e([n("esri.widgets.FeatureTable.FieldColumn")],q);const k=q;export{k as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import"../../../geometry.js";import e from"../../../Graphic.js";import{isSome as t}from"../../../core/arrayUtils.js";import{throwIfAborted as i,waitTick as r}from"../../../core/promiseUtils.js";import{ensureType as o}from"../../../core/accessorSupport/ensureType.js";import a from"../../../geometry/Mesh.js";import{projectWithZConversion as s}from"../../../geometry/projection.js";import{MeshVertexAttributes as n}from"../../../geometry/support/MeshVertexAttributes.js";import{projectVertices as l,updateFrustum as c,createCoveragePolygon as m}from"../../../layers/orientedImagery/core/coverageUtils.js";import{activeFrustumSymbol as p,additionalFrustumSymbol as u}from"../symbols.js";import f from"../../../geometry/Point.js";class d{constructor(f){this.viewModel=f,this.createFootprints=async r=>{const{coverageFrustums:o,currentBestFeature:c,isAdditionalCoverageVisible:m,view:f}=this.viewModel,d=o.filter(t);for(const t of d){let o=t.clone();if(!f.spatialReference.equals(o.spatialReference)){const{components:e,spatialReference:t,origin:c,vertexAttributes:m,vertexSpace:p}=o;if("local"===p.type){const e=await s(c,f.spatialReference,r);i(r),o.centerAt(e)}else{const s=m.position,c=Float64Array.from(await l([...s],t.clone(),f.spatialReference.clone(),r));i(r),o=new a({vertexAttributes:new n({position:c}),components:e,spatialReference:f.spatialReference.clone()})}}t.imageID===c.attributes.objectId?this.viewModel.bestFeatureFootprint=new e({attributes:{imageID:t.imageID},geometry:o,symbol:p.clone(),visible:!1}):this.viewModel.additionalFootprints.push(new e({attributes:{imageID:t.imageID},geometry:o,symbol:u.clone(),visible:m}))}},this.updateFootprint=async(r,n)=>{const{currentBestFeature:l,imagePointsInView:m,activeViewer:u,footprintExtent:f,view:d}=this.viewModel,g=o(a,this.viewModel.bestFeatureFootprint.geometry),y=u?.imageSize;if(!(l&&g&&m&&y&&f))return void this.viewModel.updateCurrentCoveragePolygon(null);const{cameraHeight:v,location:h,cameraPitch:b,horizontalFieldOfView:F,verticalFieldOfView:R,cameraRoll:M,imageRotation:j}=l.attributes,V=h.toArray(),{vertexAttributes:{position:A},spatialReference:I}=g,P=await w(A,I,h.spatialReference),C=await this.viewModel.getMapPoint(r,{feature:l,mode:"default",imageSize:y});i(n);let z=C.filter(t);if(!z.length)return;z[0].spatialReference.equals(h.spatialReference)||(z=await Promise.all(z.map((async e=>{const t=await s(e,h.spatialReference,n);return i(n),t}))));const x=await c(m.slice(0,4).map((({x:e,y:t})=>[e,t])),z.slice(0,4).map((e=>e.toArray())),{cameraHeight:v,cameraLocation:V,cameraPitch:b,frustumVertices:P,horizontalFieldOfView:F,imageHeight:y[1],imageWidth:y[0],inSRS:{wkid:h.spatialReference.wkid},outSRS:{wkid:d.spatialReference.wkid},verticalFieldOfView:R,cameraRoll:M??0,imageRotation:j??0,options:n});this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:l.attributes.objectId},geometry:x,symbol:p.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateFootprintPanorama=async(t,i)=>{await r(i);const{horizontalFieldOfView:o,pitch:a,verticalFieldOfView:s,yaw:n}=t,l=this.viewModel.currentBestFeature?.clone();if(!l)return;const{attributes:c}=l;c.orientedImageryType=null,c.cameraHeading=(n+c.cameraHeading)%360,c.cameraPitch=a,c.horizontalFieldOfView=o,c.verticalFieldOfView=s,c.cameraRoll=0;const{frustum:u}=m(c);u?this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:c.objectId},geometry:u,symbol:p.clone(),visible:this.viewModel.currentCoverageVisible})):this.viewModel.updateCurrentCoveragePolygon(null)}}updateGroundElevation(e,t){const{geometry:i}=this.viewModel.currentBestFeature,r=t.queryElevation(i);e.forEach((e=>{const{geometry:t}=e;switch(t?.type){case"mesh":{const{vertexAttributes:{position:e}}=t,i=Math.floor(e.length/3);for(let t=0;t<i;t+=1)e[3*t+2]+=r?.z??0;break}case"point":t.z=(t.z??0)+(r?.z??0)}}))}}async function w(e,t,i,r){return Float64Array.from((await Promise.all(e.reduce(((e,t,i)=>{const r=Math.floor(i/3);return e[r]=e[r]??[],e[r].push(t),e}),new Array).map((async e=>(await s(new f(e,t),i,r)).toArray())))).flat())}export{d as default};
5
+ import"../../../geometry.js";import e from"../../../Graphic.js";import{isSome as t}from"../../../core/arrayUtils.js";import{throwIfAborted as i,waitTick as r}from"../../../core/promiseUtils.js";import{ensureType as o}from"../../../core/accessorSupport/ensureType.js";import a from"../../../geometry/Mesh.js";import{projectWithZConversion as s}from"../../../geometry/projection.js";import{MeshVertexAttributes as n}from"../../../geometry/support/MeshVertexAttributes.js";import{projectVertices as l,updateFrustum as c,createCoveragePolygon as m}from"../../../layers/orientedImagery/core/coverageUtils.js";import{activeFrustumSymbol as p,additionalFrustumSymbol as u}from"../symbols.js";import f from"../../../geometry/Point.js";class d{constructor(f){this.viewModel=f,this.createFootprints=async r=>{const{coverageFrustums:o,currentBestFeature:c,isAdditionalCoverageVisible:m,view:f}=this.viewModel,d=o.filter(t);for(const t of d){let o=t.clone();if(!f.spatialReference.equals(o.spatialReference)){const{components:e,spatialReference:t,origin:c,vertexAttributes:m,vertexSpace:p}=o;if("local"===p.type){const e=await s(c,f.spatialReference,r);i(r),o.centerAt(e)}else{const s=m.position,c=Float64Array.from(await l([...s],t.clone(),f.spatialReference.clone(),r));i(r),o=new a({vertexAttributes:new n({position:c}),components:e,spatialReference:f.spatialReference.clone()})}}t.imageID===c.attributes.objectId?this.viewModel.bestFeatureFootprint=new e({attributes:{imageID:t.imageID},geometry:o,symbol:p.clone(),visible:!1}):this.viewModel.additionalFootprints.push(new e({attributes:{imageID:t.imageID},geometry:o,symbol:u.clone(),visible:m}))}},this.updateFootprint=async(r,n)=>{const{currentBestFeature:l,activeViewer:m,footprintExtent:u,view:f}=this.viewModel,d=o(a,this.viewModel.bestFeatureFootprint.geometry),g=m?.imageSize;if(!(l&&d&&g&&u))return void this.viewModel.updateCurrentCoveragePolygon(null);const{cameraHeight:y,location:v,cameraPitch:h,horizontalFieldOfView:b,verticalFieldOfView:F,cameraRoll:M}=l.attributes,R=v.toArray(),{vertexAttributes:{position:j},spatialReference:V}=d,A=await w(j,V,v.spatialReference),I=await this.viewModel.getMapPoint(r,{feature:l,mode:"default",imageSize:g});i(n);let P=I.filter(t);if(!P.length)return;P[0].spatialReference.equals(v.spatialReference)||(P=await Promise.all(P.map((async e=>{const t=await s(e,v.spatialReference,n);return i(n),t}))));const C=await c(r.map((({x:e,y:t})=>[e,t])),P.map((e=>e.toArray())),{cameraHeight:y,cameraLocation:R,cameraPitch:h,frustumVertices:A,horizontalFieldOfView:b,imageHeight:g[1],imageWidth:g[0],inSRS:{wkid:v.spatialReference.wkid},outSRS:{wkid:f.spatialReference.wkid},verticalFieldOfView:F,cameraRoll:M??0,options:n});this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:l.attributes.objectId},geometry:C,symbol:p.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateFootprintPanorama=async(t,i)=>{await r(i);const{horizontalFieldOfView:o,pitch:a,verticalFieldOfView:s,yaw:n}=t,l=this.viewModel.currentBestFeature?.clone();if(!l)return;const{attributes:c}=l;c.orientedImageryType=null,c.cameraHeading=(n+c.cameraHeading)%360,c.cameraPitch=a,c.horizontalFieldOfView=o,c.verticalFieldOfView=s,c.cameraRoll=0;const{frustum:u}=m(c);u?this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:c.objectId},geometry:u,symbol:p.clone(),visible:this.viewModel.currentCoverageVisible})):this.viewModel.updateCurrentCoveragePolygon(null)}}updateGroundElevation(e,t){const{geometry:i}=this.viewModel.currentBestFeature,r=t.queryElevation(i);e.forEach((e=>{const{geometry:t}=e;switch(t?.type){case"mesh":{const{vertexAttributes:{position:e}}=t,i=Math.floor(e.length/3);for(let t=0;t<i;t+=1)e[3*t+2]+=r?.z??0;break}case"point":t.z=(t.z??0)+(r?.z??0)}}))}}async function w(e,t,i,r){return Float64Array.from((await Promise.all(e.reduce(((e,t,i)=>{const r=Math.floor(i/3);return e[r]=e[r]??[],e[r].push(t),e}),new Array).map((async e=>(await s(new f(e,t),i,r)).toArray())))).flat())}export{d as default};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[4796],{81457:(e,t,r)=>{r.d(t,{A:()=>P});var n,o=r(90237),i=r(61147),s=(r(44208),r(66552)),a=r(25482),l=r(4718),u=r(90629),c=r(10107),p=(r(53966),r(36005)),d=r(40608),y=r(43937),h=(r(87811),r(32730));let f=n=class extends a.oY{constructor(){super(...arguments),this.expression=null,this.title=null,this.value=null}readExpression(e,t){return t.value?(0,h.mX)(t.value):e}writeExpression(e,t,r){null!=this.value&&(e=(0,h.mX)(this.value)),null!=e&&(t[r]=e)}clone(){return new n({expression:this.expression,title:this.title,value:this.value})}};(0,o._)([(0,c.MZ)({type:String,json:{write:{writerEnsuresNonNull:!0}}})],f.prototype,"expression",void 0),(0,o._)([(0,p.w)("expression",["expression","value"])],f.prototype,"readExpression",null),(0,o._)([(0,y.K)("expression")],f.prototype,"writeExpression",null),(0,o._)([(0,c.MZ)({type:String,json:{write:!0,origins:{"web-scene":{write:!1}}}})],f.prototype,"title",void 0),(0,o._)([(0,c.MZ)({json:{read:!1,write:!1}})],f.prototype,"value",void 0),f=n=(0,o._)([(0,d.$)("esri.layers.support.LabelExpressionInfo")],f);const m=f;var b,w=r(83531),g=r(59868),v=r(73838);const x=new s.J({esriServerPointLabelPlacementAboveCenter:"above-center",esriServerPointLabelPlacementAboveLeft:"above-left",esriServerPointLabelPlacementAboveRight:"above-right",esriServerPointLabelPlacementBelowCenter:"below-center",esriServerPointLabelPlacementBelowLeft:"below-left",esriServerPointLabelPlacementBelowRight:"below-right",esriServerPointLabelPlacementCenterCenter:"center-center",esriServerPointLabelPlacementCenterLeft:"center-left",esriServerPointLabelPlacementCenterRight:"center-right",esriServerLinePlacementAboveAfter:"above-after",esriServerLinePlacementAboveAlong:"above-along",esriServerLinePlacementAboveBefore:"above-before",esriServerLinePlacementAboveStart:"above-start",esriServerLinePlacementAboveEnd:"above-end",esriServerLinePlacementBelowAfter:"below-after",esriServerLinePlacementBelowAlong:"below-along",esriServerLinePlacementBelowBefore:"below-before",esriServerLinePlacementBelowStart:"below-start",esriServerLinePlacementBelowEnd:"below-end",esriServerLinePlacementCenterAfter:"center-after",esriServerLinePlacementCenterAlong:"center-along",esriServerLinePlacementCenterBefore:"center-before",esriServerLinePlacementCenterStart:"center-start",esriServerLinePlacementCenterEnd:"center-end",esriServerPolygonPlacementAlwaysHorizontal:"always-horizontal"},{ignoreUnknown:!0});function S(e,t,r){return{enabled:!(0,w.TU)(r?.layer)}}function A(e){return!e||"service"!==e.origin&&!("map-image"===e.layer?.type)}function M(e){return!!function(e){return"map-image"===e?.type}(e)&&!!e.capabilities?.exportMap?.supportsArcadeExpressionForLabeling}let I=b=class extends a.oY{static evaluateWhere(e,t){const r=(e,t,r)=>{switch(t){case"=":return e==r;case"<>":return e!=r;case">":return e>r;case">=":return e>=r;case"<":return e<r;case"<=":return e<=r}return!1};try{if(null==e)return!0;const n=e.split(" ");if(3===n.length)return r(t[n[0]],n[1],n[2]);if(7===n.length){const e=r(t[n[0]],n[1],n[2]),o=n[3],i=r(t[n[4]],n[5],n[6]);switch(o){case"AND":return e&&i;case"OR":return e||i}}return!1}catch(e){}}constructor(e){super(e),this.type="label",this.name=null,this.allowOverrun=!1,this.deconflictionStrategy="static",this.labelExpression=null,this.labelExpressionInfo=null,this.labelPlacement=null,this.labelPosition="curved",this.maxScale=0,this.minScale=0,this.repeatLabel=!0,this.repeatLabelDistance=null,this.symbol=g.Hk,this.useCodedValues=void 0,this.where=null}readLabelExpression(e,t){const r=t.labelExpressionInfo;if(!r||!r.value&&!r.expression)return e}writeLabelExpression(e,t,r){if(this.labelExpressionInfo)if(null!=this.labelExpressionInfo.value)e=(0,h.D3)(this.labelExpressionInfo.value);else if(null!=this.labelExpressionInfo.expression){const t=(0,h.tH)(this.labelExpressionInfo.expression);t&&(e="["+t+"]")}null!=e&&(t[r]=e)}writeLabelExpressionInfo(e,t,r,n){if(null==e&&null!=this.labelExpression&&A(n))e=new m({expression:this.getLabelExpressionArcade()});else if(!e)return;const o=e.toJSON(n);o.expression&&(t[r]=o)}writeMaxScale(e,t){(e||this.minScale)&&(t.maxScale=e)}writeMinScale(e,t){(e||this.maxScale)&&(t.minScale=e)}getLabelExpression(){return(0,h.XJ)(this)}getLabelExpressionArcade(){return(0,h.BI)(this)}getLabelExpressionSingleField(){return(0,h.rU)(this)}hash(){return JSON.stringify(this)}clone(){return new b({allowOverrun:this.allowOverrun,deconflictionStrategy:this.deconflictionStrategy,labelExpression:this.labelExpression,labelExpressionInfo:(0,l.o8)(this.labelExpressionInfo),labelPosition:this.labelPosition,labelPlacement:this.labelPlacement,maxScale:this.maxScale,minScale:this.minScale,name:this.name,repeatLabel:this.repeatLabel,repeatLabelDistance:this.repeatLabelDistance,symbol:(0,l.o8)(this.symbol),where:this.where,useCodedValues:this.useCodedValues})}};(0,o._)([(0,c.MZ)({type:String,json:{write:!0}})],I.prototype,"name",void 0),(0,o._)([(0,c.MZ)({type:Boolean,json:{write:!0,default:!1,origins:{"web-scene":{write:!1},"portal-item":{default:!1,write:{overridePolicy:S}}}}})],I.prototype,"allowOverrun",void 0),(0,o._)([(0,c.MZ)({type:String,json:{write:!0,default:"static",origins:{"web-scene":{write:!1},"portal-item":{default:"static",write:{overridePolicy:S}}}}})],I.prototype,"deconflictionStrategy",void 0),(0,o._)([(0,c.MZ)({type:String,json:{write:{overridePolicy(e,t,r){return this.labelExpressionInfo&&"service"===r?.origin&&M(r.layer)?{enabled:!1}:{allowNull:!0}}}}})],I.prototype,"labelExpression",void 0),(0,o._)([(0,p.w)("labelExpression")],I.prototype,"readLabelExpression",null),(0,o._)([(0,y.K)("labelExpression")],I.prototype,"writeLabelExpression",null),(0,o._)([(0,c.MZ)({type:m,json:{write:{overridePolicy:(e,t,r)=>function(e){return A(e)||M(e?.layer)}(r)?{allowNull:!0}:{enabled:!1}}}})],I.prototype,"labelExpressionInfo",void 0),(0,o._)([(0,y.K)("labelExpressionInfo")],I.prototype,"writeLabelExpressionInfo",null),(0,o._)([(0,c.MZ)({type:x.apiValues,json:{type:x.jsonValues,read:x.read,write:x.write}})],I.prototype,"labelPlacement",void 0),(0,o._)([(0,c.MZ)({type:["curved","parallel"],json:{write:!0,origins:{"web-map":{write:!1},"web-scene":{write:!1},"portal-item":{write:!1}}}})],I.prototype,"labelPosition",void 0),(0,o._)([(0,c.MZ)({type:Number})],I.prototype,"maxScale",void 0),(0,o._)([(0,y.K)("maxScale")],I.prototype,"writeMaxScale",null),(0,o._)([(0,c.MZ)({type:Number})],I.prototype,"minScale",void 0),(0,o._)([(0,y.K)("minScale")],I.prototype,"writeMinScale",null),(0,o._)([(0,c.MZ)({type:Boolean,json:{write:!0,origins:{"web-scene":{write:!1},"portal-item":{write:{overridePolicy:S}}}}})],I.prototype,"repeatLabel",void 0),(0,o._)([(0,c.MZ)({type:Number,cast:u.cr,json:{write:!0,origins:{"web-scene":{write:!1},"portal-item":{write:{overridePolicy:S}}}}})],I.prototype,"repeatLabelDistance",void 0),(0,o._)([(0,c.MZ)({types:i.em,json:{origins:{"web-scene":{types:i.Rv,write:v.oO,default:null}},write:v.oO,default:null}})],I.prototype,"symbol",void 0),(0,o._)([(0,c.MZ)({type:Boolean,json:{write:!0}})],I.prototype,"useCodedValues",void 0),(0,o._)([(0,c.MZ)({type:String,json:{write:!0}})],I.prototype,"where",void 0),I=b=(0,o._)([(0,d.$)("esri.layers.support.LabelClass")],I);const P=I},15426:(e,t,r)=>{r.d(t,{Xl:()=>S,ct:()=>I,pc:()=>T,hx:()=>V,C$:()=>k,PD:()=>z,VZ:()=>D,mm:()=>L,VA:()=>H,WP:()=>j,iX:()=>x,Nv:()=>G,xd:()=>Q,GA:()=>U,jp:()=>R,tG:()=>K,lV:()=>E,B5:()=>Z,Ye:()=>F,sg:()=>_,hM:()=>C,S2:()=>O,jD:()=>N,Zm:()=>q,$4:()=>B,Pt:()=>X,bt:()=>M,rn:()=>P,ZJ:()=>W});var n=r(70333),o=r(61147),i=r(60999),s=r(49186),a=r(66552),l=r(39516),u=r(13069),c=r(90360),p=r(39357),d=r(53177),y=r(61956);async function h(e,t,r){t=t.clone(),e.capabilities.query.supportsMaxRecordCountFactor&&(t.maxRecordCountFactor=f(e));const n=function(e){return f(e)*function(e){return e.capabilities.query.maxRecordCount||2e3}(e)}(e),o=e.capabilities.query.supportsPagination;t.start=0,t.num=n;let i=null;for(;;){const s=await e.source.queryFeaturesJSON(t,r);if(null==i?i=s:i.features=i.features.concat(s.features),i.exceededTransferLimit=s.exceededTransferLimit,!o||!s.exceededTransferLimit)break;t.start+=n}return i}function f(e){return e.capabilities.query.supportsMaxRecordCountFactor?y.A.MAX_MAX_RECORD_COUNT_FACTOR:1}var m=r(83531),b=r(96576),w=r(93618),g=r(54546),v=r(26591);const x=new a.J({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"});async function S(e,t,r,n){const o=await $(e);if(await A(e,t,n),!o.addAttachment)throw new s.A(n,"Layer source does not support addAttachment capability");return o.addAttachment(t,r)}function A(e,t,r){const{attributes:n}=t,{objectIdField:o}=e;return e.capabilities?.data?.supportsAttachment?t?n?o&&n[o]?Promise.resolve():Promise.reject(new s.A(r,`feature is missing the identifying attribute ${o}`)):Promise.reject(new s.A(r,"'attributes' are required on a feature to query attachments")):Promise.reject(new s.A(r,"A feature is required to add/delete/update attachments")):Promise.reject(new s.A(r,"this layer doesn't support attachments"))}async function M(e,t,r,n,o){const i=await $(e);if(await A(e,t,o),!i.updateAttachment)throw new s.A(o,"Layer source does not support updateAttachment capability");return i.updateAttachment(t,r,n)}async function I(e,t,n){const{applyEdits:o}=await r.e(8628).then(r.bind(r,78628)),i=await e.load();let s=n;return"feature"===i.type&&i.infoFor3D&&null!=t.deleteFeatures&&null!=i.globalIdField&&(s={...s,globalIdToObjectId:await U(i,t.deleteFeatures,i.globalIdField)}),o(i,i.source,t,n)}async function P(e,t,n){const{uploadAssets:o}=await r.e(8628).then(r.bind(r,78628)),i=await e.load();return o(i,i.source,t,n)}async function L(e,t,r,n){const o=await $(e);if(await A(e,t,n),!o.deleteAttachments)throw new s.A(n,"Layer source does not support deleteAttachments capability");return o.deleteAttachments(t,r)}async function j(e,t,r){const n=(await e.load({signal:t?.signal})).source;if(!n.fetchRecomputedExtents)throw new s.A(r,"Layer source does not support fetchUpdates capability");return n.fetchRecomputedExtents(t)}async function E(e,t,r,n){t=g.A.from(t),await e.load();const o=e.source,i=e.capabilities;if(!i?.data?.supportsAttachment)throw new s.A(n,"this layer doesn't support attachments");const{attachmentTypes:a,objectIds:l,globalIds:u,num:c,size:p,start:d,where:y}=t;if(!i?.operations?.supportsQueryAttachments&&(a?.length>0||u?.length>0||p?.length>0||c||d||y))throw new s.A(n,"when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",t);if(!(l?.length||u?.length||y))throw new s.A(n,"'objectIds', 'globalIds', or 'where' are required to perform attachment query",t);if(!o.queryAttachments)throw new s.A(n,"Layer source does not support queryAttachments capability",t);return o.queryAttachments(t)}async function _(e,t,r,n){const o=await $(e);if(!o.queryObjectIds)throw new s.A(n,"Layer source does not support queryObjectIds capability");return o.queryObjectIds(y.A.from(t)??e.createQuery(),r)}async function F(e,t,r,n){const o=await $(e);if(!o.queryFeatureCount)throw new s.A(n,"Layer source does not support queryFeatureCount capability");return o.queryFeatureCount(y.A.from(t)??e.createQuery(),r)}async function Z(e,t,r,n){const o=await $(e);if(!o.queryExtent)throw new s.A(n,"Layer source does not support queryExtent capability");return o.queryExtent(y.A.from(t)??e.createQuery(),r)}async function C(e,t,r,n){const o=await $(e);if(!o.queryRelatedFeatures)throw new s.A(n,"Layer source does not support queryRelatedFeatures capability");return o.queryRelatedFeatures(v.default.from(t),r)}async function O(e,t,r,n){const o=await $(e);if(!o.queryRelatedFeaturesCount)throw new s.A(n,"Layer source does not support queryRelatedFeaturesCount capability");return o.queryRelatedFeaturesCount(v.default.from(t),r)}async function R(e){const t=e.source;if(t?.refresh)try{const{dataChanged:r,updates:n}=await t.refresh();if(null!=n&&(e.sourceJSON={...e.sourceJSON,...n},e.read(n,{origin:"service",url:e.parsedUrl})),r)return!0}catch{}if(e.definitionExpression)try{return(await(0,l.G)(e.definitionExpression,e.fieldsIndex)).hasDateFunctions}catch{}return!1}function D(e){const t=new y.A,r=e.capabilities?.data,n=e.capabilities?.query;t.historicMoment=e.historicMoment,t.gdbVersion=e.gdbVersion,t.returnGeometry=!0,n&&(t.compactGeometryEnabled=n.supportsCompactGeometry,t.defaultSpatialReferenceEnabled=n.supportsDefaultSpatialReference),r&&(r.supportsZ&&null!=e.returnZ&&(t.returnZ=e.returnZ),r.supportsM&&null!=e.returnM&&(t.returnM=e.returnM)),t.outFields=["*"];const{timeOffset:o,timeExtent:i}=e;return t.timeExtent=null!=o&&null!=i?i.offset(-o.value,o.unit):i||null,t.multipatchOption="multipatch"===e.geometryType?"xyFootprint":null,t}function N(e){const{globalIdField:t,fields:r}=e;if(t)return t;if(r)for(const e of r)if("esriFieldTypeGlobalID"===e.type)return e.name}function q(e){const{objectIdField:t,fields:r}=e;if(t)return t;if(r)for(const e of r)if("esriFieldTypeOID"===e.type)return e.name}function B(e){return e.currentVersion?e.currentVersion:e.hasOwnProperty("capabilities")||e.hasOwnProperty("drawingInfo")||e.hasOwnProperty("hasAttachments")||e.hasOwnProperty("htmlPopupType")||e.hasOwnProperty("relationships")||e.hasOwnProperty("timeInfo")||e.hasOwnProperty("typeIdField")||e.hasOwnProperty("types")?10:9.3}function G(e,t){const{subtypes:r,subtypeField:n}=e;if(!t?.attributes||!r?.length||!n)return null;const o=t.attributes[n];return null==o?null:r.find((e=>e.code===o))}function T(e,t){const{fieldsIndex:r,subtypeField:n}=e,{name:o}=r.get(t)??{};if(!o)return null;if((n&&r.get(n)?.name)===o&&e.subtypes?.length){const t=e.subtypes.map((e=>new p.H({code:e.code,name:e.name})));if(t?.length)return new d.A({codedValues:t})}return null}function V(e,t){const{fieldsIndex:r}=e,{name:n}=r.get(t)??{};if(!n)return null;if(("typeIdField"in e?r.get(e.typeIdField)?.name:null)===n&&"types"in e&&e.types?.length){const t=e.types.map((e=>new p.H({code:e.id,name:e.name})));return new d.A({codedValues:t})}return null}async function $(e){return(await e.load()).source}async function H(e,t,r){const o=e.parsedUrl?.path;o&&e.authenticationTriggerEvent===t&&await async function(e,t){if(!n.id)return;if(n.id.findCredential(e))return;let r;try{const o=await(0,m.wI)(e,t);o&&(r=await n.id.checkSignInStatus(`${o}/sharing`))}catch(e){}if(r)try{const r=null!=t?t.signal:null;await n.id.getCredential(e,{signal:r})}catch(e){}}(o,r)}function k(e){return!X(e)&&(e.userHasUpdateItemPrivileges||e.editingEnabled)}const J=(0,c.C)({types:o.xK});function z(e,t){if(e.defaultSymbol)return e.types?.length?new w.A({defaultSymbol:J(e.defaultSymbol,e,t),field:e.typeIdField,uniqueValueInfos:e.types.map((e=>({id:e.id,symbol:J(e.symbol,e,t)})))}):new b.A({symbol:J(e.defaultSymbol,e,t)})}function K(e){let t=e.sourceJSON?.cacheMaxAge;if(!t)return!1;const r=e.editingInfo?.lastEditDate?.getTime();return null==r||(t*=1e3,Date.now()-r<t)}async function U(e,t,r){if(null==t)return null;const n=[],{objectIdField:o}=e;if(t.forEach((e=>{let t=null;if("attributes"in e){const{attributes:n}=e;t={globalId:n[r],objectId:null!=n[o]&&-1!==n[o]?n[o]:null}}else t={globalId:e.globalId,objectId:null!=e.objectId&&-1!==e.objectId?e.objectId:null};null!=t.globalId&&(null!=t.objectId&&-1!==t.objectId||n.push(t.globalId))})),0===n.length)return null;const s=e.createQuery();s.where=n.map((e=>`${r}='${e}'`)).join(" OR "),s.returnGeometry=!1,s.outFields=[o,r],s.cacheHint=!1;const a=await(0,i.DZ)(h(e,s));if(!a.ok)return null;const l=new Map,c=a.value.features;for(const e of c){const t=e.attributes[r],n=e.attributes[o];null!=t&&null!=n&&-1!==n&&l.set((0,u.AG)(t),n)}return l}function Q(e,t,r){if(!t||!r||!e)return null;const n=r.getAttribute(t);return null==n?null:e.find((e=>{const{id:t}=e;return null!=t&&t.toString()===n.toString()}))??null}function X(e){return e.sourceJSON?.isMultiServicesView||function(e){return!!e.sourceJSON?.capabilities?.toLowerCase().split(",").map((e=>e.trim())).includes("map")}(e)}function W(e,t,r){const n=t?.queryBins;if(!n)throw new s.A(r,"Layer source does not support binning");switch(e.binParameters.type){case"auto-interval":if(!n.supportsAutoInterval)throw new s.A(r,"Layer source does not support auto-interval binning");break;case"date":if(!n.supportsDate)throw new s.A(r,"Layer source does not support date binning");break;case"fixed-boundaries":if(!n.supportsFixedBoundaries)throw new s.A(r,"Layer source does not support fixed-boundaries binning");break;case"fixed-interval":if(!n.supportsFixedInterval)throw new s.A(r,"Layer source does not support fixed-interval binning")}const o=n?.supportedStatistics;if(e.outStatistics&&o){const t=new Map([["count","count"],["sum","sum"],["min","min"],["max","max"],["avg","avg"],["stddev","stddev"],["var","var"],["percentile-continuous","percentileContinuous"],["percentile-discrete","percentileDiscrete"],["centroid-aggregate","centroid"],["convex-hull-aggregate","convexHull"],["envelope-aggregate","envelope"]]);for(const{statisticType:n}of e.outStatistics){const e=t.get(n);if(e&&!o[e])throw new s.A(r,`Layer source does not support ${n} statistic type`)}}}},39383:(e,t,r)=>{r.d(t,{w:()=>l,z:()=>c});var n=r(49186),o=r(53966),i=r(81457);const s=()=>o.A.getLogger("esri.layers.support.labelingInfo"),a=/\[([^[\]]+)\]/gi;function l(e,t,r){return e?e.map((e=>{const n=new i.A;if(n.read(e,r),n.labelExpression){const e=t.fields||t.layerDefinition?.fields||this.fields;n.labelExpression=n.labelExpression.replaceAll(a,((t,r)=>`[${function(e,t){if(!t)return e;const r=e.toLowerCase();for(let e=0;e<t.length;e++){const n=t[e].name;if(n.toLowerCase()===r)return n}return e}(r,e)}]`))}return n})):null}const u={esriGeometryPoint:["above-right","above-center","above-left","center-center","center-left","center-right","below-center","below-left","below-right"],esriGeometryMultiPatch:["always-horizontal"],esriGeometryPolygon:["always-horizontal"],esriGeometryPolyline:["center-along","above-along","below-along"],esriGeometryMultipoint:null,esriGeometryEnvelope:null};function c(e,t){const r=[];for(const o of e){const e=o.labelPlacement,i=u[t];if(!o.symbol)return s().warn("No ILabelClass symbol specified."),[];if(!i)return s().error(new n.A("labeling:unsupported-geometry-type",`Unable to create labels for layer, geometry type '${t}' is not supported`)),[];if(i.includes(e))r.push(o);else{const n=i[0];e&&s().warn(`Found invalid label placement type ${e} for ${t}. Defaulting to ${n}`);const a=o.clone();a.labelPlacement=n,r.push(a)}}return r}},54546:(e,t,r)=>{r.d(t,{A:()=>d});var n,o=r(90237),i=r(25482),s=r(4718),a=r(10107),l=r(56507),u=r(40608),c=r(43937);let p=n=class extends i.oY{constructor(e){super(e),this.attachmentTypes=null,this.attachmentsWhere=null,this.cacheHint=void 0,this.keywords=null,this.globalIds=null,this.name=null,this.num=null,this.objectIds=null,this.returnMetadata=!1,this.size=null,this.start=null,this.where=null}writeStart(e,t){t.resultOffset=this.start,t.resultRecordCount=this.num||10}clone(){return new n((0,s.o8)({attachmentTypes:this.attachmentTypes,attachmentsWhere:this.attachmentsWhere,cacheHint:this.cacheHint,keywords:this.keywords,where:this.where,globalIds:this.globalIds,name:this.name,num:this.num,objectIds:this.objectIds,returnMetadata:this.returnMetadata,size:this.size,start:this.start}))}};(0,o._)([(0,a.MZ)({type:[String],json:{write:!0}})],p.prototype,"attachmentTypes",void 0),(0,o._)([(0,a.MZ)({type:String,json:{read:{source:"attachmentsDefinitionExpression"},write:{target:"attachmentsDefinitionExpression"}}})],p.prototype,"attachmentsWhere",void 0),(0,o._)([(0,a.MZ)({type:Boolean,json:{write:!0}})],p.prototype,"cacheHint",void 0),(0,o._)([(0,a.MZ)({type:[String],json:{write:!0}})],p.prototype,"keywords",void 0),(0,o._)([(0,a.MZ)({type:[String],json:{write:!0}})],p.prototype,"globalIds",void 0),(0,o._)([(0,a.MZ)({json:{write:!0}})],p.prototype,"name",void 0),(0,o._)([(0,a.MZ)({type:Number,json:{read:{source:"resultRecordCount"}}})],p.prototype,"num",void 0),(0,o._)([(0,a.MZ)({type:[Number],json:{write:!0}})],p.prototype,"objectIds",void 0),(0,o._)([(0,a.MZ)({type:Boolean,json:{default:!1,write:!0}})],p.prototype,"returnMetadata",void 0),(0,o._)([(0,a.MZ)({type:[Number],json:{write:!0}})],p.prototype,"size",void 0),(0,o._)([(0,a.MZ)({type:Number,json:{read:{source:"resultOffset"}}})],p.prototype,"start",void 0),(0,o._)([(0,c.K)("start"),(0,c.K)("num")],p.prototype,"writeStart",null),(0,o._)([(0,a.MZ)({type:String,json:{read:{source:"definitionExpression"},write:{target:"definitionExpression"}}})],p.prototype,"where",void 0),p=n=(0,o._)([(0,u.$)("esri.rest.support.AttachmentQuery")],p),p.from=(0,l.dp)(p);const d=p},26591:(e,t,r)=>{r.r(t),r.d(t,{default:()=>h});var n,o=r(90237),i=(r(59456),r(25482)),s=r(4718),a=r(10107),l=r(56507),u=r(40608),c=r(43937),p=r(27733),d=r(16930);let y=n=class extends i.oY{constructor(e){super(e),this.cacheHint=void 0,this.dynamicDataSource=void 0,this.gdbVersion=null,this.geometryPrecision=void 0,this.historicMoment=null,this.maxAllowableOffset=void 0,this.objectIds=null,this.orderByFields=null,this.outFields=null,this.outSpatialReference=null,this.relationshipId=void 0,this.start=void 0,this.num=void 0,this.returnGeometry=!1,this.returnM=void 0,this.returnZ=void 0,this.where=null}_writeHistoricMoment(e,t){t.historicMoment=e&&e.getTime()}writeStart(e,t){t.resultOffset=this.start,t.resultRecordCount=this.num||10,this.start>0&&null==this.where&&(t.definitionExpression="1=1")}clone(){return new n((0,s.o8)({cacheHint:this.cacheHint,dynamicDataSource:this.dynamicDataSource,gdbVersion:this.gdbVersion,geometryPrecision:this.geometryPrecision,historicMoment:this.historicMoment&&new Date(this.historicMoment.getTime()),maxAllowableOffset:this.maxAllowableOffset,objectIds:this.objectIds,orderByFields:this.orderByFields,outFields:this.outFields,outSpatialReference:this.outSpatialReference,relationshipId:this.relationshipId,start:this.start,num:this.num,returnGeometry:this.returnGeometry,where:this.where,returnZ:this.returnZ,returnM:this.returnM}))}};(0,o._)([(0,a.MZ)({type:Boolean,json:{write:!0}})],y.prototype,"cacheHint",void 0),(0,o._)([(0,a.MZ)({type:p.L,json:{write:!0}})],y.prototype,"dynamicDataSource",void 0),(0,o._)([(0,a.MZ)({type:String,json:{write:!0}})],y.prototype,"gdbVersion",void 0),(0,o._)([(0,a.MZ)({type:Number,json:{write:!0}})],y.prototype,"geometryPrecision",void 0),(0,o._)([(0,a.MZ)({type:Date})],y.prototype,"historicMoment",void 0),(0,o._)([(0,c.K)("historicMoment")],y.prototype,"_writeHistoricMoment",null),(0,o._)([(0,a.MZ)({type:Number,json:{write:!0}})],y.prototype,"maxAllowableOffset",void 0),(0,o._)([(0,a.MZ)({json:{write:!0}})],y.prototype,"objectIds",void 0),(0,o._)([(0,a.MZ)({type:[String],json:{write:!0}})],y.prototype,"orderByFields",void 0),(0,o._)([(0,a.MZ)({type:[String],json:{write:!0}})],y.prototype,"outFields",void 0),(0,o._)([(0,a.MZ)({type:d.A,json:{read:{source:"outSR"},write:{target:"outSR"}}})],y.prototype,"outSpatialReference",void 0),(0,o._)([(0,a.MZ)({json:{write:!0}})],y.prototype,"relationshipId",void 0),(0,o._)([(0,a.MZ)({type:Number,json:{read:{source:"resultOffset"}}})],y.prototype,"start",void 0),(0,o._)([(0,c.K)("start"),(0,c.K)("num")],y.prototype,"writeStart",null),(0,o._)([(0,a.MZ)({type:Number,json:{read:{source:"resultRecordCount"}}})],y.prototype,"num",void 0),(0,o._)([(0,a.MZ)({json:{write:!0}})],y.prototype,"returnGeometry",void 0),(0,o._)([(0,a.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],y.prototype,"returnM",void 0),(0,o._)([(0,a.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],y.prototype,"returnZ",void 0),(0,o._)([(0,a.MZ)({type:String,json:{read:{source:"definitionExpression"},write:{target:"definitionExpression"}}})],y.prototype,"where",void 0),y=n=(0,o._)([(0,u.$)("esri.rest.support.RelationshipQuery")],y),y.from=(0,l.dp)(y);const h=y},30291:(e,t,r)=>{r.d(t,{tn:()=>u});var n=r(13874),o=r(30524),i=r(28122),s=(r(84424),r(80737),r(96808),r(66159)),a=(r(67336),r(92094),r(23721),r(70696),r(41227)),l=r(68780);function u({displayField:e,editFieldsInfo:t,fields:r,objectIdField:l,title:u},y){if(!r)return null;const f=function(e,t){const r=t?.visibleFieldNames;return function({fields:e,ignoreFieldTypes:t,sortDisabled:r}){const n=e;return t&&(e=e.filter((e=>!t.includes(e.type)))),e===n&&(e=e.slice()),!0!==r&&e.sort(p),e}({fields:e.fields??[],ignoreFieldTypes:t?.ignoreFieldTypes||h,sortDisabled:t?.sortDisabled}).map((t=>new a.A({fieldName:t.name,isEditable:(0,o.R$)(t,e),label:t.alias,format:d(t),visible:c(t,{...e,visibleFieldNames:r})})))}({editFieldsInfo:t,fields:r,objectIdField:l},y);if(!f.length)return null;const m=function(e){const t=(0,o.mB)(e),{titleBase:r}=e;return t?`${r}: {${t.trim()}}`:r??""}({titleBase:u,fields:r,displayField:e}),b=[new s.A,new i.A];return new n.A({title:m,content:b,fieldInfos:f})}const c=(e,t)=>t.visibleFieldNames?t.visibleFieldNames.has(e.name):(0,o.Bz)(e,t);function p(e,t){return"oid"===e.type?-1:"oid"===t.type?1:y(e)?-1:y(t)?1:(e.alias||e.name).toLocaleLowerCase().localeCompare((t.alias||t.name).toLocaleLowerCase())}function d(e){switch(e.type){case"small-integer":case"integer":case"single":return new l.A({digitSeparator:!0,places:0});case"double":return new l.A({digitSeparator:!0,places:2});case"string":return(0,o.JL)(e.name)?new l.A({digitSeparator:!0,places:0}):void 0;default:return}}function y(e){if("name"===(e.name&&e.name.toLowerCase()))return!0;const t=e.alias?.toLowerCase();return"name"===t}const h=["geometry","blob","raster","guid","xml"]}}]);