/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{If as e,glsl as t}from"../../../core/shaderModules/glsl.js";function n(n,s){const i=2===s.type,o=0===s.type;n.attributes.add("sideness","vec2"),n.vertex.code.add(t`
    struct UnpackedAttributes {
      vec2 sideness;
      vec2 sidenessNorm;
      float lineWidthPixels;
      float extensionLengthPixels;
      ${e(i,"float type;")}
    };
  `).code.add(t`
    UnpackedAttributes unpackAttributes(ComponentData component) {
      vec2 sidenessNorm = sideness;
      vec2 sideness = sidenessNorm * 2.0 - 1.0;
      float extensionLengthPixels = component.extensionLength;
      float lineWidth = component.lineWidth;
      ${e(i,"if (component.type <= 0.0) {")}
      ${e(!o,"extensionLengthPixels *= variantExtension * 2.0 - 1.0;")}
      ${e(i,"}")}
      return UnpackedAttributes(sideness, sidenessNorm, lineWidth, extensionLengthPixels ${e(i,", component.type")});
    }
  `)}export{n as UnpackAttributes};
