Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

libtess

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libtess - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

libtess.debug.js

62

libtess.min.js

@@ -30,32 +30,32 @@ /*

*/
'use strict';var m;function s(a,b){return a.b===b.b&&a.a===b.a}function t(a,b){return a.b<b.b||a.b===b.b&&a.a<=b.a}function u(a,b,c){var d=b.b-a.b,e=c.b-b.b;return 0<d+e?d<e?b.a-a.a+d/(d+e)*(a.a-c.a):b.a-c.a+e/(d+e)*(c.a-a.a):0}function v(a,b,c){var d=b.b-a.b,e=c.b-b.b;return 0<d+e?(b.a-c.a)*d+(b.a-a.a)*e:0}function x(a,b){return a.a<b.a||a.a===b.a&&a.b<=b.b}function aa(a,b,c){var d=b.a-a.a,e=c.a-b.a;return 0<d+e?d<e?b.b-a.b+d/(d+e)*(a.b-c.b):b.b-c.b+e/(d+e)*(c.b-a.b):0}
function ba(a,b,c){var d=b.a-a.a,e=c.a-b.a;return 0<d+e?(b.b-c.b)*d+(b.b-a.b)*e:0}function ca(a){return t(z(a),a.a)}function da(a){return t(a.a,z(a))}function A(a,b,c,d){a=0>a?0:a;c=0>c?0:c;return a<=c?0===c?(b+d)/2:b+a/(a+c)*(d-b):d+c/(a+c)*(b-d)};function ea(a){var b=B(a.b);C(b,a.c);C(b.b,a.c);D(b,a.a);return b}function E(a,b){var c=!1,d=!1;a!==b&&(b.a!==a.a&&(d=!0,F(b.a,a.a)),b.d!==a.d&&(c=!0,G(b.d,a.d)),H(b,a),d||(C(b,a.a),a.a.c=a),c||(D(b,a.d),a.d.a=a))}function I(a){var b=a.b,c=!1;a.d!==a.b.d&&(c=!0,G(a.d,a.b.d));a.c===a?F(a.a,null):(a.b.d.a=J(a),a.a.c=a.c,H(a,J(a)),c||D(a,a.d));b.c===b?(F(b.a,null),G(b.d,null)):(a.d.a=J(b),b.a.c=b.c,H(b,J(b)));fa(a)}
function K(a){var b=B(a),c=b.b;H(b,a.e);b.a=z(a);C(c,b.a);b.d=c.d=a.d;b=b.b;H(a.b,J(a.b));H(a.b,b);a.b.a=b.a;z(b).c=b.b;b.b.d=a.b.d;b.g=a.g;b.b.g=a.b.g;return b}function L(a,b){var c=!1,d=B(a),e=d.b;b.d!==a.d&&(c=!0,G(b.d,a.d));H(d,a.e);H(e,b);d.a=z(a);e.a=b.a;d.d=e.d=a.d;a.d.a=e;c||D(d,a.d);return d}function B(a){var b=new M,c=new M,d=a.b.i;c.i=d;d.b.i=b;b.i=a;a.b.i=c;b.b=c;b.c=b;b.e=c;c.b=b;c.c=c;return c.e=b}function H(a,b){var c=a.c,d=b.c;c.b.e=b;d.b.e=a;a.c=d;b.c=c}
function C(a,b){var c=b.g,d=new N(b,c);c.e=d;b.g=d;c=d.c=a;do c.a=d,c=c.c;while(c!==a)}function D(a,b){var c=b.d,d=new ga(b,c);c.b=d;b.d=d;d.a=a;d.c=b.c;c=a;do c.d=d,c=c.e;while(c!==a)}function fa(a){var b=a.i;a=a.b.i;b.b.i=a;a.b.i=b}function F(a,b){var c=a.c,d=c;do d.a=b,d=d.c;while(d!==c);c=a.g;d=a.e;d.g=c;c.e=d}function G(a,b){var c=a.a,d=c;do d.d=b,d=d.e;while(d!==c);c=a.d;d=a.b;d.d=c;c.b=d};function ha(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}function ia(a){var b=0;Math.abs(a[1])>Math.abs(a[0])&&(b=1);Math.abs(a[2])>Math.abs(a[b])&&(b=2);return b};var O=4*1E150;function P(a,b){a.g+=b.g;a.b.g+=b.b.g}function ja(a,b,c){a=a.a;b=b.f;c=c.f;if(z(b)===a)return z(c)===a?t(b.a,c.a)?0>=v(z(c),b.a,c.a):0<=v(z(b),c.a,b.a):0>=v(z(c),a,c.a);if(z(c)===a)return 0<=v(z(b),a,b.a);b=u(z(b),a,b.a);a=u(z(c),a,c.a);return b>=a}function Q(a){a.f.j=null;var b=a.d;b.a.c=b.c;b.c.a=b.a;a.d=null}function R(a,b){I(a.f);a.b=!1;a.f=b;b.j=a}function S(a){var b=a.f.a;do a=T(a);while(a.f.a===b);a.b&&(b=L(U(a).f.b,a.f.e),R(a,b),a=T(a));return a}
function ka(a,b,c){var d=new V;d.f=c;d.d=la(a.i,b.d,d);return c.j=d}function ma(a,b){switch(a.y){case 100130:return 0!==(b&1);case 100131:return 0!==b;case 100132:return 0<b;case 100133:return 0>b;case 100134:return 2<=b||-2>=b}return!1}function na(a){var b=a.f,c=b.d;c.c=a.c;c.a=b;Q(a)}function W(a,b){for(var c=a,d=a.f;c!==b;){c.b=!1;var e=U(c),f=e.f;if(f.a!==d.a){if(!e.b){na(c);break}f=L(d.c.b,f.b);R(e,f)}d.c!==f&&(E(J(f),f),E(d,f));na(c);d=e.f;c=e}return d}
function X(a,b,c,d,e,f){var g=!0;do ka(a,b,c.b),c=c.c;while(c!==d);for(null===e&&(e=U(b).f.b.c);;){d=U(b);c=d.f.b;if(c.a!==e.a)break;c.c!==e&&(E(J(c),c),E(J(e),c));d.e=b.e-c.g;d.c=ma(a,d.e);b.a=!0;!g&&oa(a,b)&&(P(c,e),Q(b),I(e));g=!1;b=d;e=c}b.a=!0;f&&pa(a,b)}function qa(a,b,c,d,e){var f=[b.h[0],b.h[1],b.h[2]];b.d=null;var g;a.A?g=a.A(f,c,d,a.c):a.B&&(g=a.B(f,c,d));void 0===g&&(g=null);b.d=g;null===b.d&&(e?a.w||(Y(a,100156),a.w=!0):b.d=c[0])}
function ra(a,b,c){var d=[null,null,null,null];d[0]=b.a.d;d[1]=c.a.d;qa(a,b.a,d,[.5,.5,0,0],!1);E(b,c)}function sa(a,b,c,d,e){var f=Math.abs(b.b-a.b)+Math.abs(b.a-a.a),g=Math.abs(c.b-a.b)+Math.abs(c.a-a.a),n=e+1;d[e]=.5*g/(f+g);d[n]=.5*f/(f+g);a.h[0]+=d[e]*b.h[0]+d[n]*c.h[0];a.h[1]+=d[e]*b.h[1]+d[n]*c.h[1];a.h[2]+=d[e]*b.h[2]+d[n]*c.h[2]}
function oa(a,b){var c=U(b),d=b.f,e=c.f;if(t(d.a,e.a)){if(0<v(z(e),d.a,e.a))return!1;if(!s(d.a,e.a))K(e.b),E(d,J(e)),b.a=c.a=!0;else if(d.a!==e.a){var c=a.e,f=d.a.i;if(0<=f){var c=c.b,g=c.c,n=c.a,k=n[f].b;g[k].a=g[c.b].a;n[g[k].a].b=k;k<=--c.b&&(1>=k||c.g(n[g[k>>1].a].a,n[g[k].a].a)?ta(c,k):ua(c,k));n[f].a=null;n[f].b=c.d;c.d=f}else for(c.c[-(f+1)]=null;0<c.a&&null===c.c[c.d[c.a-1]];)--c.a;ra(a,J(e),d)}}else{if(0>v(z(d),e.a,d.a))return!1;T(b).a=b.a=!0;K(d.b);E(J(e),d)}return!0}
function va(a,b){var c=U(b),d=b.f,e=c.f,f=d.a,g=e.a,n=z(d),k=z(e),h=new N;v(n,a.a,f);v(k,a.a,g);if(f===g||Math.min(f.a,n.a)>Math.max(g.a,k.a))return!1;if(t(f,g)){if(0<v(k,f,g))return!1}else if(0>v(n,g,f))return!1;var l=n,q=f,r=k,y=g,p,w;t(l,q)||(p=l,l=q,q=p);t(r,y)||(p=r,r=y,y=p);t(l,r)||(p=l,l=r,r=p,p=q,q=y,y=p);t(r,q)?t(q,y)?(p=u(l,r,q),w=u(r,q,y),0>p+w&&(p=-p,w=-w),h.b=A(p,r.b,w,q.b)):(p=v(l,r,q),w=-v(l,y,q),0>p+w&&(p=-p,w=-w),h.b=A(p,r.b,w,y.b)):h.b=(r.b+q.b)/2;x(l,q)||(p=l,l=q,q=p);x(r,y)||(p=
r,r=y,y=p);x(l,r)||(p=l,l=r,r=p,p=q,q=y,y=p);x(r,q)?x(q,y)?(p=aa(l,r,q),w=aa(r,q,y),0>p+w&&(p=-p,w=-w),h.a=A(p,r.a,w,q.a)):(p=ba(l,r,q),w=-ba(l,y,q),0>p+w&&(p=-p,w=-w),h.a=A(p,r.a,w,y.a)):h.a=(r.a+q.a)/2;t(h,a.a)&&(h.b=a.a.b,h.a=a.a.a);l=t(f,g)?f:g;t(l,h)&&(h.b=l.b,h.a=l.a);if(s(h,f)||s(h,g))return oa(a,b),!1;if(!s(n,a.a)&&0<=v(n,a.a,h)||!s(k,a.a)&&0>=v(k,a.a,h)){if(k===a.a)return K(d.b),E(e.b,d),b=S(b),d=U(b).f,W(U(b),c),X(a,b,J(d),d,d,!0),!0;if(n===a.a){K(e.b);E(d.e,J(e));f=c=b;g=z(f.f);do f=T(f);
while(z(f.f)===g);b=f;f=U(b).f.b.c;c.f=J(e);e=W(c,null);X(a,b,e.c,d.b.c,f,!0);return!0}0<=v(n,a.a,h)&&(T(b).a=b.a=!0,K(d.b),d.a.b=a.a.b,d.a.a=a.a.a);0>=v(k,a.a,h)&&(b.a=c.a=!0,K(e.b),e.a.b=a.a.b,e.a.a=a.a.a);return!1}K(d.b);K(e.b);E(J(e),d);d.a.b=h.b;d.a.a=h.a;d.a.i=wa(a.e,d.a);d=d.a;e=[0,0,0,0];h=[f.d,n.d,g.d,k.d];d.h[0]=d.h[1]=d.h[2]=0;sa(d,f,n,e,0);sa(d,g,k,e,2);qa(a,d,h,e,!0);T(b).a=b.a=c.a=!0;return!1}
function pa(a,b){for(var c=U(b);;){for(;c.a;)b=c,c=U(c);if(!b.a&&(c=b,b=T(b),null===b||!b.a))break;b.a=!1;var d=b.f,e=c.f,f;if(f=z(d)!==z(e))a:{f=b;var g=U(f),n=f.f,k=g.f,h=void 0;if(t(z(n),z(k))){if(0>v(z(n),z(k),n.a)){f=!1;break a}T(f).a=f.a=!0;h=K(n);E(k.b,h);h.d.c=f.c}else{if(0<v(z(k),z(n),k.a)){f=!1;break a}f.a=g.a=!0;h=K(k);E(n.e,k.b);h.b.d.c=f.c}f=!0}f&&(c.b?(Q(c),I(e),c=U(b),e=c.f):b.b&&(Q(b),I(d),b=T(c),d=b.f));if(d.a!==e.a)if(z(d)===z(e)||b.b||c.b||z(d)!==a.a&&z(e)!==a.a)oa(a,b);else if(va(a,
b))break;d.a===e.a&&z(d)===z(e)&&(P(e,d),Q(b),I(d),b=T(c))}}
function xa(a,b){a.a=b;for(var c=b.c;null===c.j;)if(c=c.c,c===b.c){var c=a,d=b,e=new V;e.f=d.c.b;var f=c.i,g=f.a;do g=g.a;while(null!==g.b&&!f.c(f.b,e,g.b));var f=g.b,n=U(f),e=f.f,g=n.f;if(0===v(z(e),d,e.a))e=f.f,s(e.a,d)||s(z(e),d)||(K(e.b),f.b&&(I(e.c),f.b=!1),E(d.c,e),xa(c,d));else{var k=t(z(g),z(e))?f:n,n=void 0;f.c||k.b?(k===f?n=L(d.c.b,e.e):n=L(g.b.c.b,d.c).b,k.b?R(k,n):(e=c,f=ka(c,f,n),f.e=T(f).e+f.f.g,f.c=ma(e,f.e)),xa(c,d)):X(c,f,d.c,d.c,null,!0)}return}c=S(c.j);e=U(c);f=e.f;e=W(e,null);
if(e.c===f){var f=e,e=f.c,g=U(c),n=c.f,k=g.f,h=!1;z(n)!==z(k)&&va(a,c);s(n.a,a.a)&&(E(J(e),n),c=S(c),e=U(c).f,W(U(c),g),h=!0);s(k.a,a.a)&&(E(f,J(k)),f=W(g,null),h=!0);h?X(a,c,f.c,e,e,!0):(t(k.a,n.a)?d=J(k):d=n,d=L(f.c.b,d),X(a,c,d,d.c,d.c,!1),d.b.j.b=!0,pa(a,c))}else X(a,c,e.c,f,f,!0)}function ya(a,b){var c=new V,d=ea(a.b);d.a.b=O;d.a.a=b;z(d).b=-O;z(d).a=b;a.a=z(d);c.f=d;c.e=0;c.c=!1;c.b=!1;c.g=!0;c.a=!1;d=a.i;d=la(d,d.a,c);c.d=d};function za(a){this.a=new Aa;this.a.a=this.a;this.a.c=this.a;this.b=a;this.c=ja}function la(a,b,c){do b=b.c;while(null!==b.b&&!a.c(a.b,b.b,c));a=new Aa;a.b=c;a.a=b.a;b.a.c=a;a.c=b;return b.a=a};function Aa(){this.c=this.a=this.b=null};function Ba(){this.h=[0,0,0];this.a=null};function Z(){this.d=0;this.D=this.b=this.r=null;this.o=[0,0,0];this.J=[0,0,0];this.j=[0,0,0];this.F=0;this.y=100130;this.w=!1;this.B=this.a=this.e=this.i=null;this.s=!1;this.c=this.A=this.C=this.t=this.m=this.p=this.k=this.x=this.u=this.n=this.q=this.l=null;this.v=!1;this.g=0;this.z=Array(100);for(var a=0;100>a;a++)this.z[a]=new Ba}m=Z.prototype;m.K=function(){$(this,0)};
m.P=function(a,b){switch(a){case 100142:if(0>b||1<b)break;this.F=b;return;case 100140:switch(b){case 100130:case 100131:case 100132:case 100133:case 100134:this.y=b;return}break;case 100141:this.s=!!b;return;default:Y(this,100900);return}Y(this,100901)};m.L=function(a){switch(a){case 100142:return this.F;case 100140:return this.y;case 100141:return this.s;default:Y(this,100900)}return!1};m.O=function(a,b,c){this.o[0]=a;this.o[1]=b;this.o[2]=c};
m.M=function(a,b){var c=b?b:null;switch(a){case 100100:this.l=c;break;case 100106:this.k=c;break;case 100104:this.q=c;break;case 100110:this.p=c;break;case 100101:this.n=c;break;case 100107:this.m=c;break;case 100102:this.u=c;break;case 100108:this.t=c;break;case 100103:this.D=c;break;case 100109:this.C=c;break;case 100105:this.B=c;break;case 100111:this.A=c;break;case 100112:this.x=c;break;default:Y(this,100900)}};
m.Q=function(a,b){var c=!1,d=[0,0,0];$(this,2);this.v&&(Ca(this),this.r=null);for(var e=0;3>e;++e){var f=a[e];-1E150>f&&(f=-1E150,c=!0);1E150<f&&(f=1E150,c=!0);d[e]=f}c&&Y(this,100155);if(null===this.b){if(100>this.g){c=this.z[this.g];c.a=b;c.h[0]=d[0];c.h[1]=d[1];c.h[2]=d[2];++this.g;return}Ca(this)}Da(this,d,b)};m.H=function(a){$(this,0);this.d=1;this.g=0;this.v=!1;this.b=null;this.c=a};m.G=function(){$(this,1);this.d=2;this.r=null;0<this.g&&(this.v=!0)};m.I=function(){$(this,2);this.d=1};
m.N=function(){$(this,1);this.d=0;null===this.b&&Ca(this);var a=!1,b=[0,0,0];b[0]=this.o[0];b[1]=this.o[1];b[2]=this.o[2];if(0===b[0]&&0===b[1]&&0===b[2]){var c=[0,0,0],d=[0,0,0],a=[0,0,0],e=[0,0,0],f=[0,0,0];c[0]=c[1]=c[2]=-2*1E150;d[0]=d[1]=d[2]=2*1E150;var g=Array(3),n=Array(3),k,h,l=this.b.c;for(h=l.e;h!==l;h=h.e)for(k=0;3>k;++k){var q=h.h[k];q<d[k]&&(d[k]=q,n[k]=h);q>c[k]&&(c[k]=q,g[k]=h)}k=0;c[1]-d[1]>c[0]-d[0]&&(k=1);c[2]-d[2]>c[k]-d[k]&&(k=2);if(d[k]>=c[k])b[0]=0,b[1]=0,b[2]=1;else{c=0;h=
n[k];g=g[k];a[0]=h.h[0]-g.h[0];a[1]=h.h[1]-g.h[1];a[2]=h.h[2]-g.h[2];for(h=l.e;h!==l;h=h.e)e[0]=h.h[0]-g.h[0],e[1]=h.h[1]-g.h[1],e[2]=h.h[2]-g.h[2],f[0]=a[1]*e[2]-a[2]*e[1],f[1]=a[2]*e[0]-a[0]*e[2],f[2]=a[0]*e[1]-a[1]*e[0],k=f[0]*f[0]+f[1]*f[1]+f[2]*f[2],k>c&&(c=k,b[0]=f[0],b[1]=f[1],b[2]=f[2]);0>=c&&(b[0]=b[1]=b[2]=0,b[ia(a)]=1)}a=!0}e=this.J;f=this.j;l=ia(b);e[l]=0;e[(l+1)%3]=1;e[(l+2)%3]=0;f[l]=0;f[(l+1)%3]=0<b[l]?-0:0;f[(l+2)%3]=0<b[l]?1:-1;b=this.b.c;for(l=b.e;l!==b;l=l.e)l.b=ha(l.h,e),l.a=ha(l.h,
f);if(a){b=0;a=this.b.a;for(e=a.b;e!==a;e=e.b)if(f=e.a,!(0>=f.g)){do b+=(f.a.b-z(f).b)*(f.a.a+z(f).a),f=f.e;while(f!==e.a)}if(0>b){b=this.b.c;for(a=b.e;a!==b;a=a.e)a.a=-a.a;this.j[0]=-this.j[0];this.j[1]=-this.j[1];this.j[2]=-this.j[2]}}this.w=!1;b=this.b.b;for(e=b.i;e!==b;e=a)if(a=e.i,f=e.e,s(e.a,z(e))&&e.e.e!==e&&(ra(this,f,e),I(e),e=f,f=e.e),f.e===e){if(f!==e){if(f===a||f===a.b)a=a.i;I(f)}if(e===a||e===a.b)a=a.i;I(e)}this.e=b=new Ea;a=this.b.c;for(e=a.e;e!==a;e=e.e)e.i=wa(b,e);Fa(b);this.i=new za(this);
ya(this,-O);for(ya(this,O);null!==(b=Ga(this.e));){for(;;){a:if(a=this.e,0===a.a)a=Ha(a.b);else{e=a.c[a.d[a.a-1]];if(0!==a.b.b&&(f=Ha(a.b),a.g(f,e))){a=f;break a}a=e}if(null===a||!s(a,b))break;a=Ga(this.e);ra(this,b.c,a.c)}xa(this,b)}this.a=this.i.a.a.b.f.a;for(b=0;null!==(a=this.i.a.a.b);)a.g||++b,Q(a);this.i=null;b=this.e;a=b.b;a.a=null;a.c=null;b.b=null;b.d=null;this.e=b.c=null;b=this.b;for(e=b.a.b;e!==b.a;e=a)a=e.b,e=e.a,e.e.e===e&&(P(e.c,e),I(e));if(!this.w){if(this.s)for(b=this.b,e=b.b.i;e!==
b.b;e=a)a=e.i,e.b.d.c!==e.d.c?e.g=e.d.c?1:-1:I(e);else for(b=this.b,e=b.a.b;e!==b.a;e=a)if(a=e.b,e.c){for(e=e.a;t(z(e),e.a);e=e.c.b);for(;t(e.a,z(e));e=e.e);f=e.c.b;for(l=void 0;e.e!==f;)if(t(z(e),f.a)){for(;f.e!==e&&(ca(f.e)||0>=v(f.a,z(f),z(f.e)));)l=L(f.e,f),f=l.b;f=f.c.b}else{for(;f.e!==e&&(da(e.c.b)||0<=v(z(e),e.a,e.c.b.a));)l=L(e,e.c.b),e=l.b;e=e.e}for(;f.e.e!==e;)l=L(f.e,f),f=l.b}if(this.l||this.u||this.n||this.q||this.k||this.t||this.m||this.p)if(this.s)for(b=this.b,a=b.a.b;a!==b.a;a=a.b){if(a.c){this.k?
this.k(2,this.c):this.l&&this.l(2);e=a.a;do f=e.a.d,this.m?this.m(f,this.c):this.n&&this.n(f),e=e.e;while(e!==a.a);Ia(this)}}else{b=this.b;a=!(!this.q&&!this.p);e=!1;f=-1;for(l=b.a.d;l!==b.a;l=l.d)if(l.c){e||(this.k?this.k(4,this.c):this.l&&this.l(4),e=!0);h=l.a;do a&&(g=h.b.d.c?0:1,f!==g&&(f=g,g=!!f,this.p?this.p(g,this.c):this.q&&this.q(g))),g=h.a.d,this.m?this.m(g,this.c):this.n&&this.n(g),h=h.e;while(h!==l.a)}e&&Ia(this)}if(this.x){b=this.b;for(e=b.a.b;e!==b.a;e=a)if(a=e.b,!e.c){f=e.a;l=f.e;h=
void 0;do h=l,l=h.e,h.d=null,null===h.b.d&&(h.c===h?F(h.a,null):(h.a.c=h.c,H(h,J(h))),g=h.b,g.c===g?F(g.a,null):(g.a.c=g.c,H(g,J(g))),fa(h));while(h!==f);f=e.d;e=e.b;e.d=f;f.b=e}this.x(this.b);this.c=this.b=null;return}}this.b=this.c=null};function $(a,b){if(a.d!==b)for(;a.d!==b;)if(a.d<b)switch(a.d){case 0:Y(a,100151);a.H(null);break;case 1:Y(a,100152),a.G()}else switch(a.d){case 2:Y(a,100154);a.I();break;case 1:Y(a,100153);var c=a;c.d=0;c.r=null;c.b=null}}
function Da(a,b,c){var d=a.r;null===d?(d=ea(a.b),E(d,d.b)):(K(d),d=d.e);d.a.d=c;d.a.h[0]=b[0];d.a.h[1]=b[1];d.a.h[2]=b[2];d.g=1;d.b.g=-1;a.r=d}function Ca(a){a.b=new Ja;for(var b=0;b<a.g;b++){var c=a.z[b];Da(a,c.h,c.a)}a.g=0;a.v=!1}function Ia(a){a.t?a.t(a.c):a.u&&a.u()}function Y(a,b){a.C?a.C(b,a.c):a.D&&a.D(b)};function ga(a,b){this.b=a||this;this.d=b||this;this.a=null;this.c=!1};function M(){this.i=this;this.j=this.d=this.a=this.e=this.c=this.b=null;this.g=0}function z(a){return a.b.a}function J(a){return a.b.e};function Ja(){this.c=new N;this.a=new ga;this.b=new M;this.d=new M;this.b.b=this.d;this.d.b=this.b};function N(a,b){this.e=a||this;this.g=b||this;this.d=this.c=null;this.h=[0,0,0];this.a=this.b=0;this.i=null};function Ka(){this.a=null;this.b=0}function La(a,b){var c=Array(b),d=0;if(null!==a)for(;d<a.length;d++)c[d]=a[d];for(;d<b;d++)c[d]=new Ka;return c};function Ma(){this.a=0}function Na(a,b){var c=Array(b),d=0;if(null!==a)for(;d<a.length;d++)c[d]=a[d];for(;d<b;d++)c[d]=new Ma;return c};function Ea(){this.c=Oa(null,32);this.d=null;this.a=0;this.e=32;this.i=!1;this.g=t;this.b=new Pa(this.g)}function Fa(a){a.d=[];for(var b=0;b<a.a;b++)a.d[b]=b;a.d.sort(function(a,b){return function(e,f){return b(a[e],a[f])?1:-1}}(a.c,a.g));a.e=a.a;a.i=!0;Qa(a.b)}
function wa(a,b){if(a.i){var c=a.b,d=++c.b;2*d>c.e&&(c.e*=2,c.c=Na(c.c,c.e+1),c.a=La(c.a,c.e+1));var e;0===c.d?e=d:(e=c.d,c.d=c.a[e].b);c.c[d].a=e;c.a[e].b=d;c.a[e].a=b;c.i&&ua(c,d);return e}c=a.a;++a.a>=a.e&&(a.e*=2,a.c=Oa(a.c,a.e));a.c[c]=b;return-(c+1)}function Oa(a,b){var c=Array(b),d=0;if(null!==a)for(;d<a.length;d++)c[d]=a[d];for(;d<b;d++)c[d]=null;return c}
function Ga(a){if(0===a.a)return Ra(a.b);var b=a.c[a.d[a.a-1]];if(0!==a.b.b&&a.g(Ha(a.b),b))return Ra(a.b);do--a.a;while(0<a.a&&null===a.c[a.d[a.a-1]]);return b};function Pa(a){this.c=Na(null,33);this.a=La(null,33);this.b=0;this.e=32;this.d=0;this.i=!1;this.g=a;this.c[1].a=1}function Qa(a){for(var b=a.b;1<=b;--b)ta(a,b);a.i=!0}function Ha(a){return a.a[a.c[1].a].a}function Ra(a){var b=a.c,c=a.a,d=b[1].a,e=c[d].a;0<a.b&&(b[1].a=b[a.b].a,c[b[1].a].b=1,c[d].a=null,c[d].b=a.d,a.d=d,0<--a.b&&ta(a,1));return e}
function ta(a,b){for(var c=a.c,d=a.a,e=c[b].a;;){var f=b<<1;f<a.b&&a.g(d[c[f+1].a].a,d[c[f].a].a)&&++f;var g=c[f].a;if(f>a.b||a.g(d[e].a,d[g].a)){c[b].a=e;d[e].b=b;break}c[b].a=g;d[g].b=b;b=f}}function ua(a,b){for(var c=a.c,d=a.a,e=c[b].a;;){var f=b>>1,g=c[f].a;if(0===f||a.g(d[g].a,d[e].a)){c[b].a=e;d[e].b=b;break}c[b].a=g;d[g].b=b;b=f}};function V(){this.d=this.f=null;this.e=0;this.b=this.a=this.g=this.c=!1}function U(a){return a.d.c.b}function T(a){return a.d.a.b};this.libtess={GluTesselator:Z,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},
gluEnum:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}};Z.prototype.gluDeleteTess=Z.prototype.K;
Z.prototype.gluTessProperty=Z.prototype.P;Z.prototype.gluGetTessProperty=Z.prototype.L;Z.prototype.gluTessNormal=Z.prototype.O;Z.prototype.gluTessCallback=Z.prototype.M;Z.prototype.gluTessVertex=Z.prototype.Q;Z.prototype.gluTessBeginPolygon=Z.prototype.H;Z.prototype.gluTessBeginContour=Z.prototype.G;Z.prototype.gluTessEndContour=Z.prototype.I;Z.prototype.gluTessEndPolygon=Z.prototype.N; if (typeof module !== 'undefined') { module.exports = this.libtess; }
'use strict';var k;function s(a,b){return a.b===b.b&&a.a===b.a}function t(a,b){return a.b<b.b||a.b===b.b&&a.a<=b.a}function u(a,b,c){var d=b.b-a.b,f=c.b-b.b;return 0<d+f?d<f?b.a-a.a+d/(d+f)*(a.a-c.a):b.a-c.a+f/(d+f)*(c.a-a.a):0}function v(a,b,c){var d=b.b-a.b,f=c.b-b.b;return 0<d+f?(b.a-c.a)*d+(b.a-a.a)*f:0}function x(a,b){return a.a<b.a||a.a===b.a&&a.b<=b.b}function aa(a,b,c){var d=b.a-a.a,f=c.a-b.a;return 0<d+f?d<f?b.b-a.b+d/(d+f)*(a.b-c.b):b.b-c.b+f/(d+f)*(c.b-a.b):0}
function ba(a,b,c){var d=b.a-a.a,f=c.a-b.a;return 0<d+f?(b.b-c.b)*d+(b.b-a.b)*f:0}function ca(a){return t(z(a),a.a)}function da(a){return t(a.a,z(a))}function A(a,b,c,d){a=0>a?0:a;c=0>c?0:c;return a<=c?0===c?(b+d)/2:b+a/(a+c)*(d-b):d+c/(a+c)*(b-d)};function ea(a){var b=B(a.b);C(b,a.c);C(b.b,a.c);D(b,a.a);return b}function E(a,b){var c=!1,d=!1;a!==b&&(b.a!==a.a&&(d=!0,F(b.a,a.a)),b.d!==a.d&&(c=!0,G(b.d,a.d)),H(b,a),d||(C(b,a.a),a.a.c=a),c||(D(b,a.d),a.d.a=a))}function I(a){var b=a.b,c=!1;a.d!==a.b.d&&(c=!0,G(a.d,a.b.d));a.c===a?F(a.a,null):(a.b.d.a=J(a),a.a.c=a.c,H(a,J(a)),c||D(a,a.d));b.c===b?(F(b.a,null),G(b.d,null)):(a.d.a=J(b),b.a.c=b.c,H(b,J(b)));fa(a)}
function K(a){var b=B(a),c=b.b;H(b,a.e);b.a=z(a);C(c,b.a);b.d=c.d=a.d;b=b.b;H(a.b,J(a.b));H(a.b,b);a.b.a=b.a;z(b).c=b.b;b.b.d=a.b.d;b.f=a.f;b.b.f=a.b.f;return b}function L(a,b){var c=!1,d=B(a),f=d.b;b.d!==a.d&&(c=!0,G(b.d,a.d));H(d,a.e);H(f,b);d.a=z(a);f.a=b.a;d.d=f.d=a.d;a.d.a=f;c||D(d,a.d);return d}function B(a){var b=new M,c=new M,d=a.b.h;c.h=d;d.b.h=b;b.h=a;a.b.h=c;b.b=c;b.c=b;b.e=c;c.b=b;c.c=c;return c.e=b}function H(a,b){var c=a.c,d=b.c;c.b.e=b;d.b.e=a;a.c=d;b.c=c}
function C(a,b){var c=b.f,d=new N(b,c);c.e=d;b.f=d;c=d.c=a;do c.a=d,c=c.c;while(c!==a)}function D(a,b){var c=b.d,d=new ga(b,c);c.b=d;b.d=d;d.a=a;d.c=b.c;c=a;do c.d=d,c=c.e;while(c!==a)}function fa(a){var b=a.h;a=a.b.h;b.b.h=a;a.b.h=b}function F(a,b){var c=a.c,d=c;do d.a=b,d=d.c;while(d!==c);c=a.f;d=a.e;d.f=c;c.e=d}function G(a,b){var c=a.a,d=c;do d.d=b,d=d.e;while(d!==c);c=a.d;d=a.b;d.d=c;c.b=d};function ha(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}function ia(a){var b=0;Math.abs(a[1])>Math.abs(a[0])&&(b=1);Math.abs(a[2])>Math.abs(a[b])&&(b=2);return b};var O=4*1E150;function P(a,b){a.f+=b.f;a.b.f+=b.b.f}function ja(a,b,c){a=a.a;b=b.a;c=c.a;if(z(b)===a)return z(c)===a?t(b.a,c.a)?0>=v(z(c),b.a,c.a):0<=v(z(b),c.a,b.a):0>=v(z(c),a,c.a);if(z(c)===a)return 0<=v(z(b),a,b.a);b=u(z(b),a,b.a);a=u(z(c),a,c.a);return b>=a}function Q(a){a.a.i=null;var b=a.e;b.a.c=b.c;b.c.a=b.a;a.e=null}function R(a,b){I(a.a);a.c=!1;a.a=b;b.i=a}function S(a){var b=a.a.a;do a=T(a);while(a.a.a===b);a.c&&(b=L(U(a).a.b,a.a.e),R(a,b),a=T(a));return a}
function ka(a,b,c){var d=new V;d.a=c;d.e=la(a.h,b.e,d);return c.i=d}function ma(a,b){switch(a.x){case 100130:return 0!==(b&1);case 100131:return 0!==b;case 100132:return 0<b;case 100133:return 0>b;case 100134:return 2<=b||-2>=b}return!1}function na(a){var b=a.a,c=b.d;c.c=a.d;c.a=b;Q(a)}function W(a,b){for(var c=a,d=a.a;c!==b;){c.c=!1;var f=U(c),g=f.a;if(g.a!==d.a){if(!f.c){na(c);break}g=L(d.c.b,g.b);R(f,g)}d.c!==g&&(E(J(g),g),E(d,g));na(c);d=f.a;c=f}return d}
function X(a,b,c,d,f,g){var e=!0;do ka(a,b,c.b),c=c.c;while(c!==d);for(null===f&&(f=U(b).a.b.c);;){d=U(b);c=d.a.b;if(c.a!==f.a)break;c.c!==f&&(E(J(c),c),E(J(f),c));d.f=b.f-c.f;d.d=ma(a,d.f);b.b=!0;!e&&oa(a,b)&&(P(c,f),Q(b),I(f));e=!1;b=d;f=c}b.b=!0;g&&pa(a,b)}function qa(a,b,c,d,f){var g=[b.g[0],b.g[1],b.g[2]];b.d=null;var e;a.z?e=a.z(g,c,d,a.c):a.A&&(e=a.A(g,c,d));void 0===e&&(e=null);b.d=e;null===b.d&&(f?a.v||(Y(a,100156),a.v=!0):b.d=c[0])}
function ra(a,b,c){var d=[null,null,null,null];d[0]=b.a.d;d[1]=c.a.d;qa(a,b.a,d,[.5,.5,0,0],!1);E(b,c)}function sa(a,b,c,d,f){var g=Math.abs(b.b-a.b)+Math.abs(b.a-a.a),e=Math.abs(c.b-a.b)+Math.abs(c.a-a.a),h=f+1;d[f]=.5*e/(g+e);d[h]=.5*g/(g+e);a.g[0]+=d[f]*b.g[0]+d[h]*c.g[0];a.g[1]+=d[f]*b.g[1]+d[h]*c.g[1];a.g[2]+=d[f]*b.g[2]+d[h]*c.g[2]}
function oa(a,b){var c=U(b),d=b.a,f=c.a;if(t(d.a,f.a)){if(0<v(z(f),d.a,f.a))return!1;if(!s(d.a,f.a))K(f.b),E(d,J(f)),b.b=c.b=!0;else if(d.a!==f.a){var c=a.e,g=d.a.h;if(0<=g){var c=c.b,e=c.c,h=c.a,l=h[g].b;e[l].a=e[c.b].a;h[e[l].a].b=l;l<=--c.b&&(1>=l||c.f(h[e[l>>1].a].a,h[e[l].a].a)?ta(c,l):ua(c,l));h[g].a=null;h[g].b=c.d;c.d=g}else for(c.c[-(g+1)]=null;0<c.a&&null===c.c[c.d[c.a-1]];)--c.a;ra(a,J(f),d)}}else{if(0>v(z(d),f.a,d.a))return!1;T(b).b=b.b=!0;K(d.b);E(J(f),d)}return!0}
function va(a,b){var c=U(b),d=b.a,f=c.a,g=d.a,e=f.a,h=z(d),l=z(f),n=new N;v(h,a.a,g);v(l,a.a,e);if(g===e||Math.min(g.a,h.a)>Math.max(e.a,l.a))return!1;if(t(g,e)){if(0<v(l,g,e))return!1}else if(0>v(h,e,g))return!1;var r=h,p=g,q=l,y=e,m,w;t(r,p)||(m=r,r=p,p=m);t(q,y)||(m=q,q=y,y=m);t(r,q)||(m=r,r=q,q=m,m=p,p=y,y=m);t(q,p)?t(p,y)?(m=u(r,q,p),w=u(q,p,y),0>m+w&&(m=-m,w=-w),n.b=A(m,q.b,w,p.b)):(m=v(r,q,p),w=-v(r,y,p),0>m+w&&(m=-m,w=-w),n.b=A(m,q.b,w,y.b)):n.b=(q.b+p.b)/2;x(r,p)||(m=r,r=p,p=m);x(q,y)||(m=
q,q=y,y=m);x(r,q)||(m=r,r=q,q=m,m=p,p=y,y=m);x(q,p)?x(p,y)?(m=aa(r,q,p),w=aa(q,p,y),0>m+w&&(m=-m,w=-w),n.a=A(m,q.a,w,p.a)):(m=ba(r,q,p),w=-ba(r,y,p),0>m+w&&(m=-m,w=-w),n.a=A(m,q.a,w,y.a)):n.a=(q.a+p.a)/2;t(n,a.a)&&(n.b=a.a.b,n.a=a.a.a);r=t(g,e)?g:e;t(r,n)&&(n.b=r.b,n.a=r.a);if(s(n,g)||s(n,e))return oa(a,b),!1;if(!s(h,a.a)&&0<=v(h,a.a,n)||!s(l,a.a)&&0>=v(l,a.a,n)){if(l===a.a)return K(d.b),E(f.b,d),b=S(b),d=U(b).a,W(U(b),c),X(a,b,J(d),d,d,!0),!0;if(h===a.a){K(f.b);E(d.e,J(f));g=c=b;e=z(g.a);do g=T(g);
while(z(g.a)===e);b=g;g=U(b).a.b.c;c.a=J(f);f=W(c,null);X(a,b,f.c,d.b.c,g,!0);return!0}0<=v(h,a.a,n)&&(T(b).b=b.b=!0,K(d.b),d.a.b=a.a.b,d.a.a=a.a.a);0>=v(l,a.a,n)&&(b.b=c.b=!0,K(f.b),f.a.b=a.a.b,f.a.a=a.a.a);return!1}K(d.b);K(f.b);E(J(f),d);d.a.b=n.b;d.a.a=n.a;d.a.h=wa(a.e,d.a);d=d.a;f=[0,0,0,0];n=[g.d,h.d,e.d,l.d];d.g[0]=d.g[1]=d.g[2]=0;sa(d,g,h,f,0);sa(d,e,l,f,2);qa(a,d,n,f,!0);T(b).b=b.b=c.b=!0;return!1}
function pa(a,b){for(var c=U(b);;){for(;c.b;)b=c,c=U(c);if(!b.b&&(c=b,b=T(b),null===b||!b.b))break;b.b=!1;var d=b.a,f=c.a,g;if(g=z(d)!==z(f))a:{g=b;var e=U(g),h=g.a,l=e.a,n=void 0;if(t(z(h),z(l))){if(0>v(z(h),z(l),h.a)){g=!1;break a}T(g).b=g.b=!0;n=K(h);E(l.b,n);n.d.c=g.d}else{if(0<v(z(l),z(h),l.a)){g=!1;break a}g.b=e.b=!0;n=K(l);E(h.e,l.b);n.b.d.c=g.d}g=!0}g&&(c.c?(Q(c),I(f),c=U(b),f=c.a):b.c&&(Q(b),I(d),b=T(c),d=b.a));if(d.a!==f.a)if(z(d)===z(f)||b.c||c.c||z(d)!==a.a&&z(f)!==a.a)oa(a,b);else if(va(a,
b))break;d.a===f.a&&z(d)===z(f)&&(P(f,d),Q(b),I(d),b=T(c))}}
function xa(a,b){a.a=b;for(var c=b.c;null===c.i;)if(c=c.c,c===b.c){var c=a,d=b,f=new V;f.a=d.c.b;var g=c.h,e=g.a;do e=e.a;while(null!==e.b&&!g.c(g.b,f,e.b));var g=e.b,h=U(g),f=g.a,e=h.a;if(0===v(z(f),d,f.a))f=g.a,s(f.a,d)||s(z(f),d)||(K(f.b),g.c&&(I(f.c),g.c=!1),E(d.c,f),xa(c,d));else{var l=t(z(e),z(f))?g:h,h=void 0;g.d||l.c?(l===g?h=L(d.c.b,f.e):h=L(e.b.c.b,d.c).b,l.c?R(l,h):(f=c,g=ka(c,g,h),g.f=T(g).f+g.a.f,g.d=ma(f,g.f)),xa(c,d)):X(c,g,d.c,d.c,null,!0)}return}c=S(c.i);f=U(c);g=f.a;f=W(f,null);
if(f.c===g){var g=f,f=g.c,e=U(c),h=c.a,l=e.a,n=!1;z(h)!==z(l)&&va(a,c);s(h.a,a.a)&&(E(J(f),h),c=S(c),f=U(c).a,W(U(c),e),n=!0);s(l.a,a.a)&&(E(g,J(l)),g=W(e,null),n=!0);n?X(a,c,g.c,f,f,!0):(t(l.a,h.a)?d=J(l):d=h,d=L(g.c.b,d),X(a,c,d,d.c,d.c,!1),d.b.i.c=!0,pa(a,c))}else X(a,c,f.c,g,g,!0)}function ya(a,b){var c=new V,d=ea(a.b);d.a.b=O;d.a.a=b;z(d).b=-O;z(d).a=b;a.a=z(d);c.a=d;c.f=0;c.d=!1;c.c=!1;c.h=!0;c.b=!1;d=a.h;d=la(d,d.a,c);c.e=d};function za(a){this.a=new Aa;this.b=a;this.c=ja}function la(a,b,c){do b=b.c;while(null!==b.b&&!a.c(a.b,b.b,c));a=new Aa(c,b.a,b);b.a.c=a;return b.a=a};function Aa(a,b,c){this.b=a||null;this.a=b||this;this.c=c||this};function Ba(){this.g=[0,0,0];this.a=null};function Z(){this.d=0;this.C=this.b=this.q=null;this.n=[0,0,0];this.I=[0,0,0];this.i=[0,0,0];this.D=0;this.x=100130;this.v=!1;this.A=this.a=this.e=this.h=null;this.r=!1;this.c=this.z=this.B=this.s=this.l=this.o=this.j=this.w=this.t=this.m=this.p=this.k=null;this.u=!1;this.f=0;this.y=Array(100);for(var a=0;100>a;a++)this.y[a]=new Ba}k=Z.prototype;k.J=function(){$(this,0)};
k.O=function(a,b){switch(a){case 100142:if(0>b||1<b)break;this.D=b;return;case 100140:switch(b){case 100130:case 100131:case 100132:case 100133:case 100134:this.x=b;return}break;case 100141:this.r=!!b;return;default:Y(this,100900);return}Y(this,100901)};k.K=function(a){switch(a){case 100142:return this.D;case 100140:return this.x;case 100141:return this.r;default:Y(this,100900)}return!1};k.N=function(a,b,c){this.n[0]=a;this.n[1]=b;this.n[2]=c};
k.L=function(a,b){var c=b?b:null;switch(a){case 100100:this.k=c;break;case 100106:this.j=c;break;case 100104:this.p=c;break;case 100110:this.o=c;break;case 100101:this.m=c;break;case 100107:this.l=c;break;case 100102:this.t=c;break;case 100108:this.s=c;break;case 100103:this.C=c;break;case 100109:this.B=c;break;case 100105:this.A=c;break;case 100111:this.z=c;break;case 100112:this.w=c;break;default:Y(this,100900)}};
k.P=function(a,b){var c=!1,d=[0,0,0];$(this,2);this.u&&(Ca(this),this.q=null);for(var f=0;3>f;++f){var g=a[f];-1E150>g&&(g=-1E150,c=!0);1E150<g&&(g=1E150,c=!0);d[f]=g}c&&Y(this,100155);if(null===this.b){if(100>this.f){c=this.y[this.f];c.a=b;c.g[0]=d[0];c.g[1]=d[1];c.g[2]=d[2];++this.f;return}Ca(this)}Da(this,d,b)};k.G=function(a){$(this,0);this.d=1;this.f=0;this.u=!1;this.b=null;this.c=a};k.F=function(){$(this,1);this.d=2;this.q=null;0<this.f&&(this.u=!0)};k.H=function(){$(this,2);this.d=1};
k.M=function(){$(this,1);this.d=0;null===this.b&&Ca(this);var a=!1,b=[this.n[0],this.n[1],this.n[2]];if(0===b[0]&&0===b[1]&&0===b[2]){var c=[-2*1E150,-2*1E150,-2*1E150],d=[2*1E150,2*1E150,2*1E150],f=[],g=[],e,a=this.b.c;for(e=a.e;e!==a;e=e.e)for(var h=0;3>h;++h){var l=e.g[h];l<d[h]&&(d[h]=l,g[h]=e);l>c[h]&&(c[h]=l,f[h]=e)}e=0;c[1]-d[1]>c[0]-d[0]&&(e=1);c[2]-d[2]>c[e]-d[e]&&(e=2);if(d[e]>=c[e])b[0]=0,b[1]=0,b[2]=1;else{c=0;d=g[e];f=f[e];g=[0,0,0];d=[d.g[0]-f.g[0],d.g[1]-f.g[1],d.g[2]-f.g[2]];h=[0,
0,0];for(e=a.e;e!==a;e=e.e)h[0]=e.g[0]-f.g[0],h[1]=e.g[1]-f.g[1],h[2]=e.g[2]-f.g[2],g[0]=d[1]*h[2]-d[2]*h[1],g[1]=d[2]*h[0]-d[0]*h[2],g[2]=d[0]*h[1]-d[1]*h[0],l=g[0]*g[0]+g[1]*g[1]+g[2]*g[2],l>c&&(c=l,b[0]=g[0],b[1]=g[1],b[2]=g[2]);0>=c&&(b[0]=b[1]=b[2]=0,b[ia(d)]=1)}a=!0}e=this.I;c=this.i;f=ia(b);e[f]=0;e[(f+1)%3]=1;e[(f+2)%3]=0;c[f]=0;c[(f+1)%3]=0<b[f]?-0:0;c[(f+2)%3]=0<b[f]?1:-1;b=this.b.c;for(f=b.e;f!==b;f=f.e)f.b=ha(f.g,e),f.a=ha(f.g,c);if(a){b=0;a=this.b.a;for(e=a.b;e!==a;e=e.b)if(c=e.a,!(0>=
c.f)){do b+=(c.a.b-z(c).b)*(c.a.a+z(c).a),c=c.e;while(c!==e.a)}if(0>b){b=this.b.c;for(a=b.e;a!==b;a=a.e)a.a=-a.a;this.i[0]=-this.i[0];this.i[1]=-this.i[1];this.i[2]=-this.i[2]}}this.v=!1;b=this.b.b;for(e=b.h;e!==b;e=a)if(a=e.h,c=e.e,s(e.a,z(e))&&e.e.e!==e&&(ra(this,c,e),I(e),e=c,c=e.e),c.e===e){if(c!==e){if(c===a||c===a.b)a=a.h;I(c)}if(e===a||e===a.b)a=a.h;I(e)}this.e=b=new Ea;a=this.b.c;for(e=a.e;e!==a;e=e.e)e.h=wa(b,e);Fa(b);this.h=new za(this);ya(this,-O);for(ya(this,O);null!==(b=Ga(this.e));){for(;;){a:if(a=
this.e,0===a.a)a=Ha(a.b);else{e=a.c[a.d[a.a-1]];if(0!==a.b.b&&(c=Ha(a.b),a.f(c,e))){a=c;break a}a=e}if(null===a||!s(a,b))break;a=Ga(this.e);ra(this,b.c,a.c)}xa(this,b)}this.a=this.h.a.a.b.a.a;for(b=0;null!==(a=this.h.a.a.b);)a.h||++b,Q(a);this.h=null;b=this.e;a=b.b;a.a=null;a.c=null;b.b=null;b.d=null;this.e=b.c=null;b=this.b;for(e=b.a.b;e!==b.a;e=a)a=e.b,e=e.a,e.e.e===e&&(P(e.c,e),I(e));if(!this.v){b=this.b;if(this.r)for(e=b.b.h;e!==b.b;e=a)a=e.h,e.b.d.c!==e.d.c?e.f=e.d.c?1:-1:I(e);else for(e=b.a.b;e!==
b.a;e=a)if(a=e.b,e.c){for(e=e.a;t(z(e),e.a);e=e.c.b);for(;t(e.a,z(e));e=e.e);c=e.c.b;for(f=void 0;e.e!==c;)if(t(z(e),c.a)){for(;c.e!==e&&(ca(c.e)||0>=v(c.a,z(c),z(c.e)));)f=L(c.e,c),c=f.b;c=c.c.b}else{for(;c.e!==e&&(da(e.c.b)||0<=v(z(e),e.a,e.c.b.a));)f=L(e,e.c.b),e=f.b;e=e.e}for(;c.e.e!==e;)f=L(c.e,c),c=f.b}if(this.k||this.t||this.m||this.p||this.j||this.s||this.l||this.o)if(this.r)for(b=this.b,a=b.a.b;a!==b.a;a=a.b){if(a.c){this.j?this.j(2,this.c):this.k&&this.k(2);e=a.a;do c=e.a.d,this.l?this.l(c,
this.c):this.m&&this.m(c),e=e.e;while(e!==a.a);Ia(this)}}else{b=this.b;a=!(!this.p&&!this.o);e=!1;c=-1;for(f=b.a.d;f!==b.a;f=f.d)if(f.c){e||(this.j?this.j(4,this.c):this.k&&this.k(4),e=!0);g=f.a;do a&&(d=g.b.d.c?0:1,c!==d&&(c=d,d=!!c,this.o?this.o(d,this.c):this.p&&this.p(d))),d=g.a.d,this.l?this.l(d,this.c):this.m&&this.m(d),g=g.e;while(g!==f.a)}e&&Ia(this)}if(this.w){b=this.b;for(e=b.a.b;e!==b.a;e=a)if(a=e.b,!e.c){c=e.a;f=c.e;g=void 0;do g=f,f=g.e,g.d=null,null===g.b.d&&(g.c===g?F(g.a,null):(g.a.c=
g.c,H(g,J(g))),d=g.b,d.c===d?F(d.a,null):(d.a.c=d.c,H(d,J(d))),fa(g));while(g!==c);c=e.d;e=e.b;e.d=c;c.b=e}this.w(this.b);this.c=this.b=null;return}}this.b=this.c=null};function $(a,b){if(a.d!==b)for(;a.d!==b;)if(a.d<b)switch(a.d){case 0:Y(a,100151);a.G(null);break;case 1:Y(a,100152),a.F()}else switch(a.d){case 2:Y(a,100154);a.H();break;case 1:Y(a,100153);var c=a;c.d=0;c.q=null;c.b=null}}
function Da(a,b,c){var d=a.q;null===d?(d=ea(a.b),E(d,d.b)):(K(d),d=d.e);d.a.d=c;d.a.g[0]=b[0];d.a.g[1]=b[1];d.a.g[2]=b[2];d.f=1;d.b.f=-1;a.q=d}function Ca(a){a.b=new Ja;for(var b=0;b<a.f;b++){var c=a.y[b];Da(a,c.g,c.a)}a.f=0;a.u=!1}function Ia(a){a.s?a.s(a.c):a.t&&a.t()}function Y(a,b){a.B?a.B(b,a.c):a.C&&a.C(b)};function ga(a,b){this.b=a||this;this.d=b||this;this.a=null;this.c=!1};function M(){this.h=this;this.i=this.d=this.a=this.e=this.c=this.b=null;this.f=0}function z(a){return a.b.a}function J(a){return a.b.e};function Ja(){this.c=new N;this.a=new ga;this.b=new M;this.d=new M;this.b.b=this.d;this.d.b=this.b};function N(a,b){this.e=a||this;this.f=b||this;this.d=this.c=null;this.g=[0,0,0];this.a=this.b=0;this.h=null};function Ka(){this.a=null;this.b=0}function La(a,b){var c=Array(b),d=0;if(null!==a)for(;d<a.length;d++)c[d]=a[d];for(;d<b;d++)c[d]=new Ka;return c};function Ma(){this.a=0}function Na(a,b){var c=Array(b),d=0;if(null!==a)for(;d<a.length;d++)c[d]=a[d];for(;d<b;d++)c[d]=new Ma;return c};function Ea(){this.c=Oa(null,32);this.d=null;this.a=0;this.e=32;this.h=!1;this.f=t;this.b=new Pa(this.f)}function Fa(a){a.d=[];for(var b=0;b<a.a;b++)a.d[b]=b;a.d.sort(function(a,b){return function(f,g){return b(a[f],a[g])?1:-1}}(a.c,a.f));a.e=a.a;a.h=!0;Qa(a.b)}
function wa(a,b){if(a.h){var c=a.b,d=++c.b;2*d>c.e&&(c.e*=2,c.c=Na(c.c,c.e+1),c.a=La(c.a,c.e+1));var f;0===c.d?f=d:(f=c.d,c.d=c.a[f].b);c.c[d].a=f;c.a[f].b=d;c.a[f].a=b;c.h&&ua(c,d);return f}c=a.a;++a.a>=a.e&&(a.e*=2,a.c=Oa(a.c,a.e));a.c[c]=b;return-(c+1)}function Oa(a,b){var c=Array(b),d=0;if(null!==a)for(;d<a.length;d++)c[d]=a[d];for(;d<b;d++)c[d]=null;return c}
function Ga(a){if(0===a.a)return Ra(a.b);var b=a.c[a.d[a.a-1]];if(0!==a.b.b&&a.f(Ha(a.b),b))return Ra(a.b);do--a.a;while(0<a.a&&null===a.c[a.d[a.a-1]]);return b};function Pa(a){this.c=Na(null,33);this.a=La(null,33);this.b=0;this.e=32;this.d=0;this.h=!1;this.f=a;this.c[1].a=1}function Qa(a){for(var b=a.b;1<=b;--b)ta(a,b);a.h=!0}function Ha(a){return a.a[a.c[1].a].a}function Ra(a){var b=a.c,c=a.a,d=b[1].a,f=c[d].a;0<a.b&&(b[1].a=b[a.b].a,c[b[1].a].b=1,c[d].a=null,c[d].b=a.d,a.d=d,0<--a.b&&ta(a,1));return f}
function ta(a,b){for(var c=a.c,d=a.a,f=c[b].a;;){var g=b<<1;g<a.b&&a.f(d[c[g+1].a].a,d[c[g].a].a)&&++g;var e=c[g].a;if(g>a.b||a.f(d[f].a,d[e].a)){c[b].a=f;d[f].b=b;break}c[b].a=e;d[e].b=b;b=g}}function ua(a,b){for(var c=a.c,d=a.a,f=c[b].a;;){var g=b>>1,e=c[g].a;if(0===g||a.f(d[e].a,d[f].a)){c[b].a=f;d[f].b=b;break}c[b].a=e;d[e].b=b;b=g}};function V(){this.e=this.a=null;this.f=0;this.c=this.b=this.h=this.d=!1}function U(a){return a.e.c.b}function T(a){return a.e.a.b};this.libtess={GluTesselator:Z,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},
gluEnum:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}};Z.prototype.gluDeleteTess=Z.prototype.J;
Z.prototype.gluTessProperty=Z.prototype.O;Z.prototype.gluGetTessProperty=Z.prototype.K;Z.prototype.gluTessNormal=Z.prototype.N;Z.prototype.gluTessCallback=Z.prototype.L;Z.prototype.gluTessVertex=Z.prototype.P;Z.prototype.gluTessBeginPolygon=Z.prototype.G;Z.prototype.gluTessBeginContour=Z.prototype.F;Z.prototype.gluTessEndContour=Z.prototype.H;Z.prototype.gluTessEndPolygon=Z.prototype.M; if (typeof module !== 'undefined') { module.exports = this.libtess; }
{
"name": "libtess",
"version": "1.1.0",
"version": "1.2.0",
"description": "Polygon tesselation library, ported from SGI's GLU implementation.",

@@ -14,2 +14,3 @@ "homepage": "https://github.com/brendankenny/libtess.js/",

"libtess.cat.js",
"libtess.debug.js",
"LICENSE"

@@ -23,3 +24,4 @@ ],

"contributors": [
"Tom Payne <twpayne@gmail.com>"
"Tom Payne <twpayne@gmail.com>",
"Brett Camper <bcamper@alum.mit.edu> (http://vector.io/)"
],

@@ -45,7 +47,7 @@ "licenses": [

"coveralls": "^2.11.2",
"envify": "^3.0.0",
"glob": "^4.0.6",
"envify": "^3.2.0",
"glob": "^4.2.1",
"gulp": "^3.8.8",
"gulp-closure-compiler": "^0.2.7",
"gulp-concat": "^2.4.1",
"gulp-concat": "^2.4.2",
"gulp-filter": "^1.0.2",

@@ -55,3 +57,4 @@ "gulp-istanbul": "^0.3.1",

"gulp-jshint": "^1.8.5",
"gulp-mocha": "^1.1.1",
"gulp-mocha": "^1.1.2",
"gulp-rename": "^1.2.0",
"gulp-replace": "^0.4.0",

@@ -61,4 +64,7 @@ "jshint-stylish": "^1.0.0",

"rfolderify": "^1.3.0",
"rocambole": "^0.3.6",
"rocambole-token": "^1.2.1",
"vinyl-map": "^1.0.1",
"vinyl-source-stream": "^1.0.0"
}
}

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc