declare var _default: "// Units and calibration\nuniform float worldUnit;\nuniform float lineWidth;\nuniform float lineDepth;\nuniform float focusDepth;\n\n// General data index\nuniform vec4 geometryClip;\nattribute vec4 position4;\n\n// (Top/bottom -1,1)\nattribute float line;\n\n// 0...1 for round or bevel joins\n#ifdef LINE_JOIN_DETAIL\nattribute float joint;\n#else\nconst float joint = 0.0;\n#endif\n\n// Knock out excessively long line segments (e.g. for asymtpotes)\n#ifdef LINE_PROXIMITY\nuniform float lineProximity;\nvarying float vClipProximity;\n#endif\n\n// Ghetto line stroking (local only, not global)\n#ifdef LINE_STROKE\nvarying float vClipStrokeWidth;\nvarying float vClipStrokeIndex;\nvarying vec3 vClipStrokeEven;\nvarying vec3 vClipStrokeOdd;\nvarying vec3 vClipStrokePosition;\n#endif\n\n// External\nvec3 getPosition(vec4 xyzw, float canonical);\n\n// Clip line ends for arrows / decoration\n#ifdef LINE_CLIP\nuniform float clipRange;\nuniform vec2 clipStyle;\nuniform float clipSpace;\n\nattribute vec2 strip;\n\nvarying vec2 vClipEnds;\n\nvoid clipEnds(vec4 xyzw, vec3 center, vec3 pos) {\n\n // Sample start of line strip\n vec4 xyzwS = vec4(0.0, xyzw.yzw);\n vec3 start = getPosition(xyzwS, 0.0);\n\n // Sample middle of line strip\n vec4 xyzwM = vec4(geometryClip.x / 2.0, xyzw.yzw);\n vec3 middle = getPosition(xyzwM, 0.0);\n\n#ifdef LINE_CLOSED\n vec3 end = start;\n#else\n // Sample other end of line strip\n vec4 xyzwE = vec4(geometryClip.x, xyzw.yzw);\n vec3 end = getPosition(xyzwE, 0.0);\n#endif\n\n // Measure length\n float l = max(length(end - middle), length(middle - start)) * clipSpace * 2.0;\n\n // Arrow length (=2.5x radius)\n float arrowSize = 1.25 * clipRange * lineWidth * worldUnit;\n\n#ifdef LINE_CLOSED\n // Clip around start/end\n end = start;\n#endif\n\n vClipEnds = vec2(1.0);\n\n if (clipStyle.y > 0.0) {\n // Depth blend end\n float depth = focusDepth;\n if (lineDepth < 1.0) {\n float z = max(0.00001, -end.z);\n depth = mix(z, focusDepth, lineDepth);\n }\n\n // Absolute arrow length\n float size = arrowSize * depth;\n\n // Adjust clip range\n // Approach linear scaling with cubic ease the smaller we get\n float mini = clamp(1.0 - l / size * .333, 0.0, 1.0);\n float scale = 1.0 - mini * mini * mini;\n float invrange = 1.0 / (size * scale);\n\n // Clip end\n vec3 diff = end - center;\n if(diff == vec3(0.0))\n vClipEnds.x = -1.0;\n else {\n diff = normalize(end - center);\n float d = dot(end - pos, diff);\n vClipEnds.x = d * invrange - 1.0;\n }\n }\n\n if (clipStyle.x > 0.0) {\n // Depth blend start\n float depth = focusDepth;\n if (lineDepth < 1.0) {\n float z = max(0.00001, -start.z);\n depth = mix(z, focusDepth, lineDepth);\n }\n\n // Absolute arrow length\n float size = arrowSize * depth;\n\n // Adjust clip range\n // Approach linear scaling with cubic ease the smaller we get\n float mini = clamp(1.0 - l / size * .333, 0.0, 1.0);\n float scale = 1.0 - mini * mini * mini;\n float invrange = 1.0 / (size * scale);\n\n // Clip start\n vec3 diff = center - start;\n if(diff == vec3(0.0))\n vClipEnds.y = -1.0;\n else {\n diff = normalize(center - start);\n float d = dot(pos - start, diff);\n vClipEnds.y = d * invrange - 1.0;\n }\n }\n}\n#endif\n\n// Adjust left/center/right to be inside near/far z range\nconst float epsilon = 1e-5;\nvoid fixCenter(inout vec3 left, inout vec3 center, inout vec3 right) {\n if (center.z >= 0.0) {\n if (left.z < 0.0) {\n float d = (center.z + epsilon) / (center.z - left.z);\n center = mix(center, left, d);\n }\n else if (right.z < 0.0) {\n float d = (center.z + epsilon) / (center.z - right.z);\n center = mix(center, right, d);\n }\n }\n\n if (left.z >= 0.0) {\n if (center.z < 0.0) {\n float d = (left.z + epsilon) / (left.z - center.z);\n left = mix(left, center, d);\n }\n }\n\n if (right.z >= 0.0) {\n if (center.z < 0.0) {\n float d = (right.z + epsilon) / (right.z - center.z);\n right = mix(right, center, d);\n }\n }\n}\n\nvec4 wrapAround(vec4 xyzw) {\n#ifdef LINE_CLOSED\n float gx = geometryClip.x;\n if (xyzw.x < 0.0) xyzw.x += gx;\n if (xyzw.x >= gx) xyzw.x -= gx;\n#endif\n return xyzw;\n}\n\n// Sample the source data in an edge-aware manner\nvoid getLineGeometry(vec4 xyzw, float edge, out vec3 left, out vec3 center, out vec3 right) {\n vec4 delta = vec4(1.0, 0.0, 0.0, 0.0);\n\n center = getPosition(xyzw, 1.0);\n left = (edge > -0.5) ? getPosition(wrapAround(xyzw - delta), 0.0) : center;\n right = (edge < 0.5) ? getPosition(wrapAround(xyzw + delta), 0.0) : center;\n}\n\n// Calculate the position for a vertex along the line, including joins\nvec3 getLineJoin(float edge, bool odd, vec3 left, vec3 center, vec3 right, float width, float offset, float joint) {\n vec2 join = vec2(1.0, 0.0);\n\n fixCenter(left, center, right);\n\n vec4 a = vec4(left.xy, right.xy);\n vec4 b = a / vec4(left.zz, right.zz);\n\n vec2 l = b.xy;\n vec2 r = b.zw;\n vec2 c = center.xy / center.z;\n\n vec4 d = vec4(l, c) - vec4(c, r);\n float l1 = dot(d.xy, d.xy);\n float l2 = dot(d.zw, d.zw);\n\n if (l1 + l2 > 0.0) {\n\n if (edge > 0.5 || l2 == 0.0) {\n vec2 nl = normalize(d.xy);\n vec2 tl = vec2(nl.y, -nl.x);\n\n#ifdef LINE_PROXIMITY\n vClipProximity = 1.0;\n#endif\n\n#ifdef LINE_STROKE\n vClipStrokeEven = vClipStrokeOdd = normalize(left - center);\n#endif\n join = tl;\n }\n else if (edge < -0.5 || l1 == 0.0) {\n vec2 nr = normalize(d.zw);\n vec2 tr = vec2(nr.y, -nr.x);\n\n#ifdef LINE_PROXIMITY\n vClipProximity = 1.0;\n#endif\n\n#ifdef LINE_STROKE\n vClipStrokeEven = vClipStrokeOdd = normalize(center - right);\n#endif\n join = tr;\n }\n else {\n // Limit join stretch for tiny segments\n float lmin2 = min(l1, l2) / (width * width);\n\n // Hide line segment if ratio of leg lengths exceeds promixity threshold\n#ifdef LINE_PROXIMITY\n float lr = l1 / l2;\n float rl = l2 / l1;\n float ratio = max(lr, rl);\n float thresh = lineProximity + 1.0;\n vClipProximity = (ratio > thresh * thresh) ? 1.0 : 0.0;\n#endif\n\n // Calculate normals/tangents\n vec2 nl = normalize(d.xy);\n vec2 nr = normalize(d.zw);\n\n // Calculate tangents\n vec2 tl = vec2(nl.y, -nl.x);\n vec2 tr = vec2(nr.y, -nr.x);\n\n#ifdef LINE_PROXIMITY\n // Mix tangents according to leg lengths\n vec2 tc = normalize(mix(tl, tr, l1/(l1+l2)));\n#else\n // Average tangent\n vec2 tc = normalize(tl + tr);\n#endif\n\n // Miter join\n float cosA = dot(nl, tc);\n float sinA = max(0.1, abs(dot(tl, tc)));\n float factor = cosA / sinA;\n float scale = sqrt(1.0 + min(lmin2, factor * factor));\n\n // Stroke normals\n#ifdef LINE_STROKE\n vec3 stroke1 = normalize(left - center);\n vec3 stroke2 = normalize(center - right);\n\n if (odd) {\n vClipStrokeEven = stroke1;\n vClipStrokeOdd = stroke2;\n }\n else {\n vClipStrokeEven = stroke2;\n vClipStrokeOdd = stroke1;\n }\n#endif\n\n#ifdef LINE_JOIN_MITER\n // Apply straight up miter\n join = tc * scale;\n#endif\n\n#ifdef LINE_JOIN_ROUND\n // Slerp bevel join into circular arc\n float dotProduct = dot(nl, nr);\n float angle = acos(dotProduct);\n float sinT = sin(angle);\n join = (sin((1.0 - joint) * angle) * tl + sin(joint * angle) * tr) / sinT;\n#endif\n\n#ifdef LINE_JOIN_BEVEL\n // Direct bevel join between two flat ends\n float dotProduct = dot(nl, nr);\n join = mix(tl, tr, joint);\n#endif\n\n#ifdef LINE_JOIN_DETAIL\n // Check if on inside or outside of joint\n float crossProduct = nl.x * nr.y - nl.y * nr.x;\n if (offset * crossProduct < 0.0) {\n // For near-180-degree bends, correct back to a miter to avoid discontinuities\n float ratio = clamp(-dotProduct * 2.0 - 1.0, 0.0, 1.0);\n // Otherwise collapse the inside vertices into one.\n join = mix(tc * scale, join, ratio * ratio * ratio);\n }\n#endif\n\n }\n return vec3(join, 0.0);\n }\n else {\n return vec3(0.0);\n }\n\n}\n\n// Calculate final line position\nvec3 getLinePosition() {\n vec3 left, center, right, join;\n\n // Up/down along segment\n float offset = line;\n\n // Clip data\n vec4 p = min(geometryClip, position4);\n\n // Left/center/right\n float edge = 0.0;\n#ifdef LINE_CLOSED\n if (p.x == geometryClip.x) p.x = 0.0;\n#else\n if (p.x == geometryClip.x) edge = 1.0;\n if (p.x == 0.0) edge = -1.0;\n#endif\n\n // Get position + adjacent neighbours\n getLineGeometry(p, edge, left, center, right);\n\n#ifdef LINE_STROKE\n // Set parameters for line stroke fragment shader\n vClipStrokePosition = center;\n vClipStrokeIndex = p.x;\n bool odd = mod(p.x, 2.0) >= 1.0;\n#else\n bool odd = true;\n#endif\n\n // Divide line width up/down\n float width = lineWidth * 0.5;\n\n float depth = focusDepth;\n if (lineDepth < 1.0) {\n // Depth blending\n float z = max(0.00001, -center.z);\n depth = mix(z, focusDepth, lineDepth);\n }\n width *= depth;\n\n // Convert to world units\n width *= worldUnit;\n\n // Calculate line join\n#ifdef LINE_CLOSED\n join = getLineJoin(0.0, odd, left, center, right, width, offset, joint);\n#else\n join = getLineJoin(edge, odd, left, center, right, width, offset, joint);\n#endif\n vec3 pos = center + join * offset * width;\n\n#ifdef LINE_STROKE\n vClipStrokeWidth = width;\n#endif\n\n#ifdef LINE_CLIP\n clipEnds(p, center, pos);\n#endif\n\n return pos;\n}\n"; export default _default;