/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{freeze as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ManagedTexture as r}from"../../webgl-engine/lib/ManagedTexture.js";import{SizedPixelFormat as n,PixelType as e}from"../../../webgl/enums.js";const a=128,o=.5,u=t(o/2,o/2,1-o/2,1-o/2);function c(t){return"cross"===t||"x"===t}function s(t,n=a,e=n*o,u=0){const{data:c,parameters:s}=i(t,n,e,u);return new r(c,s)}function i(t,r=a,u=r*o,c=0){return{data:f(t,r,u,c),parameters:{mipmap:!1,wrap:{s:33071,t:33071},width:r,height:r,noUnpackFlip:!0,dataType:e.FLOAT,pixelFormat:6403,internalFormat:n.R16F,reloadable:!0}}}function f(t,r=a,n=r*o,e=0){switch(t){case"circle":default:return h(r,n);case"square":return M(r,n);case"cross":return m(r,n,e);case"x":return p(r,n,e);case"kite":return l(r,n);case"triangle":return b(r,n);case"arrow":return x(r,n)}}function h(t,r){const n=t/2-.5;return R(t,d(n,n,r/2))}function M(t,r){return T(t,r,!1)}function l(t,r){return T(t,r,!0)}function m(t,r,n=0){return w(t,r,!1,n)}function p(t,r,n=0){return w(t,r,!0,n)}function b(t,r){return R(t,g(t/2,r,r/2))}function x(t,r){const n=r,e=r/2,a=t/2,o=.8*n,u=d(a,(t-r)/2-o,Math.sqrt(o*o+e*e)),c=g(a,n,e);return R(t,(t,r)=>Math.max(c(t,r),-u(t,r)))}function T(t,r,n){return n&&(r/=Math.SQRT2),R(t,(e,a)=>{let o=e-.5*t+.25,u=.5*t-a-.75;if(n){const t=(o+u)/Math.SQRT2;u=(u-o)/Math.SQRT2,o=t}return Math.max(Math.abs(o),Math.abs(u))-.5*r})}function w(t,r,n,e=0){r-=e,n&&(r*=Math.SQRT2);const a=.5*r;return R(t,(r,o)=>{let u,c=r-.5*t,s=.5*t-o-1;if(n){const t=(c+s)/Math.SQRT2;s=(s-c)/Math.SQRT2,c=t}return c=Math.abs(c),s=Math.abs(s),u=c>s?c>a?Math.sqrt((c-a)*(c-a)+s*s):s:s>a?Math.sqrt(c*c+(s-a)*(s-a)):c,u-=e/2,u})}function d(t,r,n){return(e,a)=>{const o=e-t,u=a-r;return Math.sqrt(o*o+u*u)-n}}function g(t,r,n){const e=Math.sqrt(r*r+n*n);return(a,o)=>{const u=Math.abs(a-t)-n,c=o-t+r/2+.75,s=(r*u+n*c)/e,i=-c;return Math.max(s,i)}}function R(t,r){const n=new Float32Array(t*t);for(let e=0;e<t;e++)for(let a=0;a<t;a++){n[a+t*e]=r(a,e)/t}return n}export{x as createArrow,h as createCircle,m as createCross,l as createKite,f as createPrimitive,M as createSquare,s as createTexture,i as createTextureInfo,b as createTriangle,p as createX,u as defaultBoundingBox,o as defaultSymbolSizeRatio,a as defaultTexSize,c as requiresHalfTexelOffset};
