/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../../../../chunks/_rollupPluginBabelHelpers","../../../../../core/maybe","../enums","../Utils","./WGLGeometryBrush","../materialKey/MaterialKey","../../../../webgl/enums"],(function(e,t,a,n,o,i,r){"use strict";const s=e=>n.createProgramDescriptor(e.data,{geometry:[{location:0,name:"a_pos",count:2,type:r.DataType.SHORT},{location:1,name:"a_id",count:4,type:r.DataType.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:r.DataType.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_offsetAndNormal",count:4,type:r.DataType.BYTE},{location:4,name:"a_accumulatedDistanceAndHalfWidth",count:2,type:r.DataType.UNSIGNED_SHORT},{location:5,name:"a_tlbr",count:4,type:r.DataType.UNSIGNED_SHORT},{location:6,name:"a_segmentDirection",count:4,type:r.DataType.BYTE},{location:7,name:"a_aux",count:2,type:r.DataType.UNSIGNED_SHORT},{location:8,name:"a_zoomRange",count:2,type:r.DataType.UNSIGNED_SHORT}]});let l=function(n){function o(){return n.apply(this,arguments)||this}e._inheritsLoose(o,n);var l=o.prototype;return l.dispose=function(){},l.getGeometryType=function(){return a.WGLGeometryType.LINE},l.supportsSymbology=function(e){return!0},l.drawGeometry=function(e,a,n,o){const{context:l,painter:u,rendererInfo:c,displayLevel:m,passOptions:y,requestRender:p}=e,T=i.LineMaterialKey.load(n.materialKey),_=t.isSome(y)&&"hittest"===y.type;let d=s(T),f=r.PrimitiveType.TRIANGLES;_&&(d=this._getTriangleDesc(n.materialKey,d),f=r.PrimitiveType.POINTS);const{attributes:D,bufferLayouts:g}=d,E=u.materialManager.getMaterialProgram(e,T,"materials/line",D,o);if(t.isSome(p)&&!_&&!E.isCompiled)return void p();const N=1/e.pixelRatio,S=0;l.useProgram(E),this._setSharedUniforms(E,e,a),T.textureBinding&&u.textureManager.bindTextures(l,E,T);const U=2**(m-a.key.level);E.setUniform1f("u_zoomFactor",U),E.setUniform1f("u_blur",S+N),E.setUniform1f("u_antialiasing",N),this._setSizeVVUniforms(T,E,c,a),this._setColorAndOpacityVVUniforms(T,E,c),l.setFaceCullingEnabled(!1);const G=n.target.getVAO(l,g,D,_);let h=n.indexCount,I=n.indexFrom*Uint32Array.BYTES_PER_ELEMENT;_&&(h/=3,I/=3),l.bindVAO(G),l.drawElements(f,h,r.DataType.UNSIGNED_INT,I)},o}(o);return l}));
