TMT-Demo/assets/earcut.b6f90e68.js

2 lines
6.9 KiB
JavaScript
Raw Normal View History

var ee=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function ne(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function re(e){if(e.__esModule)return e;var r=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach(function(n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}),r}var B={exports:{}};B.exports=z;B.exports.default=z;function z(e,r,n){n=n||2;var t=r&&r.length,x=t?r[0]*n:e.length,u=G(e,0,x,n,!0),f=[];if(!u||u.next===u.prev)return f;var i,v,o,c,h,l,Z;if(t&&(u=Q(e,r,u,n)),e.length>80*n){i=o=e[0],v=c=e[1];for(var p=n;p<x;p+=n)h=e[p],l=e[p+1],h<i&&(i=h),l<v&&(v=l),h>o&&(o=h),l>c&&(c=l);Z=Math.max(o-i,c-v),Z=Z!==0?32767/Z:0}return L(u,f,n,i,v,Z,0),f}function G(e,r,n,t,x){var u,f;if(x===j(e,r,n,t)>0)for(u=r;u<n;u+=t)f=T(u,e[u],e[u+1],f);else for(u=n-t;u>=r;u-=t)f=T(u,e[u],e[u+1],f);return f&&E(f,f.next)&&(H(f),f=f.next),f}function w(e,r){if(!e)return e;r||(r=e);var n=e,t;do if(t=!1,!n.steiner&&(E(n,n.next)||g(n.prev,n,n.next)===0)){if(H(n),n=r=n.prev,n===n.next)break;t=!0}else n=n.next;while(t||n!==r);return r}function L(e,r,n,t,x,u,f){if(!!e){!f&&u&&X(e,t,x,u);for(var i=e,v,o;e.prev!==e.next;){if(v=e.prev,o=e.next,u?$(e,t,x,u):V(e)){r.push(v.i/n|0),r.push(e.i/n|0),r.push(o.i/n|0),H(e),e=o.next,i=o.next;continue}if(e=o,e===i){f?f===1?(e=J(w(e),r,n),L(e,r,n,t,x,u,2)):f===2&&K(e,r,n,t,x,u):L(w(e),r,n,t,x,u,1);break}}}}function V(e){var r=e.prev,n=e,t=e.next;if(g(r,n,t)>=0)return!1;for(var x=r.x,u=n.x,f=t.x,i=r.y,v=n.y,o=t.y,c=x<u?x<f?x:f:u<f?u:f,h=i<v?i<o?i:o:v<o?v:o,l=x>u?x>f?x:f:u>f?u:f,Z=i>v?i>o?i:o:v>o?v:o,p=t.next;p!==r;){if(p.x>=c&&p.x<=l&&p.y>=h&&p.y<=Z&&F(x,i,u,v,f,o,p.x,p.y)&&g(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function $(e,r,n,t){var x=e.prev,u=e,f=e.next;if(g(x,u,f)>=0)return!1;for(var i=x.x,v=u.x,o=f.x,c=x.y,h=u.y,l=f.y,Z=i<v?i<o?i:o:v<o?v:o,p=c<h?c<l?c:l:h<l?h:l,M=i>v?i>o?i:o:v>o?v:o,O=c>h?c>l?c:l:h>l?h:l,C=A(Z,p,r,n,t),D=A(M,O,r,n,t),s=e.prevZ,y=e.nextZ;s&&s.z>=C&&y&&y.z<=D;){if(s.x>=Z&&s.x<=M&&s.y>=p&&s.y<=O&&s!==x&&s!==f&&F(i,c,v,h,o,l,s.x,s.y)&&g(s.prev,s,s.next)>=0||(s=s.prevZ,y.x>=Z&&y.x<=M&&y.y>=p&&y.y<=O&&y!==x&&y!==f&&F(i,c,v,h,o,l,y.x,y.y)&&g(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;s&&s.z>=C;){if(s.x>=Z&&s.x<=M&&s.y>=p&&s.y<=O&&s!==x&&s!==f&&F(i,c,v,h,o,l,s.x,s.y)&&g(s.prev,s,s.next)>=0)return!1;s=s.prevZ}for(;y&&y.z<=D;){if(y.x>=Z&&y.x<=M&&y.y>=p&&y.y<=O&&y!==x&&y!==f&&F(i,c,v,h,o,l,y.x,y.y)&&g(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function J(e,r,n){var t=e;do{var x=t.prev,u=t.next.next;!E(x,u)&&N(x,t,t.next,u)&&P(x,u)&&P(u,x)&&(r.push(x.i/n|0),r.push(t.i/n|0),r.push(u.i/n|0),H(t),H(t.next),t=e=u),t=t.next}while(t!==e);return w(t)}function K(e,r,n,t,x,u){var f=e;do{for(var i=f.next.next;i!==f.prev;){if(f.i!==i.i&&q(f,i)){var v=R(f,i);f=w(f,f.next),v=w(v,v.next),L(f,r,n,t,x,u,0),L(v,r,n,t,x,u,0);return}i=i.next}f=f.next}while(f!==e)}function Q(e,r,n,t){var x=[],u,f,i,v,o;for(u=0,f=r.length;u<f;u++)i=r[u]*t,v=u<f-1?r[u+1]*t:e.length,o=G(e,i,v,t,!1),o===o.next&&(o.steiner=!0),x.push(b(o));for(x.sort(U),u=0;u<x.length;u++)n=W(x[u],n);return n}function U(e,r){return e.x-r.x}function W(e,r){var n=I(e,r);if(!n)return r;var t=R(n,e);return w(t,t.next),w(n,n.next)}function I(e,r){var n=r,t=e.x,x=e.y,u=-1/0,f;do{if(x<=n.y&&x>=n.next.y&&n.next.y!==n.y){var i=n.x+(x-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(i<=t&&i>u&&(u=i,f=n.x<n.next.x?n:n.next,i===t))return f}n=n.next}while(n!==r);if(!f)return null;var v=f,o=f.x,c=f.y,h=1/0,l;n=f;do t>=n.x&&n.x>=o&&t!==n.x&&F(x<c?t:u,x,o,c,x<c?u:t,x,n.x,n.y)&&(l=Math.abs(x-n.y)/(t-n.x),P(n,e)&&(l<h||l===h&&(n.x>f.x||n.x===f.x&&S(f,n)))&&(f=n,h=l)),n=n.next;while(n!==v);return f}function S(e,r){return g(e.prev,e,r.prev)<0&&g(r.next,e,e.next)<0}function X(e,r,n,t){var x=e;do x.z===0&&(x.z=A(x.x,x.y,r,n,t)),x.prevZ=x.prev,x.nextZ=x.next,x=x.next;while(x!==e);x.prevZ.nextZ=null,x.prevZ=null,Y(x)}function Y(e){var r,n,t