You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
458 lines
71 KiB
458 lines
71 KiB
var ln=Object.defineProperty,cn=Object.defineProperties;var un=Object.getOwnPropertyDescriptors;var mt=Object.getOwnPropertySymbols;var hn=Object.prototype.hasOwnProperty,fn=Object.prototype.propertyIsEnumerable;var We=(t,e)=>{if(e=Symbol[t])return e;throw Error("Symbol."+t+" is not defined")};var Fe=(t,e,n)=>e in t?ln(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,he=(t,e)=>{for(var n in e||(e={}))hn.call(e,n)&&Fe(t,n,e[n]);if(mt)for(var n of mt(e))fn.call(e,n)&&Fe(t,n,e[n]);return t},fe=(t,e)=>cn(t,un(e));var A=(t,e,n)=>(Fe(t,typeof e!="symbol"?e+"":e,n),n);var He=(t,e,n)=>new Promise((i,s)=>{var r=h=>{try{o(n.next(h))}catch(d){s(d)}},c=h=>{try{o(n.throw(h))}catch(d){s(d)}},o=h=>h.done?i(h.value):Promise.resolve(h.value).then(r,c);o((n=n.apply(t,e)).next())}),dn=function(t,e){this[0]=t,this[1]=e};var vt=t=>{var e=t[We("asyncIterator")],n=!1,i,s={};return e==null?(e=t[We("iterator")](),i=r=>s[r]=c=>e[r](c)):(e=e.call(t),i=r=>s[r]=c=>{if(n){if(n=!1,r==="throw")throw c;return c}return n=!0,{done:!1,value:new dn(new Promise(o=>{var h=e[r](c);if(!(h instanceof Object))throw TypeError("Object expected");o(h)}),1)}}),s[We("iterator")]=()=>s,i("next"),"throw"in e?i("throw"):s.throw=r=>{throw r},"return"in e&&i("return"),s};import{X as pn,Y as mn,S as vn,Z as gn,_ as wn,$ as yn,a0 as Ye,a1 as Sn,a2 as En,b as oe,C as Ke,V as k,a3 as xn,G as ye,a as Se,D as An,a4 as Mn,z as st,w as Be,m as kt,a5 as Wt,a6 as G,J as rt,y as Ft,O as ot,a7 as at,a8 as Pn,P as Cn,A as bn,t as Ln,a9 as On,aa as lt,ab as zn,I as gt,ac as Qe,ad as de,ae as Dn,af as Ht,ag as Te,ah as Re,ai as Yt,aj as Bn,ak as Ge,al as Tn,am as Rn,L as _n,x as Un,T as In,E as Nn,an as jn}from"./screen2Standard-03f7f908-1786807848259.js";import{E as ct,q as Vt}from"./TopicSwitcher-c91bad20-1786807848259.js";import{k as Gn,a8 as kn}from"./index-1786807848259.js";function Wn(t){let e=null,n=!1,i=!1;function s(){!n||i||(t(),e=requestAnimationFrame(s))}function r(){n||(n=!0,s())}function c(){n&&(n=!1,i=!0,cancelAnimationFrame(e))}function o(){!n&&i&&(n=!0,i=!1,s())}return{start:r,pause:c,resume:o,isActive:()=>n}}class Fn extends ct{constructor({canvas:e,config:n={}}){super(),this.canvas=e,this.config=n||{},this.maxPixelRatio=Number(this.config.maxPixelRatio)||2,this.handleResize=()=>{this.init(),this.emit("resize")},this.init(),window.addEventListener("resize",this.handleResize)}init(){var i;const e=((i=this.canvas)==null?void 0:i.parentNode)||this.canvas||document.documentElement;this.width=e.offsetWidth||window.innerWidth||1,this.height=e.offsetHeight||window.innerHeight||1;const n=Number(this.config.maxPixelRatio)||this.maxPixelRatio||2;this.maxPixelRatio=n,this.pixelRatio=Math.min(window.devicePixelRatio||1,n)}destroy(){window.removeEventListener("resize",this.handleResize),this.off("resize")}}class Hn extends ct{constructor(){super(),this.start=Date.now(),this.current=this.start,this.elapsed=0,this.delta=16,this.clock=new pn,this.raf=Wn(()=>this.tick()),this.raf.start()}tick(){const e=Date.now();this.delta=e-this.current,this.current=e,this.elapsed=this.current-this.start;const n=this.clock.getDelta(),i=this.clock.getElapsedTime();this.emit("tick",n,i)}destroy(){this.pause(),this.off("tick")}pause(){this.raf.pause()}resume(){this.raf.resume()}isActive(){this.raf.isActive()}}function Yn(t=10,e=62){var n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=[],s;if(e=e||n.length,t)for(s=0;s<t;s++)i[s]=n[0|Math.random()*e];else{var r;for(i[8]=i[13]=i[18]=i[23]="-",i[14]="4",s=0;s<36;s++)i[s]||(r=0|Math.random()*16,i[s]=n[s==19?r&3|8:r])}return i.join("")}const ut=t=>Vn(typeof t=="string"?JSON.parse(t):t);function Vn(t){var n,i,s,r;let e=(t==null?void 0:t.features)||[];for(let c=0;c<e.length;c++){const o=e[c],h=(n=o.geometry)==null?void 0:n.coordinates,d=Array.isArray(h)&&typeof((s=(i=h==null?void 0:h[0])==null?void 0:i[0])==null?void 0:s[0])=="number";((r=o.geometry)==null?void 0:r.type)==="Polygon"&&d&&(o.geometry.coordinates=[o.geometry.coordinates])}return t}class Jn{constructor({canvas:e,sizes:n,scene:i,camera:s,config:r={},postprocessing:c=!1,composer:o=null}){this.canvas=e,this.sizes=n,this.scene=i,this.camera=s,this.config=r||{},this.postprocessing=c,this.composer=o,this.setInstance()}setInstance(){this.instance=new mn({alpha:!1,antialias:this.config.antialias!==!1,powerPreference:this.config.powerPreference||"high-performance",canvas:this.canvas}),this.instance.outputColorSpace=vn,this.instance.setSize(this.sizes.width,this.sizes.height),this.instance.setPixelRatio(this.sizes.pixelRatio)}resize(){this.instance.setSize(this.sizes.width,this.sizes.height),this.instance.setPixelRatio(this.sizes.pixelRatio)}update(){this.postprocessing&&this.composer?this.composer.render():this.instance.render(this.scene,this.camera.instance)}destroy(){this.instance.dispose(),this.instance.forceContextLoss()}}class qn{constructor({sizes:e,scene:n,canvas:i},s={isOrthographic:!1}){this.sizes=e,this.scene=n,this.canvas=i,this.options=Object.assign({isOrthographic:!1},s),this.setInstance()}setInstance(){this.instance=null,this.setCamera(this.options.isOrthographic),this.instance.position.set(10,10,10),this.scene.add(this.instance)}setCamera(e=!0){let n=this.sizes.width/this.sizes.height;if(e){let i=120;this.instance=new gn(-i*n,i*n,i,-i,1,1e4)}else this.instance=new wn(45,n,1,1e4);this.setControls()}setControls(){this.controls=new yn(this.instance,this.canvas),this.controls.enableDamping=!0,this.controls.dampingFactor=.08,this.controls.enablePan=!0,this.controls.enableRotate=!0,this.controls.enableZoom=!0,this.controls.screenSpacePanning=!0,this.controls.minDistance=7,this.controls.maxDistance=72,this.controls.minPolarAngle=Math.PI*.08,this.controls.maxPolarAngle=Math.PI*.49,this.controls.mouseButtons.LEFT=Ye.PAN,this.controls.mouseButtons.MIDDLE=Ye.DOLLY,this.controls.mouseButtons.RIGHT=Ye.ROTATE,this.setCanvasInteractionStyle(),this.controls.update()}setCanvasInteractionStyle(){var e;(e=this.canvas)!=null&&e.style&&(this.handlePointerDown=()=>{this.canvas.style.cursor="grabbing"},this.handlePointerUp=()=>{this.canvas.style.cursor="grab"},this.canvas.style.cursor="grab",this.canvas.style.touchAction="none",this.canvas.addEventListener("pointerdown",this.handlePointerDown),window.addEventListener("pointerup",this.handlePointerUp),this.canvas.addEventListener("pointerleave",this.handlePointerUp))}resize(){let e=this.sizes.width/this.sizes.height;if(this.options.isOrthographic){let n=120;this.instance.left=-n*e,this.instance.right=n*e,this.instance.top=n,this.instance.bottom=-n}else this.instance.aspect=e;this.instance.updateProjectionMatrix()}update(){this.controls.update()}destroy(){var e,n,i,s;(n=(e=this.canvas)==null?void 0:e.removeEventListener)==null||n.call(e,"pointerdown",this.handlePointerDown),(s=(i=this.canvas)==null?void 0:i.removeEventListener)==null||s.call(i,"pointerleave",this.handlePointerUp),window.removeEventListener("pointerup",this.handlePointerUp),this.controls.dispose()}}class Xn{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const n=this._partials;let i=0;for(let s=0;s<this._n&&s<32;s++){const r=n[s],c=e+r,o=Math.abs(e)<Math.abs(r)?e-(c-r):r-(c-e);o&&(n[i++]=o),e=c}return n[i]=e,this._n=i+1,this}valueOf(){const e=this._partials;let n=this._n,i,s,r,c=0;if(n>0){for(c=e[--n];n>0&&(i=c,s=e[--n],c=i+s,r=s-(c-i),!r););n>0&&(r<0&&e[n-1]<0||r>0&&e[n-1]>0)&&(s=r*2,i=c+s,s==i-c&&(c=i))}return c}}function*Kn(t){for(const e of t)yield*vt(e)}function Jt(t){return Array.from(Kn(t))}var B=1e-6,Qn=1e-12,b=Math.PI,q=b/2,wt=b/4,Z=b*2,Q=180/b,N=b/180,R=Math.abs,qt=Math.atan,Ee=Math.atan2,U=Math.cos,$n=Math.exp,Zn=Math.log,I=Math.sin,ei=Math.sign||function(t){return t>0?1:t<0?-1:0},ke=Math.sqrt,ti=Math.tan;function ni(t){return t>1?0:t<-1?b:Math.acos(t)}function xe(t){return t>1?q:t<-1?-q:Math.asin(t)}function ge(){}function Ue(t,e){t&&St.hasOwnProperty(t.type)&&St[t.type](t,e)}var yt={Feature:function(t,e){Ue(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,i=-1,s=n.length;++i<s;)Ue(n[i].geometry,e)}},St={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,i=-1,s=n.length;++i<s;)t=n[i],e.point(t[0],t[1],t[2])},LineString:function(t,e){$e(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,i=-1,s=n.length;++i<s;)$e(n[i],e,0)},Polygon:function(t,e){Et(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,i=-1,s=n.length;++i<s;)Et(n[i],e)},GeometryCollection:function(t,e){for(var n=t.geometries,i=-1,s=n.length;++i<s;)Ue(n[i],e)}};function $e(t,e,n){var i=-1,s=t.length-n,r;for(e.lineStart();++i<s;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function Et(t,e){var n=-1,i=t.length;for(e.polygonStart();++n<i;)$e(t[n],e,1);e.polygonEnd()}function ii(t,e){t&&yt.hasOwnProperty(t.type)?yt[t.type](t,e):Ue(t,e)}function Ze(t){return[Ee(t[1],t[0]),xe(t[2])]}function pe(t){var e=t[0],n=t[1],i=U(n);return[i*U(e),i*I(e),I(n)]}function Pe(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Ie(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Ve(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Ce(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function et(t){var e=ke(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function tt(t,e){function n(i,s){return i=t(i,s),e(i[0],i[1])}return t.invert&&e.invert&&(n.invert=function(i,s){return i=e.invert(i,s),i&&t.invert(i[0],i[1])}),n}function nt(t,e){return R(t)>b&&(t-=Math.round(t/Z)*Z),[t,e]}nt.invert=nt;function Xt(t,e,n){return(t%=Z)?e||n?tt(At(t),Mt(e,n)):At(t):e||n?Mt(e,n):nt}function xt(t){return function(e,n){return e+=t,R(e)>b&&(e-=Math.round(e/Z)*Z),[e,n]}}function At(t){var e=xt(t);return e.invert=xt(-t),e}function Mt(t,e){var n=U(t),i=I(t),s=U(e),r=I(e);function c(o,h){var d=U(h),a=U(o)*d,l=I(o)*d,u=I(h),p=u*n+a*i;return[Ee(l*s-p*r,a*n-u*i),xe(p*s+l*r)]}return c.invert=function(o,h){var d=U(h),a=U(o)*d,l=I(o)*d,u=I(h),p=u*s-l*r;return[Ee(l*s+u*r,a*n+p*i),xe(p*n-a*i)]},c}function si(t){t=Xt(t[0]*N,t[1]*N,t.length>2?t[2]*N:0);function e(n){return n=t(n[0]*N,n[1]*N),n[0]*=Q,n[1]*=Q,n}return e.invert=function(n){return n=t.invert(n[0]*N,n[1]*N),n[0]*=Q,n[1]*=Q,n},e}function ri(t,e,n,i,s,r){if(n){var c=U(e),o=I(e),h=i*n;s==null?(s=e+i*Z,r=e-h/2):(s=Pt(c,s),r=Pt(c,r),(i>0?s<r:s>r)&&(s+=i*Z));for(var d,a=s;i>0?a>r:a<r;a-=h)d=Ze([c,-o*U(a),-o*I(a)]),t.point(d[0],d[1])}}function Pt(t,e){e=pe(e),e[0]-=t,et(e);var n=ni(-e[1]);return((-e[2]<0?-n:n)+Z-B)%Z}function Kt(){var t=[],e;return{point:function(n,i,s){e.push([n,i,s])},lineStart:function(){t.push(e=[])},lineEnd:ge,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function _e(t,e){return R(t[0]-e[0])<B&&R(t[1]-e[1])<B}function be(t,e,n,i){this.x=t,this.z=e,this.o=n,this.e=i,this.v=!1,this.n=this.p=null}function Qt(t,e,n,i,s){var r=[],c=[],o,h;if(t.forEach(function(m){if(!((g=m.length-1)<=0)){var g,f=m[0],E=m[g],S;if(_e(f,E)){if(!f[2]&&!E[2]){for(s.lineStart(),o=0;o<g;++o)s.point((f=m[o])[0],f[1]);s.lineEnd();return}E[0]+=2*B}r.push(S=new be(f,m,null,!0)),c.push(S.o=new be(f,null,S,!1)),r.push(S=new be(E,m,null,!1)),c.push(S.o=new be(E,null,S,!0))}}),!!r.length){for(c.sort(e),Ct(r),Ct(c),o=0,h=c.length;o<h;++o)c[o].e=n=!n;for(var d=r[0],a,l;;){for(var u=d,p=!0;u.v;)if((u=u.n)===d)return;a=u.z,s.lineStart();do{if(u.v=u.o.v=!0,u.e){if(p)for(o=0,h=a.length;o<h;++o)s.point((l=a[o])[0],l[1]);else i(u.x,u.n.x,1,s);u=u.n}else{if(p)for(a=u.p.z,o=a.length-1;o>=0;--o)s.point((l=a[o])[0],l[1]);else i(u.x,u.p.x,-1,s);u=u.p}u=u.o,a=u.z,p=!p}while(!u.v);s.lineEnd()}}}function Ct(t){if(e=t.length){for(var e,n=0,i=t[0],s;++n<e;)i.n=s=t[n],s.p=i,i=s;i.n=s=t[0],s.p=i}}function Je(t){return R(t[0])<=b?t[0]:ei(t[0])*((R(t[0])+b)%Z-b)}function oi(t,e){var n=Je(e),i=e[1],s=I(i),r=[I(n),-U(n),0],c=0,o=0,h=new Xn;s===1?i=q+B:s===-1&&(i=-q-B);for(var d=0,a=t.length;d<a;++d)if(u=(l=t[d]).length)for(var l,u,p=l[u-1],m=Je(p),g=p[1]/2+wt,f=I(g),E=U(g),S=0;S<u;++S,m=w,f=P,E=L,p=y){var y=l[S],w=Je(y),x=y[1]/2+wt,P=I(x),L=U(x),O=w-m,z=O>=0?1:-1,T=z*O,M=T>b,Y=f*P;if(h.add(Ee(Y*z*I(T),E*L+Y*U(T))),c+=M?O+z*Z:O,M^m>=n^w>=n){var _=Ie(pe(p),pe(y));et(_);var D=Ie(r,_);et(D);var v=(M^O>=0?-1:1)*xe(D[2]);(i>v||i===v&&(_[0]||_[1]))&&(o+=M^O>=0?1:-1)}}return(c<-B||c<B&&h<-Qn)^o&1}function $t(t,e,n,i){return function(s){var r=e(s),c=Kt(),o=e(c),h=!1,d,a,l,u={point:p,lineStart:g,lineEnd:f,polygonStart:function(){u.point=E,u.lineStart=S,u.lineEnd=y,a=[],d=[]},polygonEnd:function(){u.point=p,u.lineStart=g,u.lineEnd=f,a=Jt(a);var w=oi(d,i);a.length?(h||(s.polygonStart(),h=!0),Qt(a,li,w,n,s)):w&&(h||(s.polygonStart(),h=!0),s.lineStart(),n(null,null,1,s),s.lineEnd()),h&&(s.polygonEnd(),h=!1),a=d=null},sphere:function(){s.polygonStart(),s.lineStart(),n(null,null,1,s),s.lineEnd(),s.polygonEnd()}};function p(w,x){t(w,x)&&s.point(w,x)}function m(w,x){r.point(w,x)}function g(){u.point=m,r.lineStart()}function f(){u.point=p,r.lineEnd()}function E(w,x){l.push([w,x]),o.point(w,x)}function S(){o.lineStart(),l=[]}function y(){E(l[0][0],l[0][1]),o.lineEnd();var w=o.clean(),x=c.result(),P,L=x.length,O,z,T;if(l.pop(),d.push(l),l=null,!!L){if(w&1){if(z=x[0],(O=z.length-1)>0){for(h||(s.polygonStart(),h=!0),s.lineStart(),P=0;P<O;++P)s.point((T=z[P])[0],T[1]);s.lineEnd()}return}L>1&&w&2&&x.push(x.pop().concat(x.shift())),a.push(x.filter(ai))}}return u}}function ai(t){return t.length>1}function li(t,e){return((t=t.x)[0]<0?t[1]-q-B:q-t[1])-((e=e.x)[0]<0?e[1]-q-B:q-e[1])}const bt=$t(function(){return!0},ci,hi,[-b,-q]);function ci(t){var e=NaN,n=NaN,i=NaN,s;return{lineStart:function(){t.lineStart(),s=1},point:function(r,c){var o=r>0?b:-b,h=R(r-e);R(h-b)<B?(t.point(e,n=(n+c)/2>0?q:-q),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(o,n),t.point(r,n),s=0):i!==o&&h>=b&&(R(e-i)<B&&(e-=i*B),R(r-o)<B&&(r-=o*B),n=ui(e,n,r,c),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(o,n),s=0),t.point(e=r,n=c),i=o},lineEnd:function(){t.lineEnd(),e=n=NaN},clean:function(){return 2-s}}}function ui(t,e,n,i){var s,r,c=I(t-n);return R(c)>B?qt((I(e)*(r=U(i))*I(n)-I(i)*(s=U(e))*I(t))/(s*r*c)):(e+i)/2}function hi(t,e,n,i){var s;if(t==null)s=n*q,i.point(-b,s),i.point(0,s),i.point(b,s),i.point(b,0),i.point(b,-s),i.point(0,-s),i.point(-b,-s),i.point(-b,0),i.point(-b,s);else if(R(t[0]-e[0])>B){var r=t[0]<e[0]?b:-b;s=n*r/2,i.point(-r,s),i.point(0,s),i.point(r,s)}else i.point(e[0],e[1])}function fi(t){var e=U(t),n=2*N,i=e>0,s=R(e)>B;function r(a,l,u,p){ri(p,t,n,u,a,l)}function c(a,l){return U(a)*U(l)>e}function o(a){var l,u,p,m,g;return{lineStart:function(){m=p=!1,g=1},point:function(f,E){var S=[f,E],y,w=c(f,E),x=i?w?0:d(f,E):w?d(f+(f<0?b:-b),E):0;if(!l&&(m=p=w)&&a.lineStart(),w!==p&&(y=h(l,S),(!y||_e(l,y)||_e(S,y))&&(S[2]=1)),w!==p)g=0,w?(a.lineStart(),y=h(S,l),a.point(y[0],y[1])):(y=h(l,S),a.point(y[0],y[1],2),a.lineEnd()),l=y;else if(s&&l&&i^w){var P;!(x&u)&&(P=h(S,l,!0))&&(g=0,i?(a.lineStart(),a.point(P[0][0],P[0][1]),a.point(P[1][0],P[1][1]),a.lineEnd()):(a.point(P[1][0],P[1][1]),a.lineEnd(),a.lineStart(),a.point(P[0][0],P[0][1],3)))}w&&(!l||!_e(l,S))&&a.point(S[0],S[1]),l=S,p=w,u=x},lineEnd:function(){p&&a.lineEnd(),l=null},clean:function(){return g|(m&&p)<<1}}}function h(a,l,u){var p=pe(a),m=pe(l),g=[1,0,0],f=Ie(p,m),E=Pe(f,f),S=f[0],y=E-S*S;if(!y)return!u&&a;var w=e*E/y,x=-e*S/y,P=Ie(g,f),L=Ce(g,w),O=Ce(f,x);Ve(L,O);var z=P,T=Pe(L,z),M=Pe(z,z),Y=T*T-M*(Pe(L,L)-1);if(!(Y<0)){var _=ke(Y),D=Ce(z,(-T-_)/M);if(Ve(D,L),D=Ze(D),!u)return D;var v=a[0],C=l[0],j=a[1],V=l[1],$;C<v&&($=v,v=C,C=$);var ve=C-v,se=R(ve-b)<B,ae=se||ve<B;if(!se&&V<j&&($=j,j=V,V=$),ae?se?j+V>0^D[1]<(R(D[0]-v)<B?j:V):j<=D[1]&&D[1]<=V:ve>b^(v<=D[0]&&D[0]<=C)){var re=Ce(z,(-T+_)/M);return Ve(re,L),[D,Ze(re)]}}}function d(a,l){var u=i?t:b-t,p=0;return a<-u?p|=1:a>u&&(p|=2),l<-u?p|=4:l>u&&(p|=8),p}return $t(c,o,r,i?[0,-t]:[-b,t-b])}function di(t,e,n,i,s,r){var c=t[0],o=t[1],h=e[0],d=e[1],a=0,l=1,u=h-c,p=d-o,m;if(m=n-c,!(!u&&m>0)){if(m/=u,u<0){if(m<a)return;m<l&&(l=m)}else if(u>0){if(m>l)return;m>a&&(a=m)}if(m=s-c,!(!u&&m<0)){if(m/=u,u<0){if(m>l)return;m>a&&(a=m)}else if(u>0){if(m<a)return;m<l&&(l=m)}if(m=i-o,!(!p&&m>0)){if(m/=p,p<0){if(m<a)return;m<l&&(l=m)}else if(p>0){if(m>l)return;m>a&&(a=m)}if(m=r-o,!(!p&&m<0)){if(m/=p,p<0){if(m>l)return;m>a&&(a=m)}else if(p>0){if(m<a)return;m<l&&(l=m)}return a>0&&(t[0]=c+a*u,t[1]=o+a*p),l<1&&(e[0]=c+l*u,e[1]=o+l*p),!0}}}}}var we=1e9,Le=-we;function pi(t,e,n,i){function s(d,a){return t<=d&&d<=n&&e<=a&&a<=i}function r(d,a,l,u){var p=0,m=0;if(d==null||(p=c(d,l))!==(m=c(a,l))||h(d,a)<0^l>0)do u.point(p===0||p===3?t:n,p>1?i:e);while((p=(p+l+4)%4)!==m);else u.point(a[0],a[1])}function c(d,a){return R(d[0]-t)<B?a>0?0:3:R(d[0]-n)<B?a>0?2:1:R(d[1]-e)<B?a>0?1:0:a>0?3:2}function o(d,a){return h(d.x,a.x)}function h(d,a){var l=c(d,1),u=c(a,1);return l!==u?l-u:l===0?a[1]-d[1]:l===1?d[0]-a[0]:l===2?d[1]-a[1]:a[0]-d[0]}return function(d){var a=d,l=Kt(),u,p,m,g,f,E,S,y,w,x,P,L={point:O,lineStart:Y,lineEnd:_,polygonStart:T,polygonEnd:M};function O(v,C){s(v,C)&&a.point(v,C)}function z(){for(var v=0,C=0,j=p.length;C<j;++C)for(var V=p[C],$=1,ve=V.length,se=V[0],ae,re,Me=se[0],ue=se[1];$<ve;++$)ae=Me,re=ue,se=V[$],Me=se[0],ue=se[1],re<=i?ue>i&&(Me-ae)*(i-re)>(ue-re)*(t-ae)&&++v:ue<=i&&(Me-ae)*(i-re)<(ue-re)*(t-ae)&&--v;return v}function T(){a=l,u=[],p=[],P=!0}function M(){var v=z(),C=P&&v,j=(u=Jt(u)).length;(C||j)&&(d.polygonStart(),C&&(d.lineStart(),r(null,null,1,d),d.lineEnd()),j&&Qt(u,o,v,r,d),d.polygonEnd()),a=d,u=p=m=null}function Y(){L.point=D,p&&p.push(m=[]),x=!0,w=!1,S=y=NaN}function _(){u&&(D(g,f),E&&w&&l.rejoin(),u.push(l.result())),L.point=O,w&&a.lineEnd()}function D(v,C){var j=s(v,C);if(p&&m.push([v,C]),x)g=v,f=C,E=j,x=!1,j&&(a.lineStart(),a.point(v,C));else if(j&&w)a.point(v,C);else{var V=[S=Math.max(Le,Math.min(we,S)),y=Math.max(Le,Math.min(we,y))],$=[v=Math.max(Le,Math.min(we,v)),C=Math.max(Le,Math.min(we,C))];di(V,$,t,e,n,i)?(w||(a.lineStart(),a.point(V[0],V[1])),a.point($[0],$[1]),j||a.lineEnd(),P=!1):j&&(a.lineStart(),a.point(v,C),P=!1)}S=v,y=C,w=j}return L}}const Lt=t=>t;var me=1/0,Ne=me,Ae=-me,je=Ae,mi={point:vi,lineStart:ge,lineEnd:ge,polygonStart:ge,polygonEnd:ge,result:function(){var t=[[me,Ne],[Ae,je]];return Ae=je=-(Ne=me=1/0),t}};function vi(t,e){t<me&&(me=t),t>Ae&&(Ae=t),e<Ne&&(Ne=e),e>je&&(je=e)}const Ot=mi;function ht(t){return function(e){var n=new it;for(var i in t)n[i]=t[i];return n.stream=e,n}}function it(){}it.prototype={constructor:it,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function ft(t,e,n){var i=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),i!=null&&t.clipExtent(null),ii(n,t.stream(Ot)),e(Ot.result()),i!=null&&t.clipExtent(i),t}function Zt(t,e,n){return ft(t,function(i){var s=e[1][0]-e[0][0],r=e[1][1]-e[0][1],c=Math.min(s/(i[1][0]-i[0][0]),r/(i[1][1]-i[0][1])),o=+e[0][0]+(s-c*(i[1][0]+i[0][0]))/2,h=+e[0][1]+(r-c*(i[1][1]+i[0][1]))/2;t.scale(150*c).translate([o,h])},n)}function gi(t,e,n){return Zt(t,[[0,0],e],n)}function wi(t,e,n){return ft(t,function(i){var s=+e,r=s/(i[1][0]-i[0][0]),c=(s-r*(i[1][0]+i[0][0]))/2,o=-r*i[0][1];t.scale(150*r).translate([c,o])},n)}function yi(t,e,n){return ft(t,function(i){var s=+e,r=s/(i[1][1]-i[0][1]),c=-r*i[0][0],o=(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([c,o])},n)}var zt=16,Si=U(30*N);function Dt(t,e){return+e?xi(t,e):Ei(t)}function Ei(t){return ht({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function xi(t,e){function n(i,s,r,c,o,h,d,a,l,u,p,m,g,f){var E=d-i,S=a-s,y=E*E+S*S;if(y>4*e&&g--){var w=c+u,x=o+p,P=h+m,L=ke(w*w+x*x+P*P),O=xe(P/=L),z=R(R(P)-1)<B||R(r-l)<B?(r+l)/2:Ee(x,w),T=t(z,O),M=T[0],Y=T[1],_=M-i,D=Y-s,v=S*_-E*D;(v*v/y>e||R((E*_+S*D)/y-.5)>.3||c*u+o*p+h*m<Si)&&(n(i,s,r,c,o,h,M,Y,z,w/=L,x/=L,P,g,f),f.point(M,Y),n(M,Y,z,w,x,P,d,a,l,u,p,m,g,f))}}return function(i){var s,r,c,o,h,d,a,l,u,p,m,g,f={point:E,lineStart:S,lineEnd:w,polygonStart:function(){i.polygonStart(),f.lineStart=x},polygonEnd:function(){i.polygonEnd(),f.lineStart=S}};function E(O,z){O=t(O,z),i.point(O[0],O[1])}function S(){l=NaN,f.point=y,i.lineStart()}function y(O,z){var T=pe([O,z]),M=t(O,z);n(l,u,a,p,m,g,l=M[0],u=M[1],a=O,p=T[0],m=T[1],g=T[2],zt,i),i.point(l,u)}function w(){f.point=E,i.lineEnd()}function x(){S(),f.point=P,f.lineEnd=L}function P(O,z){y(s=O,z),r=l,c=u,o=p,h=m,d=g,f.point=y}function L(){n(l,u,a,p,m,g,r,c,s,o,h,d,zt,i),f.lineEnd=w,w()}return f}}var Ai=ht({point:function(t,e){this.stream.point(t*N,e*N)}});function Mi(t){return ht({point:function(e,n){var i=t(e,n);return this.stream.point(i[0],i[1])}})}function Pi(t,e,n,i,s){function r(c,o){return c*=i,o*=s,[e+t*c,n-t*o]}return r.invert=function(c,o){return[(c-e)/t*i,(n-o)/t*s]},r}function Bt(t,e,n,i,s,r){if(!r)return Pi(t,e,n,i,s);var c=U(r),o=I(r),h=c*t,d=o*t,a=c/t,l=o/t,u=(o*n-c*e)/t,p=(o*e+c*n)/t;function m(g,f){return g*=i,f*=s,[h*g-d*f+e,n-d*g-h*f]}return m.invert=function(g,f){return[i*(a*g-l*f+u),s*(p-l*g-a*f)]},m}function Ci(t){return bi(function(){return t})()}function bi(t){var e,n=150,i=480,s=250,r=0,c=0,o=0,h=0,d=0,a,l=0,u=1,p=1,m=null,g=bt,f=null,E,S,y,w=Lt,x=.5,P,L,O,z,T;function M(v){return O(v[0]*N,v[1]*N)}function Y(v){return v=O.invert(v[0],v[1]),v&&[v[0]*Q,v[1]*Q]}M.stream=function(v){return z&&T===v?z:z=Ai(Mi(a)(g(P(w(T=v)))))},M.preclip=function(v){return arguments.length?(g=v,m=void 0,D()):g},M.postclip=function(v){return arguments.length?(w=v,f=E=S=y=null,D()):w},M.clipAngle=function(v){return arguments.length?(g=+v?fi(m=v*N):(m=null,bt),D()):m*Q},M.clipExtent=function(v){return arguments.length?(w=v==null?(f=E=S=y=null,Lt):pi(f=+v[0][0],E=+v[0][1],S=+v[1][0],y=+v[1][1]),D()):f==null?null:[[f,E],[S,y]]},M.scale=function(v){return arguments.length?(n=+v,_()):n},M.translate=function(v){return arguments.length?(i=+v[0],s=+v[1],_()):[i,s]},M.center=function(v){return arguments.length?(r=v[0]%360*N,c=v[1]%360*N,_()):[r*Q,c*Q]},M.rotate=function(v){return arguments.length?(o=v[0]%360*N,h=v[1]%360*N,d=v.length>2?v[2]%360*N:0,_()):[o*Q,h*Q,d*Q]},M.angle=function(v){return arguments.length?(l=v%360*N,_()):l*Q},M.reflectX=function(v){return arguments.length?(u=v?-1:1,_()):u<0},M.reflectY=function(v){return arguments.length?(p=v?-1:1,_()):p<0},M.precision=function(v){return arguments.length?(P=Dt(L,x=v*v),D()):ke(x)},M.fitExtent=function(v,C){return Zt(M,v,C)},M.fitSize=function(v,C){return gi(M,v,C)},M.fitWidth=function(v,C){return wi(M,v,C)},M.fitHeight=function(v,C){return yi(M,v,C)};function _(){var v=Bt(n,0,0,u,p,l).apply(null,e(r,c)),C=Bt(n,i-v[0],s-v[1],u,p,l);return a=Xt(o,h,d),L=tt(e,C),O=tt(a,L),P=Dt(L,x),D()}function D(){return z=T=null,M}return function(){return e=t.apply(this,arguments),M.invert=e.invert&&Y,_()}}function dt(t,e){return[t,Zn(ti((q+e)/2))]}dt.invert=function(t,e){return[t,2*qt($n(e))-q]};function pt(){return Li(dt).scale(961/Z)}function Li(t){var e=Ci(t),n=e.center,i=e.scale,s=e.translate,r=e.clipExtent,c=null,o,h,d;e.scale=function(l){return arguments.length?(i(l),a()):i()},e.translate=function(l){return arguments.length?(s(l),a()):s()},e.center=function(l){return arguments.length?(n(l),a()):n()},e.clipExtent=function(l){return arguments.length?(l==null?c=o=h=d=null:(c=+l[0][0],o=+l[0][1],h=+l[1][0],d=+l[1][1]),a()):c==null?null:[[c,o],[h,d]]};function a(){var l=b*i(),u=e(si(e.rotate()).invert([0,0]));return r(c==null?[[u[0]-l,u[1]-l],[u[0]+l,u[1]+l]]:t===dt?[[Math.max(u[0]-l,c),o],[Math.min(u[0]+l,h),d]]:[[c,Math.max(u[1]-l,o)],[h,Math.min(u[1]+l,d)]])}return a()}class Ki extends ct{constructor(e,n={}){var s,r;super();let i={isOrthographic:!1};this.config=Object.assign({},i,n),this.canvas=e,this.scene=new Sn,this.sizes=new Fn(this),this.time=new Hn(this),this.camera=new qn(this,{isOrthographic:this.config.isOrthographic}),this.renderer=new Jn(this),this.handleControlsChange=()=>{var c,o,h;this.renderer.update(),(o=(c=this.label3d)==null?void 0:c.update)==null||o.call(c),(h=this.updateTownLabelScale)==null||h.call(this)},(r=(s=this.camera.controls)==null?void 0:s.addEventListener)==null||r.call(s,"change",this.handleControlsChange),this.sizes.on("resize",()=>{this.resize()}),this.time.on("tick",c=>{this.update(c)})}setAxesHelper(e=250){if(!e)return!1;let n=new En(e);this.scene.add(n)}resize(){this.camera.resize(),this.renderer.resize()}update(e){this.camera.update(e),this.renderer.update(e)}destroy(){var e,n,i,s;(n=(e=this.camera.controls)==null?void 0:e.removeEventListener)==null||n.call(e,"change",this.handleControlsChange),this.sizes.destroy(),this.time.destroy(),this.camera.destroy(),this.renderer.destroy(),this.scene.traverse(r=>{if(r instanceof oe){r.geometry.dispose();for(const c in r.material){const o=r.material[c];o&&typeof o.dispose=="function"&&o.dispose()}}}),(s=(i=this.canvas)==null?void 0:i.parentNode)==null||s.removeChild(this.canvas)}}class Qi{constructor({material:e,time:n,size:i,diffuseColor:s,diffuseSpeed:r,diffuseWidth:c,callback:o=()=>{}}){this.time=n,this.pointShader=null,this.callback=o;let h={size:100,diffuseSpeed:15,diffuseColor:9345950,diffuseWidth:10};this.options=Object.assign({},h,{material:e,size:i,diffuseColor:s,diffuseSpeed:r,diffuseWidth:c}),this.init()}init(){let{material:e,size:n,diffuseColor:i,diffuseSpeed:s,diffuseWidth:r}=this.options,c=n/s;e.onBeforeCompile=o=>{this.pointShader=o,this.callback(o,c),o.uniforms=fe(he({},o.uniforms),{uTime:{value:0},uSpeed:{value:s},uWidth:{value:r},uColor:{value:new Ke(i)}}),o.vertexShader=o.vertexShader.replace("void main() {",`
|
|
varying vec3 vPosition;
|
|
void main(){
|
|
vPosition = position;
|
|
`),o.fragmentShader=o.fragmentShader.replace("void main() {",`
|
|
uniform float uTime;
|
|
uniform float uSpeed;
|
|
uniform float uWidth;
|
|
uniform vec3 uColor;
|
|
varying vec3 vPosition;
|
|
void main(){
|
|
`),o.fragmentShader=o.fragmentShader.replace("#include <opaque_fragment>",`
|
|
#ifdef OPAQUE
|
|
diffuseColor.a = 1.0;
|
|
#endif
|
|
|
|
#ifdef USE_TRANSMISSION
|
|
diffuseColor.a *= material.transmissionAlpha;
|
|
#endif
|
|
|
|
float r = uTime * uSpeed;
|
|
|
|
float w = uWidth;
|
|
// if(w>uWidth){
|
|
// w = uWidth;
|
|
// }else{
|
|
// w = uTime * 1.5;
|
|
// }
|
|
|
|
vec2 center = vec2(0.0, 0.0);
|
|
|
|
float rDistance = distance(vPosition.xy, center);
|
|
|
|
if(rDistance > r && rDistance < r + 2.0 * w) {
|
|
float per = 0.0;
|
|
if(rDistance < r + w) {
|
|
float p = smoothstep(0.0,1.0,(rDistance - r) / w);
|
|
p*=p;
|
|
outgoingLight = mix(outgoingLight, uColor, p);
|
|
} else {
|
|
|
|
float p = smoothstep(0.0,1.0,(rDistance - r - w) / w);
|
|
|
|
outgoingLight = mix(uColor, outgoingLight, p);
|
|
}
|
|
gl_FragColor = vec4(outgoingLight, diffuseColor.a);
|
|
} else {
|
|
gl_FragColor = vec4(outgoingLight, 0.0);
|
|
}
|
|
`)}}}class $i{constructor({scene:e,time:n},i){this.scene=e,this.time=n,this.instance=null;let s={position:new k(0,0,0),gridSize:100,gridDivision:20,gridColor:2635578,shapeSize:1,shapeColor:9345950,pointSize:.2,pointColor:2635578,pointLayout:{row:200,col:200},pointBlending:xn};this.options=Object.assign({},s,i),this.init()}init(){let e=new ye;e.name="Grid";let n=this.createGridHelp(),i=this.createShapes(),s=this.createPoint();e.add(n,i,s),e.position.copy(this.options.position),this.instance=e,this.scene.add(e)}createShapes(){let{gridSize:e,gridDivision:n,shapeSize:i,shapeColor:s}=this.options,r=e/n,c=e/2,o=new Se({color:s,side:An}),h=[];for(let l=0;l<n+1;l++)for(let u=0;u<n+1;u++){let p=this.createPlus(i);p.translate(-c+l*r,-c+u*r,0),h.push(p)}let d=Vt(h),a=new oe(d,o);return a.renderOrder=-1,a.rotateX(-Math.PI/2),a.position.y+=.01,a}createGridHelp(){let{gridSize:e,gridDivision:n,gridColor:i}=this.options;return new Mn(e,n,i,i)}createPoint(){let{gridSize:e,pointSize:n,pointColor:i,pointBlending:s,pointLayout:r}=this.options;const c=r.row,o=r.col,h=new Float32Array(c*o*3);for(let u=0;u<c;u++)for(let p=0;p<o;p++){let m=u/(c-1)*e-e/2,g=0,f=p/(o-1)*e-e/2,E=(u*o+p)*3;h[E]=m,h[E+1]=g,h[E+2]=f}var d=new st;d.setAttribute("position",new Be(h,3));let a=new kt({size:n,sizeAttenuation:!0,color:i,blending:s});return new Wt(d,a)}setPointMode(){}createPlus(e=50){let n=e/6/3,i=e/3,s=[new G(-i,-n),new G(-n,-n),new G(-n,-i),new G(n,-i),new G(n,-i),new G(n,-n),new G(i,-n),new G(i,n),new G(n,n),new G(n,i),new G(-n,i),new G(-n,n),new G(-i,n)],r=new rt(s);return new Ft(r,24)}}const Tt=new k,Oi=new Pn,Rt=new k;class en extends ot{constructor(e=document.createElement("div")){super(),this.isCSS3DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.addEventListener("removed",function(){this.traverse(function(n){n.element instanceof Element&&n.element.parentNode!==null&&n.element.parentNode.removeChild(n.element)})})}copy(e,n){return super.copy(e,n),this.element=e.element.cloneNode(!0),this}}class zi extends en{constructor(e){super(e),this.isCSS3DSprite=!0,this.rotation2D=0}copy(e,n){return super.copy(e,n),this.rotation2D=e.rotation2D,this}}const ee=new at,Di=new at;class Bi{constructor(e={}){const n=this;let i,s,r,c;const o={camera:{style:""},objects:new WeakMap},h=e.element!==void 0?e.element:document.createElement("div");h.style.overflow="hidden",this.domElement=h;const d=document.createElement("div");d.style.transformOrigin="0 0",d.style.pointerEvents="none",h.appendChild(d);const a=document.createElement("div");a.style.transformStyle="preserve-3d",d.appendChild(a),this.getSize=function(){return{width:i,height:s}},this.render=function(g,f){const E=f.projectionMatrix.elements[5]*c;f.view&&f.view.enabled?(d.style.transform=`translate( ${-f.view.offsetX*(i/f.view.width)}px, ${-f.view.offsetY*(s/f.view.height)}px )`,d.style.transform+=`scale( ${f.view.fullWidth/f.view.width}, ${f.view.fullHeight/f.view.height} )`):d.style.transform="",g.matrixWorldAutoUpdate===!0&&g.updateMatrixWorld(),f.parent===null&&f.matrixWorldAutoUpdate===!0&&f.updateMatrixWorld();let S,y;f.isOrthographicCamera&&(S=-(f.right+f.left)/2,y=(f.top+f.bottom)/2);const w=f.view&&f.view.enabled?f.view.height/f.view.fullHeight:1,x=f.isOrthographicCamera?`scale( ${w} )scale(`+E+")translate("+l(S)+"px,"+l(y)+"px)"+u(f.matrixWorldInverse):`scale( ${w} )translateZ(`+E+"px)"+u(f.matrixWorldInverse),L=(f.isPerspectiveCamera?"perspective("+E+"px) ":"")+x+"translate("+r+"px,"+c+"px)";o.camera.style!==L&&(a.style.transform=L,o.camera.style=L),m(g,g,f)},this.setSize=function(g,f){i=g,s=f,r=i/2,c=s/2,h.style.width=g+"px",h.style.height=f+"px",d.style.width=g+"px",d.style.height=f+"px",a.style.width=g+"px",a.style.height=f+"px"};function l(g){return Math.abs(g)<1e-10?0:g}function u(g){const f=g.elements;return"matrix3d("+l(f[0])+","+l(-f[1])+","+l(f[2])+","+l(f[3])+","+l(f[4])+","+l(-f[5])+","+l(f[6])+","+l(f[7])+","+l(f[8])+","+l(-f[9])+","+l(f[10])+","+l(f[11])+","+l(f[12])+","+l(-f[13])+","+l(f[14])+","+l(f[15])+")"}function p(g){const f=g.elements;return"translate(-50%,-50%)"+("matrix3d("+l(f[0])+","+l(f[1])+","+l(f[2])+","+l(f[3])+","+l(-f[4])+","+l(-f[5])+","+l(-f[6])+","+l(-f[7])+","+l(f[8])+","+l(f[9])+","+l(f[10])+","+l(f[11])+","+l(f[12])+","+l(f[13])+","+l(f[14])+","+l(f[15])+")")}function m(g,f,E,S){if(g.isCSS3DObject){const y=g.visible===!0&&g.layers.test(E.layers)===!0;if(g.element.style.display=y===!0?"":"none",y===!0){g.onBeforeRender(n,f,E);let w;g.isCSS3DSprite?(ee.copy(E.matrixWorldInverse),ee.transpose(),g.rotation2D!==0&&ee.multiply(Di.makeRotationZ(g.rotation2D)),g.matrixWorld.decompose(Tt,Oi,Rt),ee.setPosition(Tt),ee.scale(Rt),ee.elements[3]=0,ee.elements[7]=0,ee.elements[11]=0,ee.elements[15]=1,w=p(ee)):w=p(g.matrixWorld);const x=g.element,P=o.objects.get(g);if(P===void 0||P.style!==w){x.style.transform=w;const L={style:w};o.objects.set(g,L)}x.parentNode!==a&&a.appendChild(x),g.onAfterRender(n,f,E)}}for(let y=0,w=g.children.length;y<w;y++)m(g.children[y],f,E)}}}class Zi{constructor({scene:e,camera:n,time:i,sizes:s,canvas:r}){this.scene=e,this.camera=n,this.time=i,this.sizes=s,this.canvas=r,this.parent=null;let{width:c,height:o}=this.sizes,h=new Bi;this.css3dRender=h,h.setSize(c,o),h.domElement.style.position="absolute",h.domElement.style.left="0px",h.domElement.style.top="0px",h.domElement.style.pointerEvents="none",h.domElement.className="label3d-"+Yn(),this.canvas.parentNode.appendChild(h.domElement),this.time.on("tick",()=>{this.update()}),this.sizes.on("resize",()=>{this.resize()})}create(e="",n="",i=!1){let s=document.createElement("div");s.innerHTML=e,s.className=n,s.style.visibility="hidden",s.style.position="absolute",n||(s.style.padding="10px",s.style.color="#fff",s.style.fontSize="12px",s.style.textAlign="center",s.style.background="rgba(0,0,0,0.6)",s.style.borderRadius="4px");let r=null;return i?r=new zi(s):r=new en(s),r.init=(c,o)=>{r.element.innerHTML=c,r.element.style.visibility="visible",r.position.copy(o)},r.hide=()=>{r.element.style.visibility="hidden"},r.scaleHide=()=>{r.element.classList.add("scale-hidden")},r.show=()=>{r.element.style.visibility="visible",r.element.classList.remove("scale-hidden")},r.setParent=c=>{this.parent=c,c.add(r)},r.remove=()=>{this.parent.remove(r)},r}setLabelStyle(e,n=.1,i="x",s=Math.PI/2,r="none"){e.element.style.pointerEvents=r,e.scale.set(n,n,n),e.rotation[i]=s}setRenderLevel(e){this.css3dRender.domElement.style.zIndex=e}update(){this.css3dRender.render(this.scene,this.camera.instance)}destroy(){if(this.css3dRender){let e=this.css3dRender.domElement;e.parentNode.removeChild(e)}}resize(){let{width:e,height:n}=this.sizes;this.css3dRender.setSize(e,n)}}class es{constructor({time:e},n){this.time=e,this.options=Object.assign({},{width:10,scale:1,position:new k(0,0,0),needRotate:!1,rotateSpeed:.001,material:new Se({transparent:!0,opacity:1,depthTest:!0})},n);let i=new Cn(this.options.width,this.options.width),s=new oe(i,this.options.material);s.position.copy(this.options.position),s.scale.set(this.options.scale,this.options.scale,this.options.scale),this.instance=s}setParent(e){e.add(this.instance),this.time.on("tick",()=>{this.update()})}update(){this.options.needRotate&&(this.instance.rotation.z+=this.options.rotateSpeed)}}class tn{constructor({time:e},n={}){this.instance=null,this.time=e,this.enable=!0,this.config=Object.assign({num:100,range:500,speed:.01,renderOrder:99,dir:"up",material:new kt({map:tn.createTexture(),size:20,color:16777215,transparent:!0,opacity:1,depthTest:!1,vertexColors:!0,blending:bn,sizeAttenuation:!0})},n),this.create()}create(){const{range:e,speed:n,dir:i,material:s,num:r,renderOrder:c}=this.config,o=[],h=[],d=[];for(let l=0;l<r;l++){o.push(Math.random()*e-e/2,Math.random()*e-e/2,Math.random()*e-e/2);let u=i==="up"?1:-1;d.push(Math.random()*u,(.1+Math.random())*u,.1+Math.random()*u);const p=s.color.clone();let m={};p.getHSL(m),p.setHSL(m.h,m.s,m.l*Math.random()),h.push(p.r,p.g,p.b)}const a=new st;a.setAttribute("position",new Be(new Float32Array(o),3)),a.setAttribute("velocities",new Be(new Float32Array(d),3)),a.setAttribute("color",new Be(new Float32Array(h),3)),this.instance=new Wt(a,s),this.instance.renderOrder=c}static createTexture(){let e=document.createElement("canvas");e.width=1024,e.height=1024;let n=e.getContext("2d"),i=n.createRadialGradient(512,512,0,512,512,512);return i.addColorStop(0,"rgba(255,255,255,1)"),i.addColorStop(1,"rgba(255,255,255,0)"),n.fillStyle=i,n.fillRect(0,0,1024,1024),new Ln(e)}update(e,n){if(!this.instance)return!1;const{range:i,speed:s,dir:r}=this.config;let c=r==="up"?1:-1,o=this.instance.geometry.getAttribute("position"),h=this.instance.geometry.getAttribute("velocities");const d=o.count;for(let a=0;a<d;a++){let l=o.getX(a);o.getY(a);let u=o.getZ(a),p=h.getX(a),m=h.getY(a);h.getZ(a),l+=Math.sin(p*n)*e,u+=s*c,u>i/2&&c===1&&(u=-i/2),u<-i/2&&c==-1&&(u=i/2),o.setX(a,l),o.setZ(a,u),h.setX(a,p),h.setY(a,m)}o.needsUpdate=!0,h.needsUpdate=!0}setParent(e){e.add(this.instance),this.time.on("tick",(n,i)=>{this.enable&&this.update(n,i)})}}class ts{constructor({},e={}){this.mapGroup=new ye,this.coordinates=[],this.config=Object.assign({position:new k(0,0,0),geoProjectionCenter:new G(0,0),geoProjectionScale:120,data:"",renderOrder:1,merge:!1,material:new Se({color:1582651,transparent:!0,opacity:1})},e),this.mapGroup.position.copy(this.config.position);let n=ut(this.config.data);this.create(n)}geoProjection(e){return pt().center(this.config.geoProjectionCenter).scale(this.config.geoProjectionScale).translate([0,0])(e)}create(e){let{merge:n}=this.config,i=[];if(e.features.forEach(s=>{const r=new ot;let{name:c,center:o=[],centroid:h=[]}=s.properties;this.coordinates.push({name:c,center:o,centroid:h}),r.userData.name=c,s.geometry.coordinates.forEach(d=>{d.forEach(a=>{const l=new rt;for(let p=0;p<a.length;p++){if(!a[p][0]||!a[p][1])return!1;const[m,g]=this.geoProjection(a[p]);p===0&&l.moveTo(m,-g),l.lineTo(m,-g)}const u=new Ft(l);if(n)i.push(u);else{const p=new oe(u,this.config.material);p.renderOrder=this.config.renderOrder,p.userData.name=c,r.add(p)}})}),n||this.mapGroup.add(r)}),n){let s=Vt(i);const r=new oe(s,this.config.material);r.renderOrder=this.config.renderOrder,this.mapGroup.add(r)}}getCoordinates(){return this.coordinates}setParent(e){e.add(this.mapGroup)}}class ns{constructor({assets:e,time:n},i={}){this.mapGroup=new ye,this.assets=e,this.time=n,this.coordinates=[],this.config=Object.assign({position:new k(0,0,0),geoProjectionCenter:new G(0,0),geoProjectionScale:120,data:"",renderOrder:1,topFaceMaterial:new Se({color:1582651,transparent:!0,opacity:1}),sideMaterial:new Se({color:464171,transparent:!0,opacity:1}),depth:.1},i),this.mapGroup.position.copy(this.config.position);let s=ut(this.config.data);this.create(s)}geoProjection(e){return pt().center(this.config.geoProjectionCenter).scale(this.config.geoProjectionScale).translate([0,0])(e)}create(e){e.features.forEach(n=>{var d,a,l;const i=new ot;let{name:s,center:r=[],centroid:c=[]}=n.properties;this.coordinates.push({name:s,center:r,centroid:c});const o={depth:this.config.depth,bevelEnabled:(d=this.config.bevelEnabled)!=null?d:!0,bevelSegments:(a=this.config.bevelSegments)!=null?a:1,bevelThickness:(l=this.config.bevelThickness)!=null?l:.1};let h=[this.config.topFaceMaterial,this.config.sideMaterial];n.geometry.coordinates.forEach(u=>{u.forEach((p,m)=>{const g=new rt;for(let S=0;S<p.length;S++){if(!p[S][0]||!p[S][1])return!1;const[y,w]=this.geoProjection(p[S]);S===0&&g.moveTo(y,-w),g.lineTo(y,-w)}const f=new On(g,o),E=new oe(f,h);i.add(E)})}),this.mapGroup.add(i)})}getCoordinates(){return this.coordinates}setParent(e){e.add(this.mapGroup)}}const _t=new lt,Oe=new k;class nn extends zn{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new gt(e,3)),this.setAttribute("uv",new gt(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,i=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),i.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new Qe(n,6,1);return this.setAttribute("instanceStart",new de(i,3,0)),this.setAttribute("instanceEnd",new de(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new Qe(n,6,1);return this.setAttribute("instanceColorStart",new de(i,3,0)),this.setAttribute("instanceColorEnd",new de(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Dn(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new lt);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),_t.setFromBufferAttribute(n),this.boundingBox.union(_t))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ht),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let s=0;for(let r=0,c=e.count;r<c;r++)Oe.fromBufferAttribute(e,r),s=Math.max(s,i.distanceToSquared(Oe)),Oe.fromBufferAttribute(n,r),s=Math.max(s,i.distanceToSquared(Oe));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}Te.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new G(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};Re.line={uniforms:Yt.merge([Te.common,Te.fog,Te.line]),vertexShader:`
|
|
#include <common>
|
|
#include <color_pars_vertex>
|
|
#include <fog_pars_vertex>
|
|
#include <logdepthbuf_pars_vertex>
|
|
#include <clipping_planes_pars_vertex>
|
|
|
|
uniform float linewidth;
|
|
uniform vec2 resolution;
|
|
|
|
attribute vec3 instanceStart;
|
|
attribute vec3 instanceEnd;
|
|
|
|
attribute vec3 instanceColorStart;
|
|
attribute vec3 instanceColorEnd;
|
|
|
|
#ifdef WORLD_UNITS
|
|
|
|
varying vec4 worldPos;
|
|
varying vec3 worldStart;
|
|
varying vec3 worldEnd;
|
|
|
|
#ifdef USE_DASH
|
|
|
|
varying vec2 vUv;
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
varying vec2 vUv;
|
|
|
|
#endif
|
|
|
|
#ifdef USE_DASH
|
|
|
|
uniform float dashScale;
|
|
attribute float instanceDistanceStart;
|
|
attribute float instanceDistanceEnd;
|
|
varying float vLineDistance;
|
|
|
|
#endif
|
|
|
|
void trimSegment( const in vec4 start, inout vec4 end ) {
|
|
|
|
// trim end segment so it terminates between the camera plane and the near plane
|
|
|
|
// conservative estimate of the near plane
|
|
float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
|
|
float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
|
|
float nearEstimate = - 0.5 * b / a;
|
|
|
|
float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
|
|
|
|
end.xyz = mix( start.xyz, end.xyz, alpha );
|
|
|
|
}
|
|
|
|
void main() {
|
|
|
|
#ifdef USE_COLOR
|
|
|
|
vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
|
|
|
|
#endif
|
|
|
|
#ifdef USE_DASH
|
|
|
|
vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
|
|
vUv = uv;
|
|
|
|
#endif
|
|
|
|
float aspect = resolution.x / resolution.y;
|
|
|
|
// camera space
|
|
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
|
|
vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
|
|
|
|
#ifdef WORLD_UNITS
|
|
|
|
worldStart = start.xyz;
|
|
worldEnd = end.xyz;
|
|
|
|
#else
|
|
|
|
vUv = uv;
|
|
|
|
#endif
|
|
|
|
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
|
|
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
|
|
// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
|
|
// perhaps there is a more elegant solution -- WestLangley
|
|
|
|
bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
|
|
|
|
if ( perspective ) {
|
|
|
|
if ( start.z < 0.0 && end.z >= 0.0 ) {
|
|
|
|
trimSegment( start, end );
|
|
|
|
} else if ( end.z < 0.0 && start.z >= 0.0 ) {
|
|
|
|
trimSegment( end, start );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// clip space
|
|
vec4 clipStart = projectionMatrix * start;
|
|
vec4 clipEnd = projectionMatrix * end;
|
|
|
|
// ndc space
|
|
vec3 ndcStart = clipStart.xyz / clipStart.w;
|
|
vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
|
|
|
|
// direction
|
|
vec2 dir = ndcEnd.xy - ndcStart.xy;
|
|
|
|
// account for clip-space aspect ratio
|
|
dir.x *= aspect;
|
|
dir = normalize( dir );
|
|
|
|
#ifdef WORLD_UNITS
|
|
|
|
vec3 worldDir = normalize( end.xyz - start.xyz );
|
|
vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );
|
|
vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );
|
|
vec3 worldFwd = cross( worldDir, worldUp );
|
|
worldPos = position.y < 0.5 ? start: end;
|
|
|
|
// height offset
|
|
float hw = linewidth * 0.5;
|
|
worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;
|
|
|
|
// don't extend the line if we're rendering dashes because we
|
|
// won't be rendering the endcaps
|
|
#ifndef USE_DASH
|
|
|
|
// cap extension
|
|
worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;
|
|
|
|
// add width to the box
|
|
worldPos.xyz += worldFwd * hw;
|
|
|
|
// endcaps
|
|
if ( position.y > 1.0 || position.y < 0.0 ) {
|
|
|
|
worldPos.xyz -= worldFwd * 2.0 * hw;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
// project the worldpos
|
|
vec4 clip = projectionMatrix * worldPos;
|
|
|
|
// shift the depth of the projected points so the line
|
|
// segments overlap neatly
|
|
vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
|
|
clip.z = clipPose.z * clip.w;
|
|
|
|
#else
|
|
|
|
vec2 offset = vec2( dir.y, - dir.x );
|
|
// undo aspect ratio adjustment
|
|
dir.x /= aspect;
|
|
offset.x /= aspect;
|
|
|
|
// sign flip
|
|
if ( position.x < 0.0 ) offset *= - 1.0;
|
|
|
|
// endcaps
|
|
if ( position.y < 0.0 ) {
|
|
|
|
offset += - dir;
|
|
|
|
} else if ( position.y > 1.0 ) {
|
|
|
|
offset += dir;
|
|
|
|
}
|
|
|
|
// adjust for linewidth
|
|
offset *= linewidth;
|
|
|
|
// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
|
|
offset /= resolution.y;
|
|
|
|
// select end
|
|
vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
|
|
|
|
// back to clip space
|
|
offset *= clip.w;
|
|
|
|
clip.xy += offset;
|
|
|
|
#endif
|
|
|
|
gl_Position = clip;
|
|
|
|
vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
|
|
|
|
#include <logdepthbuf_vertex>
|
|
#include <clipping_planes_vertex>
|
|
#include <fog_vertex>
|
|
|
|
}
|
|
`,fragmentShader:`
|
|
uniform vec3 diffuse;
|
|
uniform float opacity;
|
|
uniform float linewidth;
|
|
|
|
#ifdef USE_DASH
|
|
|
|
uniform float dashOffset;
|
|
uniform float dashSize;
|
|
uniform float gapSize;
|
|
|
|
#endif
|
|
|
|
varying float vLineDistance;
|
|
|
|
#ifdef WORLD_UNITS
|
|
|
|
varying vec4 worldPos;
|
|
varying vec3 worldStart;
|
|
varying vec3 worldEnd;
|
|
|
|
#ifdef USE_DASH
|
|
|
|
varying vec2 vUv;
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
varying vec2 vUv;
|
|
|
|
#endif
|
|
|
|
#include <common>
|
|
#include <color_pars_fragment>
|
|
#include <fog_pars_fragment>
|
|
#include <logdepthbuf_pars_fragment>
|
|
#include <clipping_planes_pars_fragment>
|
|
|
|
vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
|
|
|
|
float mua;
|
|
float mub;
|
|
|
|
vec3 p13 = p1 - p3;
|
|
vec3 p43 = p4 - p3;
|
|
|
|
vec3 p21 = p2 - p1;
|
|
|
|
float d1343 = dot( p13, p43 );
|
|
float d4321 = dot( p43, p21 );
|
|
float d1321 = dot( p13, p21 );
|
|
float d4343 = dot( p43, p43 );
|
|
float d2121 = dot( p21, p21 );
|
|
|
|
float denom = d2121 * d4343 - d4321 * d4321;
|
|
|
|
float numer = d1343 * d4321 - d1321 * d4343;
|
|
|
|
mua = numer / denom;
|
|
mua = clamp( mua, 0.0, 1.0 );
|
|
mub = ( d1343 + d4321 * ( mua ) ) / d4343;
|
|
mub = clamp( mub, 0.0, 1.0 );
|
|
|
|
return vec2( mua, mub );
|
|
|
|
}
|
|
|
|
void main() {
|
|
|
|
#include <clipping_planes_fragment>
|
|
|
|
#ifdef USE_DASH
|
|
|
|
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
|
|
|
|
if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
|
|
|
|
#endif
|
|
|
|
float alpha = opacity;
|
|
|
|
#ifdef WORLD_UNITS
|
|
|
|
// Find the closest points on the view ray and the line segment
|
|
vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
|
|
vec3 lineDir = worldEnd - worldStart;
|
|
vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
|
|
|
|
vec3 p1 = worldStart + lineDir * params.x;
|
|
vec3 p2 = rayEnd * params.y;
|
|
vec3 delta = p1 - p2;
|
|
float len = length( delta );
|
|
float norm = len / linewidth;
|
|
|
|
#ifndef USE_DASH
|
|
|
|
#ifdef USE_ALPHA_TO_COVERAGE
|
|
|
|
float dnorm = fwidth( norm );
|
|
alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
|
|
|
|
#else
|
|
|
|
if ( norm > 0.5 ) {
|
|
|
|
discard;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#ifdef USE_ALPHA_TO_COVERAGE
|
|
|
|
// artifacts appear on some hardware if a derivative is taken within a conditional
|
|
float a = vUv.x;
|
|
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
float len2 = a * a + b * b;
|
|
float dlen = fwidth( len2 );
|
|
|
|
if ( abs( vUv.y ) > 1.0 ) {
|
|
|
|
alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
if ( abs( vUv.y ) > 1.0 ) {
|
|
|
|
float a = vUv.x;
|
|
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
float len2 = a * a + b * b;
|
|
|
|
if ( len2 > 1.0 ) discard;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
vec4 diffuseColor = vec4( diffuse, alpha );
|
|
|
|
#include <logdepthbuf_fragment>
|
|
#include <color_fragment>
|
|
|
|
gl_FragColor = vec4( diffuseColor.rgb, alpha );
|
|
|
|
#include <tonemapping_fragment>
|
|
#include <colorspace_fragment>
|
|
#include <fog_fragment>
|
|
#include <premultiplied_alpha_fragment>
|
|
|
|
}
|
|
`};class sn extends Bn{constructor(e){super({type:"LineMaterial",uniforms:Yt.clone(Re.line.uniforms),vertexShader:Re.line.vertexShader,fragmentShader:Re.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1))}}const Ut=new k,It=new k,W=new Ge,F=new Ge,te=new Ge,qe=new k,Xe=new at,H=new Tn,Nt=new k,ze=new lt,De=new Ht,ne=new Ge;let ie,ce;function jt(t,e,n){return ne.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),ne.multiplyScalar(1/ne.w),ne.x=ce/n.width,ne.y=ce/n.height,ne.applyMatrix4(t.projectionMatrixInverse),ne.multiplyScalar(1/ne.w),Math.abs(Math.max(ne.x,ne.y))}function Ti(t,e){const n=t.matrixWorld,i=t.geometry,s=i.attributes.instanceStart,r=i.attributes.instanceEnd,c=Math.min(i.instanceCount,s.count);for(let o=0,h=c;o<h;o++){H.start.fromBufferAttribute(s,o),H.end.fromBufferAttribute(r,o),H.applyMatrix4(n);const d=new k,a=new k;ie.distanceSqToSegment(H.start,H.end,a,d),a.distanceTo(d)<ce*.5&&e.push({point:a,pointOnLine:d,distance:ie.origin.distanceTo(a),object:t,face:null,faceIndex:o,uv:null,uv1:null})}}function Ri(t,e,n){const i=e.projectionMatrix,r=t.material.resolution,c=t.matrixWorld,o=t.geometry,h=o.attributes.instanceStart,d=o.attributes.instanceEnd,a=Math.min(o.instanceCount,h.count),l=-e.near;ie.at(1,te),te.w=1,te.applyMatrix4(e.matrixWorldInverse),te.applyMatrix4(i),te.multiplyScalar(1/te.w),te.x*=r.x/2,te.y*=r.y/2,te.z=0,qe.copy(te),Xe.multiplyMatrices(e.matrixWorldInverse,c);for(let u=0,p=a;u<p;u++){if(W.fromBufferAttribute(h,u),F.fromBufferAttribute(d,u),W.w=1,F.w=1,W.applyMatrix4(Xe),F.applyMatrix4(Xe),W.z>l&&F.z>l)continue;if(W.z>l){const y=W.z-F.z,w=(W.z-l)/y;W.lerp(F,w)}else if(F.z>l){const y=F.z-W.z,w=(F.z-l)/y;F.lerp(W,w)}W.applyMatrix4(i),F.applyMatrix4(i),W.multiplyScalar(1/W.w),F.multiplyScalar(1/F.w),W.x*=r.x/2,W.y*=r.y/2,F.x*=r.x/2,F.y*=r.y/2,H.start.copy(W),H.start.z=0,H.end.copy(F),H.end.z=0;const g=H.closestPointToPointParameter(qe,!0);H.at(g,Nt);const f=Rn.lerp(W.z,F.z,g),E=f>=-1&&f<=1,S=qe.distanceTo(Nt)<ce*.5;if(E&&S){H.start.fromBufferAttribute(h,u),H.end.fromBufferAttribute(d,u),H.start.applyMatrix4(c),H.end.applyMatrix4(c);const y=new k,w=new k;ie.distanceSqToSegment(H.start,H.end,w,y),n.push({point:w,pointOnLine:y,distance:ie.origin.distanceTo(w),object:t,face:null,faceIndex:u,uv:null,uv1:null})}}}class _i extends oe{constructor(e=new nn,n=new sn({color:Math.random()*16777215})){super(e,n),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,n=e.attributes.instanceStart,i=e.attributes.instanceEnd,s=new Float32Array(2*n.count);for(let c=0,o=0,h=n.count;c<h;c++,o+=2)Ut.fromBufferAttribute(n,c),It.fromBufferAttribute(i,c),s[o]=o===0?0:s[o-1],s[o+1]=s[o]+Ut.distanceTo(It);const r=new Qe(s,2,1);return e.setAttribute("instanceDistanceStart",new de(r,1,0)),e.setAttribute("instanceDistanceEnd",new de(r,1,1)),this}raycast(e,n){const i=this.material.worldUnits,s=e.camera;s===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const r=e.params.Line2!==void 0&&e.params.Line2.threshold||0;ie=e.ray;const c=this.matrixWorld,o=this.geometry,h=this.material;ce=h.linewidth+r,o.boundingSphere===null&&o.computeBoundingSphere(),De.copy(o.boundingSphere).applyMatrix4(c);let d;if(i)d=ce*.5;else{const l=Math.max(s.near,De.distanceToPoint(ie.origin));d=jt(s,l,h.resolution)}if(De.radius+=d,ie.intersectsSphere(De)===!1)return;o.boundingBox===null&&o.computeBoundingBox(),ze.copy(o.boundingBox).applyMatrix4(c);let a;if(i)a=ce*.5;else{const l=Math.max(s.near,ze.distanceToPoint(ie.origin));a=jt(s,l,h.resolution)}ze.expandByScalar(a),ie.intersectsBox(ze)!==!1&&(i?Ti(this,n):Ri(this,s,n))}}class rn extends nn{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const n=e.length-3,i=new Float32Array(2*n);for(let s=0;s<n;s+=3)i[2*s]=e[s],i[2*s+1]=e[s+1],i[2*s+2]=e[s+2],i[2*s+3]=e[s+3],i[2*s+4]=e[s+4],i[2*s+5]=e[s+5];return super.setPositions(i),this}setColors(e){const n=e.length-3,i=new Float32Array(2*n);for(let s=0;s<n;s+=3)i[2*s]=e[s],i[2*s+1]=e[s+1],i[2*s+2]=e[s+2],i[2*s+3]=e[s+3],i[2*s+4]=e[s+4],i[2*s+5]=e[s+5];return super.setColors(i),this}fromLine(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}}class Ui extends _i{constructor(e=new rn,n=new sn({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}class is{constructor({},e={}){this.config=Object.assign({visibelProvince:"",geoProjectionCenter:[0,0],geoProjectionScale:120,position:new k(0,0,0),data:"",material:new _n({color:16777215}),type:"LineLoop",renderOrder:1,tubeRadius:.2},e);let n=ut(this.config.data),i=this.create(n);this.lineGroup=i,this.lineGroup.position.copy(this.config.position)}geoProjection(e){return pt().center(this.config.geoProjectionCenter).scale(this.config.geoProjectionScale).translate([0,0])(e)}create(e){const{type:n,visibelProvince:i}=this.config;let s=e.features,r=new ye;for(let c=0;c<s.length;c++){const o=s[c];let h=new ye;h.name="meshLineGroup"+c,o.properties.name!==i&&(o.geometry.coordinates.forEach(d=>{const a=[];let l=null;n==="Line2"?(d[0].forEach(u=>{const[p,m]=this.geoProjection(u);a.push(p,-m,0)}),l=this.createLine2(a)):n==="Line3"?(d[0].forEach(u=>{const[p,m]=this.geoProjection(u);a.push(new k(p,-m,0))}),l=this.createLine3(a)):d[0].forEach(u=>{const[p,m]=this.geoProjection(u);a.push(new k(p,-m,0)),l=this.createLine(a)}),h.add(l)}),r.add(h))}return r}createLine3(e){const n=this.config.tubeRadius,i=256*10,s=4,r=!1,{material:c,renderOrder:o}=this.config,h=new Un(e),d=new In(h,i,n,s,r),a=new oe(d,c);return a.name="mapLine3",a.renderOrder=o,a}createLine2(e){const{material:n,renderOrder:i}=this.config,s=new rn;s.setPositions(e);let r=new Ui(s,n);return r.name="mapLine2",r.renderOrder=i,r.computeLineDistances(),r}createLine(e){const{material:n,renderOrder:i,type:s}=this.config,r=new st;r.setFromPoints(e);let c=new Nn(r,n);return c.renderOrder=i,c.name="mapLine",c}setParent(e){e.add(this.lineGroup)}}class ss{constructor(e,n){this.shader=null,this.config=Object.assign({uColor1:2781042,uColor2:860197,size:15,dir:"x"},n),this.init(e)}init(e){let{uColor1:n,uColor2:i,dir:s,size:r}=this.config,c={x:1,y:2,z:3};e.onBeforeCompile=o=>{this.shader=o,o.uniforms=fe(he({},o.uniforms),{uColor1:{value:new Ke(n)},uColor2:{value:new Ke(i)},uDir:{value:c[s]},uSize:{value:r}}),o.vertexShader=o.vertexShader.replace("void main() {",`
|
|
attribute float alpha;
|
|
varying vec3 vPosition;
|
|
varying float vAlpha;
|
|
void main() {
|
|
vAlpha = alpha;
|
|
vPosition = position;
|
|
`),o.fragmentShader=o.fragmentShader.replace("void main() {",`
|
|
varying vec3 vPosition;
|
|
varying float vAlpha;
|
|
uniform vec3 uColor1;
|
|
uniform vec3 uColor2;
|
|
uniform float uDir;
|
|
uniform float uSize;
|
|
|
|
void main() {
|
|
`),o.fragmentShader=o.fragmentShader.replace("#include <opaque_fragment>",`
|
|
#ifdef OPAQUE
|
|
diffuseColor.a = 1.0;
|
|
#endif
|
|
|
|
// https://github.com/mrdoob/three.js/pull/22425
|
|
#ifdef USE_TRANSMISSION
|
|
diffuseColor.a *= transmissionAlpha + 0.1;
|
|
#endif
|
|
// vec3 gradient = mix(uColor1, uColor2, vPosition.x / 15.0);
|
|
vec3 gradient = vec3(0.0,0.0,0.0);
|
|
if(uDir==1.0){
|
|
gradient = mix(uColor1, uColor2, vPosition.x/ uSize);
|
|
}else if(uDir==2.0){
|
|
gradient = mix(uColor1, uColor2, vPosition.z/ uSize);
|
|
}else if(uDir==3.0){
|
|
gradient = mix(uColor1, uColor2, vPosition.y/ uSize);
|
|
}
|
|
outgoingLight = outgoingLight * gradient;
|
|
|
|
|
|
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
`)}}}const rs="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAK+SURBVHgB7dzNbdswGIdxSugCRtGBuklWSO17nXs/J0hHywA11AEMu3wDsLFT5WCJ5PtI/D8nQ5cA/FmxJJLqtofhHBSmPihUAoElEFgCgfVu7ODX95suqOKNXVDpDIElEFgCgSUQWAKBJRBYAoE1G2Q3DJ/j9fRjUGE7DI+f4niEGc0CMYzzKezjx7vWUQwjnMJdF8djDsq8M+QYLu/om0VJGP8OXI/LTc0C+fJhs4/fiIeLQ82hvMaI/zEevsVxCROb/RvSMkpuDCvLVVaLKCUwrGyXvS2hlMKwst6HtIBSEsPKfmO4ZpTSGFaRO/U1otTAsIo9OlkTSi0Mq+izrDWg1MSwij9cXDJKbQyrytPeJaJ4YFjVHr8vCcULw6o6H7IEFE8Mq/oEFRnFG8NymTEkohAwLLcpXBIKBcNynVMnoJAwLPdFDp4oNAwLserEA4WIYXVjK7C9Vr+fY8Gh7e8/Lhha/f5GhDMjJRBYAoElEFgCgSUQWAKBJRBYAoElEFgCgSUQWAKBJRBYAoElEFgCgSUQWAKBJRBYAoElEFgCgSUQWAKBJZDwvIIQs2kIA/K81tYvzKYhBMh/75vyCYHiDgLBSLmjuIK8xrBV6J1HoO11biCk/Rmk7XUuIMTNMhSU6iDUnUsWAaUqCBkj5Y1SDWQJGClPlCogS8JIeaEUB1kiRsoDpSjIkjFStVGKgawBI1UTpQjImjBStVCyg6wRI1UDJSvImjFSpVGygbSAkSqJkgWkJYxUKZTZIC1ipEqgzAJpGSOVG2UyiDBeyokyCWR3OOyFcd0Yyu4wfA83Ngnk2Pe/ziE82WdhvHSJYuNz7MPPcGOTQH5sNk+nPnyMf/xeGNcZSvyS3tv42DiFG0O94q+19Iq/BSQQWAKBJRBYAoElEFgCgSUQWKM3hsovnSGwBAJLILAEAusvLK6Na4P/Au0AAAAASUVORK5CYII=";var Gt=class{constructor(t,e){A(this,"target");A(this,"name");A(this,"intersected");A(this,"wasIntersected",!1);A(this,"wasIntersectedOnMouseDown",!1);A(this,"distance");this.target=t,this.name=e,this.intersected=!1,this.distance=0}},J=class{constructor(t,e=null){A(this,"type");A(this,"cancelBubble");A(this,"originalEvent");A(this,"coords",new G(0,0));A(this,"distance",0);A(this,"intersected",!1);A(this,"wasIntersected",!1);A(this,"wasIntersectedOnMouseDown",!1);this.cancelBubble=!1,this.type=t,this.originalEvent=e}stopPropagation(){this.cancelBubble=!0}},os=class{constructor(t,e,n,i){A(this,"renderer");A(this,"camera");A(this,"domElement");A(this,"bindEventsOnBodyElement");A(this,"autoAdd");A(this,"scene");A(this,"mouse");A(this,"supportsPointerEvents");A(this,"interactiveObjects");A(this,"closestObject");A(this,"raycaster");A(this,"treatTouchEventsAsMouseEvents");A(this,"dispose",()=>{this.domElement.removeEventListener("click",this.onMouseClick),this.supportsPointerEvents&&(this.bindEventsOnBodyElement?this.domElement.ownerDocument.removeEventListener("pointermove",this.onDocumentPointerMove):this.domElement.removeEventListener("pointermove",this.onDocumentPointerMove),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointerup",this.onPointerUp)),this.bindEventsOnBodyElement?this.domElement.ownerDocument.removeEventListener("mousemove",this.onDocumentMouseMove):this.domElement.removeEventListener("mousemove",this.onDocumentMouseMove),this.domElement.removeEventListener("mousedown",this.onMouseDown),this.domElement.removeEventListener("mouseup",this.onMouseUp),this.domElement.removeEventListener("touchstart",this.onTouchStart),this.domElement.removeEventListener("touchmove",this.onTouchMove),this.domElement.removeEventListener("touchend",this.onTouchEnd)});A(this,"add",(t,e=[])=>{if(t&&!this.interactiveObjects.find(n=>n.target===t))if(e.length>0)e.forEach(n=>{let i=t.getObjectByName(n);if(i){let s=new Gt(i,n);this.interactiveObjects.push(s)}});else{let n=new Gt(t,t.name);this.interactiveObjects.push(n)}});A(this,"remove",(t,e=[])=>{!t||(e.length>0?e.forEach(n=>{let i=t.getObjectByName(n);i&&(this.interactiveObjects=this.interactiveObjects.filter(s=>s.target!==i))}):this.interactiveObjects=this.interactiveObjects.filter(n=>n.target!==t))});A(this,"update",()=>{var i;this.raycaster.setFromCamera(this.mouse,this.camera),this.interactiveObjects.forEach(s=>{s.target&&this.checkIntersection(s)}),this.interactiveObjects.sort(function(s,r){return s.distance-r.distance});let t=(i=this.interactiveObjects.find(s=>s.intersected))!=null?i:null;if(t!=this.closestObject){if(this.closestObject){let s=new J("mouseout");this.dispatch(this.closestObject,s)}if(t){let s=new J("mouseover");this.dispatch(t,s)}this.closestObject=t}let e;this.interactiveObjects.forEach(s=>{!s.intersected&&s.wasIntersected&&(e||(e=new J("mouseleave")),this.dispatch(s,e))});let n;this.interactiveObjects.forEach(s=>{s.intersected&&!s.wasIntersected&&(n||(n=new J("mouseenter")),this.dispatch(s,n))})});A(this,"checkIntersection",t=>{let e=this.raycaster.intersectObjects([t.target],!0);if(t.wasIntersected=t.intersected,e.length>0){let n=e[0].distance;e.forEach(i=>{i.distance<n&&(n=i.distance)}),t.intersected=!0,t.distance=n}else t.intersected=!1});A(this,"onDocumentMouseMove",t=>{this.mapPositionToPoint(this.mouse,t.clientX,t.clientY);let e=new J("mousemove",t);this.interactiveObjects.forEach(n=>{this.dispatch(n,e)})});A(this,"onDocumentPointerMove",t=>{this.mapPositionToPoint(this.mouse,t.clientX,t.clientY);let e=new J("pointermove",t);this.interactiveObjects.forEach(n=>{this.dispatch(n,e)})});A(this,"onTouchMove",t=>{t.touches.length>0&&this.mapPositionToPoint(this.mouse,t.touches[0].clientX,t.touches[0].clientY);let e=new J(this.treatTouchEventsAsMouseEvents?"mousemove":"touchmove",t);this.interactiveObjects.forEach(n=>{this.dispatch(n,e)})});A(this,"onMouseClick",t=>{this.update();let e=new J("click",t);this.interactiveObjects.forEach(n=>{n.intersected&&this.dispatch(n,e)})});A(this,"onMouseDown",t=>{this.mapPositionToPoint(this.mouse,t.clientX,t.clientY),this.update();let e=new J("mousedown",t);this.interactiveObjects.forEach(n=>{n.intersected?(n.wasIntersectedOnMouseDown=!0,this.dispatch(n,e)):n.wasIntersectedOnMouseDown=!1})});A(this,"onPointerDown",t=>{this.mapPositionToPoint(this.mouse,t.clientX,t.clientY),this.update();let e=new J("pointerdown",t);this.interactiveObjects.forEach(n=>{n.intersected&&this.dispatch(n,e)})});A(this,"onTouchStart",t=>{t.touches.length>0&&this.mapPositionToPoint(this.mouse,t.touches[0].clientX,t.touches[0].clientY),this.update();let e=new J(this.treatTouchEventsAsMouseEvents?"mousedown":"touchstart",t);this.interactiveObjects.forEach(n=>{n.intersected&&this.dispatch(n,e)})});A(this,"onMouseUp",t=>{let e=new J("mouseup",t);this.interactiveObjects.forEach(n=>{this.dispatch(n,e)})});A(this,"onPointerUp",t=>{let e=new J("pointerup",t);this.interactiveObjects.forEach(n=>{this.dispatch(n,e)})});A(this,"onTouchEnd",t=>{t.touches.length>0&&this.mapPositionToPoint(this.mouse,t.touches[0].clientX,t.touches[0].clientY),this.update();let e=new J(this.treatTouchEventsAsMouseEvents?"mouseup":"touchend",t);this.interactiveObjects.forEach(n=>{this.dispatch(n,e)})});A(this,"dispatch",(t,e)=>{t.target&&!e.cancelBubble&&(e.coords=this.mouse,e.distance=t.distance,e.intersected=t.intersected,e.wasIntersected=t.wasIntersected,e.wasIntersectedOnMouseDown=t.wasIntersectedOnMouseDown,t.target.dispatchEvent(e))});A(this,"mapPositionToPoint",(t,e,n)=>{let i=this.renderer.domElement.getBoundingClientRect();t.x=(e-i.left)/i.width*2-1,t.y=-((n-i.top)/i.height)*2+1});this.renderer=t,this.camera=e,this.domElement=n,this.bindEventsOnBodyElement=i&&typeof i.bindEventsOnBodyElement<"u"?i.bindEventsOnBodyElement:!0,this.scene=i&&typeof i.scene<"u"?i.scene:null,this.scene&&(this.scene.onBeforeRender=()=>{this.autoAdd&&this.scene!==null&&this.scene.traverse(s=>{this.add(s),s.addEventListener("removed",r=>{this.remove(r.target)})}),this.update()}),this.autoAdd=i&&typeof i.autoAdd<"u"?i.autoAdd:!1,this.autoAdd&&this.scene===null&&console.error("Attention: Options.scene needs to be set when using options.autoAdd"),this.mouse=new G(-1,1),this.supportsPointerEvents=!!window.PointerEvent,this.interactiveObjects=[],this.closestObject=null,this.raycaster=new jn,n.addEventListener("click",this.onMouseClick),this.supportsPointerEvents&&(this.bindEventsOnBodyElement?n.ownerDocument.addEventListener("pointermove",this.onDocumentPointerMove):n.addEventListener("pointermove",this.onDocumentPointerMove),n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointerup",this.onPointerUp)),this.bindEventsOnBodyElement?n.ownerDocument.addEventListener("mousemove",this.onDocumentMouseMove):n.addEventListener("mousemove",this.onDocumentMouseMove),n.addEventListener("mousedown",this.onMouseDown),n.addEventListener("mouseup",this.onMouseUp),n.addEventListener("touchstart",this.onTouchStart,{passive:!0}),n.addEventListener("touchmove",this.onTouchMove,{passive:!0}),n.addEventListener("touchend",this.onTouchEnd,{passive:!0}),this.treatTouchEventsAsMouseEvents=!0}};const X={}.VITE_OPEN_API_BASE||"/openApi",Ii=new Date().getFullYear();function Ni(t,e){return/^https?:\/\//.test(e)?e:`${t}${e.startsWith("/")?e:`/${e}`}`}function ji(t){if((t==null?void 0:t.success)===!1&&(t==null?void 0:t.code)!==void 0&&![0,200,"0","200"].includes(t.code))throw new Error((t==null?void 0:t.msg)||(t==null?void 0:t.message)||"接口请求失败");return kn(t)}function K(t,e,n,i={}){return Gn(Ni(t,e),{params:n,timeout:i.timeout||18e3}).then(ji)}function Gi(){return K(X,"/screen2/yak-management/distribution").then(t=>on(t))}function ki(){return K(X,"/screen2/yak-management/structure").then(t=>on(t))}function as(){return K(X,"/screen2/yak-management/profile").then(t=>t||{})}function ls(t=Ii){return K(X,"/screen2/yak-trade/dashboard",typeof t=="object"?t:{year:t}).then(Wi)}function cs(){return K(X,"/screen2/yak-trade/options").then(t=>t||{})}function us(t={}){return K(X,"/screen2/yak-trade/ledger",t).then(Fi)}function hs(t={}){return K(X,"/screen2/yak-slaughter/dashboard",t).then(e=>e||{})}function fs(){return K(X,"/screen2/yak-slaughter/options").then(t=>t||{})}function ds(t={}){return K(X,"/screen2/yak-slaughter/ledger",t).then(e=>e||{})}function Wi(t={}){var r,c;const e=Array.isArray(t.metrics)?t.metrics:[],n=o=>{var h;return Number(((h=e.find(d=>d.key===o))==null?void 0:h.value)||0)},i=Array.isArray(t.certificateStructure)?t.certificateStructure:[],s=(o,h)=>{var d;return Number(((d=i.find(a=>a.key===o))==null?void 0:d[h])||0)};return fe(he({},t),{hasData:(c=(r=t.requestedHasData)!=null?r:t.hasData)!=null?c:!1,year:t.displayYear,metrics:{headCount:n("headCount"),totalHeads:n("headCount"),recordCount:n("recordCount"),totalRecords:n("recordCount"),vehicleCount:n("vehicleCount"),outProvinceHeads:s("A证","value"),outProvinceCount:s("A证","recordCount"),aCertHeads:s("A证","value"),aCertCount:s("A证","recordCount"),inProvinceHeads:s("B证","value"),inProvinceCount:s("B证","recordCount"),bCertHeads:s("B证","value"),bCertCount:s("B证","recordCount")},startTownCounts:t.townRanking||[],usageCounts:t.usageStructure||[],transportNumberCounts:t.vehicleRanking||[],destinationCounts:t.destinationRanking||[]})}function Fi(t={}){const e=Array.isArray(t.rows)?t.rows.map(n=>({certId:n.recordKey,factoryCode:n.recordKey,certType:n.certType,certScopeName:n.certType,ownerName:n.ownerDisplay,ownerPhone:"",transportNumber:n.vehicleDisplay,amount:n.amount,unitName:n.unit||"头",animalTypeName:"",usageTypeName:n.usageType,startTown:n.startTown,startRegionFullName:n.startTown,destProvince:n.destProvince,destRegionFullName:n.destProvince,quarantineOfficerName:"",issueTime:n.issueDate,statusName:n.status})):[];return fe(he({},t),{rows:e})}function ps(t={}){return K(X,"/screen2/yak-management/epidemic/analysis",t).then(e=>e||{})}function ms(t={}){return K(X,"/screen2/yak-management/epidemic/records",t).then(e=>e||{})}function vs(t={}){return K(X,"/screen2/yak-management/epidemic/stats",t).then(e=>e||{})}function gs(t={}){return K(X,"/screen2/yak-management/epidemic/village-stats",t).then(e=>e||{})}function ws(t){return K(X,"/screen2/yak-management/epidemic/detail",{earTag:t}).then(e=>e||null)}function ys(){return He(this,null,function*(){return(yield Gi()).map((e,n)=>({key:le(e,["areaCode","area_code","code","id"],`yak-town-${n}`),name:le(e,["areaName","area_name","zoneName","townName","name"],`区域${n+1}`),value:an(le(e,["number","yakCount","yak_count","count","value"])),unit:"头"})).filter(e=>e.name&&Number.isFinite(e.value)).sort((e,n)=>n.value-e.value)})}function Ss(){return He(this,null,function*(){const e=(yield ki()).map((n,i)=>{const s=le(n,["sex","gender"],""),r=Yi(s),c=le(n,["ageRange","age_range","age","name","type"],""),o=[r,c].filter(Boolean).join(" ")||`结构${i+1}`;return{key:le(n,["id","key"],`${o}-${i}`),name:o,value:an(le(n,["number","count","value"])),unit:"头"}}).filter(n=>n.name&&Number.isFinite(n.value));return Hi(e)})}function on(t){return Array.isArray(t)?t:Array.isArray(t==null?void 0:t.rows)?t.rows:Array.isArray(t==null?void 0:t.list)?t.list:Array.isArray(t==null?void 0:t.records)?t.records:Array.isArray(t==null?void 0:t.data)?t.data:[]}function Hi(t=[]){const e=new Map;return t.forEach(n=>{const i=e.get(n.name)||fe(he({},n),{value:0});i.value+=n.value,e.set(n.name,i)}),[...e.values()].sort((n,i)=>i.value-n.value)}function le(t,e,n=""){for(const i of e){const s=t==null?void 0:t[i];if(s!=null&&s!=="")return s}return n}function Yi(t){return["boy","male","公","公牛"].includes(t)?"公牛":["girl","female","母","母牛"].includes(t)?"母牛":t||""}function an(t){if(t==null||t==="")return NaN;const e=Number(String(t).replace(/,/g,"").replace(/%/g,""));return Number.isFinite(e)?e:NaN}export{ts as B,Qi as D,ns as E,ss as G,Zi as L,Ki as M,es as P,is as a,$i as b,tn as c,ds as d,as as e,ys as f,pt as g,os as h,Ss as i,cs as j,ls as k,rs as l,us as m,hs as n,fs as o,ps as p,ms as q,vs as r,gs as s,ws as t};
|
|
|