@genome-spy/core 0.25.0 → 0.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -11,18 +11,18 @@ var mE=Object.defineProperty;var AE=(R,T,K)=>T in R?mE(R,T,{enumerable:!0,config
11
11
  `;break;case"r":t+="\r";break;case"t":t+=" ";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:Mr(r)?(i="01234567".indexOf(r),i!==0&&(o=!0),x<ce&&Mr(S[x])&&(o=!0,i=i*8+"01234567".indexOf(S[x++]),"0123".indexOf(r)>=0&&x<ce&&Mr(S[x])&&(i=i*8+"01234567".indexOf(S[x++]))),t+=String.fromCharCode(i)):t+=r;break}else r==="\r"&&S[x]===`
12
12
  `&&++x;else{if(Ir(r.charCodeAt(0)))break;t+=r}return e!==""&&N({},ie,ae),{type:Br,value:t,octal:o,start:n,end:x}}function a1(t,e){let n=t;e.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,(r,i)=>{if(parseInt(i,16)<=1114111)return"x";N({},Js)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch{N({},Js)}try{return new RegExp(t,e)}catch{return null}}function u1(){var t,e,n,r,i;for(t=S[x],Wi(t==="/","Regular expression literal must start with a slash"),e=S[x++],n=!1,r=!1;x<ce;)if(t=S[x++],e+=t,t==="\\")t=S[x++],Ir(t.charCodeAt(0))&&N({},_s),e+=t;else if(Ir(t.charCodeAt(0)))N({},_s);else if(n)t==="]"&&(n=!1);else if(t==="/"){r=!0;break}else t==="["&&(n=!0);return r||N({},_s),i=e.substr(1,e.length-2),{value:i,literal:e}}function c1(){var t,e,n;for(e="",n="";x<ce&&(t=S[x],!!Xi(t.charCodeAt(0)));)++x,t==="\\"&&x<ce?N({},ie,ae):(n+=t,e+=t);return n.search(/[^gimuy]/g)>=0&&N({},Js,n),{value:n,literal:e}}function l1(){var t,e,n,r;return G=null,sf(),t=x,e=u1(),n=c1(),r=a1(e.value,n.value),{literal:e.literal+n.literal,value:r,regex:{pattern:e.value,flags:n.value},start:t,end:x}}function f1(t){return t.type===Xt||t.type===wt||t.type===Vi||t.type===Yi}function cf(){if(sf(),x>=ce)return{type:Dr,start:x,end:x};const t=S.charCodeAt(x);return Tr(t)?r1():t===40||t===41||t===59?ta():t===39||t===34?s1():t===46?ot(S.charCodeAt(x+1))?uf():ta():ot(t)?uf():ta()}function be(){const t=G;return x=t.end,G=cf(),x=t.end,t}function lf(){const t=x;G=cf(),x=t}function h1(t){const e=new Ge(kA);return e.elements=t,e}function ff(t,e,n){const r=new Ge(t==="||"||t==="&&"?UA:NA);return r.operator=t,r.left=e,r.right=n,r}function d1(t,e){const n=new Ge(zA);return n.callee=t,n.arguments=e,n}function p1(t,e,n){const r=new Ge(OA);return r.test=t,r.consequent=e,r.alternate=n,r}function na(t){const e=new Ge(rf);return e.name=t,e}function Pr(t){const e=new Ge(GA);return e.value=t.value,e.raw=S.slice(t.start,t.end),t.regex&&(e.raw==="//"&&(e.raw="/(?:)/"),e.regex=t.regex),e}function hf(t,e,n){const r=new Ge(HA);return r.computed=t==="[",r.object=e,r.property=n,r.computed||(n.member=!0),r}function g1(t){const e=new Ge(QA);return e.properties=t,e}function df(t,e,n){const r=new Ge(jA);return r.key=e,r.value=n,r.kind=t,r}function m1(t,e){const n=new Ge(VA);return n.operator=t,n.argument=e,n.prefix=!0,n}function N(t,e){var n,r=Array.prototype.slice.call(arguments,2),i=e.replace(/%(\d)/g,(o,s)=>(Wi(s<r.length,"Message reference must be in range"),r[s]));throw n=new Error(i),n.index=x,n.description=i,n}function Zi(t){t.type===Dr&&N(t,KA),t.type===Zt&&N(t,YA),t.type===Br&&N(t,WA),t.type===Xt&&N(t,XA),t.type===wt&&N(t,ZA),N(t,ie,t.value)}function le(t){const e=be();(e.type!==ye||e.value!==t)&&Zi(e)}function j(t){return G.type===ye&&G.value===t}function ra(t){return G.type===wt&&G.value===t}function A1(){const t=[];for(x=G.start,le("[");!j("]");)j(",")?(be(),t.push(null)):(t.push(Kt()),j("]")||le(","));return be(),h1(t)}function pf(){x=G.start;const t=be();return t.type===Br||t.type===Zt?(t.octal&&N(t,of),Pr(t)):na(t.value)}function x1(){var t,e,n,r;if(x=G.start,t=G,t.type===Xt)return n=pf(),le(":"),r=Kt(),df("init",n,r);if(t.type===Dr||t.type===ye)Zi(t);else return e=pf(),le(":"),r=Kt(),df("init",e,r)}function y1(){var t=[],e,n,r,i={},o=String;for(x=G.start,le("{");!j("}");)e=x1(),e.key.type===rf?n=e.key.name:n=o(e.key.value),r="$"+n,Object.prototype.hasOwnProperty.call(i,r)?N({},qA):i[r]=!0,t.push(e),j("}")||le(",");return le("}"),g1(t)}function b1(){le("(");const t=ia();return le(")"),t}const w1={if:1};function v1(){var t,e,n;if(j("("))return b1();if(j("["))return A1();if(j("{"))return y1();if(t=G.type,x=G.start,t===Xt||w1[G.value])n=na(be().value);else if(t===Br||t===Zt)G.octal&&N(G,of),n=Pr(be());else{if(t===wt)throw new Error(Fr);t===Vi?(e=be(),e.value=e.value==="true",n=Pr(e)):t===Yi?(e=be(),e.value=null,n=Pr(e)):j("/")||j("/=")?(n=Pr(l1()),lf()):Zi(be())}return n}function C1(){const t=[];if(le("("),!j(")"))for(;x<ce&&(t.push(Kt()),!j(")"));)le(",");return le(")"),t}function E1(){x=G.start;const t=be();return f1(t)||Zi(t),na(t.value)}function S1(){return le("."),E1()}function D1(){le("[");const t=ia();return le("]"),t}function B1(){var t,e,n;for(t=v1();;)if(j("."))n=S1(),t=hf(".",t,n);else if(j("("))e=C1(),t=d1(t,e);else if(j("["))n=D1(),t=hf("[",t,n);else break;return t}function gf(){const t=B1();if(G.type===ye&&(j("++")||j("--")))throw new Error(Fr);return t}function Ki(){var t,e;if(G.type!==ye&&G.type!==wt)e=gf();else{if(j("++")||j("--"))throw new Error(Fr);if(j("+")||j("-")||j("~")||j("!"))t=be(),e=Ki(),e=m1(t.value,e);else{if(ra("delete")||ra("void")||ra("typeof"))throw new Error(Fr);e=gf()}}return e}function mf(t){let e=0;if(t.type!==ye&&t.type!==wt)return 0;switch(t.value){case"||":e=1;break;case"&&":e=2;break;case"|":e=3;break;case"^":e=4;break;case"&":e=5;break;case"==":case"!=":case"===":case"!==":e=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":e=7;break;case"<<":case">>":case">>>":e=8;break;case"+":case"-":e=9;break;case"*":case"/":case"%":e=11;break}return e}function F1(){var t,e,n,r,i,o,s,a,u,c;if(t=G,u=Ki(),r=G,i=mf(r),i===0)return u;for(r.prec=i,be(),e=[t,G],s=Ki(),o=[u,r,s];(i=mf(G))>0;){for(;o.length>2&&i<=o[o.length-2].prec;)s=o.pop(),a=o.pop().value,u=o.pop(),e.pop(),n=ff(a,u,s),o.push(n);r=be(),r.prec=i,o.push(r),e.push(G),n=Ki(),o.push(n)}for(c=o.length-1,n=o[c],e.pop();c>1;)e.pop(),n=ff(o[c-1].value,o[c-2],n),c-=2;return n}function Kt(){var t,e,n;return t=F1(),j("?")&&(be(),e=Kt(),le(":"),n=Kt(),t=p1(t,e,n)),t}function ia(){const t=Kt();if(j(","))throw new Error(Fr);return t}function M1(t){S=t,x=0,ce=S.length,G=null,lf();const e=ia();if(G.type!==Dr)throw new Error("Unexpect token after expression.");return e}var I1={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function T1(t){function e(s,a,u,c){let f=t(a[0]);return u&&(f=u+"("+f+")",u.lastIndexOf("new ",0)===0&&(f="("+f+")")),f+"."+s+(c<0?"":c===0?"()":"("+a.slice(1).map(t).join(",")+")")}function n(s,a,u){return c=>e(s,c,a,u)}const r="new Date",i="String",o="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(s){s.length<3&&X("Missing arguments to clamp function."),s.length>3&&X("Too many arguments to clamp function.");const a=s.map(t);return"Math.max("+a[1]+", Math.min("+a[2]+","+a[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:r,date:n("getDate",r,0),day:n("getDay",r,0),year:n("getFullYear",r,0),month:n("getMonth",r,0),hours:n("getHours",r,0),minutes:n("getMinutes",r,0),seconds:n("getSeconds",r,0),milliseconds:n("getMilliseconds",r,0),time:n("getTime",r,0),timezoneoffset:n("getTimezoneOffset",r,0),utcdate:n("getUTCDate",r,0),utcday:n("getUTCDay",r,0),utcyear:n("getUTCFullYear",r,0),utcmonth:n("getUTCMonth",r,0),utchours:n("getUTCHours",r,0),utcminutes:n("getUTCMinutes",r,0),utcseconds:n("getUTCSeconds",r,0),utcmilliseconds:n("getUTCMilliseconds",r,0),length:n("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase",i,0),lower:n("toLowerCase",i,0),substring:n("substring",i),split:n("split",i),trim:n("trim",i,0),regexp:o,test:n("test",o),if:function(s){s.length<3&&X("Missing arguments to if function."),s.length>3&&X("Too many arguments to if function.");const a=s.map(t);return"("+a[0]+"?"+a[1]+":"+a[2]+")"}}}function P1(t){const e=t&&t.length-1;return e&&(t[0]==='"'&&t[e]==='"'||t[0]==="'"&&t[e]==="'")?t.slice(1,-1):t}function L1(t){t=t||{};const e=t.allowed?fi(t.allowed):{},n=t.forbidden?fi(t.forbidden):{},r=t.constants||I1,i=(t.functions||T1)(l),o=t.globalvar,s=t.fieldvar,a=ge(o)?o:d=>`${o}["${d}"]`;let u={},c={},f=0;function l(d){if(Z(d))return d;const g=h[d.type];return g==null&&X("Unsupported type: "+d.type),g(d)}const h={Literal:d=>d.raw,Identifier:d=>{const g=d.name;return f>0?g:Tt(n,g)?X("Illegal identifier: "+g):Tt(r,g)?r[g]:Tt(e,g)?g:(u[g]=1,a(g))},MemberExpression:d=>{const g=!d.computed,A=l(d.object);g&&(f+=1);const m=l(d.property);return A===s&&(c[P1(m)]=1),g&&(f-=1),A+(g?"."+m:"["+m+"]")},CallExpression:d=>{d.callee.type!=="Identifier"&&X("Illegal callee type: "+d.callee.type);const g=d.callee.name,A=d.arguments,m=Tt(i,g)&&i[g];return m||X("Unrecognized function: "+g),ge(m)?m(A):m+"("+A.map(l).join(",")+")"},ArrayExpression:d=>"["+d.elements.map(l).join(",")+"]",BinaryExpression:d=>"("+l(d.left)+" "+d.operator+" "+l(d.right)+")",UnaryExpression:d=>"("+d.operator+l(d.argument)+")",ConditionalExpression:d=>"("+l(d.test)+"?"+l(d.consequent)+":"+l(d.alternate)+")",LogicalExpression:d=>"("+l(d.left)+d.operator+l(d.right)+")",ObjectExpression:d=>"{"+d.properties.map(l).join(",")+"}",Property:d=>{f+=1;const g=l(d.key);return f-=1,g+":"+l(d.value)}};function p(d){const g={code:l(d),globals:Object.keys(u),fields:Object.keys(c)};return u={},c={},g}return p.functions=i,p.constants=r,p}function oa(t,e={}){const n=L1({forbidden:[],allowed:["datum"],globalvar:"global",fieldvar:"datum"});try{const r=M1(t),i=n(r),o=Function("datum","global",`"use strict"; return (${i.code});`),s=a=>o(a,e);return s.fields=i.fields,s}catch(r){throw new Error(`Invalid expression: ${t}, ${r.message}`)}}function R1(){let t=0;const e=new Map,n=r=>{let i=e.get(r);return i===void 0&&(i=t++,e.set(r,i)),i};return n.addAll=r=>{for(const i of r)n(i)},n.invert=r=>{for(const i of e.entries())if(i[1]==r)return i[0]},n.domain=()=>[...e.keys()],n}function k1(t,e){const n={};e||(e=t.encoding);for(const[r,i]of Object.entries(e)){if(!i)continue;const o=t.unitView.getScaleResolution(Le(i)&&i.resolutionChannel||r);n[r]=N1(e[r],o==null?void 0:o.getScale(),t.unitView.getAccessor(r),r)}return n}function N1(t,e,n,r){let i;if(Ue(t)){const o=t.value;i=s=>o,i.constant=!0,i.constantValue=!0,i.accessor=void 0}else if(n)if(r=="text")i=o=>{},i.accessor=n,i.constant=n.constant;else{if(!e)throw new Error(`Missing scale! "${r}": ${JSON.stringify(t)}`);if(i=o=>e(n(o)),Wt(e.type)){const o=R1();o.addAll(e.domain()),i.indexer=o}i.constant=n.constant,i.accessor=n,i.scale=e}else throw new Error(`Missing value or accessor (field, expr, datum) on channel "${r}": ${JSON.stringify(t)}`);return i.invert=e?o=>e.invert(o):o=>{throw new Error("No scale available, cannot invert: "+JSON.stringify(t))},i.channelDef=t,i.applyMetadata=o=>{for(const s in i)s in i&&(o[s]=i[s]);return o},i}function Ue(t){return t&&"value"in t}function Lr(t){return t&&"field"in t}function Rr(t){return t&&"datum"in t}function Le(t){return Lr(t)||Rr(t)||aa(t)||Af(t)}function sa(t,e){const n=t.mark.encoding[e];if(Le(n))return n;throw new Error("Not a channel def with scale!")}function Af(t){return t&&"chrom"in t}function aa(t){return t&&"expr"in t}const kr=["x","y"],z1=["x2","y2"],O1=[...kr,...z1];function xf(t){return kr.includes(t)}function Nr(t){return O1.includes(t)}const ua={x:"x2",y:"y2"},yf=Object.fromEntries(Object.entries(ua).map(t=>[t[1],t[0]]));function zr(t){return t in yf}function G1(t){const e=ua[t];if(e)return e;throw new Error(`${t} has no secondary channel!`)}function En(t){var e;return(e=yf[t])!=null?e:t}function qt(t){return["color","fill","stroke"].includes(En(t))}function qi(t){return["shape","squeeze"].includes(t)}function bf(t){switch(t){case"shape":return["circle","square","triangle-up","cross","diamond","triangle-down","triangle-right","triangle-left"]}}function wf(t){if(!qi(t))throw new Error("Not a discrete channel: "+t);const e=new Map(bf(t).map((n,r)=>[n,r]));return n=>{const r=e.get(n);if(r!==void 0)return r;throw new Error(`Invalid value for "${t}" channel: ${n}`)}}function H(t,e=t){if(/^[A-Za-z0-9_]+$/.test(t)){const n=new Function("datum",`return datum[${JSON.stringify(t)}]`);return T(n,[t],e)}else return ii(t)}class U1{constructor(){this.accessorCreators=[],this.register(e=>{if(Lr(e))try{const n=H(e.field);return n.constant=!1,n.fields=It(n),n}catch(n){throw new Error(`Invalid field definition: ${n.message}`)}}),this.register(e=>aa(e)?H1(e.expr):void 0),this.register(e=>{if(Rr(e)){const r=md(e.datum);return r.constant=!0,r.fields=[],r}})}register(e){this.accessorCreators.push(e)}createAccessor(e){for(const n of this.accessorCreators){const r=n(e);if(r)return r}}}function H1(t){const e=oa(t);return e.constant=e.fields.length==0,e}/* @license twgl.js 4.22.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
13
13
  Available via the MIT license.
14
- see: http://github.com/greggman/twgl.js for details */const ca=5120,Or=5121,la=5122,fa=5123,ha=5124,da=5125,pa=5126,Q1=32819,j1=32820,V1=33635,Y1=5131,W1=33640,X1=35899,Z1=35902,K1=36269,q1=34042,vf={};{const t=vf;t[ca]=Int8Array,t[Or]=Uint8Array,t[la]=Int16Array,t[fa]=Uint16Array,t[ha]=Int32Array,t[da]=Uint32Array,t[pa]=Float32Array,t[Q1]=Uint16Array,t[j1]=Uint16Array,t[V1]=Uint16Array,t[Y1]=Uint16Array,t[W1]=Uint32Array,t[X1]=Uint32Array,t[Z1]=Uint32Array,t[K1]=Uint32Array,t[q1]=Uint32Array}function ga(t){if(t instanceof Int8Array)return ca;if(t instanceof Uint8Array||t instanceof Uint8ClampedArray)return Or;if(t instanceof Int16Array)return la;if(t instanceof Uint16Array)return fa;if(t instanceof Int32Array)return ha;if(t instanceof Uint32Array)return da;if(t instanceof Float32Array)return pa;throw new Error("unsupported typed array type")}function J1(t){if(t===Int8Array)return ca;if(t===Uint8Array||t===Uint8ClampedArray)return Or;if(t===Int16Array)return la;if(t===Uint16Array)return fa;if(t===Int32Array)return ha;if(t===Uint32Array)return da;if(t===Float32Array)return pa;throw new Error("unsupported typed array type")}function _1(t){const e=vf[t];if(!e)throw new Error("unknown gl type");return e}const Ji=typeof SharedArrayBuffer<"u"?function(e){return e&&e.buffer&&(e.buffer instanceof ArrayBuffer||e.buffer instanceof SharedArrayBuffer)}:function(e){return e&&e.buffer&&e.buffer instanceof ArrayBuffer};function $1(...t){console.error(...t)}function Cf(...t){console.warn(...t)}function ex(t,e){return typeof WebGLBuffer<"u"&&e instanceof WebGLBuffer}function Ef(t,e){return typeof WebGLRenderbuffer<"u"&&e instanceof WebGLRenderbuffer}function _i(t,e){return typeof WebGLTexture<"u"&&e instanceof WebGLTexture}function tx(t,e){return typeof WebGLSampler<"u"&&e instanceof WebGLSampler}const Sf=35044,Je=34962,nx=34963,rx=34660,ix=5120,ox=5121,sx=5122,ax=5123,ux=5124,cx=5125,lx=5126,Df={attribPrefix:""};function Bf(t,e,n,r,i){t.bindBuffer(e,n),t.bufferData(e,r,i||Sf)}function Ff(t,e,n,r){if(ex(t,e))return e;n=n||Je;const i=t.createBuffer();return Bf(t,n,i,e,r),i}function Mf(t){return t==="indices"}function fx(t){return t instanceof Int8Array||t instanceof Uint8Array}function hx(t){return t===Int8Array||t===Uint8Array}function dx(t){return t.length?t:t.data}const px=/coord|texture/i,gx=/color|colour/i;function If(t,e){let n;if(px.test(t)?n=2:gx.test(t)?n=4:n=3,e%n>0)throw new Error(`Can not guess numComponents for attribute '${t}'. Tried ${n} but ${e} values is not evenly divisible by ${n}. You should specify it.`);return n}function mx(t,e){return t.numComponents||t.size||If(e,dx(t).length)}function ma(t,e){if(Ji(t))return t;if(Ji(t.data))return t.data;Array.isArray(t)&&(t={data:t});let n=t.type;return n||(Mf(e)?n=Uint16Array:n=Float32Array),new n(t.data)}function Ax(t,e){const n={};return Object.keys(e).forEach(function(r){if(!Mf(r)){const i=e[r],o=i.attrib||i.name||i.attribName||Df.attribPrefix+r;if(i.value){if(!Array.isArray(i.value)&&!Ji(i.value))throw new Error("array.value is not array or typedarray");n[o]={value:i.value}}else{let s,a,u,c;if(i.buffer&&i.buffer instanceof WebGLBuffer)s=i.buffer,c=i.numComponents||i.size,a=i.type,u=i.normalize;else if(typeof i=="number"||typeof i.data=="number"){const f=i.data||i,l=i.type||Float32Array,h=f*l.BYTES_PER_ELEMENT;a=J1(l),u=i.normalize!==void 0?i.normalize:hx(l),c=i.numComponents||i.size||If(r,f),s=t.createBuffer(),t.bindBuffer(Je,s),t.bufferData(Je,h,i.drawType||Sf)}else{const f=ma(i,r);s=Ff(t,f,void 0,i.drawType),a=ga(f),u=i.normalize!==void 0?i.normalize:fx(f),c=mx(i,r)}n[o]={buffer:s,numComponents:c,type:a,normalize:u,stride:i.stride||0,offset:i.offset||0,divisor:i.divisor===void 0?void 0:i.divisor,drawType:i.drawType}}}}),t.bindBuffer(Je,null),n}function xx(t,e,n,r){n=ma(n),r!==void 0?(t.bindBuffer(Je,e.buffer),t.bufferSubData(Je,r,n)):Bf(t,Je,e.buffer,n,e.drawType)}function yx(t,e){return e===ix||e===ox?1:e===sx||e===ax?2:e===ux||e===cx||e===lx?4:0}const Aa=["position","positions","a_position"];function bx(t,e){let n,r;for(r=0;r<Aa.length&&(n=Aa[r],!(n in e||(n=Df.attribPrefix+n,n in e)));++r);r===Aa.length&&(n=Object.keys(e)[0]);const i=e[n];t.bindBuffer(Je,i.buffer);const o=t.getBufferParameter(Je,rx);t.bindBuffer(Je,null);const s=yx(t,i.type),a=o/s,u=i.numComponents||i.size,c=a/u;if(c%1!==0)throw new Error(`numComponents ${u} not correct for length ${length}`);return c}function wx(t,e,n){const r=Ax(t,e),i=Object.assign({},n||{});i.attribs=Object.assign({},n?n.attribs:{},r);const o=e.indices;if(o){const s=ma(o,"indices");i.indices=Ff(t,s,nx),i.numElements=s.length,i.elementType=ga(s)}else i.numElements||(i.numElements=bx(t,i.attribs));return i}function Sn(t){return!!t.texStorage2D}const xa=function(){const t={},e={};function n(r){const i=r.constructor.name;if(!t[i]){for(const o in r)if(typeof r[o]=="number"){const s=e[r[o]];e[r[o]]=s?`${s} | ${o}`:o}t[i]=!0}}return function(i,o){return n(i),e[o]||(typeof o=="number"?`0x${o.toString(16)}`:o)}}(),vt={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},Dn=Ji,Tf=function(){let t;return function(){return t=t||(typeof document<"u"&&document.createElement?document.createElement("canvas").getContext("2d"):null),t}}(),Pf=6406,_e=6407,Y=6408,Lf=6409,Rf=6410,Gr=6402,kf=34041,$i=33071,vx=9728,Cx=9729,st=3553,at=34067,Ct=32879,Et=35866,eo=34069,Ex=34070,Sx=34071,Dx=34072,Bx=34073,Fx=34074,ya=10241,ba=10240,to=10242,no=10243,Nf=32882,Mx=33082,Ix=33083,Tx=33084,Px=33085,wa=3317,zf=3314,Of=32878,Gf=3316,Uf=3315,Hf=32877,Lx=37443,Rx=37441,kx=37440,Nx=33321,zx=36756,Ox=33325,Gx=33326,Ux=33330,Hx=33329,Qx=33338,jx=33337,Vx=33340,Yx=33339,Wx=33323,Xx=36757,Zx=33327,Kx=33328,qx=33336,Jx=33335,_x=33332,$x=33331,ey=33334,ty=33333,ny=32849,ry=35905,iy=36194,oy=36758,sy=35898,ay=35901,uy=34843,cy=34837,ly=36221,fy=36239,hy=36215,dy=36233,py=36209,gy=36227,my=32856,Ay=35907,xy=36759,yy=32855,by=32854,wy=32857,vy=34842,Cy=34836,Ey=36220,Sy=36238,Dy=36975,By=36214,Fy=36232,My=36226,Iy=36208,Ty=33189,Py=33190,Ly=36012,Ry=36013,ky=35056,St=5120,W=5121,ro=5122,Bn=5123,io=5124,Jt=5125,fe=5126,Qf=32819,jf=32820,Vf=33635,He=5131,Ur=36193,va=33640,Ny=35899,zy=35902,Oy=36269,Gy=34042,oo=33319,Fn=33320,so=6403,Mn=36244,In=36248,_t=36249;let Ca;function ao(t){if(!Ca){const e={};e[Pf]={textureFormat:Pf,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[W,He,Ur,fe]},e[Lf]={textureFormat:Lf,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[W,He,Ur,fe]},e[Rf]={textureFormat:Rf,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2,4,4,8],type:[W,He,Ur,fe]},e[_e]={textureFormat:_e,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,6,6,12,2],type:[W,He,Ur,fe,Vf]},e[Y]={textureFormat:Y,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,8,8,16,2,2],type:[W,He,Ur,fe,Qf,jf]},e[Gr]={textureFormat:Gr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[Jt,Bn]},e[Nx]={textureFormat:so,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1],type:[W]},e[zx]={textureFormat:so,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[1],type:[St]},e[Ox]={textureFormat:so,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4,2],type:[fe,He]},e[Gx]={textureFormat:so,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[4],type:[fe]},e[Ux]={textureFormat:Mn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[1],type:[W]},e[Hx]={textureFormat:Mn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[1],type:[St]},e[_x]={textureFormat:Mn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[Bn]},e[$x]={textureFormat:Mn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[ro]},e[ey]={textureFormat:Mn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Jt]},e[ty]={textureFormat:Mn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[io]},e[Wx]={textureFormat:oo,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2],type:[W]},e[Xx]={textureFormat:oo,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[2],type:[St]},e[Zx]={textureFormat:oo,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[8,4],type:[fe,He]},e[Kx]={textureFormat:oo,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[8],type:[fe]},e[qx]={textureFormat:Fn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[W]},e[Jx]={textureFormat:Fn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[St]},e[Qx]={textureFormat:Fn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Bn]},e[jx]={textureFormat:Fn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[ro]},e[Vx]={textureFormat:Fn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[Jt]},e[Yx]={textureFormat:Fn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[io]},e[ny]={textureFormat:_e,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3],type:[W]},e[ry]={textureFormat:_e,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[3],type:[W]},e[iy]={textureFormat:_e,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,2],type:[W,Vf]},e[oy]={textureFormat:_e,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[3],type:[St]},e[sy]={textureFormat:_e,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[fe,He,Ny]},e[ay]={textureFormat:_e,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[fe,He,zy]},e[uy]={textureFormat:_e,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6],type:[fe,He]},e[cy]={textureFormat:_e,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[fe]},e[ly]={textureFormat:In,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[3],type:[W]},e[fy]={textureFormat:In,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[3],type:[St]},e[hy]={textureFormat:In,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[6],type:[Bn]},e[dy]={textureFormat:In,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[6],type:[ro]},e[py]={textureFormat:In,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[Jt]},e[gy]={textureFormat:In,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[io]},e[my]={textureFormat:Y,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[W]},e[Ay]={textureFormat:Y,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[W]},e[xy]={textureFormat:Y,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4],type:[St]},e[yy]={textureFormat:Y,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2,4],type:[W,jf,va]},e[by]={textureFormat:Y,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2],type:[W,Qf]},e[wy]={textureFormat:Y,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[va]},e[vy]={textureFormat:Y,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[16,8],type:[fe,He]},e[Cy]={textureFormat:Y,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[16],type:[fe]},e[Ey]={textureFormat:_t,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[W]},e[Sy]={textureFormat:_t,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[St]},e[Dy]={textureFormat:_t,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[va]},e[By]={textureFormat:_t,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[Bn]},e[Fy]={textureFormat:_t,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[ro]},e[My]={textureFormat:_t,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[16],type:[io]},e[Iy]={textureFormat:_t,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[16],type:[Jt]},e[Ty]={textureFormat:Gr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[Bn,Jt]},e[Py]={textureFormat:Gr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Jt]},e[Ly]={textureFormat:Gr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[fe]},e[ky]={textureFormat:kf,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Gy]},e[Ry]={textureFormat:kf,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Oy]},Object.keys(e).forEach(function(n){const r=e[n];r.bytesPerElementMap={},r.bytesPerElement.forEach(function(i,o){const s=r.type[o];r.bytesPerElementMap[s]=i})}),Ca=e}return Ca[t]}function Uy(t,e){const n=ao(t);if(!n)throw"unknown internal format";const r=n.bytesPerElementMap[e];if(r===void 0)throw"unknown internal format";return r}function Tn(t){const e=ao(t);if(!e)throw"unknown internal format";return{format:e.textureFormat,type:e.type[0]}}function Yf(t){return(t&t-1)===0}function Hy(t,e,n,r){if(!Sn(t))return Yf(e)&&Yf(n);const i=ao(r);if(!i)throw"unknown internal format";return i.colorRenderable&&i.textureFilterable}function Qy(t){const e=ao(t);if(!e)throw"unknown internal format";return e.textureFilterable}function Wf(t,e,n){return Dn(e)?ga(e):n||W}function uo(t,e,n,r,i){if(i%1!==0)throw"can't guess dimensions";if(!n&&!r){const o=Math.sqrt(i/(e===at?6:1));o%1===0?(n=o,r=o):(n=i,r=1)}else if(r){if(!n&&(n=i/r,n%1))throw"can't guess dimensions"}else if(r=i/n,r%1)throw"can't guess dimensions";return{width:n,height:r}}function Pn(t,e){e.colorspaceConversion!==void 0&&t.pixelStorei(Lx,e.colorspaceConversion),e.premultiplyAlpha!==void 0&&t.pixelStorei(Rx,e.premultiplyAlpha),e.flipY!==void 0&&t.pixelStorei(kx,e.flipY)}function Xf(t){t.pixelStorei(wa,4),Sn(t)&&(t.pixelStorei(zf,0),t.pixelStorei(Of,0),t.pixelStorei(Gf,0),t.pixelStorei(Uf,0),t.pixelStorei(Hf,0))}function jy(t,e,n,r){r.minMag&&(n.call(t,e,ya,r.minMag),n.call(t,e,ba,r.minMag)),r.min&&n.call(t,e,ya,r.min),r.mag&&n.call(t,e,ba,r.mag),r.wrap&&(n.call(t,e,to,r.wrap),n.call(t,e,no,r.wrap),(e===Ct||tx(t,e))&&n.call(t,e,Nf,r.wrap)),r.wrapR&&n.call(t,e,Nf,r.wrapR),r.wrapS&&n.call(t,e,to,r.wrapS),r.wrapT&&n.call(t,e,no,r.wrapT),r.minLod&&n.call(t,e,Mx,r.minLod),r.maxLod&&n.call(t,e,Ix,r.maxLod),r.baseLevel&&n.call(t,e,Tx,r.baseLevel),r.maxLevel&&n.call(t,e,Px,r.maxLevel)}function Zf(t,e,n){const r=n.target||st;t.bindTexture(r,e),jy(t,r,t.texParameteri,n)}function Vy(t){return t=t||vt.textureColor,Dn(t)?t:new Uint8Array([t[0]*255,t[1]*255,t[2]*255,t[3]*255])}function Ea(t,e,n,r,i,o){n=n||vt.textureOptions,o=o||Y;const s=n.target||st;if(r=r||n.width,i=i||n.height,t.bindTexture(s,e),Hy(t,r,i,o))t.generateMipmap(s);else{const a=Qy(o)?Cx:vx;t.texParameteri(s,ya,a),t.texParameteri(s,ba,a),t.texParameteri(s,to,$i),t.texParameteri(s,no,$i)}}function Hr(t){return t.auto===!0||t.auto===void 0&&t.level===void 0}function Sa(t,e){return e=e||{},e.cubeFaceOrder||[eo,Ex,Sx,Dx,Bx,Fx]}function Da(t,e){const r=Sa(t,e).map(function(i,o){return{face:i,ndx:o}});return r.sort(function(i,o){return i.face-o.face}),r}function Kf(t,e,n,r){r=r||vt.textureOptions;const i=r.target||st,o=r.level||0;let s=n.width,a=n.height;const u=r.internalFormat||r.format||Y,c=Tn(u),f=r.format||c.format,l=r.type||c.type;if(Pn(t,r),t.bindTexture(i,e),i===at){const h=n.width,p=n.height;let d,g;if(h/6===p)d=p,g=[0,0,1,0,2,0,3,0,4,0,5,0];else if(p/6===h)d=h,g=[0,0,0,1,0,2,0,3,0,4,0,5];else if(h/3===p/2)d=h/3,g=[0,0,1,0,2,0,0,1,1,1,2,1];else if(h/2===p/3)d=h/2,g=[0,0,1,0,0,1,1,1,0,2,1,2];else throw"can't figure out cube map from element: "+(n.src?n.src:n.nodeName);const A=Tf();A?(A.canvas.width=d,A.canvas.height=d,s=d,a=d,Da(t,r).forEach(function(m){const b=g[m.ndx*2+0]*d,y=g[m.ndx*2+1]*d;A.drawImage(n,b,y,d,d,0,0,d,d),t.texImage2D(m.face,o,u,f,l,A.canvas)}),A.canvas.width=1,A.canvas.height=1):typeof createImageBitmap<"u"&&(s=d,a=d,Da(t,r).forEach(function(m){const b=g[m.ndx*2+0]*d,y=g[m.ndx*2+1]*d;t.texImage2D(m.face,o,u,d,d,0,f,l,null),createImageBitmap(n,b,y,d,d,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then(function(w){Pn(t,r),t.bindTexture(i,e),t.texImage2D(m.face,o,u,f,l,w),Hr(r)&&Ea(t,e,r,s,a,u)})}))}else if(i===Ct||i===Et){const h=Math.min(n.width,n.height),p=Math.max(n.width,n.height),d=p/h;if(d%1!==0)throw"can not compute 3D dimensions of element";const g=n.width===p?1:0,A=n.height===p?1:0;t.pixelStorei(wa,1),t.pixelStorei(zf,n.width),t.pixelStorei(Of,0),t.pixelStorei(Hf,0),t.texImage3D(i,o,u,h,h,h,0,f,l,null);for(let m=0;m<d;++m){const b=m*h*g,y=m*h*A;t.pixelStorei(Gf,b),t.pixelStorei(Uf,y),t.texSubImage3D(i,o,0,0,m,h,h,1,f,l,n)}Xf(t)}else t.texImage2D(i,o,u,f,l,n);Hr(r)&&Ea(t,e,r,s,a,u),Zf(t,e,r)}function Qr(){}function Yy(t){if(typeof document<"u"){const e=document.createElement("a");return e.href=t,e.hostname===location.hostname&&e.port===location.port&&e.protocol===location.protocol}else{const e=new URL(location.href).origin;return new URL(t,location.href).origin===e}}function Wy(t,e){return e===void 0&&!Yy(t)?"anonymous":e}function Xy(t,e,n){n=n||Qr;let r;if(e=e!==void 0?e:vt.crossOrigin,e=Wy(t,e),typeof Image<"u"){r=new Image,e!==void 0&&(r.crossOrigin=e);const i=function(){r.removeEventListener("error",o),r.removeEventListener("load",s),r=null},o=function(){const u="couldn't load image: "+t;$1(u),n(u,r),i()},s=function(){n(null,r),i()};return r.addEventListener("error",o),r.addEventListener("load",s),r.src=t,r}else if(typeof ImageBitmap<"u"){let i,o;const s=function(){n(i,o)},a={};e&&(a.mode="cors"),fetch(t,a).then(function(u){if(!u.ok)throw u;return u.blob()}).then(function(u){return createImageBitmap(u,{premultiplyAlpha:"none",colorSpaceConversion:"none"})}).then(function(u){o=u,setTimeout(s)}).catch(function(u){i=u,setTimeout(s)}),r=null}return r}function qf(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof ImageData<"u"&&t instanceof ImageData||typeof HTMLElement<"u"&&t instanceof HTMLElement}function Ba(t,e,n){return qf(t)?(setTimeout(function(){n(null,t)}),t):Xy(t,e,n)}function Fa(t,e,n){n=n||vt.textureOptions;const r=n.target||st;if(t.bindTexture(r,e),n.color===!1)return;const i=Vy(n.color);if(r===at)for(let o=0;o<6;++o)t.texImage2D(eo+o,0,Y,1,1,0,Y,W,i);else r===Ct||r===Et?t.texImage3D(r,0,Y,1,1,1,0,Y,W,i):t.texImage2D(r,0,Y,1,1,0,Y,W,i)}function Zy(t,e,n,r){return r=r||Qr,n=n||vt.textureOptions,Fa(t,e,n),n=Object.assign({},n),Ba(n.src,n.crossOrigin,function(o,s){o?r(o,e,s):(Kf(t,e,s,n),r(null,e,s))})}function Ky(t,e,n,r){r=r||Qr;const i=n.src;if(i.length!==6)throw"there must be 6 urls for a cubemap";const o=n.level||0,s=n.internalFormat||n.format||Y,a=Tn(s),u=n.format||a.format,c=n.type||W,f=n.target||st;if(f!==at)throw"target must be TEXTURE_CUBE_MAP";Fa(t,e,n),n=Object.assign({},n);let l=6;const h=[],p=Sa(t,n);let d;function g(A){return function(m,b){--l,m?h.push(m):b.width!==b.height?h.push("cubemap face img is not a square: "+b.src):(Pn(t,n),t.bindTexture(f,e),l===5?Sa().forEach(function(y){t.texImage2D(y,o,s,u,c,b)}):t.texImage2D(A,o,s,u,c,b),Hr(n)&&t.generateMipmap(f)),l===0&&r(h.length?h:void 0,e,d)}}d=i.map(function(A,m){return Ba(A,n.crossOrigin,g(p[m]))})}function qy(t,e,n,r){r=r||Qr;const i=n.src,o=n.internalFormat||n.format||Y,s=Tn(o),a=n.format||s.format,u=n.type||W,c=n.target||Et;if(c!==Ct&&c!==Et)throw"target must be TEXTURE_3D or TEXTURE_2D_ARRAY";Fa(t,e,n),n=Object.assign({},n);let f=i.length;const l=[];let h;const p=n.level||0;let d=n.width,g=n.height;const A=i.length;let m=!0;function b(y){return function(w,E){if(--f,w)l.push(w);else{if(Pn(t,n),t.bindTexture(c,e),m){m=!1,d=n.width||E.width,g=n.height||E.height,t.texImage3D(c,p,o,d,g,A,0,a,u,null);for(let C=0;C<A;++C)t.texSubImage3D(c,p,0,0,C,d,g,1,a,u,E)}else{let C=E,B;(E.width!==d||E.height!==g)&&(B=Tf(),C=B.canvas,B.canvas.width=d,B.canvas.height=g,B.drawImage(E,0,0,d,g)),t.texSubImage3D(c,p,0,0,y,d,g,1,a,u,C),B&&C===B.canvas&&(B.canvas.width=0,B.canvas.height=0)}Hr(n)&&t.generateMipmap(c)}f===0&&r(l.length?l:void 0,e,h)}}h=i.map(function(y,w){return Ba(y,n.crossOrigin,b(w))})}function Jf(t,e,n,r){r=r||vt.textureOptions;const i=r.target||st;t.bindTexture(i,e);let o=r.width,s=r.height,a=r.depth;const u=r.level||0,c=r.internalFormat||r.format||Y,f=Tn(c),l=r.format||f.format,h=r.type||Wf(t,n,f.type);if(Dn(n))n instanceof Uint8ClampedArray&&(n=new Uint8Array(n.buffer));else{const A=_1(h);n=new A(n)}const p=Uy(c,h),d=n.byteLength/p;if(d%1)throw"length wrong size for format: "+xa(t,l);let g;if(i===Ct||i===Et)if(!o&&!s&&!a){const A=Math.cbrt(d);if(A%1!==0)throw"can't guess cube size of array of numElements: "+d;o=A,s=A,a=A}else o&&(!s||!a)?(g=uo(t,i,s,a,d/o),s=g.width,a=g.height):s&&(!o||!a)?(g=uo(t,i,o,a,d/s),o=g.width,a=g.height):(g=uo(t,i,o,s,d/a),o=g.width,s=g.height);else g=uo(t,i,o,s,d),o=g.width,s=g.height;if(Xf(t),t.pixelStorei(wa,r.unpackAlignment||1),Pn(t,r),i===at){const A=p/n.BYTES_PER_ELEMENT,m=d/6*A;Da(t,r).forEach(b=>{const y=m*b.ndx,w=n.subarray(y,y+m);t.texImage2D(b.face,u,c,o,s,0,l,h,w)})}else i===Ct||i===Et?t.texImage3D(i,u,c,o,s,a,0,l,h,n):t.texImage2D(i,u,c,o,s,0,l,h,n);return{width:o,height:s,depth:a,type:h}}function Jy(t,e,n){const r=n.target||st;t.bindTexture(r,e);const i=n.level||0,o=n.internalFormat||n.format||Y,s=Tn(o),a=n.format||s.format,u=n.type||s.type;if(Pn(t,n),r===at)for(let c=0;c<6;++c)t.texImage2D(eo+c,i,o,n.width,n.height,0,a,u,null);else r===Ct||r===Et?t.texImage3D(r,i,o,n.width,n.height,n.depth,0,a,u,null):t.texImage2D(r,i,o,n.width,n.height,0,a,u,null)}function jr(t,e,n){n=n||Qr,e=e||vt.textureOptions;const r=t.createTexture(),i=e.target||st;let o=e.width||1,s=e.height||1;const a=e.internalFormat||Y;t.bindTexture(i,r),i===at&&(t.texParameteri(i,to,$i),t.texParameteri(i,no,$i));let u=e.src;if(u)if(typeof u=="function"&&(u=u(t,e)),typeof u=="string")Zy(t,r,e,n);else if(Dn(u)||Array.isArray(u)&&(typeof u[0]=="number"||Array.isArray(u[0])||Dn(u[0]))){const c=Jf(t,r,u,e);o=c.width,s=c.height}else Array.isArray(u)&&(typeof u[0]=="string"||qf(u[0]))?i===at?Ky(t,r,e,n):qy(t,r,e,n):(Kf(t,r,u,e),o=u.width,s=u.height);else Jy(t,r,e);return Hr(e)&&Ea(t,r,e,o,s,a),Zf(t,r,e),r}function _y(t,e,n,r,i,o){r=r||n.width,i=i||n.height,o=o||n.depth;const s=n.target||st;t.bindTexture(s,e);const a=n.level||0,u=n.internalFormat||n.format||Y,c=Tn(u),f=n.format||c.format;let l;const h=n.src;if(h&&(Dn(h)||Array.isArray(h)&&typeof h[0]=="number")?l=n.type||Wf(t,h,c.type):l=n.type||c.type,s===at)for(let p=0;p<6;++p)t.texImage2D(eo+p,a,u,r,i,0,f,l,null);else s===Ct||s===Et?t.texImage3D(s,a,u,r,i,o,0,f,l,null):t.texImage2D(s,a,u,r,i,0,f,l,null)}const $y=Cf,co=33984,e2=35048,lo=34962,t2=34963,Ma=35345,_f=35718,n2=35721,r2=35971,i2=35382,o2=35396,s2=35398,a2=35392,u2=35395,fo=5126,$f=35664,e0=35665,t0=35666,Ia=5124,n0=35667,r0=35668,i0=35669,o0=35670,s0=35671,a0=35672,u0=35673,c0=35674,l0=35675,f0=35676,c2=35678,l2=35680,f2=35679,h2=35682,d2=35685,p2=35686,g2=35687,m2=35688,A2=35689,x2=35690,y2=36289,b2=36292,w2=36293,Ta=5125,h0=36294,d0=36295,p0=36296,v2=36298,C2=36299,E2=36300,S2=36303,D2=36306,B2=36307,F2=36308,M2=36311,ho=3553,po=34067,Pa=32879,go=35866,F={};function g0(t,e){return F[e].bindPoint}function I2(t,e){return function(n){t.uniform1f(e,n)}}function T2(t,e){return function(n){t.uniform1fv(e,n)}}function P2(t,e){return function(n){t.uniform2fv(e,n)}}function L2(t,e){return function(n){t.uniform3fv(e,n)}}function R2(t,e){return function(n){t.uniform4fv(e,n)}}function m0(t,e){return function(n){t.uniform1i(e,n)}}function A0(t,e){return function(n){t.uniform1iv(e,n)}}function x0(t,e){return function(n){t.uniform2iv(e,n)}}function y0(t,e){return function(n){t.uniform3iv(e,n)}}function b0(t,e){return function(n){t.uniform4iv(e,n)}}function k2(t,e){return function(n){t.uniform1ui(e,n)}}function N2(t,e){return function(n){t.uniform1uiv(e,n)}}function z2(t,e){return function(n){t.uniform2uiv(e,n)}}function O2(t,e){return function(n){t.uniform3uiv(e,n)}}function G2(t,e){return function(n){t.uniform4uiv(e,n)}}function U2(t,e){return function(n){t.uniformMatrix2fv(e,!1,n)}}function H2(t,e){return function(n){t.uniformMatrix3fv(e,!1,n)}}function Q2(t,e){return function(n){t.uniformMatrix4fv(e,!1,n)}}function j2(t,e){return function(n){t.uniformMatrix2x3fv(e,!1,n)}}function V2(t,e){return function(n){t.uniformMatrix3x2fv(e,!1,n)}}function Y2(t,e){return function(n){t.uniformMatrix2x4fv(e,!1,n)}}function W2(t,e){return function(n){t.uniformMatrix4x2fv(e,!1,n)}}function X2(t,e){return function(n){t.uniformMatrix3x4fv(e,!1,n)}}function Z2(t,e){return function(n){t.uniformMatrix4x3fv(e,!1,n)}}function de(t,e,n,r){const i=g0(t,e);return Sn(t)?function(o){let s,a;_i(t,o)?(s=o,a=null):(s=o.texture,a=o.sampler),t.uniform1i(r,n),t.activeTexture(co+n),t.bindTexture(i,s),t.bindSampler(n,a)}:function(o){t.uniform1i(r,n),t.activeTexture(co+n),t.bindTexture(i,o)}}function pe(t,e,n,r,i){const o=g0(t,e),s=new Int32Array(i);for(let a=0;a<i;++a)s[a]=n+a;return Sn(t)?function(a){t.uniform1iv(r,s),a.forEach(function(u,c){t.activeTexture(co+s[c]);let f,l;_i(t,u)?(f=u,l=null):(f=u.texture,l=u.sampler),t.bindSampler(n,l),t.bindTexture(o,f)})}:function(a){t.uniform1iv(r,s),a.forEach(function(u,c){t.activeTexture(co+s[c]),t.bindTexture(o,u)})}}F[fo]={Type:Float32Array,size:4,setter:I2,arraySetter:T2},F[$f]={Type:Float32Array,size:8,setter:P2,cols:2},F[e0]={Type:Float32Array,size:12,setter:L2,cols:3},F[t0]={Type:Float32Array,size:16,setter:R2,cols:4},F[Ia]={Type:Int32Array,size:4,setter:m0,arraySetter:A0},F[n0]={Type:Int32Array,size:8,setter:x0,cols:2},F[r0]={Type:Int32Array,size:12,setter:y0,cols:3},F[i0]={Type:Int32Array,size:16,setter:b0,cols:4},F[Ta]={Type:Uint32Array,size:4,setter:k2,arraySetter:N2},F[h0]={Type:Uint32Array,size:8,setter:z2,cols:2},F[d0]={Type:Uint32Array,size:12,setter:O2,cols:3},F[p0]={Type:Uint32Array,size:16,setter:G2,cols:4},F[o0]={Type:Uint32Array,size:4,setter:m0,arraySetter:A0},F[s0]={Type:Uint32Array,size:8,setter:x0,cols:2},F[a0]={Type:Uint32Array,size:12,setter:y0,cols:3},F[u0]={Type:Uint32Array,size:16,setter:b0,cols:4},F[c0]={Type:Float32Array,size:32,setter:U2,rows:2,cols:2},F[l0]={Type:Float32Array,size:48,setter:H2,rows:3,cols:3},F[f0]={Type:Float32Array,size:64,setter:Q2,rows:4,cols:4},F[d2]={Type:Float32Array,size:32,setter:j2,rows:2,cols:3},F[p2]={Type:Float32Array,size:32,setter:Y2,rows:2,cols:4},F[g2]={Type:Float32Array,size:48,setter:V2,rows:3,cols:2},F[m2]={Type:Float32Array,size:48,setter:X2,rows:3,cols:4},F[A2]={Type:Float32Array,size:64,setter:W2,rows:4,cols:2},F[x2]={Type:Float32Array,size:64,setter:Z2,rows:4,cols:3},F[c2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:ho},F[l2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:po},F[f2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:Pa},F[h2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:ho},F[y2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:go},F[b2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:go},F[w2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:po},F[v2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:ho},F[C2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:Pa},F[E2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:po},F[S2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:go},F[D2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:ho},F[B2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:Pa},F[F2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:po},F[M2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:go};function mo(t,e){return function(n){if(n.value)switch(t.disableVertexAttribArray(e),n.value.length){case 4:t.vertexAttrib4fv(e,n.value);break;case 3:t.vertexAttrib3fv(e,n.value);break;case 2:t.vertexAttrib2fv(e,n.value);break;case 1:t.vertexAttrib1fv(e,n.value);break;default:throw new Error("the length of a float constant value must be between 1 and 4!")}else t.bindBuffer(lo,n.buffer),t.enableVertexAttribArray(e),t.vertexAttribPointer(e,n.numComponents||n.size,n.type||fo,n.normalize||!1,n.stride||0,n.offset||0),n.divisor!==void 0&&t.vertexAttribDivisor(e,n.divisor)}}function Dt(t,e){return function(n){if(n.value)if(t.disableVertexAttribArray(e),n.value.length===4)t.vertexAttrib4iv(e,n.value);else throw new Error("The length of an integer constant value must be 4!");else t.bindBuffer(lo,n.buffer),t.enableVertexAttribArray(e),t.vertexAttribIPointer(e,n.numComponents||n.size,n.type||Ia,n.stride||0,n.offset||0),n.divisor!==void 0&&t.vertexAttribDivisor(e,n.divisor)}}function Ao(t,e){return function(n){if(n.value)if(t.disableVertexAttribArray(e),n.value.length===4)t.vertexAttrib4uiv(e,n.value);else throw new Error("The length of an unsigned integer constant value must be 4!");else t.bindBuffer(lo,n.buffer),t.enableVertexAttribArray(e),t.vertexAttribIPointer(e,n.numComponents||n.size,n.type||Ta,n.stride||0,n.offset||0),n.divisor!==void 0&&t.vertexAttribDivisor(e,n.divisor)}}function La(t,e,n){const r=n.size,i=n.count;return function(o){t.bindBuffer(lo,o.buffer);const s=o.size||o.numComponents||r,a=s/i,u=o.type||fo,f=F[u].size*s,l=o.normalize||!1,h=o.offset||0,p=f/i;for(let d=0;d<i;++d)t.enableVertexAttribArray(e+d),t.vertexAttribPointer(e+d,a,u,l,f,h+p*d),o.divisor!==void 0&&t.vertexAttribDivisor(e+d,o.divisor)}}const q={};q[fo]={size:4,setter:mo},q[$f]={size:8,setter:mo},q[e0]={size:12,setter:mo},q[t0]={size:16,setter:mo},q[Ia]={size:4,setter:Dt},q[n0]={size:8,setter:Dt},q[r0]={size:12,setter:Dt},q[i0]={size:16,setter:Dt},q[Ta]={size:4,setter:Ao},q[h0]={size:8,setter:Ao},q[d0]={size:12,setter:Ao},q[p0]={size:16,setter:Ao},q[o0]={size:4,setter:Dt},q[s0]={size:8,setter:Dt},q[a0]={size:12,setter:Dt},q[u0]={size:16,setter:Dt},q[c0]={size:4,setter:La,count:2},q[l0]={size:9,setter:La,count:3},q[f0]={size:16,setter:La,count:4};function w0(t){const e=t.name;return e.startsWith("gl_")||e.startsWith("webgl_")}const K2=/(\.|\[|]|\w+)/g,q2=t=>t>="0"&&t<="9";function v0(t,e,n,r){const i=t.split(K2).filter(a=>a!=="");let o=0,s="";for(;;){const a=i[o++];s+=a;const u=q2(a[0]),c=u?parseInt(a):a;if(u&&(s+=i[o++]),o===i.length){n[c]=e;break}else{const l=i[o++],h=l==="[",p=n[c]||(h?[]:{});n[c]=p,n=p,r[s]=r[s]||function(d){return function(g){B0(d,g)}}(p),s+=l}}}function J2(t,e){let n=0;function r(a,u,c){const f=u.name.endsWith("[0]"),l=u.type,h=F[l];if(!h)throw new Error(`unknown type: 0x${l.toString(16)}`);let p;if(h.bindPoint){const d=n;n+=u.size,f?p=h.arraySetter(t,l,d,c,u.size):p=h.setter(t,l,d,c,u.size)}else h.arraySetter&&f?p=h.arraySetter(t,c):p=h.setter(t,c);return p.location=c,p}const i={},o={},s=t.getProgramParameter(e,_f);for(let a=0;a<s;++a){const u=t.getActiveUniform(e,a);if(w0(u))continue;let c=u.name;c.endsWith("[0]")&&(c=c.substr(0,c.length-3));const f=t.getUniformLocation(e,u.name);if(f){const l=r(e,u,f);i[c]=l,v0(c,l,o,i)}}return i}function _2(t,e){const n={},r=t.getProgramParameter(e,r2);for(let i=0;i<r;++i){const o=t.getTransformFeedbackVarying(e,i);n[o.name]={index:i,type:o.type,size:o.size}}return n}function $2(t,e){const n=t.getProgramParameter(e,_f),r=[],i=[];for(let a=0;a<n;++a){i.push(a),r.push({});const u=t.getActiveUniform(e,a);r[a].name=u.name}[["UNIFORM_TYPE","type"],["UNIFORM_SIZE","size"],["UNIFORM_BLOCK_INDEX","blockNdx"],["UNIFORM_OFFSET","offset"]].forEach(function(a){const u=a[0],c=a[1];t.getActiveUniforms(e,i,t[u]).forEach(function(f,l){r[l][c]=f})});const o={},s=t.getProgramParameter(e,i2);for(let a=0;a<s;++a){const u=t.getActiveUniformBlockName(e,a),c={index:t.getUniformBlockIndex(e,u),usedByVertexShader:t.getActiveUniformBlockParameter(e,a,o2),usedByFragmentShader:t.getActiveUniformBlockParameter(e,a,s2),size:t.getActiveUniformBlockParameter(e,a,a2),uniformIndices:t.getActiveUniformBlockParameter(e,a,u2)};c.used=c.usedByVertexShader||c.usedByFragmentShader,o[u]=c}return{blockSpecs:o,uniformData:r}}const C0=/\[\d+\]\.$/,eb=(t,e)=>((t+(e-1))/e|0)*e;function tb(t,e,n,r){if(e||n){r=r||1;const o=t.length/4;return function(s){let a=0,u=0;for(let c=0;c<o;++c){for(let f=0;f<r;++f)t[a++]=s[u++];a+=4-r}}}else return function(i){i.length?t.set(i):t[0]=i}}function nb(t,e,n,r){const i=n.blockSpecs,o=n.uniformData,s=i[r];if(!s)return $y("no uniform block object named:",r),{name:r,uniforms:{}};const a=new ArrayBuffer(s.size),u=t.createBuffer(),c=s.index;t.bindBuffer(Ma,u),t.uniformBlockBinding(e,s.index,c);let f=r+".";C0.test(f)&&(f=f.replace(C0,"."));const l={},h={},p={};return s.uniformIndices.forEach(function(d){const g=o[d];let A=g.name;A.startsWith(f)&&(A=A.substr(f.length));const m=A.endsWith("[0]");m&&(A=A.substr(0,A.length-3));const b=F[g.type],y=b.Type,w=m?eb(b.size,16)*g.size:b.size*g.size,E=new y(a,g.offset,w/y.BYTES_PER_ELEMENT);l[A]=E;const C=tb(E,m,b.rows,b.cols);h[A]=C,v0(A,C,p,h)}),{name:r,array:a,asFloat:new Float32Array(a),buffer:u,uniforms:l,setters:h}}function E0(t,e,n){return nb(t,e.program,e.uniformBlockSpec,n)}function rb(t,e,n){const i=(e.uniformBlockSpec||e).blockSpecs[n.name];if(i){const o=i.index;return t.bindBufferRange(Ma,o,n.buffer,n.offset||0,n.array.byteLength),!0}return!1}function S0(t,e,n){rb(t,e,n)&&t.bufferData(Ma,n.array,e2)}function D0(t,e){const n=t.setters;for(const r in e){const i=n[r];if(i){const o=e[r];i(o)}}}function B0(t,e){for(const n in e){const r=t[n];typeof r=="function"?r(e[n]):B0(t[n],e[n])}}function Ee(t,...e){const n=t.uniformSetters||t,r=e.length;for(let i=0;i<r;++i){const o=e[i];if(Array.isArray(o)){const s=o.length;for(let a=0;a<s;++a)Ee(n,o[a])}else for(const s in o){const a=n[s];a&&a(o[s])}}}function ib(t,e){const n={},r=t.getProgramParameter(e,n2);for(let i=0;i<r;++i){const o=t.getActiveAttrib(e,i);if(w0(o))continue;const s=t.getAttribLocation(e,o.name),a=q[o.type],u=a.setter(t,s,a);u.location=s,n[o.name]=u}return n}function ob(t,e){for(const n in e){const r=t[n];r&&r(e[n])}}function Ln(t,e,n){n.vertexArrayObject?t.bindVertexArray(n.vertexArrayObject):(ob(e.attribSetters||e,n.attribs),n.indices&&t.bindBuffer(t2,n.indices))}function sb(t,e){const n=J2(t,e),r=ib(t,e),i={program:e,uniformSetters:n,attribSetters:r};return Sn(t)&&(i.uniformBlockSpec=$2(t,e),i.transformFeedbackInfo=_2(t,e)),i}const ab=4,F0=5123;function Vr(t,e,n,r,i,o){n=n===void 0?ab:n;const s=e.indices,a=e.elementType,u=r===void 0?e.numElements:r;i=i===void 0?0:i,a||s?o!==void 0?t.drawElementsInstanced(n,u,a===void 0?F0:e.elementType,i,o):t.drawElements(n,u,a===void 0?F0:e.elementType,i):o!==void 0?t.drawArraysInstanced(n,i,u,o):t.drawArrays(n,i,u)}const ub=36160,$t=36161,cb=3553,lb=5121,fb=6402,hb=6408,db=33190,pb=36012,gb=35056,mb=36013,Ab=32854,xb=32855,yb=36194,M0=33189,I0=6401,T0=36168,Ra=34041,bb=36064,xo=36096,P0=36128,ka=33306,Na=33071,za=9729,L0=[{format:hb,type:lb,min:za,wrap:Na},{format:Ra}],Qe={};Qe[Ra]=ka,Qe[I0]=P0,Qe[T0]=P0,Qe[fb]=xo,Qe[M0]=xo,Qe[db]=xo,Qe[pb]=xo,Qe[gb]=ka,Qe[mb]=ka;function wb(t,e){return Qe[t]||Qe[e]}const Bt={};Bt[Ab]=!0,Bt[xb]=!0,Bt[yb]=!0,Bt[Ra]=!0,Bt[M0]=!0,Bt[I0]=!0,Bt[T0]=!0;function vb(t){return Bt[t]}function Cb(t,e,n,r){const i=ub,o=t.createFramebuffer();t.bindFramebuffer(i,o),n=n||t.drawingBufferWidth,r=r||t.drawingBufferHeight,e=e||L0;let s=0;const a={framebuffer:o,attachments:[],width:n,height:r};return e.forEach(function(u){let c=u.attachment;const f=u.samples,l=u.format;let h=u.attachmentPoint||wb(l,u.internalFormat);if(h||(h=bb+s++),!c)if(f!==void 0||vb(l))c=t.createRenderbuffer(),t.bindRenderbuffer($t,c),f>1?t.renderbufferStorageMultisample($t,f,l,n,r):t.renderbufferStorage($t,l,n,r);else{const p=Object.assign({},u);p.width=n,p.height=r,p.auto===void 0&&(p.auto=!1,p.min=p.min||p.minMag||za,p.mag=p.mag||p.minMag||za,p.wrapS=p.wrapS||p.wrap||Na,p.wrapT=p.wrapT||p.wrap||Na),c=jr(t,p)}if(Ef(t,c))t.framebufferRenderbuffer(i,h,$t,c);else if(_i(t,c))u.layer!==void 0?t.framebufferTextureLayer(i,h,c,u.level||0,u.layer):t.framebufferTexture2D(i,h,u.target||cb,c,u.level||0);else throw new Error("unknown attachment type");a.attachments.push(c)}),a}function Eb(t,e,n,r,i){r=r||t.drawingBufferWidth,i=i||t.drawingBufferHeight,e.width=r,e.height=i,n=n||L0,n.forEach(function(o,s){const a=e.attachments[s],u=o.format,c=o.samples;if(c!==void 0||Ef(t,a))t.bindRenderbuffer($t,a),c>1?t.renderbufferStorageMultisample($t,c,u,r,i):t.renderbufferStorage($t,u,r,i);else if(_i(t,a))_y(t,a,o,r,i);else throw new Error("unknown attachment type")})}function Sb(t,e,n){const r=t.createVertexArray();return t.bindVertexArray(r),e.length||(e=[e]),e.forEach(function(i){Ln(t,i,n)}),t.bindVertexArray(null),{numElements:n.numElements,elementType:n.elementType,vertexArrayObject:r}}const Db=/^(.*?)_/;function Bb(t,e){xa(t,0);const n=t.getExtension(e);if(n){const r={},i=Db.exec(e)[1],o="_"+i;for(const s in n){const a=n[s],u=typeof a=="function",c=u?i:o;let f=s;s.endsWith(c)&&(f=s.substring(0,s.length-c.length)),t[f]!==void 0?!u&&t[f]!==a&&Cf(f,t[f],a,s):u?t[f]=function(l){return function(){return l.apply(n,arguments)}}(a):(t[f]=a,r[f]=a)}r.constructor={name:n.constructor.name},xa(r,0)}return n}const R0=["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_color_buffer_float","EXT_color_buffer_half_float","EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2","EXT_frag_depth","EXT_sRGB","EXT_shader_texture_lod","EXT_texture_filter_anisotropic","OES_element_index_uint","OES_standard_derivatives","OES_texture_float","OES_texture_float_linear","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_color_buffer_float","WEBGL_compressed_texture_atc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_pvrtc","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_depth_texture","WEBGL_draw_buffers"];function k0(t){for(let e=0;e<R0.length;++e)Bb(t,R0[e])}function Fb(t,e){const n=["webgl2","webgl","experimental-webgl"];let r=null;for(let i=0;i<n.length;++i)if(r=t.getContext(n[i],e),r){k0(r);break}return r}function Mb(t,e){return Fb(t,e)}const Ib=`/***The vertex position wrt the rectangle specified by(x,x2,y,y2).*[0,0]=[x,y],[1,1]=[x2,y2].*The x or y component may contain fractional values if the rectangle*have been tessellated.*/in vec2 frac;uniform vec2 uMinSize;uniform float uMinOpacity;uniform vec4 uCornerRadii;flat out lowp vec4 vFillColor;flat out lowp vec4 vStrokeColor;flat out float vHalfStrokeWidth;flat out vec4 vCornerRadii;
14
+ see: http://github.com/greggman/twgl.js for details */const ca=5120,Or=5121,la=5122,fa=5123,ha=5124,da=5125,pa=5126,Q1=32819,j1=32820,V1=33635,Y1=5131,W1=33640,X1=35899,Z1=35902,K1=36269,q1=34042,vf={};{const t=vf;t[ca]=Int8Array,t[Or]=Uint8Array,t[la]=Int16Array,t[fa]=Uint16Array,t[ha]=Int32Array,t[da]=Uint32Array,t[pa]=Float32Array,t[Q1]=Uint16Array,t[j1]=Uint16Array,t[V1]=Uint16Array,t[Y1]=Uint16Array,t[W1]=Uint32Array,t[X1]=Uint32Array,t[Z1]=Uint32Array,t[K1]=Uint32Array,t[q1]=Uint32Array}function ga(t){if(t instanceof Int8Array)return ca;if(t instanceof Uint8Array||t instanceof Uint8ClampedArray)return Or;if(t instanceof Int16Array)return la;if(t instanceof Uint16Array)return fa;if(t instanceof Int32Array)return ha;if(t instanceof Uint32Array)return da;if(t instanceof Float32Array)return pa;throw new Error("unsupported typed array type")}function J1(t){if(t===Int8Array)return ca;if(t===Uint8Array||t===Uint8ClampedArray)return Or;if(t===Int16Array)return la;if(t===Uint16Array)return fa;if(t===Int32Array)return ha;if(t===Uint32Array)return da;if(t===Float32Array)return pa;throw new Error("unsupported typed array type")}function _1(t){const e=vf[t];if(!e)throw new Error("unknown gl type");return e}const Ji=typeof SharedArrayBuffer<"u"?function(e){return e&&e.buffer&&(e.buffer instanceof ArrayBuffer||e.buffer instanceof SharedArrayBuffer)}:function(e){return e&&e.buffer&&e.buffer instanceof ArrayBuffer};function $1(...t){console.error(...t)}function Cf(...t){console.warn(...t)}function ex(t,e){return typeof WebGLBuffer<"u"&&e instanceof WebGLBuffer}function Ef(t,e){return typeof WebGLRenderbuffer<"u"&&e instanceof WebGLRenderbuffer}function _i(t,e){return typeof WebGLTexture<"u"&&e instanceof WebGLTexture}function tx(t,e){return typeof WebGLSampler<"u"&&e instanceof WebGLSampler}const Sf=35044,Je=34962,nx=34963,rx=34660,ix=5120,ox=5121,sx=5122,ax=5123,ux=5124,cx=5125,lx=5126,Df={attribPrefix:""};function Bf(t,e,n,r,i){t.bindBuffer(e,n),t.bufferData(e,r,i||Sf)}function Ff(t,e,n,r){if(ex(t,e))return e;n=n||Je;const i=t.createBuffer();return Bf(t,n,i,e,r),i}function Mf(t){return t==="indices"}function fx(t){return t instanceof Int8Array||t instanceof Uint8Array}function hx(t){return t===Int8Array||t===Uint8Array}function dx(t){return t.length?t:t.data}const px=/coord|texture/i,gx=/color|colour/i;function If(t,e){let n;if(px.test(t)?n=2:gx.test(t)?n=4:n=3,e%n>0)throw new Error(`Can not guess numComponents for attribute '${t}'. Tried ${n} but ${e} values is not evenly divisible by ${n}. You should specify it.`);return n}function mx(t,e){return t.numComponents||t.size||If(e,dx(t).length)}function ma(t,e){if(Ji(t))return t;if(Ji(t.data))return t.data;Array.isArray(t)&&(t={data:t});let n=t.type;return n||(Mf(e)?n=Uint16Array:n=Float32Array),new n(t.data)}function Ax(t,e){const n={};return Object.keys(e).forEach(function(r){if(!Mf(r)){const i=e[r],o=i.attrib||i.name||i.attribName||Df.attribPrefix+r;if(i.value){if(!Array.isArray(i.value)&&!Ji(i.value))throw new Error("array.value is not array or typedarray");n[o]={value:i.value}}else{let s,a,u,c;if(i.buffer&&i.buffer instanceof WebGLBuffer)s=i.buffer,c=i.numComponents||i.size,a=i.type,u=i.normalize;else if(typeof i=="number"||typeof i.data=="number"){const f=i.data||i,l=i.type||Float32Array,h=f*l.BYTES_PER_ELEMENT;a=J1(l),u=i.normalize!==void 0?i.normalize:hx(l),c=i.numComponents||i.size||If(r,f),s=t.createBuffer(),t.bindBuffer(Je,s),t.bufferData(Je,h,i.drawType||Sf)}else{const f=ma(i,r);s=Ff(t,f,void 0,i.drawType),a=ga(f),u=i.normalize!==void 0?i.normalize:fx(f),c=mx(i,r)}n[o]={buffer:s,numComponents:c,type:a,normalize:u,stride:i.stride||0,offset:i.offset||0,divisor:i.divisor===void 0?void 0:i.divisor,drawType:i.drawType}}}}),t.bindBuffer(Je,null),n}function xx(t,e,n,r){n=ma(n),r!==void 0?(t.bindBuffer(Je,e.buffer),t.bufferSubData(Je,r,n)):Bf(t,Je,e.buffer,n,e.drawType)}function yx(t,e){return e===ix||e===ox?1:e===sx||e===ax?2:e===ux||e===cx||e===lx?4:0}const Aa=["position","positions","a_position"];function bx(t,e){let n,r;for(r=0;r<Aa.length&&(n=Aa[r],!(n in e||(n=Df.attribPrefix+n,n in e)));++r);r===Aa.length&&(n=Object.keys(e)[0]);const i=e[n];t.bindBuffer(Je,i.buffer);const o=t.getBufferParameter(Je,rx);t.bindBuffer(Je,null);const s=yx(t,i.type),a=o/s,u=i.numComponents||i.size,c=a/u;if(c%1!==0)throw new Error(`numComponents ${u} not correct for length ${length}`);return c}function wx(t,e,n){const r=Ax(t,e),i=Object.assign({},n||{});i.attribs=Object.assign({},n?n.attribs:{},r);const o=e.indices;if(o){const s=ma(o,"indices");i.indices=Ff(t,s,nx),i.numElements=s.length,i.elementType=ga(s)}else i.numElements||(i.numElements=bx(t,i.attribs));return i}function Sn(t){return!!t.texStorage2D}const xa=function(){const t={},e={};function n(r){const i=r.constructor.name;if(!t[i]){for(const o in r)if(typeof r[o]=="number"){const s=e[r[o]];e[r[o]]=s?`${s} | ${o}`:o}t[i]=!0}}return function(i,o){return n(i),e[o]||(typeof o=="number"?`0x${o.toString(16)}`:o)}}(),vt={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},Dn=Ji,Tf=function(){let t;return function(){return t=t||(typeof document<"u"&&document.createElement?document.createElement("canvas").getContext("2d"):null),t}}(),Pf=6406,_e=6407,Y=6408,Lf=6409,Rf=6410,Gr=6402,kf=34041,$i=33071,vx=9728,Cx=9729,st=3553,at=34067,Ct=32879,Et=35866,eo=34069,Ex=34070,Sx=34071,Dx=34072,Bx=34073,Fx=34074,ya=10241,ba=10240,to=10242,no=10243,Nf=32882,Mx=33082,Ix=33083,Tx=33084,Px=33085,wa=3317,zf=3314,Of=32878,Gf=3316,Uf=3315,Hf=32877,Lx=37443,Rx=37441,kx=37440,Nx=33321,zx=36756,Ox=33325,Gx=33326,Ux=33330,Hx=33329,Qx=33338,jx=33337,Vx=33340,Yx=33339,Wx=33323,Xx=36757,Zx=33327,Kx=33328,qx=33336,Jx=33335,_x=33332,$x=33331,ey=33334,ty=33333,ny=32849,ry=35905,iy=36194,oy=36758,sy=35898,ay=35901,uy=34843,cy=34837,ly=36221,fy=36239,hy=36215,dy=36233,py=36209,gy=36227,my=32856,Ay=35907,xy=36759,yy=32855,by=32854,wy=32857,vy=34842,Cy=34836,Ey=36220,Sy=36238,Dy=36975,By=36214,Fy=36232,My=36226,Iy=36208,Ty=33189,Py=33190,Ly=36012,Ry=36013,ky=35056,St=5120,W=5121,ro=5122,Bn=5123,io=5124,Jt=5125,fe=5126,Qf=32819,jf=32820,Vf=33635,He=5131,Ur=36193,va=33640,Ny=35899,zy=35902,Oy=36269,Gy=34042,oo=33319,Fn=33320,so=6403,Mn=36244,In=36248,_t=36249;let Ca;function ao(t){if(!Ca){const e={};e[Pf]={textureFormat:Pf,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[W,He,Ur,fe]},e[Lf]={textureFormat:Lf,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[W,He,Ur,fe]},e[Rf]={textureFormat:Rf,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2,4,4,8],type:[W,He,Ur,fe]},e[_e]={textureFormat:_e,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,6,6,12,2],type:[W,He,Ur,fe,Vf]},e[Y]={textureFormat:Y,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,8,8,16,2,2],type:[W,He,Ur,fe,Qf,jf]},e[Gr]={textureFormat:Gr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[Jt,Bn]},e[Nx]={textureFormat:so,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1],type:[W]},e[zx]={textureFormat:so,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[1],type:[St]},e[Ox]={textureFormat:so,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4,2],type:[fe,He]},e[Gx]={textureFormat:so,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[4],type:[fe]},e[Ux]={textureFormat:Mn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[1],type:[W]},e[Hx]={textureFormat:Mn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[1],type:[St]},e[_x]={textureFormat:Mn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[Bn]},e[$x]={textureFormat:Mn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[ro]},e[ey]={textureFormat:Mn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Jt]},e[ty]={textureFormat:Mn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[io]},e[Wx]={textureFormat:oo,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2],type:[W]},e[Xx]={textureFormat:oo,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[2],type:[St]},e[Zx]={textureFormat:oo,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[8,4],type:[fe,He]},e[Kx]={textureFormat:oo,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[8],type:[fe]},e[qx]={textureFormat:Fn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[W]},e[Jx]={textureFormat:Fn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[St]},e[Qx]={textureFormat:Fn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Bn]},e[jx]={textureFormat:Fn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[ro]},e[Vx]={textureFormat:Fn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[Jt]},e[Yx]={textureFormat:Fn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[io]},e[ny]={textureFormat:_e,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3],type:[W]},e[ry]={textureFormat:_e,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[3],type:[W]},e[iy]={textureFormat:_e,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,2],type:[W,Vf]},e[oy]={textureFormat:_e,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[3],type:[St]},e[sy]={textureFormat:_e,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[fe,He,Ny]},e[ay]={textureFormat:_e,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[fe,He,zy]},e[uy]={textureFormat:_e,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6],type:[fe,He]},e[cy]={textureFormat:_e,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[fe]},e[ly]={textureFormat:In,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[3],type:[W]},e[fy]={textureFormat:In,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[3],type:[St]},e[hy]={textureFormat:In,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[6],type:[Bn]},e[dy]={textureFormat:In,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[6],type:[ro]},e[py]={textureFormat:In,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[Jt]},e[gy]={textureFormat:In,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[io]},e[my]={textureFormat:Y,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[W]},e[Ay]={textureFormat:Y,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[W]},e[xy]={textureFormat:Y,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4],type:[St]},e[yy]={textureFormat:Y,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2,4],type:[W,jf,va]},e[by]={textureFormat:Y,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2],type:[W,Qf]},e[wy]={textureFormat:Y,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[va]},e[vy]={textureFormat:Y,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[16,8],type:[fe,He]},e[Cy]={textureFormat:Y,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[16],type:[fe]},e[Ey]={textureFormat:_t,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[W]},e[Sy]={textureFormat:_t,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[St]},e[Dy]={textureFormat:_t,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[va]},e[By]={textureFormat:_t,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[Bn]},e[Fy]={textureFormat:_t,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[ro]},e[My]={textureFormat:_t,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[16],type:[io]},e[Iy]={textureFormat:_t,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[16],type:[Jt]},e[Ty]={textureFormat:Gr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[Bn,Jt]},e[Py]={textureFormat:Gr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Jt]},e[Ly]={textureFormat:Gr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[fe]},e[ky]={textureFormat:kf,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Gy]},e[Ry]={textureFormat:kf,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Oy]},Object.keys(e).forEach(function(n){const r=e[n];r.bytesPerElementMap={},r.bytesPerElement.forEach(function(i,o){const s=r.type[o];r.bytesPerElementMap[s]=i})}),Ca=e}return Ca[t]}function Uy(t,e){const n=ao(t);if(!n)throw"unknown internal format";const r=n.bytesPerElementMap[e];if(r===void 0)throw"unknown internal format";return r}function Tn(t){const e=ao(t);if(!e)throw"unknown internal format";return{format:e.textureFormat,type:e.type[0]}}function Yf(t){return(t&t-1)===0}function Hy(t,e,n,r){if(!Sn(t))return Yf(e)&&Yf(n);const i=ao(r);if(!i)throw"unknown internal format";return i.colorRenderable&&i.textureFilterable}function Qy(t){const e=ao(t);if(!e)throw"unknown internal format";return e.textureFilterable}function Wf(t,e,n){return Dn(e)?ga(e):n||W}function uo(t,e,n,r,i){if(i%1!==0)throw"can't guess dimensions";if(!n&&!r){const o=Math.sqrt(i/(e===at?6:1));o%1===0?(n=o,r=o):(n=i,r=1)}else if(r){if(!n&&(n=i/r,n%1))throw"can't guess dimensions"}else if(r=i/n,r%1)throw"can't guess dimensions";return{width:n,height:r}}function Pn(t,e){e.colorspaceConversion!==void 0&&t.pixelStorei(Lx,e.colorspaceConversion),e.premultiplyAlpha!==void 0&&t.pixelStorei(Rx,e.premultiplyAlpha),e.flipY!==void 0&&t.pixelStorei(kx,e.flipY)}function Xf(t){t.pixelStorei(wa,4),Sn(t)&&(t.pixelStorei(zf,0),t.pixelStorei(Of,0),t.pixelStorei(Gf,0),t.pixelStorei(Uf,0),t.pixelStorei(Hf,0))}function jy(t,e,n,r){r.minMag&&(n.call(t,e,ya,r.minMag),n.call(t,e,ba,r.minMag)),r.min&&n.call(t,e,ya,r.min),r.mag&&n.call(t,e,ba,r.mag),r.wrap&&(n.call(t,e,to,r.wrap),n.call(t,e,no,r.wrap),(e===Ct||tx(t,e))&&n.call(t,e,Nf,r.wrap)),r.wrapR&&n.call(t,e,Nf,r.wrapR),r.wrapS&&n.call(t,e,to,r.wrapS),r.wrapT&&n.call(t,e,no,r.wrapT),r.minLod&&n.call(t,e,Mx,r.minLod),r.maxLod&&n.call(t,e,Ix,r.maxLod),r.baseLevel&&n.call(t,e,Tx,r.baseLevel),r.maxLevel&&n.call(t,e,Px,r.maxLevel)}function Zf(t,e,n){const r=n.target||st;t.bindTexture(r,e),jy(t,r,t.texParameteri,n)}function Vy(t){return t=t||vt.textureColor,Dn(t)?t:new Uint8Array([t[0]*255,t[1]*255,t[2]*255,t[3]*255])}function Ea(t,e,n,r,i,o){n=n||vt.textureOptions,o=o||Y;const s=n.target||st;if(r=r||n.width,i=i||n.height,t.bindTexture(s,e),Hy(t,r,i,o))t.generateMipmap(s);else{const a=Qy(o)?Cx:vx;t.texParameteri(s,ya,a),t.texParameteri(s,ba,a),t.texParameteri(s,to,$i),t.texParameteri(s,no,$i)}}function Hr(t){return t.auto===!0||t.auto===void 0&&t.level===void 0}function Sa(t,e){return e=e||{},e.cubeFaceOrder||[eo,Ex,Sx,Dx,Bx,Fx]}function Da(t,e){const r=Sa(t,e).map(function(i,o){return{face:i,ndx:o}});return r.sort(function(i,o){return i.face-o.face}),r}function Kf(t,e,n,r){r=r||vt.textureOptions;const i=r.target||st,o=r.level||0;let s=n.width,a=n.height;const u=r.internalFormat||r.format||Y,c=Tn(u),f=r.format||c.format,l=r.type||c.type;if(Pn(t,r),t.bindTexture(i,e),i===at){const h=n.width,p=n.height;let d,g;if(h/6===p)d=p,g=[0,0,1,0,2,0,3,0,4,0,5,0];else if(p/6===h)d=h,g=[0,0,0,1,0,2,0,3,0,4,0,5];else if(h/3===p/2)d=h/3,g=[0,0,1,0,2,0,0,1,1,1,2,1];else if(h/2===p/3)d=h/2,g=[0,0,1,0,0,1,1,1,0,2,1,2];else throw"can't figure out cube map from element: "+(n.src?n.src:n.nodeName);const A=Tf();A?(A.canvas.width=d,A.canvas.height=d,s=d,a=d,Da(t,r).forEach(function(m){const b=g[m.ndx*2+0]*d,y=g[m.ndx*2+1]*d;A.drawImage(n,b,y,d,d,0,0,d,d),t.texImage2D(m.face,o,u,f,l,A.canvas)}),A.canvas.width=1,A.canvas.height=1):typeof createImageBitmap<"u"&&(s=d,a=d,Da(t,r).forEach(function(m){const b=g[m.ndx*2+0]*d,y=g[m.ndx*2+1]*d;t.texImage2D(m.face,o,u,d,d,0,f,l,null),createImageBitmap(n,b,y,d,d,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then(function(w){Pn(t,r),t.bindTexture(i,e),t.texImage2D(m.face,o,u,f,l,w),Hr(r)&&Ea(t,e,r,s,a,u)})}))}else if(i===Ct||i===Et){const h=Math.min(n.width,n.height),p=Math.max(n.width,n.height),d=p/h;if(d%1!==0)throw"can not compute 3D dimensions of element";const g=n.width===p?1:0,A=n.height===p?1:0;t.pixelStorei(wa,1),t.pixelStorei(zf,n.width),t.pixelStorei(Of,0),t.pixelStorei(Hf,0),t.texImage3D(i,o,u,h,h,h,0,f,l,null);for(let m=0;m<d;++m){const b=m*h*g,y=m*h*A;t.pixelStorei(Gf,b),t.pixelStorei(Uf,y),t.texSubImage3D(i,o,0,0,m,h,h,1,f,l,n)}Xf(t)}else t.texImage2D(i,o,u,f,l,n);Hr(r)&&Ea(t,e,r,s,a,u),Zf(t,e,r)}function Qr(){}function Yy(t){if(typeof document<"u"){const e=document.createElement("a");return e.href=t,e.hostname===location.hostname&&e.port===location.port&&e.protocol===location.protocol}else{const e=new URL(location.href).origin;return new URL(t,location.href).origin===e}}function Wy(t,e){return e===void 0&&!Yy(t)?"anonymous":e}function Xy(t,e,n){n=n||Qr;let r;if(e=e!==void 0?e:vt.crossOrigin,e=Wy(t,e),typeof Image<"u"){r=new Image,e!==void 0&&(r.crossOrigin=e);const i=function(){r.removeEventListener("error",o),r.removeEventListener("load",s),r=null},o=function(){const u="couldn't load image: "+t;$1(u),n(u,r),i()},s=function(){n(null,r),i()};return r.addEventListener("error",o),r.addEventListener("load",s),r.src=t,r}else if(typeof ImageBitmap<"u"){let i,o;const s=function(){n(i,o)},a={};e&&(a.mode="cors"),fetch(t,a).then(function(u){if(!u.ok)throw u;return u.blob()}).then(function(u){return createImageBitmap(u,{premultiplyAlpha:"none",colorSpaceConversion:"none"})}).then(function(u){o=u,setTimeout(s)}).catch(function(u){i=u,setTimeout(s)}),r=null}return r}function qf(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof ImageData<"u"&&t instanceof ImageData||typeof HTMLElement<"u"&&t instanceof HTMLElement}function Ba(t,e,n){return qf(t)?(setTimeout(function(){n(null,t)}),t):Xy(t,e,n)}function Fa(t,e,n){n=n||vt.textureOptions;const r=n.target||st;if(t.bindTexture(r,e),n.color===!1)return;const i=Vy(n.color);if(r===at)for(let o=0;o<6;++o)t.texImage2D(eo+o,0,Y,1,1,0,Y,W,i);else r===Ct||r===Et?t.texImage3D(r,0,Y,1,1,1,0,Y,W,i):t.texImage2D(r,0,Y,1,1,0,Y,W,i)}function Zy(t,e,n,r){return r=r||Qr,n=n||vt.textureOptions,Fa(t,e,n),n=Object.assign({},n),Ba(n.src,n.crossOrigin,function(o,s){o?r(o,e,s):(Kf(t,e,s,n),r(null,e,s))})}function Ky(t,e,n,r){r=r||Qr;const i=n.src;if(i.length!==6)throw"there must be 6 urls for a cubemap";const o=n.level||0,s=n.internalFormat||n.format||Y,a=Tn(s),u=n.format||a.format,c=n.type||W,f=n.target||st;if(f!==at)throw"target must be TEXTURE_CUBE_MAP";Fa(t,e,n),n=Object.assign({},n);let l=6;const h=[],p=Sa(t,n);let d;function g(A){return function(m,b){--l,m?h.push(m):b.width!==b.height?h.push("cubemap face img is not a square: "+b.src):(Pn(t,n),t.bindTexture(f,e),l===5?Sa().forEach(function(y){t.texImage2D(y,o,s,u,c,b)}):t.texImage2D(A,o,s,u,c,b),Hr(n)&&t.generateMipmap(f)),l===0&&r(h.length?h:void 0,e,d)}}d=i.map(function(A,m){return Ba(A,n.crossOrigin,g(p[m]))})}function qy(t,e,n,r){r=r||Qr;const i=n.src,o=n.internalFormat||n.format||Y,s=Tn(o),a=n.format||s.format,u=n.type||W,c=n.target||Et;if(c!==Ct&&c!==Et)throw"target must be TEXTURE_3D or TEXTURE_2D_ARRAY";Fa(t,e,n),n=Object.assign({},n);let f=i.length;const l=[];let h;const p=n.level||0;let d=n.width,g=n.height;const A=i.length;let m=!0;function b(y){return function(w,E){if(--f,w)l.push(w);else{if(Pn(t,n),t.bindTexture(c,e),m){m=!1,d=n.width||E.width,g=n.height||E.height,t.texImage3D(c,p,o,d,g,A,0,a,u,null);for(let C=0;C<A;++C)t.texSubImage3D(c,p,0,0,C,d,g,1,a,u,E)}else{let C=E,B;(E.width!==d||E.height!==g)&&(B=Tf(),C=B.canvas,B.canvas.width=d,B.canvas.height=g,B.drawImage(E,0,0,d,g)),t.texSubImage3D(c,p,0,0,y,d,g,1,a,u,C),B&&C===B.canvas&&(B.canvas.width=0,B.canvas.height=0)}Hr(n)&&t.generateMipmap(c)}f===0&&r(l.length?l:void 0,e,h)}}h=i.map(function(y,w){return Ba(y,n.crossOrigin,b(w))})}function Jf(t,e,n,r){r=r||vt.textureOptions;const i=r.target||st;t.bindTexture(i,e);let o=r.width,s=r.height,a=r.depth;const u=r.level||0,c=r.internalFormat||r.format||Y,f=Tn(c),l=r.format||f.format,h=r.type||Wf(t,n,f.type);if(Dn(n))n instanceof Uint8ClampedArray&&(n=new Uint8Array(n.buffer));else{const A=_1(h);n=new A(n)}const p=Uy(c,h),d=n.byteLength/p;if(d%1)throw"length wrong size for format: "+xa(t,l);let g;if(i===Ct||i===Et)if(!o&&!s&&!a){const A=Math.cbrt(d);if(A%1!==0)throw"can't guess cube size of array of numElements: "+d;o=A,s=A,a=A}else o&&(!s||!a)?(g=uo(t,i,s,a,d/o),s=g.width,a=g.height):s&&(!o||!a)?(g=uo(t,i,o,a,d/s),o=g.width,a=g.height):(g=uo(t,i,o,s,d/a),o=g.width,s=g.height);else g=uo(t,i,o,s,d),o=g.width,s=g.height;if(Xf(t),t.pixelStorei(wa,r.unpackAlignment||1),Pn(t,r),i===at){const A=p/n.BYTES_PER_ELEMENT,m=d/6*A;Da(t,r).forEach(b=>{const y=m*b.ndx,w=n.subarray(y,y+m);t.texImage2D(b.face,u,c,o,s,0,l,h,w)})}else i===Ct||i===Et?t.texImage3D(i,u,c,o,s,a,0,l,h,n):t.texImage2D(i,u,c,o,s,0,l,h,n);return{width:o,height:s,depth:a,type:h}}function Jy(t,e,n){const r=n.target||st;t.bindTexture(r,e);const i=n.level||0,o=n.internalFormat||n.format||Y,s=Tn(o),a=n.format||s.format,u=n.type||s.type;if(Pn(t,n),r===at)for(let c=0;c<6;++c)t.texImage2D(eo+c,i,o,n.width,n.height,0,a,u,null);else r===Ct||r===Et?t.texImage3D(r,i,o,n.width,n.height,n.depth,0,a,u,null):t.texImage2D(r,i,o,n.width,n.height,0,a,u,null)}function jr(t,e,n){n=n||Qr,e=e||vt.textureOptions;const r=t.createTexture(),i=e.target||st;let o=e.width||1,s=e.height||1;const a=e.internalFormat||Y;t.bindTexture(i,r),i===at&&(t.texParameteri(i,to,$i),t.texParameteri(i,no,$i));let u=e.src;if(u)if(typeof u=="function"&&(u=u(t,e)),typeof u=="string")Zy(t,r,e,n);else if(Dn(u)||Array.isArray(u)&&(typeof u[0]=="number"||Array.isArray(u[0])||Dn(u[0]))){const c=Jf(t,r,u,e);o=c.width,s=c.height}else Array.isArray(u)&&(typeof u[0]=="string"||qf(u[0]))?i===at?Ky(t,r,e,n):qy(t,r,e,n):(Kf(t,r,u,e),o=u.width,s=u.height);else Jy(t,r,e);return Hr(e)&&Ea(t,r,e,o,s,a),Zf(t,r,e),r}function _y(t,e,n,r,i,o){r=r||n.width,i=i||n.height,o=o||n.depth;const s=n.target||st;t.bindTexture(s,e);const a=n.level||0,u=n.internalFormat||n.format||Y,c=Tn(u),f=n.format||c.format;let l;const h=n.src;if(h&&(Dn(h)||Array.isArray(h)&&typeof h[0]=="number")?l=n.type||Wf(t,h,c.type):l=n.type||c.type,s===at)for(let p=0;p<6;++p)t.texImage2D(eo+p,a,u,r,i,0,f,l,null);else s===Ct||s===Et?t.texImage3D(s,a,u,r,i,o,0,f,l,null):t.texImage2D(s,a,u,r,i,0,f,l,null)}const $y=Cf,co=33984,e2=35048,lo=34962,t2=34963,Ma=35345,_f=35718,n2=35721,r2=35971,i2=35382,o2=35396,s2=35398,a2=35392,u2=35395,fo=5126,$f=35664,e0=35665,t0=35666,Ia=5124,n0=35667,r0=35668,i0=35669,o0=35670,s0=35671,a0=35672,u0=35673,c0=35674,l0=35675,f0=35676,c2=35678,l2=35680,f2=35679,h2=35682,d2=35685,p2=35686,g2=35687,m2=35688,A2=35689,x2=35690,y2=36289,b2=36292,w2=36293,Ta=5125,h0=36294,d0=36295,p0=36296,v2=36298,C2=36299,E2=36300,S2=36303,D2=36306,B2=36307,F2=36308,M2=36311,ho=3553,po=34067,Pa=32879,go=35866,F={};function g0(t,e){return F[e].bindPoint}function I2(t,e){return function(n){t.uniform1f(e,n)}}function T2(t,e){return function(n){t.uniform1fv(e,n)}}function P2(t,e){return function(n){t.uniform2fv(e,n)}}function L2(t,e){return function(n){t.uniform3fv(e,n)}}function R2(t,e){return function(n){t.uniform4fv(e,n)}}function m0(t,e){return function(n){t.uniform1i(e,n)}}function A0(t,e){return function(n){t.uniform1iv(e,n)}}function x0(t,e){return function(n){t.uniform2iv(e,n)}}function y0(t,e){return function(n){t.uniform3iv(e,n)}}function b0(t,e){return function(n){t.uniform4iv(e,n)}}function k2(t,e){return function(n){t.uniform1ui(e,n)}}function N2(t,e){return function(n){t.uniform1uiv(e,n)}}function z2(t,e){return function(n){t.uniform2uiv(e,n)}}function O2(t,e){return function(n){t.uniform3uiv(e,n)}}function G2(t,e){return function(n){t.uniform4uiv(e,n)}}function U2(t,e){return function(n){t.uniformMatrix2fv(e,!1,n)}}function H2(t,e){return function(n){t.uniformMatrix3fv(e,!1,n)}}function Q2(t,e){return function(n){t.uniformMatrix4fv(e,!1,n)}}function j2(t,e){return function(n){t.uniformMatrix2x3fv(e,!1,n)}}function V2(t,e){return function(n){t.uniformMatrix3x2fv(e,!1,n)}}function Y2(t,e){return function(n){t.uniformMatrix2x4fv(e,!1,n)}}function W2(t,e){return function(n){t.uniformMatrix4x2fv(e,!1,n)}}function X2(t,e){return function(n){t.uniformMatrix3x4fv(e,!1,n)}}function Z2(t,e){return function(n){t.uniformMatrix4x3fv(e,!1,n)}}function de(t,e,n,r){const i=g0(t,e);return Sn(t)?function(o){let s,a;_i(t,o)?(s=o,a=null):(s=o.texture,a=o.sampler),t.uniform1i(r,n),t.activeTexture(co+n),t.bindTexture(i,s),t.bindSampler(n,a)}:function(o){t.uniform1i(r,n),t.activeTexture(co+n),t.bindTexture(i,o)}}function pe(t,e,n,r,i){const o=g0(t,e),s=new Int32Array(i);for(let a=0;a<i;++a)s[a]=n+a;return Sn(t)?function(a){t.uniform1iv(r,s),a.forEach(function(u,c){t.activeTexture(co+s[c]);let f,l;_i(t,u)?(f=u,l=null):(f=u.texture,l=u.sampler),t.bindSampler(n,l),t.bindTexture(o,f)})}:function(a){t.uniform1iv(r,s),a.forEach(function(u,c){t.activeTexture(co+s[c]),t.bindTexture(o,u)})}}F[fo]={Type:Float32Array,size:4,setter:I2,arraySetter:T2},F[$f]={Type:Float32Array,size:8,setter:P2,cols:2},F[e0]={Type:Float32Array,size:12,setter:L2,cols:3},F[t0]={Type:Float32Array,size:16,setter:R2,cols:4},F[Ia]={Type:Int32Array,size:4,setter:m0,arraySetter:A0},F[n0]={Type:Int32Array,size:8,setter:x0,cols:2},F[r0]={Type:Int32Array,size:12,setter:y0,cols:3},F[i0]={Type:Int32Array,size:16,setter:b0,cols:4},F[Ta]={Type:Uint32Array,size:4,setter:k2,arraySetter:N2},F[h0]={Type:Uint32Array,size:8,setter:z2,cols:2},F[d0]={Type:Uint32Array,size:12,setter:O2,cols:3},F[p0]={Type:Uint32Array,size:16,setter:G2,cols:4},F[o0]={Type:Uint32Array,size:4,setter:m0,arraySetter:A0},F[s0]={Type:Uint32Array,size:8,setter:x0,cols:2},F[a0]={Type:Uint32Array,size:12,setter:y0,cols:3},F[u0]={Type:Uint32Array,size:16,setter:b0,cols:4},F[c0]={Type:Float32Array,size:32,setter:U2,rows:2,cols:2},F[l0]={Type:Float32Array,size:48,setter:H2,rows:3,cols:3},F[f0]={Type:Float32Array,size:64,setter:Q2,rows:4,cols:4},F[d2]={Type:Float32Array,size:32,setter:j2,rows:2,cols:3},F[p2]={Type:Float32Array,size:32,setter:Y2,rows:2,cols:4},F[g2]={Type:Float32Array,size:48,setter:V2,rows:3,cols:2},F[m2]={Type:Float32Array,size:48,setter:X2,rows:3,cols:4},F[A2]={Type:Float32Array,size:64,setter:W2,rows:4,cols:2},F[x2]={Type:Float32Array,size:64,setter:Z2,rows:4,cols:3},F[c2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:ho},F[l2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:po},F[f2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:Pa},F[h2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:ho},F[y2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:go},F[b2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:go},F[w2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:po},F[v2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:ho},F[C2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:Pa},F[E2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:po},F[S2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:go},F[D2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:ho},F[B2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:Pa},F[F2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:po},F[M2]={Type:null,size:0,setter:de,arraySetter:pe,bindPoint:go};function mo(t,e){return function(n){if(n.value)switch(t.disableVertexAttribArray(e),n.value.length){case 4:t.vertexAttrib4fv(e,n.value);break;case 3:t.vertexAttrib3fv(e,n.value);break;case 2:t.vertexAttrib2fv(e,n.value);break;case 1:t.vertexAttrib1fv(e,n.value);break;default:throw new Error("the length of a float constant value must be between 1 and 4!")}else t.bindBuffer(lo,n.buffer),t.enableVertexAttribArray(e),t.vertexAttribPointer(e,n.numComponents||n.size,n.type||fo,n.normalize||!1,n.stride||0,n.offset||0),n.divisor!==void 0&&t.vertexAttribDivisor(e,n.divisor)}}function Dt(t,e){return function(n){if(n.value)if(t.disableVertexAttribArray(e),n.value.length===4)t.vertexAttrib4iv(e,n.value);else throw new Error("The length of an integer constant value must be 4!");else t.bindBuffer(lo,n.buffer),t.enableVertexAttribArray(e),t.vertexAttribIPointer(e,n.numComponents||n.size,n.type||Ia,n.stride||0,n.offset||0),n.divisor!==void 0&&t.vertexAttribDivisor(e,n.divisor)}}function Ao(t,e){return function(n){if(n.value)if(t.disableVertexAttribArray(e),n.value.length===4)t.vertexAttrib4uiv(e,n.value);else throw new Error("The length of an unsigned integer constant value must be 4!");else t.bindBuffer(lo,n.buffer),t.enableVertexAttribArray(e),t.vertexAttribIPointer(e,n.numComponents||n.size,n.type||Ta,n.stride||0,n.offset||0),n.divisor!==void 0&&t.vertexAttribDivisor(e,n.divisor)}}function La(t,e,n){const r=n.size,i=n.count;return function(o){t.bindBuffer(lo,o.buffer);const s=o.size||o.numComponents||r,a=s/i,u=o.type||fo,f=F[u].size*s,l=o.normalize||!1,h=o.offset||0,p=f/i;for(let d=0;d<i;++d)t.enableVertexAttribArray(e+d),t.vertexAttribPointer(e+d,a,u,l,f,h+p*d),o.divisor!==void 0&&t.vertexAttribDivisor(e+d,o.divisor)}}const q={};q[fo]={size:4,setter:mo},q[$f]={size:8,setter:mo},q[e0]={size:12,setter:mo},q[t0]={size:16,setter:mo},q[Ia]={size:4,setter:Dt},q[n0]={size:8,setter:Dt},q[r0]={size:12,setter:Dt},q[i0]={size:16,setter:Dt},q[Ta]={size:4,setter:Ao},q[h0]={size:8,setter:Ao},q[d0]={size:12,setter:Ao},q[p0]={size:16,setter:Ao},q[o0]={size:4,setter:Dt},q[s0]={size:8,setter:Dt},q[a0]={size:12,setter:Dt},q[u0]={size:16,setter:Dt},q[c0]={size:4,setter:La,count:2},q[l0]={size:9,setter:La,count:3},q[f0]={size:16,setter:La,count:4};function w0(t){const e=t.name;return e.startsWith("gl_")||e.startsWith("webgl_")}const K2=/(\.|\[|]|\w+)/g,q2=t=>t>="0"&&t<="9";function v0(t,e,n,r){const i=t.split(K2).filter(a=>a!=="");let o=0,s="";for(;;){const a=i[o++];s+=a;const u=q2(a[0]),c=u?parseInt(a):a;if(u&&(s+=i[o++]),o===i.length){n[c]=e;break}else{const l=i[o++],h=l==="[",p=n[c]||(h?[]:{});n[c]=p,n=p,r[s]=r[s]||function(d){return function(g){B0(d,g)}}(p),s+=l}}}function J2(t,e){let n=0;function r(a,u,c){const f=u.name.endsWith("[0]"),l=u.type,h=F[l];if(!h)throw new Error(`unknown type: 0x${l.toString(16)}`);let p;if(h.bindPoint){const d=n;n+=u.size,f?p=h.arraySetter(t,l,d,c,u.size):p=h.setter(t,l,d,c,u.size)}else h.arraySetter&&f?p=h.arraySetter(t,c):p=h.setter(t,c);return p.location=c,p}const i={},o={},s=t.getProgramParameter(e,_f);for(let a=0;a<s;++a){const u=t.getActiveUniform(e,a);if(w0(u))continue;let c=u.name;c.endsWith("[0]")&&(c=c.substr(0,c.length-3));const f=t.getUniformLocation(e,u.name);if(f){const l=r(e,u,f);i[c]=l,v0(c,l,o,i)}}return i}function _2(t,e){const n={},r=t.getProgramParameter(e,r2);for(let i=0;i<r;++i){const o=t.getTransformFeedbackVarying(e,i);n[o.name]={index:i,type:o.type,size:o.size}}return n}function $2(t,e){const n=t.getProgramParameter(e,_f),r=[],i=[];for(let a=0;a<n;++a){i.push(a),r.push({});const u=t.getActiveUniform(e,a);r[a].name=u.name}[["UNIFORM_TYPE","type"],["UNIFORM_SIZE","size"],["UNIFORM_BLOCK_INDEX","blockNdx"],["UNIFORM_OFFSET","offset"]].forEach(function(a){const u=a[0],c=a[1];t.getActiveUniforms(e,i,t[u]).forEach(function(f,l){r[l][c]=f})});const o={},s=t.getProgramParameter(e,i2);for(let a=0;a<s;++a){const u=t.getActiveUniformBlockName(e,a),c={index:t.getUniformBlockIndex(e,u),usedByVertexShader:t.getActiveUniformBlockParameter(e,a,o2),usedByFragmentShader:t.getActiveUniformBlockParameter(e,a,s2),size:t.getActiveUniformBlockParameter(e,a,a2),uniformIndices:t.getActiveUniformBlockParameter(e,a,u2)};c.used=c.usedByVertexShader||c.usedByFragmentShader,o[u]=c}return{blockSpecs:o,uniformData:r}}const C0=/\[\d+\]\.$/,eb=(t,e)=>((t+(e-1))/e|0)*e;function tb(t,e,n,r){if(e||n){r=r||1;const o=t.length/4;return function(s){let a=0,u=0;for(let c=0;c<o;++c){for(let f=0;f<r;++f)t[a++]=s[u++];a+=4-r}}}else return function(i){i.length?t.set(i):t[0]=i}}function nb(t,e,n,r){const i=n.blockSpecs,o=n.uniformData,s=i[r];if(!s)return $y("no uniform block object named:",r),{name:r,uniforms:{}};const a=new ArrayBuffer(s.size),u=t.createBuffer(),c=s.index;t.bindBuffer(Ma,u),t.uniformBlockBinding(e,s.index,c);let f=r+".";C0.test(f)&&(f=f.replace(C0,"."));const l={},h={},p={};return s.uniformIndices.forEach(function(d){const g=o[d];let A=g.name;A.startsWith(f)&&(A=A.substr(f.length));const m=A.endsWith("[0]");m&&(A=A.substr(0,A.length-3));const b=F[g.type],y=b.Type,w=m?eb(b.size,16)*g.size:b.size*g.size,E=new y(a,g.offset,w/y.BYTES_PER_ELEMENT);l[A]=E;const C=tb(E,m,b.rows,b.cols);h[A]=C,v0(A,C,p,h)}),{name:r,array:a,asFloat:new Float32Array(a),buffer:u,uniforms:l,setters:h}}function E0(t,e,n){return nb(t,e.program,e.uniformBlockSpec,n)}function rb(t,e,n){const i=(e.uniformBlockSpec||e).blockSpecs[n.name];if(i){const o=i.index;return t.bindBufferRange(Ma,o,n.buffer,n.offset||0,n.array.byteLength),!0}return!1}function S0(t,e,n){rb(t,e,n)&&t.bufferData(Ma,n.array,e2)}function D0(t,e){const n=t.setters;for(const r in e){const i=n[r];if(i){const o=e[r];i(o)}}}function B0(t,e){for(const n in e){const r=t[n];typeof r=="function"?r(e[n]):B0(t[n],e[n])}}function Ee(t,...e){const n=t.uniformSetters||t,r=e.length;for(let i=0;i<r;++i){const o=e[i];if(Array.isArray(o)){const s=o.length;for(let a=0;a<s;++a)Ee(n,o[a])}else for(const s in o){const a=n[s];a&&a(o[s])}}}function ib(t,e){const n={},r=t.getProgramParameter(e,n2);for(let i=0;i<r;++i){const o=t.getActiveAttrib(e,i);if(w0(o))continue;const s=t.getAttribLocation(e,o.name),a=q[o.type],u=a.setter(t,s,a);u.location=s,n[o.name]=u}return n}function ob(t,e){for(const n in e){const r=t[n];r&&r(e[n])}}function Ln(t,e,n){n.vertexArrayObject?t.bindVertexArray(n.vertexArrayObject):(ob(e.attribSetters||e,n.attribs),n.indices&&t.bindBuffer(t2,n.indices))}function sb(t,e){const n=J2(t,e),r=ib(t,e),i={program:e,uniformSetters:n,attribSetters:r};return Sn(t)&&(i.uniformBlockSpec=$2(t,e),i.transformFeedbackInfo=_2(t,e)),i}const ab=4,F0=5123;function Vr(t,e,n,r,i,o){n=n===void 0?ab:n;const s=e.indices,a=e.elementType,u=r===void 0?e.numElements:r;i=i===void 0?0:i,a||s?o!==void 0?t.drawElementsInstanced(n,u,a===void 0?F0:e.elementType,i,o):t.drawElements(n,u,a===void 0?F0:e.elementType,i):o!==void 0?t.drawArraysInstanced(n,i,u,o):t.drawArrays(n,i,u)}const ub=36160,$t=36161,cb=3553,lb=5121,fb=6402,hb=6408,db=33190,pb=36012,gb=35056,mb=36013,Ab=32854,xb=32855,yb=36194,M0=33189,I0=6401,T0=36168,Ra=34041,bb=36064,xo=36096,P0=36128,ka=33306,Na=33071,za=9729,L0=[{format:hb,type:lb,min:za,wrap:Na},{format:Ra}],Qe={};Qe[Ra]=ka,Qe[I0]=P0,Qe[T0]=P0,Qe[fb]=xo,Qe[M0]=xo,Qe[db]=xo,Qe[pb]=xo,Qe[gb]=ka,Qe[mb]=ka;function wb(t,e){return Qe[t]||Qe[e]}const Bt={};Bt[Ab]=!0,Bt[xb]=!0,Bt[yb]=!0,Bt[Ra]=!0,Bt[M0]=!0,Bt[I0]=!0,Bt[T0]=!0;function vb(t){return Bt[t]}function Cb(t,e,n,r){const i=ub,o=t.createFramebuffer();t.bindFramebuffer(i,o),n=n||t.drawingBufferWidth,r=r||t.drawingBufferHeight,e=e||L0;let s=0;const a={framebuffer:o,attachments:[],width:n,height:r};return e.forEach(function(u){let c=u.attachment;const f=u.samples,l=u.format;let h=u.attachmentPoint||wb(l,u.internalFormat);if(h||(h=bb+s++),!c)if(f!==void 0||vb(l))c=t.createRenderbuffer(),t.bindRenderbuffer($t,c),f>1?t.renderbufferStorageMultisample($t,f,l,n,r):t.renderbufferStorage($t,l,n,r);else{const p=Object.assign({},u);p.width=n,p.height=r,p.auto===void 0&&(p.auto=!1,p.min=p.min||p.minMag||za,p.mag=p.mag||p.minMag||za,p.wrapS=p.wrapS||p.wrap||Na,p.wrapT=p.wrapT||p.wrap||Na),c=jr(t,p)}if(Ef(t,c))t.framebufferRenderbuffer(i,h,$t,c);else if(_i(t,c))u.layer!==void 0?t.framebufferTextureLayer(i,h,c,u.level||0,u.layer):t.framebufferTexture2D(i,h,u.target||cb,c,u.level||0);else throw new Error("unknown attachment type");a.attachments.push(c)}),a}function Eb(t,e,n,r,i){r=r||t.drawingBufferWidth,i=i||t.drawingBufferHeight,e.width=r,e.height=i,n=n||L0,n.forEach(function(o,s){const a=e.attachments[s],u=o.format,c=o.samples;if(c!==void 0||Ef(t,a))t.bindRenderbuffer($t,a),c>1?t.renderbufferStorageMultisample($t,c,u,r,i):t.renderbufferStorage($t,u,r,i);else if(_i(t,a))_y(t,a,o,r,i);else throw new Error("unknown attachment type")})}function Sb(t,e,n){const r=t.createVertexArray();return t.bindVertexArray(r),e.length||(e=[e]),e.forEach(function(i){Ln(t,i,n)}),t.bindVertexArray(null),{numElements:n.numElements,elementType:n.elementType,vertexArrayObject:r}}const Db=/^(.*?)_/;function Bb(t,e){xa(t,0);const n=t.getExtension(e);if(n){const r={},i=Db.exec(e)[1],o="_"+i;for(const s in n){const a=n[s],u=typeof a=="function",c=u?i:o;let f=s;s.endsWith(c)&&(f=s.substring(0,s.length-c.length)),t[f]!==void 0?!u&&t[f]!==a&&Cf(f,t[f],a,s):u?t[f]=function(l){return function(){return l.apply(n,arguments)}}(a):(t[f]=a,r[f]=a)}r.constructor={name:n.constructor.name},xa(r,0)}return n}const R0=["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_color_buffer_float","EXT_color_buffer_half_float","EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2","EXT_frag_depth","EXT_sRGB","EXT_shader_texture_lod","EXT_texture_filter_anisotropic","OES_element_index_uint","OES_standard_derivatives","OES_texture_float","OES_texture_float_linear","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_color_buffer_float","WEBGL_compressed_texture_atc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_pvrtc","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_depth_texture","WEBGL_draw_buffers"];function k0(t){for(let e=0;e<R0.length;++e)Bb(t,R0[e])}function Fb(t,e){const n=["webgl2","webgl","experimental-webgl"];let r=null;for(let i=0;i<n.length;++i)if(r=t.getContext(n[i],e),r){k0(r);break}return r}function Mb(t,e){return Fb(t,e)}const Ib=`/***The vertex position wrt the rectangle specified by(x,x2,y,y2).*[0,0]=[x,y],[1,1]=[x2,y2].*The x or y component may contain fractional values if the rectangle*have been tessellated.*/in vec2 frac;uniform vec2 uMinSize;uniform float uMinOpacity;uniform vec4 uCornerRadii;out lowp vec4 vFillColor;out lowp vec4 vStrokeColor;out float vHalfStrokeWidth;out vec4 vCornerRadii;
15
15
  #if defined(ROUNDED_CORNERS) || defined(STROKED)
16
16
  out vec2 vPosInPixels;
17
17
  #endif
18
- flat out vec2 vHalfSizeInPixels;/***Clamps the minimumSize and returns an opacity that reflects the amount of clamping.*/float clampMinSize(inout float pos,float frac,float size,float minSize){if(minSize>0.0&&abs(size)<minSize){pos+=(frac-0.5)*(minSize*sign(size)-size);return abs(size)/minSize;}return 1.0;}void sort(inout float a,inout float b){if(a>b){float tmp=b;b=a;a=tmp;}}void main(void){vec2 normalizedMinSize=uMinSize/uViewportSize;float x=getScaled_x();float x2=getScaled_x2();float y=getScaled_y();float y2=getScaled_y2();sort(x,x2);sort(y,y2);float clampMargin=1.0;vec2 pos1=vec2(clamp(x,0.0-clampMargin,1.0+clampMargin),y);vec2 pos2=vec2(clamp(x2,0.0-clampMargin,1.0+clampMargin),y2);vec2 size=pos2-pos1;if(size.x<=0.0||size.y<=0.0){gl_Position=vec4(0.0,0.0,0.0,1.0);return;}vec2 pos=pos1+frac*size;size.y*=getSampleFacetHeight(pos);float opaFactor=uViewOpacity*max(uMinOpacity,clampMinSize(pos.x,frac.x,size.x,normalizedMinSize.x)*clampMinSize(pos.y,frac.y,size.y,normalizedMinSize.y));pos=applySampleFacet(pos);
18
+ out vec2 vHalfSizeInPixels;/***Clamps the minimumSize and returns an opacity that reflects the amount of clamping.*/float clampMinSize(inout float pos,float frac,float size,float minSize){if(minSize>0.0&&abs(size)<minSize){pos+=(frac-0.5)*(minSize*sign(size)-size);return abs(size)/minSize;}return 1.0;}void sort(inout float a,inout float b){if(a>b){float tmp=b;b=a;a=tmp;}}void main(void){vec2 normalizedMinSize=uMinSize/uViewportSize;float x=getScaled_x();float x2=getScaled_x2();float y=getScaled_y();float y2=getScaled_y2();sort(x,x2);sort(y,y2);float clampMargin=1.0;vec2 pos1=vec2(clamp(x,0.0-clampMargin,1.0+clampMargin),y);vec2 pos2=vec2(clamp(x2,0.0-clampMargin,1.0+clampMargin),y2);vec2 size=pos2-pos1;if(size.x<=0.0||size.y<=0.0){gl_Position=vec4(0.0,0.0,0.0,1.0);return;}vec2 pos=pos1+frac*size;size.y*=getSampleFacetHeight(pos);float opaFactor=uViewOpacity*max(uMinOpacity,clampMinSize(pos.x,frac.x,size.x,normalizedMinSize.x)*clampMinSize(pos.y,frac.y,size.y,normalizedMinSize.y));pos=applySampleFacet(pos);
19
19
  #if defined(ROUNDED_CORNERS) || defined(STROKED)
20
20
  float aaPadding=1.0/uDevicePixelRatio;float strokeWidth=getScaled_strokeWidth();float strokeOpacity=getScaled_strokeOpacity()*opaFactor;vec2 centeredFrac=frac-0.5;vec2 expand=centeredFrac*(strokeWidth+aaPadding)/uViewportSize;pos+=expand;vec2 sizeInPixels=size*uViewportSize;vPosInPixels=(centeredFrac+expand/size)*sizeInPixels;vHalfSizeInPixels=sizeInPixels/2.0;vCornerRadii=min(uCornerRadii,min(vHalfSizeInPixels.x,vHalfSizeInPixels.y));vHalfStrokeWidth=strokeWidth/2.0;vStrokeColor=vec4(getScaled_stroke()*strokeOpacity,strokeOpacity);
21
21
  #endif
22
22
  gl_Position=unitToNdc(pos);float fillOpacity=getScaled_fillOpacity()*opaFactor;vFillColor=vec4(getScaled_fill()*fillOpacity,fillOpacity);setupPicking();}`,Tb=`#if defined(ROUNDED_CORNERS) || defined(STROKED)
23
23
  in vec2 vPosInPixels;
24
24
  #endif
25
- flat in vec2 vHalfSizeInPixels;flat in lowp vec4 vFillColor;flat in lowp vec4 vStrokeColor;flat in float vHalfStrokeWidth;flat in vec4 vCornerRadii;out lowp vec4 fragColor;float sdRoundedBox(vec2 p,vec2 b,vec4 r){r.xy=p.x>0.0 ? r.xy : r.zw;r.x=p.y>0.0 ? r.x : r.y;vec2 q=abs(p)-b+r.x;return min(max(q.x,q.y),0.0)+length(max(q,0.0))-r.x;}float sdSharpBox(vec2 p,vec2 b){vec2 q=abs(p)-b;return max(q.x,q.y);}void main(void){
25
+ in vec2 vHalfSizeInPixels;in lowp vec4 vFillColor;in lowp vec4 vStrokeColor;in float vHalfStrokeWidth;in vec4 vCornerRadii;out lowp vec4 fragColor;float sdRoundedBox(vec2 p,vec2 b,vec4 r){r.xy=p.x>0.0 ? r.xy : r.zw;r.x=p.y>0.0 ? r.x : r.y;vec2 q=abs(p)-b+r.x;return min(max(q.x,q.y),0.0)+length(max(q,0.0))-r.x;}float sdSharpBox(vec2 p,vec2 b){vec2 q=abs(p)-b;return max(q.x,q.y);}void main(void){
26
26
  #if defined(ROUNDED_CORNERS) || defined(STROKED)
27
27
  #ifdef ROUNDED_CORNERS
28
28
  float d=sdRoundedBox(vPosInPixels,vHalfSizeInPixels,vCornerRadii);
@@ -63,13 +63,13 @@ SampleFacetPosition getSampleFacetPos(){return SampleFacetPosition(0.0,1.0,0.0,1
63
63
  #elif defined(SAMPLE_FACET_TEXTURE)
64
64
  uniform sampler2D uSampleFacetTexture;SampleFacetPosition getSampleFacetPos(){vec4 texel=texelFetch(uSampleFacetTexture,ivec2(int(attr_facetIndex),0),0);return SampleFacetPosition(1.0-texel.r-texel.g,texel.g,1.0-texel.r-texel.g,texel.g);}
65
65
  #endif
66
- bool isFacetedSamples(SampleFacetPosition facetPos){return facetPos!=SampleFacetPosition(0.0,1.0,0.0,1.0);}bool isFacetedSamples(){return isFacetedSamples(getSampleFacetPos());}bool isInTransit(){return uTransitionOffset>0.0;}float getTransitionFraction(float xPos){return smoothstep(0.0,0.7+uTransitionOffset,(xPos-uTransitionOffset)*2.0);}vec2 applySampleFacet(vec2 pos){SampleFacetPosition facetPos=getSampleFacetPos();if(!isFacetedSamples(facetPos)){return pos;}else if(isInTransit()){vec2 interpolated=mix(vec2(facetPos.pos,facetPos.height),vec2(facetPos.targetPos,facetPos.targetHeight),getTransitionFraction(pos.x));return vec2(pos.x,interpolated[0]+pos.y*interpolated[1]);}else{return vec2(pos.x,facetPos.pos+pos.y*facetPos.height);}}float getSampleFacetHeight(vec2 pos){SampleFacetPosition facetPos=getSampleFacetPos();if(!isFacetedSamples(facetPos)){return 1.0;}else if(isInTransit()){return mix(facetPos.height,facetPos.targetHeight,getTransitionFraction(pos.x));}else{return facetPos.height;}}`,qb=`/**Based on concepts presented at:*https:*https:*/flat out highp vec4 vPickingColor;/***Passes the unique id to the fragment shader as a color if picking is enabled.*Returns true if picking is enabled.*/bool setupPicking(){if(uPickingEnabled){
66
+ bool isFacetedSamples(SampleFacetPosition facetPos){return facetPos!=SampleFacetPosition(0.0,1.0,0.0,1.0);}bool isFacetedSamples(){return isFacetedSamples(getSampleFacetPos());}bool isInTransit(){return uTransitionOffset>0.0;}float getTransitionFraction(float xPos){return smoothstep(0.0,0.7+uTransitionOffset,(xPos-uTransitionOffset)*2.0);}vec2 applySampleFacet(vec2 pos){SampleFacetPosition facetPos=getSampleFacetPos();if(!isFacetedSamples(facetPos)){return pos;}else if(isInTransit()){vec2 interpolated=mix(vec2(facetPos.pos,facetPos.height),vec2(facetPos.targetPos,facetPos.targetHeight),getTransitionFraction(pos.x));return vec2(pos.x,interpolated[0]+pos.y*interpolated[1]);}else{return vec2(pos.x,facetPos.pos+pos.y*facetPos.height);}}float getSampleFacetHeight(vec2 pos){SampleFacetPosition facetPos=getSampleFacetPos();if(!isFacetedSamples(facetPos)){return 1.0;}else if(isInTransit()){return mix(facetPos.height,facetPos.targetHeight,getTransitionFraction(pos.x));}else{return facetPos.height;}}`,qb=`/**Based on concepts presented at:*https:*https:*/out highp vec4 vPickingColor;/***Passes the unique id to the fragment shader as a color if picking is enabled.*Returns true if picking is enabled.*/bool setupPicking(){if(uPickingEnabled){
67
67
  #ifdef uniqueId_DEFINED
68
68
  int id=int(getScaled_uniqueId());vPickingColor=vec4(ivec4(id>>0,id>>8,id>>16,0xFF)&0xFF)/float(0xFF);
69
69
  #else
70
70
  vPickingColor=vec4(1.0);
71
71
  #endif
72
- return true;}return false;}`,Jb="flat in highp vec4 vPickingColor;",bo=Symbol("cacheMap");function kn(t,e,n){let r=Wr(t).get(e);return r===void 0&&(r=n(e),Wr(t).set(e,r)),r}function j0(t,e){Wr(t).delete(e)}function wo(t,e){const n=Wr(t);for(const r of n.keys())r.startsWith(e)&&n.delete(r);Wr(t).delete(e)}function V0(t){t[bo]=new Map}function Wr(t){return t[bo]||V0(t),t[bo]}function _b(t,e,n,r){const i=Z(t)?t:t.name,o=!Z(t)&&t.extent||[0,1];if(n===void 0&&!Z(t)&&(n=t.count),i){const s=qs(i);if(ge(s)){const a=W0(s,{extent:o,count:n});return vo(e,{minMag:e.LINEAR,format:e.RGB,height:1,wrap:e.CLAMP_TO_EDGE},a,r)}else{if(Me(s))return Y0(s,e);throw new Error("Unknown scheme: "+i)}}}function $b(t,e="rgb",n,r){const i=ji(t,Z(e)?e:e.type,Z(e)?void 0:e.gamma),o=W0(i);return vo(n,{minMag:n.LINEAR,format:n.RGB,height:1,wrap:n.CLAMP_TO_EDGE},o,r)}function ew(t,e,n,r){const i=Math.max(t.length,n||0),o=new Float32Array(i);for(let s=0;s<i;s++)o[s]=t[s%t.length];return vo(e,{minMag:e.NEAREST,format:e.RED,internalFormat:e.R32F,height:1},o,r)}function Y0(t,e,n,r){const i=X0(t,n);return vo(e,{minMag:e.NEAREST,format:e.RGB,height:1},i,r)}function W0(t,{extent:e=[0,1],reverse:n=!1,count:r=256}={}){const i=e[0],o=Cn(e)-i,s=Kn(r).map(a=>a/(r-1)).map(a=>i+a/o).map(t);return n&&s.reverse(),X0(s)}function X0(t,e){const n=Math.max(t.length,e||0),r=new Uint8Array(n*3);for(let i=0;i<n;i++){const o=Ht(t[i%t.length]).rgb();r[i*3+0]=o.r,r[i*3+1]=o.g,r[i*3+2]=o.b}return r}class tw{constructor(e,n){this._container=e,this._sizeSource=n,this._shaderCache=new Map,this._listeners=[],this.rangeTextures=new WeakMap;const r=document.createElement("canvas");e.appendChild(r);const i=Mb(r,{antialias:!0,depth:!1,premultipliedAlpha:!0});if(!i)throw new Error("Unable to initialize WebGL. Your browser or machine may not support it.");if(!Sn(i))throw new Error("Your web browser does not support WebGL 2.0. Chrome, Firefox, and Safari Tech Preview should work.");k0(i),i.blendFunc(i.ONE,i.ONE_MINUS_SRC_ALPHA),this.canvas=r,this.gl=i,this._pickingAttachmentOptions=[{format:i.RGBA,type:i.UNSIGNED_BYTE,minMag:i.LINEAR,wrap:i.CLAMP_TO_EDGE}],this._pickingBufferInfo=Cb(i,this._pickingAttachmentOptions),i.bindFramebuffer(i.FRAMEBUFFER,null),this.adjustGl(),this._resizeObserver=new ResizeObserver(o=>{this.invalidateSize(),this._emit("resize")}),this._resizeObserver.observe(this._container),this._updateDpr()}invalidateSize(){this._logicalCanvasSize=void 0,this._updateDpr(),this.adjustGl()}_updateDpr(){this.dpr=window.devicePixelRatio}compileShader(e,n){const r="#version 300 es",i="precision mediump float;";Me(n)&&(n=n.join(`
72
+ return true;}return false;}`,Jb="in highp vec4 vPickingColor;",bo=Symbol("cacheMap");function kn(t,e,n){let r=Wr(t).get(e);return r===void 0&&(r=n(e),Wr(t).set(e,r)),r}function j0(t,e){Wr(t).delete(e)}function wo(t,e){const n=Wr(t);for(const r of n.keys())r.startsWith(e)&&n.delete(r);Wr(t).delete(e)}function V0(t){t[bo]=new Map}function Wr(t){return t[bo]||V0(t),t[bo]}function _b(t,e,n,r){const i=Z(t)?t:t.name,o=!Z(t)&&t.extent||[0,1];if(n===void 0&&!Z(t)&&(n=t.count),i){const s=qs(i);if(ge(s)){const a=W0(s,{extent:o,count:n});return vo(e,{minMag:e.LINEAR,format:e.RGB,height:1,wrap:e.CLAMP_TO_EDGE},a,r)}else{if(Me(s))return Y0(s,e);throw new Error("Unknown scheme: "+i)}}}function $b(t,e="rgb",n,r){const i=ji(t,Z(e)?e:e.type,Z(e)?void 0:e.gamma),o=W0(i);return vo(n,{minMag:n.LINEAR,format:n.RGB,height:1,wrap:n.CLAMP_TO_EDGE},o,r)}function ew(t,e,n,r){const i=Math.max(t.length,n||0),o=new Float32Array(i);for(let s=0;s<i;s++)o[s]=t[s%t.length];return vo(e,{minMag:e.NEAREST,format:e.RED,internalFormat:e.R32F,height:1},o,r)}function Y0(t,e,n,r){const i=X0(t,n);return vo(e,{minMag:e.NEAREST,format:e.RGB,height:1},i,r)}function W0(t,{extent:e=[0,1],reverse:n=!1,count:r=256}={}){const i=e[0],o=Cn(e)-i,s=Kn(r).map(a=>a/(r-1)).map(a=>i+a/o).map(t);return n&&s.reverse(),X0(s)}function X0(t,e){const n=Math.max(t.length,e||0),r=new Uint8Array(n*3);for(let i=0;i<n;i++){const o=Ht(t[i%t.length]).rgb();r[i*3+0]=o.r,r[i*3+1]=o.g,r[i*3+2]=o.b}return r}class tw{constructor(e,n){this._container=e,this._sizeSource=n,this._shaderCache=new Map,this._listeners=[],this.rangeTextures=new WeakMap;const r=document.createElement("canvas");e.appendChild(r);const i=Mb(r,{antialias:!0,depth:!1,premultipliedAlpha:!0});if(!i)throw new Error("Unable to initialize WebGL. Your browser or machine may not support it.");if(!Sn(i))throw new Error("Your web browser does not support WebGL 2.0. Chrome, Firefox, and Safari Tech Preview should work.");k0(i),i.blendFunc(i.ONE,i.ONE_MINUS_SRC_ALPHA),this.canvas=r,this.gl=i,this._pickingAttachmentOptions=[{format:i.RGBA,type:i.UNSIGNED_BYTE,minMag:i.LINEAR,wrap:i.CLAMP_TO_EDGE}],this._pickingBufferInfo=Cb(i,this._pickingAttachmentOptions),i.bindFramebuffer(i.FRAMEBUFFER,null),this.adjustGl(),this._resizeObserver=new ResizeObserver(o=>{this.invalidateSize(),this._emit("resize")}),this._resizeObserver.observe(this._container),this._updateDpr()}invalidateSize(){this._logicalCanvasSize=void 0,this._updateDpr(),this.adjustGl()}_updateDpr(){this.dpr=window.devicePixelRatio}compileShader(e,n){const r="#version 300 es",i="precision mediump float;";Me(n)&&(n=n.join(`
73
73
 
74
74
  `));const o=this.gl,s=n.replaceAll(/ {2,}|^\s*\/\/.*$/gm,"");let a=this._shaderCache.get(s);if(!a){const u=[r,i,n].join(`
75
75
 
@@ -83,16 +83,16 @@ Error compiling: ${o}`,t.deleteShader(u));t.deleteProgram(r)}if(o)return{message
83
83
  `).join("")+`};
84
84
 
85
85
  `:"",c=[`precision highp float;
86
- `,...r,Q0,Zb,a,...o,Kb,qb,e],f=[...r,Q0,Jb,n],l=this.gl;this.programStatus=rw(l,this.glHelper.compileShader(l.VERTEX_SHADER,c),this.glHelper.compileShader(l.FRAGMENT_SHADER,f))}finalizeGraphicsInitialization(){const e=this.programStatus.getProgramErrors();if(e){e.detail&&console.warn(e.detail);const n=new Error("Cannot create shader program: "+e.message);throw n.view=this.unitView,n}this.programInfo=sb(this.gl,this.programStatus.program),delete this.programStatus,this.domainUniforms.length&&(this.domainUniformInfo=E0(this.gl,this.programInfo,"Domains")),this.viewUniformInfo=E0(this.gl,this.programInfo,"View"),this.gl.useProgram(this.programInfo.program),this._setDatums(),Ee(this.programInfo,{uSampleFacet:[0,1,0,1],uTransitionOffset:0})}_setDatums(){for(const[e,n]of Object.entries(this.encoding))if(Rr(n)){const r=this.encoders[e],i=r.indexer?r.indexer(n.datum):yo(r.scale.type)?Ha(+n.datum):+n.datum;Ee(this.programInfo,{[Oa+e]:i})}}deleteGraphicsData(){if(this.bufferInfo){const e=this.gl;for(let n=0;n<8;n++)e.disableVertexAttribArray(n);Object.values(this.bufferInfo.attribs).forEach(n=>this.gl.deleteBuffer(n.buffer)),this.bufferInfo.indices&&this.gl.deleteBuffer(this.bufferInfo.indices),this.bufferInfo=void 0}}updateBufferInfo(e){if(this.gl.bindVertexArray(null),this.bufferInfo&&e.vertexCount<=this.bufferInfo.allocatedVertices)for(const[n,r]of Object.entries(e.arrays))r.data&&xx(this.gl,this.bufferInfo.attribs[n],r.data,0);else this.deleteGraphicsData(),this.bufferInfo=wx(this.gl,e.arrays,{numElements:e.vertexCount}),this.bufferInfo.allocatedVertices=e.allocatedVertices,this.vertexArrayInfo=void 0}get glHelper(){return this.getContext().glHelper}get gl(){return this.glHelper.gl}onBeforeSampleAnimation(){}onAfterSampleAnimation(){}isReady(){return this.bufferInfo&&this.programInfo}isPickingParticipant(){if(this.properties.tooltip===null)return!1;for(const e of this.unitView.getAncestors())if(!e.isPickingSupported())return!1;return!0}prepareRender(e){var s;const n=this.glHelper,r=this.gl,i=[];if(i.push(()=>{this.vertexArrayInfo||(this.vertexArrayInfo=Sb(this.gl,this.programInfo,this.bufferInfo)),r.useProgram(this.programInfo.program)}),this.domainUniformInfo){for(const[a,u]of Object.entries(this.domainUniformInfo.setters)){const c=a.substring(N0.length),f=this.encoding[c],l=Le(f)&&f.resolutionChannel||c,h=this.unitView.getScaleResolution(l);if(h){const p=h.getScale();i.push(()=>{const d=Wt(p.type)?[0,p.domain().length]:p.domain();u(yo(p.type)?Ob(d):d)})}}i.push(()=>S0(r,this.programInfo,this.domainUniformInfo))}for(const[a,u]of Object.entries(this.encoding))if(Le(u)){const c=Le(u)&&u.resolutionChannel||a,f=this.unitView.getScaleResolution(c),l=n.rangeTextures.get(f);l&&i.push(()=>Ee(this.programInfo,{[Ga+a]:l}))}this.getSampleFacetMode()==Z0&&i.push(()=>{let a;for(const u of this.unitView.getAncestors())if(a=u.getSampleFacetTexture(),a)break;if(!a)throw new Error("No facet texture available. This is bug.");Ee(this.programInfo,{uSampleFacetTexture:a})});const o=((s=e.picking)!=null?s:!1)&&this.isPickingParticipant();return i.push(()=>D0(this.viewUniformInfo,{uViewOpacity:this.unitView.getEffectiveOpacity(),uPickingEnabled:o})),this.opaque||e.picking?i.push(()=>r.disable(r.BLEND)):i.push(()=>r.enable(r.BLEND)),i}prepareSampleFacetRendering(e){const n=e.sampleFacetRenderingOptions,r=this.programInfo.uniformSetters.uSampleFacet;if(n&&r){const i=n.locSize?n.locSize.location:0,o=n.locSize?n.locSize.size:1;if(i>1||i+o<0)return!1;const s=n.targetLocSize?n.targetLocSize.location:i,a=n.targetLocSize?n.targetLocSize.size:o;this.gl.uniform4f(r.location,i,o,s,a)}return!0}render(e){}createRenderCallback(e,n){var f;const r=this;let i;const o=(f=this.unitView.getScaleResolution("x"))==null?void 0:f.getScale(),s=o&&Pe(o.type),a=["index","locus"].includes(o==null?void 0:o.type)?-1:0,u=[0,0];i=l=>{if(s&&l.xIndex){const h=o.domain(),p=l.xIndex(h[0]+a,h[1],u),d=p[0],g=p[1]-d;g>0&&e(d,g)}else e(l.offset,l.count)};const c=this.rangeMap.get(n.facetId);return n.sampleFacetRenderingOptions?function(){c.count&&r.prepareSampleFacetRendering(n)&&i(c)}:function(){c.count&&i(c)}}setViewport(e,n){const r=this.glHelper.dpr,i=this.gl,o=this.properties,s=this.glHelper.getLogicalCanvasSize(),a=.5,u=(o.xOffset||0)+a,c=(o.yOffset||0)+a;let f,l=e;if(o.clip||n){let h=0,p=0,d;n?(l=o.clip?e.intersect(n):n,d=[e.width/l.width,e.height/l.height],p=Math.max(0,e.y2-n.y2),h=Math.max(0,e.x2-n.x2)):d=[1,1];const g=[e.x,s.height-l.y2,Math.max(0,l.width),Math.max(0,l.height)].map(y=>y*r),A=g.map(y=>Math.floor(y)),[m,b]=g.map((y,w)=>y-A[w]);i.viewport(...A),i.scissor(...A),i.enable(i.SCISSOR_TEST),f={uViewOffset:[(u+h+m)/l.width,-(c+p-b)/l.height],uViewScale:d}}else i.viewport(0,0,s.width*r,s.height*r),i.disable(i.SCISSOR_TEST),f={uViewOffset:[(e.x+u)/s.width,(s.height-e.y-c-e.height)/s.height],uViewScale:[e.width/s.width,e.height/s.height]};return D0(this.viewUniformInfo,{...f,uViewportSize:[e.width,e.height],uDevicePixelRatio:this.glHelper.dpr}),S0(this.gl,this.programInfo,this.viewUniformInfo),l.height>0&&l.width>0}findDatumAt(e,n){}}class aw extends Pt{constructor(){super([],JSON.stringify)}get(e){let n=super.get(e);return n===void 0&&(n={offset:0,count:0,xIndex:void 0},super.set(e,n)),n}migrateEntries(e){for(const[n,r]of e.entries())Object.assign(this.get(n),r)}}function Va(t,e){var o;const n=G1(e);let r=t[e]&&{...t[e]},i=t[n]&&{...t[n]};if(!(Ue(r)||Ue(i))){if(r){if(!Le(t[e]))return;if(i){if(r.type!="quantitative"){const s=(1-(r.band||1))/2;r.band=s,i.band=-s}}else if(r.type=="quantitative")i={datum:0};else{i={...r};const s=(1-((o=r.band)!=null?o:1))/2;r.band=0+s,i.band=1-s}}else r={value:0},i={value:1};t[e]=r,t[n]=i}}function K0(t,e){t.stroke||(e?t.stroke={value:null}:t.stroke={resolutionChannel:"color",...t.color}),Ue(t.stroke)&&t.stroke.value===null&&(t.strokeWidth={value:0}),t.strokeOpacity||(t.strokeOpacity={resolutionChannel:"opacity",...t.opacity})}function q0(t,e){Ue(t.fill)&&t.fill.value===null?t.fillOpacity={value:0}:t.fill||(t.fill={resolutionChannel:"color",...t.color},!e&&!t.fillOpacity&&(t.fillOpacity={value:0})),t.fillOpacity||(e?t.fillOpacity={resolutionChannel:"opacity",...t.opacity}:t.fillOpacity={value:0})}class uw extends Xr{constructor(e){super(e),Object.defineProperties(this.defaultProperties,Object.getOwnPropertyDescriptors({x2:void 0,y2:void 0,filled:!0,color:"#4c78a8",opacity:1,strokeWidth:3,cornerRadius:0,minWidth:.5,minHeight:.5,minOpacity:1,tessellationZoomThreshold:10,tessellationTiles:35}))}getAttributes(){return["uniqueId","facetIndex","x","x2","y","y2","fill","stroke","fillOpacity","strokeOpacity","strokeWidth"]}getSupportedChannels(){return[...super.getSupportedChannels(),"x2","y2","fill","stroke","fillOpacity","strokeOpacity","strokeWidth"]}get opaque(){return kn(this,"opaque",()=>!this._isRoundedCorners()&&!this._isStroked()&&Ue(this.encoding.fillOpacity)&&this.encoding.fillOpacity.value==1&&this.properties.minOpacity==1)&&this.unitView.getEffectiveOpacity()==1}fixEncoding(e){return Va(e,"x"),Va(e,"y"),K0(e,this.properties.filled),q0(e,this.properties.filled),delete e.color,delete e.opacity,e}onBeforeSampleAnimation(){}onAfterSampleAnimation(){}_isRoundedCorners(){return["","TopLeft","TopRight","BottomLeft","BottomRight"].map(e=>"cornerRadius"+e).some(e=>this.properties[e]>0)}_isStroked(){const e=this.encoding.strokeWidth;return!(Ue(e)&&!e.value)}async initializeGraphics(){await super.initializeGraphics();const e=[];this._isRoundedCorners()&&e.push("ROUNDED_CORNERS"),this._isStroked()&&e.push("STROKED"),this.createAndLinkShaders(Ib,Tb,e.map(n=>"#define "+n))}finalizeGraphicsInitialization(){var n,r,i,o;super.finalizeGraphicsInitialization(),this.gl.useProgram(this.programInfo.program);const e=this.properties;Ee(this.programInfo,{uMinSize:[e.minWidth,e.minHeight],uMinOpacity:e.minOpacity,uCornerRadii:[(n=e.cornerRadiusTopRight)!=null?n:e.cornerRadius,(r=e.cornerRadiusBottomRight)!=null?r:e.cornerRadius,(i=e.cornerRadiusTopLeft)!=null?i:e.cornerRadius,(o=e.cornerRadiusBottomLeft)!=null?o:e.cornerRadius]})}updateGraphicsData(){const e=this.unitView.getCollector(),n=e.getItemCount(),r=new jb({encoders:this.encoders,attributes:this.getAttributes(),numItems:n});r.addBatches(e.facetBatches);const i=r.toArrays();this.rangeMap.migrateEntries(i.rangeMap),this.updateBufferInfo(i)}prepareRender(e){const n=super.prepareRender(e);return n.push(()=>Ln(this.gl,this.programInfo,this.vertexArrayInfo)),n}render(e){const n=this.gl;return this.createRenderCallback((r,i)=>{Vr(n,this.vertexArrayInfo,n.TRIANGLE_STRIP,i,r)},e)}findDatumAt(e,n){e=Ke(e);const r=this.encoders,i=this.unitView.getCollector().facetBatches.get(e),o=r.x.accessor,s=r.x2.accessor;if(i)return i.find(a=>n>=o(a)&&n<s(a))}}const cw=`/***The stroke should only grow inwards,e.g,the diameter/outline is not affected by the stroke width.*Thus,a point that has a zero size has no visible stroke. This allows strokes to be used with*geometric zoom,etc.*/uniform bool uInwardStroke;uniform lowp float uMaxRelativePointDiameter;uniform float uScaleFactor;uniform float uMaxPointSize;uniform float uZoomLevel;uniform float uSemanticThreshold;flat out float vRadius;flat out float vRadiusWithPadding;flat out lowp vec4 vFillColor;flat out lowp vec4 vStrokeColor;flat out lowp float vShape;flat out lowp float vHalfStrokeWidth;flat out mat2 vRotationMatrix;float computeSemanticThresholdFactor(){return getScaled_semanticScore()>=uSemanticThreshold ? 1.0 : 0.0;}/***Computes a scaling factor for the points in a sample-faceted view.*/float getDownscaleFactor(vec2 pos){if(!isFacetedSamples()){return 1.0;}float sampleFacetHeight=getSampleFacetHeight(pos);float maxPointDiameter=sqrt(uMaxPointSize);float factor=sampleFacetHeight*uViewportSize.y*uMaxRelativePointDiameter;return clamp(0.0,maxPointDiameter,factor)/maxPointDiameter;}vec2 getDxDy(){
86
+ `,...r,Q0,Zb,a,...o,Kb,qb,e],f=[...r,Q0,Jb,n],l=this.gl;this.programStatus=rw(l,this.glHelper.compileShader(l.VERTEX_SHADER,c),this.glHelper.compileShader(l.FRAGMENT_SHADER,f))}finalizeGraphicsInitialization(){const e=this.programStatus.getProgramErrors();if(e){e.detail&&console.warn(e.detail);const n=new Error("Cannot create shader program: "+e.message);throw n.view=this.unitView,n}this.programInfo=sb(this.gl,this.programStatus.program),delete this.programStatus,this.domainUniforms.length&&(this.domainUniformInfo=E0(this.gl,this.programInfo,"Domains")),this.viewUniformInfo=E0(this.gl,this.programInfo,"View"),this.gl.useProgram(this.programInfo.program),this._setDatums(),Ee(this.programInfo,{uSampleFacet:[0,1,0,1],uTransitionOffset:0})}_setDatums(){for(const[e,n]of Object.entries(this.encoding))if(Rr(n)){const r=this.encoders[e],i=r.indexer?r.indexer(n.datum):yo(r.scale.type)?Ha(+n.datum):+n.datum;Ee(this.programInfo,{[Oa+e]:i})}}deleteGraphicsData(){if(this.bufferInfo){const e=this.gl;for(let n=0;n<8;n++)e.disableVertexAttribArray(n);Object.values(this.bufferInfo.attribs).forEach(n=>this.gl.deleteBuffer(n.buffer)),this.bufferInfo.indices&&this.gl.deleteBuffer(this.bufferInfo.indices),this.bufferInfo=void 0}}updateBufferInfo(e){if(this.gl.bindVertexArray(null),this.bufferInfo&&e.vertexCount<=this.bufferInfo.allocatedVertices)for(const[n,r]of Object.entries(e.arrays))r.data&&xx(this.gl,this.bufferInfo.attribs[n],r.data,0);else this.deleteGraphicsData(),this.bufferInfo=wx(this.gl,e.arrays,{numElements:e.vertexCount}),this.bufferInfo.allocatedVertices=e.allocatedVertices,this.vertexArrayInfo=void 0}get glHelper(){return this.getContext().glHelper}get gl(){return this.glHelper.gl}onBeforeSampleAnimation(){}onAfterSampleAnimation(){}isReady(){return this.bufferInfo&&this.programInfo}isPickingParticipant(){if(this.properties.tooltip===null)return!1;for(const e of this.unitView.getAncestors())if(!e.isPickingSupported())return!1;return!0}prepareRender(e){var s;const n=this.glHelper,r=this.gl,i=[];if(i.push(()=>{this.vertexArrayInfo||(this.vertexArrayInfo=Sb(this.gl,this.programInfo,this.bufferInfo)),r.useProgram(this.programInfo.program)}),this.domainUniformInfo){for(const[a,u]of Object.entries(this.domainUniformInfo.setters)){const c=a.substring(N0.length),f=this.encoding[c],l=Le(f)&&f.resolutionChannel||c,h=this.unitView.getScaleResolution(l);if(h){const p=h.getScale();i.push(()=>{const d=Wt(p.type)?[0,p.domain().length]:p.domain();u(yo(p.type)?Ob(d):d)})}}i.push(()=>S0(r,this.programInfo,this.domainUniformInfo))}for(const[a,u]of Object.entries(this.encoding))if(Le(u)){const c=Le(u)&&u.resolutionChannel||a,f=this.unitView.getScaleResolution(c),l=n.rangeTextures.get(f);l&&i.push(()=>Ee(this.programInfo,{[Ga+a]:l}))}this.getSampleFacetMode()==Z0&&i.push(()=>{let a;for(const u of this.unitView.getAncestors())if(a=u.getSampleFacetTexture(),a)break;if(!a)throw new Error("No facet texture available. This is bug.");Ee(this.programInfo,{uSampleFacetTexture:a})});const o=((s=e.picking)!=null?s:!1)&&this.isPickingParticipant();return i.push(()=>D0(this.viewUniformInfo,{uViewOpacity:this.unitView.getEffectiveOpacity(),uPickingEnabled:o})),this.opaque||e.picking?i.push(()=>r.disable(r.BLEND)):i.push(()=>r.enable(r.BLEND)),i}prepareSampleFacetRendering(e){const n=e.sampleFacetRenderingOptions,r=this.programInfo.uniformSetters.uSampleFacet;if(n&&r){const i=n.locSize?n.locSize.location:0,o=n.locSize?n.locSize.size:1;if(i>1||i+o<0)return!1;const s=n.targetLocSize?n.targetLocSize.location:i,a=n.targetLocSize?n.targetLocSize.size:o;this.gl.uniform4f(r.location,i,o,s,a)}return!0}render(e){}createRenderCallback(e,n){var f;const r=this;let i;const o=(f=this.unitView.getScaleResolution("x"))==null?void 0:f.getScale(),s=o&&Pe(o.type),a=["index","locus"].includes(o==null?void 0:o.type)?-1:0,u=[0,0];i=l=>{if(s&&l.xIndex){const h=o.domain(),p=l.xIndex(h[0]+a,h[1],u),d=p[0],g=p[1]-d;g>0&&e(d,g)}else e(l.offset,l.count)};const c=this.rangeMap.get(n.facetId);return n.sampleFacetRenderingOptions?function(){c.count&&r.prepareSampleFacetRendering(n)&&i(c)}:function(){c.count&&i(c)}}setViewport(e,n){const r=this.glHelper.dpr,i=this.gl,o=this.properties,s=this.glHelper.getLogicalCanvasSize(),a=.5,u=(o.xOffset||0)+a,c=(o.yOffset||0)+a;let f,l=e;if(o.clip||n){let h=0,p=0,d;n?(l=o.clip?e.intersect(n):n,d=[e.width/l.width,e.height/l.height],p=Math.max(0,e.y2-n.y2),h=Math.max(0,e.x2-n.x2)):d=[1,1];const g=[e.x,s.height-l.y2,Math.max(0,l.width),Math.max(0,l.height)].map(y=>y*r),A=g.map(y=>Math.floor(y)),[m,b]=g.map((y,w)=>y-A[w]);i.viewport(...A),i.scissor(...A),i.enable(i.SCISSOR_TEST),f={uViewOffset:[(u+h+m)/l.width,-(c+p-b)/l.height],uViewScale:d}}else i.viewport(0,0,s.width*r,s.height*r),i.disable(i.SCISSOR_TEST),f={uViewOffset:[(e.x+u)/s.width,(s.height-e.y-c-e.height)/s.height],uViewScale:[e.width/s.width,e.height/s.height]};return D0(this.viewUniformInfo,{...f,uViewportSize:[e.width,e.height],uDevicePixelRatio:this.glHelper.dpr}),S0(this.gl,this.programInfo,this.viewUniformInfo),l.height>0&&l.width>0}findDatumAt(e,n){}}class aw extends Pt{constructor(){super([],JSON.stringify)}get(e){let n=super.get(e);return n===void 0&&(n={offset:0,count:0,xIndex:void 0},super.set(e,n)),n}migrateEntries(e){for(const[n,r]of e.entries())Object.assign(this.get(n),r)}}function Va(t,e){var o;const n=G1(e);let r=t[e]&&{...t[e]},i=t[n]&&{...t[n]};if(!(Ue(r)||Ue(i))){if(r){if(!Le(t[e]))return;if(i){if(r.type!="quantitative"){const s=(1-(r.band||1))/2;r.band=s,i.band=-s}}else if(r.type=="quantitative")i={datum:0};else{i={...r};const s=(1-((o=r.band)!=null?o:1))/2;r.band=0+s,i.band=1-s}}else r={value:0},i={value:1};t[e]=r,t[n]=i}}function K0(t,e){t.stroke||(e?t.stroke={value:null}:t.stroke={resolutionChannel:"color",...t.color}),Ue(t.stroke)&&t.stroke.value===null&&(t.strokeWidth={value:0}),t.strokeOpacity||(t.strokeOpacity={resolutionChannel:"opacity",...t.opacity})}function q0(t,e){Ue(t.fill)&&t.fill.value===null?t.fillOpacity={value:0}:t.fill||(t.fill={resolutionChannel:"color",...t.color},!e&&!t.fillOpacity&&(t.fillOpacity={value:0})),t.fillOpacity||(e?t.fillOpacity={resolutionChannel:"opacity",...t.opacity}:t.fillOpacity={value:0})}class uw extends Xr{constructor(e){super(e),Object.defineProperties(this.defaultProperties,Object.getOwnPropertyDescriptors({x2:void 0,y2:void 0,filled:!0,color:"#4c78a8",opacity:1,strokeWidth:3,cornerRadius:0,minWidth:.5,minHeight:.5,minOpacity:1,tessellationZoomThreshold:10,tessellationTiles:35}))}getAttributes(){return["uniqueId","facetIndex","x","x2","y","y2","fill","stroke","fillOpacity","strokeOpacity","strokeWidth"]}getSupportedChannels(){return[...super.getSupportedChannels(),"x2","y2","fill","stroke","fillOpacity","strokeOpacity","strokeWidth"]}get opaque(){return kn(this,"opaque",()=>!this._isRoundedCorners()&&!this._isStroked()&&Ue(this.encoding.fillOpacity)&&this.encoding.fillOpacity.value==1&&this.properties.minOpacity==1)&&this.unitView.getEffectiveOpacity()==1}fixEncoding(e){return Va(e,"x"),Va(e,"y"),K0(e,this.properties.filled),q0(e,this.properties.filled),delete e.color,delete e.opacity,e}onBeforeSampleAnimation(){}onAfterSampleAnimation(){}_isRoundedCorners(){return["","TopLeft","TopRight","BottomLeft","BottomRight"].map(e=>"cornerRadius"+e).some(e=>this.properties[e]>0)}_isStroked(){const e=this.encoding.strokeWidth;return!(Ue(e)&&!e.value)}async initializeGraphics(){await super.initializeGraphics();const e=[];this._isRoundedCorners()&&e.push("ROUNDED_CORNERS"),this._isStroked()&&e.push("STROKED"),this.createAndLinkShaders(Ib,Tb,e.map(n=>"#define "+n))}finalizeGraphicsInitialization(){var n,r,i,o;super.finalizeGraphicsInitialization(),this.gl.useProgram(this.programInfo.program);const e=this.properties;Ee(this.programInfo,{uMinSize:[e.minWidth,e.minHeight],uMinOpacity:e.minOpacity,uCornerRadii:[(n=e.cornerRadiusTopRight)!=null?n:e.cornerRadius,(r=e.cornerRadiusBottomRight)!=null?r:e.cornerRadius,(i=e.cornerRadiusTopLeft)!=null?i:e.cornerRadius,(o=e.cornerRadiusBottomLeft)!=null?o:e.cornerRadius]})}updateGraphicsData(){const e=this.unitView.getCollector(),n=e.getItemCount(),r=new jb({encoders:this.encoders,attributes:this.getAttributes(),numItems:n});r.addBatches(e.facetBatches);const i=r.toArrays();this.rangeMap.migrateEntries(i.rangeMap),this.updateBufferInfo(i)}prepareRender(e){const n=super.prepareRender(e);return n.push(()=>Ln(this.gl,this.programInfo,this.vertexArrayInfo)),n}render(e){const n=this.gl;return this.createRenderCallback((r,i)=>{Vr(n,this.vertexArrayInfo,n.TRIANGLE_STRIP,i,r)},e)}findDatumAt(e,n){e=Ke(e);const r=this.encoders,i=this.unitView.getCollector().facetBatches.get(e),o=r.x.accessor,s=r.x2.accessor;if(i)return i.find(a=>n>=o(a)&&n<s(a))}}const cw=`/***The stroke should only grow inwards,e.g,the diameter/outline is not affected by the stroke width.*Thus,a point that has a zero size has no visible stroke. This allows strokes to be used with*geometric zoom,etc.*/uniform bool uInwardStroke;uniform lowp float uMaxRelativePointDiameter;uniform float uScaleFactor;uniform float uMaxPointSize;uniform float uZoomLevel;uniform float uSemanticThreshold;out float vRadius;out float vRadiusWithPadding;out lowp vec4 vFillColor;out lowp vec4 vStrokeColor;out lowp float vShape;out lowp float vHalfStrokeWidth;out mat2 vRotationMatrix;float computeSemanticThresholdFactor(){return getScaled_semanticScore()>=uSemanticThreshold ? 1.0 : 0.0;}/***Computes a scaling factor for the points in a sample-faceted view.*/float getDownscaleFactor(vec2 pos){if(!isFacetedSamples()){return 1.0;}float sampleFacetHeight=getSampleFacetHeight(pos);float maxPointDiameter=sqrt(uMaxPointSize);float factor=sampleFacetHeight*uViewportSize.y*uMaxRelativePointDiameter;return clamp(0.0,maxPointDiameter,factor)/maxPointDiameter;}vec2 getDxDy(){
87
87
  #if defined(dx_DEFINED) || defined(dy_DEFINED)
88
88
  return vec2(getScaled_dx(),getScaled_dy())/uViewportSize;
89
89
  #else
90
90
  return vec2(0.0,0.0);
91
91
  #endif
92
- }void main(void){float semanticThresholdFactor=computeSemanticThresholdFactor();if(semanticThresholdFactor<=0.0){gl_PointSize=0.0;gl_Position=vec4(100.0,0.0,0.0,0.0);return;}float size=getScaled_size();vec2 pos=vec2(getScaled_x(),getScaled_y())+getDxDy();gl_Position=unitToNdc(applySampleFacet(pos));float strokeWidth=getScaled_strokeWidth();float diameter=sqrt(size)*uScaleFactor*semanticThresholdFactor*getDownscaleFactor(pos);float opacity=uViewOpacity;if(strokeWidth<=0.0||uInwardStroke){float minDiameter=1.0/uDevicePixelRatio;if(diameter<minDiameter){opacity*=pow(diameter/minDiameter,2.5);diameter=minDiameter;}}float fillOpa=getScaled_fillOpacity()*opacity;float strokeOpa=getScaled_strokeOpacity()*opacity;vShape=getScaled_shape();bool circle=vShape==0.0;float angleInDegrees=getScaled_angle();float angle=-angleInDegrees*PI/180.0;float sinTheta=sin(angle);float cosTheta=cos(angle);vRotationMatrix=mat2(cosTheta,sinTheta,-sinTheta,cosTheta);float roomForRotation=circle ? 1.0 : sin(mod(angle,PI/2.0)+PI/4.0)/sin(PI/4.0);float aaPadding=1.0/uDevicePixelRatio;float rotationPadding=(diameter*roomForRotation)-diameter;float strokePadding=uInwardStroke ? 0.0 : strokeWidth*(circle ? 1.0 : sqrt(3.0));float padding=rotationPadding+strokePadding+aaPadding;gl_PointSize=(diameter+padding)*uDevicePixelRatio;vRadius=diameter/2.0;vRadiusWithPadding=vRadius+padding/2.0;vHalfStrokeWidth=strokeWidth/2.0;vFillColor=vec4(getScaled_fill()*fillOpa,fillOpa);vStrokeColor=vec4(getScaled_stroke()*strokeOpa,strokeOpa);setupPicking();}`,lw="const lowp vec4 white=vec4(1.0);const lowp vec4 black=vec4(0.0,0.0,0.0,1.0);uniform bool uInwardStroke;uniform float uGradientStrength;flat in float vRadius;flat in float vRadiusWithPadding;flat in lowp vec4 vFillColor;flat in lowp vec4 vStrokeColor;flat in lowp float vShape;flat in lowp float vHalfStrokeWidth;flat in mat2 vRotationMatrix;out lowp vec4 fragColor;const float CIRCLE=0.0;const float SQUARE=1.0;const float TRIANGLE_UP=2.0;const float CROSS=3.0;const float DIAMOND=4.0;const float TRIANGLE_DOWN=5.0;const float TRIANGLE_RIGHT=6.0;const float TRIANGLE_LEFT=7.0;float circle(vec2 p,float r){return length(p)-r;}float square(vec2 p,float r){p=abs(p);return max(p.x,p.y)-r;}float equilateralTriangle(vec2 p,float r,bool flip,bool swap){if(swap){p.xy=p.yx;}if(flip){p.y=-p.y;}float k=sqrt(3.0);float kr=k*r;p.y-=kr/2.0;return max((abs(p.x)*k+p.y)/2.0,-p.y-kr);}float crossShape(vec2 p,float r){p=abs(p);vec2 b=vec2(0.4,1.0)*r;vec2 v=abs(p)-b.xy;vec2 h=abs(p)-b.yx;return min(max(v.x,v.y),max(h.x,h.y));}float diamond(vec2 p,float r){p=abs(p);return(max(abs(p.x-p.y),abs(p.x+p.y))-r)/sqrt(2.0);}void main(){float d;vec2 p=vRotationMatrix*(2.0*gl_PointCoord-1.0)*vRadiusWithPadding;float r=vRadius;if(vShape==CIRCLE){d=circle(p,r);}else if(vShape==SQUARE){d=square(p,r);}else if(vShape==TRIANGLE_UP){d=equilateralTriangle(p,r,true,false);}else if(vShape==CROSS){d=crossShape(p,r);}else if(vShape==DIAMOND){d=diamond(p,r);}else if(vShape==TRIANGLE_DOWN){d=equilateralTriangle(p,r,false,false);}else if(vShape==TRIANGLE_RIGHT){d=equilateralTriangle(p,r,false,true);}else if(vShape==TRIANGLE_LEFT){d=equilateralTriangle(p,r,true,true);}else{d=0.0;}if(!uPickingEnabled){lowp vec4 fillColor=mix(vFillColor,white,-d*uGradientStrength/vRadius);fragColor=distanceToColor(d+(uInwardStroke ? vHalfStrokeWidth : 0.0),fillColor,vStrokeColor,vHalfStrokeWidth);}else if(d-vHalfStrokeWidth<=0.0){fragColor=vPickingColor;}else{discard;}}",ut=1<<0,Ft=1<<1,fw={};class J{get behavior(){return 0}constructor(){this.children=[],this.parent=void 0,this.completed=!1}reset(){this.completed=!1;for(const e of this.children)e.reset()}initialize(){}_updatePropagator(){this._propagate=Function("children",Kn(this.children.length).map(e=>`const child${e} = children[${e}];`).join(`
92
+ }void main(void){float semanticThresholdFactor=computeSemanticThresholdFactor();if(semanticThresholdFactor<=0.0){gl_PointSize=0.0;gl_Position=vec4(100.0,0.0,0.0,0.0);return;}float size=getScaled_size();vec2 pos=vec2(getScaled_x(),getScaled_y())+getDxDy();gl_Position=unitToNdc(applySampleFacet(pos));float strokeWidth=getScaled_strokeWidth();float diameter=sqrt(size)*uScaleFactor*semanticThresholdFactor*getDownscaleFactor(pos);float opacity=uViewOpacity;if(strokeWidth<=0.0||uInwardStroke){float minDiameter=1.0/uDevicePixelRatio;if(diameter<minDiameter){opacity*=pow(diameter/minDiameter,2.5);diameter=minDiameter;}}float fillOpa=getScaled_fillOpacity()*opacity;float strokeOpa=getScaled_strokeOpacity()*opacity;vShape=getScaled_shape();bool circle=vShape==0.0;float angleInDegrees=getScaled_angle();float angle=-angleInDegrees*PI/180.0;float sinTheta=sin(angle);float cosTheta=cos(angle);vRotationMatrix=mat2(cosTheta,sinTheta,-sinTheta,cosTheta);float roomForRotation=circle ? 1.0 : sin(mod(angle,PI/2.0)+PI/4.0)/sin(PI/4.0);float aaPadding=1.0/uDevicePixelRatio;float rotationPadding=(diameter*roomForRotation)-diameter;float strokePadding=uInwardStroke ? 0.0 : strokeWidth*(circle ? 1.0 : sqrt(3.0));float padding=rotationPadding+strokePadding+aaPadding;gl_PointSize=(diameter+padding)*uDevicePixelRatio;vRadius=diameter/2.0;vRadiusWithPadding=vRadius+padding/2.0;vHalfStrokeWidth=strokeWidth/2.0;vFillColor=vec4(getScaled_fill()*fillOpa,fillOpa);vStrokeColor=vec4(getScaled_stroke()*strokeOpa,strokeOpa);setupPicking();}`,lw="const lowp vec4 white=vec4(1.0);const lowp vec4 black=vec4(0.0,0.0,0.0,1.0);uniform bool uInwardStroke;uniform float uGradientStrength;in float vRadius;in float vRadiusWithPadding;in lowp vec4 vFillColor;in lowp vec4 vStrokeColor;in lowp float vShape;in lowp float vHalfStrokeWidth;in mat2 vRotationMatrix;out lowp vec4 fragColor;const float CIRCLE=0.0;const float SQUARE=1.0;const float TRIANGLE_UP=2.0;const float CROSS=3.0;const float DIAMOND=4.0;const float TRIANGLE_DOWN=5.0;const float TRIANGLE_RIGHT=6.0;const float TRIANGLE_LEFT=7.0;float circle(vec2 p,float r){return length(p)-r;}float square(vec2 p,float r){p=abs(p);return max(p.x,p.y)-r;}float equilateralTriangle(vec2 p,float r,bool flip,bool swap){if(swap){p.xy=p.yx;}if(flip){p.y=-p.y;}float k=sqrt(3.0);float kr=k*r;p.y-=kr/2.0;return max((abs(p.x)*k+p.y)/2.0,-p.y-kr);}float crossShape(vec2 p,float r){p=abs(p);vec2 b=vec2(0.4,1.0)*r;vec2 v=abs(p)-b.xy;vec2 h=abs(p)-b.yx;return min(max(v.x,v.y),max(h.x,h.y));}float diamond(vec2 p,float r){p=abs(p);return(max(abs(p.x-p.y),abs(p.x+p.y))-r)/sqrt(2.0);}void main(){float d;vec2 p=vRotationMatrix*(2.0*gl_PointCoord-1.0)*vRadiusWithPadding;float r=vRadius;if(vShape==CIRCLE){d=circle(p,r);}else if(vShape==SQUARE){d=square(p,r);}else if(vShape==TRIANGLE_UP){d=equilateralTriangle(p,r,true,false);}else if(vShape==CROSS){d=crossShape(p,r);}else if(vShape==DIAMOND){d=diamond(p,r);}else if(vShape==TRIANGLE_DOWN){d=equilateralTriangle(p,r,false,false);}else if(vShape==TRIANGLE_RIGHT){d=equilateralTriangle(p,r,false,true);}else if(vShape==TRIANGLE_LEFT){d=equilateralTriangle(p,r,true,true);}else{d=0.0;}if(!uPickingEnabled){lowp vec4 fillColor=mix(vFillColor,white,-d*uGradientStrength/vRadius);fragColor=distanceToColor(d+(uInwardStroke ? vHalfStrokeWidth : 0.0),fillColor,vStrokeColor,vHalfStrokeWidth);}else if(d-vHalfStrokeWidth<=0.0){fragColor=vPickingColor;}else{discard;}}",ut=1<<0,Ft=1<<1,fw={};class J{get behavior(){return 0}constructor(){this.children=[],this.parent=void 0,this.completed=!1}reset(){this.completed=!1;for(const e of this.children)e.reset()}initialize(){}_updatePropagator(){this._propagate=Function("children",Kn(this.children.length).map(e=>`const child${e} = children[${e}];`).join(`
93
93
  `)+`return function propagate(datum) {${Kn(this.children.length).map(e=>`child${e}.handle(datum);`).join(`
94
94
  `)}}`)(this.children)}setParent(e){this.parent=e}addChild(e){if(e.parent)throw new Error("Cannot add the child! It already has a parent.");return this.children.push(e),e.setParent(this),this._updatePropagator(),this}adopt(e){e.parent&&e.parent.removeChild(e),this.addChild(e)}adoptChildrenOf(e){for(const n of e.children)this.adopt(n)}insertAsParent(e){if(this.isRoot())throw new Error("Cannot insert a new parent for a root node!");e.parent=this.parent,this.parent.children[this.parent.children.indexOf(this)]=e,this.parent._updatePropagator(),this.parent=void 0,e.addChild(this)}removeChild(e){const n=this.children.indexOf(e);if(n>-1)this.children.splice(n,1),e.parent=void 0,this._updatePropagator();else throw new Error("Trying to remove an unknown child node!")}excise(){if(this.isRoot())throw new Error("Cannot excise root node!");if(this.isTerminal())this.parent.removeChild(this);else if(this.children.length==1){const e=this.children[0];e.setParent(this.parent),this.parent.children[this.parent.children.indexOf(this)]=e,this.parent._updatePropagator(),this.setParent(void 0),this.children.length=0}else throw new Error("Cannot excise a node that has multiple children!")}isRoot(){return!this.parent}isBranching(){return this.children.length>1}isTerminal(){return this.children.length==0}visit(e){e(this);for(const n of this.children)n.visit(e);e.afterChildren&&e.afterChildren(this)}subtreeToString(e=0){var r;const n=this.children.map(i=>i.subtreeToString(e+1)).join("");return" ".repeat(e*2)+"* "+((r=/^class ([A-Za-z0-9_]+)/.exec(""+this.constructor))==null?void 0:r[1])+`
95
- `+n}getGlobalObject(){return this.parent?this.parent.getGlobalObject():fw}handle(e){this._propagate(e)}complete(){this.completed=!0;for(const e of this.children)e.complete()}beginBatch(e){for(const n of this.children)n.beginBatch(e)}_propagate(e){}}function J0(t){return t.type=="file"}function hw(t){return t.type=="facet"}class _0 extends J{constructor(e){super(),this.k=e.size||500,this.reset()}reset(){super.reset(),this.reservoir=[],this.W=void 0,this.ingester=this._initialIngester}_initialIngester(e){this.reservoir.push(e),this.reservoir.length==this.k&&(this.W=Math.exp(Math.log(Math.random())/this.k),this.i=this.k,this.next=this.i,this.ingester=this._finalIngester,this._setNextStop())}_finalIngester(e){++this.i==this.next&&(this.reservoir[Math.floor(Math.random()*this.k)]=e,this.W*=Math.exp(Math.log(Math.random())/this.k),this._setNextStop())}_setNextStop(){this.next+=Math.floor(Math.log(Math.random())/Math.log(1-this.W))+1}handle(e){this.ingester(e)}complete(){for(const e of this.reservoir)this._propagate(e);super.complete()}}function dw(t,e,n){const r=new _0({type:"sample",size:t});for(const i of e)r.handle(n(i));return r.complete(),r.reservoir}const pw={};class gw extends Xr{constructor(e){super(e),Object.defineProperties(this.defaultProperties,Object.getOwnPropertyDescriptors({x:.5,y:.5,color:"#4c78a8",filled:!0,opacity:1,size:100,semanticScore:0,shape:"circle",strokeWidth:2,fillGradientStrength:0,dx:0,dy:0,angle:0,sampleFacetPadding:.1,semanticZoomFraction:.02}))}getAttributes(){return["inwardStroke","uniqueId","facetIndex","x","y","size","semanticScore","shape","strokeWidth","gradientStrength","dx","dy","fill","stroke","fillOpacity","strokeOpacity","angle"]}getSupportedChannels(){return[...super.getSupportedChannels(),"size","semanticScore","shape","strokeWidth","dx","dy","fill","stroke","fillOpacity","strokeOpacity","angle"]}getDefaultEncoding(){return{...super.getDefaultEncoding(),...pw}}fixEncoding(e){return K0(e,this.properties.filled),q0(e,this.properties.filled),delete e.color,delete e.opacity,e}initializeData(){super.initializeData();const e=this.unitView.getAccessor("semanticScore");e&&(this.sampledSemanticScores=Float32Array.from(dw(1e4,this.unitView.getCollector().getData(),e)),this.sampledSemanticScores.sort((n,r)=>n-r))}async initializeGraphics(){await super.initializeGraphics(),this.createAndLinkShaders(cw,lw)}finalizeGraphicsInitialization(){super.finalizeGraphicsInitialization(),this.gl.useProgram(this.programInfo.program);const e=this.properties;Ee(this.programInfo,{uInwardStroke:e.inwardStroke,uGradientStrength:e.fillGradientStrength,uMaxRelativePointDiameter:1-2*e.sampleFacetPadding})}updateGraphicsData(){const e=this.unitView.getCollector(),n=e.getItemCount(),r=new Yb({encoders:this.encoders,attributes:this.getAttributes(),numItems:Math.max(n,this.properties.minBufferSize||0)});r.addBatches(e.facetBatches);const i=r.toArrays();this.rangeMap.migrateEntries(i.rangeMap),this.updateBufferInfo(i)}_getGeometricScaleFactor(){const e=Math.pow(2,this.properties.geometricZoomBound||0);return Math.pow(Math.min(1,this.unitView.getZoomLevel()/e),1/3)}_getMaxPointSize(){const e=this.encoders.size;return e.constant?e(null):e.scale.range().reduce((n,r)=>Math.max(n,r))}getSemanticThreshold(){if(this.sampledSemanticScores){const e=Math.max(0,1-this.properties.semanticZoomFraction*this.unitView.getZoomLevel());if(e<=0)return-1/0;if(e>=1)return 1/0;{const n=this.sampledSemanticScores;return Tu(n,e)}}else return-1}prepareRender(e){const n=super.prepareRender(e);return n.push(()=>Ee(this.programInfo,{uMaxPointSize:this._getMaxPointSize(),uScaleFactor:this._getGeometricScaleFactor(),uSemanticThreshold:this.getSemanticThreshold()})),n.push(()=>Ln(this.gl,this.programInfo,this.vertexArrayInfo)),n}render(e){const n=this.gl;return this.createRenderCallback((r,i)=>{i&&Vr(n,this.vertexArrayInfo,n.POINTS,i,r)},e)}}const mw="const int BUTT=0;const int SQUARE=1;const int ROUND=2;in float pos;in float side;uniform float uMinLength;uniform mediump float uDashTextureSize;uniform lowp int uStrokeCap;flat out vec4 vColor;flat out float vSize;out float vNormalLengthInPixels;out highp vec2 vPosInPixels;void main(void){float pixelSize=1.0/uDevicePixelRatio;float size=getScaled_size();float opacity=getScaled_opacity()*uViewOpacity;if(size<pixelSize){opacity*=size/pixelSize;size=pixelSize;}vec2 a=applySampleFacet(vec2(getScaled_x(),getScaled_y()));vec2 b=applySampleFacet(vec2(getScaled_x2(),getScaled_y2()));vec2 tangent=b-a;float offset=0.0;float relativeDiff=0.0;if(uMinLength>0.0||uStrokeCap!=BUTT){float len=length(tangent*uViewportSize);float diff=max(0.0,uMinLength-len);if(uStrokeCap!=BUTT){diff+=size;}relativeDiff=diff/len;offset=relativeDiff*(pos-0.5);}vec2 p=pos<1.0? a+tangent*(pos+offset): b+tangent*offset;float aaPadding=pixelSize;vec2 normal=normalize(vec2(-tangent.y,tangent.x)/uViewportSize);p+=normal*side*(size+aaPadding)/uViewportSize;gl_Position=unitToNdc(p);vColor=vec4(getScaled_color()*opacity,opacity);vSize=size;vNormalLengthInPixels=side*(size+aaPadding);vPosInPixels=vec2(pos,(1.0-pos))*(1.0+relativeDiff)*length(tangent*uViewportSize)-vec2(uStrokeCap!=BUTT ? size/2.0 : 0.0);setupPicking();}",Aw="const int BUTT=0;const int SQUARE=1;const int ROUND=2;uniform sampler2D uDashTexture;uniform float uDashTextureSize;uniform float uStrokeDashOffset;uniform lowp int uStrokeCap;flat in vec4 vColor;flat in float vSize;in vec2 vPosInPixels;in float vNormalLengthInPixels;out lowp vec4 fragColor;void main(void){float dpr=uDevicePixelRatio;float distanceFromEnd=-min(vPosInPixels[0],vPosInPixels[1]);float distance;if(distanceFromEnd>0.0&&uStrokeCap==ROUND){distance=length(vec2(distanceFromEnd,vNormalLengthInPixels));}else{distance=abs(vNormalLengthInPixels);}float opacity=clamp(((vSize/2.0-distance)*dpr),-0.5,0.5)+0.5;if(uDashTextureSize>0.0){float pos=(vPosInPixels[0]+uStrokeDashOffset)*dpr;float floored=floor(pos);vec2 texelPositions=(floored+vec2(0.5,1.5))/dpr/uDashTextureSize;opacity*=mix(texture(uDashTexture,vec2(texelPositions[0],0)).r,texture(uDashTexture,vec2(texelPositions[1],0)).r,clamp((pos-floored),0.0,1.0));}fragColor=vColor*opacity;if(uPickingEnabled){fragColor=vPickingColor;}}";class xw extends Xr{constructor(e){super(e),this.dashTextureSize=0,Object.defineProperties(this.defaultProperties,Object.getOwnPropertyDescriptors({x2:void 0,y2:void 0,size:1,color:"black",opacity:1,minLength:0,strokeDash:null,strokeDashOffset:0,strokeCap:"butt"}))}getAttributes(){return["uniqueId","facetIndex","x","x2","y","y2","size","color","opacity"]}getSupportedChannels(){return[...super.getSupportedChannels(),"x2","y2","size"]}fixEncoding(e){if(!(e.x&&e.y&&e.x2&&e.y2))if(e.x&&e.x2&&!e.y)e.y={value:.5},e.y2=e.y;else if(e.y&&e.y2&&!e.x)e.x={value:.5},e.x2=e.x;else if(e.x&&!e.y)e.y={value:0},e.y2={value:1},e.x2=e.x;else if(e.y&&!e.x)e.x={value:0},e.x2={value:1},e.y2=e.y;else if(e.x&&e.y&&e.y2)e.x2=e.x;else if(e.y&&e.x&&e.x2)e.y2=e.y;else if(e.y&&e.x)if(!e.x2&&Le(e.y)&&e.y.type=="quantitative")e.x2=e.x,e.y2={datum:0};else if(!e.y2&&Le(e.x)&&e.x.type=="quantitative")e.y2=e.y,e.x2={datum:0};else throw new Error("A bug!");else throw new Error("Invalid x and y encodings for rule mark: "+JSON.stringify(e));return e}async initializeGraphics(){if(await super.initializeGraphics(),this.properties.strokeDash){const e=this.gl,n=yw(this.properties.strokeDash);this.dashTexture=jr(e,{mag:e.NEAREST,min:e.NEAREST,internalFormat:e.R8,format:e.RED,src:n,height:1}),this.dashTextureSize=n.length}this.createAndLinkShaders(mw,Aw)}finalizeGraphicsInitialization(){super.finalizeGraphicsInitialization(),this.gl.useProgram(this.programInfo.program);const e=this.properties;Ee(this.programInfo,{uMinLength:e.minLength,uDashTextureSize:this.dashTextureSize,uStrokeCap:["butt","square","round"].indexOf(e.strokeCap)})}updateGraphicsData(){const e=this.unitView.getCollector(),n=e.getItemCount(),r=new Vb({encoders:this.encoders,attributes:this.getAttributes(),numItems:Math.max(n,this.properties.minBufferSize||0)});r.addBatches(e.facetBatches);const i=r.toArrays();this.rangeMap.migrateEntries(i.rangeMap),this.updateBufferInfo(i)}prepareRender(e){const n=super.prepareRender(e);return this.dashTexture&&n.push(()=>Ee(this.programInfo,{uDashTexture:this.dashTexture,uStrokeDashOffset:this.properties.strokeDashOffset})),n.push(()=>Ln(this.gl,this.programInfo,this.vertexArrayInfo)),n}render(e){const n=this.gl;return this.createRenderCallback((r,i)=>Vr(n,this.vertexArrayInfo,n.TRIANGLE_STRIP,i,r),e)}}function yw(t){if(t.length==0||t.length%2||t.findIndex(o=>Math.round(o)!=o||o<1||o>1e3)>=0)throw new Error("Invalid stroke dash pattern: "+JSON.stringify(t));const e=t.reduce((o,s)=>o+s),n=new Uint8Array(e);let r=!0,i=0;for(let o of t){for(;o;)n[i++]=r&&255||0,o--;r=!r}return n}const bw=`uniform float uSagittaScaleFactor;uniform float uMinSagittaLength;in vec2 strip;out vec4 vColor;out float vSize;out float vNormalLengthInPixels;void main(void){float pixelSize=1.0/uDevicePixelRatio;float opacity=getScaled_opacity()*uViewOpacity;vec2 a=vec2(getScaled_x(),getScaled_y())*uViewportSize;vec2 b=vec2(getScaled_x2(),getScaled_y2())*uViewportSize;vec2 chordVector=b-a;vec2 unitChordVector=normalize(chordVector);vec2 chordNormal=vec2(-unitChordVector.y,unitChordVector.x);float sagitta=max(length(chordVector)/2.0*uSagittaScaleFactor,uMinSagittaLength);bool compress=false;if(compress){float maxSagittaLen=length(chordNormal*uViewportSize);float maxChordLen=length(unitChordVector*uViewportSize);float threshold=maxSagittaLen*0.5;if(sagitta>threshold){float m=(maxSagittaLen-threshold)/(maxChordLen-threshold);sagitta=(sagitta-threshold)*m+threshold;}}vec2 controlOffset=chordNormal*sagitta/0.75;vec2 p1=a;vec2 p2=a+controlOffset;vec2 p3=b+controlOffset;vec2 p4=b;float t=smoothstep(0.0,1.0,strip.x);vec2 C1=p4-3.0*p3+3.0*p2-p1;vec2 C2=3.0*p3-6.0*p2+3.0*p1;vec2 C3=3.0*p2-3.0*p1;vec2 C4=p1;vec2 p;if(t==0.0){p=p1;}else if(t==1.0){p=p4;}else{p=C1*t*t*t+C2*t*t+C3*t+C4;}vec2 tangent=normalize(3.0*C1*t*t+2.0*C2*t+C3);vec2 normal=vec2(-tangent.y,tangent.x);
95
+ `+n}getGlobalObject(){return this.parent?this.parent.getGlobalObject():fw}handle(e){this._propagate(e)}complete(){this.completed=!0;for(const e of this.children)e.complete()}beginBatch(e){for(const n of this.children)n.beginBatch(e)}_propagate(e){}}function J0(t){return t.type=="file"}function hw(t){return t.type=="facet"}class _0 extends J{constructor(e){super(),this.k=e.size||500,this.reset()}reset(){super.reset(),this.reservoir=[],this.W=void 0,this.ingester=this._initialIngester}_initialIngester(e){this.reservoir.push(e),this.reservoir.length==this.k&&(this.W=Math.exp(Math.log(Math.random())/this.k),this.i=this.k,this.next=this.i,this.ingester=this._finalIngester,this._setNextStop())}_finalIngester(e){++this.i==this.next&&(this.reservoir[Math.floor(Math.random()*this.k)]=e,this.W*=Math.exp(Math.log(Math.random())/this.k),this._setNextStop())}_setNextStop(){this.next+=Math.floor(Math.log(Math.random())/Math.log(1-this.W))+1}handle(e){this.ingester(e)}complete(){for(const e of this.reservoir)this._propagate(e);super.complete()}}function dw(t,e,n){const r=new _0({type:"sample",size:t});for(const i of e)r.handle(n(i));return r.complete(),r.reservoir}const pw={};class gw extends Xr{constructor(e){super(e),Object.defineProperties(this.defaultProperties,Object.getOwnPropertyDescriptors({x:.5,y:.5,color:"#4c78a8",filled:!0,opacity:1,size:100,semanticScore:0,shape:"circle",strokeWidth:2,fillGradientStrength:0,dx:0,dy:0,angle:0,sampleFacetPadding:.1,semanticZoomFraction:.02}))}getAttributes(){return["inwardStroke","uniqueId","facetIndex","x","y","size","semanticScore","shape","strokeWidth","gradientStrength","dx","dy","fill","stroke","fillOpacity","strokeOpacity","angle"]}getSupportedChannels(){return[...super.getSupportedChannels(),"size","semanticScore","shape","strokeWidth","dx","dy","fill","stroke","fillOpacity","strokeOpacity","angle"]}getDefaultEncoding(){return{...super.getDefaultEncoding(),...pw}}fixEncoding(e){return K0(e,this.properties.filled),q0(e,this.properties.filled),delete e.color,delete e.opacity,e}initializeData(){super.initializeData();const e=this.unitView.getAccessor("semanticScore");e&&(this.sampledSemanticScores=Float32Array.from(dw(1e4,this.unitView.getCollector().getData(),e)),this.sampledSemanticScores.sort((n,r)=>n-r))}async initializeGraphics(){await super.initializeGraphics(),this.createAndLinkShaders(cw,lw)}finalizeGraphicsInitialization(){super.finalizeGraphicsInitialization(),this.gl.useProgram(this.programInfo.program);const e=this.properties;Ee(this.programInfo,{uInwardStroke:e.inwardStroke,uGradientStrength:e.fillGradientStrength,uMaxRelativePointDiameter:1-2*e.sampleFacetPadding})}updateGraphicsData(){const e=this.unitView.getCollector(),n=e.getItemCount(),r=new Yb({encoders:this.encoders,attributes:this.getAttributes(),numItems:Math.max(n,this.properties.minBufferSize||0)});r.addBatches(e.facetBatches);const i=r.toArrays();this.rangeMap.migrateEntries(i.rangeMap),this.updateBufferInfo(i)}_getGeometricScaleFactor(){const e=Math.pow(2,this.properties.geometricZoomBound||0);return Math.pow(Math.min(1,this.unitView.getZoomLevel()/e),1/3)}_getMaxPointSize(){const e=this.encoders.size;return e.constant?e(null):e.scale.range().reduce((n,r)=>Math.max(n,r))}getSemanticThreshold(){if(this.sampledSemanticScores){const e=Math.max(0,1-this.properties.semanticZoomFraction*this.unitView.getZoomLevel());if(e<=0)return-1/0;if(e>=1)return 1/0;{const n=this.sampledSemanticScores;return Tu(n,e)}}else return-1}prepareRender(e){const n=super.prepareRender(e);return n.push(()=>Ee(this.programInfo,{uMaxPointSize:this._getMaxPointSize(),uScaleFactor:this._getGeometricScaleFactor(),uSemanticThreshold:this.getSemanticThreshold()})),n.push(()=>Ln(this.gl,this.programInfo,this.vertexArrayInfo)),n}render(e){const n=this.gl;return this.createRenderCallback((r,i)=>{i&&Vr(n,this.vertexArrayInfo,n.POINTS,i,r)},e)}}const mw="const int BUTT=0;const int SQUARE=1;const int ROUND=2;in float pos;in float side;uniform float uMinLength;uniform mediump float uDashTextureSize;uniform lowp int uStrokeCap;out vec4 vColor;out float vSize;out float vNormalLengthInPixels;out highp vec2 vPosInPixels;void main(void){float pixelSize=1.0/uDevicePixelRatio;float size=getScaled_size();float opacity=getScaled_opacity()*uViewOpacity;if(size<pixelSize){opacity*=size/pixelSize;size=pixelSize;}vec2 a=applySampleFacet(vec2(getScaled_x(),getScaled_y()));vec2 b=applySampleFacet(vec2(getScaled_x2(),getScaled_y2()));vec2 tangent=b-a;float offset=0.0;float relativeDiff=0.0;if(uMinLength>0.0||uStrokeCap!=BUTT){float len=length(tangent*uViewportSize);float diff=max(0.0,uMinLength-len);if(uStrokeCap!=BUTT){diff+=size;}relativeDiff=diff/len;offset=relativeDiff*(pos-0.5);}vec2 p=pos<1.0? a+tangent*(pos+offset): b+tangent*offset;float aaPadding=pixelSize;vec2 normal=normalize(vec2(-tangent.y,tangent.x)/uViewportSize);p+=normal*side*(size+aaPadding)/uViewportSize;gl_Position=unitToNdc(p);vColor=vec4(getScaled_color()*opacity,opacity);vSize=size;vNormalLengthInPixels=side*(size+aaPadding);vPosInPixels=vec2(pos,(1.0-pos))*(1.0+relativeDiff)*length(tangent*uViewportSize)-vec2(uStrokeCap!=BUTT ? size/2.0 : 0.0);setupPicking();}",Aw="const int BUTT=0;const int SQUARE=1;const int ROUND=2;uniform sampler2D uDashTexture;uniform float uDashTextureSize;uniform float uStrokeDashOffset;uniform lowp int uStrokeCap;in vec4 vColor;in float vSize;in vec2 vPosInPixels;in float vNormalLengthInPixels;out lowp vec4 fragColor;void main(void){float dpr=uDevicePixelRatio;float distanceFromEnd=-min(vPosInPixels[0],vPosInPixels[1]);float distance;if(distanceFromEnd>0.0&&uStrokeCap==ROUND){distance=length(vec2(distanceFromEnd,vNormalLengthInPixels));}else{distance=abs(vNormalLengthInPixels);}float opacity=clamp(((vSize/2.0-distance)*dpr),-0.5,0.5)+0.5;if(uDashTextureSize>0.0){float pos=(vPosInPixels[0]+uStrokeDashOffset)*dpr;float floored=floor(pos);vec2 texelPositions=(floored+vec2(0.5,1.5))/dpr/uDashTextureSize;opacity*=mix(texture(uDashTexture,vec2(texelPositions[0],0)).r,texture(uDashTexture,vec2(texelPositions[1],0)).r,clamp((pos-floored),0.0,1.0));}fragColor=vColor*opacity;if(uPickingEnabled){fragColor=vPickingColor;}}";class xw extends Xr{constructor(e){super(e),this.dashTextureSize=0,Object.defineProperties(this.defaultProperties,Object.getOwnPropertyDescriptors({x2:void 0,y2:void 0,size:1,color:"black",opacity:1,minLength:0,strokeDash:null,strokeDashOffset:0,strokeCap:"butt"}))}getAttributes(){return["uniqueId","facetIndex","x","x2","y","y2","size","color","opacity"]}getSupportedChannels(){return[...super.getSupportedChannels(),"x2","y2","size"]}fixEncoding(e){if(!(e.x&&e.y&&e.x2&&e.y2))if(e.x&&e.x2&&!e.y)e.y={value:.5},e.y2=e.y;else if(e.y&&e.y2&&!e.x)e.x={value:.5},e.x2=e.x;else if(e.x&&!e.y)e.y={value:0},e.y2={value:1},e.x2=e.x;else if(e.y&&!e.x)e.x={value:0},e.x2={value:1},e.y2=e.y;else if(e.x&&e.y&&e.y2)e.x2=e.x;else if(e.y&&e.x&&e.x2)e.y2=e.y;else if(e.y&&e.x)if(!e.x2&&Le(e.y)&&e.y.type=="quantitative")e.x2=e.x,e.y2={datum:0};else if(!e.y2&&Le(e.x)&&e.x.type=="quantitative")e.y2=e.y,e.x2={datum:0};else throw new Error("A bug!");else throw new Error("Invalid x and y encodings for rule mark: "+JSON.stringify(e));return e}async initializeGraphics(){if(await super.initializeGraphics(),this.properties.strokeDash){const e=this.gl,n=yw(this.properties.strokeDash);this.dashTexture=jr(e,{mag:e.NEAREST,min:e.NEAREST,internalFormat:e.R8,format:e.RED,src:n,height:1}),this.dashTextureSize=n.length}this.createAndLinkShaders(mw,Aw)}finalizeGraphicsInitialization(){super.finalizeGraphicsInitialization(),this.gl.useProgram(this.programInfo.program);const e=this.properties;Ee(this.programInfo,{uMinLength:e.minLength,uDashTextureSize:this.dashTextureSize,uStrokeCap:["butt","square","round"].indexOf(e.strokeCap)})}updateGraphicsData(){const e=this.unitView.getCollector(),n=e.getItemCount(),r=new Vb({encoders:this.encoders,attributes:this.getAttributes(),numItems:Math.max(n,this.properties.minBufferSize||0)});r.addBatches(e.facetBatches);const i=r.toArrays();this.rangeMap.migrateEntries(i.rangeMap),this.updateBufferInfo(i)}prepareRender(e){const n=super.prepareRender(e);return this.dashTexture&&n.push(()=>Ee(this.programInfo,{uDashTexture:this.dashTexture,uStrokeDashOffset:this.properties.strokeDashOffset})),n.push(()=>Ln(this.gl,this.programInfo,this.vertexArrayInfo)),n}render(e){const n=this.gl;return this.createRenderCallback((r,i)=>Vr(n,this.vertexArrayInfo,n.TRIANGLE_STRIP,i,r),e)}}function yw(t){if(t.length==0||t.length%2||t.findIndex(o=>Math.round(o)!=o||o<1||o>1e3)>=0)throw new Error("Invalid stroke dash pattern: "+JSON.stringify(t));const e=t.reduce((o,s)=>o+s),n=new Uint8Array(e);let r=!0,i=0;for(let o of t){for(;o;)n[i++]=r&&255||0,o--;r=!r}return n}const bw=`uniform float uSagittaScaleFactor;uniform float uMinSagittaLength;in vec2 strip;out vec4 vColor;out float vSize;out float vNormalLengthInPixels;void main(void){float pixelSize=1.0/uDevicePixelRatio;float opacity=getScaled_opacity()*uViewOpacity;vec2 a=vec2(getScaled_x(),getScaled_y())*uViewportSize;vec2 b=vec2(getScaled_x2(),getScaled_y2())*uViewportSize;vec2 chordVector=b-a;vec2 unitChordVector=normalize(chordVector);vec2 chordNormal=vec2(-unitChordVector.y,unitChordVector.x);float sagitta=max(length(chordVector)/2.0*uSagittaScaleFactor,uMinSagittaLength);bool compress=false;if(compress){float maxSagittaLen=length(chordNormal*uViewportSize);float maxChordLen=length(unitChordVector*uViewportSize);float threshold=maxSagittaLen*0.5;if(sagitta>threshold){float m=(maxSagittaLen-threshold)/(maxChordLen-threshold);sagitta=(sagitta-threshold)*m+threshold;}}vec2 controlOffset=chordNormal*sagitta/0.75;vec2 p1=a;vec2 p2=a+controlOffset;vec2 p3=b+controlOffset;vec2 p4=b;float t=smoothstep(0.0,1.0,strip.x);vec2 C1=p4-3.0*p3+3.0*p2-p1;vec2 C2=3.0*p3-6.0*p2+3.0*p1;vec2 C3=3.0*p2-3.0*p1;vec2 C4=p1;vec2 p;if(t==0.0){p=p1;}else if(t==1.0){p=p4;}else{p=C1*t*t*t+C2*t*t+C3*t+C4;}vec2 tangent=normalize(3.0*C1*t*t+2.0*C2*t+C3);vec2 normal=vec2(-tangent.y,tangent.x);
96
96
  #ifdef size2_DEFINED
97
97
  float mixedSize=mix(getScaled_size(),getScaled_size2(),t);
98
98
  #else
@@ -111,7 +111,7 @@ uniform float uPaddingX;uniform bool uFlushX;
111
111
  #ifdef y2_DEFINED
112
112
  uniform float uPaddingY;uniform bool uFlushY;
113
113
  #endif
114
- out vec2 vTexCoord;flat out vec4 vColor;flat out float vSlope;out float vEdgeFadeOpacity;struct RangeResult{float pos;float scale;};float minValue(vec4 v){return min(min(v.x,v.y),min(v.z,v.w));}float maxValue(vec4 v){return max(max(v.x,v.y),max(v.z,v.w));}/***All measures are in[0,1]*/RangeResult positionInsideRange(float a,float b,float width,float padding,int align,bool flush){float span=b-a;float paddedWidth=width+2.0*padding;if(a>1.0||b<0.0){return RangeResult(0.0,0.0);}float extra=max(0.0,span-paddedWidth);float pos;if(align==0){float centre=a+b;if(flush){float leftOver=max(0.0,paddedWidth-centre);centre+=min(leftOver,extra);float rightOver=max(0.0,paddedWidth+centre-2.0);centre-=min(rightOver,extra);}pos=centre/2.0;}else if(align<0){float edge=a;if(flush){float over=max(0.0,-edge);edge+=min(over,extra);}pos=edge+padding;}else{float edge=b;if(flush){float over=max(0.0,edge-1.0);edge-=min(over,extra);}pos=edge-padding;}float scale=clamp((span-padding)/paddedWidth,0.0,1.0);return RangeResult(pos,scale);}vec2 calculateRotatedDimensions(float width,mat2 rotationMatrix){vec2 a=abs(rotationMatrix*vec2(width/2.0,0.5));vec2 b=abs(rotationMatrix*vec2(width/2.0,-0.5));return vec2(max(a.x,b.x),max(a.y,b.y))*2.0;}ivec2 fixAlignForAngle(ivec2 align,float angleInDegrees){float a=mod(angleInDegrees+45.0,360.0);int x=align.x;int y=-align.y;if(a<90.0){return ivec2(x,y);}else if(a<180.0){return ivec2(y,-x);}else if(a<270.0){return ivec2(-x,y);}else{return ivec2(-y,x);}}void main(void){float opacity=getScaled_opacity()*uViewOpacity;vec2 size=vec2(getScaled_size());float x=getScaled_x();float y=getScaled_y();float scale=1.0;float angleInDegrees=getScaled_angle();float angle=-angleInDegrees*PI/180.0;float sinTheta=sin(angle);float cosTheta=cos(angle);mat2 rotationMatrix=mat2(cosTheta,sinTheta,-sinTheta,cosTheta);vec2 flushSize=calculateRotatedDimensions(width,rotationMatrix);
114
+ out vec2 vTexCoord;out vec4 vColor;out float vSlope;out float vEdgeFadeOpacity;struct RangeResult{float pos;float scale;};float minValue(vec4 v){return min(min(v.x,v.y),min(v.z,v.w));}float maxValue(vec4 v){return max(max(v.x,v.y),max(v.z,v.w));}/***All measures are in[0,1]*/RangeResult positionInsideRange(float a,float b,float width,float padding,int align,bool flush){float span=b-a;float paddedWidth=width+2.0*padding;if(a>1.0||b<0.0){return RangeResult(0.0,0.0);}float extra=max(0.0,span-paddedWidth);float pos;if(align==0){float centre=a+b;if(flush){float leftOver=max(0.0,paddedWidth-centre);centre+=min(leftOver,extra);float rightOver=max(0.0,paddedWidth+centre-2.0);centre-=min(rightOver,extra);}pos=centre/2.0;}else if(align<0){float edge=a;if(flush){float over=max(0.0,-edge);edge+=min(over,extra);}pos=edge+padding;}else{float edge=b;if(flush){float over=max(0.0,edge-1.0);edge-=min(over,extra);}pos=edge-padding;}float scale=clamp((span-padding)/paddedWidth,0.0,1.0);return RangeResult(pos,scale);}vec2 calculateRotatedDimensions(float width,mat2 rotationMatrix){vec2 a=abs(rotationMatrix*vec2(width/2.0,0.5));vec2 b=abs(rotationMatrix*vec2(width/2.0,-0.5));return vec2(max(a.x,b.x),max(a.y,b.y))*2.0;}ivec2 fixAlignForAngle(ivec2 align,float angleInDegrees){float a=mod(angleInDegrees+45.0,360.0);int x=align.x;int y=-align.y;if(a<90.0){return ivec2(x,y);}else if(a<180.0){return ivec2(y,-x);}else if(a<270.0){return ivec2(-x,y);}else{return ivec2(-y,x);}}void main(void){float opacity=getScaled_opacity()*uViewOpacity;vec2 size=vec2(getScaled_size());float x=getScaled_x();float y=getScaled_y();float scale=1.0;float angleInDegrees=getScaled_angle();float angle=-angleInDegrees*PI/180.0;float sinTheta=sin(angle);float cosTheta=cos(angle);mat2 rotationMatrix=mat2(cosTheta,sinTheta,-sinTheta,cosTheta);vec2 flushSize=calculateRotatedDimensions(width,rotationMatrix);
115
115
  #if defined(x2_DEFINED) || defined(y2_DEFINED)
116
116
  ivec2 align=fixAlignForAngle(uAlign,angleInDegrees);
117
117
  #else
@@ -124,7 +124,7 @@ vec2 pos=applySampleFacet(vec2(x,y));
124
124
  #ifdef y2_DEFINED
125
125
  float y2=getScaled_y2();vec2 pos2=applySampleFacet(vec2(x,y2));if(uLogoLetter){size.y=(pos2.y-pos.y)*uViewportSize.y;pos.y+=(pos2.y-pos.y)/2.0;}else{RangeResult result=positionInsideRange(min(pos.y,pos2.y),max(pos.y,pos2.y),size.y*scale*flushSize.y/uViewportSize.y,uPaddingY/uViewportSize.y,align.y,uFlushY);pos.y=result.pos;scale*=result.scale;}
126
126
  #endif
127
- if(scale<1.0){if(uSqueeze){vec2 scaleFadeExtent=vec2(3.0,6.0)/size;if(scale<scaleFadeExtent[0]){gl_Position=vec4(0.0);return;}size*=scale;opacity*=linearstep(scaleFadeExtent[0],scaleFadeExtent[1],scale);}else if(scale<1.0){gl_Position=vec4(0.0);return;}}vec2 charPos=rotationMatrix*(vertexCoord*size+uD);vec2 unitPos=pos+charPos/uViewportSize;gl_Position=unitToNdc(unitPos);vSlope=max(1.0,min(size.x,size.y)/uSdfNumerator);vColor=vec4(getScaled_color()*opacity,opacity);vTexCoord=textureCoord;if(maxValue(uViewportEdgeFadeDistance)>-pow(10.0,10.0)){vEdgeFadeOpacity=minValue(((vec4(1.0,1.0,0.0,0.0)+vec4(-1.0,-1.0,1.0,1.0)*unitPos.yxyx)*uViewportSize.yxyx-uViewportEdgeFadeDistance)/uViewportEdgeFadeWidth);}else{vEdgeFadeOpacity=1.0;}setupPicking();}`,Sw="uniform sampler2D uTexture;in vec2 vTexCoord;in float vEdgeFadeOpacity;flat in vec4 vColor;flat in float vSlope;out lowp vec4 fragColor;float median(float r,float g,float b){return max(min(r,g),min(max(r,g),b));}void main(){vec3 c=texture(uTexture,vTexCoord).rgb;float sigDist=1.0-median(c.r,c.g,c.b);float opa=clamp((sigDist-0.5)*vSlope+0.5,0.0,1.0);opa*=pow(clamp(vEdgeFadeOpacity,0.0,1.0),2.2);fragColor=vColor*opa;if(uPickingEnabled){fragColor=vPickingColor;}}",Dw={left:-1,center:0,right:1},Bw={top:-1,middle:0,bottom:1,alphabetic:1};class Fw extends Xr{constructor(e){super(e),Object.defineProperties(this.defaultProperties,Object.getOwnPropertyDescriptors({x:.5,y:.5,x2:void 0,y2:void 0,text:"",size:11,color:"black",opacity:1,font:void 0,fontStyle:void 0,fontWeight:void 0,align:"center",baseline:"middle",dx:0,dy:0,angle:0,fitToBand:!1,squeeze:!0,paddingX:0,paddingY:0,flushX:!0,flushY:!0,logoLetters:!1,viewportEdgeFadeWidthTop:0,viewportEdgeFadeWidthRight:0,viewportEdgeFadeWidthBottom:0,viewportEdgeFadeWidthLeft:0,viewportEdgeFadeDistanceTop:-1/0,viewportEdgeFadeDistanceRight:-1/0,viewportEdgeFadeDistanceBottom:-1/0,viewportEdgeFadeDistanceLeft:-1/0})),this.font=this.properties.font?e.context.fontManager.getFont(this.properties.font,this.properties.fontStyle,this.properties.fontWeight):e.context.fontManager.getDefaultFont()}getAttributes(){return["uniqueId","facetIndex","x","x2","y","y2","color","size","opacity","angle"]}getSupportedChannels(){return[...super.getSupportedChannels(),"x2","y2","size","text","angle"]}fixEncoding(e){for(const n of kr)this.properties.fitToBand&&Va(e,n);return e}async initializeGraphics(){await super.initializeGraphics(),this.createAndLinkShaders(Ew,Sw)}finalizeGraphicsInitialization(){super.finalizeGraphicsInitialization(),this.gl.useProgram(this.programInfo.program);const e=this.properties;Ee(this.programInfo,{uPaddingX:e.paddingX,uPaddingY:e.paddingY,uFlushX:!!e.flushX,uFlushY:!!e.flushY,uAlign:[Dw[e.align],Bw[e.baseline]],uD:[e.dx,-e.dy],uLogoLetter:!!e.logoLetters,uSqueeze:!!e.squeeze,uViewportEdgeFadeWidth:[e.viewportEdgeFadeWidthTop,e.viewportEdgeFadeWidthRight,e.viewportEdgeFadeWidthBottom,e.viewportEdgeFadeWidthLeft],uViewportEdgeFadeDistance:[e.viewportEdgeFadeDistanceTop,e.viewportEdgeFadeDistanceRight,e.viewportEdgeFadeDistanceBottom,e.viewportEdgeFadeDistanceLeft]})}updateGraphicsData(){const e=this.unitView.getCollector(),n=e.getData(),r=this.encoding,i=this.encoders.text.accessor||this.encoders.text;let o=0;const s=r.text.format?se(r.text.format):c=>c;for(const c of n){const f=s(i(c)),l=Z(f)?f:f===null?"":""+f;o+=l&&l.length||0}const a=new Xb({encoders:this.encoders,attributes:this.getAttributes(),properties:this.properties,fontMetrics:this.font.metrics,numCharacters:Math.max(o,this.properties.minBufferSize||0)});a.addBatches(e.facetBatches);const u=a.toArrays();this.rangeMap.migrateEntries(u.rangeMap),this.updateBufferInfo(u)}prepareRender(e){const n=super.prepareRender(e);let r=.35;return this.properties.logoLetters&&(r/=2),n.push(()=>Ee(this.programInfo,{uTexture:this.font.texture,uSdfNumerator:this.font.metrics.common.base/(this.glHelper.dpr/r)})),n.push(()=>Ln(this.gl,this.programInfo,this.vertexArrayInfo)),n}render(e){const n=this.gl;return this.createRenderCallback((r,i)=>Vr(n,this.vertexArrayInfo,n.TRIANGLES,i,r),e)}}function $0(t,e,{spacing:n,devicePixelRatio:r,offset:i,reverse:o}={}){n=n||0,i=i||0;let s=0,a=0;for(const d of t)s+=Co(d.px)+(Ya(d)?0:n),a+=Co(d.grow);s-=n;const u=Math.max(0,e-s),c=r!==void 0?d=>Math.round(d*r)/r:d=>d,f=[],l=[],h=d=>{const g=f.length;if(!g)return;const A=(d?n:0)*(o?-1:1);p-=A;for(let m=0;m<g;m++)l.push({location:p+(m+1)/(g+1)*A,size:0});p+=A,f.length=0};let p=o?Math.max(e,s):0+i;if(t.length==1&&Ya(t[0]))return[{location:p,size:0}];for(let d=0;d<t.length;d++){const g=t[d];if(Ya(g))f.push(g);else{h(l.length>0);const A=Co(g.px)+(a?Co(g.grow)/a*u:0);o&&(p-=A),l.push({location:c(p),size:c(A)}),o?p-=n:p+=A+n}}return p+=o?n:-n,h(!1),l}function Mw(t){var r,i;let e=0,n=0;for(const o of t)e=Math.max(e,(r=o.px)!=null?r:0),n=Math.max(n,(i=o.grow)!=null?i:0);return{px:e,grow:n}}const au=class{constructor(e,n){he(this,Jr);this.width=e,this.height=n}addPadding(e){return ue(this,Jr,cu).call(this,e.width,e.height)}subtractPadding(e){return ue(this,Jr,cu).call(this,-e.width,-e.height)}};let tn=au;Jr=new WeakSet,cu=function(e,n){var r,i;return new au({px:((r=this.width.px)!=null?r:0)+e,grow:this.width.grow},{px:((i=this.height.px)!=null?i:0)+n,grow:this.height.grow})};const Zr=Object.freeze({px:0,grow:0}),Iw=new tn(Zr,Zr);function Ya(t){return!t.px&&!t.grow}function Co(t){return t||0}function Tw(t){return t&&(me(t.px)||me(t.grow))}function Pw(t){if(rh(t))throw new Error("parseSizeDef does not accept step-based sizes.");if(Tw(t))return t;if(me(t))return{px:t,grow:0};if(t==="container")return{px:0,grow:1};if(!t)return{px:0,grow:1};throw new Error(`Invalid sizeDef: ${t}`)}class je{constructor(e,n,r,i){this.top=e||0,this.right=n||0,this.bottom=r||0,this.left=i||0}get width(){return this.left+this.right}get height(){return this.top+this.bottom}expand(e){return e<=0?this:new je(this.top+e,this.right+e,this.bottom+e,this.left+e)}add(e){return new je(this.top+e.top,this.right+e.right,this.bottom+e.bottom,this.left+e.left)}subtract(e){return new je(this.top-e.top,this.right-e.right,this.bottom-e.bottom,this.left-e.left)}static createFromConfig(e){return typeof e=="number"?this.createUniformPadding(e):e?this.createFromRecord(e):Wa}static createFromRecord(e){return new je(e.top,e.right,e.bottom,e.left)}static zero(){return Wa}static createUniformPadding(e){return new je(e,e,e,e)}}const Wa=je.createUniformPadding(0);Object.freeze(Wa);const Lw=/^([A-Za-z]+:)?\/\//;function Rw(t,e){if(e&&Lw.test(e))return e;const n=t();return n&&e?n.endsWith("/")?n+e:n+"/"+e:n!=null?n:e}const eh="VISIT_SKIP",Kr="VISIT_STOP",th=t=>t;class nh{constructor(e,n,r,i){this.context=n,this.parent=r,this.name=e.name||i,this.spec=e,this.resolutions={scale:{},axis:{}},this._broadcastHandlers={},this._capturingInteractionEventListeners={},this._nonCapturingInteractionEventListeners={},V0(this),this.opacityFunction=th,this.blockEncodingInheritance=!1}getPadding(){return this._cache("size/padding",()=>je.createFromConfig(this.spec.padding))}getOverhang(){return je.zero()}getSize(){return this._cache("size/size",()=>this.isVisible()?this.getSizeFromSpec().addPadding(this.getPadding()):Iw)}getSizeFromSpec(){const e=n=>{var i,o;let r=this.spec[n];if(rh(r)){const s=r.step,a=(i=this.getScaleResolution(n=="width"?"x":"y"))==null?void 0:i.getScale();if(a){let u=0;if(Wt(a.type))u=a.domain().length;else if(["locus","index"].includes(a.type)){const f=a.domain();u=Cn(f)-f[0]}else throw new Error(`Cannot use step-based size with "${a.type}" scale!`);const c=a;return u=Vs(u,c.paddingInner(),c.paddingOuter()),{px:u*s,grow:0}}else throw new Error("Cannot use 'step' size with missing scale!")}else return(o=r&&Pw(r))!=null?o:{px:0,grow:1}};return this._cache("size/sizeFromSpec",()=>new tn(e("width"),e("height")))}isVisible(){return this.context.isViewVisible(this)}isVisibleInSpec(){var e;return(e=this.spec.visible)!=null?e:!0}getEffectiveOpacity(){var e,n;return this.opacityFunction((n=(e=this.parent)==null?void 0:e.getEffectiveOpacity())!=null?n:1)}getPathString(){return[...this.getAncestors()].map(e=>e.name).reverse().join("/")}*getAncestors(){let e=this;do yield e,e=e.parent;while(e)}handleBroadcast(e){for(const n of this._broadcastHandlers[e.type]||[])n(e)}_addBroadcastHandler(e,n){let r=this._broadcastHandlers[e];r||(r=[],this._broadcastHandlers[e]=r),r.push(n)}handleInteractionEvent(e,n,r){const i=r?this._capturingInteractionEventListeners:this._nonCapturingInteractionEventListeners;for(const o of i[n.type]||[])o(e,n)}addInteractionEventListener(e,n,r){const i=r?this._capturingInteractionEventListeners:this._nonCapturingInteractionEventListeners;let o=i[e];o||(o=[],i[e]=o),o.push(n)}visit(e){try{const n=e(this);if(e.postOrder&&e.postOrder(this),n!==Kr)return n}catch(n){throw n.view=this,n}}onScalesResolved(){(!this.opacityFunction||this.opacityFunction===th)&&(this.opacityFunction=Nw(this))}onBeforeRender(){}render(e,n,r={}){}getEncoding(){const e=this.parent&&!this.blockEncodingInheritance?this.parent.getEncoding():{},n=this.spec.encoding||{},r={...e,...n};for(const[i,o]of Object.entries(r))o===null&&delete r[i];return r}getFacetAccessor(e){if(this.parent)return this.parent.getFacetAccessor(this)}getFacetFields(e){var r;const n=this.getEncoding().sample;return Lr(n)?[n.field]:(r=this.parent)==null?void 0:r.getFacetFields(this)}getSampleFacetTexture(){}_getResolution(e,n){e=En(e);let r=this;do{const i=r.resolutions[n][e];if(i)return i;r=r.parent}while(r)}getScaleResolution(e){return this._getResolution(e,"scale")}getAxisResolution(e){return this._getResolution(e,"axis")}getBaseUrl(){return Rw(()=>{var e;return(e=this.parent)==null?void 0:e.getBaseUrl()},this.spec.baseUrl)}getDynamicDataSource(){throw new Error("The view does not provide dynamic data!")}isPickingSupported(){return!0}getTitleText(){const e=this.spec.title;if(e)return Z(e)?e:e.text}_cache(e,n){return kn(this,e,n)}_invalidateCacheByPrefix(e,n="self"){switch(n){case"self":wo(this,e);break;case"ancestors":for(const r of this.getAncestors())wo(r,e);break;case"progeny":this.visit(r=>wo(r,e));break}}invalidateSizeCache(){this._invalidateCacheByPrefix("size/","ancestors")}propagateInteractionEvent(e){}}function kw(t){return"unitsPerPixel"in t}function Nw(t){const e=t.spec.opacity;if(e!==void 0){if(me(e))return n=>n*e;if(kw(e)){const n=o=>{var a;const s=(a=t.getScaleResolution(o))==null?void 0:a.getScale();if(["linear","index","locus"].includes(s==null?void 0:s.type))return s},r=e.channel?n(e.channel):n("x")||n("y");if(!r)throw new Error("Cannot find a resolved quantitative scale for dynamic opacity!");const i=Ns().domain(e.unitsPerPixel).range(e.values).clamp(!0);return o=>{const a=ci(r.domain())/1e3;return i(a)*o}}}return n=>n}const rh=t=>!!(t!=null&&t.step);class Nn extends nh{constructor(e,n,r,i){super(e,n,r,i),this.spec=e}*[Symbol.iterator](){}replaceChild(e,n){throw new Error("Not implemented")}visit(e){let n;try{n=e(this)}catch(r){throw r.view=this,r}if(n===Kr)return n;if(n!==eh){e.beforeChildren&&e.beforeChildren(this);for(const r of this){const i=r.visit(e);if(i===Kr)return i}e.afterChildren&&e.afterChildren(this),e.postOrder&&e.postOrder(this)}}findDescendantByPath(e){for(const n of this)if(n.name===e[0]){if(e.length==1)return n;if(n instanceof Nn)return n.findDescendantByPath(e.slice(1))}}findChildByName(e){for(const n of this)if(n.name===e)return n}findDescendantByName(e){let n;return this.visit(r=>{if(r.name==e)return n=r,Kr}),n}getConfiguredResolution(e,n){var r,i;return(i=(r=this.spec.resolve)==null?void 0:r[n])==null?void 0:i[e]}getDefaultResolution(e,n){return"shared"}getConfiguredOrDefaultResolution(e,n){var r,i;return(i=(r=this.getConfiguredResolution(e,n))!=null?r:this.getConfiguredResolution("default",n))!=null?i:this.getDefaultResolution(e,n)}}function Eo(t,e,n){if(n=n||[],t.some(s=>s===null)){if(t.every(s=>s===null))return null;throw console.warn(t),new Error("Cannot merge objects with nulls!")}const r={},i=(s,a)=>s===a||zn(s)&&zn(a)||zn(s)&&a===!0||s===!0&&ke(a),o=s=>{for(let a in s){const u=s[a];if(!n.includes(a)&&u!==void 0)if(r[a]!==void 0&&!i(r[a],u))console.warn(`Conflicting property ${a} of ${e}: (${JSON.stringify(r[a])} and ${JSON.stringify(s[a])}). Using ${JSON.stringify(r[a])}.`);else{const c=r[a];if(zn(c))zn(u)&&(r[a]=Eo([c,u],a));else if(zn(u)){if(!(c===!0||c===void 0))throw new Error("Bug in merge! Target is: "+c);r[a]=Eo([{},u],a)}else r[a]=u}}};for(const s of t)o(s);return r}function zn(t){return ke(t)&&!Array.isArray(t)}/*!
127
+ if(scale<1.0){if(uSqueeze){vec2 scaleFadeExtent=vec2(3.0,6.0)/size;if(scale<scaleFadeExtent[0]){gl_Position=vec4(0.0);return;}size*=scale;opacity*=linearstep(scaleFadeExtent[0],scaleFadeExtent[1],scale);}else if(scale<1.0){gl_Position=vec4(0.0);return;}}vec2 charPos=rotationMatrix*(vertexCoord*size+uD);vec2 unitPos=pos+charPos/uViewportSize;gl_Position=unitToNdc(unitPos);vSlope=max(1.0,min(size.x,size.y)/uSdfNumerator);vColor=vec4(getScaled_color()*opacity,opacity);vTexCoord=textureCoord;if(maxValue(uViewportEdgeFadeDistance)>-pow(10.0,10.0)){vEdgeFadeOpacity=minValue(((vec4(1.0,1.0,0.0,0.0)+vec4(-1.0,-1.0,1.0,1.0)*unitPos.yxyx)*uViewportSize.yxyx-uViewportEdgeFadeDistance)/uViewportEdgeFadeWidth);}else{vEdgeFadeOpacity=1.0;}setupPicking();}`,Sw="uniform sampler2D uTexture;in vec2 vTexCoord;in float vEdgeFadeOpacity;in vec4 vColor;in float vSlope;out lowp vec4 fragColor;float median(float r,float g,float b){return max(min(r,g),min(max(r,g),b));}void main(){vec3 c=texture(uTexture,vTexCoord).rgb;float sigDist=1.0-median(c.r,c.g,c.b);float opa=clamp((sigDist-0.5)*vSlope+0.5,0.0,1.0);opa*=pow(clamp(vEdgeFadeOpacity,0.0,1.0),2.2);fragColor=vColor*opa;if(uPickingEnabled){fragColor=vPickingColor;}}",Dw={left:-1,center:0,right:1},Bw={top:-1,middle:0,bottom:1,alphabetic:1};class Fw extends Xr{constructor(e){super(e),Object.defineProperties(this.defaultProperties,Object.getOwnPropertyDescriptors({x:.5,y:.5,x2:void 0,y2:void 0,text:"",size:11,color:"black",opacity:1,font:void 0,fontStyle:void 0,fontWeight:void 0,align:"center",baseline:"middle",dx:0,dy:0,angle:0,fitToBand:!1,squeeze:!0,paddingX:0,paddingY:0,flushX:!0,flushY:!0,logoLetters:!1,viewportEdgeFadeWidthTop:0,viewportEdgeFadeWidthRight:0,viewportEdgeFadeWidthBottom:0,viewportEdgeFadeWidthLeft:0,viewportEdgeFadeDistanceTop:-1/0,viewportEdgeFadeDistanceRight:-1/0,viewportEdgeFadeDistanceBottom:-1/0,viewportEdgeFadeDistanceLeft:-1/0})),this.font=this.properties.font?e.context.fontManager.getFont(this.properties.font,this.properties.fontStyle,this.properties.fontWeight):e.context.fontManager.getDefaultFont()}getAttributes(){return["uniqueId","facetIndex","x","x2","y","y2","color","size","opacity","angle"]}getSupportedChannels(){return[...super.getSupportedChannels(),"x2","y2","size","text","angle"]}fixEncoding(e){for(const n of kr)this.properties.fitToBand&&Va(e,n);return e}async initializeGraphics(){await super.initializeGraphics(),this.createAndLinkShaders(Ew,Sw)}finalizeGraphicsInitialization(){super.finalizeGraphicsInitialization(),this.gl.useProgram(this.programInfo.program);const e=this.properties;Ee(this.programInfo,{uPaddingX:e.paddingX,uPaddingY:e.paddingY,uFlushX:!!e.flushX,uFlushY:!!e.flushY,uAlign:[Dw[e.align],Bw[e.baseline]],uD:[e.dx,-e.dy],uLogoLetter:!!e.logoLetters,uSqueeze:!!e.squeeze,uViewportEdgeFadeWidth:[e.viewportEdgeFadeWidthTop,e.viewportEdgeFadeWidthRight,e.viewportEdgeFadeWidthBottom,e.viewportEdgeFadeWidthLeft],uViewportEdgeFadeDistance:[e.viewportEdgeFadeDistanceTop,e.viewportEdgeFadeDistanceRight,e.viewportEdgeFadeDistanceBottom,e.viewportEdgeFadeDistanceLeft]})}updateGraphicsData(){const e=this.unitView.getCollector(),n=e.getData(),r=this.encoding,i=this.encoders.text.accessor||this.encoders.text;let o=0;const s=r.text.format?se(r.text.format):c=>c;for(const c of n){const f=s(i(c)),l=Z(f)?f:f===null?"":""+f;o+=l&&l.length||0}const a=new Xb({encoders:this.encoders,attributes:this.getAttributes(),properties:this.properties,fontMetrics:this.font.metrics,numCharacters:Math.max(o,this.properties.minBufferSize||0)});a.addBatches(e.facetBatches);const u=a.toArrays();this.rangeMap.migrateEntries(u.rangeMap),this.updateBufferInfo(u)}prepareRender(e){const n=super.prepareRender(e);let r=.35;return this.properties.logoLetters&&(r/=2),n.push(()=>Ee(this.programInfo,{uTexture:this.font.texture,uSdfNumerator:this.font.metrics.common.base/(this.glHelper.dpr/r)})),n.push(()=>Ln(this.gl,this.programInfo,this.vertexArrayInfo)),n}render(e){const n=this.gl;return this.createRenderCallback((r,i)=>Vr(n,this.vertexArrayInfo,n.TRIANGLES,i,r),e)}}function $0(t,e,{spacing:n,devicePixelRatio:r,offset:i,reverse:o}={}){n=n||0,i=i||0;let s=0,a=0;for(const d of t)s+=Co(d.px)+(Ya(d)?0:n),a+=Co(d.grow);s-=n;const u=Math.max(0,e-s),c=r!==void 0?d=>Math.round(d*r)/r:d=>d,f=[],l=[],h=d=>{const g=f.length;if(!g)return;const A=(d?n:0)*(o?-1:1);p-=A;for(let m=0;m<g;m++)l.push({location:p+(m+1)/(g+1)*A,size:0});p+=A,f.length=0};let p=o?Math.max(e,s):0+i;if(t.length==1&&Ya(t[0]))return[{location:p,size:0}];for(let d=0;d<t.length;d++){const g=t[d];if(Ya(g))f.push(g);else{h(l.length>0);const A=Co(g.px)+(a?Co(g.grow)/a*u:0);o&&(p-=A),l.push({location:c(p),size:c(A)}),o?p-=n:p+=A+n}}return p+=o?n:-n,h(!1),l}function Mw(t){var r,i;let e=0,n=0;for(const o of t)e=Math.max(e,(r=o.px)!=null?r:0),n=Math.max(n,(i=o.grow)!=null?i:0);return{px:e,grow:n}}const au=class{constructor(e,n){he(this,Jr);this.width=e,this.height=n}addPadding(e){return ue(this,Jr,cu).call(this,e.width,e.height)}subtractPadding(e){return ue(this,Jr,cu).call(this,-e.width,-e.height)}};let tn=au;Jr=new WeakSet,cu=function(e,n){var r,i;return new au({px:((r=this.width.px)!=null?r:0)+e,grow:this.width.grow},{px:((i=this.height.px)!=null?i:0)+n,grow:this.height.grow})};const Zr=Object.freeze({px:0,grow:0}),Iw=new tn(Zr,Zr);function Ya(t){return!t.px&&!t.grow}function Co(t){return t||0}function Tw(t){return t&&(me(t.px)||me(t.grow))}function Pw(t){if(rh(t))throw new Error("parseSizeDef does not accept step-based sizes.");if(Tw(t))return t;if(me(t))return{px:t,grow:0};if(t==="container")return{px:0,grow:1};if(!t)return{px:0,grow:1};throw new Error(`Invalid sizeDef: ${t}`)}class je{constructor(e,n,r,i){this.top=e||0,this.right=n||0,this.bottom=r||0,this.left=i||0}get width(){return this.left+this.right}get height(){return this.top+this.bottom}expand(e){return e<=0?this:new je(this.top+e,this.right+e,this.bottom+e,this.left+e)}add(e){return new je(this.top+e.top,this.right+e.right,this.bottom+e.bottom,this.left+e.left)}subtract(e){return new je(this.top-e.top,this.right-e.right,this.bottom-e.bottom,this.left-e.left)}static createFromConfig(e){return typeof e=="number"?this.createUniformPadding(e):e?this.createFromRecord(e):Wa}static createFromRecord(e){return new je(e.top,e.right,e.bottom,e.left)}static zero(){return Wa}static createUniformPadding(e){return new je(e,e,e,e)}}const Wa=je.createUniformPadding(0);Object.freeze(Wa);const Lw=/^([A-Za-z]+:)?\/\//;function Rw(t,e){if(e&&Lw.test(e))return e;const n=t();return n&&e?n.endsWith("/")?n+e:n+"/"+e:n!=null?n:e}const eh="VISIT_SKIP",Kr="VISIT_STOP",th=t=>t;class nh{constructor(e,n,r,i){this.context=n,this.parent=r,this.name=e.name||i,this.spec=e,this.resolutions={scale:{},axis:{}},this._broadcastHandlers={},this._capturingInteractionEventListeners={},this._nonCapturingInteractionEventListeners={},V0(this),this.opacityFunction=th,this.blockEncodingInheritance=!1}getPadding(){return this._cache("size/padding",()=>je.createFromConfig(this.spec.padding))}getOverhang(){return je.zero()}getSize(){return this._cache("size/size",()=>this.isVisible()?this.getSizeFromSpec().addPadding(this.getPadding()):Iw)}getSizeFromSpec(){const e=n=>{var i,o;let r=this.spec[n];if(rh(r)){const s=r.step,a=(i=this.getScaleResolution(n=="width"?"x":"y"))==null?void 0:i.getScale();if(a){let u=0;if(Wt(a.type))u=a.domain().length;else if(["locus","index"].includes(a.type)){const f=a.domain();u=Cn(f)-f[0]}else throw new Error(`Cannot use step-based size with "${a.type}" scale!`);const c=a;return u=Vs(u,c.paddingInner(),c.paddingOuter()),{px:u*s,grow:0}}else throw new Error("Cannot use 'step' size with missing scale!")}else return(o=r&&Pw(r))!=null?o:{px:0,grow:1}};return this._cache("size/sizeFromSpec",()=>new tn(e("width"),e("height")))}isVisible(){return this.context.isViewVisible(this)}isVisibleInSpec(){var e;return(e=this.spec.visible)!=null?e:!0}getEffectiveOpacity(){var e,n;return this.opacityFunction((n=(e=this.parent)==null?void 0:e.getEffectiveOpacity())!=null?n:1)}getPathString(){return[...this.getAncestors()].map(e=>e.name).reverse().join("/")}*getAncestors(){let e=this;do yield e,e=e.parent;while(e)}handleBroadcast(e){for(const n of this._broadcastHandlers[e.type]||[])n(e)}_addBroadcastHandler(e,n){let r=this._broadcastHandlers[e];r||(r=[],this._broadcastHandlers[e]=r),r.push(n)}handleInteractionEvent(e,n,r){const i=r?this._capturingInteractionEventListeners:this._nonCapturingInteractionEventListeners;for(const o of i[n.type]||[])o(e,n)}addInteractionEventListener(e,n,r){const i=r?this._capturingInteractionEventListeners:this._nonCapturingInteractionEventListeners;let o=i[e];o||(o=[],i[e]=o),o.push(n)}visit(e){try{const n=e(this);if(e.postOrder&&e.postOrder(this),n!==Kr)return n}catch(n){throw n.view=this,n}}onScalesResolved(){(!this.opacityFunction||this.opacityFunction===th)&&(this.opacityFunction=Nw(this))}onBeforeRender(){}render(e,n,r={}){}getEncoding(){const e=this.parent&&!this.blockEncodingInheritance?this.parent.getEncoding():{},n=this.spec.encoding||{},r={...e,...n};for(const[i,o]of Object.entries(r))o===null&&delete r[i];return r}getFacetAccessor(e){if(this.parent)return this.parent.getFacetAccessor(this)}getFacetFields(e){var r;const n=this.getEncoding().sample;return Lr(n)?[n.field]:(r=this.parent)==null?void 0:r.getFacetFields(this)}getSampleFacetTexture(){}_getResolution(e,n){e=En(e);let r=this;do{const i=r.resolutions[n][e];if(i)return i;r=r.parent}while(r)}getScaleResolution(e){return this._getResolution(e,"scale")}getAxisResolution(e){return this._getResolution(e,"axis")}getBaseUrl(){return Rw(()=>{var e;return(e=this.parent)==null?void 0:e.getBaseUrl()},this.spec.baseUrl)}getDynamicDataSource(){throw new Error("The view does not provide dynamic data!")}isPickingSupported(){return!0}getTitleText(){const e=this.spec.title;if(e)return Z(e)?e:e.text}_cache(e,n){return kn(this,e,n)}_invalidateCacheByPrefix(e,n="self"){switch(n){case"self":wo(this,e);break;case"ancestors":for(const r of this.getAncestors())wo(r,e);break;case"progeny":this.visit(r=>wo(r,e));break}}invalidateSizeCache(){this._invalidateCacheByPrefix("size/","ancestors")}propagateInteractionEvent(e){}}function kw(t){return"unitsPerPixel"in t}function Nw(t){const e=t.spec.opacity;if(e!==void 0){if(me(e))return n=>n*e;if(kw(e)){const n=o=>{var a;const s=(a=t.getScaleResolution(o))==null?void 0:a.getScale();if(["linear","index","locus"].includes(s==null?void 0:s.type))return s},r=e.channel?n(e.channel):n("x")||n("y");if(!r)throw new Error("Cannot find a resolved quantitative scale for dynamic opacity!");const i=Ns().domain(e.unitsPerPixel).range(e.values).clamp(!0);return o=>{const a=ci(r.domain())/1e3;return i(a)*o}}}return n=>n}const rh=t=>!!(t!=null&&t.step);class Nn extends nh{constructor(e,n,r,i){super(e,n,r,i),this.spec=e}*[Symbol.iterator](){}replaceChild(e,n){throw new Error("Not implemented")}visit(e){let n;try{n=e(this)}catch(r){throw r.view=this,r}if(n===Kr)return n;if(n!==eh){e.beforeChildren&&e.beforeChildren(this);for(const r of this){const i=r.visit(e);if(i===Kr)return i}e.afterChildren&&e.afterChildren(this),e.postOrder&&e.postOrder(this)}}findDescendantByPath(e){for(const n of this)if(n.name===e[0]){if(e.length==1)return n;if(n instanceof Nn)return n.findDescendantByPath(e.slice(1))}}findChildByName(e){for(const n of this)if(n.name===e)return n}findDescendantByName(e){let n;return this.visit(r=>{if(r.name==e)return n=r,Kr}),n}getConfiguredResolution(e,n){var r,i;return(i=(r=this.spec.resolve)==null?void 0:r[n])==null?void 0:i[e]}getDefaultResolution(e,n){return"shared"}getConfiguredOrDefaultResolution(e,n){var r,i;return(i=(r=this.getConfiguredResolution(e,n))!=null?r:this.getConfiguredResolution("default",n))!=null?i:this.getDefaultResolution(e,n)}}function Eo(t,e,n){if(n=n||[],t.some(s=>s===null)){if(t.every(s=>s===null))return null;throw console.warn(t),new Error("Cannot merge objects with nulls!")}const r={},i=(s,a)=>s===a||zn(s)&&zn(a)||zn(s)&&a===!0||s===!0&&ke(a),o=s=>{for(let a in s){const u=s[a];if(!n.includes(a)&&u!==void 0)if(r[a]!==void 0&&!i(r[a],u))console.warn(`Conflicting property ${a} of ${e}: (${JSON.stringify(r[a])} and ${JSON.stringify(s[a])}). Using ${JSON.stringify(r[a])}.`);else{const c=r[a];if(zn(c))zn(u)&&(r[a]=Eo([c,u],a));else if(zn(u)){if(!(c===!0||c===void 0))throw new Error("Bug in merge! Target is: "+c);r[a]=Eo([{},u],a)}else r[a]=u}}};for(const s of t)o(s);return r}function zn(t){return ke(t)&&!Array.isArray(t)}/*!
128
128
  * Adapted from vega-encode:
129
129
  * https://github.com/vega/vega/blob/master/packages/vega-encode/src/ticks.js
130
130
  *
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "contributors": [],
9
9
  "license": "BSD-2-Clause",
10
- "version": "0.25.0",
10
+ "version": "0.25.1",
11
11
  "main": "dist/index.js",
12
12
  "module": "src/index.js",
13
13
  "exports": {
@@ -53,5 +53,5 @@
53
53
  "vega-scale": "^7.1.1",
54
54
  "vega-util": "^1.16.0"
55
55
  },
56
- "gitHead": "1b8f0acaf7aaf15b1c6d348b7a1d891e41dbc977"
56
+ "gitHead": "e9c4acf0c725ce1ef46303a01a05d7ccf6dcc9c3"
57
57
  }
@@ -1 +1 @@
1
- flat in highp vec4 vPickingColor;
1
+ in highp vec4 vPickingColor;
@@ -4,7 +4,7 @@
4
4
  * https://deck.gl/docs/developer-guide/custom-layers/picking
5
5
  */
6
6
 
7
- flat out highp vec4 vPickingColor;
7
+ out highp vec4 vPickingColor;
8
8
 
9
9
  /**
10
10
  * Passes the unique id to the fragment shader as a color if picking is enabled.
@@ -4,15 +4,15 @@ const lowp vec4 black = vec4(0.0, 0.0, 0.0, 1.0);
4
4
  uniform bool uInwardStroke;
5
5
  uniform float uGradientStrength;
6
6
 
7
- flat in float vRadius;
8
- flat in float vRadiusWithPadding;
7
+ in float vRadius;
8
+ in float vRadiusWithPadding;
9
9
 
10
- flat in lowp vec4 vFillColor;
11
- flat in lowp vec4 vStrokeColor;
12
- flat in lowp float vShape;
13
- flat in lowp float vHalfStrokeWidth;
10
+ in lowp vec4 vFillColor;
11
+ in lowp vec4 vStrokeColor;
12
+ in lowp float vShape;
13
+ in lowp float vHalfStrokeWidth;
14
14
 
15
- flat in mat2 vRotationMatrix;
15
+ in mat2 vRotationMatrix;
16
16
 
17
17
  out lowp vec4 fragColor;
18
18
 
@@ -17,13 +17,13 @@ uniform float uMaxPointSize;
17
17
  uniform float uZoomLevel;
18
18
  uniform float uSemanticThreshold;
19
19
 
20
- flat out float vRadius;
21
- flat out float vRadiusWithPadding;
22
- flat out lowp vec4 vFillColor;
23
- flat out lowp vec4 vStrokeColor;
24
- flat out lowp float vShape;
25
- flat out lowp float vHalfStrokeWidth;
26
- flat out mat2 vRotationMatrix;
20
+ out float vRadius;
21
+ out float vRadiusWithPadding;
22
+ out lowp vec4 vFillColor;
23
+ out lowp vec4 vStrokeColor;
24
+ out lowp float vShape;
25
+ out lowp float vHalfStrokeWidth;
26
+ out mat2 vRotationMatrix;
27
27
 
28
28
 
29
29
  float computeSemanticThresholdFactor() {
@@ -2,12 +2,12 @@
2
2
  in vec2 vPosInPixels;
3
3
  #endif
4
4
 
5
- flat in vec2 vHalfSizeInPixels;
5
+ in vec2 vHalfSizeInPixels;
6
6
 
7
- flat in lowp vec4 vFillColor;
8
- flat in lowp vec4 vStrokeColor;
9
- flat in float vHalfStrokeWidth;
10
- flat in vec4 vCornerRadii;
7
+ in lowp vec4 vFillColor;
8
+ in lowp vec4 vStrokeColor;
9
+ in float vHalfStrokeWidth;
10
+ in vec4 vCornerRadii;
11
11
 
12
12
  out lowp vec4 fragColor;
13
13
 
@@ -15,10 +15,10 @@ uniform float uMinOpacity;
15
15
  /** top-right, bottom-right, top-left, bottom-left */
16
16
  uniform vec4 uCornerRadii;
17
17
 
18
- flat out lowp vec4 vFillColor;
19
- flat out lowp vec4 vStrokeColor;
20
- flat out float vHalfStrokeWidth;
21
- flat out vec4 vCornerRadii;
18
+ out lowp vec4 vFillColor;
19
+ out lowp vec4 vStrokeColor;
20
+ out float vHalfStrokeWidth;
21
+ out vec4 vCornerRadii;
22
22
 
23
23
 
24
24
  #if defined(ROUNDED_CORNERS) || defined(STROKED)
@@ -27,7 +27,7 @@ out vec2 vPosInPixels;
27
27
  #endif
28
28
 
29
29
  /** Size of the rect in pixels */
30
- flat out vec2 vHalfSizeInPixels;
30
+ out vec2 vHalfSizeInPixels;
31
31
 
32
32
  /**
33
33
  * Clamps the minimumSize and returns an opacity that reflects the amount of clamping.
@@ -8,8 +8,8 @@ uniform float uDashTextureSize;
8
8
  uniform float uStrokeDashOffset;
9
9
  uniform lowp int uStrokeCap;
10
10
 
11
- flat in vec4 vColor;
12
- flat in float vSize;
11
+ in vec4 vColor;
12
+ in float vSize;
13
13
 
14
14
  /** Position on the rule along its length in pixels */
15
15
  in vec2 vPosInPixels;
@@ -15,10 +15,10 @@ uniform float uMinLength;
15
15
  uniform mediump float uDashTextureSize;
16
16
  uniform lowp int uStrokeCap;
17
17
 
18
- flat out vec4 vColor;
18
+ out vec4 vColor;
19
19
 
20
20
  /** Stroke width */
21
- flat out float vSize;
21
+ out float vSize;
22
22
 
23
23
  /** The distance from the line center to the direction of normal in pixels */
24
24
  out float vNormalLengthInPixels;
@@ -2,8 +2,8 @@ uniform sampler2D uTexture;
2
2
 
3
3
  in vec2 vTexCoord;
4
4
  in float vEdgeFadeOpacity;
5
- flat in vec4 vColor;
6
- flat in float vSlope;
5
+ in vec4 vColor;
6
+ in float vSlope;
7
7
 
8
8
  out lowp vec4 fragColor;
9
9
 
@@ -29,8 +29,8 @@ uniform bool uFlushY;
29
29
  #endif
30
30
 
31
31
  out vec2 vTexCoord;
32
- flat out vec4 vColor;
33
- flat out float vSlope;
32
+ out vec4 vColor;
33
+ out float vSlope;
34
34
  out float vEdgeFadeOpacity;
35
35
 
36
36
  struct RangeResult {