text: /*
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  See https://js.arcgis.com/4.19/esri/copyright.txt for details.
  */
  function n(n,t){return n?t?4:3:t?3:2}function t(t,I,o,u,l){if(!I||!I.lengths.length)return null;const N="upperLeft"===(null==l?void 0:l.originPosition)?-1:1;t.lengths.length&&(t.lengths.length=0),t.coords.length&&(t.coords.length=0);const s=t.coords,c=[],f=o?[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY]:[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY],{lengths:i,coords:T}=I,h=n(o,u);let g=0;for(const n of i){const t=e(f,T,g,n,o,u,N);t&&c.push(t),g+=n*h;}if(c.sort(((n,t)=>{let e=N*n[2]-N*t[2];return 0===e&&o&&(e=n[4]-t[4]),e})),c.length){let n=6*c[0][2];s[0]=c[0][0]/n,s[1]=c[0][1]/n,o&&(n=6*c[0][4],s[2]=0!==n?c[0][3]/n:0),(s[0]<f[0]||s[0]>f[1]||s[1]<f[2]||s[1]>f[3]||o&&(s[2]<f[4]||s[2]>f[5]))&&(s.length=0);}if(!s.length){const n=I.lengths[0]?r(T,0,i[0],o,u):null;if(!n)return null;s[0]=n[0],s[1]=n[1],o&&n.length>2&&(s[2]=n[2]);}return t}function e(t,e,r,I,o,u,l=1){const N=n(o,u);let s=r,c=r+N,f=0,i=0,T=0,h=0,g=0;for(let n=0,b=I-1;n<b;n++,s+=N,c+=N){const n=e[s],r=e[s+1],I=e[s+2],u=e[c],l=e[c+1],N=e[c+2];let E=n*l-u*r;h+=E,f+=(n+u)*E,i+=(r+l)*E,o&&(E=n*N-u*I,T+=(I+N)*E,g+=E),n<t[0]&&(t[0]=n),n>t[1]&&(t[1]=n),r<t[2]&&(t[2]=r),r>t[3]&&(t[3]=r),o&&(I<t[4]&&(t[4]=I),I>t[5]&&(t[5]=I));}if(h*l>0&&(h*=-1),g*l>0&&(g*=-1),!h)return null;const E=[f,i,.5*h];return o&&(E[3]=T,E[4]=.5*g),E}function r(t,e,r,N,s){const c=n(N,s);let f=e,i=e+c,T=0,h=0,g=0,E=0;for(let n=0,b=r-1;n<b;n++,f+=c,i+=c){const n=t[f],e=t[f+1],r=t[f+2],s=t[i],c=t[i+1],b=t[i+2],m=N?o(n,e,r,s,c,b):I(n,e,s,c);if(m)if(T+=m,N){const t=l(n,e,r,s,c,b);h+=m*t[0],g+=m*t[1],E+=m*t[2];}else {const t=u(n,e,s,c);h+=m*t[0],g+=m*t[1];}}return T>0?N?[h/T,g/T,E/T]:[h/T,g/T]:r>0?N?[t[e],t[e+1],t[e+2]]:[t[e],t[e+1]]:null}function I(n,t,e,r){const I=e-n,o=r-t;return Math.sqrt(I*I+o*o)}function o(n,t,e,r,I,o){const u=r-n,l=I-t,N=o-e;return Math.sqrt(u*u+l*l+N*N)}function u(n,t,e,r){return [n+.5*(e-n),t+.5*(r-t)]}function l(n,t,e,r,I,o){return [n+.5*(r-n),t+.5*(I-t),e+.5*(o-e)]}
  
  export { t };
  