/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../../core/maybe","../../../../chunks/mat4","../../../../chunks/mat4f64","../../../../chunks/vec3f64","../../../../chunks/vec4","../../../../chunks/vec4f64","../../../../geometry/projection","../../../../geometry/support/aaBoundingBox","../../../../geometry/support/aaBoundingRect","../../../../geometry/support/centroid","../../../../geometry/support/coordsUtils","../../../../layers/graphics/dehydratedFeatures","../../../../layers/graphics/hydratedFeatures","../../webgl-engine/lib/VertexAttribute"],(function(e,t,n,r,o,i,u,s,a,l,c,m,d,h,f){"use strict";function y(e,t){if("point"===e.type)return b(e,t,!1);if(h.isHydratedGeometry(e))switch(e.type){case"extent":return b(e.center,t,!1);case"polygon":return b(e.centroid,t,!1);case"polyline":return b(g(e),t,!0);case"mesh":return b(e.origin,t,!1)}else switch(e.type){case"extent":return b(p(e),t,!0);case"polygon":return b(x(e),t,!0);case"polyline":return b(g(e),t,!0)}}function g(e){const t=e.paths[0];if(!t||0===t.length)return null;const n=m.getPointOnPath(t,m.getPathLength(t)/2);return d.makeDehydratedPoint(n[0],n[1],n[2],e.spatialReference)}function p(e){const t=isFinite(e.zmin);return d.makeDehydratedPoint(.5*(e.xmax+e.xmin),.5*(e.ymax+e.ymin),t?.5*(e.zmax+e.zmin):void 0,e.spatialReference)}function x(e){const t=e.rings[0];if(!t||0===t.length)return null;const n=c.ringsCentroid(e.rings,e.hasZ);return d.makeDehydratedPoint(n[0],n[1],n[2],e.spatialReference)}function b(e,t,n){const r=n?e:h.clonePoint(e);return t&&e?s.projectPoint(e,r,t)?r:null:r}function S(e,t,n,r=0){if(e){t||(t=l.create());const o=e;let u=.5*o.width*(n-1),s=.5*o.height*(n-1);return o.width<1e-7*o.height?u+=s/20:o.height<1e-7*o.width&&(s+=u/20),i.set(t,o.xmin-u-r,o.ymin-s-r,o.xmax+u+r,o.ymax+s+r),t}return null}function P(e,t){for(let n=0;n<e.geometries.length;++n){const r=e.geometries[n].getMutableAttribute(f.VertexAttribute.AUXPOS1);r&&r.data[3]!==t&&(r.data[3]=t,e.geometryVertexAttrsUpdated(e.geometryRecords[n]))}}function v(e,n){const r=u.clone(u.ONES);return t.isSome(e)&&(r[0]=e[0],r[1]=e[1],r[2]=e[2]),t.isSome(n)?r[3]=n:t.isSome(e)&&e.length>3&&(r[3]=e[3]),r}function A(e,n,r,o,i,u=[0,0,0,0]){for(let s=0;s<3;++s)t.isSome(e)&&null!=e[s]?u[s]=e[s]:t.isSome(r)&&null!=r[s]?u[s]=r[s]:u[s]=i[s];return t.isSome(n)?u[3]=n:t.isSome(o)?u[3]=o:u[3]=i[3],u}function R(e=o.ONES,n,r,i=1){const u=new Array(3);if(t.isNone(n)||t.isNone(r))u[0]=1,u[1]=1,u[2]=1;else{let t,o=0;for(let i=2;i>=0;i--){const s=e[i];let a;const l=null!=s,c=0===i&&!t&&!l,m=r[i];"symbol-value"===s||c?a=0!==m?n[i]/m:1:l&&"proportional"!==s&&isFinite(s)&&(a=0!==m?s/m:1),null!=a&&(u[i]=a,t=a,o=Math.max(o,Math.abs(a)))}for(let e=2;e>=0;e--)null==u[e]?u[e]=t:0===u[e]&&(u[e]=.001*o)}for(let t=2;t>=0;t--)u[t]/=i;return o.fromArray(u)}function w(e){return null!=e.isPrimitive}function k(e){return w(e)&&(e=[e.width,e.depth,e.height]),M(e)?null:"Symbol sizes may not be negative values"}function M(e){if(Array.isArray(e)){for(const t of e)if(!M(t))return!1;return!0}return null==e||e>=0}function O(e,t,o,i=r.create()){const u=e||0,s=t||0,a=o||0;return 0!==u&&n.rotateZ(i,i,-u/180*Math.PI),0!==s&&n.rotateX(i,i,s/180*Math.PI),0!==a&&n.rotateY(i,i,a/180*Math.PI),i}function D(e,t){return null!=t.minDemResolution?t.minDemResolution:a.isPoint(e)?t.minDemResolutionForPoints:.01*a.maximumDimension(e)}e.computeCentroid=y,e.computeObjectRotation=O,e.computeObjectScale=R,e.demResolutionForBoundingBox=D,e.enlargeExtent=S,e.isValidSize=M,e.mixinColorAndOpacity=v,e.overrideColor=A,e.updateVertexAttributeAuxpos1w=P,e.validateSymbolLayerSize=k,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
