brainsmatics 1.0.97 → 1.0.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{deflate-4d6254d5.mjs → deflate-3de676da.mjs} +1 -1
- package/dist/{deflate-5555774b.js → deflate-b00c3ba5.js} +1 -1
- package/dist/{index-a7ff0af2.mjs → index-3d947682.mjs} +3 -3
- package/dist/{index-cc5fed18.js → index-a3c82190.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{lerc-d8773d08.mjs → lerc-216552b9.mjs} +1 -1
- package/dist/{lerc-18931f4b.js → lerc-9800b656.js} +1 -1
- package/package.json +1 -1
|
@@ -4217,7 +4217,7 @@ version 0.6.9
|
|
|
4217
4217
|
<span style='font-weight:bold'>Mouse Position: </span><span style='font-weight:normal'>M-L </span>${Ve}mm /<span style='font-weight:normal'> D-V </span>${Ae}mm /<span style='font-weight:normal'> A-P </span>${Qe}mm<br>
|
|
4218
4218
|
`)}if(an=="Points"){let Ve=(pr.x-Wn.x).toFixed(2),Ae=(pr.y-Wn.y).toFixed(2),Qe=-(pr.z-Wn.z).toFixed(2);wt!=""&&(Tn=`<span style='font-weight:bold'>Lable Name: ${wt}</span><br>
|
|
4219
4219
|
<span style='font-weight:bold'>Mouse Position: </span><span style='font-weight:normal'>M-L </span>${Ve}mm /<span style='font-weight:normal'> D-V </span>${Ae}mm /<span style='font-weight:normal'> A-P </span>${Qe}mm<br>
|
|
4220
|
-
`)}_e(Tn);const Dr=Me.current.rotation,hn=new Ie(Dr.x,Dr.y,Dr.z).negate(),ar=new ed(hn.x,hn.y,hn.z),Qn=new wi().makeRotationFromEuler(ar);pr.z>-8&&pr.y>-5.57&&pr.x<5.16&&pr.x>-5.18&&(dt.current&&(dt.current.mouseLine_w.position.z=pr.z,dt.current.mouseLine_w.position.x=0,dt.current.mouseLine_h.position.x=pr.x,dt.current.mouseLine_h.position.z=0,dt.current.mouseLine_w.position.y=dt.current.mouseLine_w.userData.initY,dt.current.mouseLine_h.position.y=dt.current.mouseLine_h.userData.initY,(er=dt.current)==null||er.mouseLine_w.position.applyMatrix4(Qn),(sr=dt.current)==null||sr.mouseLine_h.position.applyMatrix4(Qn),(ei=dt.current)==null||ei.mouseLine_w.updateMatrix(),(cn=dt.current)==null||cn.mouseLine_h.updateMatrix()),ft.current&&(ft.current.mouseLine_w.position.y=pr.y,ft.current.mouseLine_w.position.x=0,ft.current.mouseLine_h.position.x=pr.x,ft.current.mouseLine_h.position.y=0,ft.current.mouseLine_w.position.z=ft.current.mouseLine_w.userData.initZ,ft.current.mouseLine_h.position.z=ft.current.mouseLine_h.userData.initZ,(Pn=ft.current)==null||Pn.mouseLine_w.position.applyMatrix4(Qn),(Ir=ft.current)==null||Ir.mouseLine_h.position.applyMatrix4(Qn),(ti=ft.current)==null||ti.mouseLine_w.updateMatrix(),(Wi=ft.current)==null||Wi.mouseLine_h.updateMatrix()),Ze.current&&(Ze.current.mouseLine_w.position.z=pr.z,Ze.current.mouseLine_w.position.x=0,Ze.current.mouseLine_h.position.x=pr.x,Ze.current.mouseLine_h.position.z=0,Ze.current.mouseLine_w.position.y=Ze.current.mouseLine_w.userData.initY,Ze.current.mouseLine_h.position.y=Ze.current.mouseLine_h.userData.initY,(Yi=Ze.current)==null||Yi.mouseLine_w.position.applyMatrix4(Qn),(vi=Ze.current)==null||vi.mouseLine_h.position.applyMatrix4(Qn),(ri=Ze.current)==null||ri.mouseLine_w.updateMatrix(),(co=Ze.current)==null||co.mouseLine_h.updateMatrix()),tt.current&&(tt.current.mouseLine_w.position.y=pr.y,tt.current.mouseLine_w.position.z=0,tt.current.mouseLine_h.position.z=pr.z,tt.current.mouseLine_h.position.y=0,tt.current.mouseLine_w.position.x=tt.current.mouseLine_w.userData.initX,tt.current.mouseLine_h.position.x=tt.current.mouseLine_h.userData.initX,(ta=tt.current)==null||ta.mouseLine_w.position.applyMatrix4(Qn),(Vn=tt.current)==null||Vn.mouseLine_h.position.applyMatrix4(Qn),(yt=tt.current)==null||yt.mouseLine_w.updateMatrix(),(Re=tt.current)==null||Re.mouseLine_h.updateMatrix()),Ye.current&&(Ye.current.mouseLine_w.position.y=pr.y,Ye.current.mouseLine_w.position.x=0,Ye.current.mouseLine_h.position.x=pr.x,Ye.current.mouseLine_h.position.y=0,Ye.current.mouseLine_w.position.z=Ye.current.mouseLine_w.userData.initZ,Ye.current.mouseLine_h.position.z=Ye.current.mouseLine_h.userData.initZ,(Je=Ye.current)==null||Je.mouseLine_w.position.applyMatrix4(Qn),($e=Ye.current)==null||$e.mouseLine_h.position.applyMatrix4(Qn),(at=Ye.current)==null||at.mouseLine_w.updateMatrix(),(ct=Ye.current)==null||ct.mouseLine_h.updateMatrix()),rt.current&&(rt.current.mouseLine_w.position.y=pr.y,rt.current.mouseLine_w.position.z=0,rt.current.mouseLine_h.position.z=pr.z,rt.current.mouseLine_h.position.y=0,rt.current.mouseLine_w.position.x=rt.current.mouseLine_w.userData.initX,rt.current.mouseLine_h.position.x=rt.current.mouseLine_h.userData.initX,(mt=rt.current)==null||mt.mouseLine_w.position.applyMatrix4(Qn),(it=rt.current)==null||it.mouseLine_h.position.applyMatrix4(Qn),(be=rt.current)==null||be.mouseLine_w.updateMatrix(),(ce=rt.current)==null||ce.mouseLine_h.updateMatrix()))},En=Yt=>{e==null||e.domElement.removeEventListener("mousemove",H.current,!1),e==null||e.domElement.addEventListener("mouseup",_n,!1)},_n=Yt=>{e==null||e.domElement.addEventListener("mousemove",H.current,!1),e==null||e.domElement.removeEventListener("mouseup",_n,!1),Tr(),In()},In=()=>{for(let Yt in p.current)p.current[Yt].lookAt(Ti.current.position)},Jn=Yt=>{var wt=new WX(Yt,{size:.7,height:.01,font:vt.current,curveSegments:5,bevelEnabled:!1}),an=new kl({color:0,specular:0,shininess:0});let ot=new nr(wt,an);return ot.castShadow=!0,ot},vr=(Yt,wt,an,ot,Tn,pr,Wn,Dr,hn)=>{let ar=new yo;function Qn(ei){return typeof ei=="number"&&ei%1===0}hn=hn==0?hn:1,Dr=Dr||new Ie(0,0,0);let er=Qn(Tn)?ot/Tn:0,sr=Qn(Tn)?(Wn-pr)/Tn:0;if(er==0||sr==0)return ar;for(let ei=hn;ei<Tn;ei++){let cn=(pr+ei*sr).toFixed(2),Pn=an.clone().multiplyScalar(er*ei),Ir=wt.clone().add(Pn),ti=Jn(cn);ti.position.set(Ir.x+Dr.x,Ir.y+Dr.y,Ir.z+Dr.z),ti.up.set(Yt.x,Yt.y,Yt.z),ti.scale.set(.2,.2,.25),ti.lookAt(Ti.current.position),ar.add(ti);const Wi=Me.current.rotation,Yi=new Ie(Wi.x,Wi.y,Wi.z).negate(),vi=new ed(Yi.x,Yi.y,Yi.z);ar.rotation.copy(vi),p.current.push(ti)}return ar},Tr=()=>{var ar,Qn,er,sr,ei,cn,Pn,Ir,ti,Wi,Yi,vi,ri,co,ta,Vn,yt,Re,Je,$e,at,ct,mt,it,be,ce,Ve,Ae,Qe,gt,Bt,Lt,qt,Ct,Xt,Yn,mr,On,Rn,Yr,$r,pn,Jt,si,Pr,jr,xs,ga,xo,li,Jr,Ki,ts,Ia,Go,Ml,Xs,ks,Ha,ka,Zs,il,Us,dr,Qa,Yo,Ks,Cs,Va,Uo,Fo,io,Mo,hl,Zl,Bo,Lo,jo,Ys,fs,Kl,pl,rc,ic,vl,gl,hs,pc,ac,Ll,Bu,os,dd,Vo,ml,ss,Yl,Fs,nu,fd,ru,hd,oc,Uc,vc,Fc,sc,bu,gc,xu,al,yl,Rl,qs,bl,Js,Ii,Qs,ao,Cu,Bc,Vu,iu,$u,au,ou,Vc,lc,zu,E,D,X,le,Ce,qe,Ot,sn,vn,Kn,Wr,_i,qi,qo,uo,ps,Oo,ql,ol,Hu,Su,Ol,sl,Jl,Co,mc,pd,Jo,wu,ll,Qo,yc,Eu,$c,Cv,Gu,Zm;let Yt=n.current.target.clone().sub(Ti.current.position.clone()),wt,an,ot,Tn=!1,pr=!1,Wn=!1,Dr=!1,hn=Ti.current.up.y<=0;hn?((Qn=(ar=Ze.current)==null?void 0:ar.coordText_lb)==null||Qn.children.forEach(Bs=>{Bs.up.set(0,-1,0)}),(sr=(er=Ze.current)==null?void 0:er.coordText_lf)==null||sr.children.forEach(Bs=>{Bs.up.set(0,-1,0)}),(cn=(ei=Ze.current)==null?void 0:ei.coordText_rf)==null||cn.children.forEach(Bs=>{Bs.up.set(0,-1,0)}),(Ir=(Pn=Ze.current)==null?void 0:Pn.coordText_rb)==null||Ir.children.forEach(Bs=>{Bs.up.set(0,-1,0)})):((Wi=(ti=Ze.current)==null?void 0:ti.coordText_lb)==null||Wi.children.forEach(Bs=>{Bs.up.set(0,1,0)}),(vi=(Yi=Ze.current)==null?void 0:Yi.coordText_lf)==null||vi.children.forEach(Bs=>{Bs.up.set(0,1,0)}),(co=(ri=Ze.current)==null?void 0:ri.coordText_rf)==null||co.children.forEach(Bs=>{Bs.up.set(0,1,0)}),(Vn=(ta=Ze.current)==null?void 0:ta.coordText_rb)==null||Vn.children.forEach(Bs=>{Bs.up.set(0,1,0)})),wt=(yt=ft.current)==null?void 0:yt.normalVector,ot=ft,an=wt&&Yt.dot(wt),pr=!1,(Re=ot.current)!=null&&Re.coordMesh&&Me.current.remove((Je=ot.current)==null?void 0:Je.coordMesh),($e=ot.current)!=null&&$e.mouseLine_w&&Me.current.remove((at=ot.current)==null?void 0:at.mouseLine_w),(ct=ot.current)!=null&&ct.mouseLine_h&&Me.current.remove((mt=ot.current)==null?void 0:mt.mouseLine_h),typeof((it=ot.current)==null?void 0:it.coordText)=="object"&&Me.current.remove((be=ot.current)==null?void 0:be.coordText),typeof((ce=ot.current)==null?void 0:ce.coordTextReverse)=="object"&&Me.current.remove((Ve=ot.current)==null?void 0:Ve.coordTextReverse),an&&an>=0&&(pr=!0,(Ae=ot.current)!=null&&Ae.coordMesh&&Me.current.add((Qe=ot.current)==null?void 0:Qe.coordMesh),(gt=ot.current)!=null&>.mouseLine_w&&Me.current.add((Bt=ot.current)==null?void 0:Bt.mouseLine_w),(Lt=ot.current)!=null&&Lt.mouseLine_h&&Me.current.add((qt=ot.current)==null?void 0:qt.mouseLine_h),hn?typeof((Ct=ot.current)==null?void 0:Ct.coordText)=="object"&&Me.current.add((Xt=ot.current)==null?void 0:Xt.coordText):typeof((Yn=ot.current)==null?void 0:Yn.coordTextReverse)=="object"&&Me.current.add((mr=ot.current)==null?void 0:mr.coordTextReverse)),wt=(On=Ye.current)==null?void 0:On.normalVector,ot=Ye,an=wt&&Yt.dot(wt),Tn=!1,(Rn=ot.current)!=null&&Rn.coordMesh&&Me.current.remove((Yr=ot.current)==null?void 0:Yr.coordMesh),($r=ot.current)!=null&&$r.mouseLine_w&&Me.current.remove((pn=ot.current)==null?void 0:pn.mouseLine_w),(Jt=ot.current)!=null&&Jt.mouseLine_h&&Me.current.remove((si=ot.current)==null?void 0:si.mouseLine_h),typeof((Pr=ot.current)==null?void 0:Pr.coordText)=="object"&&Me.current.remove((jr=ot.current)==null?void 0:jr.coordText),typeof((xs=ot.current)==null?void 0:xs.coordTextReverse)=="object"&&Me.current.remove((ga=ot.current)==null?void 0:ga.coordTextReverse),an&&an>=0&&(Tn=!0,(xo=ot.current)!=null&&xo.coordMesh&&Me.current.add((li=ot.current)==null?void 0:li.coordMesh),(Jr=ot.current)!=null&&Jr.mouseLine_w&&Me.current.add((Ki=ot.current)==null?void 0:Ki.mouseLine_w),(ts=ot.current)!=null&&ts.mouseLine_h&&Me.current.add((Ia=ot.current)==null?void 0:Ia.mouseLine_h),hn?typeof((Go=ot.current)==null?void 0:Go.coordText)=="object"&&Me.current.add((Ml=ot.current)==null?void 0:Ml.coordText):typeof((Xs=ot.current)==null?void 0:Xs.coordTextReverse)=="object"&&Me.current.add((ks=ot.current)==null?void 0:ks.coordTextReverse)),wt=(Ha=tt.current)==null?void 0:Ha.normalVector,ot=tt,an=wt&&Yt.dot(wt),Wn=!1,(ka=ot.current)!=null&&ka.coordMesh&&Me.current.remove((Zs=ot.current)==null?void 0:Zs.coordMesh),(il=ot.current)!=null&&il.mouseLine_w&&Me.current.remove((Us=ot.current)==null?void 0:Us.mouseLine_w),(dr=ot.current)!=null&&dr.mouseLine_h&&Me.current.remove((Qa=ot.current)==null?void 0:Qa.mouseLine_h),typeof((Yo=ot.current)==null?void 0:Yo.coordText)=="object"&&Me.current.remove((Ks=ot.current)==null?void 0:Ks.coordText),typeof((Cs=ot.current)==null?void 0:Cs.coordTextReverse)=="object"&&Me.current.remove((Va=ot.current)==null?void 0:Va.coordTextReverse),an&&an>=0&&(Wn=!0,(Uo=ot.current)!=null&&Uo.coordMesh&&Me.current.add((Fo=ot.current)==null?void 0:Fo.coordMesh),(io=ot.current)!=null&&io.mouseLine_w&&Me.current.add((Mo=ot.current)==null?void 0:Mo.mouseLine_w),(hl=ot.current)!=null&&hl.mouseLine_h&&Me.current.add((Zl=ot.current)==null?void 0:Zl.mouseLine_h),hn?typeof((Bo=ot.current)==null?void 0:Bo.coordText)=="object"&&Me.current.add((Lo=ot.current)==null?void 0:Lo.coordText):typeof((jo=ot.current)==null?void 0:jo.coordTextReverse)=="object"&&Me.current.add((Ys=ot.current)==null?void 0:Ys.coordTextReverse)),wt=(fs=rt.current)==null?void 0:fs.normalVector,ot=rt,an=wt&&Yt.dot(wt),Dr=!1,(Kl=ot.current)!=null&&Kl.coordMesh&&Me.current.remove((pl=ot.current)==null?void 0:pl.coordMesh),(rc=ot.current)!=null&&rc.mouseLine_w&&Me.current.remove((ic=ot.current)==null?void 0:ic.mouseLine_w),(vl=ot.current)!=null&&vl.mouseLine_h&&Me.current.remove((gl=ot.current)==null?void 0:gl.mouseLine_h),typeof((hs=ot.current)==null?void 0:hs.coordText)=="object"&&Me.current.remove((pc=ot.current)==null?void 0:pc.coordText),typeof((ac=ot.current)==null?void 0:ac.coordTextReverse)=="object"&&Me.current.remove((Ll=ot.current)==null?void 0:Ll.coordTextReverse),an&&an>=0&&(Dr=!0,(Bu=ot.current)!=null&&Bu.coordMesh&&Me.current.add((os=ot.current)==null?void 0:os.coordMesh),(dd=ot.current)!=null&&dd.mouseLine_w&&Me.current.add((Vo=ot.current)==null?void 0:Vo.mouseLine_w),(ml=ot.current)!=null&&ml.mouseLine_h&&Me.current.add((ss=ot.current)==null?void 0:ss.mouseLine_h),hn?typeof((Yl=ot.current)==null?void 0:Yl.coordText)=="object"&&Me.current.add((Fs=ot.current)==null?void 0:Fs.coordText):typeof((nu=ot.current)==null?void 0:nu.coordTextReverse)=="object"&&Me.current.add((fd=ot.current)==null?void 0:fd.coordTextReverse)),wt=(ru=Ze.current)==null?void 0:ru.normalVector,ot=Ze,an=wt&&Yt.dot(wt),an&&an>=0?((hd=ot.current)!=null&&hd.coordMesh&&Me.current.add((oc=ot.current)==null?void 0:oc.coordMesh),(Uc=ot.current)!=null&&Uc.mouseLine_w&&Me.current.add((vc=ot.current)==null?void 0:vc.mouseLine_w),(Fc=ot.current)!=null&&Fc.mouseLine_h&&Me.current.add((sc=ot.current)==null?void 0:sc.mouseLine_h),(bu=ot.current)!=null&&bu.coordText_lb&&Me.current.remove((gc=ot.current)==null?void 0:gc.coordText_lb),(xu=ot.current)!=null&&xu.coordText_rb&&Me.current.remove((al=ot.current)==null?void 0:al.coordText_rb),(yl=ot.current)!=null&&yl.coordText_lf&&Me.current.remove((Rl=ot.current)==null?void 0:Rl.coordText_lf),(qs=ot.current)!=null&&qs.coordText_rf&&Me.current.remove((bl=ot.current)==null?void 0:bl.coordText_rf),pr&&Wn?(Js=ot.current)!=null&&Js.coordText_lb&&Me.current.add((Ii=ot.current)==null?void 0:Ii.coordText_lb):pr&&Dr?(Qs=ot.current)!=null&&Qs.coordText_rb&&Me.current.add((ao=ot.current)==null?void 0:ao.coordText_rb):Tn&&Dr?(Cu=ot.current)!=null&&Cu.coordText_rf&&Me.current.add((Bc=ot.current)==null?void 0:Bc.coordText_rf):Tn&&Wn&&(Vu=ot.current)!=null&&Vu.coordText_lf&&Me.current.add((iu=ot.current)==null?void 0:iu.coordText_lf)):(($u=ot.current)!=null&&$u.coordMesh&&Me.current.remove((au=ot.current)==null?void 0:au.coordMesh),(ou=ot.current)!=null&&ou.mouseLine_w&&Me.current.remove((Vc=ot.current)==null?void 0:Vc.mouseLine_w),(lc=ot.current)!=null&&lc.mouseLine_h&&Me.current.remove((zu=ot.current)==null?void 0:zu.mouseLine_h),(E=ot.current)!=null&&E.coordText_lb&&Me.current.remove((D=ot.current)==null?void 0:D.coordText_lb),(X=ot.current)!=null&&X.coordText_rb&&Me.current.remove((le=ot.current)==null?void 0:le.coordText_rb),(Ce=ot.current)!=null&&Ce.coordText_lf&&Me.current.remove((qe=ot.current)==null?void 0:qe.coordText_lf),(Ot=ot.current)!=null&&Ot.coordText_rf&&Me.current.remove((sn=ot.current)==null?void 0:sn.coordText_rf)),wt=(vn=dt.current)==null?void 0:vn.normalVector,ot=dt,an=wt&&Yt.dot(wt),an&&an>=0?((Kn=ot.current)!=null&&Kn.coordMesh&&Me.current.add((Wr=ot.current)==null?void 0:Wr.coordMesh),(_i=ot.current)!=null&&_i.mouseLine_w&&Me.current.add((qi=ot.current)==null?void 0:qi.mouseLine_w),(qo=ot.current)!=null&&qo.mouseLine_h&&Me.current.add((uo=ot.current)==null?void 0:uo.mouseLine_h),(ps=Ze.current)!=null&&ps.coordText_lb&&Me.current.remove((Oo=Ze.current)==null?void 0:Oo.coordText_lb),(ql=Ze.current)!=null&&ql.coordText_rb&&Me.current.remove((ol=Ze.current)==null?void 0:ol.coordText_rb),(Hu=Ze.current)!=null&&Hu.coordText_lf&&Me.current.remove((Su=Ze.current)==null?void 0:Su.coordText_lf),(Ol=Ze.current)!=null&&Ol.coordText_rf&&Me.current.remove((sl=Ze.current)==null?void 0:sl.coordText_rf),pr&&Wn?(Jl=Ze.current)!=null&&Jl.coordText_lb&&Me.current.add((Co=Ze.current)==null?void 0:Co.coordText_lb):pr&&Dr?(mc=Ze.current)!=null&&mc.coordText_rb&&Me.current.add((pd=Ze.current)==null?void 0:pd.coordText_rb):Tn&&Dr?(Jo=Ze.current)!=null&&Jo.coordText_rf&&Me.current.add((wu=Ze.current)==null?void 0:wu.coordText_rf):Tn&&Wn&&(ll=Ze.current)!=null&&ll.coordText_lf&&Me.current.add((Qo=Ze.current)==null?void 0:Qo.coordText_lf)):((yc=ot.current)!=null&&yc.coordMesh&&Me.current.remove((Eu=ot.current)==null?void 0:Eu.coordMesh),($c=ot.current)!=null&&$c.mouseLine_w&&Me.current.remove((Cv=ot.current)==null?void 0:Cv.mouseLine_w),(Gu=ot.current)!=null&&Gu.mouseLine_h&&Me.current.remove((Zm=ot.current)==null?void 0:Zm.mouseLine_h))},Ci=Yt=>{y!=null&&y.current&&Me.current.remove(y.current);const wt=new Qi().setFromPoints(Yt),an=new Mf({color:255}),ot=new Ua(wt,an);ot.name="Line",y&&(y.current=ot),Me.current.add(ot)},ir=(Yt,wt)=>{const an={flag:ip.current,start_point:Yt,end_point:wt};fetch("/app-api/c-api/findn",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(an)}).then(ot=>{if(ot.ok)return ot.json();throw cs.error({content:"失败"}),new Error(ot.statusText)}).then(ot=>{Wt(ot.name_list)})},Rr=Yt=>{const wt=new Qi().setFromPoints(Yt),an=new Vvt({color:16711680,dashSize:.5,gapSize:.2}),ot=new Ua(wt,an);ot.computeLineDistances(),$n.current=ot,$n.current.name="dashedLine";const Tn=Me.current.getObjectByName("dashedLine");Tn&&Me.current.remove(Tn),Me.current.add($n.current)},Or=Yt=>{var Wn,Dr,hn,ar,Qn,er,sr,ei;if(Yt.preventDefault(),bn.current.x=Yt.offsetX/e.domElement.clientWidth*2-1,bn.current.y=-(Yt.offsetY/e.domElement.clientHeight)*2+1,he.current.setFromCamera(bn.current,Ti.current),he.current.params.Points.threshold=.05,u!=null&&u.current)var wt=he.current.intersectObjects(Me.current.children.filter(cn=>{const Pn=cn instanceof QS;return!["","ExtractedSurface","outline","dashedLine","Line","sphereBig","sphereMiddelClick","test_behind","test_front","test_left","test_right","test_bootom","test_top","test_top_mouseLine_w","test_top_mouseLine_h","test_bottom_mouseLine_w","test_bottom_mouseLine_h","test_left_mouseLine_w","test_left_mouseLine_h","test_right_mouseLine_w","test_right_mouseLine_h","test_front_mouseLine_w","test_front_mouseLine_h",,"test_behind_mouseLine_w","test_behind_mouseLine_h"].includes(cn.name)&&!Pn}),!0);else var wt=he.current.intersectObjects(Me.current.children.filter(Pn=>{const Ir=Pn instanceof QS;return!["","Brain","ExtractedSurface","outline","dashedLine","Line","sphereBig","sphereMiddelClick","test_behind","test_front","test_left","test_right","test_bootom","test_top","test_top_mouseLine_w","test_top_mouseLine_h","test_bottom_mouseLine_w","test_bottom_mouseLine_h","test_left_mouseLine_w","test_left_mouseLine_h","test_right_mouseLine_w","test_right_mouseLine_h","test_front_mouseLine_w","test_front_mouseLine_h",,"test_behind_mouseLine_w","test_behind_mouseLine_h"].includes(Pn.name)&&!Ir}),!0);const an=Me.current.getObjectByName("Brain"),ot=new ed(-Me.current.rotation.x,-Me.current.rotation.y,-Me.current.rotation.z);let Tn;if(an){const cn=new gs;cn.expandByObject(an);const Pn=new Ie;cn.getSize(Pn);const Ir=new Ie;cn.getCenter(Ir);const ti=new zs(Pn.x,Pn.y,Pn.z),Wi=new Qu({color:65280,wireframe:!0}),Yi=new nr(ti,Wi);if(Yi.position.copy(Ir),Tn=he.current.intersectObject(Yi,!0),(b==null?void 0:b.current)==2&&Tn.length>0){const vi=Tn[0].point.clone().applyEuler(ot);let ri=Ir.clone().sub(vi);if(ri.normalize(),wt.length>0&&((m==null?void 0:m.current.length)==2||(m==null?void 0:m.current.length)==1)){ri=wt[0].point.clone().applyEuler(ot).sub(m.current[0]),ri.normalize();const $e=new h7;$e.set(m.current[0],ri);const at=new yE($e.ray.origin,$e.ray.direction),ct=new Ie,mt=at.intersectBox(cn,ct);mt&&hr.current.position.set(mt.x,mt.y,mt.z),ri=ri.negate()}else hr.current.position.set(vi.x,vi.y,vi.z);const co=hr.current.userData.direction,ta=co.dot(ri),Vn=Math.acos(ta),yt=new Ie().crossVectors(co,ri).normalize(),Re=new vo().setFromAxisAngle(yt,Vn);hr.current.rotation.set(0,0,0),hr.current.applyQuaternion(Re),vi.z<-6?hr.current.position.setZ(vi.z+hr.current.userData.center.x):vi.x<-5?hr.current.translateX(hr.current.userData.center.x):vi.y<-3&&hr.current.position.setY(vi.y+hr.current.userData.center.x-.8),Me.current.getObjectByName("syrings")||Me.current.add(hr.current)}}if(wt.length>0){let cn=0;{if((jt.current!=wt[cn].object.parent||jt.current!=wt[cn].object)&&wt[cn].object.parent!=null){if(jt){let Pn=jt.current.name;if(jt.current.myMeshType=="SWC")jt.current.children[0].material.color.setHex(jt.current.currentHex),jt.current.traverse(Ir=>{Ir instanceof Ua&&Ir.material.color.setHex(jt.current.currentHex)});else if(jt.current.myMeshType=="FBX")jt.current.children[0].material.color.setHex(jt.current.currentHex);else if(jt.current.myMeshType=="Vessel")r.current&&r.current[Pn].contentmaterial.color.setHex(jt.current.currentHex),r.current&&r.current[Pn].contentobj.traverse(Ir=>{Ir instanceof $T&&Ir.levels.forEach(ti=>{ti.object.material.color.setHex(jt.current.currentHex)})});else if(jt.current.name==="lineNameMesh"){const Ir=jt.current.userData.wholeName.split("-")[0],ti=jt.current.userData.wholeName.split("-")[1];let Wi=jt.current.userData.initColor;jt.current.material.color.set(Wi),Me.current.traverse(Yi=>{if(Yi.name===`swcPointGroup${Ir}`)for(let vi in Yi.children){let ri=Yi.children[vi];ri.name===`${Ir}-${ti}`&&ri.myMeshType==="neuronSphere"&&(ri.material.uniforms.color.value=new oi(ri.userData.color))}})}else jt.current.myMeshType==="neuronSphere"?(jt.current.material.uniforms.color.value=new oi(jt.current.userData.color),Me.current.traverse(Ir=>{if(Ir.name==="lineNameMesh"&&Ir.userData.wholeName===jt.current.name){let ti=Ir.userData.initColor;Ir.material.color.set(ti)}})):wt[cn].object.name=="lineName"&&(Z(""),W(""),V(""),te({}),B(wt[cn].object.userData.name))}if(jt.current=wt[cn].object.parent,jt.current.currentHex=(Dr=(Wn=wt[cn].object.material)==null?void 0:Wn.color)==null?void 0:Dr.getHex(),jt.current.myMeshType=="SWC")jt.current.children[0].material.color.setHex(16711680),jt.current.traverse(Pn=>{Pn instanceof Ua&&Pn.material.color.setHex(16711680)}),V(jt.current.name),B(""),W(""),Z(""),ae({});else if(jt.current.myMeshType=="FBX")wt[cn].object.parent.name=="Brain"||wt[cn].object.parent.name=="syrings"?(jt.current.children[0].material.color.setHex(jt.current.currentHex),br.current=!1,B("")):(jt.current.name!=ur.current&&(V(""),B(jt.current.name)),(b==null?void 0:b.current)==1&&jt.current.children[0].material.color.setHex(16711680),br.current=!0),jt.current.children[0].geometry.computeBoundingBox(),a&&a(jt.current.name);else if(jt.current.myMeshType=="Vessel"){let Pn=jt.current.name;W(Pn),V(""),r.current&&r.current[Pn].contentmaterial.color.setHex(16711680),r.current&&r.current[Pn].contentobj.traverse(Ir=>{Ir instanceof $T&&Ir.levels.forEach(ti=>{ti.object.material.color.setHex(16711680)})}),lt(!0),a&&a(jt.current.name)}else if(wt[cn].object.name==="lineNameMesh"||wt[cn].object.myMeshType==="neuronSphere"){if(jt.current=wt[cn].object,jt.current.myMeshType==="neuronSphere"&&(jt.current.material.uniforms.color.value=new oi("#ff0000"),V(""),Z(""),W(""),cr(""),ae({name:jt.current.name,Lable:jt.current.name.split("-")[1]}),Me.current.traverse(Pn=>{Pn.name==="lineNameMesh"&&Pn.userData.wholeName===jt.current.name&&Pn.material.color.set("#ff0000")})),jt.current.name==="lineNameMesh"){let Pn=jt.current.userData.name,Ir=jt.current.userData.wholeName.split("-")[0],ti=jt.current.userData.wholeName.split("-")[1];jt.current.material.color.set("#ff0000"),Me.current.traverse(Wi=>{if(Wi.name===`swcPointGroup${Ir}`)for(let Yi in Wi.children){let vi=Wi.children[Yi];vi.name===`${Ir}-${ti}`&&vi.myMeshType==="neuronSphere"&&(vi.material.uniforms.color.value=new oi("#ff0000"))}}),V(""),Z(""),W(""),B(Pn.replace("/","_"))}}else["CoronalView","SagittalView","HorizontalView","arbitrarySlice"].includes(wt[cn].object.name)&&(B(""),W(""),Z(""))}if(Yt.type=="mousemove"&&jt.current.name!="Syringeobjcleanergles"){if(wt[cn].point=wt[cn].point.clone().applyEuler(ot),((ar=(hn=wt[cn].object)==null?void 0:hn.geometry)==null?void 0:ar.type)=="SphereGeometry"&&!["sphereMiddelClick","sphereBig","sectionSphere"].includes(wt[cn].object.name)&&wt[cn].object.myMeshType!=="neuronSphere"){let Pn=((wt[cn].point.x-Le.current.x)*Pe.current).toFixed(2),Ir=((wt[cn].point.y-Le.current.y)*Ge.current).toFixed(2),ti=-((wt[cn].point.z-Le.current.z)*De.current).toFixed(2);const Wi=wt[cn].object.name;let Yi=new Ie;He.current.forEach((vi,ri)=>{vi.name==Wi&&(Yi=vi.position)}),Yi.x===0&&Yi.y===0&&Yi.z===0||(ln.current={point:new Ie(parseFloat(Pn),parseFloat(Ir),ti),center:new Ie(Yi.x,Yi.y,Yi.z),name:Wi}),wt[cn].object.userData.type=="points"?Gn(wt[cn].point,wt[cn].object.name,"Point1",wt[cn].object):(Gn(wt[cn].point,Wi,"Point"),cr(Wi),Dn.current=!0,Un({left:Yt.clientX,top:Yt.clientY}));return}jt.current.myMeshType=="FBX"&&(wt[cn].object.parent.name=="Brain"||wt[cn].object.parent.name=="syrings"?(B(""),Z(""),W(""),V(""),cr("")):(Gn(wt[cn].point,jt.current.name,"FBX"),Z(jt.current.name),V(""),W(""),Un({left:Yt.clientX,top:Yt.clientY}))),jt.current.myMeshType=="SWC"&&Gn(wt[cn].point,jt.current.name,"SWC"),jt.current.myMeshType=="Vessel"&&Gn(wt[cn].point,jt.current.name,"Vessel"),wt[cn].object.type=="Points"&&Gn(wt[cn].point,wt[cn].object.name,"Points"),v&&v.current&&g&&m&&wt[cn].object.name!="lineName"&&(m.current.length==2?P.current||(g.current.pop(),g.current.push(Zn(wt[cn].point)),m.current.pop(),m.current.push(wt[cn].point),N.current&&(rn(wt[cn].point,wt[cn].object.name),Rr(m.current))):m.current.length==0?br!=null&&br.current&&(P.current||rn(wt[cn].point,wt[cn].object.name)):(g.current.push(Zn(wt[cn].point)),m.current.push(wt[cn].point),P.current||N.current&&(rn(wt[cn].point,wt[cn].object.name),Rr(m.current)))),Dn.current=!1,wt[cn].object.material.type=="MeshPhongMaterial"&&cr("")}else if(Yt.type=="click"&&jt.current.name!="Syringeobjcleanergles"){if(wt[cn].point=wt[cn].point.clone().applyEuler(ot),(((er=(Qn=wt[cn].object)==null?void 0:Qn.geometry)==null?void 0:er.type)=="SphereGeometry"||((ei=(sr=wt[cn].object)==null?void 0:sr.geometry)==null?void 0:ei.type)=="PlaneGeometry")&&!["sphereMiddelClick","sphereBig","sectionSphere"].includes(wt[cn].object.name)&&wt[cn].object.myMeshType!=="neuronSphere"){if(wt[cn].object.userData.type=="points"&&Gn(wt[cn].point,wt[cn].object.name,"Point",wt[cn].object),wt[cn].object.name=="Points"){const Pn=ea(wt[cn].object.userData,wt[cn].object.position);Me.current.add(Pn)}wt[cn].object.name=="card"?(console.log(wt[cn].uv,wt[cn]),wt[cn].object.userData.onClick(wt[cn].uv)):(Gn(wt[cn].point,wt[cn].object.name,"Point"),Di(wt[cn].object.name),cr(wt[cn].object.name));return}if(v&&v.current&&g&&m){if(m.current.length>1){if(!N.current)return;Ni(g.current),g.current.pop(),m.current.pop()}if(!P.current){g.current.push(Zn(wt[cn].point)),m.current.push(wt[cn].point);var pr=new vo;pr.setFromAxisAngle(new Ie(1,0,0),Math.PI/2);const Pn=Me.current.getObjectByName("Brain");if(m.current.length==2&&Pn){let Ir=m.current[0].clone().applyEuler(Me.current.rotation),ti=m.current[1].clone().applyEuler(Me.current.rotation);Ir=Ir.applyMatrix4(Pn.matrixWorld.clone().invert()).applyQuaternion(pr),ti=ti.applyMatrix4(Pn.matrixWorld.clone().invert()).applyQuaternion(pr),ir(Ir.toArray(),ti.toArray())}Ci(m.current)}}v!=null&&v.current&&(!P.current&&(g==null?void 0:g.current.length)==1?(ur.current=wt[cn].object.name,xr(wt[cn].point,!0)):P.current||xr(wt[cn].point))}}}else{if(B(""),cr(""),Z(""),W(""),V(""),te({}),ae({}),V(""),G.current.removeFBX(Vt.current,!0),Vt.current="",q.current={},jt.current){let cn=jt.current.name;if(jt.current.myMeshType=="SWC")jt.current.children[0].material.color.setHex(jt.current.currentHex),jt.current.traverse(Pn=>{Pn instanceof Ua&&Pn.material.color.setHex(jt.current.currentHex)});else if(jt.current.myMeshType=="FBX")jt.current.children[0].material.color.setHex(jt.current.currentHex);else if(jt.current.myMeshType=="Vessel")cn in r.current&&(r.current&&r.current[cn].contentmaterial.color.setHex(jt.current.currentHex),r.current&&r.current[cn].contentobj.traverse(Pn=>{Pn instanceof $T&&Pn.levels.forEach(Ir=>{Ir.object.material.color.setHex(jt.current.currentHex)})}));else if(jt.current.name==="lineNameMesh"){const Pn=jt.current.userData.wholeName.split("-")[0],Ir=jt.current.userData.wholeName.split("-")[1];let ti=jt.current.userData.initColor;jt.current.material.color.set(ti),Me.current.traverse(Wi=>{for(let Yi in Wi.children){let vi=Wi.children[Yi];vi.name===`${Pn}-${Ir}`&&vi.myMeshType==="neuronSphere"&&(vi.material.uniforms.color.value=new oi(vi.userData.color))}})}else jt.current.myMeshType==="neuronSphere"&&(jt.current.material.uniforms.color.value=new oi(jt.current.userData.color),Me.current.traverse(Pn=>{if(Pn.name==="lineNameMesh"&&Pn.userData.wholeName===jt.current.name){let Ir=Pn.userData.initColor;Pn.material.color.set(Ir)}}))}cr(""),xe(""),_e(""),ye(""),jt.current=new Du,jt.current.myMeshType="",jt.current.currentHex="",b&&b.current==3}Qr(Yt)},tr=()=>{new _gt().load(ge+"/data/GLB/syringe.glb",wt=>{hr.current=wt.scene,hr.current.name="syrings",hr.current.userData.direction=new Ie(1,0,0),hr.current.scale.set(2,2,2),hr.current.position.set(0,0,0);var an=new gs;an.expandByObject(hr.current);var ot=new Ie;an==null||an.getCenter(ot),hr.current.userData.center=ot})},Fr=()=>{if(An(),ji(),tr(),Loe){let Yt=JSON.parse(Loe);p.current.forEach(wt=>{wt.visible=Yt})}};C.useEffect(()=>{var Yt,wt,an,ot,Tn,pr,Wn,Dr,hn,ar,Qn,er;if(ft.current&&Ze.current&&tt.current&&rt.current&&Ye.current&&St){let sr=new Ie(0,-1,0),ei=new Ie(0,1,0);typeof((Yt=ft.current)==null?void 0:Yt.coordText)=="object"&&Me.current.remove(ft.current.coordText),typeof((wt=ft.current)==null?void 0:wt.coordTextReverse)=="object"&&Me.current.remove(ft.current.coordTextReverse),typeof((an=Ye.current)==null?void 0:an.coordText)=="object"&&Me.current.remove(Ye.current.coordText),typeof((ot=Ye.current)==null?void 0:ot.coordTextReverse)=="object"&&Me.current.remove(Ye.current.coordTextReverse),typeof((Tn=tt.current)==null?void 0:Tn.coordText)=="object"&&Me.current.remove(tt.current.coordText),typeof((pr=tt.current)==null?void 0:pr.coordTextReverse)=="object"&&Me.current.remove(tt.current.coordTextReverse),typeof((Wn=rt.current)==null?void 0:Wn.coordText)=="object"&&Me.current.remove(rt.current.coordText),typeof((Dr=Ze.current)==null?void 0:Dr.coordText_lb)=="object"&&Me.current.remove(Ze.current.coordText_lb),typeof((hn=Ze.current)==null?void 0:hn.coordText_rb)=="object"&&Me.current.remove(Ze.current.coordText_rb),typeof((ar=Ze.current)==null?void 0:ar.coordText_rf)=="object"&&Me.current.remove(Ze.current.coordText_rf),typeof((Qn=Ze.current)==null?void 0:Qn.coordText_lf)=="object"&&Me.current.remove(Ze.current.coordText_lf),typeof((er=rt.current)==null?void 0:er.coordTextReverse)=="object"&&Me.current.remove(rt.current.coordTextReverse);let cn=new Ie(Be.current.x,Be.current.y,ke.current.z),Pn=new Ie(1,0,0);ft.current.coordText=vr(sr,cn,Pn,ke.current.x-Be.current.x,12,-(6+St.x),-(St.x-6),new Ie(0,0,0)),cn.y=ke.current.y,ft.current.coordTextReverse=vr(ei,cn,Pn,ke.current.x-Be.current.x,12,-(6+St.x),-(St.x-6),new Ie(0,0,0)),cn=new Ie(Be.current.x,Be.current.y,Be.current.z),Pn=new Ie(1,0,0),Ye.current.coordText=vr(sr,cn,Pn,ke.current.x-Be.current.x,12,-(6+St.x),-(St.x-6),new Ie(0,0,0)),cn.y=ke.current.y,Ye.current.coordTextReverse=vr(ei,cn,Pn,ke.current.x-Be.current.x,12,-(6+St.x),-(St.x-6),new Ie(0,0,0)),cn=new Ie(Be.current.x,Be.current.y,ke.current.z),Pn=new Ie(0,0,-1),tt.current.coordText=vr(sr,cn,Pn,ke.current.z-Be.current.z,14,-(8+St.z),-(St.z-6),new Ie(0,0,0)),cn.y=ke.current.y,tt.current.coordTextReverse=vr(ei,cn,Pn,ke.current.z-Be.current.z,14,-(8+St.z),-(St.z-6),new Ie(0,0,0)),cn=new Ie(ke.current.x,Be.current.y,ke.current.z),Pn=new Ie(0,0,-1),rt.current.coordText=vr(sr,cn,Pn,ke.current.z-Be.current.z,14,-(8+St.z),-(St.z-6),new Ie(0,0,0)),cn.y=ke.current.y,rt.current.coordTextReverse=vr(ei,cn,Pn,ke.current.z-Be.current.z,14,-(8+St.z),-(St.z-6),new Ie(0,0,0)),cn=new Ie(ke.current.x,Be.current.y,ke.current.z),Pn=new Ie(0,1,0),Ze.current.coordText_lb=vr(sr,cn,Pn,ke.current.y-Be.current.y,10,-St.y,10-St.y,new Ie(0,0,0)),cn=new Ie(Be.current.x,Be.current.y,ke.current.z),Pn=new Ie(0,1,0),Ze.current.coordText_lf=vr(sr,cn,Pn,ke.current.y-Be.current.y,10,-St.y,10-St.y,new Ie(0,0,0)),cn=new Ie(Be.current.x,Be.current.y,Be.current.z),Pn=new Ie(0,1,0),Ze.current.coordText_rf=vr(sr,cn,Pn,ke.current.y-Be.current.y,10,-St.y,10-St.y,new Ie(0,0,0)),cn=new Ie(ke.current.x,Be.current.y,Be.current.z),Pn=new Ie(0,1,0),Ze.current.coordText_rb=vr(sr,cn,Pn,ke.current.y-Be.current.y,10,-St.y,10-St.y,new Ie(0,0,0)),Tr()}A&&(A.current=At(Rt.current))},[St]);const Ni=Yt=>{var wt=Yt[0].x-Yt[1].x,an=Yt[0].y-Yt[1].y,ot=Yt[0].z-Yt[1].z,Tn=Math.sqrt(wt*wt+an*an+ot*ot);wt=Math.abs(wt/Tn),an=Math.abs(an/Tn),ot=Math.abs(ot/Tn),wt=Math.acos(wt)*180/Math.PI,an=Math.acos(an)*180/Math.PI,ot=Math.acos(ot)*180/Math.PI;var pr=pe=="en_us"&&pe?"Target site (unit: mm): ":"项目 (unit: mm): ",Wn=pe=="en_us"&&pe?"The angle of injection (unit:°):":"注射方向的角度 (unit:°):",Dr=pe=="en_us"&&pe?"Injection site (unit: mm):":"注射部位 (unit: mm):",hn=`<span style='font-weight:bold'> ${Wn}<br/></span>coronal plane ${ot.toFixed(2)} / horizontal plane ${an.toFixed(2)} / sagittal plane ${wt.toFixed(2)}`,ar=`<br><span style='font-weight:bold'>${pr}</span><br>X: ${Yt[0].x.toFixed(2)} / Y: ${Yt[0].y.toFixed(2)} / Z: ${Yt[0].z.toFixed(2)}<br><span style='font-weight:bold'>${Dr}: </span><br>X: ${Yt[1].x.toFixed(2)} / Y: ${Yt[1].y.toFixed(2)} / Z: ${Yt[1].z.toFixed(2)}`;c&&c(hn+ar)},Li=(Yt,wt,an,ot)=>{var Tn=document.createElement("canvas");Tn.width=Yt,Tn.height=wt,Tn.style.border="1px solid #000";let pr=Tn.getContext("2d");return pr.font="101px Arial",pr.fillText(an,40,80),Tn},Di=Yt=>{Mt.current&&Me.current.remove(Mt.current);const wt=Pt.current.find(ot=>ot.name===Yt);var an=new Bh(Li(650,620,Yt.replace("_","/")));Mt.current=new Fh(new Kf({map:an})),wt&&"Coordinate"in wt&&(Mt.current.scale.set(1.5,1.5,1.5),Mt.current.position.set(wt.Coordinate.x*.001,wt.Coordinate.y*.001+.002,wt.Coordinate.z*.001),Mt.current.translateX(po.current),Mt.current.translateY(qa.current),Mt.current.translateZ(to.current),Me.current.add(Mt.current))},ji=()=>{dt.current=va(1,{x:(Be.current.x+ke.current.x)/2,y:Be.current.y,z:(Be.current.z+ke.current.z)/2},ke.current.x-Be.current.x,ke.current.z-Be.current.z,12,14,"#E3E3E3","test_top"),dt.current.normalVector=new Ie(0,-1,0),dt.current.mouseLine_w.name="test_top_mouseLine_w",dt.current.mouseLine_h.name="test_top_mouseLine_h",Ze.current=va(1,{x:(Be.current.x+ke.current.x)/2,y:ke.current.y,z:(Be.current.z+ke.current.z)/2},ke.current.x-Be.current.x,ke.current.z-Be.current.z,12,14,"#E3E3E3","test_bootom"),Ze.current.normalVector=new Ie(0,1,0),Ze.current.mouseLine_w.name="test_bottom_mouseLine_w",Ze.current.mouseLine_h.name="test_bottom_mouseLine_h",Ye.current=va(2,{x:(Be.current.x+ke.current.x)/2,y:(Be.current.y+ke.current.y)/2,z:Be.current.z},ke.current.x-Be.current.x,ke.current.y-Be.current.y,12,10,"#E3E3E3","test_front"),Ye.current.normalVector=new Ie(0,0,-1),Ye.current.mouseLine_w.name="test_front_mouseLine_w",Ye.current.mouseLine_h.name="test_front_mouseLine_h",ft.current=va(2,{x:(Be.current.x+ke.current.x)/2,y:(Be.current.y+ke.current.y)/2,z:ke.current.z},ke.current.x-Be.current.x,ke.current.y-Be.current.y,12,10,"#E3E3E3","test_behind"),ft.current.normalVector=new Ie(0,0,1),ft.current.mouseLine_w.name="test_behind_mouseLine_w",ft.current.mouseLine_h.name="test_behind_mouseLine_h",tt.current=va(3,{x:Be.current.x,y:(Be.current.y+ke.current.y)/2,z:(Be.current.z+ke.current.z)/2},ke.current.z-Be.current.z,ke.current.y-Be.current.y,14,10,"#E3E3E3","test_left"),tt.current.normalVector=new Ie(-1,0,0),tt.current.mouseLine_w.name="test_left_mouseLine_w",tt.current.mouseLine_h.name="test_left_mouseLine_h",rt.current=va(3,{x:ke.current.x,y:(Be.current.y+ke.current.y)/2,z:(Be.current.z+ke.current.z)/2},ke.current.z-Be.current.z,ke.current.y-Be.current.y,14,10,"#E3E3E3","test_right"),rt.current.normalVector=new Ie(1,0,0),rt.current.mouseLine_w.name="test_right_mouseLine_w",rt.current.mouseLine_h.name="test_right_mouseLine_h",rm=new nr(new lu(.1,32,32),new kl({color:392960,transparent:!0})),rm.name="sphereBig",dn.current=new nr(new lu(.065,32,32),new kl({color:392960,transparent:!0})),Cn.current=new nr(new lu(.025,32,32),new kl({color:392960,transparent:!0})),Me.current.getObjectByName("sphereMiddelClick")||(su=new nr(new a9(.1,.3,32),new kl({color:1609983,transparent:!0})),su.name="sphereMiddelClick"),ft.current&&(ft.current.coordMesh.visible=Q,ft.current.mouseLine_w.visible=Q,ft.current.mouseLine_h.visible=Q),dt.current&&(dt.current.coordMesh.visible=Q,dt.current.mouseLine_w.visible=Q,dt.current.mouseLine_h.visible=Q),Ye.current&&(Ye.current.coordMesh.visible=Q,Ye.current.mouseLine_w.visible=Q,Ye.current.mouseLine_h.visible=Q),Ze.current&&(Ze.current.coordMesh.visible=Q,Ze.current.mouseLine_w.visible=Q,Ze.current.mouseLine_h.visible=Q),tt.current&&(tt.current.coordMesh.visible=Q,tt.current.mouseLine_w.visible=Q,tt.current.mouseLine_h.visible=Q),rt.current&&(rt.current.coordMesh.visible=Q,rt.current.mouseLine_w.visible=Q,rt.current.mouseLine_h.visible=Q);let wt=new Ie(0,-1,0),an=new Ie(0,1,0),ot=new Ie(Be.current.x,Be.current.y,ke.current.z),Tn=new Ie(1,0,0);ft.current.coordText=vr(wt,ot,Tn,ke.current.x-Be.current.x,12,-6,6,new Ie(0,0,0)),ot.y=ke.current.y,ft.current.coordTextReverse=vr(an,ot,Tn,ke.current.x-Be.current.x,12,-6,6,new Ie(0,0,0)),ot=new Ie(Be.current.x,Be.current.y,Be.current.z),Tn=new Ie(1,0,0),Ye.current.coordText=vr(wt,ot,Tn,ke.current.x-Be.current.x,12,-6,6,new Ie(0,0,0)),ot.y=ke.current.y,Ye.current.coordTextReverse=vr(an,ot,Tn,ke.current.x-Be.current.x,12,-6,6,new Ie(0,0,0)),ot=new Ie(Be.current.x,Be.current.y,ke.current.z),Tn=new Ie(0,0,-1),tt.current.coordText=vr(wt,ot,Tn,ke.current.z-Be.current.z,14,-8,6,new Ie(0,0,0)),ot.y=ke.current.y,tt.current.coordTextReverse=vr(an,ot,Tn,ke.current.z-Be.current.z,14,-8,6,new Ie(0,0,0)),ot=new Ie(ke.current.x,Be.current.y,ke.current.z),Tn=new Ie(0,0,-1),rt.current.coordText=vr(wt,ot,Tn,ke.current.z-Be.current.z,14,-8,6,new Ie(0,0,0)),ot.y=ke.current.y,rt.current.coordTextReverse=vr(an,ot,Tn,ke.current.z-Be.current.z,14,-8,6,new Ie(0,0,0)),ot=new Ie(ke.current.x,Be.current.y,ke.current.z),Tn=new Ie(0,1,0),Ze.current.coordText_lb=vr(wt,ot,Tn,ke.current.y-Be.current.y,10,0,10,new Ie(0,0,0)),ot=new Ie(Be.current.x,Be.current.y,ke.current.z),Tn=new Ie(0,1,0),Ze.current.coordText_lf=vr(wt,ot,Tn,ke.current.y-Be.current.y,10,0,10,new Ie(0,0,0)),ot=new Ie(Be.current.x,Be.current.y,Be.current.z),Tn=new Ie(0,1,0),Ze.current.coordText_rf=vr(wt,ot,Tn,ke.current.y-Be.current.y,10,0,10,new Ie(0,0,0)),ot=new Ie(ke.current.x,Be.current.y,Be.current.z),Tn=new Ie(0,1,0),Ze.current.coordText_rb=vr(wt,ot,Tn,ke.current.y-Be.current.y,10,0,10,new Ie(0,0,0)),Tr()},va=(Yt,wt,an,ot,Tn,pr,Wn,Dr)=>{let hn={mouseLine_w:new Ua,mouseLine_h:new Ua,coordMesh:new yo},ar=new yo,Qn,er,sr,ei,cn,Pn,Ir,ti;Ir=an/Tn,ti=ot/pr;let Wi=new Mf({color:Wn,opacity:.9,transparent:!1}),Yi=new Mf({color:"#9ACD32",opacity:.5}),vi,ri;const co=Me.current.rotation,ta=new Ie(co.x,co.y,co.z).negate(),Vn=new ed(ta.x,ta.y,ta.z),yt=new wi().makeRotationFromEuler(Vn);if(Yt==1){er=wt.y,cn=er,Qn=wt.x-an/2,ei=wt.x+an/2,sr=wt.z-ot/2,Pn=wt.z+ot/2;for(let $e=0;$e<=Tn;$e++){let at=new Qi,ct=[];ct.push(Qn+$e*Ir,er,sr,Qn+$e*Ir,er,Pn);const mt=new Float32Array(ct);at.setAttribute("position",new ms(mt,3));let it=new Ua(at,Wi);ar.add(it)}for(let $e=0;$e<=pr;$e++){let at=new Qi,ct=[];ct.push(Qn,er,sr+$e*ti,ei,er,sr+$e*ti);const mt=new Float32Array(ct);at.setAttribute("position",new ms(mt,3));let it=new Ua(at,Wi);ar.add(it)}let Re=new Qi;Re.setAttribute("position",new ms(new Float32Array([Qn,0,0,ei,0,0]),3)),vi=new Ua(Re,Yi),vi.position.setY(cn),vi.userData.initY=cn;let Je=new Qi;Je.setAttribute("position",new ms(new Float32Array([0,0,sr,0,0,Pn]),3)),ri=new Ua(Je,Yi),ri.position.setY(cn),ri.userData.initY=cn,hn.mouseLine_w=vi,hn.mouseLine_h=ri}else if(Yt==2){sr=wt.z,Pn=sr,Qn=wt.x-an/2,ei=wt.x+an/2,er=wt.y-ot/2,cn=wt.y+ot/2;for(let $e=0;$e<=Tn;$e++){let at=new Qi;at.setAttribute("position",new ms(new Float32Array([Qn+$e*Ir,er,sr,Qn+$e*Ir,cn,sr]),3));let ct=new Ua(at,Wi);ar.add(ct)}for(let $e=0;$e<=pr;$e++){let at=new Qi;at.setAttribute("position",new ms(new Float32Array([Qn,er+$e*ti,sr,ei,er+$e*ti,sr]),3));let ct=new Ua(at,Wi);ar.add(ct)}let Re=new Qi;Re.setAttribute("position",new ms(new Float32Array([Qn,0,0,ei,0,0]),3)),vi=new Ua(Re,Yi),vi.position.setZ(Pn),vi.userData.initZ=Pn;let Je=new Qi;Je.setAttribute("position",new ms(new Float32Array([0,er,0,0,cn,0]),3)),ri=new Ua(Je,Yi),ri.position.setZ(Pn),ri.userData.initZ=Pn,hn.mouseLine_w=vi,hn.mouseLine_h=ri}else if(Yt==3){Qn=wt.x,ei=Qn,sr=wt.z-an/2,Pn=wt.z+an/2,er=wt.y-ot/2,cn=wt.y+ot/2;for(let $e=0;$e<=Tn;$e++){let at=new Qi;at.setAttribute("position",new ms(new Float32Array([Qn,er,sr+$e*Ir,Qn,cn,sr+$e*Ir]),3));let ct=new Ua(at,Wi);ar.add(ct)}for(let $e=0;$e<=pr;$e++){let at=new Qi;at.setAttribute("position",new ms(new Float32Array([Qn,er+$e*ti,sr,Qn,er+$e*ti,Pn]),3));let ct=new Ua(at,Wi);ar.add(ct)}let Re=new Qi;Re.setAttribute("position",new ms(new Float32Array([0,0,sr,0,0,Pn]),3)),vi=new Ua(Re,Yi),vi.position.setX(ei),vi.userData.initX=ei;let Je=new Qi;Je.setAttribute("position",new ms(new Float32Array([0,er,0,0,cn,0]),3)),ri=new Ua(Je,Yi),ri.position.setX(ei),ri.userData.initX=ei,hn.mouseLine_w=vi,hn.mouseLine_h=ri}return ar.rotation.copy(Vn),hn.mouseLine_w.rotation.copy(Vn),hn.mouseLine_h.rotation.copy(Vn),hn.mouseLine_w.position.applyMatrix4(yt),hn.mouseLine_h.position.applyMatrix4(yt),hn.mouseLine_h.updateMatrix(),hn.mouseLine_w.updateMatrix(),hn.coordMesh=ar,hn.coordMesh.name=Dr,hn};function ea(Yt,wt){const an=document.createElement("canvas");an.width=512,an.height=256;const ot=an.getContext("2d"),Tn=new Bh(an);Tn.minFilter=uu;const pr=new Qu({map:Tn,transparent:!0,side:Jd}),Wn=new bE(5,2.5),Dr=new nr(Wn,pr);Dr.position.copy(wt);let hn=!1;const ar=()=>{if(ot.clearRect(0,0,an.width,an.height),ot.fillStyle="#ffffffcc",ot.fillRect(0,0,an.width,an.height),ot.fillStyle="#000000",ot.font="bold 28px Arial",ot.textBaseline="top",hn){const er=Wa(ot,Yt.Text,20,20,an.width-40,28);console.log(er)}else{let er=20;ot.fillText(`年份: ${Yt.Year}`,20,er),er+=40;const sr=Wa(ot,`标题: ${Yt.Title}`,20,er,an.width-2*20,28);console.log(sr),er+=sr+10,ot.fillText(`DIO: ${Yt.DOI}`,20,er)}ot.fillStyle="#888",ot.fillRect(an.width-50,10,40,30),ot.fillStyle="#fff",ot.font="20px Arial",ot.fillText("↺",an.width-38,14),Tn.needsUpdate=!0};return ar(),Dr.userData.onClick=Qn=>{const er=Qn.x*an.width,sr=(1-Qn.y)*an.height;er>=an.width-50&&er<=an.width-10&&sr>=10&&sr<=40&&(hn=!hn,ar())},Dr.name="card",Dr.onBeforeRender=()=>{Dr.up.set(0,-1,0),Dr.rotation.copy(Ti.current.rotation)},Dr}function Wa(Yt,wt,an,ot,Tn,pr){const Wn=wt.split(" ");let Dr="",hn=0;for(let ar=0;ar<Wn.length;ar++){const Qn=Dr+Wn[ar]+" ";Yt.measureText(Qn).width>Tn&&ar>0?(Yt.fillText(Dr,an,ot),Dr=Wn[ar]+" ",ot+=pr,hn++):Dr=Qn}return Yt.fillText(Dr,an,ot),hn++,hn*pr}C.useEffect(()=>{ft.current&&(ft.current.coordMesh.visible=Q,ft.current.mouseLine_w.visible=Q,ft.current.mouseLine_h.visible=Q),dt.current&&(dt.current.coordMesh.visible=Q,dt.current.mouseLine_w.visible=Q,dt.current.mouseLine_h.visible=Q),Ye.current&&(Ye.current.coordMesh.visible=Q,Ye.current.mouseLine_w.visible=Q,Ye.current.mouseLine_h.visible=Q),Ze.current&&(Ze.current.coordMesh.visible=Q,Ze.current.mouseLine_w.visible=Q,Ze.current.mouseLine_h.visible=Q),tt.current&&(tt.current.coordMesh.visible=Q,tt.current.mouseLine_w.visible=Q,tt.current.mouseLine_h.visible=Q),rt.current&&(rt.current.coordMesh.visible=Q,rt.current.mouseLine_w.visible=Q,rt.current.mouseLine_h.visible=Q)},[Q]);const za=()=>{R&&R(!0),N.current==="automatic"?(_(!0),P.current=!0,u&&(u.current=!1)):N.current==="manual"&&(_(!1),P.current=!1,u&&(u.current=!0)),Me.current.remove(rm)},Kr=(Yt,wt)=>{for(let an of Yt){if(an.name===wt&&!an.children)return{color:an.color,path:an.path};if(an.children){const ot=Kr(an.children,wt);if(ot)return ot}}return null},Qr=Yt=>{Nt.current.left&&(Yt.clientX<Number(Nt.current.left.replace("px",""))||Yt.clientY<Number(Nt.current.top.replace("px","")))&&f(!0)},Ra=Yt=>{Yt.preventDefault(),da&&da.length===0||F.current==0?f(!0):(Nt.current={top:`${Yt.clientY-10}px`,left:`${Yt.clientX-10}px`},f(!1))},da=C.useMemo(()=>rr?[{key:"1",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center",color:"#000"},onClick:Yt=>{Dt(ln.current.point);let wt=new URL(window.location.href),an=new URLSearchParams(wt.search);const ot=JSON.stringify(ln.current.point);an.set("datumMarkSelected",ot),wt.search=an.toString(),window.history.replaceState({},"",wt),Rt.current=ln.current.center,He.current.forEach((Tn,pr)=>{Tn.geometry.parameters.radius===.15&&Tn.name!=ln.current.name?(Me.current.remove(Tn),Tn.geometry.dispose(),Tn.geometry=new lu(.07,32,32),Me.current.add(Tn)):Tn.name===ln.current.name&&(Me.current.remove(Tn),Tn.geometry.dispose(),Tn.geometry=new lu(.15,32,32),Me.current.add(Tn))}),f(!0)}},z("5000.5038",{name:ln.current.name})||"切换"+ln.current.name+"为坐标原点")},ln.current.name!="Bregma"&&ln.current.name!="Lambda"?{key:"2",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center",color:"#000"},onClick:Yt=>{const wt=document.createElement("a");wt.href=`${ge}/data/TIFF/${ln.current.name}.tif`,wt.style.display="none",wt.download=`${ln.current.name}.tiff`,wt.click(),f(!0)}},z("5000.5039",{name:ln.current.name})||"下载"+ln.current.name+"周围的原始图像")}:null,{key:"3",label:C.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{const Yt=Me.current.getObjectByName(ln.current.name);if(Yt){const wt=new gs().setFromObject(Yt),an=new Ie;wt.getCenter(an),n.current.target.copy(an),f(!0)}}},z("7000.7019")||"设置为焦点")}]:h,[d,h,se,ie,rr]);return C.useEffect(()=>{o?He.current.forEach(Yt=>{Yt.visible=!0}):He.current.forEach(Yt=>{Yt.visible=!1})},[o]),C.createElement("div",null,C.createElement("div",{style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",zIndex:998,display:"none"}}),C.createElement(tx,{menu:{items:da},trigger:["contextMenu"],open:!d},C.createElement("div",{ref:i,id:"display_neuron",onContextMenu:Yt=>{Ra(Yt)},onMouseEnter:Yt=>{f(!0),B(""),Z(""),W(""),V(""),cr(""),te({}),ae({})},style:{position:"absolute",height:"100%",width:"100%"}})),C.createElement("div",{style:{position:"absolute",bottom:"10px",left:"360px",height:"60px"}},C.createElement("div",{dangerouslySetInnerHTML:{__html:ne||""}}),C.createElement("div",{style:{textAlign:"left"},dangerouslySetInnerHTML:{__html:ee||""}}),C.createElement("div",{style:{textAlign:"left"},dangerouslySetInnerHTML:{__html:de||""}})))};const Cl=C.forwardRef(({className:t,Name:e,t:n,data_change:r,data_c:i,col:a,row:o},s)=>{const[c,u]=C.useState([]),[d,f]=C.useState([]);C.useState(!0);const[h,p]=C.useState(!0),v=(y,g,m)=>{let b={};for(let x in y){for(let S of y[x])S.type=="cell"&&(S.point[0]<570?p(!0):p(!1));if(m.includes("_r")){if(x==g.replace("_",m.split("_r")[0].replace("_",""))){for(let S of y[x])if(S.point[0]>570&&S.name==r.name&&S.type=="end"&&(b.name===x?b.index=(b.index||0)+1:b={name:x,index:1}),S.point[0]>570&&S.name==r.name&&S.type=="cell")return{name:x,index:1,type:"cell"}}}else if(x==g.replace("_",m.replace("_",""))){for(let S of y[x])if(S.point[0]<570&&S.name==r.name&&S.type=="end"&&(b.name===x?b.index=(b.index||0)+1:b={name:x,index:1,type:"end"}),S.point[0]<570&&S.name==r.name&&S.type=="cell")return{name:x,index:1,type:"cell"}}}return Object.keys(b).length>0?b:{}};return C.useEffect(()=>{let y=[];const g=[];for(let S=0;S<o.length;S++)g.push(o[S]);for(let S=o.length-1;S>=0;S--)g.push(o[S]+"_r");const m=g.filter(S=>!S.includes("_r")),b=g.filter(S=>S.includes("_r"));a.forEach(S=>{let w={index:S};g.forEach(_=>{let A=v(i,S,_);Object.keys(A).length>0&&(w[_]=A)}),Object.keys(w).length>1&&y.push(w)});const x=[{title:"",dataIndex:"index",key:"index",align:"center",className:"cell-index",render:S=>S.replace("_","")},{title:"Left hemisphere("+(h?"lpsilateral":"Contralateral")+")",align:"center",className:"cell-left",children:m.map(S=>({title:S.replace("_",""),dataIndex:S,key:S,align:"center",render:w=>w?w.type==="cell"?C.createElement(Ui,{placement:"top",title:w.name},C.createElement("svg",{style:{verticalAlign:"middle"},width:"50",height:"50",viewBox:"0 0 100 100"},C.createElement("path",{d:`\r
|
|
4220
|
+
`)}_e(Tn);const Dr=Me.current.rotation,hn=new Ie(Dr.x,Dr.y,Dr.z).negate(),ar=new ed(hn.x,hn.y,hn.z),Qn=new wi().makeRotationFromEuler(ar);pr.z>-8&&pr.y>-5.57&&pr.x<5.16&&pr.x>-5.18&&(dt.current&&(dt.current.mouseLine_w.position.z=pr.z,dt.current.mouseLine_w.position.x=0,dt.current.mouseLine_h.position.x=pr.x,dt.current.mouseLine_h.position.z=0,dt.current.mouseLine_w.position.y=dt.current.mouseLine_w.userData.initY,dt.current.mouseLine_h.position.y=dt.current.mouseLine_h.userData.initY,(er=dt.current)==null||er.mouseLine_w.position.applyMatrix4(Qn),(sr=dt.current)==null||sr.mouseLine_h.position.applyMatrix4(Qn),(ei=dt.current)==null||ei.mouseLine_w.updateMatrix(),(cn=dt.current)==null||cn.mouseLine_h.updateMatrix()),ft.current&&(ft.current.mouseLine_w.position.y=pr.y,ft.current.mouseLine_w.position.x=0,ft.current.mouseLine_h.position.x=pr.x,ft.current.mouseLine_h.position.y=0,ft.current.mouseLine_w.position.z=ft.current.mouseLine_w.userData.initZ,ft.current.mouseLine_h.position.z=ft.current.mouseLine_h.userData.initZ,(Pn=ft.current)==null||Pn.mouseLine_w.position.applyMatrix4(Qn),(Ir=ft.current)==null||Ir.mouseLine_h.position.applyMatrix4(Qn),(ti=ft.current)==null||ti.mouseLine_w.updateMatrix(),(Wi=ft.current)==null||Wi.mouseLine_h.updateMatrix()),Ze.current&&(Ze.current.mouseLine_w.position.z=pr.z,Ze.current.mouseLine_w.position.x=0,Ze.current.mouseLine_h.position.x=pr.x,Ze.current.mouseLine_h.position.z=0,Ze.current.mouseLine_w.position.y=Ze.current.mouseLine_w.userData.initY,Ze.current.mouseLine_h.position.y=Ze.current.mouseLine_h.userData.initY,(Yi=Ze.current)==null||Yi.mouseLine_w.position.applyMatrix4(Qn),(vi=Ze.current)==null||vi.mouseLine_h.position.applyMatrix4(Qn),(ri=Ze.current)==null||ri.mouseLine_w.updateMatrix(),(co=Ze.current)==null||co.mouseLine_h.updateMatrix()),tt.current&&(tt.current.mouseLine_w.position.y=pr.y,tt.current.mouseLine_w.position.z=0,tt.current.mouseLine_h.position.z=pr.z,tt.current.mouseLine_h.position.y=0,tt.current.mouseLine_w.position.x=tt.current.mouseLine_w.userData.initX,tt.current.mouseLine_h.position.x=tt.current.mouseLine_h.userData.initX,(ta=tt.current)==null||ta.mouseLine_w.position.applyMatrix4(Qn),(Vn=tt.current)==null||Vn.mouseLine_h.position.applyMatrix4(Qn),(yt=tt.current)==null||yt.mouseLine_w.updateMatrix(),(Re=tt.current)==null||Re.mouseLine_h.updateMatrix()),Ye.current&&(Ye.current.mouseLine_w.position.y=pr.y,Ye.current.mouseLine_w.position.x=0,Ye.current.mouseLine_h.position.x=pr.x,Ye.current.mouseLine_h.position.y=0,Ye.current.mouseLine_w.position.z=Ye.current.mouseLine_w.userData.initZ,Ye.current.mouseLine_h.position.z=Ye.current.mouseLine_h.userData.initZ,(Je=Ye.current)==null||Je.mouseLine_w.position.applyMatrix4(Qn),($e=Ye.current)==null||$e.mouseLine_h.position.applyMatrix4(Qn),(at=Ye.current)==null||at.mouseLine_w.updateMatrix(),(ct=Ye.current)==null||ct.mouseLine_h.updateMatrix()),rt.current&&(rt.current.mouseLine_w.position.y=pr.y,rt.current.mouseLine_w.position.z=0,rt.current.mouseLine_h.position.z=pr.z,rt.current.mouseLine_h.position.y=0,rt.current.mouseLine_w.position.x=rt.current.mouseLine_w.userData.initX,rt.current.mouseLine_h.position.x=rt.current.mouseLine_h.userData.initX,(mt=rt.current)==null||mt.mouseLine_w.position.applyMatrix4(Qn),(it=rt.current)==null||it.mouseLine_h.position.applyMatrix4(Qn),(be=rt.current)==null||be.mouseLine_w.updateMatrix(),(ce=rt.current)==null||ce.mouseLine_h.updateMatrix()))},En=Yt=>{e==null||e.domElement.removeEventListener("mousemove",H.current,!1),e==null||e.domElement.addEventListener("mouseup",_n,!1)},_n=Yt=>{e==null||e.domElement.addEventListener("mousemove",H.current,!1),e==null||e.domElement.removeEventListener("mouseup",_n,!1),Tr(),In()},In=()=>{for(let Yt in p.current)p.current[Yt].lookAt(Ti.current.position)},Jn=Yt=>{var wt=new WX(Yt,{size:.7,height:.01,font:vt.current,curveSegments:5,bevelEnabled:!1}),an=new kl({color:0,specular:0,shininess:0});let ot=new nr(wt,an);return ot.castShadow=!0,ot},vr=(Yt,wt,an,ot,Tn,pr,Wn,Dr,hn)=>{let ar=new yo;function Qn(ei){return typeof ei=="number"&&ei%1===0}hn=hn==0?hn:1,Dr=Dr||new Ie(0,0,0);let er=Qn(Tn)?ot/Tn:0,sr=Qn(Tn)?(Wn-pr)/Tn:0;if(er==0||sr==0)return ar;for(let ei=hn;ei<Tn;ei++){let cn=(pr+ei*sr).toFixed(2),Pn=an.clone().multiplyScalar(er*ei),Ir=wt.clone().add(Pn),ti=Jn(cn);ti.position.set(Ir.x+Dr.x,Ir.y+Dr.y,Ir.z+Dr.z),ti.up.set(Yt.x,Yt.y,Yt.z),ti.scale.set(.2,.2,.25),ti.lookAt(Ti.current.position),ar.add(ti);const Wi=Me.current.rotation,Yi=new Ie(Wi.x,Wi.y,Wi.z).negate(),vi=new ed(Yi.x,Yi.y,Yi.z);ar.rotation.copy(vi),p.current.push(ti)}return ar},Tr=()=>{var ar,Qn,er,sr,ei,cn,Pn,Ir,ti,Wi,Yi,vi,ri,co,ta,Vn,yt,Re,Je,$e,at,ct,mt,it,be,ce,Ve,Ae,Qe,gt,Bt,Lt,qt,Ct,Xt,Yn,mr,On,Rn,Yr,$r,pn,Jt,si,Pr,jr,xs,ga,xo,li,Jr,Ki,ts,Ia,Go,Ml,Xs,ks,Ha,ka,Zs,il,Us,dr,Qa,Yo,Ks,Cs,Va,Uo,Fo,io,Mo,hl,Zl,Bo,Lo,jo,Ys,fs,Kl,pl,rc,ic,vl,gl,hs,pc,ac,Ll,Bu,os,dd,Vo,ml,ss,Yl,Fs,nu,fd,ru,hd,oc,Uc,vc,Fc,sc,bu,gc,xu,al,yl,Rl,qs,bl,Js,Ii,Qs,ao,Cu,Bc,Vu,iu,$u,au,ou,Vc,lc,zu,E,D,X,le,Ce,qe,Ot,sn,vn,Kn,Wr,_i,qi,qo,uo,ps,Oo,ql,ol,Hu,Su,Ol,sl,Jl,Co,mc,pd,Jo,wu,ll,Qo,yc,Eu,$c,Cv,Gu,Zm;let Yt=n.current.target.clone().sub(Ti.current.position.clone()),wt,an,ot,Tn=!1,pr=!1,Wn=!1,Dr=!1,hn=Ti.current.up.y<=0;hn?((Qn=(ar=Ze.current)==null?void 0:ar.coordText_lb)==null||Qn.children.forEach(Bs=>{Bs.up.set(0,-1,0)}),(sr=(er=Ze.current)==null?void 0:er.coordText_lf)==null||sr.children.forEach(Bs=>{Bs.up.set(0,-1,0)}),(cn=(ei=Ze.current)==null?void 0:ei.coordText_rf)==null||cn.children.forEach(Bs=>{Bs.up.set(0,-1,0)}),(Ir=(Pn=Ze.current)==null?void 0:Pn.coordText_rb)==null||Ir.children.forEach(Bs=>{Bs.up.set(0,-1,0)})):((Wi=(ti=Ze.current)==null?void 0:ti.coordText_lb)==null||Wi.children.forEach(Bs=>{Bs.up.set(0,1,0)}),(vi=(Yi=Ze.current)==null?void 0:Yi.coordText_lf)==null||vi.children.forEach(Bs=>{Bs.up.set(0,1,0)}),(co=(ri=Ze.current)==null?void 0:ri.coordText_rf)==null||co.children.forEach(Bs=>{Bs.up.set(0,1,0)}),(Vn=(ta=Ze.current)==null?void 0:ta.coordText_rb)==null||Vn.children.forEach(Bs=>{Bs.up.set(0,1,0)})),wt=(yt=ft.current)==null?void 0:yt.normalVector,ot=ft,an=wt&&Yt.dot(wt),pr=!1,(Re=ot.current)!=null&&Re.coordMesh&&Me.current.remove((Je=ot.current)==null?void 0:Je.coordMesh),($e=ot.current)!=null&&$e.mouseLine_w&&Me.current.remove((at=ot.current)==null?void 0:at.mouseLine_w),(ct=ot.current)!=null&&ct.mouseLine_h&&Me.current.remove((mt=ot.current)==null?void 0:mt.mouseLine_h),typeof((it=ot.current)==null?void 0:it.coordText)=="object"&&Me.current.remove((be=ot.current)==null?void 0:be.coordText),typeof((ce=ot.current)==null?void 0:ce.coordTextReverse)=="object"&&Me.current.remove((Ve=ot.current)==null?void 0:Ve.coordTextReverse),an&&an>=0&&(pr=!0,(Ae=ot.current)!=null&&Ae.coordMesh&&Me.current.add((Qe=ot.current)==null?void 0:Qe.coordMesh),(gt=ot.current)!=null&>.mouseLine_w&&Me.current.add((Bt=ot.current)==null?void 0:Bt.mouseLine_w),(Lt=ot.current)!=null&&Lt.mouseLine_h&&Me.current.add((qt=ot.current)==null?void 0:qt.mouseLine_h),hn?typeof((Ct=ot.current)==null?void 0:Ct.coordText)=="object"&&Me.current.add((Xt=ot.current)==null?void 0:Xt.coordText):typeof((Yn=ot.current)==null?void 0:Yn.coordTextReverse)=="object"&&Me.current.add((mr=ot.current)==null?void 0:mr.coordTextReverse)),wt=(On=Ye.current)==null?void 0:On.normalVector,ot=Ye,an=wt&&Yt.dot(wt),Tn=!1,(Rn=ot.current)!=null&&Rn.coordMesh&&Me.current.remove((Yr=ot.current)==null?void 0:Yr.coordMesh),($r=ot.current)!=null&&$r.mouseLine_w&&Me.current.remove((pn=ot.current)==null?void 0:pn.mouseLine_w),(Jt=ot.current)!=null&&Jt.mouseLine_h&&Me.current.remove((si=ot.current)==null?void 0:si.mouseLine_h),typeof((Pr=ot.current)==null?void 0:Pr.coordText)=="object"&&Me.current.remove((jr=ot.current)==null?void 0:jr.coordText),typeof((xs=ot.current)==null?void 0:xs.coordTextReverse)=="object"&&Me.current.remove((ga=ot.current)==null?void 0:ga.coordTextReverse),an&&an>=0&&(Tn=!0,(xo=ot.current)!=null&&xo.coordMesh&&Me.current.add((li=ot.current)==null?void 0:li.coordMesh),(Jr=ot.current)!=null&&Jr.mouseLine_w&&Me.current.add((Ki=ot.current)==null?void 0:Ki.mouseLine_w),(ts=ot.current)!=null&&ts.mouseLine_h&&Me.current.add((Ia=ot.current)==null?void 0:Ia.mouseLine_h),hn?typeof((Go=ot.current)==null?void 0:Go.coordText)=="object"&&Me.current.add((Ml=ot.current)==null?void 0:Ml.coordText):typeof((Xs=ot.current)==null?void 0:Xs.coordTextReverse)=="object"&&Me.current.add((ks=ot.current)==null?void 0:ks.coordTextReverse)),wt=(Ha=tt.current)==null?void 0:Ha.normalVector,ot=tt,an=wt&&Yt.dot(wt),Wn=!1,(ka=ot.current)!=null&&ka.coordMesh&&Me.current.remove((Zs=ot.current)==null?void 0:Zs.coordMesh),(il=ot.current)!=null&&il.mouseLine_w&&Me.current.remove((Us=ot.current)==null?void 0:Us.mouseLine_w),(dr=ot.current)!=null&&dr.mouseLine_h&&Me.current.remove((Qa=ot.current)==null?void 0:Qa.mouseLine_h),typeof((Yo=ot.current)==null?void 0:Yo.coordText)=="object"&&Me.current.remove((Ks=ot.current)==null?void 0:Ks.coordText),typeof((Cs=ot.current)==null?void 0:Cs.coordTextReverse)=="object"&&Me.current.remove((Va=ot.current)==null?void 0:Va.coordTextReverse),an&&an>=0&&(Wn=!0,(Uo=ot.current)!=null&&Uo.coordMesh&&Me.current.add((Fo=ot.current)==null?void 0:Fo.coordMesh),(io=ot.current)!=null&&io.mouseLine_w&&Me.current.add((Mo=ot.current)==null?void 0:Mo.mouseLine_w),(hl=ot.current)!=null&&hl.mouseLine_h&&Me.current.add((Zl=ot.current)==null?void 0:Zl.mouseLine_h),hn?typeof((Bo=ot.current)==null?void 0:Bo.coordText)=="object"&&Me.current.add((Lo=ot.current)==null?void 0:Lo.coordText):typeof((jo=ot.current)==null?void 0:jo.coordTextReverse)=="object"&&Me.current.add((Ys=ot.current)==null?void 0:Ys.coordTextReverse)),wt=(fs=rt.current)==null?void 0:fs.normalVector,ot=rt,an=wt&&Yt.dot(wt),Dr=!1,(Kl=ot.current)!=null&&Kl.coordMesh&&Me.current.remove((pl=ot.current)==null?void 0:pl.coordMesh),(rc=ot.current)!=null&&rc.mouseLine_w&&Me.current.remove((ic=ot.current)==null?void 0:ic.mouseLine_w),(vl=ot.current)!=null&&vl.mouseLine_h&&Me.current.remove((gl=ot.current)==null?void 0:gl.mouseLine_h),typeof((hs=ot.current)==null?void 0:hs.coordText)=="object"&&Me.current.remove((pc=ot.current)==null?void 0:pc.coordText),typeof((ac=ot.current)==null?void 0:ac.coordTextReverse)=="object"&&Me.current.remove((Ll=ot.current)==null?void 0:Ll.coordTextReverse),an&&an>=0&&(Dr=!0,(Bu=ot.current)!=null&&Bu.coordMesh&&Me.current.add((os=ot.current)==null?void 0:os.coordMesh),(dd=ot.current)!=null&&dd.mouseLine_w&&Me.current.add((Vo=ot.current)==null?void 0:Vo.mouseLine_w),(ml=ot.current)!=null&&ml.mouseLine_h&&Me.current.add((ss=ot.current)==null?void 0:ss.mouseLine_h),hn?typeof((Yl=ot.current)==null?void 0:Yl.coordText)=="object"&&Me.current.add((Fs=ot.current)==null?void 0:Fs.coordText):typeof((nu=ot.current)==null?void 0:nu.coordTextReverse)=="object"&&Me.current.add((fd=ot.current)==null?void 0:fd.coordTextReverse)),wt=(ru=Ze.current)==null?void 0:ru.normalVector,ot=Ze,an=wt&&Yt.dot(wt),an&&an>=0?((hd=ot.current)!=null&&hd.coordMesh&&Me.current.add((oc=ot.current)==null?void 0:oc.coordMesh),(Uc=ot.current)!=null&&Uc.mouseLine_w&&Me.current.add((vc=ot.current)==null?void 0:vc.mouseLine_w),(Fc=ot.current)!=null&&Fc.mouseLine_h&&Me.current.add((sc=ot.current)==null?void 0:sc.mouseLine_h),(bu=ot.current)!=null&&bu.coordText_lb&&Me.current.remove((gc=ot.current)==null?void 0:gc.coordText_lb),(xu=ot.current)!=null&&xu.coordText_rb&&Me.current.remove((al=ot.current)==null?void 0:al.coordText_rb),(yl=ot.current)!=null&&yl.coordText_lf&&Me.current.remove((Rl=ot.current)==null?void 0:Rl.coordText_lf),(qs=ot.current)!=null&&qs.coordText_rf&&Me.current.remove((bl=ot.current)==null?void 0:bl.coordText_rf),pr&&Wn?(Js=ot.current)!=null&&Js.coordText_lb&&Me.current.add((Ii=ot.current)==null?void 0:Ii.coordText_lb):pr&&Dr?(Qs=ot.current)!=null&&Qs.coordText_rb&&Me.current.add((ao=ot.current)==null?void 0:ao.coordText_rb):Tn&&Dr?(Cu=ot.current)!=null&&Cu.coordText_rf&&Me.current.add((Bc=ot.current)==null?void 0:Bc.coordText_rf):Tn&&Wn&&(Vu=ot.current)!=null&&Vu.coordText_lf&&Me.current.add((iu=ot.current)==null?void 0:iu.coordText_lf)):(($u=ot.current)!=null&&$u.coordMesh&&Me.current.remove((au=ot.current)==null?void 0:au.coordMesh),(ou=ot.current)!=null&&ou.mouseLine_w&&Me.current.remove((Vc=ot.current)==null?void 0:Vc.mouseLine_w),(lc=ot.current)!=null&&lc.mouseLine_h&&Me.current.remove((zu=ot.current)==null?void 0:zu.mouseLine_h),(E=ot.current)!=null&&E.coordText_lb&&Me.current.remove((D=ot.current)==null?void 0:D.coordText_lb),(X=ot.current)!=null&&X.coordText_rb&&Me.current.remove((le=ot.current)==null?void 0:le.coordText_rb),(Ce=ot.current)!=null&&Ce.coordText_lf&&Me.current.remove((qe=ot.current)==null?void 0:qe.coordText_lf),(Ot=ot.current)!=null&&Ot.coordText_rf&&Me.current.remove((sn=ot.current)==null?void 0:sn.coordText_rf)),wt=(vn=dt.current)==null?void 0:vn.normalVector,ot=dt,an=wt&&Yt.dot(wt),an&&an>=0?((Kn=ot.current)!=null&&Kn.coordMesh&&Me.current.add((Wr=ot.current)==null?void 0:Wr.coordMesh),(_i=ot.current)!=null&&_i.mouseLine_w&&Me.current.add((qi=ot.current)==null?void 0:qi.mouseLine_w),(qo=ot.current)!=null&&qo.mouseLine_h&&Me.current.add((uo=ot.current)==null?void 0:uo.mouseLine_h),(ps=Ze.current)!=null&&ps.coordText_lb&&Me.current.remove((Oo=Ze.current)==null?void 0:Oo.coordText_lb),(ql=Ze.current)!=null&&ql.coordText_rb&&Me.current.remove((ol=Ze.current)==null?void 0:ol.coordText_rb),(Hu=Ze.current)!=null&&Hu.coordText_lf&&Me.current.remove((Su=Ze.current)==null?void 0:Su.coordText_lf),(Ol=Ze.current)!=null&&Ol.coordText_rf&&Me.current.remove((sl=Ze.current)==null?void 0:sl.coordText_rf),pr&&Wn?(Jl=Ze.current)!=null&&Jl.coordText_lb&&Me.current.add((Co=Ze.current)==null?void 0:Co.coordText_lb):pr&&Dr?(mc=Ze.current)!=null&&mc.coordText_rb&&Me.current.add((pd=Ze.current)==null?void 0:pd.coordText_rb):Tn&&Dr?(Jo=Ze.current)!=null&&Jo.coordText_rf&&Me.current.add((wu=Ze.current)==null?void 0:wu.coordText_rf):Tn&&Wn&&(ll=Ze.current)!=null&&ll.coordText_lf&&Me.current.add((Qo=Ze.current)==null?void 0:Qo.coordText_lf)):((yc=ot.current)!=null&&yc.coordMesh&&Me.current.remove((Eu=ot.current)==null?void 0:Eu.coordMesh),($c=ot.current)!=null&&$c.mouseLine_w&&Me.current.remove((Cv=ot.current)==null?void 0:Cv.mouseLine_w),(Gu=ot.current)!=null&&Gu.mouseLine_h&&Me.current.remove((Zm=ot.current)==null?void 0:Zm.mouseLine_h))},Ci=Yt=>{y!=null&&y.current&&Me.current.remove(y.current);const wt=new Qi().setFromPoints(Yt),an=new Mf({color:255}),ot=new Ua(wt,an);ot.name="Line",y&&(y.current=ot),Me.current.add(ot)},ir=(Yt,wt)=>{const an={flag:ip.current,start_point:Yt,end_point:wt};fetch("/app-api/c-api/findn",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(an)}).then(ot=>{if(ot.ok)return ot.json();throw cs.error({content:"失败"}),new Error(ot.statusText)}).then(ot=>{Wt(ot.name_list)})},Rr=Yt=>{const wt=new Qi().setFromPoints(Yt),an=new Vvt({color:16711680,dashSize:.5,gapSize:.2}),ot=new Ua(wt,an);ot.computeLineDistances(),$n.current=ot,$n.current.name="dashedLine";const Tn=Me.current.getObjectByName("dashedLine");Tn&&Me.current.remove(Tn),Me.current.add($n.current)},Or=Yt=>{var Wn,Dr,hn,ar,Qn,er,sr,ei;if(Yt.preventDefault(),bn.current.x=Yt.offsetX/e.domElement.clientWidth*2-1,bn.current.y=-(Yt.offsetY/e.domElement.clientHeight)*2+1,he.current.setFromCamera(bn.current,Ti.current),he.current.params.Points.threshold=.05,u!=null&&u.current)var wt=he.current.intersectObjects(Me.current.children.filter(cn=>{const Pn=cn instanceof QS;return!["","ExtractedSurface","outline","dashedLine","Line","sphereBig","sphereMiddelClick","test_behind","test_front","test_left","test_right","test_bootom","test_top","test_top_mouseLine_w","test_top_mouseLine_h","test_bottom_mouseLine_w","test_bottom_mouseLine_h","test_left_mouseLine_w","test_left_mouseLine_h","test_right_mouseLine_w","test_right_mouseLine_h","test_front_mouseLine_w","test_front_mouseLine_h",,"test_behind_mouseLine_w","test_behind_mouseLine_h"].includes(cn.name)&&!Pn}),!0);else var wt=he.current.intersectObjects(Me.current.children.filter(Pn=>{const Ir=Pn instanceof QS;return!["","Brain","ExtractedSurface","outline","dashedLine","Line","sphereBig","sphereMiddelClick","test_behind","test_front","test_left","test_right","test_bootom","test_top","test_top_mouseLine_w","test_top_mouseLine_h","test_bottom_mouseLine_w","test_bottom_mouseLine_h","test_left_mouseLine_w","test_left_mouseLine_h","test_right_mouseLine_w","test_right_mouseLine_h","test_front_mouseLine_w","test_front_mouseLine_h",,"test_behind_mouseLine_w","test_behind_mouseLine_h"].includes(Pn.name)&&!Ir}),!0);const an=Me.current.getObjectByName("Brain"),ot=new ed(-Me.current.rotation.x,-Me.current.rotation.y,-Me.current.rotation.z);let Tn;if(an){const cn=new gs;cn.expandByObject(an);const Pn=new Ie;cn.getSize(Pn);const Ir=new Ie;cn.getCenter(Ir);const ti=new zs(Pn.x,Pn.y,Pn.z),Wi=new Qu({color:65280,wireframe:!0}),Yi=new nr(ti,Wi);if(Yi.position.copy(Ir),Tn=he.current.intersectObject(Yi,!0),(b==null?void 0:b.current)==2&&Tn.length>0){const vi=Tn[0].point.clone().applyEuler(ot);let ri=Ir.clone().sub(vi);if(ri.normalize(),wt.length>0&&((m==null?void 0:m.current.length)==2||(m==null?void 0:m.current.length)==1)){ri=wt[0].point.clone().applyEuler(ot).sub(m.current[0]),ri.normalize();const $e=new h7;$e.set(m.current[0],ri);const at=new yE($e.ray.origin,$e.ray.direction),ct=new Ie,mt=at.intersectBox(cn,ct);mt&&hr.current.position.set(mt.x,mt.y,mt.z),ri=ri.negate()}else hr.current.position.set(vi.x,vi.y,vi.z);const co=hr.current.userData.direction,ta=co.dot(ri),Vn=Math.acos(ta),yt=new Ie().crossVectors(co,ri).normalize(),Re=new vo().setFromAxisAngle(yt,Vn);hr.current.rotation.set(0,0,0),hr.current.applyQuaternion(Re),vi.z<-6?hr.current.position.setZ(vi.z+hr.current.userData.center.x):vi.x<-5?hr.current.translateX(hr.current.userData.center.x):vi.y<-3&&hr.current.position.setY(vi.y+hr.current.userData.center.x-.8),Me.current.getObjectByName("syrings")||Me.current.add(hr.current)}}if(wt.length>0){let cn=0;{if((jt.current!=wt[cn].object.parent||jt.current!=wt[cn].object)&&wt[cn].object.parent!=null){if(jt){let Pn=jt.current.name;if(jt.current.myMeshType=="SWC")jt.current.children[0].material.color.setHex(jt.current.currentHex),jt.current.traverse(Ir=>{Ir instanceof Ua&&Ir.material.color.setHex(jt.current.currentHex)});else if(jt.current.myMeshType=="FBX")jt.current.children[0].material.color.setHex(jt.current.currentHex);else if(jt.current.myMeshType=="Vessel")r.current&&r.current[Pn].contentmaterial.color.setHex(jt.current.currentHex),r.current&&r.current[Pn].contentobj.traverse(Ir=>{Ir instanceof $T&&Ir.levels.forEach(ti=>{ti.object.material.color.setHex(jt.current.currentHex)})});else if(jt.current.name==="lineNameMesh"){const Ir=jt.current.userData.wholeName.split("-")[0],ti=jt.current.userData.wholeName.split("-")[1];let Wi=jt.current.userData.initColor;jt.current.material.color.set(Wi),Me.current.traverse(Yi=>{if(Yi.name===`swcPointGroup${Ir}`)for(let vi in Yi.children){let ri=Yi.children[vi];ri.name===`${Ir}-${ti}`&&ri.myMeshType==="neuronSphere"&&(ri.material.uniforms.color.value=new oi(ri.userData.color))}})}else jt.current.myMeshType==="neuronSphere"?(jt.current.material.uniforms.color.value=new oi(jt.current.userData.color),Me.current.traverse(Ir=>{if(Ir.name==="lineNameMesh"&&Ir.userData.wholeName===jt.current.name){let ti=Ir.userData.initColor;Ir.material.color.set(ti)}})):wt[cn].object.name=="lineName"&&(Z(""),W(""),V(""),te({}),B(wt[cn].object.userData.name))}if(jt.current=wt[cn].object.parent,jt.current.currentHex=(Dr=(Wn=wt[cn].object.material)==null?void 0:Wn.color)==null?void 0:Dr.getHex(),jt.current.myMeshType=="SWC")jt.current.children[0].material.color.setHex(16711680),jt.current.traverse(Pn=>{Pn instanceof Ua&&Pn.material.color.setHex(16711680)}),V(jt.current.name),B(""),W(""),Z(""),ae({});else if(jt.current.myMeshType=="FBX")wt[cn].object.parent.name=="Brain"||wt[cn].object.parent.name=="syrings"?(jt.current.children[0].material.color.setHex(jt.current.currentHex),br.current=!1,B("")):(jt.current.name!=ur.current&&(V(""),B(jt.current.name)),(b==null?void 0:b.current)==1&&jt.current.children[0].material.color.setHex(16711680),br.current=!0),jt.current.children[0].geometry.computeBoundingBox(),a&&a(jt.current.name);else if(jt.current.myMeshType=="Vessel"){let Pn=jt.current.name;W(Pn),V(""),r.current&&r.current[Pn].contentmaterial.color.setHex(16711680),r.current&&r.current[Pn].contentobj.traverse(Ir=>{Ir instanceof $T&&Ir.levels.forEach(ti=>{ti.object.material.color.setHex(16711680)})}),lt(!0),a&&a(jt.current.name)}else if(wt[cn].object.name==="lineNameMesh"||wt[cn].object.myMeshType==="neuronSphere"){if(jt.current=wt[cn].object,jt.current.myMeshType==="neuronSphere"&&(jt.current.material.uniforms.color.value=new oi("#ff0000"),V(""),Z(""),W(""),cr(""),ae({name:jt.current.name,Lable:jt.current.name.split("-")[1]}),Me.current.traverse(Pn=>{Pn.name==="lineNameMesh"&&Pn.userData.wholeName===jt.current.name&&Pn.material.color.set("#ff0000")})),jt.current.name==="lineNameMesh"){let Pn=jt.current.userData.name,Ir=jt.current.userData.wholeName.split("-")[0],ti=jt.current.userData.wholeName.split("-")[1];jt.current.material.color.set("#ff0000"),Me.current.traverse(Wi=>{if(Wi.name===`swcPointGroup${Ir}`)for(let Yi in Wi.children){let vi=Wi.children[Yi];vi.name===`${Ir}-${ti}`&&vi.myMeshType==="neuronSphere"&&(vi.material.uniforms.color.value=new oi("#ff0000"))}}),V(""),Z(""),W(""),B(Pn.replace("/","_"))}}else["CoronalView","SagittalView","HorizontalView","arbitrarySlice"].includes(wt[cn].object.name)&&(B(""),W(""),Z(""))}if(Yt.type=="mousemove"&&jt.current.name!="Syringeobjcleanergles"){if(wt[cn].point=wt[cn].point.clone().applyEuler(ot),((ar=(hn=wt[cn].object)==null?void 0:hn.geometry)==null?void 0:ar.type)=="SphereGeometry"&&!["sphereMiddelClick","sphereBig","sectionSphere"].includes(wt[cn].object.name)&&wt[cn].object.myMeshType!=="neuronSphere"){let Pn=((wt[cn].point.x-Le.current.x)*Pe.current).toFixed(2),Ir=((wt[cn].point.y-Le.current.y)*Ge.current).toFixed(2),ti=-((wt[cn].point.z-Le.current.z)*De.current).toFixed(2);const Wi=wt[cn].object.name;let Yi=new Ie;He.current.forEach((vi,ri)=>{vi.name==Wi&&(Yi=vi.position)}),Yi.x===0&&Yi.y===0&&Yi.z===0||(ln.current={point:new Ie(parseFloat(Pn),parseFloat(Ir),ti),center:new Ie(Yi.x,Yi.y,Yi.z),name:Wi}),wt[cn].object.userData.type=="points"?Gn(wt[cn].point,wt[cn].object.name,"Point1",wt[cn].object):(Gn(wt[cn].point,Wi,"Point"),cr(Wi),Dn.current=!0,Un({left:Yt.clientX,top:Yt.clientY}));return}jt.current.myMeshType=="FBX"&&(wt[cn].object.parent.name=="Brain"||wt[cn].object.parent.name=="syrings"?(B(""),Z(""),W(""),V(""),cr("")):(Gn(wt[cn].point,jt.current.name,"FBX"),Z(jt.current.name),V(""),W(""),Un({left:Yt.clientX,top:Yt.clientY}))),jt.current.myMeshType=="SWC"&&Gn(wt[cn].point,jt.current.name,"SWC"),jt.current.myMeshType=="Vessel"&&Gn(wt[cn].point,jt.current.name,"Vessel"),wt[cn].object.type=="Points"&&Gn(wt[cn].point,wt[cn].object.name,"Points"),v&&v.current&&g&&m&&wt[cn].object.name!="lineName"&&(m.current.length==2?P.current||(g.current.pop(),g.current.push(Zn(wt[cn].point)),m.current.pop(),m.current.push(wt[cn].point),N.current&&(rn(wt[cn].point,wt[cn].object.name),Rr(m.current))):m.current.length==0?br!=null&&br.current&&(P.current||rn(wt[cn].point,wt[cn].object.name)):(g.current.push(Zn(wt[cn].point)),m.current.push(wt[cn].point),P.current||N.current&&(rn(wt[cn].point,wt[cn].object.name),Rr(m.current)))),Dn.current=!1,wt[cn].object.material.type=="MeshPhongMaterial"&&cr("")}else if(Yt.type=="click"&&jt.current.name!="Syringeobjcleanergles"){if(wt[cn].point=wt[cn].point.clone().applyEuler(ot),(((er=(Qn=wt[cn].object)==null?void 0:Qn.geometry)==null?void 0:er.type)=="SphereGeometry"||((ei=(sr=wt[cn].object)==null?void 0:sr.geometry)==null?void 0:ei.type)=="PlaneGeometry")&&!["sphereMiddelClick","sphereBig","sectionSphere"].includes(wt[cn].object.name)&&wt[cn].object.myMeshType!=="neuronSphere"){if(wt[cn].object.userData.type=="points"&&Gn(wt[cn].point,wt[cn].object.name,"Point",wt[cn].object),wt[cn].object.name=="Points"){const Pn=ea(wt[cn].object.userData,wt[cn].object.position);Me.current.add(Pn)}wt[cn].object.name=="card"?(console.log(wt[cn].uv,wt[cn]),wt[cn].object.userData.onClick(wt[cn].uv)):(Gn(wt[cn].point,wt[cn].object.name,"Point"),Di(wt[cn].object.name),cr(wt[cn].object.name));return}if(v&&v.current&&g&&m){if(m.current.length>1){if(!N.current)return;Ni(g.current),g.current.pop(),m.current.pop()}if(!P.current){g.current.push(Zn(wt[cn].point)),m.current.push(wt[cn].point);var pr=new vo;pr.setFromAxisAngle(new Ie(1,0,0),Math.PI/2);const Pn=Me.current.getObjectByName("Brain");if(m.current.length==2&&Pn){let Ir=m.current[0].clone().applyEuler(Me.current.rotation),ti=m.current[1].clone().applyEuler(Me.current.rotation);Ir=Ir.applyMatrix4(Pn.matrixWorld.clone().invert()).applyQuaternion(pr),ti=ti.applyMatrix4(Pn.matrixWorld.clone().invert()).applyQuaternion(pr),ir(Ir.toArray(),ti.toArray())}Ci(m.current)}}v!=null&&v.current&&(!P.current&&(g==null?void 0:g.current.length)==1?(ur.current=wt[cn].object.name,xr(wt[cn].point,!0)):P.current||xr(wt[cn].point))}}}else{if(B(""),cr(""),Z(""),W(""),V(""),te({}),ae({}),V(""),G.current.removeFBX(Vt.current,!0),Vt.current="",q.current={},jt.current){let cn=jt.current.name;if(jt.current.myMeshType=="SWC")jt.current.children[0].material.color.setHex(jt.current.currentHex),jt.current.traverse(Pn=>{Pn instanceof Ua&&Pn.material.color.setHex(jt.current.currentHex)});else if(jt.current.myMeshType=="FBX")jt.current.children[0].material.color.setHex(jt.current.currentHex);else if(jt.current.myMeshType=="Vessel")cn in r.current&&(r.current&&r.current[cn].contentmaterial.color.setHex(jt.current.currentHex),r.current&&r.current[cn].contentobj.traverse(Pn=>{Pn instanceof $T&&Pn.levels.forEach(Ir=>{Ir.object.material.color.setHex(jt.current.currentHex)})}));else if(jt.current.name==="lineNameMesh"){const Pn=jt.current.userData.wholeName.split("-")[0],Ir=jt.current.userData.wholeName.split("-")[1];let ti=jt.current.userData.initColor;jt.current.material.color.set(ti),Me.current.traverse(Wi=>{for(let Yi in Wi.children){let vi=Wi.children[Yi];vi.name===`${Pn}-${Ir}`&&vi.myMeshType==="neuronSphere"&&(vi.material.uniforms.color.value=new oi(vi.userData.color))}})}else jt.current.myMeshType==="neuronSphere"&&(jt.current.material.uniforms.color.value=new oi(jt.current.userData.color),Me.current.traverse(Pn=>{if(Pn.name==="lineNameMesh"&&Pn.userData.wholeName===jt.current.name){let Ir=Pn.userData.initColor;Pn.material.color.set(Ir)}}))}cr(""),xe(""),_e(""),ye(""),jt.current=new Du,jt.current.myMeshType="",jt.current.currentHex="",b&&b.current==3}Qr(Yt)},tr=()=>{new _gt().load(ge+"/data/GLB/syringe.glb",wt=>{hr.current=wt.scene,hr.current.name="syrings",hr.current.userData.direction=new Ie(1,0,0),hr.current.scale.set(2,2,2),hr.current.position.set(0,0,0);var an=new gs;an.expandByObject(hr.current);var ot=new Ie;an==null||an.getCenter(ot),hr.current.userData.center=ot})},Fr=()=>{if(An(),ji(),tr(),Loe){let Yt=JSON.parse(Loe);p.current.forEach(wt=>{wt.visible=Yt})}};C.useEffect(()=>{var Yt,wt,an,ot,Tn,pr,Wn,Dr,hn,ar,Qn,er;if(ft.current&&Ze.current&&tt.current&&rt.current&&Ye.current&&St){let sr=new Ie(0,-1,0),ei=new Ie(0,1,0);typeof((Yt=ft.current)==null?void 0:Yt.coordText)=="object"&&Me.current.remove(ft.current.coordText),typeof((wt=ft.current)==null?void 0:wt.coordTextReverse)=="object"&&Me.current.remove(ft.current.coordTextReverse),typeof((an=Ye.current)==null?void 0:an.coordText)=="object"&&Me.current.remove(Ye.current.coordText),typeof((ot=Ye.current)==null?void 0:ot.coordTextReverse)=="object"&&Me.current.remove(Ye.current.coordTextReverse),typeof((Tn=tt.current)==null?void 0:Tn.coordText)=="object"&&Me.current.remove(tt.current.coordText),typeof((pr=tt.current)==null?void 0:pr.coordTextReverse)=="object"&&Me.current.remove(tt.current.coordTextReverse),typeof((Wn=rt.current)==null?void 0:Wn.coordText)=="object"&&Me.current.remove(rt.current.coordText),typeof((Dr=Ze.current)==null?void 0:Dr.coordText_lb)=="object"&&Me.current.remove(Ze.current.coordText_lb),typeof((hn=Ze.current)==null?void 0:hn.coordText_rb)=="object"&&Me.current.remove(Ze.current.coordText_rb),typeof((ar=Ze.current)==null?void 0:ar.coordText_rf)=="object"&&Me.current.remove(Ze.current.coordText_rf),typeof((Qn=Ze.current)==null?void 0:Qn.coordText_lf)=="object"&&Me.current.remove(Ze.current.coordText_lf),typeof((er=rt.current)==null?void 0:er.coordTextReverse)=="object"&&Me.current.remove(rt.current.coordTextReverse);let cn=new Ie(Be.current.x,Be.current.y,ke.current.z),Pn=new Ie(1,0,0);ft.current.coordText=vr(sr,cn,Pn,ke.current.x-Be.current.x,12,-(6+St.x),-(St.x-6),new Ie(0,0,0)),cn.y=ke.current.y,ft.current.coordTextReverse=vr(ei,cn,Pn,ke.current.x-Be.current.x,12,-(6+St.x),-(St.x-6),new Ie(0,0,0)),cn=new Ie(Be.current.x,Be.current.y,Be.current.z),Pn=new Ie(1,0,0),Ye.current.coordText=vr(sr,cn,Pn,ke.current.x-Be.current.x,12,-(6+St.x),-(St.x-6),new Ie(0,0,0)),cn.y=ke.current.y,Ye.current.coordTextReverse=vr(ei,cn,Pn,ke.current.x-Be.current.x,12,-(6+St.x),-(St.x-6),new Ie(0,0,0)),cn=new Ie(Be.current.x,Be.current.y,ke.current.z),Pn=new Ie(0,0,-1),tt.current.coordText=vr(sr,cn,Pn,ke.current.z-Be.current.z,14,-(8+St.z),-(St.z-6),new Ie(0,0,0)),cn.y=ke.current.y,tt.current.coordTextReverse=vr(ei,cn,Pn,ke.current.z-Be.current.z,14,-(8+St.z),-(St.z-6),new Ie(0,0,0)),cn=new Ie(ke.current.x,Be.current.y,ke.current.z),Pn=new Ie(0,0,-1),rt.current.coordText=vr(sr,cn,Pn,ke.current.z-Be.current.z,14,-(8+St.z),-(St.z-6),new Ie(0,0,0)),cn.y=ke.current.y,rt.current.coordTextReverse=vr(ei,cn,Pn,ke.current.z-Be.current.z,14,-(8+St.z),-(St.z-6),new Ie(0,0,0)),cn=new Ie(ke.current.x,Be.current.y,ke.current.z),Pn=new Ie(0,1,0),Ze.current.coordText_lb=vr(sr,cn,Pn,ke.current.y-Be.current.y,10,-St.y,10-St.y,new Ie(0,0,0)),cn=new Ie(Be.current.x,Be.current.y,ke.current.z),Pn=new Ie(0,1,0),Ze.current.coordText_lf=vr(sr,cn,Pn,ke.current.y-Be.current.y,10,-St.y,10-St.y,new Ie(0,0,0)),cn=new Ie(Be.current.x,Be.current.y,Be.current.z),Pn=new Ie(0,1,0),Ze.current.coordText_rf=vr(sr,cn,Pn,ke.current.y-Be.current.y,10,-St.y,10-St.y,new Ie(0,0,0)),cn=new Ie(ke.current.x,Be.current.y,Be.current.z),Pn=new Ie(0,1,0),Ze.current.coordText_rb=vr(sr,cn,Pn,ke.current.y-Be.current.y,10,-St.y,10-St.y,new Ie(0,0,0)),Tr()}A&&(A.current=At(Rt.current))},[St]);const Ni=Yt=>{var wt=Yt[0].x-Yt[1].x,an=Yt[0].y-Yt[1].y,ot=Yt[0].z-Yt[1].z,Tn=Math.sqrt(wt*wt+an*an+ot*ot);wt=Math.abs(wt/Tn),an=Math.abs(an/Tn),ot=Math.abs(ot/Tn),wt=Math.acos(wt)*180/Math.PI,an=Math.acos(an)*180/Math.PI,ot=Math.acos(ot)*180/Math.PI;var pr=pe=="en_us"&&pe?"Target site (unit: mm): ":"项目 (unit: mm): ",Wn=pe=="en_us"&&pe?"The angle of injection (unit:°):":"注射方向的角度 (unit:°):",Dr=pe=="en_us"&&pe?"Injection site (unit: mm):":"注射部位 (unit: mm):",hn=`<span style='font-weight:bold'> ${Wn}<br/></span>coronal plane ${ot.toFixed(2)} / horizontal plane ${an.toFixed(2)} / sagittal plane ${wt.toFixed(2)}`,ar=`<br><span style='font-weight:bold'>${pr}</span><br>X: ${Yt[0].x.toFixed(2)} / Y: ${Yt[0].y.toFixed(2)} / Z: ${Yt[0].z.toFixed(2)}<br><span style='font-weight:bold'>${Dr}: </span><br>X: ${Yt[1].x.toFixed(2)} / Y: ${Yt[1].y.toFixed(2)} / Z: ${Yt[1].z.toFixed(2)}`;c&&c(hn+ar)},Li=(Yt,wt,an,ot)=>{var Tn=document.createElement("canvas");Tn.width=Yt,Tn.height=wt,Tn.style.border="1px solid #000";let pr=Tn.getContext("2d");return pr.font="101px Arial",pr.fillText(an,40,80),Tn},Di=Yt=>{Mt.current&&Me.current.remove(Mt.current);const wt=Pt.current.find(ot=>ot.name===Yt);var an=new Bh(Li(650,620,Yt.replace("_","/")));Mt.current=new Fh(new Kf({map:an})),wt&&"Coordinate"in wt&&(Mt.current.scale.set(1.5,1.5,1.5),Mt.current.position.set(wt.Coordinate.x*.001,wt.Coordinate.y*.001+.002,wt.Coordinate.z*.001),Mt.current.translateX(po.current),Mt.current.translateY(qa.current),Mt.current.translateZ(to.current),Me.current.add(Mt.current))},ji=()=>{dt.current=va(1,{x:(Be.current.x+ke.current.x)/2,y:Be.current.y,z:(Be.current.z+ke.current.z)/2},ke.current.x-Be.current.x,ke.current.z-Be.current.z,12,14,"#E3E3E3","test_top"),dt.current.normalVector=new Ie(0,-1,0),dt.current.mouseLine_w.name="test_top_mouseLine_w",dt.current.mouseLine_h.name="test_top_mouseLine_h",Ze.current=va(1,{x:(Be.current.x+ke.current.x)/2,y:ke.current.y,z:(Be.current.z+ke.current.z)/2},ke.current.x-Be.current.x,ke.current.z-Be.current.z,12,14,"#E3E3E3","test_bootom"),Ze.current.normalVector=new Ie(0,1,0),Ze.current.mouseLine_w.name="test_bottom_mouseLine_w",Ze.current.mouseLine_h.name="test_bottom_mouseLine_h",Ye.current=va(2,{x:(Be.current.x+ke.current.x)/2,y:(Be.current.y+ke.current.y)/2,z:Be.current.z},ke.current.x-Be.current.x,ke.current.y-Be.current.y,12,10,"#E3E3E3","test_front"),Ye.current.normalVector=new Ie(0,0,-1),Ye.current.mouseLine_w.name="test_front_mouseLine_w",Ye.current.mouseLine_h.name="test_front_mouseLine_h",ft.current=va(2,{x:(Be.current.x+ke.current.x)/2,y:(Be.current.y+ke.current.y)/2,z:ke.current.z},ke.current.x-Be.current.x,ke.current.y-Be.current.y,12,10,"#E3E3E3","test_behind"),ft.current.normalVector=new Ie(0,0,1),ft.current.mouseLine_w.name="test_behind_mouseLine_w",ft.current.mouseLine_h.name="test_behind_mouseLine_h",tt.current=va(3,{x:Be.current.x,y:(Be.current.y+ke.current.y)/2,z:(Be.current.z+ke.current.z)/2},ke.current.z-Be.current.z,ke.current.y-Be.current.y,14,10,"#E3E3E3","test_left"),tt.current.normalVector=new Ie(-1,0,0),tt.current.mouseLine_w.name="test_left_mouseLine_w",tt.current.mouseLine_h.name="test_left_mouseLine_h",rt.current=va(3,{x:ke.current.x,y:(Be.current.y+ke.current.y)/2,z:(Be.current.z+ke.current.z)/2},ke.current.z-Be.current.z,ke.current.y-Be.current.y,14,10,"#E3E3E3","test_right"),rt.current.normalVector=new Ie(1,0,0),rt.current.mouseLine_w.name="test_right_mouseLine_w",rt.current.mouseLine_h.name="test_right_mouseLine_h",rm=new nr(new lu(.1,32,32),new kl({color:392960,transparent:!0})),rm.name="sphereBig",dn.current=new nr(new lu(.065,32,32),new kl({color:392960,transparent:!0})),Cn.current=new nr(new lu(.025,32,32),new kl({color:392960,transparent:!0})),Me.current.getObjectByName("sphereMiddelClick")||(su=new nr(new a9(.1,.3,32),new kl({color:1609983,transparent:!0})),su.name="sphereMiddelClick"),ft.current&&(ft.current.coordMesh.visible=Q,ft.current.mouseLine_w.visible=Q,ft.current.mouseLine_h.visible=Q),dt.current&&(dt.current.coordMesh.visible=Q,dt.current.mouseLine_w.visible=Q,dt.current.mouseLine_h.visible=Q),Ye.current&&(Ye.current.coordMesh.visible=Q,Ye.current.mouseLine_w.visible=Q,Ye.current.mouseLine_h.visible=Q),Ze.current&&(Ze.current.coordMesh.visible=Q,Ze.current.mouseLine_w.visible=Q,Ze.current.mouseLine_h.visible=Q),tt.current&&(tt.current.coordMesh.visible=Q,tt.current.mouseLine_w.visible=Q,tt.current.mouseLine_h.visible=Q),rt.current&&(rt.current.coordMesh.visible=Q,rt.current.mouseLine_w.visible=Q,rt.current.mouseLine_h.visible=Q);let wt=new Ie(0,-1,0),an=new Ie(0,1,0),ot=new Ie(Be.current.x,Be.current.y,ke.current.z),Tn=new Ie(1,0,0);ft.current.coordText=vr(wt,ot,Tn,ke.current.x-Be.current.x,12,-6,6,new Ie(0,0,0)),ot.y=ke.current.y,ft.current.coordTextReverse=vr(an,ot,Tn,ke.current.x-Be.current.x,12,-6,6,new Ie(0,0,0)),ot=new Ie(Be.current.x,Be.current.y,Be.current.z),Tn=new Ie(1,0,0),Ye.current.coordText=vr(wt,ot,Tn,ke.current.x-Be.current.x,12,-6,6,new Ie(0,0,0)),ot.y=ke.current.y,Ye.current.coordTextReverse=vr(an,ot,Tn,ke.current.x-Be.current.x,12,-6,6,new Ie(0,0,0)),ot=new Ie(Be.current.x,Be.current.y,ke.current.z),Tn=new Ie(0,0,-1),tt.current.coordText=vr(wt,ot,Tn,ke.current.z-Be.current.z,14,-8,6,new Ie(0,0,0)),ot.y=ke.current.y,tt.current.coordTextReverse=vr(an,ot,Tn,ke.current.z-Be.current.z,14,-8,6,new Ie(0,0,0)),ot=new Ie(ke.current.x,Be.current.y,ke.current.z),Tn=new Ie(0,0,-1),rt.current.coordText=vr(wt,ot,Tn,ke.current.z-Be.current.z,14,-8,6,new Ie(0,0,0)),ot.y=ke.current.y,rt.current.coordTextReverse=vr(an,ot,Tn,ke.current.z-Be.current.z,14,-8,6,new Ie(0,0,0)),ot=new Ie(ke.current.x,Be.current.y,ke.current.z),Tn=new Ie(0,1,0),Ze.current.coordText_lb=vr(wt,ot,Tn,ke.current.y-Be.current.y,10,0,10,new Ie(0,0,0)),ot=new Ie(Be.current.x,Be.current.y,ke.current.z),Tn=new Ie(0,1,0),Ze.current.coordText_lf=vr(wt,ot,Tn,ke.current.y-Be.current.y,10,0,10,new Ie(0,0,0)),ot=new Ie(Be.current.x,Be.current.y,Be.current.z),Tn=new Ie(0,1,0),Ze.current.coordText_rf=vr(wt,ot,Tn,ke.current.y-Be.current.y,10,0,10,new Ie(0,0,0)),ot=new Ie(ke.current.x,Be.current.y,Be.current.z),Tn=new Ie(0,1,0),Ze.current.coordText_rb=vr(wt,ot,Tn,ke.current.y-Be.current.y,10,0,10,new Ie(0,0,0)),Tr()},va=(Yt,wt,an,ot,Tn,pr,Wn,Dr)=>{let hn={mouseLine_w:new Ua,mouseLine_h:new Ua,coordMesh:new yo},ar=new yo,Qn,er,sr,ei,cn,Pn,Ir,ti;Ir=an/Tn,ti=ot/pr;let Wi=new Mf({color:Wn,opacity:.9,transparent:!1}),Yi=new Mf({color:"#9ACD32",opacity:.5}),vi,ri;const co=Me.current.rotation,ta=new Ie(co.x,co.y,co.z).negate(),Vn=new ed(ta.x,ta.y,ta.z),yt=new wi().makeRotationFromEuler(Vn);if(Yt==1){er=wt.y,cn=er,Qn=wt.x-an/2,ei=wt.x+an/2,sr=wt.z-ot/2,Pn=wt.z+ot/2;for(let $e=0;$e<=Tn;$e++){let at=new Qi,ct=[];ct.push(Qn+$e*Ir,er,sr,Qn+$e*Ir,er,Pn);const mt=new Float32Array(ct);at.setAttribute("position",new ms(mt,3));let it=new Ua(at,Wi);ar.add(it)}for(let $e=0;$e<=pr;$e++){let at=new Qi,ct=[];ct.push(Qn,er,sr+$e*ti,ei,er,sr+$e*ti);const mt=new Float32Array(ct);at.setAttribute("position",new ms(mt,3));let it=new Ua(at,Wi);ar.add(it)}let Re=new Qi;Re.setAttribute("position",new ms(new Float32Array([Qn,0,0,ei,0,0]),3)),vi=new Ua(Re,Yi),vi.position.setY(cn),vi.userData.initY=cn;let Je=new Qi;Je.setAttribute("position",new ms(new Float32Array([0,0,sr,0,0,Pn]),3)),ri=new Ua(Je,Yi),ri.position.setY(cn),ri.userData.initY=cn,hn.mouseLine_w=vi,hn.mouseLine_h=ri}else if(Yt==2){sr=wt.z,Pn=sr,Qn=wt.x-an/2,ei=wt.x+an/2,er=wt.y-ot/2,cn=wt.y+ot/2;for(let $e=0;$e<=Tn;$e++){let at=new Qi;at.setAttribute("position",new ms(new Float32Array([Qn+$e*Ir,er,sr,Qn+$e*Ir,cn,sr]),3));let ct=new Ua(at,Wi);ar.add(ct)}for(let $e=0;$e<=pr;$e++){let at=new Qi;at.setAttribute("position",new ms(new Float32Array([Qn,er+$e*ti,sr,ei,er+$e*ti,sr]),3));let ct=new Ua(at,Wi);ar.add(ct)}let Re=new Qi;Re.setAttribute("position",new ms(new Float32Array([Qn,0,0,ei,0,0]),3)),vi=new Ua(Re,Yi),vi.position.setZ(Pn),vi.userData.initZ=Pn;let Je=new Qi;Je.setAttribute("position",new ms(new Float32Array([0,er,0,0,cn,0]),3)),ri=new Ua(Je,Yi),ri.position.setZ(Pn),ri.userData.initZ=Pn,hn.mouseLine_w=vi,hn.mouseLine_h=ri}else if(Yt==3){Qn=wt.x,ei=Qn,sr=wt.z-an/2,Pn=wt.z+an/2,er=wt.y-ot/2,cn=wt.y+ot/2;for(let $e=0;$e<=Tn;$e++){let at=new Qi;at.setAttribute("position",new ms(new Float32Array([Qn,er,sr+$e*Ir,Qn,cn,sr+$e*Ir]),3));let ct=new Ua(at,Wi);ar.add(ct)}for(let $e=0;$e<=pr;$e++){let at=new Qi;at.setAttribute("position",new ms(new Float32Array([Qn,er+$e*ti,sr,Qn,er+$e*ti,Pn]),3));let ct=new Ua(at,Wi);ar.add(ct)}let Re=new Qi;Re.setAttribute("position",new ms(new Float32Array([0,0,sr,0,0,Pn]),3)),vi=new Ua(Re,Yi),vi.position.setX(ei),vi.userData.initX=ei;let Je=new Qi;Je.setAttribute("position",new ms(new Float32Array([0,er,0,0,cn,0]),3)),ri=new Ua(Je,Yi),ri.position.setX(ei),ri.userData.initX=ei,hn.mouseLine_w=vi,hn.mouseLine_h=ri}return ar.rotation.copy(Vn),hn.mouseLine_w.rotation.copy(Vn),hn.mouseLine_h.rotation.copy(Vn),hn.mouseLine_w.position.applyMatrix4(yt),hn.mouseLine_h.position.applyMatrix4(yt),hn.mouseLine_h.updateMatrix(),hn.mouseLine_w.updateMatrix(),hn.coordMesh=ar,hn.coordMesh.name=Dr,hn};function ea(Yt,wt){const an=document.createElement("canvas");an.width=512,an.height=256;const ot=an.getContext("2d"),Tn=new Bh(an);Tn.minFilter=uu;const pr=new Qu({map:Tn,transparent:!0,side:Jd}),Wn=new bE(5,2.5),Dr=new nr(Wn,pr);Dr.position.copy(wt);let hn=!1;const ar=()=>{if(ot.clearRect(0,0,an.width,an.height),ot.fillStyle="#ffffffcc",ot.fillRect(0,0,an.width,an.height),ot.fillStyle="#000000",ot.font="bold 28px Arial",ot.textBaseline="top",hn){const er=Wa(ot,Yt.Text,20,20,an.width-40,28);console.log(er)}else{let er=20;ot.fillText(`年份: ${Yt.Year}`,20,er),er+=40;const sr=Wa(ot,`标题: ${Yt.Title}`,20,er,an.width-2*20,28);console.log(sr),er+=sr+10,ot.fillText(`DIO: ${Yt.DOI}`,20,er)}ot.fillStyle="#888",ot.fillRect(an.width-50,10,40,30),ot.fillStyle="#fff",ot.font="20px Arial",ot.fillText("↺",an.width-38,14),Tn.needsUpdate=!0};return ar(),Dr.userData.onClick=Qn=>{const er=Qn.x*an.width,sr=(1-Qn.y)*an.height;er>=an.width-50&&er<=an.width-10&&sr>=10&&sr<=40&&(hn=!hn,ar())},Dr.name="card",Dr.onBeforeRender=()=>{Dr.up.set(0,-1,0),Dr.rotation.copy(Ti.current.rotation)},Dr}function Wa(Yt,wt,an,ot,Tn,pr){const Wn=wt.split(" ");let Dr="",hn=0;for(let ar=0;ar<Wn.length;ar++){const Qn=Dr+Wn[ar]+" ";Yt.measureText(Qn).width>Tn&&ar>0?(Yt.fillText(Dr,an,ot),Dr=Wn[ar]+" ",ot+=pr,hn++):Dr=Qn}return Yt.fillText(Dr,an,ot),hn++,hn*pr}C.useEffect(()=>{ft.current&&(ft.current.coordMesh.visible=Q,ft.current.mouseLine_w.visible=Q,ft.current.mouseLine_h.visible=Q),dt.current&&(dt.current.coordMesh.visible=Q,dt.current.mouseLine_w.visible=Q,dt.current.mouseLine_h.visible=Q),Ye.current&&(Ye.current.coordMesh.visible=Q,Ye.current.mouseLine_w.visible=Q,Ye.current.mouseLine_h.visible=Q),Ze.current&&(Ze.current.coordMesh.visible=Q,Ze.current.mouseLine_w.visible=Q,Ze.current.mouseLine_h.visible=Q),tt.current&&(tt.current.coordMesh.visible=Q,tt.current.mouseLine_w.visible=Q,tt.current.mouseLine_h.visible=Q),rt.current&&(rt.current.coordMesh.visible=Q,rt.current.mouseLine_w.visible=Q,rt.current.mouseLine_h.visible=Q)},[Q]);const za=()=>{R&&R(!0),N.current==="automatic"?(_(!0),P.current=!0,u&&(u.current=!1)):N.current==="manual"&&(_(!1),P.current=!1,u&&(u.current=!0)),Me.current.remove(rm)},Kr=(Yt,wt)=>{for(let an of Yt){if(an.name===wt&&!an.children)return{color:an.color,path:an.path};if(an.children){const ot=Kr(an.children,wt);if(ot)return ot}}return null},Qr=Yt=>{Nt.current.left&&(Yt.clientX<Number(Nt.current.left.replace("px",""))||Yt.clientY<Number(Nt.current.top.replace("px","")))&&f(!0)},Ra=Yt=>{Yt.preventDefault(),da&&da.length===0||F.current==0?f(!0):(Nt.current={top:`${Yt.clientY-10}px`,left:`${Yt.clientX-10}px`},f(!1))},da=C.useMemo(()=>rr?[{key:"1",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center",color:"#000"},onClick:Yt=>{Dt(ln.current.point);let wt=new URL(window.location.href),an=new URLSearchParams(wt.search);const ot=JSON.stringify(ln.current.point);an.set("datumMarkSelected",ot),wt.search=an.toString(),window.history.replaceState({},"",wt),Rt.current=ln.current.center,He.current.forEach((Tn,pr)=>{Tn.geometry.parameters.radius===.15&&Tn.name!=ln.current.name?(Me.current.remove(Tn),Tn.geometry.dispose(),Tn.geometry=new lu(.07,32,32),Me.current.add(Tn)):Tn.name===ln.current.name&&(Me.current.remove(Tn),Tn.geometry.dispose(),Tn.geometry=new lu(.15,32,32),Me.current.add(Tn))}),f(!0)}},z("5000.5038",{name:ln.current.name})||"切换"+ln.current.name+"为坐标原点")},ln.current.name!="Bregma"&&ln.current.name!="Lambda"?{key:"2",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center",color:"#000"},onClick:Yt=>{const wt=document.createElement("a");wt.href=`${ge}/data/TIFF/${ln.current.name}.tif`,wt.style.display="none",wt.download=`${ln.current.name}.tiff`,wt.click(),f(!0)}},z("5000.5039",{name:ln.current.name})||"下载"+ln.current.name+"周围的原始图像")}:null,{key:"3",label:C.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{const Yt=Me.current.getObjectByName(ln.current.name);if(Yt){const wt=new gs().setFromObject(Yt),an=new Ie;wt.getCenter(an),n.current.target.copy(an),f(!0)}}},z("7000.7019")||"设置为焦点")}]:h,[d,h,se,ie,rr]);return C.useEffect(()=>{o?He.current.forEach(Yt=>{Yt.visible=!0}):He.current.forEach(Yt=>{Yt.visible=!1})},[o]),C.createElement("div",null,C.createElement("div",{style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",zIndex:998,display:"none"}}),C.createElement(tx,{menu:{items:da},trigger:["contextMenu"],open:!d},C.createElement("div",{ref:i,id:"display_neuron",onContextMenu:Yt=>{Ra(Yt)},onMouseEnter:Yt=>{f(!0),B(""),Z(""),W(""),V(""),cr(""),te({}),ae({})},style:{position:"absolute",height:"100%",width:"100%"}})),C.createElement("div",{style:{position:"absolute",bottom:"60px",left:"360px",height:"60px"}},C.createElement("div",{dangerouslySetInnerHTML:{__html:ne||""}}),C.createElement("div",{style:{textAlign:"left"},dangerouslySetInnerHTML:{__html:ee||""}}),C.createElement("div",{style:{textAlign:"left"},dangerouslySetInnerHTML:{__html:de||""}})))};const Cl=C.forwardRef(({className:t,Name:e,t:n,data_change:r,data_c:i,col:a,row:o},s)=>{const[c,u]=C.useState([]),[d,f]=C.useState([]);C.useState(!0);const[h,p]=C.useState(!0),v=(y,g,m)=>{let b={};for(let x in y){for(let S of y[x])S.type=="cell"&&(S.point[0]<570?p(!0):p(!1));if(m.includes("_r")){if(x==g.replace("_",m.split("_r")[0].replace("_",""))){for(let S of y[x])if(S.point[0]>570&&S.name==r.name&&S.type=="end"&&(b.name===x?b.index=(b.index||0)+1:b={name:x,index:1}),S.point[0]>570&&S.name==r.name&&S.type=="cell")return{name:x,index:1,type:"cell"}}}else if(x==g.replace("_",m.replace("_",""))){for(let S of y[x])if(S.point[0]<570&&S.name==r.name&&S.type=="end"&&(b.name===x?b.index=(b.index||0)+1:b={name:x,index:1,type:"end"}),S.point[0]<570&&S.name==r.name&&S.type=="cell")return{name:x,index:1,type:"cell"}}}return Object.keys(b).length>0?b:{}};return C.useEffect(()=>{let y=[];const g=[];for(let S=0;S<o.length;S++)g.push(o[S]);for(let S=o.length-1;S>=0;S--)g.push(o[S]+"_r");const m=g.filter(S=>!S.includes("_r")),b=g.filter(S=>S.includes("_r"));a.forEach(S=>{let w={index:S};g.forEach(_=>{let A=v(i,S,_);Object.keys(A).length>0&&(w[_]=A)}),Object.keys(w).length>1&&y.push(w)});const x=[{title:"",dataIndex:"index",key:"index",align:"center",className:"cell-index",render:S=>S.replace("_","")},{title:"Left hemisphere("+(h?"lpsilateral":"Contralateral")+")",align:"center",className:"cell-left",children:m.map(S=>({title:S.replace("_",""),dataIndex:S,key:S,align:"center",render:w=>w?w.type==="cell"?C.createElement(Ui,{placement:"top",title:w.name},C.createElement("svg",{style:{verticalAlign:"middle"},width:"50",height:"50",viewBox:"0 0 100 100"},C.createElement("path",{d:`\r
|
|
4221
4221
|
M 50,10\r
|
|
4222
4222
|
L 61,35\r
|
|
4223
4223
|
L 88,35\r
|
|
@@ -4467,7 +4467,7 @@ echarts.use([`+B+"]);":"Unknown series "+k))}return}if(f==="tooltip"){if(x){proc
|
|
|
4467
4467
|
}
|
|
4468
4468
|
`,transparent:!1,depthWrite:!1,depthTest:!1}),Lt=new qf(Qe,Bt);Lt.translateX(be),Lt.translateY(it),Lt.translateZ(ce),Lt.myMeshType="neuronSphere",Lt.name=`${Je}-${mt.line[0].start_name}`,Lt.userData.color="#1771FF",Lt.myMeshType="neuronSphere",Lt.name=`${Je}-${mt.line[0].start_name}`,Lt.userData.color="#1771FF",Jn(Lt),Ae.add(Lt),Ae.name=`swcPointGroup${Je}`,dt.current.push(Ae),Me.current.add(Ae);let qt=1;for(let Ct=0;Ct<mt.line.length;Ct++){let Xt=[],Yn=[mt.position[0].x,mt.position[0].y,mt.position[0].z];for(let On=mt.line[Ct].start;On<=mt.line[Ct].end;On++){On===mt.line[Ct].start&&(Yn=[mt.position[On].x,mt.position[On].y,mt.position[On].z]);let Rn=mt.position[On].x,Yr=mt.position[On].y,$r=mt.position[On].z;(Math.sqrt((Rn-Yn[0])*(Rn-Yn[0])+(Yr-Yn[1])*(Yr-Yn[1])+($r-Yn[2])*($r-Yn[2]))>qt||On===mt.line[Ct].end||On===mt.line[Ct].start)&&(Xt.push(new Ie(Rn,Yr,$r)),Yn=[Rn,Yr,$r])}let mr=new Ua(new Qi().setFromPoints(Xt),new Mf({color:$e}));mr.myMeshType="SWC",Ve.add(mr)}Ve.scale.set(sa.current,sa.current,sa.current),Ve.translateX(be),Ve.translateY(it),Ve.translateZ(ce),Ve.name=Je,Ve.myMeshType="SWC",oe.current[Je]=Ve,Me.current.add(oe.current[Je]),at&&at()})},Tr=function(yt){return yt.replace("/","_").replace(" ","_")},Ci=(yt,Re,Je)=>{var at;Je.color=Re;let $e=Me.current.children.find(ct=>ct.name==Je.name);if(s=="vessel")i.current[Je.name]&&$e&&$e.traverse(function(ct){(ct instanceof Ua||ct instanceof nr)&&ct.material.color.set(Je.color)});else if(s=="fbx"){if(Gi.current[Je.name]&&$e){let ct;if(Je.color.includes("rgba")){const Ae=Je.color.lastIndexOf(",");ct=Je.color.slice(Ae+1,-1)}const mt=new oi(Je.color);let it=new URL(window.location.href),be=new URLSearchParams(it.search),ce=be.get("fbxColor"),Ve={};ce&&(Ve=JSON.parse(ce)),Ve[`${Je.name}`]=Je.color,be.set("fbxColor",JSON.stringify(Ve)),it.search=be.toString(),window.history.replaceState({},"",it),$e.traverse(function(Ae){Ae instanceof nr&&(Ae.material.color.set(mt),ct&&(Ae.material.transparent=!0,Ae.material.opacity=ct))})}}else if(s=="soma")Q.current.includes(Je.name)&&$e&&$e.traverse(function(ct){ct instanceof qf&&(ct.material.uniforms.color.value=er(Je.color))});else if(s=="swc"){const ct=new oi(Je.color);let mt;if(Je.color.includes("rgba")){const ce=Je.color.lastIndexOf(",");mt=parseFloat(Je.color.slice(ce+1,-1))}if(oe.current[Je.name]&&$e){let ce=new URL(window.location.href),Ve=new URLSearchParams(ce.search);zt.current[Je.name]=Je.color.replace("#","!"),Ve.set("neuronsColor",encodeURIComponent(JSON.stringify(zt.current))),ce.search=Ve.toString(),window.history.replaceState({},"",ce),$e.traverse(function(Ae){Ae instanceof Ua&&(Ae.material.color.set(ct),mt&&(Ae.material.transparent=!0,Ae.material.opacity=mt,Ae.material.needsUpdate=!0))})}Me.current.traverse(ce=>{ce.myMeshType==="neuronSphere"&&ce.userData.type=="end"&&Je.name===ce.name.split("-")[0]&&(ce.material.uniforms.color.value=ct,ce.userData.color=yt,mt&&(ce.material.uniforms.opacity.value=mt))});let[it,be]=Tn(Ze.current,Je.name);for(let ce in be){let Ve=ce;ce.indexOf("_")>-1&&(Ve=ce.split("_")[0]);let Ae=(at=Ze.current[`${Ve}`])==null?void 0:at.find(Qe=>Qe.name===Je.name);Ae&&(Ae.color=ct)}Me.current.traverse(ce=>{if(ce.name==="lineNameMesh"&&ce.userData.type=="end"&&Je.name===ce.userData.wholeName.split("-")[0]){let Ve=Je.color;ce.material.color.set(Ve),ce.userData.initColor=Ve}})}},ir=C.useCallback((yt,Re,Je,$e,at)=>{yt.stopPropagation();let ct=new URL(window.location.href),mt=new URLSearchParams(ct.search),it=Re,be=KX(it,xe.current),Ve=Xp(it,xe.current).children,Ae=B+"/data/"+ee.current+"/"+Tr(it)+".FBX";for(var Qe=0;Qe<be.length;Qe++){if(ot(be[Qe],!0),Se.includes(be[Qe])){We(Lt=>Lt.filter(qt=>qt!==be[Qe]));const Bt=JSON.stringify(Se.filter(Lt=>Lt!==be[Qe]));mt.set("regionsExpanded",Bt)}Q.current=Q.current.filter(Bt=>Bt!==be[Qe])}if(Se.includes(it)){We(Lt=>Lt.filter(qt=>qt!==it));const Bt=JSON.stringify(Se.filter(Lt=>Lt!==it));mt.set("regionsExpanded",Bt),Q.current.includes(it)||Q.current.push(it),Gi.current[it]?(Me.current.remove(Gi.current[it]),Gi.current[it].children[0].material.color.set($e),Me.current.add(Gi.current[it]),ip.current&&(Me.current.remove(xa.current[it]),xa.current[it].children[0].material.color.set($e),Me.current.add(xa.current[it]))):Ju(Ae,it,$e,.6,parseInt(at));for(var Qe=0;Qe<Ve.length;Qe++)Q.current=Q.current.filter(qt=>qt!==Ve[Qe].name),ot(Ve[Qe].name,!0),lt.current=0,delete ae.current[Ve[Qe].name]}else{const Bt=document.getElementById("spinner"),Lt=JSON.stringify([...Se,it]);mt.set("regionsExpanded",Lt),We(qt=>[...qt,it]),Bt&&(Bt.style.display="block"),Gi.current[it]?(Me.current.remove(Gi.current[it]),Gi.current[it].children[0].material.color.set("#DBDBDB"),Me.current.add(Gi.current[it]),ip.current&&(Me.current.remove(xa.current[it]),xa.current[it].children[0].material.color.set("#DBDBDB"),Me.current.add(xa.current[it]))):Ju(Ae,it,"#DBDBDB",.6,parseInt(at)),Q.current=Q.current.filter(qt=>qt!==it);for(var Qe=0;Qe<Ve.length;Qe++)if(Ve[Qe]["3D"]){let Ct=parseInt(Ve[Qe].z),Xt=Ve[Qe].color,Yn=B+"/data/"+ee.current+"/"+Tr(Ve[Qe].name)+".FBX";Q.current.push(Ve[Qe].name),va(Yn,Ve[Qe].name,Xt,.6,Ct,function(){Bt&&(Bt.style.display="none")})}}m(Q.current);const gt=JSON.stringify(Q.current);mt.set("regionsChecked",gt),ct.search=mt.toString(),window.history.replaceState({},"",ct)},[g,f,Se]),Rr=(yt,Re,Je)=>{if(Re===Q.current[0]&&b)return;const $e=Q.current.indexOf(Re);if($e!==-1){b&&(yt.target.style.color="black"),m(it=>it.filter(be=>be!==Re)),Q.current.splice($e,1);let at=new URL(window.location.href),ct=new URLSearchParams(at.search);const mt=JSON.stringify(Q.current);s==="fbx"?ct.set("regionsChecked",mt):s==="vessel"&&ct.set("vesselsChecked",mt),at.search=ct.toString(),window.history.replaceState({},"",at),ot(Re,!0)}else{b&&(yt.target.style.color="red"),Q.current.push(Re),m([...Q.current]);let at=new URL(window.location.href),ct=new URLSearchParams(at.search);const mt=JSON.stringify(Q.current);s==="fbx"?ct.set("regionsChecked",mt):s==="vessel"&&ct.set("vesselsChecked",mt),at.search=ct.toString(),window.history.replaceState({},"",at);let it=B+"/data/FBX/"+Re+".FBX";Ju(it,Re,Je,.8,0)}if(x){const at=x.current.indexOf(Re);at>-1?x.current.splice(at,1):x.current.push(Re)}},Or=C.useMemo(()=>{var at,ct;let yt=q&&q.split(" ")[0]||"",Re=typeof ie=="string"?ie.split(" ")[0]:"",Je=["MO","MOs","MOp","CP","Isocortex"];if(s=="swc"){let mt=[],it=[];if(w&&Re){let be=((at=w[Re])==null?void 0:at.axon)||[];mt=[...mt,...be]}if(w&&yt){let be=((ct=w[yt])==null?void 0:ct.soma)||[];it=[...it,...be]}if(Re&&yt){let be=new Set(mt),ce=new Set(it);rt.current=[...be].filter(Ve=>ce.has(Ve))}else Re?rt.current=mt:yt&&(rt.current=it)}const $e=mt=>mt&&mt.map((it,be)=>{gB.push(it),it.nameflag?it.key=it.nameflag:it.key=it.name;let ce=it.name;if(localStorage.getItem("lang")=="zh_cn"&&it.cname&&(ce=it.cname),s==="vessel"){const Bt=u1(it.key,n);Bt[Bt.length-1]}if(it.path||(s==="vessel"?it.path=B+"/data/Vessel/":s==="fbx"&&(it.path=B+"/data/FBX/")),qhe){let Bt=JSON.parse(qhe),qt=Object.keys(Bt).find(Ct=>Ct===it.name);qt&&(it.color=Bt[qt])}const Ve=Ye.reduce((Bt,Lt)=>{const[qt,Ct]=Lt.split(":");return Bt[qt]=Ct,Bt},{}),Ae=(Bt,Lt)=>Bt in Ve?Ve[Bt]===Lt[Bt]:!0;let Qe;const gt=ie&&it["3D"]&&ce.toLowerCase().indexOf(ie.toLowerCase())!==-1||b&&Q.current.slice(1).includes(ce)||s=="vessel"&&ie&&ce.toLowerCase().indexOf(ie.toLowerCase())!==-1;if(s==="fbx"||s==="vessel")return Qe=C.createElement("span",{style:{display:"flex",alignItems:"center"},onClick:Bt=>Bt.stopPropagation()},C.createElement(ib,{format:"rgb",defaultValue:it.color,onChange:(Bt,Lt)=>Ci(Bt,Lt,it)}),C.createElement(Ui,{placement:"right",title:it.fullname},C.createElement("div",{onClick:Bt=>Rr(Bt,it.key,it.color),style:gt?{color:"red",whiteSpace:"nowrap"}:{color:"black",whiteSpace:"nowrap"}},ce)),En.includes(it.name)?C.createElement(Ui,{placement:"right",title:p("5000.6041")||"新标注"},C.createElement("svg",{className:"svgleft",width:"20px",height:"20px",viewBox:"0 0 200 200",version:"1.1",style:{marginLeft:"8px"},xmlns:"http://www.w3.org/2000/svg"},C.createElement("g",{id:"#1296dbff"},C.createElement("path",{fill:"#1296db",opacity:"1.00",d:" M 12.39 0.00 L 187.60 0.00 C 193.55 1.76 198.40 6.33 200.00 12.39 L 200.00 197.03 C 197.21 200.36 192.66 199.74 189.30 197.68 C 160.70 182.89 131.92 168.44 103.27 153.76 C 100.74 151.94 97.96 153.23 95.58 154.56 C 79.92 162.65 64.11 170.45 48.45 178.54 C 34.57 185.85 20.35 192.53 6.55 200.00 L 4.06 200.00 C 2.44 198.91 1.07 197.50 0.00 195.87 L 0.00 12.40 C 1.80 6.43 6.41 1.77 12.39 0.00 M 68.04 50.93 C 67.96 68.97 68.00 87.02 68.01 105.06 C 67.45 108.62 71.21 112.26 74.72 110.75 C 77.57 109.92 78.36 106.64 78.30 104.03 C 78.31 90.37 78.34 76.71 78.25 63.05 C 93.63 78.23 108.28 94.13 123.37 109.59 C 124.85 111.28 127.53 111.57 129.39 110.34 C 131.68 109.12 132.04 106.39 132.00 104.06 C 131.96 86.01 132.08 67.96 131.94 49.91 C 132.41 46.10 127.58 43.22 124.42 45.37 C 121.60 46.80 121.73 50.30 121.67 53.00 C 121.74 66.29 121.62 79.57 121.76 92.85 C 107.86 78.88 94.47 64.40 80.64 50.36 C 78.20 48.09 75.99 44.09 72.08 44.90 C 69.30 45.36 67.87 48.32 68.04 50.93 Z"})))):null,F!=null&&F.includes("neurons")&&Je.includes(it.name)&&(k=="task3D"||k=="3Dneurons")?C.createElement(Ui,{placement:"right",title:p("5000.6040")||"投射丰富"},C.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 200 200",style:{marginLeft:"5px"},version:"1.1",xmlns:"http://www.w3.org/2000/svg",onClick:()=>{R==null||R.current.tabChange(7),setTimeout(()=>{P&&P(it.name)},50)}},C.createElement("g",{id:"#1296dbff"},C.createElement("path",{fill:"#1296db",opacity:"1.00",d:" M 161.22 29.23 C 170.61 22.47 184.66 24.19 192.68 32.31 C 197.08 36.53 199.12 42.53 200.00 48.42 L 200.00 51.57 C 199.07 58.41 196.19 65.28 190.43 69.42 C 182.96 75.76 171.77 76.37 163.24 71.84 C 157.18 68.92 153.36 63.05 150.76 57.07 C 143.17 57.08 135.57 56.74 127.99 57.09 C 125.64 57.08 124.07 59.04 122.49 60.48 C 109.60 73.80 96.19 86.60 83.39 100.00 C 96.19 113.40 109.60 126.20 122.49 139.52 C 124.07 140.96 125.64 142.92 127.98 142.91 C 135.58 143.26 143.19 142.92 150.80 142.94 C 152.36 139.60 153.87 136.15 156.39 133.41 C 161.32 127.99 168.67 124.81 176.01 125.13 C 183.62 125.37 191.06 129.33 195.32 135.66 C 200.14 142.64 201.01 152.08 197.83 159.90 C 193.64 169.75 182.73 176.08 172.08 174.81 C 162.13 173.99 153.99 166.24 150.70 157.12 C 141.45 156.77 132.19 157.20 122.94 156.99 C 119.96 157.25 117.95 154.84 116.03 152.98 C 102.37 138.97 88.30 125.36 74.64 111.35 C 72.74 109.58 70.92 107.06 68.05 107.07 C 61.80 106.71 55.54 107.06 49.29 107.12 C 46.34 115.79 38.83 122.99 29.63 124.43 C 19.13 126.37 7.56 120.75 2.99 111.02 C -1.82 101.38 0.34 88.66 8.45 81.45 C 16.25 74.63 28.64 72.73 37.60 78.39 C 43.12 81.56 46.99 86.86 49.37 92.67 C 55.88 92.61 62.41 93.06 68.91 92.61 C 70.92 92.57 72.27 90.88 73.65 89.65 C 87.81 75.15 102.36 61.03 116.53 46.53 C 118.28 44.79 120.23 42.76 122.94 43.01 C 132.21 42.82 141.49 43.18 150.76 42.93 C 153.10 37.64 156.28 32.47 161.22 29.23 Z"})))):null,C.createElement("div",{ref:be==0?u:null,style:{width:20,height:20,marginLeft:8}},it.children&&y&&(k=="task3D"||k=="3Dlabel")?C.createElement(Ui,{placement:"right",title:Se.includes(it.key)?"Assemle":"Expand"},Se.includes(it.key)?C.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 128 128",version:"1.1",xmlns:"http://www.w3.org/2000/svg",onClick:Bt=>ir(Bt,it.key,`${it.key}`,it.color,it.z)},C.createElement("g",{id:"#1296dbff"},C.createElement("path",{fill:"#1296db",opacity:"1.00",d:" M 63.29 5.38 C 64.77 5.01 66.21 5.93 67.59 6.37 C 76.47 10.42 84.89 15.45 93.99 19.03 C 96.79 20.32 100.17 21.53 101.43 24.64 C 103.43 28.57 100.65 33.35 96.69 34.67 C 89.18 37.63 82.15 41.64 74.68 44.70 C 70.42 46.40 65.85 50.45 61.12 47.92 C 51.83 43.67 42.87 38.75 33.64 34.38 C 30.76 33.08 27.65 31.24 27.03 27.85 C 26.96 24.60 28.32 20.85 31.64 19.65 C 42.33 15.22 52.50 9.55 63.29 5.38 Z"}),C.createElement("path",{fill:"#1296db",opacity:"1.00",d:" M 15.39 56.26 C 17.98 55.30 20.40 57.34 22.69 58.29 C 30.72 62.68 39.29 66.09 47.05 70.95 C 50.29 72.73 50.08 76.80 50.06 79.98 C 49.82 91.26 50.26 102.56 49.87 113.83 C 48.69 117.23 44.23 120.17 40.62 118.42 C 31.59 115.01 22.81 110.92 14.00 106.99 C 9.42 104.95 9.09 99.37 8.97 95.04 C 9.05 85.36 8.92 75.67 9.02 66.00 C 8.93 61.81 11.32 57.64 15.39 56.26 Z"}),C.createElement("path",{fill:"#1296db",opacity:"1.00",d:" M 109.45 56.37 C 113.43 54.97 117.33 58.88 118.67 62.35 C 119.44 66.85 118.87 71.46 119.00 76.00 C 118.77 84.93 119.77 94.00 117.79 102.80 C 117.39 105.12 115.10 106.29 113.17 107.17 C 105.54 110.54 97.93 113.93 90.31 117.31 C 88.05 118.18 85.69 119.33 83.20 118.99 C 80.27 117.96 77.59 115.38 77.99 112.02 C 77.99 100.34 77.98 88.66 78.00 76.98 C 77.80 73.81 79.74 70.88 82.64 69.66 C 91.60 65.29 100.43 60.62 109.45 56.37 Z"})),C.createElement("g",{id:"#8da6d9ff"},C.createElement("path",{fill:"#8da6d9",opacity:"1.00",d:" M 10.48 33.45 C 14.12 32.46 17.23 35.20 20.36 36.61 C 22.35 38.00 25.96 38.81 25.77 41.84 C 25.91 43.53 23.62 44.66 22.18 43.98 C 18.23 42.43 14.41 40.41 10.91 38.01 C 9.31 36.99 10.24 34.90 10.48 33.45 Z"}),C.createElement("path",{fill:"#8da6d9",opacity:"1.00",d:" M 113.64 33.62 C 114.86 32.90 116.24 33.28 117.54 33.44 C 117.65 34.89 118.71 37.04 117.12 38.02 C 113.32 40.46 109.32 42.77 105.00 44.17 C 102.38 44.63 101.22 40.71 103.32 39.38 C 106.46 36.98 110.08 35.28 113.64 33.62 Z"}),C.createElement("path",{fill:"#8da6d9",opacity:"1.00",d:" M 32.35 44.38 C 36.95 44.43 40.98 47.92 44.91 50.13 C 47.61 51.34 45.87 56.15 43.02 55.20 C 38.83 53.64 34.78 51.46 31.23 48.74 C 29.51 47.51 30.52 44.85 32.35 44.38 Z"}),C.createElement("path",{fill:"#8da6d9",opacity:"1.00",d:" M 83.15 50.18 C 86.59 47.86 90.26 45.76 94.16 44.30 C 96.46 43.58 97.45 46.12 97.82 47.88 C 94.55 50.84 90.52 52.76 86.56 54.60 C 85.18 55.35 83.62 54.93 82.16 54.82 C 82.08 53.21 81.21 51.03 83.15 50.18 Z"}),C.createElement("path",{fill:"#8da6d9",opacity:"1.00",d:" M 51.49 55.43 C 56.19 54.55 59.78 58.65 64.01 59.97 C 68.18 58.57 71.82 54.46 76.48 55.50 C 76.69 56.83 77.25 58.23 76.74 59.58 C 73.79 61.91 70.21 63.25 67.06 65.27 C 66.80 69.37 67.00 73.50 66.42 77.57 C 64.81 77.78 63.19 77.76 61.59 77.55 C 61.00 73.47 61.20 69.34 60.94 65.24 C 57.78 63.24 54.16 61.96 51.27 59.56 C 50.53 58.23 51.26 56.78 51.49 55.43 Z"}),C.createElement("path",{fill:"#8da6d9",opacity:"1.00",d:" M 61.61 84.44 C 63.20 84.05 64.82 84.09 66.42 84.44 C 67.10 89.77 67.19 95.20 66.42 100.53 C 64.82 101.13 63.15 101.18 61.52 100.63 C 60.93 95.26 60.78 89.80 61.61 84.44 Z"}),C.createElement("path",{fill:"#8da6d9",opacity:"1.00",d:" M 61.65 108.59 C 62.39 106.51 65.30 107.03 66.52 108.37 C 67.25 112.72 67.03 117.20 66.40 121.55 C 64.81 122.00 63.19 122.00 61.60 121.55 C 61.04 117.28 60.56 112.81 61.65 108.59 Z"}))):C.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 128 128",version:"1.1",xmlns:"http://www.w3.org/2000/svg",onClick:Bt=>ir(Bt,it.key,`${it.key}`,it.color,it.z)},C.createElement("g",{id:"#1296dbff"},C.createElement("path",{fill:"#1296db",opacity:"1.00",d:" M 61.53 12.67 C 65.46 11.54 69.30 13.51 72.75 15.18 C 79.87 18.83 87.26 21.90 94.40 25.50 C 98.14 27.43 102.24 28.74 105.61 31.32 C 108.79 33.88 107.69 39.53 104.04 41.12 C 97.03 44.96 89.48 47.73 82.40 51.44 C 77.12 53.83 71.95 56.48 66.60 58.70 C 63.66 60.17 60.60 58.42 57.90 57.25 C 46.68 51.71 35.19 46.70 23.99 41.12 C 19.70 39.29 19.26 32.55 23.58 30.52 C 32.09 25.74 41.21 22.17 49.92 17.78 C 53.73 15.95 57.45 13.86 61.53 12.67 Z"}),C.createElement("path",{fill:"#1296db",opacity:"1.00",d:" M 19.32 48.10 C 22.27 47.30 25.07 49.17 27.71 50.24 C 36.66 54.75 45.89 58.69 54.87 63.12 C 56.99 64.25 59.54 65.55 60.07 68.13 C 60.64 70.71 60.51 73.37 60.53 76.00 C 60.40 86.34 60.51 96.69 60.51 107.03 C 60.44 109.78 60.34 113.19 57.72 114.82 C 54.77 117.03 51.17 114.98 48.27 113.77 C 39.28 109.37 30.16 105.24 21.11 100.97 C 19.03 99.85 16.43 98.92 15.46 96.58 C 14.66 93.80 14.87 90.85 14.82 87.99 C 14.97 77.31 14.77 66.62 14.88 55.94 C 14.74 52.76 16.06 49.18 19.32 48.10 Z"}),C.createElement("path",{fill:"#1296db",opacity:"1.00",d:" M 105.40 48.21 C 108.42 46.98 112.09 49.16 112.66 52.32 C 113.43 56.16 113.11 60.11 113.15 64.00 C 113.03 73.34 113.25 82.69 113.10 92.04 C 113.14 95.16 112.21 98.70 109.04 100.01 C 99.09 104.78 89.00 109.29 79.06 114.12 C 76.54 115.15 73.59 116.72 70.92 115.21 C 67.85 113.76 67.50 110.02 67.50 107.03 C 67.51 95.68 67.56 84.34 67.48 72.99 C 67.64 70.22 67.28 66.64 70.01 64.96 C 74.57 61.94 79.73 60.01 84.64 57.66 C 91.64 54.70 98.21 50.72 105.40 48.21 Z"})))):null)),it.title=Qe,it.key=it.name,it["3D"]==!1&&(it.disabled=!0),b||Se.includes(it.name)?it.disableCheckbox=!0:it.disableCheckbox=!1,it.children&&(it.children=$e(it.children)),it;if(s=="swc"){if(Re||yt)return rt.current&&rt.current.includes(ce)&&Ae("strain",it)&&Ae("age",it)&&Ae("weight",it)&&Ae("gender",it)&&Ae("injected_viruses",it)&&Ae("imaging_system",it)&&Ae("species",it)?(it.title=it.name,it.key=it.name,it.color=it.color?it.color:"#045404",!Fn||it.show?it:null):null}else{const Bt=ie&&ce.toLowerCase().indexOf(ie.toLowerCase())!==-1;return Qe=C.createElement(Ui,{placement:"right",title:it.fullname},C.createElement("span",{style:{display:"flex",alignItems:"center"},onClick:Lt=>Lt.stopPropagation()},it.children&&s=="swc"?null:C.createElement(ib,{disabled:s=="swc",format:"rgb",defaultValue:s=="swc"?"#045404":it.color,onChange:(Lt,qt)=>Ci(Lt,qt,it)}),C.createElement("div",{style:Bt?{color:"red"}:{}},ce))),it.title=Qe,it.key=it.name,it.children&&(it.children=$e(it.children)),it}});return $e(n).filter(Boolean)},[ie,n,q,Se,b,y,A,ye,Ye,w,Fn,k]),tr=new u9;C.useEffect(()=>{tr.load("/staticresource/fonts/helvetiker_bold.typeface.json",yt=>{})},[]);const Fr=(yt,Re)=>{m(mt=>[...mt,yt]),Q.current.push(yt);let Je=new URL(window.location.href),$e=new URLSearchParams(Je.search);const at=JSON.stringify(Q.current);$e.set("neuronsChecked",at),Je.search=$e.toString(),window.history.replaceState({},"",Je);let ct=vi(Or,yt);fetch(ct.path).then(mt=>mt.json()).then(mt=>{nn(mt)}),oe.current[yt]?(Mt({name:yt,color:Re}),Pt(!0)):vr(ct.path,6,yt,ct.color,function(){da(yt,ct.color),Mt({name:yt,color:Re}),Pt(!0)})},Ni=[{title:"Name",dataIndex:"name"},{title:"Color",dataIndex:"Picker",width:50,render:(yt,Re)=>(zt[Re.name]&&(Re.color=zt[Re.name]),C.createElement(ib,{disabled:!Re.show,format:"rgb",defaultValue:Re.color?Re.color:"#045404",onChange:(Je,$e)=>Ci(Je,$e,Re)}))},{title:"Ana.",dataIndex:"Ana",align:"center",render:(yt,Re)=>C.createElement(Ui,{placement:"right",title:p("5000.7008")||"分析"},C.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 200 200",version:"1.1",xmlns:"http://www.w3.org/2000/svg",cursor:"pointer",pointerEvents:Re.show?"auto":"none",onClick:Je=>{Fr(Re.name,Re.color)}},C.createElement("g",{id:"#515151ff"},C.createElement("path",{fill:"#515151",opacity:"1.00",d:" M 93.31 23.38 C 99.84 22.59 106.48 23.11 113.05 23.06 C 116.47 22.96 118.74 26.28 119.64 29.16 C 119.69 72.38 119.68 115.62 119.65 158.85 C 118.76 161.25 117.05 164.47 114.01 164.31 C 107.36 164.33 100.70 164.43 94.05 164.27 C 90.19 163.42 89.10 158.51 89.04 155.07 C 88.96 114.37 88.99 73.66 89.03 32.95 C 88.88 29.39 89.91 25.14 93.31 23.38 Z"}),C.createElement("path",{fill:"#515151",opacity:"1.00",d:" M 154.30 33.38 C 160.49 32.55 166.82 33.20 173.07 33.01 C 177.49 32.53 180.75 36.93 180.68 41.00 C 180.64 79.96 180.71 118.92 180.65 157.87 C 180.10 160.67 178.42 164.46 175.00 164.30 C 168.35 164.35 161.68 164.43 155.03 164.26 C 150.70 163.82 149.84 158.51 149.68 155.00 C 149.66 117.67 149.67 80.35 149.67 43.02 C 149.50 39.30 150.67 35.07 154.30 33.38 Z"}),C.createElement("path",{fill:"#515151",opacity:"1.00",d:" M 31.38 68.42 C 36.43 66.93 41.81 67.98 47.00 67.67 C 50.60 67.83 55.31 66.86 57.74 70.26 C 59.28 71.73 58.83 74.05 59.00 75.97 C 58.96 103.34 59.07 130.71 58.95 158.08 C 59.30 161.45 56.33 164.46 52.99 164.32 C 46.66 164.36 40.33 164.36 34.01 164.32 C 30.72 164.36 27.65 161.48 28.05 158.09 C 27.95 130.37 28.00 102.64 28.03 74.92 C 27.75 72.28 28.89 69.58 31.38 68.42 Z"}),C.createElement("path",{fill:"#515151",opacity:"1.00",d:" M 7.94 174.89 C 8.70 174.83 10.24 174.70 11.01 174.64 C 47.00 174.68 83.00 174.65 119.00 174.66 C 146.00 174.78 173.01 174.42 200.00 174.84 L 200.00 184.15 C 198.66 184.25 197.33 184.31 196.00 184.35 C 134.33 184.34 72.67 184.34 11.01 184.35 C 10.24 184.29 8.70 184.17 7.94 184.11 C 7.49 181.06 7.48 177.94 7.94 174.89 Z"}))))},{title:"Path",dataIndex:"img",align:"center",width:50,render:(yt,Re)=>C.createElement(Ui,{placement:"right",title:p("5000.6003")||"投射路径"},C.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 200 200",version:"1.1",xmlns:"http://www.w3.org/2000/svg",cursor:"pointer",pointerEvents:Re.show?"auto":"none",onClick:Je=>{Wn(Re.name)}},C.createElement("g",{id:"#1296dbff"},C.createElement("path",{fill:_&&Re.name in _.current?"#1296db":"#515151",opacity:"1.00",d:" M 49.85 22.81 C 59.71 14.23 76.52 14.87 85.29 24.74 C 87.48 27.08 88.68 30.09 90.41 32.73 C 91.80 33.49 93.46 33.21 94.98 33.33 C 111.66 33.26 128.35 33.27 145.03 33.31 C 156.32 33.34 168.08 37.82 175.15 46.90 C 184.45 58.34 185.39 75.18 179.31 88.32 C 175.60 95.86 169.21 102.22 161.27 105.20 C 155.18 107.71 148.53 108.28 142.00 108.29 C 112.98 108.27 83.95 108.30 54.93 108.29 C 47.32 108.11 39.18 111.60 35.74 118.72 C 31.96 126.77 32.58 137.41 38.92 144.04 C 43.19 148.73 49.91 149.96 55.98 150.00 C 72.33 150.03 88.68 149.95 105.04 150.04 C 106.56 150.01 108.10 150.00 109.60 149.65 C 111.78 145.95 113.50 141.75 117.13 139.15 C 126.54 131.15 141.94 131.52 150.80 140.19 C 153.70 142.84 155.15 146.56 157.28 149.78 C 164.10 150.58 171.02 149.34 177.82 150.39 C 184.67 152.33 185.10 163.99 178.15 166.09 C 171.31 167.70 164.18 165.87 157.29 167.06 C 155.14 170.31 153.62 174.04 150.68 176.70 C 140.24 186.50 121.13 185.09 112.96 173.05 C 111.06 170.87 110.76 166.29 107.04 166.72 C 93.69 166.66 80.35 166.74 67.00 166.71 C 57.97 166.58 48.53 167.54 39.99 163.97 C 31.40 160.72 23.97 154.20 20.28 145.72 C 13.84 131.17 16.41 112.32 28.35 101.31 C 36.18 93.81 47.48 91.52 58.00 91.71 C 87.34 91.67 116.69 91.78 146.03 91.68 C 153.59 91.69 161.48 87.76 164.60 80.60 C 168.03 72.44 167.24 61.77 160.57 55.44 C 156.20 51.22 149.90 49.98 144.02 50.00 C 128.01 49.96 112.00 50.06 95.99 49.95 C 94.12 49.98 92.23 49.93 90.41 50.34 C 88.22 54.05 86.50 58.25 82.87 60.85 C 73.46 68.85 58.08 68.47 49.22 59.81 C 46.25 57.21 44.85 53.43 42.73 50.21 C 35.91 49.42 28.99 50.67 22.20 49.60 C 15.26 47.64 14.91 36.10 21.94 33.95 C 28.72 32.23 35.86 34.16 42.71 32.94 C 44.97 29.49 46.61 25.52 49.85 22.81 M 63.32 34.12 C 56.99 36.45 57.07 46.16 62.70 49.22 C 65.17 50.16 68.00 50.11 70.52 49.39 C 73.84 47.68 75.46 43.66 74.83 40.07 C 74.41 34.85 67.77 32.10 63.32 34.12 M 130.37 150.45 C 125.27 151.88 123.75 158.64 126.14 162.91 C 128.25 166.43 133.18 167.23 136.81 165.90 C 141.61 164.64 142.31 158.29 140.69 154.36 C 139.16 150.30 134.12 149.42 130.37 150.45 Z"}))))},{title:"Src.",dataIndex:"source",align:"center",width:50,render:(yt,Re)=>{const Je=Re.type;return C.createElement(Ui,{placement:"right",title:p("5000.6038",{name:Je})||'数据来源"'+Je+'"'},C.createElement("a",{href:Re.url,target:"_blank"},C.createElement("img",{src:Re.image,width:"20px",height:"20px"})))}}],Li=yt=>{for(var Re=window.location.search.substring(1),Je=Re.split("&"),$e=0;$e<Je.length;$e++){var at=Je[$e].split("=");if(at[0]==yt)return at[1]}return!1},Di=(yt,Re)=>{let $e=Xp(nh(yt,Re),Re).children;for(var at=[],ct=0;ct<$e.length;ct++)$e[ct]["3D"]&&at.push($e[ct].name);return at},ji=()=>{const yt=Object.keys(ae.current);Object.keys(ae.current).length!==0&&ea(yt,ae.current,.2,0,void 0,!0)};C.useEffect(()=>{ji()},[f]);const va=(yt,Re,Je,$e,at,ct)=>{var mt=new vo;if(mt.setFromAxisAngle(new Ie(1,0,0),Math.PI/2),!Gi.current[Re]){var it=new d9;$e=$e||.1,it.load(yt,function(be){be.scale.set(sa.current,sa.current,sa.current),be.applyQuaternion(mt),at&&be.translateY(at*sa.current*.1),be.children[0].material.transparent=!0,be.children[0].material.opacity=$e,be.children[0].material.depthTest=!1,be.children[0].material.color.set(Je);let ce=be.clone();if(Re!="Brain"){var Ve=new wi,Ae=new Ie(1,0,0);Ve.set(1-2*Ae.x*Ae.x,-2*Ae.x*Ae.y,-2*Ae.x*Ae.z,0,-2*Ae.x*Ae.y,1-2*Ae.y*Ae.y,-2*Ae.y*Ae.z,0,-2*Ae.x*Ae.z,-2*Ae.y*Ae.z,1-2*Ae.z*Ae.z,0,0,0,0,1),ce.applyMatrix4(Ve),ce.translateX(-po.current),ce.translateY(to.current),ce.translateZ(-qa.current),ce.name=Re,ce.myMeshType="FBX",ce.children[0].name=Re,ce.children[0].myMeshType="FBX",xa.current[Re]=ce,ip.current&&Me.current.add(ce)}be.translateX(po.current),be.translateY(to.current),be.translateZ(-qa.current),be.name=Re,be.myMeshType="FBX",be.children[0].name=Re,be.children[0].myMeshType="FBX",Gi.current[Re]=be,Me.current.add(Gi.current[Re]);var Qe=new Ie,gt=new gs().setFromObject(be);gt.getCenter(Qe);var Bt=new Ie;gt.getSize(Bt);var Lt=Bt.x*Bt.y*Bt.z;c1.current[Re]=[Qe,Lt];for(var qt=u1(Re,xe.current),Ct=0;Ct<qt.length;Ct++)if(o!=null&&o.current&&ae.current[qt[Ct]])if(ge.current||he.current){be.translateOnAxis(ae==null?void 0:ae.current[qt[Ct]].axis,o.current*(ae==null?void 0:ae.current[qt[Ct]].length));var Xt=ae==null?void 0:ae.current[qt[Ct]].axis.clone();Xt.x=Xt.x*-1,ce.translateOnAxis(Xt,o.current*(ae==null?void 0:ae.current[qt[Ct]].length))}else{var Xt=ae[qt[Ct]].axis.clone();Xt.x=Xt.x*-1,ce.translateOnAxis(Xt,o.current*(ae==null?void 0:ae.current[qt[Ct]].length)),be.translateOnAxis(ae==null?void 0:ae.current[qt[Ct]].axis,o.current*(ae==null?void 0:ae.current[qt[Ct]].length))}Gi.current[Re]=be;let Yn=Di(Re,xe.current);for(var mr=!0,On=0;On<Yn.length;On++)Yn[On]in Gi.current||(mr=!1);if(mr){for(var Rn=0,On=0;On<Yn.length;On++){var Yr=Yn[On];if(!ge.current)if(he.current){let Jt=new Ie(0,0,5);ae.current[Yr]={axis:c1.current[Yr][0].clone().sub(Jt).applyAxisAngle(new Ie(1,0,0),-1*Math.PI/2).normalize(),length:Math.cbrt(c1.current[Yr][1])}}else ne.current;Rn=Rn+ae.current[Yr].length}if(!(he.current||ge.current))for(On=0;On<Yn.length;On++)ae.current[Yn[On]].length=ae.current[Yn[On]].length/Rn*Yn.length;var $r=setInterval(function(){if(o!=null&&o.current&<.current<(o==null?void 0:o.current)){lt.current=lt.current+.2;let pn;lt.current>(o==null?void 0:o.current)&&(pn=(o==null?void 0:o.current)-lt.current+.2,lt.current=o.current),ea(Yn,ae.current,.2,0,pn)}else lt.current=0,clearInterval($r)},20)}ct&&ct()})}},ea=(yt,Re,Je,$e,at,ct=!1)=>{var mt,it;if(ge.current||he.current)var be=.2;else var be=Je;for(var ce in yt){var Ve=yt[ce];mt=Gi.current[Ve],it=xa.current[Ve];var Ae=Re[Ve].axis,Qe=Ae.clone();Qe.x=Qe.x*-1;var gt=Re[Ve].length;if(ct&&o){Gi.current[yt[ce]].locationLength=o==null?void 0:o.current,Gi.current[yt[ce]].position.set(0,0,0),Gi.current[yt[ce]].translateX(po.current),Gi.current[yt[ce]].translateY(to.current),Gi.current[yt[ce]].translateZ(-qa.current),Gi.current[yt[ce]].translateOnAxis(Ae,(o==null?void 0:o.current)*gt),xa.current[yt[ce]].position.set(0,0,0),xa.current[yt[ce]].translateX(-po.current),xa.current[yt[ce]].translateY(to.current),xa.current[yt[ce]].translateZ(-qa.current),xa.current[yt[ce]].locationLength=o==null?void 0:o.current,xa.current[yt[ce]].translateOnAxis(Qe,(o==null?void 0:o.current)*gt);continue}switch($e){case 0:at?(Gi.current[yt[ce]].translateOnAxis(Ae,at*gt),xa.current[yt[ce]].translateOnAxis(Qe,at*gt)):(Gi.current[yt[ce]].translateOnAxis(Ae,be*gt),xa.current[yt[ce]].translateOnAxis(Qe,be*gt));break;case 1:be<=0?(mt.translateOnAxis(Ae,-1*Math.sqrt(Math.abs(be*gt))),it.translateOnAxis(Qe,-1*Math.sqrt(Math.abs(be*gt)))):(mt.translateOnAxis(Ae,Math.sqrt(be*gt)),it.translateOnAxis(Qe,Math.sqrt(be*gt)));break;case 2:be<=0?(mt.translateOnAxis(Ae,-1*Math.pow(be,2)*gt),it.translateOnAxis(Qe,-1*Math.pow(be,2)*gt)):(mt.translateOnAxis(Ae,Math.pow(be,2)*gt),it.translateOnAxis(Qe,Math.pow(be,2)*gt));break}}},Wa=yt=>{for(let Re=0;Re<yt.length;Re++){const Je=yt[Re],{key:$e,cname:at}=Je;localStorage.getItem("lang")=="zh_cn"&&at?ve.current.push({key:$e,title:at}):ve.current.push({key:$e,title:$e}),Je.children&&Wa(Je.children)}},za=yt=>{const{value:Re}=yt.target;if(Re!=""){De.current=!1,gB=[];const Je=ve.current.map(at=>at.title.toLowerCase().indexOf(Re.toLowerCase())>-1?nh(at.key,n):null).filter((at,ct,mt)=>!!(at&&mt.indexOf(at)===ct));let $e=[];for(let at in Je){let ct=Je[at];if(ct){let mt=u1(ct,n);Re.length===1?(mt.length>2&&(mt=mt.slice(mt.length-3,mt.length)),$e.push(...mt)):$e.push(ct,...mt)}}$e.filter((at,ct,mt)=>!!(at&&mt.indexOf(at)===ct)),j($e),Z(!0),se(Re)}else j(_e.current),se(""),De.current=!0},Kr=(yt,Re)=>(...$e)=>{clearTimeout(Y.current),Y.current=setTimeout(()=>{yt(...$e)},Re)},Qr=Kr(za,50),Ra=yt=>{j(yt),gB=[],Z(!1)},da=(yt,Re)=>{oe.current[yt]&&oe.current[yt].children[0].material.color.set(Re)},Yt=C.useCallback((yt,Re,Je,$e)=>{let at=yt,ct="",mt;if(s!=="swc"){if(at=Re.node.name,ct=Re.node.path,mt=Re.node.color,at===Q.current[0]&&S===2)return;if(x){const gt=x.current.indexOf(at);gt>-1?x.current.splice(gt,1):Q.current.length!==0&&x.current.push(at)}let be=g.findIndex(gt=>gt==at),ce=JSON.parse(JSON.stringify(g));be>-1?ce.splice(be,1):ce.push(at),m(ce),Q.current=ce;let Ve=new URL(window.location.href),Ae=new URLSearchParams(Ve.search);const Qe=JSON.stringify(ce);s==="fbx"?Ae.set("regionsChecked",Qe):s==="vessel"&&Ae.set("vesselsChecked",Qe),Ve.search=Ae.toString(),window.history.replaceState({},"",Ve)}const it=document.getElementById("spinner");switch(s){case"vessel":{at=="Unnamed vein"&&(at="Unnamed_Vein");let be=ct+at+".js";Re.checked?(U0=!0,it&&(it.style.display="block"),Qn(be,8,mt,at,function(){it&&(it.style.display="none")})):(U0=!1,it&&(it.style.display="none"),ar(at));break}case"swc":{if(Je){if($e){let be=Re.map((ce,Ve)=>new Promise((Ae,Qe)=>{if(Re)if(oe.current[ce.name])Ae("");else{if(m(gt=>[...gt,ce.name]),Ve===Re.length-1){let gt=new URL(window.location.href),Bt=new URLSearchParams(gt.search),Lt=Re.map(Xt=>Xt.name);Q.current.push(...Lt);const qt=[...g,...Lt],Ct=JSON.stringify(qt);Bt.set("neuronsChecked",Ct),gt.search=Bt.toString(),window.history.replaceState({},"",gt)}it&&(it.style.display="block"),vr(ce.path,6,ce.name,ce.color,function(){da(ce.name,"#045404"),Ae("")})}else{U0=!1,Dr(ce.name);let gt=new URL(window.location.href),Bt=new URLSearchParams(gt.search);const qt=JSON.stringify([]);Bt.set("neuronsChecked",qt),gt.search=Bt.toString(),window.history.replaceState({},"",gt),Ae("")}}));Promise.all(be).then(()=>{it&&(it.style.display="none")})}else if(!oe.current[yt.name]){Q.current.push(yt.name),it&&(it.style.display="block"),m(Ae=>[...Ae,yt.name]);let be=new URL(window.location.href),ce=new URLSearchParams(be.search);const Ve=JSON.stringify(Q.current);ce.set("neuronsChecked",Ve),be.search=ce.toString(),window.history.replaceState({},"",be),vr(yt.path,6,yt.name,yt.color,function(){da(yt.name,"#045404"),it&&(it.style.display="none"),setTimeout(()=>{V&&V("欢迎来和我一起探索更多<strong>"+yt.name+"</strong>脑区相关内容")},5e3)})}}else if($e)Re.forEach((be,ce)=>{if(Re){if(m(Ve=>Ve.filter(Ae=>Ae!==be.name)),Q.current=Q.current.filter(Ve=>Ve!==be.name),Dr(be.name),ce===Re.length-1){let Ve=new URL(window.location.href),Ae=new URLSearchParams(Ve.search);const Qe=JSON.stringify(Q.current);Ae.set("neuronsChecked",Qe),Ve.search=Ae.toString(),window.history.replaceState({},"",Ve)}if(_&&be.name in _.current){de(Ve=>Ve.filter(Ae=>Ae!==be.name));for(let Ve in _.current[be.name])Me.current.remove(_.current[be.name][Ve]);delete _.current[be.name]}}});else{if(_&&yt.name in _.current){de(Ae=>Ae.filter(Qe=>Qe!==yt.name));for(let Ae in _.current[yt.name])Me.current.remove(_.current[yt.name][Ae]);delete _.current[yt.name]}Dr(yt.name),Q.current=Q.current.filter(Ae=>Ae!==yt.name),m(Ae=>Ae.filter(Qe=>Qe!==yt.name));let be=new URL(window.location.href),ce=new URLSearchParams(be.search);const Ve=JSON.stringify(Q.current);ce.set("neuronsChecked",Ve),be.search=ce.toString(),window.history.replaceState({},"",be)}break}case"soma":{ZX(at,Or).forEach(ce=>{Re.checked?(U0=!0,oe.current[at]||(h!=null&&h.current?sr(ct,ce.color,at):sr(B+"/data/json/"+at,ce.color,at))):(U0=!1,Dr(at))});break}case"fbx":{let be=parseInt(Re.node.z),ce=B+"/data/FBX/"+Tr(at)+".FBX";Re.checked?(it&&(it.style.display="block"),Ju(ce,at,mt,.8,be,"FBX",function(){it&&(it.style.display="none"),setTimeout(()=>{V&&V("欢迎来和我一起探索更多 <strong>"+at+"</strong> 脑区相关内容")},5e3)})):ot(at)}}},[g]),wt=()=>{if(xe.current.length>0&&s!=="swc"&&g.length>0&&(s==="fbx"||s==="vessel"))return new Promise((yt,Re)=>{const Je=document.getElementById("spinner");let $e=0;for(let at=0;at<g.length;at++){let ct=Xp(g[at],xe.current);if(ct){let mt={node:{...ct,checked:!0}};if(s==="fbx"){let it=B+"/data/FBX/"+Tr(ct.key)+".FBX";Ju(it,ct.key,ct.color,.8,ct.z,"FBX",function(){Je&&Gn.current===!0&&(Je.style.display="none"),$e+=1,$e===g.length&&yt("")})}else if(s==="vessel"){let it=ct.name,be=mt.node.path;it=="Unnamed vein"&&(it="Unnamed_Vein");let ce=be+it+".js";U0=!0,Je&&(Je.style.display="block"),Qn(ce,8,ct.color,it,function(){Je&&Gn.current===!0&&(Je.style.display="none"),$e+=1,$e===g.length&&yt("")})}}}}).then(yt=>{if(jhe){let Re=JSON.parse(jhe);for(let Je=0;Je<Re.length;Je++){let $e=Xp(Re[Je],xe.current);$e&&ir({stopPropagation:()=>{}},$e.key,`${$e.key}`,$e.color,$e.z)}}})},an=()=>{if(mB&&JSON.parse(mB).length!=0){Gn.current=!1;const yt=document.getElementById("spinner"),Re=JSON.parse(mB);let Je=0;yt&&(yt.style.display="block");for(let $e=0;$e<Re.length;$e++){$e!==Re.length-1&&yt&&(yt.style.display="block");let at=n.find(ct=>ct.name===Re[$e]);at&&(zt.current[Re[$e]]?at.color=zt.current[Re[$e]].replace("!","#"):at.color="#045404",vr(at.path,6,at.name,at.color,function(){if(da(at.name,at.color),Whe){const ct=JSON.parse(Whe);for(let mt=0;mt<ct.length;mt++)at.name==ct[mt]&&Wn(at.name)}Je++,Je===Re.length&&yt&&(yt.style.display="none",Gn.current=!0)}))}}};C.useEffect(()=>{!en.current&&n&&n.length>0&&(an(),wt(),en.current=!0)},[n]);const ot=(yt,Re=!1)=>{Gi.current[yt]&&(Me.current.remove(Gi.current[yt]),Gi.current[yt].children[0].geometry.dispose(),Re&&delete Gi.current[yt]),xa.current[yt]&&(Me.current.remove(xa.current[yt]),xa.current[yt].children[0].geometry.dispose(),Re&&delete xa.current[yt]),ae.current[yt]&&Re&&delete ae.current[yt]},Tn=(yt,Re)=>{const Je={},$e={};for(const at in yt){const ct=yt[at];for(const mt of ct)if(mt.name==Re){if(mt.color==="#1771FF"){Je[at]={point:mt.point,color:mt.color,type:mt.type};break}if(mt.color==="#A7B5A1"){Je[at]={point:mt.point,color:mt.color,type:mt.type};break}Je[at]={point:mt.point,color:mt.color,type:mt.type}}}for(const at in yt){const ct=yt[at];for(const mt of ct)if(mt.name==Re){if(mt.type=="cell"){$e[at]={point:mt.point,color:mt.color,type:mt.type};break}mt.type==="end"&&(mt.point[0]<570?$e[at]={point:mt.point,color:mt.color,type:mt.type}:$e[at+"_111"]={point:mt.point,color:mt.color,type:mt.type}),!$e[at]&&!$e[at+"_111"]&&mt.point[0]<570&&($e[at]={point:mt.point,color:mt.color,type:mt.type})}}return[Je,$e]},pr=(yt,Re)=>{if(Object.keys(yt).length>0){const Je=Ti.current.position;let $e=Me.current.getObjectByName("DR-anterior"),at=0;$e&&(at=Je.distanceTo($e.position));for(let ct in yt){let{point:mt,color:it,type:be}=yt[ct];xPt.load(B+"/fonts/helvetiker_bold.typeface.json",function(ce){const Ve=new WX(ct.replace("_111",""),{font:ce,size:.3,height:.01}),Ae=new kl({color:it,specular:0,shininess:0}),Qe=new nr(Ve,Ae),gt=at<6?.2:at<9?.3:.5;Qe.scale.set(gt,gt,gt),Qe.position.set(mt[0]*.01,mt[1]*.01,mt[2]*.01),Qe.name="lineNameMesh",Qe.userData.name=ct.replace("_111",""),Qe.userData.wholeName=`${Re}-${ct.replace("_111","")}`,Qe.userData.initColor=it,Qe.userData.type=be,Qe.translateY(qa.current),Qe.translateZ(to.current),Qe.translateX(po.current),Ve.center(),_!=null&&_.current&&_.current[Re].push(Qe),Me.current.add(Qe)})}}else setTimeout(()=>{const[Je,$e]=Tn(Ze.current,Re);pr($e,Re)},100)},Wn=(yt,Re,Je)=>{let $e=new URL(window.location.href),at=new URLSearchParams($e.search),ct,mt;if(Je?[ct,mt]=Tn(Je,yt):[ct,mt]=Tn(Ze.current,yt),_!=null&&_.current){const it=document.getElementById("spinner");if(yt in _.current){for(let ce in _.current[yt])de(Ve=>Ve.filter(Ae=>Ae!==yt)),Me.current.remove(_.current[yt][ce]);const be=ye.filter(ce=>ce!==yt);at.set("neuronsText",JSON.stringify(be)),delete _.current[yt]}else{if(_.current[yt]=[],de(be=>[...be,yt]),at.set("neuronsText",JSON.stringify([...ye,yt])),!(yt in oe.current)){m(Ve=>[...Ve,yt]),Q.current=[...Q.current,yt];const be=JSON.stringify(Q.current);at.set("neuronsChecked",be);let ce=vi(Or,yt);if(it&&(it.style.display="block"),!oe.current[yt]){let Ve=ce.color;ce.path&&Ve&&vr(ce.path,6,yt,Ve,function(){Ve&&da(yt,Ve),it&&(it.style.display="none")})}}pr(mt,yt)}$e.search=at.toString(),window.history.replaceState({},"",$e)}},Dr=yt=>{oe.current[yt]&&(Me.current.remove(oe.current[yt]),oe.current[yt]=null,delete oe.current[yt]);const Re=Me.current.getObjectByName(`swcPointGroup${yt}`);Re&&Me.current.remove(Re)},hn=yt=>yt.map(Re=>({value:Re.name+" "+Re.fullname,title:C.createElement(Ui,{placement:"right",title:Re.fullname},C.createElement("div",{style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",lineHeight:"2.4"}},Re.name," ",Re.fullname)),children:Re.children?hn(Re.children):void 0})),ar=yt=>{Me.current.remove(rm),Me.current.remove(su),i.current[yt]&&(Me.current.remove(i.current[yt].contentobj),i.current[yt].contentobj.traverse(function(Re){Re.type=="Mesh"&&(Re.geometry.dispose(),Re.geometry=null)}),i.current[yt].contentmaterial.dispose(),i.current[yt].contentmaterial=null,i.current[yt]=null,delete i.current[yt])},Qn=(yt,Re,Je,$e,at)=>{i.current[$e]?(Me.current.add(i.current[$e].obj),at&&at()):fetch(yt).then(ct=>ct.json()).then(ct=>{var mt=new Du,it=new l9({color:Je}),be=!1;ct.line.length>1e4&&(be=!0);let ce=1;for(let Ae=0;Ae<ct.line.length;Ae++)ct.line[Ae].layer>ce&&(ce=ct.line[Ae].layer);ce++;for(let Ae=0;Ae<ct.line.length;Ae++){let Qe=(ce-ct.line[Ae].layer)*20/ce,gt=0,Bt=[];for(let On=ct.line[Ae].start;On<=ct.line[Ae].end;On++){let Rn=ct.position[On].x,Yr=ct.position[On].y,$r=ct.position[On].z;gt++,Bt.push(new Ie(Rn,Yr,$r))}let Lt=new BX(Bt);gt=be?Math.ceil(gt/5):gt;const qt=new $T,Ct=new nr(new s9(Lt,gt,Qe,Re,!1),it);Ct.scale.set(1,1,1),qt.addLevel(Ct,0);const Xt=80,Yn=[Bt[0]];for(let On=1;On<Bt.length;On++){const Rn=Yn[Yn.length-1],Yr=Bt[On];(Rn.distanceTo(Yr)>Xt||On===Bt.length-1)&&Yn.push(Yr)}const mr=new Ua(new Qi().setFromPoints(Yn),new Mf({color:Je}));mr.scale.set(1,1,1),qt.addLevel(mr,10),qt.name=$e,qt.myMeshType="Vessel",qt.autoUpdate=!1,mt.add(qt)}mt.scale.set(sa.current*.1,sa.current*.1,sa.current*.1),mt.translateX(po.current),mt.translateY(qa.current),mt.translateZ(to.current),mt.name=$e,mt.myMeshType="Vessel",Me.current.add(mt);let Ve={contentobj:mt,contentmaterial:it};i.current[$e]=Ve,at&&at()})},er=yt=>{yt=yt.replace("#","");const Re=parseInt(yt.slice(0,2),16),Je=parseInt(yt.slice(2,4),16),$e=parseInt(yt.slice(4,6),16),at=Re/255,ct=Je/255,mt=$e/255;return new Ie(at,ct,mt)},sr=(yt,Re,Je,$e)=>{fetch(yt).then(at=>at.json()).then(at=>{let ct=new qf,mt=new Qi,it=[];for(let ce=0;ce<at.position.length;ce++){let Ve=at.position[ce].split(","),Ae=Ve[0],Qe=Ve[1],gt=Ve[2];it.push(Ae*sa.current*.099,Qe*sa.current*.099,gt*sa.current*.099)}mt.setAttribute("position",new Da(it,3)),er(Re);let be=new i9({size:pe.current/100,color:new oi(Re)});ct=new qf(mt,be),ct.translateX(po.current),ct.translateY(qa.current),ct.translateZ(to.current-.45),ct.name=Je,oe.current[Je]=ct,Me.current.add(ct)}),$e&&$e()},ei=yt=>{ut.current=!0;let Re=new URL(window.location.href),Je=new URLSearchParams(Re.search);Je.set("neuronsProjects",JSON.stringify(yt)),Re.search=Je.toString(),window.history.replaceState({},"",Re),yt!=""?se(yt):(se(yt),j(_e.current))},cn=Kr(ei,50),Pn=yt=>{ut.current=!0;let Re=new URL(window.location.href),Je=new URLSearchParams(Re.search);Je.set("neuronsSomaLocates",JSON.stringify(yt)),Re.search=Je.toString(),window.history.replaceState({},"",Re),yt!=""?te(yt):(te(yt),j(_e.current))},Ir=Kr(Pn,50),ti=()=>{let yt=[Gi.current,xa.current,ae.current];for(let at of yt)for(let ct in at)ct!="Brain"&&ot(ct,!0);de([]),Object.keys(oe.current).forEach(at=>{for(let ct in _==null?void 0:_.current[at])Me.current.remove(_==null?void 0:_.current[at][ct]);Dr(at)}),Object.keys(i.current).forEach(at=>{ar(at)}),m([]),_&&(_.current={}),Q.current=[];let Re=new URL(window.location.href),Je=new URLSearchParams(Re.search);const $e=JSON.stringify(Q.current);s==="fbx"?Je.set("regionsChecked",$e):s==="vessel"?Je.set("vesselsChecked",$e):s==="swc"&&(Je.set("neuronsChecked",$e),Je.set("neuronsText",$e)),Re.search=Je.toString(),window.history.replaceState({},"",Re)},Wi=(yt,Re)=>{let Je=0;for(const $e of yt.toLowerCase())if($e===Re[Je]&&(Je++,Je===Re.length))return!0;return!1},Yi=yt=>{if(yt){const Re=yt.toLowerCase(),Je=Pe.current.map($e=>{const at=$e.name&&$e.name.toLowerCase()===Re,ct=$e.fullname&&Wi($e.fullname,Re);return{...$e,matchPriority:at?1:ct?2:3}}).filter($e=>$e.matchPriority<3).sort(($e,at)=>$e.matchPriority-at.matchPriority).map($e=>({value:`${$e.name} ${$e.fullname}`,label:`${$e.name} ${$e.fullname}`}));Le(Je)}else Le([])};C.useEffect(()=>{ut.current&&(q?Be.current&&Be.current.focus():ke.current&&ke.current.focus())},[q]),C.useEffect(()=>{ut.current&&(ie?vt.current&&vt.current.focus():pt.current&&pt.current.focus())},[ie]);const vi=(yt,Re)=>{let Je=null,$e=null;for(let at=0;at<yt.length;at++)if(yt[at].name==Re)return Je=yt[at].path,$e=yt[at].color,{path:Je,color:$e};return{path:Je,color:$e}},ri={emptyText:C.createElement(cm,{description:C.createElement("div",{style:{color:"#ccc"}},"Neurons that meet the filter criteria entered in the input boxes above will be displayed here.")})},co={selectedRowKeys:g,onSelectAll:(yt,Re,Je)=>{Yt(Re,Je,yt,!0)},onSelect:(yt,Re,Je)=>{Yt(yt,Je,Re,!1)},getCheckboxProps:yt=>({name:yt.name})},ta=yt=>{let Re=new URL(window.location.href),Je=new URLSearchParams(Re.search);const $e=JSON.stringify(yt);Je.set("neuronsFilterInfo",$e),Re.search=Je.toString(),window.history.replaceState({},"",Re),ft(yt)},Vn=yt=>{Tt(yt)};return C.createElement("div",{ref:c,style:{transition:"all ease-in 0.5s"}},s==="swc"?C.createElement(C.Fragment,null,q?C.createElement(R4,{ref:Be,style:{width:"100%",marginBottom:8},options:ue,placeholder:p("5000.5040")||"Input the region that soma locates",onSearch:Yi,onChange:Ir,value:q}):C.createElement(ob,{ref:ke,showSearch:!0,style:{width:"100%",marginBottom:8},value:q,dropdownStyle:{maxHeight:400,overflow:"hidden"},placeholder:p("5000.5040")||"Input the region that soma locates",allowClear:!0,treeDefaultExpandAll:!1,onChange:Pn,onSearch:Pn,treeData:hn(r)}),ie?C.createElement(R4,{ref:vt,style:{width:"100%",marginBottom:8},options:ue,placeholder:p("5000.5041")||"Input the region that neuron projects",onSearch:Yi,onChange:cn,value:ie}):C.createElement(ob,{showSearch:!0,ref:pt,style:{width:"100%"},value:ie,dropdownStyle:{maxHeight:400,overflow:"hidden",marginBottom:8},placeholder:p("5000.5041")||"Input the region that neuron projects",allowClear:!0,treeDefaultExpandAll:!1,onChange:ei,onSearch:ei,treeData:hn(r)}),H&&C.createElement(C.Fragment,null,C.createElement(ob,{treeData:He,value:Ye,onChange:ta,treeCheckable:!0,placeholder:"Filter by data information",style:{width:"100%",marginTop:8}}),C.createElement($o,{style:{marginTop:"5px"}},C.createElement(E1,{onChange:yt=>{An(yt.target.checked)}},p("7000.7025")||"只展示可用神经元"),C.createElement($o,{style:{fontStyle:"italic",marginTop:"5px"}},p("7000.7026")||"点击Color按钮,修改神经元颜色;点击Ana.按钮,显示神经元投射路径分析结果;点击Path按钮,在主界面显示神经元经过的脑结构;Src按钮展示了神经元数据的来源"))),C.createElement("div",null,C.createElement(cs,{className:"Echart",open:tt,onOk:()=>{Pt(!1)},onCancel:()=>{Pt(!1)},width:"auto",footer:null},C.createElement(Om,{activeKey:Xe,onChange:Vn},C.createElement(vB,{tab:p("5000.7009")||"神经元末梢分布",key:"1"},Wt&&C.createElement(Ri,null,"Isocortex"),C.createElement(Cl,{ref:Nt,className:"Isocortex",Name:"Isocortex",t:p,data_change:Dt,data_c:Ze.current,col:["RSPv_","FRP_","MOp_","MOs_","SSp_","SSp-n_","SSp-bfd_","SSp-ll_","SSp-m_","SSp-ul_","SSp-tr_","SSp-un_","SSs_","GU_","VISC_","AUDd_","AUDp_","AUDpo_","AUDv_","VISal_","VISam_","VISl_","VISp_","VISpl_","VISpm_","VISli_","VISpor_","ACAd_","ACAv_","PL_","ILA_","ORB_","AId_","AIp_","AIv_","RSPagl_","RSPd_","PTLp_","TEa_","PERI_","ECT_"],row:["1","2/3","5","6a","6b"]}),Rt&&C.createElement(Ri,null,"HPF"),C.createElement(Cl,{ref:xr[0],className:"HPF",Name:"HPF",t:p,data_change:Dt,data_c:Ze.current,col:["CA1_","CA1_dd","CA1_d","CA1_i","CA1_v","CA1_vv","CA2_dd","CA2_d","CA2_i","CA2_v","CA2_vv","CA3_dd","CA3_d","CA3_i","CA3_v","CA3_vv"],row:["so","sp","slu","sr","slm"]}),C.createElement(Cl,{ref:xr[1],className:"HPF",Name:"HPF",t:p,data_change:Dt,data_c:Ze.current,col:["DG_d","DG_i","DG_V"],row:["mo","sg","po"]}),C.createElement(Cl,{ref:xr[2],className:"HPF",Name:"HPF",t:p,data_change:Dt,data_c:Ze.current,col:["SUBd_1","SUBv_1","SUBd_2","SUBv_2","SUBd_3","SUBv_3","SUBd_4","SUBv_4","SUBd_","SUBv_"],row:["sp","sr","m"]}),ln&&C.createElement(Ri,null,"CNU"),C.createElement(Cl,{ref:wr,className:"CNU",Name:"CNU",t:p,data_change:Dt,data_c:Ze.current,col:["CP_","ACBv_","ACBd_","FS_","OTisl_","OTislm_","OT1","OT2","OT3","LSc","LSr_","SF","SH","AAA","BA","CEAc","CEAm","IA","MEAad","MEAav","MEApd","MEApv","GPe","GPi","SI","MA","NDB","TRS","PALc","BSTse","BAC"],row:["_"]}),cr&&C.createElement(Ri,null,"OLF"),C.createElement(Cl,{ref:Zn[0],className:"OLF",Name:"OLF",t:p,data_change:Dt,data_c:Ze.current,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["gr","mi","ipl","opl","gl"]}),C.createElement(Cl,{ref:Zn[1],className:"OLF",Name:"OLF",t:p,data_change:Dt,data_c:Ze.current,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["1","2","3","4","5","6a","2/3"]}),hr&&C.createElement(Ri,null,"TH"),C.createElement(Cl,{ref:Ut,className:"TH",Name:"TH",t:p,data_change:Dt,data_c:Ze.current,col:["VAL","VM","VPL","VPLpc","VPM","VPMpc","PoT","SPFm","SPFp","SPA","PP","MGd","MGv","MGm","LGdsh","LGdco","LGdip","LP","PO","POL","SGN","Eth","REth","AV","AMd","AMv","AD","IAM","IAD","LD","IMD","MDc","MDl","MDm","SMT","PR","PVT","PT","RE","Xi","RH","CM","PCN","CL","PF","PIL","RT","IGL","IntG","LGvl","LGvm","SubG","MH","LH","PIN"],row:["_"]}),jt&&C.createElement(Ri,null,"HY"),C.createElement(Cl,{ref:Ft,className:"HY",Name:"HY",t:p,data_change:Dt,data_c:Ze.current,col:["SO","NC","PVHam","PVHmm","PVHpmm","PVHpml","PVHap","PVHmpd","PVHpv","PVa","PVi","ARH","ADP","AHA","AVP","DMHa","DMHp","DMHv","MEPO","MPO","OV","PD","PS","PSCH","PVp","PVpo","SBPV","SCH","SFO","VMPO","VLPO","AVPV","AHNa","AHNc","AHNd","AHNp","LM","MMme","MMl","MMm","MMp","MMd","SUMm","SUMl","TMd","TMv","MPNc","MPNl","MPNm","PMd","PMv","PVHdp","PVHf","PVHlp","PVHmpv","VMHa","VMHc","VMHdm","VMHvl","PH","LHA","LPO","PST","PSTN","RCH","PeF","STN","TU","A13","FF","ZIr","ZIc","ZId","ZIv","ME"],row:["_"]}),Un&&C.createElement(Ri,null,"MB"),C.createElement(Cl,{ref:$t,className:"MB",Name:"MB",t:p,data_change:Dt,data_c:Ze.current,col:["SCop","SCsg","SCzo","ICc","ICd","ICe","NB","SAG","PBG","MEV","SCO","SNr","VTA","RR","MRNm","MRNmg","MRNp","SCdg","SCdw","SCiw","SCig-a","SCig-b","SCig-c","PRC","INC","ND","Su3","PAGdm","PAGl","PAGvl","PAGdl","PAGvm","APN","MPT","NOT","NPC","OP","PPT","RPF","InCo","CUN","RN","III","MA3","EW","IV","PA4","VTN","AT","LT","DT","MT","SNl","SNc","PPN","IF","IPR","IPC","IPA","IPL","IPI","IPDM","IPDL","IPRL","RL","CLI","DR"],row:["_"]}),gn&&C.createElement(Ri,null,"HB"),C.createElement(Cl,{ref:Vt,className:"HB",Name:"HB",t:p,data_change:Dt,data_c:Ze.current,col:["NLLd","NLLh","NLLv","PSV","KF","PBlc","PBld","PBle","PBls","PBlv","PBme","PBmm","PBmv","POR","SOCm","SOCl","B","DTN","LTN","PDTg","PCG","PG","PRNc","PRNv","SG","SSN","SUT","TRN","V","P5","Acs5","PC5","I5","CSl","CSm","LC","LDT","NI","PRNr","RPO","SLC","SLD","AP","CNlam","CNspg","DCO","VCO","CU","GR","ECU","NTB","NTSce","NTSco","NTSge","NTSl","NTSm","SPVC","SPVI","SPVOcdm","SPVOmdmd","SPVOmdmv","SPVOrdm","SPVOvl","Pa5","z","VI","ACVI","VII","ACVII","EV","AMBd","AMBv","DMX","ECO","GRN","ICB","IO","LRNm","LRNp","ISN","LIN","IRN","MARN","MDRNd","MDRNv","PARN","PAS","PGRNd","PGRNl","NIS","NR","PRP","PMR","PPYd","PPYs","LAV","MV","SPIV","SUV","XII","x","y","RM","RPA","RO"],row:["_"]}),Cn&&C.createElement(Ri,null,"CB"),C.createElement(Cl,{ref:rn[0],className:"CB",Name:"CB",t:p,data_change:Dt,data_c:Ze.current,col:["LING_","LING_","CENT2_","CENT2_","CENT3_","CENT3_","CUL4/5_","CUL4/5_","DEC_","DEC_","FOTU_","FOTU_","PYR_","PYR_","UVU_","UVU_","NOD_","NOD_","SIM_","SIM_","ANcr1_","ANcr1_","ANcr2_","ANcr2_","PRM_","PRM_","COPY_","COPY_","PFL_","PFL_","FL_","FL_","IP","DN"],row:["gr","mo"]}),C.createElement(Cl,{ref:rn[1],className:"CB",Name:"CB",t:p,data_change:Dt,data_c:Ze.current,col:["FN","IP","DN","VeCB"],row:["_"]})),C.createElement(vB,{tab:p("5000.7011")||"神经元投射模式",key:"2"},r?C.createElement(CAe,{data:At,fbxTreeDatas:r}):null),C.createElement(vB,{tab:p("5000.7012")||"投射长度分布",key:"3"},Wt&&C.createElement(Ri,null,"Isocortex"),C.createElement(Sl,{t:p,data_change:Dt,data_c:At,col:["RSPv_","FRP_","MOp_","MOs_","SSp_","SSp-n_","SSp-bfd_","SSp-ll_","SSp-m_","SSp-ul_","SSp-tr_","SSp-un_","SSs_","GU_","VISC_","AUDd_","AUDp_","AUDpo_","AUDv_","VISal_","VISam_","VISl_","VISp_","VISpl_","VISpm_","VISli_","VISpor_","ACAd_","ACAv_","PL_","ILA_","ORB_","AId_","AIp_","AIv_","RSPagl_","RSPd_","PTLp_","TEa_","PERI_","ECT_"],row:["1","2/3","5","6a","6b"]}),Rt&&C.createElement(Ri,null,"HPF"),C.createElement(Sl,{t:p,data_change:Dt,data_c:At,col:["CA1_d","CA1_i","CA1_v","CA1_","CA3_dd","CA3_d","CA3_i","CA3_v","CA3_vv","CA2_"],row:["so","sp","slu","sr","slm"]}),C.createElement(Sl,{t:p,data_change:Dt,data_c:At,col:["DG_d","DG_i","DG_V"],row:["mo","sg","po"]}),C.createElement(Sl,{t:p,data_change:Dt,data_c:At,col:["SUBd_1","SUBv_1","SUBd_2","SUBv_2","SUBd_3","SUBv_3","SUBd_4","SUBv_4","SUBd_","SUBv_"],row:["sp","sr","m"]}),ln&&C.createElement(Ri,null,"CNU"),C.createElement(Sl,{t:p,data_change:Dt,data_c:At,col:["CP_","ACBv_","ACBd_","FS_","OTisl_","OTislm_","OT1","OT2","OT3","LSc","LSr_","SF","SH","AAA","BA","CEAc","CEAm","IA","MEAad","MEAav","MEApd","MEApv","GPe","GPi","SI","MA","NDB","TRS","PALc","BSTse","BAC"],row:["_"]}),cr&&C.createElement(Ri,null,"OLF"),C.createElement(Sl,{t:p,data_change:Dt,data_c:At,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["gr","mi","ipl","opl","gl"]}),C.createElement(Sl,{t:p,data_change:Dt,data_c:At,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["1","2","3","4","5","6a","2/3"]}),hr&&C.createElement(Ri,null,"TH"),C.createElement(Sl,{t:p,data_change:Dt,data_c:At,col:["VAL","VM","VPL","VPLpc","VPM","VPMpc","PoT","SPFm","SPFp","SPA","PP","MGd","MGv","MGm","LGdsh","LGdco","LGdip","LP","PO","POL","SGN","Eth","REth","AV","AMd","AMv","AD","IAM","IAD","LD","IMD","MDc","MDl","MDm","SMT","PR","PVT","PT","RE","Xi","RH","CM","PCN","CL","PF","PIL","RT","IGL","IntG","LGvl","LGvm","SubG","MH","LH","PIN"],row:["_"]}),jt&&C.createElement(Ri,null,"HY"),C.createElement(Sl,{t:p,data_change:Dt,data_c:At,col:["SO","NC","PVHam","PVHmm","PVHpmm","PVHpml","PVHap","PVHmpd","PVHpv","PVa","PVi","ARH","ADP","AHA","AVP","DMHa","DMHp","DMHv","MEPO","MPO","OV","PD","PS","PSCH","PVp","PVpo","SBPV","SCH","SFO","VMPO","VLPO","AVPV","AHNa","AHNc","AHNd","AHNp","LM","MMme","MMl","MMm","MMp","MMd","SUMm","SUMl","TMd","TMv","MPNc","MPNl","MPNm","PMd","PMv","PVHdp","PVHf","PVHlp","PVHmpv","VMHa","VMHc","VMHdm","VMHvl","PH","LHA","LPO","PST","PSTN","RCH","PeF","STN","TU","A13","FF","ZIr","ZIc","ZId","ZIv","ME"],row:["_"]}),Un&&C.createElement(Ri,null,"MB"),C.createElement(Sl,{t:p,data_change:Dt,data_c:At,col:["SCop","SCsg","SCzo","ICc","ICd","ICe","NB","SAG","PBG","MEV","SCO","SNr","VTA","RR","MRNm","MRNmg","MRNp","SCdg","SCdw","SCiw","SCig-a","SCig-b","SCig-c","PRC","INC","ND","Su3","PAGdm","PAGl","PAGvl","PAGdl","PAGvm","APN","MPT","NOT","NPC","OP","PPT","RPF","InCo","CUN","RN","III","MA3","EW","IV","PA4","VTN","AT","LT","DT","MT","SNl","SNc","PPN","IF","IPR","IPC","IPA","IPL","IPI","IPDM","IPDL","IPRL","RL","CLI","DR"],row:["_"]}),gn&&C.createElement(Ri,null,"HB"),C.createElement(Sl,{t:p,data_change:Dt,data_c:At,col:["NLLd","NLLh","NLLv","PSV","KF","PBlc","PBld","PBle","PBls","PBlv","PBme","PBmm","PBmv","POR","SOCm","SOCl","B","DTN","LTN","PDTg","PCG","PG","PRNc","PRNv","SG","SSN","SUT","TRN","V","P5","Acs5","PC5","I5","CSl","CSm","LC","LDT","NI","PRNr","RPO","SLC","SLD","AP","CNlam","CNspg","DCO","VCO","CU","GR","ECU","NTB","NTSce","NTSco","NTSge","NTSl","NTSm","SPVC","SPVI","SPVOcdm","SPVOmdmd","SPVOmdmv","SPVOrdm","SPVOvl","Pa5","z","VI","ACVI","VII","ACVII","EV","AMBd","AMBv","DMX","ECO","GRN","ICB","IO","LRNm","LRNp","ISN","LIN","IRN","MARN","MDRNd","MDRNv","PARN","PAS","PGRNd","PGRNl","NIS","NR","PRP","PMR","PPYd","PPYs","LAV","MV","SPIV","SUV","XII","x","y","RM","RPA","RO"],row:["_"]}),Cn&&C.createElement(Ri,null,"CB"),C.createElement(Sl,{t:p,data_change:Dt,data_c:At,col:["LING_","LING_","CENT2_","CENT2_","CENT3_","CENT3_","CUL4/5_","CUL4/5_","DEC_","DEC_","FOTU_","FOTU_","PYR_","PYR_","UVU_","UVU_","NOD_","NOD_","SIM_","SIM_","ANcr1_","ANcr1_","ANcr2_","ANcr2_","PRM_","PRM_","COPY_","COPY_","PFL_","PFL_","FL_","FL_","IP","DN"],row:["gr","mo"]}),C.createElement(Sl,{t:p,data_change:Dt,data_c:At,col:["FN","IP","DN","VeCB"],row:["_"]})))),C.createElement(KO,{className:"SwcTable",rowSelection:co,columns:Ni,dataSource:Or,locale:ri}))):C.createElement(C.Fragment,null,C.createElement(bPt,{style:{marginBottom:8},placeholder:"Search",onChange:Qr,onKeyPress:yt=>{yt.stopPropagation()}}),C.createElement(Ew,{showLine:!0,onExpand:Ra,defaultExpandParent:!0,expandedKeys:z,onCheck:Yt,checkable:!0,selectable:!1,treeData:Or,checkedKeys:g,checkStrictly:!0,autoExpandParent:W,style:{paddingLeft:"2px"}})))});let wPt=new URL(window.location.href),EPt=new URLSearchParams(wPt.search),Jhe=EPt.get("brainContourOpacity");const _Pt=t=>{const{regionData:e}=t,[n,r]=C.useState(!1);return C.useEffect(()=>{let i=Jhe?JSON.parse(Jhe):.3;$0({filepath:e+"/data/FBX/outline.FBX",index:"Brain",color:"0xcccccc",opacity:i,offsetZ:0,R:1,callback:function(){r(!1)}})},[]),C.createElement("div",{id:"spinner",style:{position:"absolute",zIndex:999,left:0,top:0,width:"100%",height:"100%",display:`${n?"block":"none"}`,opacity:.7,backgroundColor:"#ffffff"}},C.createElement("div",{style:{position:"absolute",zIndex:999,left:"50%",top:"50%",fontWeight:"bold",textAlign:"center"}},C.createElement(BO,{spinning:!0,size:"large"}),C.createElement("br",null),"Loading....wait..."))};(function(t){if(t.TextEncoder&&t.TextDecoder)return!1;function e(r="utf-8"){if(r!=="utf-8")throw new RangeError(`Failed to construct 'TextEncoder': The encoding label provided ('${r}') is invalid.`)}Object.defineProperty(e.prototype,"encoding",{value:"utf-8"}),e.prototype.encode=function(r,i={stream:!1}){if(i.stream)throw new Error("Failed to encode: the 'stream' option is unsupported.");let a=0;const o=r.length;let s=0,c=Math.max(32,o+(o>>1)+7),u=new Uint8Array(c>>3<<3);for(;a<o;){let d=r.charCodeAt(a++);if(d>=55296&&d<=56319){if(a<o){const f=r.charCodeAt(a);(f&64512)===56320&&(++a,d=((d&1023)<<10)+(f&1023)+65536)}if(d>=55296&&d<=56319)continue}if(s+4>u.length){c+=8,c*=1+a/r.length*2,c=c>>3<<3;const f=new Uint8Array(c);f.set(u),u=f}if(d&4294967168)if(!(d&4294965248))u[s++]=d>>6&31|192;else if(!(d&4294901760))u[s++]=d>>12&15|224,u[s++]=d>>6&63|128;else if(!(d&4292870144))u[s++]=d>>18&7|240,u[s++]=d>>12&63|128,u[s++]=d>>6&63|128;else continue;else{u[s++]=d;continue}u[s++]=d&63|128}return u.slice(0,s)};function n(r="utf-8",i={fatal:!1}){if(r!=="utf-8")throw new RangeError(`Failed to construct 'TextDecoder': The encoding label provided ('${r}') is invalid.`);if(i.fatal)throw new Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.")}Object.defineProperty(n.prototype,"encoding",{value:"utf-8"}),Object.defineProperty(n.prototype,"fatal",{value:!1}),Object.defineProperty(n.prototype,"ignoreBOM",{value:!1}),n.prototype.decode=function(r,i={stream:!1}){if(i.stream)throw new Error("Failed to decode: the 'stream' option is unsupported.");const a=new Uint8Array(r);let o=0;const s=a.length,c=[];for(;o<s;){const u=a[o++];if(u===0)break;if(!(u&128))c.push(u);else if((u&224)===192){const d=a[o++]&63;c.push((u&31)<<6|d)}else if((u&240)===224){const d=a[o++]&63,f=a[o++]&63;c.push((u&31)<<12|d<<6|f)}else if((u&248)===240){const d=a[o++]&63,f=a[o++]&63,h=a[o++]&63;let p=(u&7)<<18|d<<12|f<<6|h;p>65535&&(p-=65536,c.push(p>>>10&1023|55296),p=56320|p&1023),c.push(p)}}return String.fromCharCode.apply(null,c)},t.TextEncoder=e,t.TextDecoder=n})(typeof window<"u"?window:typeof self<"u"?self:globalThis);function Qhe(t,e="utf8"){return new TextDecoder(e).decode(t)}const TPt=new TextEncoder;function IPt(t){return TPt.encode(t)}const APt=1024*8,MPt=(()=>{const t=new Uint8Array(4),e=new Uint32Array(t.buffer);return!((e[0]=1)&t[0])})(),yB={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class eP{constructor(e=APt,n={}){let r=!1;typeof e=="number"?e=new ArrayBuffer(e):(r=!0,this.lastWrittenByte=e.byteLength);const i=n.offset?n.offset>>>0:0,a=e.byteLength-i;let o=i;(ArrayBuffer.isView(e)||e instanceof eP)&&(e.byteLength!==e.buffer.byteLength&&(o=e.byteOffset+i),e=e.buffer),r?this.lastWrittenByte=a:this.lastWrittenByte=0,this.buffer=e,this.length=a,this.byteLength=a,this.byteOffset=o,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,o,a),this._mark=0,this._marks=[]}available(e=1){return this.offset+e<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(e=1){return this.offset+=e,this}back(e=1){return this.offset-=e,this}seek(e){return this.offset=e,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const e=this._marks.pop();if(e===void 0)throw new Error("Mark stack empty");return this.seek(e),this}rewind(){return this.offset=0,this}ensureAvailable(e=1){if(!this.available(e)){const r=(this.offset+e)*2,i=new Uint8Array(r);i.set(new Uint8Array(this.buffer)),this.buffer=i.buffer,this.length=this.byteLength=r,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(e=1){return this.readArray(e,"uint8")}readArray(e,n){const r=yB[n].BYTES_PER_ELEMENT*e,i=this.byteOffset+this.offset,a=this.buffer.slice(i,i+r);if(this.littleEndian===MPt&&n!=="uint8"&&n!=="int8"){const s=new Uint8Array(this.buffer.slice(i,i+r));s.reverse();const c=new yB[n](s.buffer);return this.offset+=r,c.reverse(),c}const o=new yB[n](a);return this.offset+=r,o}readInt16(){const e=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}readUint16(){const e=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,e}readInt32(){const e=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}readUint32(){const e=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat32(){const e=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat64(){const e=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}readBigInt64(){const e=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,e}readBigUint64(){const e=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,e}readChar(){return String.fromCharCode(this.readInt8())}readChars(e=1){let n="";for(let r=0;r<e;r++)n+=this.readChar();return n}readUtf8(e=1){return Qhe(this.readBytes(e))}decodeText(e=1,n="utf-8"){return Qhe(this.readBytes(e),n)}writeBoolean(e){return this.writeUint8(e?255:0),this}writeInt8(e){return this.ensureAvailable(1),this._data.setInt8(this.offset++,e),this._updateLastWrittenByte(),this}writeUint8(e){return this.ensureAvailable(1),this._data.setUint8(this.offset++,e),this._updateLastWrittenByte(),this}writeByte(e){return this.writeUint8(e)}writeBytes(e){this.ensureAvailable(e.length);for(let n=0;n<e.length;n++)this._data.setUint8(this.offset++,e[n]);return this._updateLastWrittenByte(),this}writeInt16(e){return this.ensureAvailable(2),this._data.setInt16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(e){return this.ensureAvailable(2),this._data.setUint16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(e){return this.ensureAvailable(4),this._data.setInt32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(e){return this.ensureAvailable(4),this._data.setUint32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(e){return this.ensureAvailable(4),this._data.setFloat32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(e){return this.ensureAvailable(8),this._data.setFloat64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(e){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(e){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(e){return this.writeUint8(e.charCodeAt(0))}writeChars(e){for(let n=0;n<e.length;n++)this.writeUint8(e.charCodeAt(n));return this}writeUtf8(e){return this.writeBytes(IPt(e))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}function LPt(t){if(t.compression!==1)throw new Error("missing mandatory StripByteCounts field in compressed image");const e=t.rowsPerStrip*t.width*t.samplesPerPixel*(t.bitsPerSample/8);return new Array(t.stripOffsets.length).fill(e)}function RPt(t,e,n){let r=0;for(;r<t.length;){for(let i=n;i<e*n;i+=n)for(let a=0;a<n;a++)t[r+i+a]=t[r+i+a]+t[r+i-(n-a)]&255;r+=e*n}}function OPt(t,e,n){let r=0;for(;r<t.length;){for(let i=n;i<e*n;i+=n)for(let a=0;a<n;a++)t[r+i+a]=t[r+i+a]+t[r+i-(n-a)]&65535;r+=e*n}}const kG={33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"ISOSpeedRatings",34856:"OECF",34864:"SensitivityType",34865:"StandardOutputSensitivity",34866:"RecommendedExposureIndex",34867:"ISOSpeed",34868:"ISOSpeedLatitudeyyy",34869:"ISOSpeedLatitudezzz",36864:"ExifVersion",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBiasValue",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",37396:"SubjectArea",37500:"MakerNote",37510:"UserComment",37520:"SubsecTime",37521:"SubsecTimeOriginal",37522:"SubsecTimeDigitized",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",40964:"RelatedSoundFile",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRatio",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",42016:"ImageUniqueID",42032:"CameraOwnerName",42033:"BodySerialNumber",42034:"LensSpecification",42035:"LensMake",42036:"LensModel",42037:"LensSerialNumber",42240:"Gamma"},SAe={};for(const t in kG)SAe[kG[t]]=Number(t);const PPt=Object.freeze(Object.defineProperty({__proto__:null,tagsById:kG,tagsByName:SAe},Symbol.toStringTag,{value:"Module"})),UG={0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential",31:"GPSHPositioningError"},wAe={};for(const t in UG)wAe[UG[t]]=Number(t);const NPt=Object.freeze(Object.defineProperty({__proto__:null,tagsById:UG,tagsByName:wAe},Symbol.toStringTag,{value:"Module"})),FG={254:"NewSubfileType",255:"SubfileType",256:"ImageWidth",257:"ImageLength",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",263:"Threshholding",264:"CellWidth",265:"CellLength",266:"FillOrder",270:"ImageDescription",271:"Make",272:"Model",273:"StripOffsets",274:"Orientation",277:"SamplesPerPixel",278:"RowsPerStrip",279:"StripByteCounts",280:"MinSampleValue",281:"MaxSampleValue",282:"XResolution",283:"YResolution",284:"PlanarConfiguration",288:"FreeOffsets",289:"FreeByteCounts",290:"GrayResponseUnit",291:"GrayResponseCurve",296:"ResolutionUnit",305:"Software",306:"DateTime",315:"Artist",316:"HostComputer",320:"ColorMap",338:"ExtraSamples",33432:"Copyright",269:"DocumentName",285:"PageName",286:"XPosition",287:"YPosition",292:"T4Options",293:"T6Options",297:"PageNumber",301:"TransferFunction",317:"Predictor",318:"WhitePoint",319:"PrimaryChromaticities",321:"HalftoneHints",322:"TileWidth",323:"TileLength",324:"TileOffsets",325:"TileByteCounts",326:"BadFaxLines",327:"CleanFaxData",328:"ConsecutiveBadFaxLines",330:"SubIFDs",332:"InkSet",333:"InkNames",334:"NumberOfInks",336:"DotRange",337:"TargetPrinter",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",342:"TransferRange",343:"ClipPath",344:"XClipPathUnits",345:"YClipPathUnits",346:"Indexed",347:"JPEGTables",351:"OPIProxy",400:"GlobalParametersIFD",401:"ProfileType",402:"FaxProfile",403:"CodingMethods",404:"VersionYear",405:"ModeNumber",433:"Decode",434:"DefaultImageColor",512:"JPEGProc",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",515:"JPEGRestartInterval",517:"JPEGLosslessPredictors",518:"JPEGPointTransforms",519:"JPEGQTables",520:"JPEGDCTables",521:"JPEGACTables",529:"YCbCrCoefficients",530:"YCbCrSubSampling",531:"YCbCrPositioning",532:"ReferenceBlackWhite",559:"StripRowCounts",700:"XMP",32781:"ImageID",34732:"ImageLayer",32932:"WangAnnotatio",33445:"MDFileTag",33446:"MDScalePixel",33447:"MDColorTable",33448:"MDLabName",33449:"MDSampleInfo",33450:"MDPrepDate",33451:"MDPrepTime",33452:"MDFileUnits",33550:"ModelPixelScaleTag",33723:"IPTC",33918:"INGRPacketDataTag",33919:"INGRFlagRegisters",33920:"IrasBTransformationMatrix",33922:"ModelTiepointTag",34264:"ModelTransformationTag",34377:"Photoshop",34665:"ExifIFD",34675:"ICCProfile",34735:"GeoKeyDirectoryTag",34736:"GeoDoubleParamsTag",34737:"GeoAsciiParamsTag",34853:"GPSIFD",34908:"HylaFAXFaxRecvParams",34909:"HylaFAXFaxSubAddress",34910:"HylaFAXFaxRecvTime",37724:"ImageSourceData",40965:"InteroperabilityIFD",42112:"GDAL_METADATA",42113:"GDAL_NODATA",50215:"OceScanjobDescription",50216:"OceApplicationSelector",50217:"OceIdentificationNumber",50218:"OceImageLogicCharacteristics",50706:"DNGVersion",50707:"DNGBackwardVersion",50708:"UniqueCameraModel",50709:"LocalizedCameraModel",50710:"CFAPlaneColor",50711:"CFALayout",50712:"LinearizationTable",50713:"BlackLevelRepeatDim",50714:"BlackLevel",50715:"BlackLevelDeltaH",50716:"BlackLevelDeltaV",50717:"WhiteLevel",50718:"DefaultScale",50719:"DefaultCropOrigin",50720:"DefaultCropSize",50721:"ColorMatrix1",50722:"ColorMatrix2",50723:"CameraCalibration1",50724:"CameraCalibration2",50725:"ReductionMatrix1",50726:"ReductionMatrix2",50727:"AnalogBalance",50728:"AsShotNeutral",50729:"AsShotWhiteXY",50730:"BaselineExposure",50731:"BaselineNoise",50732:"BaselineSharpness",50733:"BayerGreenSplit",50734:"LinearResponseLimit",50735:"CameraSerialNumber",50736:"LensInfo",50737:"ChromaBlurRadius",50738:"AntiAliasStrength",50740:"DNGPrivateData",50741:"MakerNoteSafety",50778:"CalibrationIlluminant1",50779:"CalibrationIlluminant2",50780:"BestQualityScale",50784:"AliasLayerMetadata"},EAe={};for(const t in FG)EAe[FG[t]]=Number(t);const DPt=Object.freeze(Object.defineProperty({__proto__:null,tagsById:FG,tagsByName:EAe},Symbol.toStringTag,{value:"Module"})),epe={standard:DPt,exif:PPt,gps:NPt};class _Ae{constructor(e){if(!e)throw new Error("missing kind");this.data=new Uint8Array,this.fields=new Map,this.kind=e,this._hasMap=!1,this._map={}}get(e){if(typeof e=="number")return this.fields.get(e);if(typeof e=="string")return this.fields.get(epe[this.kind].tagsByName[e]);throw new Error("expected a number or string")}get map(){if(!this._hasMap){const e=epe[this.kind].tagsById;for(const n of this.fields.keys())e[n]&&(this._map[e[n]]=this.fields.get(n));this._hasMap=!0}return this._map}}const TAe=new Map([[1,[1,tpe]],[2,[1,FPt]],[3,[2,BPt]],[4,[4,VPt]],[5,[8,$Pt]],[6,[1,zPt]],[7,[1,tpe]],[8,[2,HPt]],[9,[4,GPt]],[10,[8,jPt]],[11,[4,WPt]],[12,[8,XPt]]]);function kPt(t,e){const n=TAe.get(t);if(!n)throw new Error(`type not found: ${t}`);return n[0]*e}function UPt(t,e,n){const r=TAe.get(e);if(!r)throw new Error(`type not found: ${e}`);return r[1](t,n)}function tpe(t,e){if(e===1)return t.readUint8();const n=new Uint8Array(e);for(let r=0;r<e;r++)n[r]=t.readUint8();return n}function FPt(t,e){const n=[];let r="";for(let i=0;i<e;i++){const a=String.fromCharCode(t.readUint8());a==="\0"?(n.push(r),r=""):r+=a}return n.length===1?n[0]:n}function BPt(t,e){if(e===1)return t.readUint16();const n=new Uint16Array(e);for(let r=0;r<e;r++)n[r]=t.readUint16();return n}function VPt(t,e){if(e===1)return t.readUint32();const n=new Uint32Array(e);for(let r=0;r<e;r++)n[r]=t.readUint32();return n}function $Pt(t,e){if(e===1)return t.readUint32()/t.readUint32();const n=new Array(e);for(let r=0;r<e;r++)n[r]=t.readUint32()/t.readUint32();return n}function zPt(t,e){if(e===1)return t.readInt8();const n=new Int8Array(e);for(let r=0;r<e;r++)n[r]=t.readInt8();return n}function HPt(t,e){if(e===1)return t.readInt16();const n=new Int16Array(e);for(let r=0;r<e;r++)n[r]=t.readInt16();return n}function GPt(t,e){if(e===1)return t.readInt32();const n=new Int32Array(e);for(let r=0;r<e;r++)n[r]=t.readInt32();return n}function jPt(t,e){if(e===1)return t.readInt32()/t.readInt32();const n=new Array(e);for(let r=0;r<e;r++)n[r]=t.readInt32()/t.readInt32();return n}function WPt(t,e){if(e===1)return t.readFloat32();const n=new Float32Array(e);for(let r=0;r<e;r++)n[r]=t.readFloat32();return n}function XPt(t,e){if(e===1)return t.readFloat64();const n=new Float64Array(e);for(let r=0;r<e;r++)n[r]=t.readFloat64();return n}const ZPt=256,npe=257,rpe=258,ipe=9;let Z2=[];function KPt(){if(Z2.length===0){for(let e=0;e<256;e++)Z2.push([e]);const t=[];for(let e=256;e<4096;e++)Z2.push(t)}}const YPt=[511,1023,2047,4095],qPt=[0,0,0,0,0,0,0,0,0,511,1023,2047,4095];class JPt{constructor(e){this.nextData=0,this.nextBits=0,this.bytePointer=0,this.tableLength=rpe,this.currentBitLength=ipe,this.stripArray=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),this.outData=new eP(e.byteLength),this.initializeTable()}decode(){let e=0,n=0;for(;(e=this.getNextCode())!==npe;)if(e===ZPt){if(this.initializeTable(),e=this.getNextCode(),e===npe)break;this.writeString(this.stringFromCode(e)),n=e}else if(this.isInTable(e))this.writeString(this.stringFromCode(e)),this.addStringToTable(this.stringFromCode(n).concat(this.stringFromCode(e)[0])),n=e;else{const i=this.stringFromCode(n).concat(this.stringFromCode(n)[0]);this.writeString(i),this.addStringToTable(i),n=e}const r=this.outData.toArray();return new DataView(r.buffer,r.byteOffset,r.byteLength)}initializeTable(){KPt(),this.tableLength=rpe,this.currentBitLength=ipe}writeString(e){this.outData.writeBytes(e)}stringFromCode(e){return Z2[e]}isInTable(e){return e<this.tableLength}addStringToTable(e){if(Z2[this.tableLength++]=e,Z2.length>4096)throw Z2=[],new Error("LZW decoding error. Please open an issue at https://github.com/image-js/tiff/issues/new/choose (include a test image).");this.tableLength===qPt[this.currentBitLength]&&this.currentBitLength++}getNextCode(){this.nextData=this.nextData<<8|this.stripArray[this.bytePointer++]&255,this.nextBits+=8,this.nextBits<this.currentBitLength&&(this.nextData=this.nextData<<8|this.stripArray[this.bytePointer++]&255,this.nextBits+=8);const e=this.nextData>>this.nextBits-this.currentBitLength&YPt[this.currentBitLength-9];return this.nextBits-=this.currentBitLength,this.bytePointer>this.stripArray.length?257:e}}function QPt(t){return new JPt(t).decode()}const eNt=/^(\d{4}):(\d{2}):(\d{2}) (\d{2}):(\d{2}):(\d{2})$/;class ape extends _Ae{constructor(){super("standard")}get size(){return this.width*this.height}get width(){return this.imageWidth}get height(){return this.imageLength}get components(){return this.samplesPerPixel}get date(){const e=new Date,n=eNt.exec(this.dateTime);if(n===null)throw new Error(`invalid dateTime: ${this.dateTime}`);return e.setFullYear(Number(n[1]),Number(n[2])-1,Number(n[3])),e.setHours(Number(n[4]),Number(n[5]),Number(n[6])),e}get newSubfileType(){return this.get("NewSubfileType")}get imageWidth(){return this.get("ImageWidth")}get imageLength(){return this.get("ImageLength")}get bitsPerSample(){const e=this.get("BitsPerSample");return e&&typeof e!="number"?e[0]:e}get alpha(){const e=this.extraSamples;return e?e[0]!==0:!1}get associatedAlpha(){const e=this.extraSamples;return e?e[0]===1:!1}get extraSamples(){return eM(this.get("ExtraSamples"))}get compression(){return this.get("Compression")||1}get type(){return this.get("PhotometricInterpretation")}get fillOrder(){return this.get("FillOrder")||1}get documentName(){return this.get("DocumentName")}get imageDescription(){return this.get("ImageDescription")}get stripOffsets(){return eM(this.get("StripOffsets"))}get orientation(){return this.get("Orientation")}get samplesPerPixel(){return this.get("SamplesPerPixel")||1}get rowsPerStrip(){return this.get("RowsPerStrip")}get stripByteCounts(){return eM(this.get("StripByteCounts"))}get minSampleValue(){return this.get("MinSampleValue")||0}get maxSampleValue(){return this.get("MaxSampleValue")||2**this.bitsPerSample-1}get xResolution(){return this.get("XResolution")}get yResolution(){return this.get("YResolution")}get planarConfiguration(){return this.get("PlanarConfiguration")||1}get resolutionUnit(){return this.get("ResolutionUnit")||2}get dateTime(){return this.get("DateTime")}get predictor(){return this.get("Predictor")||1}get sampleFormat(){return eM(this.get("SampleFormat")||1)[0]}get sMinSampleValue(){return this.get("SMinSampleValue")||this.minSampleValue}get sMaxSampleValue(){return this.get("SMaxSampleValue")||this.maxSampleValue}get palette(){const e=2**this.bitsPerSample,n=this.get("ColorMap");if(!n)return;if(n.length!==3*e)throw new Error(`ColorMap size must be ${e}`);const r=[];for(let i=0;i<e;i++)r.push([n[i],n[i+e],n[i+2*e]]);return r}}function eM(t){return typeof t=="number"?[t]:t}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const tNt=4,ope=0,spe=1,nNt=2;function zE(t){let e=t.length;for(;--e>=0;)t[e]=0}const rNt=0,IAe=1,iNt=2,aNt=3,oNt=258,sY=29,gI=256,h5=gI+1+sY,sw=30,lY=19,AAe=2*h5+1,K2=15,bB=16,sNt=7,cY=256,MAe=16,LAe=17,RAe=18,BG=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),EL=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),lNt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),OAe=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),cNt=512,sm=new Array((h5+2)*2);zE(sm);const s4=new Array(sw*2);zE(s4);const p5=new Array(cNt);zE(p5);const v5=new Array(oNt-aNt+1);zE(v5);const uY=new Array(sY);zE(uY);const vR=new Array(sw);zE(vR);function xB(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}let PAe,NAe,DAe;function CB(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}const kAe=t=>t<256?p5[t]:p5[256+(t>>>7)],g5=(t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},Af=(t,e,n)=>{t.bi_valid>bB-n?(t.bi_buf|=e<<t.bi_valid&65535,g5(t,t.bi_buf),t.bi_buf=e>>bB-t.bi_valid,t.bi_valid+=n-bB):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)},eg=(t,e,n)=>{Af(t,n[e*2],n[e*2+1])},UAe=(t,e)=>{let n=0;do n|=t&1,t>>>=1,n<<=1;while(--e>0);return n>>>1},uNt=t=>{t.bi_valid===16?(g5(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)},dNt=(t,e)=>{const n=e.dyn_tree,r=e.max_code,i=e.stat_desc.static_tree,a=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,c=e.stat_desc.max_length;let u,d,f,h,p,v,y=0;for(h=0;h<=K2;h++)t.bl_count[h]=0;for(n[t.heap[t.heap_max]*2+1]=0,u=t.heap_max+1;u<AAe;u++)d=t.heap[u],h=n[n[d*2+1]*2+1]+1,h>c&&(h=c,y++),n[d*2+1]=h,!(d>r)&&(t.bl_count[h]++,p=0,d>=s&&(p=o[d-s]),v=n[d*2],t.opt_len+=v*(h+p),a&&(t.static_len+=v*(i[d*2+1]+p)));if(y!==0){do{for(h=c-1;t.bl_count[h]===0;)h--;t.bl_count[h]--,t.bl_count[h+1]+=2,t.bl_count[c]--,y-=2}while(y>0);for(h=c;h!==0;h--)for(d=t.bl_count[h];d!==0;)f=t.heap[--u],!(f>r)&&(n[f*2+1]!==h&&(t.opt_len+=(h-n[f*2+1])*n[f*2],n[f*2+1]=h),d--)}},FAe=(t,e,n)=>{const r=new Array(K2+1);let i=0,a,o;for(a=1;a<=K2;a++)i=i+n[a-1]<<1,r[a]=i;for(o=0;o<=e;o++){let s=t[o*2+1];s!==0&&(t[o*2]=UAe(r[s]++,s))}},fNt=()=>{let t,e,n,r,i;const a=new Array(K2+1);for(n=0,r=0;r<sY-1;r++)for(uY[r]=n,t=0;t<1<<BG[r];t++)v5[n++]=r;for(v5[n-1]=r,i=0,r=0;r<16;r++)for(vR[r]=i,t=0;t<1<<EL[r];t++)p5[i++]=r;for(i>>=7;r<sw;r++)for(vR[r]=i<<7,t=0;t<1<<EL[r]-7;t++)p5[256+i++]=r;for(e=0;e<=K2;e++)a[e]=0;for(t=0;t<=143;)sm[t*2+1]=8,t++,a[8]++;for(;t<=255;)sm[t*2+1]=9,t++,a[9]++;for(;t<=279;)sm[t*2+1]=7,t++,a[7]++;for(;t<=287;)sm[t*2+1]=8,t++,a[8]++;for(FAe(sm,h5+1,a),t=0;t<sw;t++)s4[t*2+1]=5,s4[t*2]=UAe(t,5);PAe=new xB(sm,BG,gI+1,h5,K2),NAe=new xB(s4,EL,0,sw,K2),DAe=new xB(new Array(0),lNt,0,lY,sNt)},BAe=t=>{let e;for(e=0;e<h5;e++)t.dyn_ltree[e*2]=0;for(e=0;e<sw;e++)t.dyn_dtree[e*2]=0;for(e=0;e<lY;e++)t.bl_tree[e*2]=0;t.dyn_ltree[cY*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},VAe=t=>{t.bi_valid>8?g5(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},lpe=(t,e,n,r)=>{const i=e*2,a=n*2;return t[i]<t[a]||t[i]===t[a]&&r[e]<=r[n]},SB=(t,e,n)=>{const r=t.heap[n];let i=n<<1;for(;i<=t.heap_len&&(i<t.heap_len&&lpe(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!lpe(e,r,t.heap[i],t.depth));)t.heap[n]=t.heap[i],n=i,i<<=1;t.heap[n]=r},cpe=(t,e,n)=>{let r,i,a=0,o,s;if(t.sym_next!==0)do r=t.pending_buf[t.sym_buf+a++]&255,r+=(t.pending_buf[t.sym_buf+a++]&255)<<8,i=t.pending_buf[t.sym_buf+a++],r===0?eg(t,i,e):(o=v5[i],eg(t,o+gI+1,e),s=BG[o],s!==0&&(i-=uY[o],Af(t,i,s)),r--,o=kAe(r),eg(t,o,n),s=EL[o],s!==0&&(r-=vR[o],Af(t,r,s)));while(a<t.sym_next);eg(t,cY,e)},VG=(t,e)=>{const n=e.dyn_tree,r=e.stat_desc.static_tree,i=e.stat_desc.has_stree,a=e.stat_desc.elems;let o,s,c=-1,u;for(t.heap_len=0,t.heap_max=AAe,o=0;o<a;o++)n[o*2]!==0?(t.heap[++t.heap_len]=c=o,t.depth[o]=0):n[o*2+1]=0;for(;t.heap_len<2;)u=t.heap[++t.heap_len]=c<2?++c:0,n[u*2]=1,t.depth[u]=0,t.opt_len--,i&&(t.static_len-=r[u*2+1]);for(e.max_code=c,o=t.heap_len>>1;o>=1;o--)SB(t,n,o);u=a;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],SB(t,n,1),s=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=s,n[u*2]=n[o*2]+n[s*2],t.depth[u]=(t.depth[o]>=t.depth[s]?t.depth[o]:t.depth[s])+1,n[o*2+1]=n[s*2+1]=u,t.heap[1]=u++,SB(t,n,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],dNt(t,e),FAe(n,c,t.bl_count)},upe=(t,e,n)=>{let r,i=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),e[(n+1)*2+1]=65535,r=0;r<=n;r++)a=o,o=e[(r+1)*2+1],!(++s<c&&a===o)&&(s<u?t.bl_tree[a*2]+=s:a!==0?(a!==i&&t.bl_tree[a*2]++,t.bl_tree[MAe*2]++):s<=10?t.bl_tree[LAe*2]++:t.bl_tree[RAe*2]++,s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4))},dpe=(t,e,n)=>{let r,i=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),r=0;r<=n;r++)if(a=o,o=e[(r+1)*2+1],!(++s<c&&a===o)){if(s<u)do eg(t,a,t.bl_tree);while(--s!==0);else a!==0?(a!==i&&(eg(t,a,t.bl_tree),s--),eg(t,MAe,t.bl_tree),Af(t,s-3,2)):s<=10?(eg(t,LAe,t.bl_tree),Af(t,s-3,3)):(eg(t,RAe,t.bl_tree),Af(t,s-11,7));s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4)}},hNt=t=>{let e;for(upe(t,t.dyn_ltree,t.l_desc.max_code),upe(t,t.dyn_dtree,t.d_desc.max_code),VG(t,t.bl_desc),e=lY-1;e>=3&&t.bl_tree[OAe[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},pNt=(t,e,n,r)=>{let i;for(Af(t,e-257,5),Af(t,n-1,5),Af(t,r-4,4),i=0;i<r;i++)Af(t,t.bl_tree[OAe[i]*2+1],3);dpe(t,t.dyn_ltree,e-1),dpe(t,t.dyn_dtree,n-1)},vNt=t=>{let e=4093624447,n;for(n=0;n<=31;n++,e>>>=1)if(e&1&&t.dyn_ltree[n*2]!==0)return ope;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return spe;for(n=32;n<gI;n++)if(t.dyn_ltree[n*2]!==0)return spe;return ope};let fpe=!1;const gNt=t=>{fpe||(fNt(),fpe=!0),t.l_desc=new CB(t.dyn_ltree,PAe),t.d_desc=new CB(t.dyn_dtree,NAe),t.bl_desc=new CB(t.bl_tree,DAe),t.bi_buf=0,t.bi_valid=0,BAe(t)},$Ae=(t,e,n,r)=>{Af(t,(rNt<<1)+(r?1:0),3),VAe(t),g5(t,n),g5(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n},mNt=t=>{Af(t,IAe<<1,3),eg(t,cY,sm),uNt(t)},yNt=(t,e,n,r)=>{let i,a,o=0;t.level>0?(t.strm.data_type===nNt&&(t.strm.data_type=vNt(t)),VG(t,t.l_desc),VG(t,t.d_desc),o=hNt(t),i=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=i&&(i=a)):i=a=n+5,n+4<=i&&e!==-1?$Ae(t,e,n,r):t.strategy===tNt||a===i?(Af(t,(IAe<<1)+(r?1:0),3),cpe(t,sm,s4)):(Af(t,(iNt<<1)+(r?1:0),3),pNt(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),cpe(t,t.dyn_ltree,t.dyn_dtree)),BAe(t),r&&VAe(t)},bNt=(t,e,n)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=n,e===0?t.dyn_ltree[n*2]++:(t.matches++,e--,t.dyn_ltree[(v5[n]+gI+1)*2]++,t.dyn_dtree[kAe(e)*2]++),t.sym_next===t.sym_end);var xNt=gNt,CNt=$Ae,SNt=yNt,wNt=bNt,ENt=mNt,_Nt={_tr_init:xNt,_tr_stored_block:CNt,_tr_flush_block:SNt,_tr_tally:wNt,_tr_align:ENt};const TNt=(t,e,n,r)=>{let i=t&65535|0,a=t>>>16&65535|0,o=0;for(;n!==0;){o=n>2e3?2e3:n,n-=o;do i=i+e[r++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0};var m5=TNt;const INt=()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=t&1?3988292384^t>>>1:t>>>1;e[n]=t}return e},ANt=new Uint32Array(INt()),MNt=(t,e,n,r)=>{const i=ANt,a=r+n;t^=-1;for(let o=r;o<a;o++)t=t>>>8^i[(t^e[o])&255];return t^-1};var Ru=MNt,Gw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},mI={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:LNt,_tr_stored_block:$G,_tr_flush_block:RNt,_tr_tally:p1,_tr_align:ONt}=_Nt,{Z_NO_FLUSH:v1,Z_PARTIAL_FLUSH:PNt,Z_FULL_FLUSH:NNt,Z_FINISH:Qh,Z_BLOCK:hpe,Z_OK:Yu,Z_STREAM_END:ppe,Z_STREAM_ERROR:ug,Z_DATA_ERROR:DNt,Z_BUF_ERROR:wB,Z_DEFAULT_COMPRESSION:kNt,Z_FILTERED:UNt,Z_HUFFMAN_ONLY:tM,Z_RLE:FNt,Z_FIXED:BNt,Z_DEFAULT_STRATEGY:VNt,Z_UNKNOWN:$Nt,Z_DEFLATED:tP}=mI,zNt=9,HNt=15,GNt=8,jNt=29,WNt=256,zG=WNt+1+jNt,XNt=30,ZNt=19,KNt=2*zG+1,YNt=15,Zo=3,i1=258,dg=i1+Zo+1,qNt=32,jw=42,dY=57,HG=69,GG=73,jG=91,WG=103,Y2=113,ST=666,Qd=1,HE=2,jb=3,GE=4,JNt=3,q2=(t,e)=>(t.msg=Gw[e],e),vpe=t=>t*2-(t>4?9:0),z0=t=>{let e=t.length;for(;--e>=0;)t[e]=0},QNt=t=>{let e,n,r,i=t.w_size;e=t.hash_size,r=e;do n=t.head[--r],t.head[r]=n>=i?n-i:0;while(--e);e=i,r=e;do n=t.prev[--r],t.prev[r]=n>=i?n-i:0;while(--e)};let eDt=(t,e,n)=>(e<<t.hash_shift^n)&t.hash_mask,g1=eDt;const Zf=t=>{const e=t.state;let n=e.pending;n>t.avail_out&&(n=t.avail_out),n!==0&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+n),t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,e.pending===0&&(e.pending_out=0))},ih=(t,e)=>{RNt(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Zf(t.strm)},vs=(t,e)=>{t.pending_buf[t.pending++]=e},N_=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},XG=(t,e,n,r)=>{let i=t.avail_in;return i>r&&(i=r),i===0?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),n),t.state.wrap===1?t.adler=m5(t.adler,e,i,n):t.state.wrap===2&&(t.adler=Ru(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)},zAe=(t,e)=>{let n=t.max_chain_length,r=t.strstart,i,a,o=t.prev_length,s=t.nice_match;const c=t.strstart>t.w_size-dg?t.strstart-(t.w_size-dg):0,u=t.window,d=t.w_mask,f=t.prev,h=t.strstart+i1;let p=u[r+o-1],v=u[r+o];t.prev_length>=t.good_match&&(n>>=2),s>t.lookahead&&(s=t.lookahead);do if(i=e,!(u[i+o]!==v||u[i+o-1]!==p||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&r<h);if(a=i1-(h-r),r=h-i1,a>o){if(t.match_start=e,o=a,a>=s)break;p=u[r+o-1],v=u[r+o]}}while((e=f[e&d])>c&&--n!==0);return o<=t.lookahead?o:t.lookahead},Ww=t=>{const e=t.w_size;let n,r,i;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-dg)&&(t.window.set(t.window.subarray(e,e+e-r),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),QNt(t),r+=e),t.strm.avail_in===0)break;if(n=XG(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=n,t.lookahead+t.insert>=Zo)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=g1(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=g1(t,t.ins_h,t.window[i+Zo-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<Zo)););}while(t.lookahead<dg&&t.strm.avail_in!==0)},HAe=(t,e)=>{let n=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,r,i,a,o=0,s=t.strm.avail_in;do{if(r=65535,a=t.bi_valid+42>>3,t.strm.avail_out<a||(a=t.strm.avail_out-a,i=t.strstart-t.block_start,r>i+t.strm.avail_in&&(r=i+t.strm.avail_in),r>a&&(r=a),r<n&&(r===0&&e!==Qh||e===v1||r!==i+t.strm.avail_in)))break;o=e===Qh&&r===i+t.strm.avail_in?1:0,$G(t,0,0,o),t.pending_buf[t.pending-4]=r,t.pending_buf[t.pending-3]=r>>8,t.pending_buf[t.pending-2]=~r,t.pending_buf[t.pending-1]=~r>>8,Zf(t.strm),i&&(i>r&&(i=r),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,r-=i),r&&(XG(t.strm,t.strm.output,t.strm.next_out,r),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r)}while(o===0);return s-=t.strm.avail_in,s&&(s>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=s&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-s,t.strm.next_in),t.strstart),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),o?GE:e!==v1&&e!==Qh&&t.strm.avail_in===0&&t.strstart===t.block_start?HE:(a=t.window_size-t.strstart,t.strm.avail_in>a&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,a+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),a>t.strm.avail_in&&(a=t.strm.avail_in),a&&(XG(t.strm,t.window,t.strstart,a),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.high_water<t.strstart&&(t.high_water=t.strstart),a=t.bi_valid+42>>3,a=t.pending_buf_size-a>65535?65535:t.pending_buf_size-a,n=a>t.w_size?t.w_size:a,i=t.strstart-t.block_start,(i>=n||(i||e===Qh)&&e!==v1&&t.strm.avail_in===0&&i<=a)&&(r=i>a?a:i,o=e===Qh&&t.strm.avail_in===0&&r===i?1:0,$G(t,t.block_start,r,o),t.block_start+=r,Zf(t.strm)),o?jb:Qd)},EB=(t,e)=>{let n,r;for(;;){if(t.lookahead<dg){if(Ww(t),t.lookahead<dg&&e===v1)return Qd;if(t.lookahead===0)break}if(n=0,t.lookahead>=Zo&&(t.ins_h=g1(t,t.ins_h,t.window[t.strstart+Zo-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),n!==0&&t.strstart-n<=t.w_size-dg&&(t.match_length=zAe(t,n)),t.match_length>=Zo)if(r=p1(t,t.strstart-t.match_start,t.match_length-Zo),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=Zo){t.match_length--;do t.strstart++,t.ins_h=g1(t,t.ins_h,t.window[t.strstart+Zo-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=g1(t,t.ins_h,t.window[t.strstart+1]);else r=p1(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(ih(t,!1),t.strm.avail_out===0))return Qd}return t.insert=t.strstart<Zo-1?t.strstart:Zo-1,e===Qh?(ih(t,!0),t.strm.avail_out===0?jb:GE):t.sym_next&&(ih(t,!1),t.strm.avail_out===0)?Qd:HE},DC=(t,e)=>{let n,r,i;for(;;){if(t.lookahead<dg){if(Ww(t),t.lookahead<dg&&e===v1)return Qd;if(t.lookahead===0)break}if(n=0,t.lookahead>=Zo&&(t.ins_h=g1(t,t.ins_h,t.window[t.strstart+Zo-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=Zo-1,n!==0&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-dg&&(t.match_length=zAe(t,n),t.match_length<=5&&(t.strategy===UNt||t.match_length===Zo&&t.strstart-t.match_start>4096)&&(t.match_length=Zo-1)),t.prev_length>=Zo&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-Zo,r=p1(t,t.strstart-1-t.prev_match,t.prev_length-Zo),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=g1(t,t.ins_h,t.window[t.strstart+Zo-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=Zo-1,t.strstart++,r&&(ih(t,!1),t.strm.avail_out===0))return Qd}else if(t.match_available){if(r=p1(t,0,t.window[t.strstart-1]),r&&ih(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return Qd}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=p1(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<Zo-1?t.strstart:Zo-1,e===Qh?(ih(t,!0),t.strm.avail_out===0?jb:GE):t.sym_next&&(ih(t,!1),t.strm.avail_out===0)?Qd:HE},tDt=(t,e)=>{let n,r,i,a;const o=t.window;for(;;){if(t.lookahead<=i1){if(Ww(t),t.lookahead<=i1&&e===v1)return Qd;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=Zo&&t.strstart>0&&(i=t.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=t.strstart+i1;do;while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<a);t.match_length=i1-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=Zo?(n=p1(t,1,t.match_length-Zo),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=p1(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(ih(t,!1),t.strm.avail_out===0))return Qd}return t.insert=0,e===Qh?(ih(t,!0),t.strm.avail_out===0?jb:GE):t.sym_next&&(ih(t,!1),t.strm.avail_out===0)?Qd:HE},nDt=(t,e)=>{let n;for(;;){if(t.lookahead===0&&(Ww(t),t.lookahead===0)){if(e===v1)return Qd;break}if(t.match_length=0,n=p1(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(ih(t,!1),t.strm.avail_out===0))return Qd}return t.insert=0,e===Qh?(ih(t,!0),t.strm.avail_out===0?jb:GE):t.sym_next&&(ih(t,!1),t.strm.avail_out===0)?Qd:HE};function Uv(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}const wT=[new Uv(0,0,0,0,HAe),new Uv(4,4,8,4,EB),new Uv(4,5,16,8,EB),new Uv(4,6,32,32,EB),new Uv(4,4,16,16,DC),new Uv(8,16,32,32,DC),new Uv(8,16,128,128,DC),new Uv(8,32,128,256,DC),new Uv(32,128,258,1024,DC),new Uv(32,258,258,4096,DC)],rDt=t=>{t.window_size=2*t.w_size,z0(t.head),t.max_lazy_match=wT[t.level].max_lazy,t.good_match=wT[t.level].good_length,t.nice_match=wT[t.level].nice_length,t.max_chain_length=wT[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=Zo-1,t.match_available=0,t.ins_h=0};function iDt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=tP,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(KNt*2),this.dyn_dtree=new Uint16Array((2*XNt+1)*2),this.bl_tree=new Uint16Array((2*ZNt+1)*2),z0(this.dyn_ltree),z0(this.dyn_dtree),z0(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(YNt+1),this.heap=new Uint16Array(2*zG+1),z0(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*zG+1),z0(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const yI=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==jw&&e.status!==dY&&e.status!==HG&&e.status!==GG&&e.status!==jG&&e.status!==WG&&e.status!==Y2&&e.status!==ST?1:0},GAe=t=>{if(yI(t))return q2(t,ug);t.total_in=t.total_out=0,t.data_type=$Nt;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?dY:e.wrap?jw:Y2,t.adler=e.wrap===2?0:1,e.last_flush=-2,LNt(e),Yu},jAe=t=>{const e=GAe(t);return e===Yu&&rDt(t.state),e},aDt=(t,e)=>yI(t)||t.state.wrap!==2?ug:(t.state.gzhead=e,Yu),WAe=(t,e,n,r,i,a)=>{if(!t)return ug;let o=1;if(e===kNt&&(e=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>zNt||n!==tP||r<8||r>15||e<0||e>9||a<0||a>BNt||r===8&&o!==1)return q2(t,ug);r===8&&(r=9);const s=new iDt;return t.state=s,s.strm=t,s.status=jw,s.wrap=o,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+Zo-1)/Zo),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=a,s.method=n,jAe(t)},oDt=(t,e)=>WAe(t,e,tP,HNt,GNt,VNt),sDt=(t,e)=>{if(yI(t)||e>hpe||e<0)return t?q2(t,ug):ug;const n=t.state;if(!t.output||t.avail_in!==0&&!t.input||n.status===ST&&e!==Qh)return q2(t,t.avail_out===0?wB:ug);const r=n.last_flush;if(n.last_flush=e,n.pending!==0){if(Zf(t),t.avail_out===0)return n.last_flush=-1,Yu}else if(t.avail_in===0&&vpe(e)<=vpe(r)&&e!==Qh)return q2(t,wB);if(n.status===ST&&t.avail_in!==0)return q2(t,wB);if(n.status===jw&&n.wrap===0&&(n.status=Y2),n.status===jw){let i=tP+(n.w_bits-8<<4)<<8,a=-1;if(n.strategy>=tM||n.level<2?a=0:n.level<6?a=1:n.level===6?a=2:a=3,i|=a<<6,n.strstart!==0&&(i|=qNt),i+=31-i%31,N_(n,i),n.strstart!==0&&(N_(n,t.adler>>>16),N_(n,t.adler&65535)),t.adler=1,n.status=Y2,Zf(t),n.pending!==0)return n.last_flush=-1,Yu}if(n.status===dY){if(t.adler=0,vs(n,31),vs(n,139),vs(n,8),n.gzhead)vs(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),vs(n,n.gzhead.time&255),vs(n,n.gzhead.time>>8&255),vs(n,n.gzhead.time>>16&255),vs(n,n.gzhead.time>>24&255),vs(n,n.level===9?2:n.strategy>=tM||n.level<2?4:0),vs(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(vs(n,n.gzhead.extra.length&255),vs(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=Ru(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=HG;else if(vs(n,0),vs(n,0),vs(n,0),vs(n,0),vs(n,0),vs(n,n.level===9?2:n.strategy>=tM||n.level<2?4:0),vs(n,JNt),n.status=Y2,Zf(t),n.pending!==0)return n.last_flush=-1,Yu}if(n.status===HG){if(n.gzhead.extra){let i=n.pending,a=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+a>n.pending_buf_size;){let s=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(t.adler=Ru(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=s,Zf(t),n.pending!==0)return n.last_flush=-1,Yu;i=0,a-=s}let o=new Uint8Array(n.gzhead.extra);n.pending_buf.set(o.subarray(n.gzindex,n.gzindex+a),n.pending),n.pending+=a,n.gzhead.hcrc&&n.pending>i&&(t.adler=Ru(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=GG}if(n.status===GG){if(n.gzhead.name){let i=n.pending,a;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=Ru(t.adler,n.pending_buf,n.pending-i,i)),Zf(t),n.pending!==0)return n.last_flush=-1,Yu;i=0}n.gzindex<n.gzhead.name.length?a=n.gzhead.name.charCodeAt(n.gzindex++)&255:a=0,vs(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(t.adler=Ru(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=jG}if(n.status===jG){if(n.gzhead.comment){let i=n.pending,a;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=Ru(t.adler,n.pending_buf,n.pending-i,i)),Zf(t),n.pending!==0)return n.last_flush=-1,Yu;i=0}n.gzindex<n.gzhead.comment.length?a=n.gzhead.comment.charCodeAt(n.gzindex++)&255:a=0,vs(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(t.adler=Ru(t.adler,n.pending_buf,n.pending-i,i))}n.status=WG}if(n.status===WG){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Zf(t),n.pending!==0))return n.last_flush=-1,Yu;vs(n,t.adler&255),vs(n,t.adler>>8&255),t.adler=0}if(n.status=Y2,Zf(t),n.pending!==0)return n.last_flush=-1,Yu}if(t.avail_in!==0||n.lookahead!==0||e!==v1&&n.status!==ST){let i=n.level===0?HAe(n,e):n.strategy===tM?nDt(n,e):n.strategy===FNt?tDt(n,e):wT[n.level].func(n,e);if((i===jb||i===GE)&&(n.status=ST),i===Qd||i===jb)return t.avail_out===0&&(n.last_flush=-1),Yu;if(i===HE&&(e===PNt?ONt(n):e!==hpe&&($G(n,0,0,!1),e===NNt&&(z0(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Zf(t),t.avail_out===0))return n.last_flush=-1,Yu}return e!==Qh?Yu:n.wrap<=0?ppe:(n.wrap===2?(vs(n,t.adler&255),vs(n,t.adler>>8&255),vs(n,t.adler>>16&255),vs(n,t.adler>>24&255),vs(n,t.total_in&255),vs(n,t.total_in>>8&255),vs(n,t.total_in>>16&255),vs(n,t.total_in>>24&255)):(N_(n,t.adler>>>16),N_(n,t.adler&65535)),Zf(t),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Yu:ppe)},lDt=t=>{if(yI(t))return ug;const e=t.state.status;return t.state=null,e===Y2?q2(t,DNt):Yu},cDt=(t,e)=>{let n=e.length;if(yI(t))return ug;const r=t.state,i=r.wrap;if(i===2||i===1&&r.status!==jw||r.lookahead)return ug;if(i===1&&(t.adler=m5(t.adler,e,n,0)),r.wrap=0,n>=r.w_size){i===0&&(z0(r.head),r.strstart=0,r.block_start=0,r.insert=0);let c=new Uint8Array(r.w_size);c.set(e.subarray(n-r.w_size,n),0),e=c,n=r.w_size}const a=t.avail_in,o=t.next_in,s=t.input;for(t.avail_in=n,t.next_in=0,t.input=e,Ww(r);r.lookahead>=Zo;){let c=r.strstart,u=r.lookahead-(Zo-1);do r.ins_h=g1(r,r.ins_h,r.window[c+Zo-1]),r.prev[c&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=c,c++;while(--u);r.strstart=c,r.lookahead=Zo-1,Ww(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Zo-1,r.match_available=0,t.next_in=o,t.input=s,t.avail_in=a,r.wrap=i,Yu};var uDt=oDt,dDt=WAe,fDt=jAe,hDt=GAe,pDt=aDt,vDt=sDt,gDt=lDt,mDt=cDt,yDt="pako deflate (from Nodeca project)",l4={deflateInit:uDt,deflateInit2:dDt,deflateReset:fDt,deflateResetKeep:hDt,deflateSetHeader:pDt,deflate:vDt,deflateEnd:gDt,deflateSetDictionary:mDt,deflateInfo:yDt};const bDt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var xDt=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const n=e.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)bDt(n,r)&&(t[r]=n[r])}}return t},CDt=t=>{let e=0;for(let r=0,i=t.length;r<i;r++)e+=t[r].length;const n=new Uint8Array(e);for(let r=0,i=0,a=t.length;r<a;r++){let o=t[r];n.set(o,i),i+=o.length}return n},nP={assign:xDt,flattenChunks:CDt};let XAe=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{XAe=!1}const y5=new Uint8Array(256);for(let t=0;t<256;t++)y5[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;y5[254]=y5[254]=1;var SDt=t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let e,n,r,i,a,o=t.length,s=0;for(i=0;i<o;i++)n=t.charCodeAt(i),(n&64512)===55296&&i+1<o&&(r=t.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(e=new Uint8Array(s),a=0,i=0;a<s;i++)n=t.charCodeAt(i),(n&64512)===55296&&i+1<o&&(r=t.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?e[a++]=n:n<2048?(e[a++]=192|n>>>6,e[a++]=128|n&63):n<65536?(e[a++]=224|n>>>12,e[a++]=128|n>>>6&63,e[a++]=128|n&63):(e[a++]=240|n>>>18,e[a++]=128|n>>>12&63,e[a++]=128|n>>>6&63,e[a++]=128|n&63);return e};const wDt=(t,e)=>{if(e<65534&&t.subarray&&XAe)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let n="";for(let r=0;r<e;r++)n+=String.fromCharCode(t[r]);return n};var EDt=(t,e)=>{const n=e||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));let r,i;const a=new Array(n*2);for(i=0,r=0;r<n;){let o=t[r++];if(o<128){a[i++]=o;continue}let s=y5[o];if(s>4){a[i++]=65533,r+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&r<n;)o=o<<6|t[r++]&63,s--;if(s>1){a[i++]=65533;continue}o<65536?a[i++]=o:(o-=65536,a[i++]=55296|o>>10&1023,a[i++]=56320|o&1023)}return wDt(a,i)},_Dt=(t,e)=>{e=e||t.length,e>t.length&&(e=t.length);let n=e-1;for(;n>=0&&(t[n]&192)===128;)n--;return n<0||n===0?e:n+y5[t[n]]>e?n:e},b5={string2buf:SDt,buf2string:EDt,utf8border:_Dt};function TDt(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var ZAe=TDt;const KAe=Object.prototype.toString,{Z_NO_FLUSH:IDt,Z_SYNC_FLUSH:ADt,Z_FULL_FLUSH:MDt,Z_FINISH:LDt,Z_OK:gR,Z_STREAM_END:RDt,Z_DEFAULT_COMPRESSION:ODt,Z_DEFAULT_STRATEGY:PDt,Z_DEFLATED:NDt}=mI;function fY(t){this.options=nP.assign({level:ODt,method:NDt,chunkSize:16384,windowBits:15,memLevel:8,strategy:PDt},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ZAe,this.strm.avail_out=0;let n=l4.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==gR)throw new Error(Gw[n]);if(e.header&&l4.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=b5.string2buf(e.dictionary):KAe.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,n=l4.deflateSetDictionary(this.strm,r),n!==gR)throw new Error(Gw[n]);this._dict_set=!0}}fY.prototype.push=function(t,e){const n=this.strm,r=this.options.chunkSize;let i,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?LDt:IDt,typeof t=="string"?n.input=b5.string2buf(t):KAe.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(a===ADt||a===MDt)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=l4.deflate(n,a),i===RDt)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=l4.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===gR;if(n.avail_out===0){this.onData(n.output);continue}if(a>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};fY.prototype.onData=function(t){this.chunks.push(t)};fY.prototype.onEnd=function(t){t===gR&&(this.result=nP.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};const nM=16209,DDt=16191;var kDt=function(e,n){let r,i,a,o,s,c,u,d,f,h,p,v,y,g,m,b,x,S,w,_,A,P,R,N;const k=e.state;r=e.next_in,R=e.input,i=r+(e.avail_in-5),a=e.next_out,N=e.output,o=a-(n-e.avail_out),s=a+(e.avail_out-257),c=k.dmax,u=k.wsize,d=k.whave,f=k.wnext,h=k.window,p=k.hold,v=k.bits,y=k.lencode,g=k.distcode,m=(1<<k.lenbits)-1,b=(1<<k.distbits)-1;e:do{v<15&&(p+=R[r++]<<v,v+=8,p+=R[r++]<<v,v+=8),x=y[p&m];t:for(;;){if(S=x>>>24,p>>>=S,v-=S,S=x>>>16&255,S===0)N[a++]=x&65535;else if(S&16){w=x&65535,S&=15,S&&(v<S&&(p+=R[r++]<<v,v+=8),w+=p&(1<<S)-1,p>>>=S,v-=S),v<15&&(p+=R[r++]<<v,v+=8,p+=R[r++]<<v,v+=8),x=g[p&b];n:for(;;){if(S=x>>>24,p>>>=S,v-=S,S=x>>>16&255,S&16){if(_=x&65535,S&=15,v<S&&(p+=R[r++]<<v,v+=8,v<S&&(p+=R[r++]<<v,v+=8)),_+=p&(1<<S)-1,_>c){e.msg="invalid distance too far back",k.mode=nM;break e}if(p>>>=S,v-=S,S=a-o,_>S){if(S=_-S,S>d&&k.sane){e.msg="invalid distance too far back",k.mode=nM;break e}if(A=0,P=h,f===0){if(A+=u-S,S<w){w-=S;do N[a++]=h[A++];while(--S);A=a-_,P=N}}else if(f<S){if(A+=u+f-S,S-=f,S<w){w-=S;do N[a++]=h[A++];while(--S);if(A=0,f<w){S=f,w-=S;do N[a++]=h[A++];while(--S);A=a-_,P=N}}}else if(A+=f-S,S<w){w-=S;do N[a++]=h[A++];while(--S);A=a-_,P=N}for(;w>2;)N[a++]=P[A++],N[a++]=P[A++],N[a++]=P[A++],w-=3;w&&(N[a++]=P[A++],w>1&&(N[a++]=P[A++]))}else{A=a-_;do N[a++]=N[A++],N[a++]=N[A++],N[a++]=N[A++],w-=3;while(w>2);w&&(N[a++]=N[A++],w>1&&(N[a++]=N[A++]))}}else if(S&64){e.msg="invalid distance code",k.mode=nM;break e}else{x=g[(x&65535)+(p&(1<<S)-1)];continue n}break}}else if(S&64)if(S&32){k.mode=DDt;break e}else{e.msg="invalid literal/length code",k.mode=nM;break e}else{x=y[(x&65535)+(p&(1<<S)-1)];continue t}break}}while(r<i&&a<s);w=v>>3,r-=w,v-=w<<3,p&=(1<<v)-1,e.next_in=r,e.next_out=a,e.avail_in=r<i?5+(i-r):5-(r-i),e.avail_out=a<s?257+(s-a):257-(a-s),k.hold=p,k.bits=v};const kC=15,gpe=852,mpe=592,ype=0,_B=1,bpe=2,UDt=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),FDt=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),BDt=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),VDt=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),$Dt=(t,e,n,r,i,a,o,s)=>{const c=s.bits;let u=0,d=0,f=0,h=0,p=0,v=0,y=0,g=0,m=0,b=0,x,S,w,_,A,P=null,R;const N=new Uint16Array(kC+1),k=new Uint16Array(kC+1);let B=null,H,F,G;for(u=0;u<=kC;u++)N[u]=0;for(d=0;d<r;d++)N[e[n+d]]++;for(p=c,h=kC;h>=1&&N[h]===0;h--);if(p>h&&(p=h),h===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(f=1;f<h&&N[f]===0;f++);for(p<f&&(p=f),g=1,u=1;u<=kC;u++)if(g<<=1,g-=N[u],g<0)return-1;if(g>0&&(t===ype||h!==1))return-1;for(k[1]=0,u=1;u<kC;u++)k[u+1]=k[u]+N[u];for(d=0;d<r;d++)e[n+d]!==0&&(o[k[e[n+d]]++]=d);if(t===ype?(P=B=o,R=20):t===_B?(P=UDt,B=FDt,R=257):(P=BDt,B=VDt,R=0),b=0,d=0,u=f,A=a,v=p,y=0,w=-1,m=1<<p,_=m-1,t===_B&&m>gpe||t===bpe&&m>mpe)return 1;for(;;){H=u-y,o[d]+1<R?(F=0,G=o[d]):o[d]>=R?(F=B[o[d]-R],G=P[o[d]-R]):(F=32+64,G=0),x=1<<u-y,S=1<<v,f=S;do S-=x,i[A+(b>>y)+S]=H<<24|F<<16|G|0;while(S!==0);for(x=1<<u-1;b&x;)x>>=1;if(x!==0?(b&=x-1,b+=x):b=0,d++,--N[u]===0){if(u===h)break;u=e[n+o[d]]}if(u>p&&(b&_)!==w){for(y===0&&(y=p),A+=f,v=u-y,g=1<<v;v+y<h&&(g-=N[v+y],!(g<=0));)v++,g<<=1;if(m+=1<<v,t===_B&&m>gpe||t===bpe&&m>mpe)return 1;w=b&_,i[w]=p<<24|v<<16|A-a|0}}return b!==0&&(i[A+b]=u-y<<24|64<<16|0),s.bits=p,0};var c4=$Dt;const zDt=0,YAe=1,qAe=2,{Z_FINISH:xpe,Z_BLOCK:HDt,Z_TREES:rM,Z_OK:Wb,Z_STREAM_END:GDt,Z_NEED_DICT:jDt,Z_STREAM_ERROR:fp,Z_DATA_ERROR:JAe,Z_MEM_ERROR:QAe,Z_BUF_ERROR:WDt,Z_DEFLATED:Cpe}=mI,rP=16180,Spe=16181,wpe=16182,Epe=16183,_pe=16184,Tpe=16185,Ipe=16186,Ape=16187,Mpe=16188,Lpe=16189,mR=16190,Wg=16191,TB=16192,Rpe=16193,IB=16194,Ope=16195,Ppe=16196,Npe=16197,Dpe=16198,iM=16199,aM=16200,kpe=16201,Upe=16202,Fpe=16203,Bpe=16204,Vpe=16205,AB=16206,$pe=16207,zpe=16208,zl=16209,e6e=16210,t6e=16211,XDt=852,ZDt=592,KDt=15,YDt=KDt,Hpe=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function qDt(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const fx=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<rP||e.mode>t6e?1:0},n6e=t=>{if(fx(t))return fp;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=rP,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(XDt),e.distcode=e.distdyn=new Int32Array(ZDt),e.sane=1,e.back=-1,Wb},r6e=t=>{if(fx(t))return fp;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,n6e(t)},i6e=(t,e)=>{let n;if(fx(t))return fp;const r=t.state;return e<0?(n=0,e=-e):(n=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?fp:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,r6e(t))},a6e=(t,e)=>{if(!t)return fp;const n=new qDt;t.state=n,n.strm=t,n.window=null,n.mode=rP;const r=i6e(t,e);return r!==Wb&&(t.state=null),r},JDt=t=>a6e(t,YDt);let Gpe=!0,MB,LB;const QDt=t=>{if(Gpe){MB=new Int32Array(512),LB=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(c4(YAe,t.lens,0,288,MB,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;c4(qAe,t.lens,0,32,LB,0,t.work,{bits:5}),Gpe=!1}t.lencode=MB,t.lenbits=9,t.distcode=LB,t.distbits=5},o6e=(t,e,n,r)=>{let i;const a=t.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),r>=a.wsize?(a.window.set(e.subarray(n-a.wsize,n),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),a.window.set(e.subarray(n-r,n-r+i),a.wnext),r-=i,r?(a.window.set(e.subarray(n-r,n),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0},ekt=(t,e)=>{let n,r,i,a,o,s,c,u,d,f,h,p,v,y,g=0,m,b,x,S,w,_,A,P;const R=new Uint8Array(4);let N,k;const B=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(fx(t)||!t.output||!t.input&&t.avail_in!==0)return fp;n=t.state,n.mode===Wg&&(n.mode=TB),o=t.next_out,i=t.output,c=t.avail_out,a=t.next_in,r=t.input,s=t.avail_in,u=n.hold,d=n.bits,f=s,h=c,P=Wb;e:for(;;)switch(n.mode){case rP:if(n.wrap===0){n.mode=TB;break}for(;d<16;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(n.wrap&2&&u===35615){n.wbits===0&&(n.wbits=15),n.check=0,R[0]=u&255,R[1]=u>>>8&255,n.check=Ru(n.check,R,2,0),u=0,d=0,n.mode=Spe;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){t.msg="incorrect header check",n.mode=zl;break}if((u&15)!==Cpe){t.msg="unknown compression method",n.mode=zl;break}if(u>>>=4,d-=4,A=(u&15)+8,n.wbits===0&&(n.wbits=A),A>15||A>n.wbits){t.msg="invalid window size",n.mode=zl;break}n.dmax=1<<n.wbits,n.flags=0,t.adler=n.check=1,n.mode=u&512?Lpe:Wg,u=0,d=0;break;case Spe:for(;d<16;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(n.flags=u,(n.flags&255)!==Cpe){t.msg="unknown compression method",n.mode=zl;break}if(n.flags&57344){t.msg="unknown header flags set",n.mode=zl;break}n.head&&(n.head.text=u>>8&1),n.flags&512&&n.wrap&4&&(R[0]=u&255,R[1]=u>>>8&255,n.check=Ru(n.check,R,2,0)),u=0,d=0,n.mode=wpe;case wpe:for(;d<32;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}n.head&&(n.head.time=u),n.flags&512&&n.wrap&4&&(R[0]=u&255,R[1]=u>>>8&255,R[2]=u>>>16&255,R[3]=u>>>24&255,n.check=Ru(n.check,R,4,0)),u=0,d=0,n.mode=Epe;case Epe:for(;d<16;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}n.head&&(n.head.xflags=u&255,n.head.os=u>>8),n.flags&512&&n.wrap&4&&(R[0]=u&255,R[1]=u>>>8&255,n.check=Ru(n.check,R,2,0)),u=0,d=0,n.mode=_pe;case _pe:if(n.flags&1024){for(;d<16;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}n.length=u,n.head&&(n.head.extra_len=u),n.flags&512&&n.wrap&4&&(R[0]=u&255,R[1]=u>>>8&255,n.check=Ru(n.check,R,2,0)),u=0,d=0}else n.head&&(n.head.extra=null);n.mode=Tpe;case Tpe:if(n.flags&1024&&(p=n.length,p>s&&(p=s),p&&(n.head&&(A=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(a,a+p),A)),n.flags&512&&n.wrap&4&&(n.check=Ru(n.check,r,p,a)),s-=p,a+=p,n.length-=p),n.length))break e;n.length=0,n.mode=Ipe;case Ipe:if(n.flags&2048){if(s===0)break e;p=0;do A=r[a+p++],n.head&&A&&n.length<65536&&(n.head.name+=String.fromCharCode(A));while(A&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=Ru(n.check,r,p,a)),s-=p,a+=p,A)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=Ape;case Ape:if(n.flags&4096){if(s===0)break e;p=0;do A=r[a+p++],n.head&&A&&n.length<65536&&(n.head.comment+=String.fromCharCode(A));while(A&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=Ru(n.check,r,p,a)),s-=p,a+=p,A)break e}else n.head&&(n.head.comment=null);n.mode=Mpe;case Mpe:if(n.flags&512){for(;d<16;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(n.wrap&4&&u!==(n.check&65535)){t.msg="header crc mismatch",n.mode=zl;break}u=0,d=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=Wg;break;case Lpe:for(;d<32;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}t.adler=n.check=Hpe(u),u=0,d=0,n.mode=mR;case mR:if(n.havedict===0)return t.next_out=o,t.avail_out=c,t.next_in=a,t.avail_in=s,n.hold=u,n.bits=d,jDt;t.adler=n.check=1,n.mode=Wg;case Wg:if(e===HDt||e===rM)break e;case TB:if(n.last){u>>>=d&7,d-=d&7,n.mode=AB;break}for(;d<3;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}switch(n.last=u&1,u>>>=1,d-=1,u&3){case 0:n.mode=Rpe;break;case 1:if(QDt(n),n.mode=iM,e===rM){u>>>=2,d-=2;break e}break;case 2:n.mode=Ppe;break;case 3:t.msg="invalid block type",n.mode=zl}u>>>=2,d-=2;break;case Rpe:for(u>>>=d&7,d-=d&7;d<32;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if((u&65535)!==(u>>>16^65535)){t.msg="invalid stored block lengths",n.mode=zl;break}if(n.length=u&65535,u=0,d=0,n.mode=IB,e===rM)break e;case IB:n.mode=Ope;case Ope:if(p=n.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break e;i.set(r.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,n.length-=p;break}n.mode=Wg;break;case Ppe:for(;d<14;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(n.nlen=(u&31)+257,u>>>=5,d-=5,n.ndist=(u&31)+1,u>>>=5,d-=5,n.ncode=(u&15)+4,u>>>=4,d-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=zl;break}n.have=0,n.mode=Npe;case Npe:for(;n.have<n.ncode;){for(;d<3;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}n.lens[B[n.have++]]=u&7,u>>>=3,d-=3}for(;n.have<19;)n.lens[B[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,N={bits:n.lenbits},P=c4(zDt,n.lens,0,19,n.lencode,0,n.work,N),n.lenbits=N.bits,P){t.msg="invalid code lengths set",n.mode=zl;break}n.have=0,n.mode=Dpe;case Dpe:for(;n.have<n.nlen+n.ndist;){for(;g=n.lencode[u&(1<<n.lenbits)-1],m=g>>>24,b=g>>>16&255,x=g&65535,!(m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(x<16)u>>>=m,d-=m,n.lens[n.have++]=x;else{if(x===16){for(k=m+2;d<k;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(u>>>=m,d-=m,n.have===0){t.msg="invalid bit length repeat",n.mode=zl;break}A=n.lens[n.have-1],p=3+(u&3),u>>>=2,d-=2}else if(x===17){for(k=m+3;d<k;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}u>>>=m,d-=m,A=0,p=3+(u&7),u>>>=3,d-=3}else{for(k=m+7;d<k;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}u>>>=m,d-=m,A=0,p=11+(u&127),u>>>=7,d-=7}if(n.have+p>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=zl;break}for(;p--;)n.lens[n.have++]=A}}if(n.mode===zl)break;if(n.lens[256]===0){t.msg="invalid code -- missing end-of-block",n.mode=zl;break}if(n.lenbits=9,N={bits:n.lenbits},P=c4(YAe,n.lens,0,n.nlen,n.lencode,0,n.work,N),n.lenbits=N.bits,P){t.msg="invalid literal/lengths set",n.mode=zl;break}if(n.distbits=6,n.distcode=n.distdyn,N={bits:n.distbits},P=c4(qAe,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,N),n.distbits=N.bits,P){t.msg="invalid distances set",n.mode=zl;break}if(n.mode=iM,e===rM)break e;case iM:n.mode=aM;case aM:if(s>=6&&c>=258){t.next_out=o,t.avail_out=c,t.next_in=a,t.avail_in=s,n.hold=u,n.bits=d,kDt(t,h),o=t.next_out,i=t.output,c=t.avail_out,a=t.next_in,r=t.input,s=t.avail_in,u=n.hold,d=n.bits,n.mode===Wg&&(n.back=-1);break}for(n.back=0;g=n.lencode[u&(1<<n.lenbits)-1],m=g>>>24,b=g>>>16&255,x=g&65535,!(m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(b&&!(b&240)){for(S=m,w=b,_=x;g=n.lencode[_+((u&(1<<S+w)-1)>>S)],m=g>>>24,b=g>>>16&255,x=g&65535,!(S+m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}u>>>=S,d-=S,n.back+=S}if(u>>>=m,d-=m,n.back+=m,n.length=x,b===0){n.mode=Vpe;break}if(b&32){n.back=-1,n.mode=Wg;break}if(b&64){t.msg="invalid literal/length code",n.mode=zl;break}n.extra=b&15,n.mode=kpe;case kpe:if(n.extra){for(k=n.extra;d<k;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}n.length+=u&(1<<n.extra)-1,u>>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Upe;case Upe:for(;g=n.distcode[u&(1<<n.distbits)-1],m=g>>>24,b=g>>>16&255,x=g&65535,!(m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(!(b&240)){for(S=m,w=b,_=x;g=n.distcode[_+((u&(1<<S+w)-1)>>S)],m=g>>>24,b=g>>>16&255,x=g&65535,!(S+m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}u>>>=S,d-=S,n.back+=S}if(u>>>=m,d-=m,n.back+=m,b&64){t.msg="invalid distance code",n.mode=zl;break}n.offset=x,n.extra=b&15,n.mode=Fpe;case Fpe:if(n.extra){for(k=n.extra;d<k;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}n.offset+=u&(1<<n.extra)-1,u>>>=n.extra,d-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=zl;break}n.mode=Bpe;case Bpe:if(c===0)break e;if(p=h-c,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=zl;break}p>n.wnext?(p-=n.wnext,v=n.wsize-p):v=n.wnext-p,p>n.length&&(p=n.length),y=n.window}else y=i,v=o-n.offset,p=n.length;p>c&&(p=c),c-=p,n.length-=p;do i[o++]=y[v++];while(--p);n.length===0&&(n.mode=aM);break;case Vpe:if(c===0)break e;i[o++]=n.length,c--,n.mode=aM;break;case AB:if(n.wrap){for(;d<32;){if(s===0)break e;s--,u|=r[a++]<<d,d+=8}if(h-=c,t.total_out+=h,n.total+=h,n.wrap&4&&h&&(t.adler=n.check=n.flags?Ru(n.check,i,h,o-h):m5(n.check,i,h,o-h)),h=c,n.wrap&4&&(n.flags?u:Hpe(u))!==n.check){t.msg="incorrect data check",n.mode=zl;break}u=0,d=0}n.mode=$pe;case $pe:if(n.wrap&&n.flags){for(;d<32;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(n.wrap&4&&u!==(n.total&4294967295)){t.msg="incorrect length check",n.mode=zl;break}u=0,d=0}n.mode=zpe;case zpe:P=GDt;break e;case zl:P=JAe;break e;case e6e:return QAe;case t6e:default:return fp}return t.next_out=o,t.avail_out=c,t.next_in=a,t.avail_in=s,n.hold=u,n.bits=d,(n.wsize||h!==t.avail_out&&n.mode<zl&&(n.mode<AB||e!==xpe))&&o6e(t,t.output,t.next_out,h-t.avail_out),f-=t.avail_in,h-=t.avail_out,t.total_in+=f,t.total_out+=h,n.total+=h,n.wrap&4&&h&&(t.adler=n.check=n.flags?Ru(n.check,i,h,t.next_out-h):m5(n.check,i,h,t.next_out-h)),t.data_type=n.bits+(n.last?64:0)+(n.mode===Wg?128:0)+(n.mode===iM||n.mode===IB?256:0),(f===0&&h===0||e===xpe)&&P===Wb&&(P=WDt),P},tkt=t=>{if(fx(t))return fp;let e=t.state;return e.window&&(e.window=null),t.state=null,Wb},nkt=(t,e)=>{if(fx(t))return fp;const n=t.state;return n.wrap&2?(n.head=e,e.done=!1,Wb):fp},rkt=(t,e)=>{const n=e.length;let r,i,a;return fx(t)||(r=t.state,r.wrap!==0&&r.mode!==mR)?fp:r.mode===mR&&(i=1,i=m5(i,e,n,0),i!==r.check)?JAe:(a=o6e(t,e,n,n),a?(r.mode=e6e,QAe):(r.havedict=1,Wb))};var ikt=r6e,akt=i6e,okt=n6e,skt=JDt,lkt=a6e,ckt=ekt,ukt=tkt,dkt=nkt,fkt=rkt,hkt="pako inflate (from Nodeca project)",lm={inflateReset:ikt,inflateReset2:akt,inflateResetKeep:okt,inflateInit:skt,inflateInit2:lkt,inflate:ckt,inflateEnd:ukt,inflateGetHeader:dkt,inflateSetDictionary:fkt,inflateInfo:hkt};function pkt(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var vkt=pkt;const s6e=Object.prototype.toString,{Z_NO_FLUSH:gkt,Z_FINISH:mkt,Z_OK:x5,Z_STREAM_END:RB,Z_NEED_DICT:OB,Z_STREAM_ERROR:ykt,Z_DATA_ERROR:jpe,Z_MEM_ERROR:bkt}=mI;function bI(t){this.options=nP.assign({chunkSize:1024*64,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ZAe,this.strm.avail_out=0;let n=lm.inflateInit2(this.strm,e.windowBits);if(n!==x5)throw new Error(Gw[n]);if(this.header=new vkt,lm.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=b5.string2buf(e.dictionary):s6e.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=lm.inflateSetDictionary(this.strm,e.dictionary),n!==x5)))throw new Error(Gw[n])}bI.prototype.push=function(t,e){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?mkt:gkt,s6e.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),a=lm.inflate(n,o),a===OB&&i&&(a=lm.inflateSetDictionary(n,i),a===x5?a=lm.inflate(n,o):a===jpe&&(a=OB));n.avail_in>0&&a===RB&&n.state.wrap>0&&t[n.next_in]!==0;)lm.inflateReset(n),a=lm.inflate(n,o);switch(a){case ykt:case jpe:case OB:case bkt:return this.onEnd(a),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||a===RB))if(this.options.to==="string"){let c=b5.utf8border(n.output,n.next_out),u=n.next_out-c,d=b5.buf2string(n.output,c);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(c,c+u),0),this.onData(d)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(a===x5&&s===0)){if(a===RB)return a=lm.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};bI.prototype.onData=function(t){this.chunks.push(t)};bI.prototype.onEnd=function(t){t===x5&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=nP.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function hY(t,e){const n=new bI(e);if(n.push(t),n.err)throw n.msg||Gw[n.err];return n.result}function xkt(t,e){return e=e||{},e.raw=!0,hY(t,e)}var Ckt=bI,Skt=hY,wkt=xkt,Ekt=hY,_kt=mI,Tkt={Inflate:Ckt,inflate:Skt,inflateRaw:wkt,ungzip:Ekt,constants:_kt};const{Inflate:iHt,inflate:Ikt,inflateRaw:aHt,ungzip:oHt}=Tkt;var l6e=Ikt;function Akt(t){const e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n=l6e(e);return new DataView(n.buffer,n.byteOffset,n.byteLength)}const Mkt={ignoreImageData:!1};class c6e extends eP{constructor(e){super(e),this._nextIFD=0}get isMultiPage(){let e=0;for(this.decodeHeader();this._nextIFD;)if(e++,this.decodeIFD({ignoreImageData:!0},!0),e===2)return!0;if(e===1)return!1;throw em("ifdCount",e)}get pageCount(){let e=0;for(this.decodeHeader();this._nextIFD;)e++,this.decodeIFD({ignoreImageData:!0},!0);if(e>0)return e;throw em("ifdCount",e)}decode(e={}){const{pages:n}=e;Nkt(n);const r=n?Math.max(...n):1/0;e={...Mkt,...e};const i=[];this.decodeHeader();let a=0;for(;this._nextIFD;){if(n){if(n.includes(a)?i.push(this.decodeIFD(e,!0)):this.decodeIFD({ignoreImageData:!0},!0),a===r)break}else i.push(this.decodeIFD(e,!0));a++}if(a<r&&r!==1/0)throw new RangeError(`Index ${r} is out of bounds. The stack only contains ${a} images.`);return i}decodeHeader(){const e=this.readUint16();if(e===18761)this.setLittleEndian();else if(e===19789)this.setBigEndian();else throw new Error(`invalid byte order: 0x${e.toString(16)}`);if(this.readUint16()!==42)throw new Error("not a TIFF file");this._nextIFD=this.readUint32()}decodeIFD(e,n){this.seek(this._nextIFD);let r;if(n)r=new ape;else{if(!e.kind)throw new Error("kind is missing");r=new _Ae(e.kind)}const i=this.readUint16();for(let a=0;a<i;a++)this.decodeIFDEntry(r);if(!e.ignoreImageData){if(!(r instanceof ape))throw new Error("must be a tiff ifd");this.decodeImageData(r)}return this._nextIFD=this.readUint32(),r}decodeIFDEntry(e){const n=this.offset,r=this.readUint16(),i=this.readUint16(),a=this.readUint32();if(i<1||i>12){this.skip(4);return}kPt(i,a)>4&&this.seek(this.readUint32());const s=UPt(this,i,a);if(e.fields.set(r,s),r===34665||r===34853){const c=this.offset;let u="exif";r===34665?u="exif":r===34853&&(u="gps"),this._nextIFD=s,e[u]=this.decodeIFD({kind:u,ignoreImageData:!0},!1),this.offset=c}this.seek(n),this.skip(12)}decodeImageData(e){const n=e.orientation;if(n&&n!==1)throw em("orientation",n);switch(e.type){case 0:case 1:case 2:case 3:this.readStripData(e);break;default:throw em("image type",e.type)}if(this.applyPredictor(e),this.convertAlpha(e),e.type===0){const i=2**e.bitsPerSample-1;for(let a=0;a<e.data.length;a++)e.data[a]=i-e.data[a]}}readStripData(e){const n=e.width,r=e.height,i=e.bitsPerSample,a=e.sampleFormat,o=n*r*e.samplesPerPixel,s=Lkt(o,i,a),u=e.rowsPerStrip*n*e.samplesPerPixel,d=e.stripOffsets,f=e.stripByteCounts||LPt(e);let h=o,p=0;for(let v=0;v<d.length;v++){const y=new DataView(this.buffer,this.byteOffset+d[v],f[v]),g=h>u?u:h;h-=g;let m=y;switch(e.compression){case 1:break;case 5:{m=QPt(y);break}case 8:{m=Akt(y);break}case 2:throw em("Compression","CCITT Group 3");case 32773:throw em("Compression","PackBits");default:throw em("Compression",e.compression)}p=this.fillUncompressed(i,a,s,m,p,g)}e.data=s}fillUncompressed(e,n,r,i,a,o){if(e===8)return Rkt(r,i,a,o);if(e===16)return Okt(r,i,a,o,this.isLittleEndian());if(e===32&&n===3)return Pkt(r,i,a,o,this.isLittleEndian());throw em("bitDepth",e)}applyPredictor(e){const n=e.bitsPerSample;switch(e.predictor){case 1:break;case 2:{if(n===8)RPt(e.data,e.width,e.components);else if(n===16)OPt(e.data,e.width,e.components);else throw new Error(`Horizontal differencing is only supported for images with a bit depth of ${n}`);break}default:throw new Error(`invalid predictor: ${e.predictor}`)}}convertAlpha(e){if(e.alpha&&e.associatedAlpha){const{data:n,components:r,maxSampleValue:i}=e;for(let a=0;a<n.length;a+=r){const o=n[a+r-1];for(let s=0;s<r-1;s++)n[a+s]=Math.round(n[a+s]*i/o)}}}}function Lkt(t,e,n){if(e===8)return new Uint8Array(t);if(e===16)return new Uint16Array(t);if(e===32&&n===3)return new Float32Array(t);throw em("bit depth / sample format",`${e} / ${n}`)}function Rkt(t,e,n,r){for(let i=0;i<r;i++)t[n++]=e.getUint8(i);return n}function Okt(t,e,n,r,i){for(let a=0;a<r*2;a+=2)t[n++]=e.getUint16(a,i);return n}function Pkt(t,e,n,r,i){for(let a=0;a<r*4;a+=4)t[n++]=e.getFloat32(a,i);return n}function em(t,e){return new Error(`Unsupported ${t}: ${e}`)}function Nkt(t){if(t){for(const e of t)if(e<0||!Number.isInteger(e))throw new RangeError(`Index ${e} is invalid. Must be a positive integer.`)}}function PB(t,e){return new c6e(t).decode(e)}function Wpe(t){return new c6e(t).pageCount}function cd(t){return(e,...n)=>Dkt(t,e,n)}function jE(t,e){return cd(u6e(t,e).get)}const{apply:Dkt,construct:sHt,defineProperty:lHt,get:cHt,getOwnPropertyDescriptor:u6e,getPrototypeOf:pY,has:uHt,ownKeys:kkt,set:dHt,setPrototypeOf:fHt}=Reflect,{iterator:xI,species:hHt,toStringTag:Ukt,for:pHt}=Symbol,Fkt=Object,{create:vY,defineProperty:Bkt,freeze:vHt,is:gHt}=Fkt,Vkt=Array,$kt=Vkt.prototype,d6e=$kt[xI],zkt=cd(d6e),f6e=ArrayBuffer,Hkt=f6e.prototype;jE(Hkt,"byteLength");const Xpe=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:null;Xpe&&jE(Xpe.prototype,"byteLength");const h6e=pY(Uint8Array);h6e.from;const hf=h6e.prototype;hf[xI];cd(hf.keys);cd(hf.values);cd(hf.entries);cd(hf.set);cd(hf.reverse);cd(hf.fill);cd(hf.copyWithin);cd(hf.sort);cd(hf.slice);cd(hf.subarray);jE(hf,"buffer");jE(hf,"byteOffset");jE(hf,"length");jE(hf,Ukt);const Gkt=Uint8Array,p6e=Uint16Array,gY=Uint32Array,jkt=Float32Array,C5=pY([][xI]()),v6e=cd(C5.next),Wkt=cd(function*(){}().next),Xkt=pY(C5),Zkt=DataView.prototype,Kkt=cd(Zkt.getUint16),mY=WeakMap,g6e=mY.prototype,m6e=cd(g6e.get),Ykt=cd(g6e.set),y6e=new mY,qkt=vY(null,{next:{value:function(){const e=m6e(y6e,this);return v6e(e)}},[xI]:{value:function(){return this}}});function Jkt(t){if(t[xI]===d6e&&C5.next===v6e)return t;const e=vY(qkt);return Ykt(y6e,e,zkt(t)),e}const Qkt=new mY,eUt=vY(Xkt,{next:{value:function(){const e=m6e(Qkt,this);return Wkt(e)},writable:!0,configurable:!0}});for(const t of kkt(C5))t!=="next"&&Bkt(eUt,t,u6e(C5,t));const b6e=new f6e(4),tUt=new jkt(b6e),nUt=new gY(b6e),Fv=new p6e(512),Bv=new Gkt(512);for(let t=0;t<256;++t){const e=t-127;e<-24?(Fv[t]=0,Fv[t|256]=32768,Bv[t]=24,Bv[t|256]=24):e<-14?(Fv[t]=1024>>-e-14,Fv[t|256]=1024>>-e-14|32768,Bv[t]=-e-1,Bv[t|256]=-e-1):e<=15?(Fv[t]=e+15<<10,Fv[t|256]=e+15<<10|32768,Bv[t]=13,Bv[t|256]=13):e<128?(Fv[t]=31744,Fv[t|256]=64512,Bv[t]=24,Bv[t|256]=24):(Fv[t]=31744,Fv[t|256]=64512,Bv[t]=13,Bv[t|256]=13)}const yY=new gY(2048);for(let t=1;t<1024;++t){let e=t<<13,n=0;for(;!(e&8388608);)e<<=1,n-=8388608;e&=-8388609,n+=947912704,yY[t]=e|n}for(let t=1024;t<2048;++t)yY[t]=939524096+(t-1024<<13);const WE=new gY(64);for(let t=1;t<31;++t)WE[t]=t<<23;WE[31]=1199570944;WE[32]=2147483648;for(let t=33;t<63;++t)WE[t]=2147483648+(t-32<<23);WE[63]=3347054592;const x6e=new p6e(64);for(let t=1;t<64;++t)t!==32&&(x6e[t]=1024);function rUt(t){const e=t>>10;return nUt[0]=yY[x6e[e]+(t&1023)]+WE[e],tUt[0]}function C6e(t,e,...n){return rUt(Kkt(t,e,...Jkt(n)))}var lw={},iUt={get exports(){return lw},set exports(t){lw=t}};function S6e(t,e,n){const r=n&&n.debug||!1;r&&console.log("[xml-utils] getting "+e+" in "+t);const i=typeof t=="object"?t.outer:t,a=i.slice(0,i.indexOf(">")+1),o=['"',"'"];for(let s=0;s<o.length;s++){const c=o[s],u=e+"\\="+c+"([^"+c+"]*)"+c;r&&console.log("[xml-utils] pattern:",u);const f=new RegExp(u).exec(a);if(r&&console.log("[xml-utils] match:",f),f)return f[1]}}iUt.exports=S6e;lw.default=S6e;var yR={},aUt={get exports(){return yR},set exports(t){yR=t}},bR={},oUt={get exports(){return bR},set exports(t){bR=t}},xR={},sUt={get exports(){return xR},set exports(t){xR=t}};function w6e(t,e,n){const i=new RegExp(e).exec(t.slice(n));return i?n+i.index:-1}sUt.exports=w6e;xR.default=w6e;var CR={},lUt={get exports(){return CR},set exports(t){CR=t}};function E6e(t,e,n){const i=new RegExp(e).exec(t.slice(n));return i?n+i.index+i[0].length-1:-1}lUt.exports=E6e;CR.default=E6e;var SR={},cUt={get exports(){return SR},set exports(t){SR=t}};function _6e(t,e){const n=new RegExp(e,"g"),r=t.match(n);return r?r.length:0}cUt.exports=_6e;SR.default=_6e;const uUt=xR,NB=CR,Zpe=SR;function T6e(t,e,n){const r=n&&n.debug||!1,i=!(n&&typeof n.nested===!1),a=n&&n.startIndex||0;r&&console.log("[xml-utils] starting findTagByName with",e," and ",n);const o=uUt(t,`<${e}[
|
|
4469
4469
|
>/]`,a);if(r&&console.log("[xml-utils] start:",o),o===-1)return;const s=t.slice(o+e.length);let c=NB(s,"^[^<]*[ /]>",0);const u=c!==-1&&s[c-1]==="/";if(r&&console.log("[xml-utils] selfClosing:",u),u===!1)if(i){let p=0,v=1,y=0;for(;(c=NB(s,"[ /]"+e+">",p))!==-1;){const g=s.substring(p,c+1);if(v+=Zpe(g,"<"+e+`[
|
|
4470
|
-
>]`),y+=Zpe(g,"</"+e+">"),y>=v)break;p=c}}else c=NB(s,"[ /]"+e+">",0);const d=o+e.length+c+1;if(r&&console.log("[xml-utils] end:",d),d===-1)return;const f=t.slice(o,d);let h;return u?h=null:h=f.slice(f.indexOf(">")+1,f.lastIndexOf("<")),{inner:h,outer:f,start:o,end:d}}oUt.exports=T6e;bR.default=T6e;const dUt=bR;function I6e(t,e,n){const r=[],i=n&&n.debug||!1,a=n&&typeof n.nested=="boolean"?n.nested:!0;let o=n&&n.startIndex||0,s;for(;s=dUt(t,e,{debug:i,startIndex:o});)a?o=s.start+1+e.length:o=s.end,r.push(s);return i&&console.log("findTagsByName found",r.length,"tags"),r}aUt.exports=I6e;yR.default=I6e;const u4={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},Wv={};for(const t in u4)u4.hasOwnProperty(t)&&(Wv[u4[t]]=parseInt(t,10));const fUt=[Wv.BitsPerSample,Wv.ExtraSamples,Wv.SampleFormat,Wv.StripByteCounts,Wv.StripOffsets,Wv.StripRowCounts,Wv.TileByteCounts,Wv.TileOffsets,Wv.SubIFDs],DB={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},oo={};for(const t in DB)DB.hasOwnProperty(t)&&(oo[DB[t]]=parseInt(t,10));const Gf={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},hUt={Unspecified:0,Assocalpha:1,Unassalpha:2},pUt={Version:0,AddCompression:1},vUt={None:0,Deflate:1,Zstandard:2},gUt={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"};function mUt(t,e){const{width:n,height:r}=t,i=new Uint8Array(n*r*3);let a;for(let o=0,s=0;o<t.length;++o,s+=3)a=256-t[o]/e*256,i[s]=a,i[s+1]=a,i[s+2]=a;return i}function yUt(t,e){const{width:n,height:r}=t,i=new Uint8Array(n*r*3);let a;for(let o=0,s=0;o<t.length;++o,s+=3)a=t[o]/e*256,i[s]=a,i[s+1]=a,i[s+2]=a;return i}function bUt(t,e){const{width:n,height:r}=t,i=new Uint8Array(n*r*3),a=e.length/3,o=e.length/3*2;for(let s=0,c=0;s<t.length;++s,c+=3){const u=t[s];i[c]=e[u]/65536*256,i[c+1]=e[u+a]/65536*256,i[c+2]=e[u+o]/65536*256}return i}function xUt(t){const{width:e,height:n}=t,r=new Uint8Array(e*n*3);for(let i=0,a=0;i<t.length;i+=4,a+=3){const o=t[i],s=t[i+1],c=t[i+2],u=t[i+3];r[a]=255*((255-o)/256)*((255-u)/256),r[a+1]=255*((255-s)/256)*((255-u)/256),r[a+2]=255*((255-c)/256)*((255-u)/256)}return r}function CUt(t){const{width:e,height:n}=t,r=new Uint8ClampedArray(e*n*3);for(let i=0,a=0;i<t.length;i+=3,a+=3){const o=t[i],s=t[i+1],c=t[i+2];r[a]=o+1.402*(c-128),r[a+1]=o-.34414*(s-128)-.71414*(c-128),r[a+2]=o+1.772*(s-128)}return r}const SUt=.95047,wUt=1,EUt=1.08883;function _Ut(t){const{width:e,height:n}=t,r=new Uint8Array(e*n*3);for(let i=0,a=0;i<t.length;i+=3,a+=3){const o=t[i+0],s=t[i+1]<<24>>24,c=t[i+2]<<24>>24;let u=(o+16)/116,d=s/500+u,f=u-c/200,h,p,v;d=SUt*(d*d*d>.008856?d*d*d:(d-16/116)/7.787),u=wUt*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),f=EUt*(f*f*f>.008856?f*f*f:(f-16/116)/7.787),h=d*3.2406+u*-1.5372+f*-.4986,p=d*-.9689+u*1.8758+f*.0415,v=d*.0557+u*-.204+f*1.057,h=h>.0031308?1.055*h**(1/2.4)-.055:12.92*h,p=p>.0031308?1.055*p**(1/2.4)-.055:12.92*p,v=v>.0031308?1.055*v**(1/2.4)-.055:12.92*v,r[a]=Math.max(0,Math.min(1,h))*255,r[a+1]=Math.max(0,Math.min(1,p))*255,r[a+2]=Math.max(0,Math.min(1,v))*255}return r}const A6e=new Map;function K1(t,e){Array.isArray(t)||(t=[t]),t.forEach(n=>A6e.set(n,e))}async function TUt(t){const e=A6e.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);const n=await e();return new n(t)}K1([void 0,1],()=>Promise.resolve().then(()=>require("./raw-9c0f4034.js")).then(t=>t.default));K1(5,()=>Promise.resolve().then(()=>require("./lzw-f00e8c8c.js")).then(t=>t.default));K1(6,()=>{throw new Error("old style JPEG compression is not supported.")});K1(7,()=>Promise.resolve().then(()=>require("./jpeg-f3c7cefc.js")).then(t=>t.default));K1([8,32946],()=>Promise.resolve().then(()=>require("./deflate-5555774b.js")).then(t=>t.default));K1(32773,()=>Promise.resolve().then(()=>require("./packbits-58fd9c05.js")).then(t=>t.default));K1(34887,()=>Promise.resolve().then(()=>require("./lerc-18931f4b.js")).then(async t=>(await t.zstd.init(),t)).then(t=>t.default));K1(50001,()=>Promise.resolve().then(()=>require("./webimage-bc81928d.js")).then(t=>t.default));function iP(t,e,n,r=1){return new(Object.getPrototypeOf(t)).constructor(e*n*r)}function IUt(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const c=iP(s,r,i);for(let u=0;u<i;++u){const d=Math.min(Math.round(o*u),n-1);for(let f=0;f<r;++f){const h=Math.min(Math.round(a*f),e-1),p=s[d*e+h];c[u*r+f]=p}}return c})}function cw(t,e,n){return(1-n)*t+n*e}function AUt(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const c=iP(s,r,i);for(let u=0;u<i;++u){const d=o*u,f=Math.floor(d),h=Math.min(Math.ceil(d),n-1);for(let p=0;p<r;++p){const v=a*p,y=v%1,g=Math.floor(v),m=Math.min(Math.ceil(v),e-1),b=s[f*e+g],x=s[f*e+m],S=s[h*e+g],w=s[h*e+m],_=cw(cw(b,x,y),cw(S,w,y),d%1);c[u*r+p]=_}}return c})}function MUt(t,e,n,r,i,a="nearest"){switch(a.toLowerCase()){case"nearest":return IUt(t,e,n,r,i);case"bilinear":case"linear":return AUt(t,e,n,r,i);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function LUt(t,e,n,r,i,a){const o=e/r,s=n/i,c=iP(t,r,i,a);for(let u=0;u<i;++u){const d=Math.min(Math.round(s*u),n-1);for(let f=0;f<r;++f){const h=Math.min(Math.round(o*f),e-1);for(let p=0;p<a;++p){const v=t[d*e*a+h*a+p];c[u*r*a+f*a+p]=v}}}return c}function RUt(t,e,n,r,i,a){const o=e/r,s=n/i,c=iP(t,r,i,a);for(let u=0;u<i;++u){const d=s*u,f=Math.floor(d),h=Math.min(Math.ceil(d),n-1);for(let p=0;p<r;++p){const v=o*p,y=v%1,g=Math.floor(v),m=Math.min(Math.ceil(v),e-1);for(let b=0;b<a;++b){const x=t[f*e*a+g*a+b],S=t[f*e*a+m*a+b],w=t[h*e*a+g*a+b],_=t[h*e*a+m*a+b],A=cw(cw(x,S,y),cw(w,_,y),d%1);c[u*r*a+p*a+b]=A}}}return c}function OUt(t,e,n,r,i,a,o="nearest"){switch(o.toLowerCase()){case"nearest":return LUt(t,e,n,r,i,a);case"bilinear":case"linear":return RUt(t,e,n,r,i,a);default:throw new Error(`Unsupported resampling method: '${o}'`)}}function PUt(t,e,n){let r=0;for(let i=e;i<n;++i)r+=t[i];return r}function ZG(t,e,n){switch(t){case 1:if(e<=8)return new Uint8Array(n);if(e<=16)return new Uint16Array(n);if(e<=32)return new Uint32Array(n);break;case 2:if(e===8)return new Int8Array(n);if(e===16)return new Int16Array(n);if(e===32)return new Int32Array(n);break;case 3:switch(e){case 16:case 32:return new Float32Array(n);case 64:return new Float64Array(n)}break}throw Error("Unsupported data format/bitsPerSample")}function NUt(t,e){return(t===1||t===2)&&e<=32&&e%8===0?!1:!(t===3&&(e===16||e===32||e===64))}function DUt(t,e,n,r,i,a,o){const s=new DataView(t),c=n===2?o*a:o*a*r,u=n===2?1:r,d=ZG(e,i,c),f=parseInt("1".repeat(i),2);if(e===1){let h;n===1?h=r*i:h=i;let p=a*h;p&7&&(p=p+7&-8);for(let v=0;v<o;++v){const y=v*p;for(let g=0;g<a;++g){const m=y+g*u*i;for(let b=0;b<u;++b){const x=m+b*i,S=(v*a+g)*u+b,w=Math.floor(x/8),_=x%8;if(_+i<=8)d[S]=s.getUint8(w)>>8-i-_&f;else if(_+i<=16)d[S]=s.getUint16(w)>>16-i-_&f;else if(_+i<=24){const A=s.getUint16(w)<<8|s.getUint8(w+2);d[S]=A>>24-i-_&f}else d[S]=s.getUint32(w)>>32-i-_&f}}}}return d.buffer}class kUt{constructor(e,n,r,i,a,o){this.fileDirectory=e,this.geoKeys=n,this.dataView=r,this.littleEndian=i,this.tiles=a?{}:null,this.isTiled=!e.StripOffsets;const s=e.PlanarConfiguration;if(this.planarConfiguration=typeof s>"u"?1:s,this.planarConfiguration!==1&&this.planarConfiguration!==2)throw new Error("Invalid planar configuration.");this.source=o}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return typeof this.fileDirectory.SamplesPerPixel<"u"?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:typeof this.fileDirectory.RowsPerStrip<"u"?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(e){return this.isTiled||(e+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-e*this.getTileHeight()}getBytesPerPixel(){let e=0;for(let n=0;n<this.fileDirectory.BitsPerSample.length;++n)e+=this.getSampleByteSize(n);return e}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[e]/8)}getReaderForSample(e){const n=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,r=this.fileDirectory.BitsPerSample[e];switch(n){case 1:if(r<=8)return DataView.prototype.getUint8;if(r<=16)return DataView.prototype.getUint16;if(r<=32)return DataView.prototype.getUint32;break;case 2:if(r<=8)return DataView.prototype.getInt8;if(r<=16)return DataView.prototype.getInt16;if(r<=32)return DataView.prototype.getInt32;break;case 3:switch(r){case 16:return function(i,a){return C6e(this,i,a)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}break}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(e=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1}getBitsPerSample(e=0){return this.fileDirectory.BitsPerSample[e]}getArrayForSample(e,n){const r=this.getSampleFormat(e),i=this.getBitsPerSample(e);return ZG(r,i,n)}async getTileOrStrip(e,n,r,i,a){const o=Math.ceil(this.getWidth()/this.getTileWidth()),s=Math.ceil(this.getHeight()/this.getTileHeight());let c;const{tiles:u}=this;this.planarConfiguration===1?c=n*o+e:this.planarConfiguration===2&&(c=r*o*s+n*o+e);let d,f;this.isTiled?(d=this.fileDirectory.TileOffsets[c],f=this.fileDirectory.TileByteCounts[c]):(d=this.fileDirectory.StripOffsets[c],f=this.fileDirectory.StripByteCounts[c]);const h=(await this.source.fetch([{offset:d,length:f}],a))[0];let p;return u===null||!u[c]?(p=(async()=>{let v=await i.decode(this.fileDirectory,h);const y=this.getSampleFormat(),g=this.getBitsPerSample();return NUt(y,g)&&(v=DUt(v,y,this.planarConfiguration,this.getSamplesPerPixel(),g,this.getTileWidth(),this.getBlockHeight(n))),v})(),u!==null&&(u[c]=p)):p=u[c],{x:e,y:n,sample:r,data:await p}}async _readRaster(e,n,r,i,a,o,s,c,u){const d=this.getTileWidth(),f=this.getTileHeight(),h=this.getWidth(),p=this.getHeight(),v=Math.max(Math.floor(e[0]/d),0),y=Math.min(Math.ceil(e[2]/d),Math.ceil(h/d)),g=Math.max(Math.floor(e[1]/f),0),m=Math.min(Math.ceil(e[3]/f),Math.ceil(p/f)),b=e[2]-e[0];let x=this.getBytesPerPixel();const S=[],w=[];for(let P=0;P<n.length;++P)this.planarConfiguration===1?S.push(PUt(this.fileDirectory.BitsPerSample,0,n[P])/8):S.push(0),w.push(this.getReaderForSample(n[P]));const _=[],{littleEndian:A}=this;for(let P=g;P<m;++P)for(let R=v;R<y;++R){let N;this.planarConfiguration===1&&(N=this.getTileOrStrip(R,P,0,a,u));for(let k=0;k<n.length;++k){const B=k,H=n[k];this.planarConfiguration===2&&(x=this.getSampleByteSize(H),N=this.getTileOrStrip(R,P,H,a,u));const F=N.then(G=>{const V=G.data,z=new DataView(V),j=this.getBlockHeight(G.y),Y=G.y*f,W=G.x*d,Z=Y+j,ie=(G.x+1)*d,se=w[B],q=Math.min(j,j-(Z-e[3]),p-Y),te=Math.min(d,d-(ie-e[2]),h-W);for(let oe=Math.max(0,e[1]-Y);oe<q;++oe)for(let Q=Math.max(0,e[0]-W);Q<te;++Q){const ae=(oe*d+Q)*x,ge=se.call(z,ae+S[B],A);let pe;i?(pe=(oe+Y-e[1])*b*n.length+(Q+W-e[0])*n.length+B,r[pe]=ge):(pe=(oe+Y-e[1])*b+Q+W-e[0],r[B][pe]=ge)}});_.push(F)}}if(await Promise.all(_),o&&e[2]-e[0]!==o||s&&e[3]-e[1]!==s){let P;return i?P=OUt(r,e[2]-e[0],e[3]-e[1],o,s,n.length,c):P=MUt(r,e[2]-e[0],e[3]-e[1],o,s,c),P.width=o,P.height=s,P}return r.width=o||e[2]-e[0],r.height=s||e[3]-e[1],r}async readRasters({window:e,samples:n=[],interleave:r,pool:i=null,width:a,height:o,resampleMethod:s,fillValue:c,signal:u}={}){const d=e||[0,0,this.getWidth(),this.getHeight()];if(d[0]>d[2]||d[1]>d[3])throw new Error("Invalid subsets");const f=d[2]-d[0],h=d[3]-d[1],p=f*h,v=this.getSamplesPerPixel();if(!n||!n.length)for(let b=0;b<v;++b)n.push(b);else for(let b=0;b<n.length;++b)if(n[b]>=v)return Promise.reject(new RangeError(`Invalid sample index '${n[b]}'.`));let y;if(r){const b=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,x=Math.max.apply(null,this.fileDirectory.BitsPerSample);y=ZG(b,x,p*n.length),c&&y.fill(c)}else{y=[];for(let b=0;b<n.length;++b){const x=this.getArrayForSample(n[b],p);Array.isArray(c)&&b<c.length?x.fill(c[b]):c&&!Array.isArray(c)&&x.fill(c),y.push(x)}}const g=i||await TUt(this.fileDirectory);return await this._readRaster(d,n,y,r,g,a,o,s,u)}async readRGB({window:e,interleave:n=!0,pool:r=null,width:i,height:a,resampleMethod:o,enableAlpha:s=!1,signal:c}={}){const u=e||[0,0,this.getWidth(),this.getHeight()];if(u[0]>u[2]||u[1]>u[3])throw new Error("Invalid subsets");const d=this.fileDirectory.PhotometricInterpretation;if(d===Gf.RGB){let m=[0,1,2];if(this.fileDirectory.ExtraSamples!==hUt.Unspecified&&s){m=[];for(let b=0;b<this.fileDirectory.BitsPerSample.length;b+=1)m.push(b)}return this.readRasters({window:e,interleave:n,samples:m,pool:r,width:i,height:a,resampleMethod:o,signal:c})}let f;switch(d){case Gf.WhiteIsZero:case Gf.BlackIsZero:case Gf.Palette:f=[0];break;case Gf.CMYK:f=[0,1,2,3];break;case Gf.YCbCr:case Gf.CIELab:f=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const h={window:u,interleave:!0,samples:f,pool:r,width:i,height:a,resampleMethod:o,signal:c},{fileDirectory:p}=this,v=await this.readRasters(h),y=2**this.fileDirectory.BitsPerSample[0];let g;switch(d){case Gf.WhiteIsZero:g=mUt(v,y);break;case Gf.BlackIsZero:g=yUt(v,y);break;case Gf.Palette:g=bUt(v,p.ColorMap);break;case Gf.CMYK:g=xUt(v);break;case Gf.YCbCr:g=CUt(v);break;case Gf.CIELab:g=_Ut(v);break;default:throw new Error("Unsupported photometric interpretation.")}if(!n){const m=new Uint8Array(g.length/3),b=new Uint8Array(g.length/3),x=new Uint8Array(g.length/3);for(let S=0,w=0;S<g.length;S+=3,++w)m[w]=g[S],b[w]=g[S+1],x[w]=g[S+2];g=[m,b,x]}return g.width=v.width,g.height=v.height,g}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let n=0;n<this.fileDirectory.ModelTiepoint.length;n+=6)e.push({i:this.fileDirectory.ModelTiepoint[n],j:this.fileDirectory.ModelTiepoint[n+1],k:this.fileDirectory.ModelTiepoint[n+2],x:this.fileDirectory.ModelTiepoint[n+3],y:this.fileDirectory.ModelTiepoint[n+4],z:this.fileDirectory.ModelTiepoint[n+5]});return e}getGDALMetadata(e=null){const n={};if(!this.fileDirectory.GDAL_METADATA)return null;const r=this.fileDirectory.GDAL_METADATA;let i=yR(r,"Item");e===null?i=i.filter(a=>lw(a,"sample")===void 0):i=i.filter(a=>Number(lw(a,"sample"))===e);for(let a=0;a<i.length;++a){const o=i[a];n[lw(o,"name")]=o.inner}return n}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const e=this.fileDirectory.GDAL_NODATA;return Number(e.substring(0,e.length-1))}getOrigin(){const e=this.fileDirectory.ModelTiepoint,n=this.fileDirectory.ModelTransformation;if(e&&e.length===6)return[e[3],e[4],e[5]];if(n)return[n[3],n[7],n[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const n=this.fileDirectory.ModelPixelScale,r=this.fileDirectory.ModelTransformation;if(n)return[n[0],-n[1],n[2]];if(r)return r[1]===0&&r[4]===0?[r[0],-r[5],r[10]]:[Math.sqrt(r[0]*r[0]+r[4]*r[4]),-Math.sqrt(r[1]*r[1]+r[5]*r[5]),r[10]];if(e){const[i,a,o]=e.getResolution();return[i*e.getWidth()/this.getWidth(),a*e.getHeight()/this.getHeight(),o*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return this.geoKeys.GTRasterTypeGeoKey===1}getBoundingBox(e=!1){const n=this.getHeight(),r=this.getWidth();if(this.fileDirectory.ModelTransformation&&!e){const[i,a,o,s,c,u,d,f]=this.fileDirectory.ModelTransformation,p=[[0,0],[0,n],[r,0],[r,n]].map(([g,m])=>[s+i*g+a*m,f+c*g+u*m]),v=p.map(g=>g[0]),y=p.map(g=>g[1]);return[Math.min(...v),Math.min(...y),Math.max(...v),Math.max(...y)]}else{const i=this.getOrigin(),a=this.getResolution(),o=i[0],s=i[1],c=o+a[0]*r,u=s+a[1]*n;return[Math.min(o,c),Math.min(s,u),Math.max(o,c),Math.max(s,u)]}}}const UUt=kUt;class FUt{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,n){const r=this.getUint32(e,n),i=this.getUint32(e+4,n);let a;if(n){if(a=r+2**32*i,!Number.isSafeInteger(a))throw new Error(`${a} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return a}if(a=2**32*r+i,!Number.isSafeInteger(a))throw new Error(`${a} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return a}getInt64(e,n){let r=0;const i=(this._dataView.getUint8(e+(n?7:0))&128)>0;let a=!0;for(let o=0;o<8;o++){let s=this._dataView.getUint8(e+(n?o:7-o));i&&(a?s!==0&&(s=~(s-1)&255,a=!1):s=~s&255),r+=s*256**o}return i&&(r=-r),r}getUint8(e,n){return this._dataView.getUint8(e,n)}getInt8(e,n){return this._dataView.getInt8(e,n)}getUint16(e,n){return this._dataView.getUint16(e,n)}getInt16(e,n){return this._dataView.getInt16(e,n)}getUint32(e,n){return this._dataView.getUint32(e,n)}getInt32(e,n){return this._dataView.getInt32(e,n)}getFloat16(e,n){return C6e(this._dataView,e,n)}getFloat32(e,n){return this._dataView.getFloat32(e,n)}getFloat64(e,n){return this._dataView.getFloat64(e,n)}}class BUt{constructor(e,n,r,i){this._dataView=new DataView(e),this._sliceOffset=n,this._littleEndian=r,this._bigTiff=i}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,n){return this.sliceOffset<=e&&this.sliceTop>=e+n}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const n=this.readUint32(e),r=this.readUint32(e+4);let i;if(this._littleEndian){if(i=n+2**32*r,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}if(i=2**32*n+r,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}readInt64(e){let n=0;const r=(this._dataView.getUint8(e+(this._littleEndian?7:0))&128)>0;let i=!0;for(let a=0;a<8;a++){let o=this._dataView.getUint8(e+(this._littleEndian?a:7-a));r&&(i?o!==0&&(o=~(o-1)&255,i=!1):o=~o&255),n+=o*256**a}return r&&(n=-n),n}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}class VUt{async fetch(e,n=void 0){return Promise.all(e.map(r=>this.fetchSlice(r,n)))}async fetchSlice(e){throw new Error(`fetching of slice ${e} not possible, not implemented`)}get fileSize(){return null}async close(){}}class bY extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,bY),this.name="AbortError"}}class $Ut extends VUt{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,n){if(n&&n.aborted)throw new bY("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function zUt(t){return new $Ut(t)}function KG(t){switch(t){case oo.BYTE:case oo.ASCII:case oo.SBYTE:case oo.UNDEFINED:return 1;case oo.SHORT:case oo.SSHORT:return 2;case oo.LONG:case oo.SLONG:case oo.FLOAT:case oo.IFD:return 4;case oo.RATIONAL:case oo.SRATIONAL:case oo.DOUBLE:case oo.LONG8:case oo.SLONG8:case oo.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function HUt(t){const e=t.GeoKeyDirectory;if(!e)return null;const n={};for(let r=4;r<=e[3]*4;r+=4){const i=gUt[e[r]],a=e[r+1]?u4[e[r+1]]:null,o=e[r+2],s=e[r+3];let c=null;if(!a)c=s;else{if(c=t[a],typeof c>"u"||c===null)throw new Error(`Could not get value of geoKey '${i}'.`);typeof c=="string"?c=c.substring(s,s+o-1):c.subarray&&(c=c.subarray(s,s+o),o===1&&(c=c[0]))}n[i]=c}return n}function UC(t,e,n,r){let i=null,a=null;const o=KG(e);switch(e){case oo.BYTE:case oo.ASCII:case oo.UNDEFINED:i=new Uint8Array(n),a=t.readUint8;break;case oo.SBYTE:i=new Int8Array(n),a=t.readInt8;break;case oo.SHORT:i=new Uint16Array(n),a=t.readUint16;break;case oo.SSHORT:i=new Int16Array(n),a=t.readInt16;break;case oo.LONG:case oo.IFD:i=new Uint32Array(n),a=t.readUint32;break;case oo.SLONG:i=new Int32Array(n),a=t.readInt32;break;case oo.LONG8:case oo.IFD8:i=new Array(n),a=t.readUint64;break;case oo.SLONG8:i=new Array(n),a=t.readInt64;break;case oo.RATIONAL:i=new Uint32Array(n*2),a=t.readUint32;break;case oo.SRATIONAL:i=new Int32Array(n*2),a=t.readInt32;break;case oo.FLOAT:i=new Float32Array(n),a=t.readFloat32;break;case oo.DOUBLE:i=new Float64Array(n),a=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===oo.RATIONAL||e===oo.SRATIONAL)for(let s=0;s<n;s+=2)i[s]=a.call(t,r+s*o),i[s+1]=a.call(t,r+(s*o+4));else for(let s=0;s<n;++s)i[s]=a.call(t,r+s*o);return e===oo.ASCII?new TextDecoder("utf-8").decode(i):i}class GUt{constructor(e,n,r){this.fileDirectory=e,this.geoKeyDirectory=n,this.nextIFDByteOffset=r}}class oM extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class jUt{async readRasters(e={}){const{window:n,width:r,height:i}=e;let{resX:a,resY:o,bbox:s}=e;const c=await this.getImage();let u=c;const d=await this.getImageCount(),f=c.getBoundingBox();if(n&&s)throw new Error('Both "bbox" and "window" passed.');if(r||i){if(n){const[v,y]=c.getOrigin(),[g,m]=c.getResolution();s=[v+n[0]*g,y+n[1]*m,v+n[2]*g,y+n[3]*m]}const p=s||f;if(r){if(a)throw new Error("Both width and resX passed");a=(p[2]-p[0])/r}if(i){if(o)throw new Error("Both width and resY passed");o=(p[3]-p[1])/i}}if(a||o){const p=[];for(let v=0;v<d;++v){const y=await this.getImage(v),{SubfileType:g,NewSubfileType:m}=y.fileDirectory;(v===0||g===2||m&1)&&p.push(y)}p.sort((v,y)=>v.getWidth()-y.getWidth());for(let v=0;v<p.length;++v){const y=p[v],g=(f[2]-f[0])/y.getWidth(),m=(f[3]-f[1])/y.getHeight();if(u=y,a&&a>g||o&&o>m)break}}let h=n;if(s){const[p,v]=c.getOrigin(),[y,g]=u.getResolution(c);h=[Math.round((s[0]-p)/y),Math.round((s[1]-v)/g),Math.round((s[2]-p)/y),Math.round((s[3]-v)/g)],h=[Math.min(h[0],h[2]),Math.min(h[1],h[3]),Math.max(h[0],h[2]),Math.max(h[1],h[3])]}return u.readRasters({...e,window:h})}}class xY extends jUt{constructor(e,n,r,i,a={}){super(),this.source=e,this.littleEndian=n,this.bigTiff=r,this.firstIFDOffset=i,this.cache=a.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,n){const r=this.bigTiff?4048:1024;return new BUt((await this.source.fetch([{offset:e,length:typeof n<"u"?n:r}]))[0],e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const n=this.bigTiff?20:12,r=this.bigTiff?8:2;let i=await this.getSlice(e);const a=this.bigTiff?i.readUint64(e):i.readUint16(e),o=a*n+(this.bigTiff?16:6);i.covers(e,o)||(i=await this.getSlice(e,o));const s={};let c=e+(this.bigTiff?8:2);for(let f=0;f<a;c+=n,++f){const h=i.readUint16(c),p=i.readUint16(c+2),v=this.bigTiff?i.readUint64(c+4):i.readUint32(c+4);let y,g;const m=KG(p),b=c+(this.bigTiff?12:8);if(m*v<=(this.bigTiff?8:4))y=UC(i,p,v,b);else{const x=i.readOffset(b),S=KG(p)*v;if(i.covers(x,S))y=UC(i,p,v,x);else{const w=await this.getSlice(x,S);y=UC(w,p,v,x)}}v===1&&fUt.indexOf(h)===-1&&!(p===oo.RATIONAL||p===oo.SRATIONAL)?g=y[0]:g=y,s[u4[h]]=g}const u=HUt(s),d=i.readOffset(e+r+n*a);return new GUt(s,u,d)}async requestIFD(e){if(this.ifdRequests[e])return this.ifdRequests[e];if(e===0)return this.ifdRequests[e]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[e];if(!this.ifdRequests[e-1])try{this.ifdRequests[e-1]=this.requestIFD(e-1)}catch(n){throw n instanceof oM?new oM(e):n}return this.ifdRequests[e]=(async()=>{const n=await this.ifdRequests[e-1];if(n.nextIFDByteOffset===0)throw new oM(e);return this.parseFileDirectoryAt(n.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const n=await this.requestIFD(e);return new UUt(n.fileDirectory,n.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let e=0,n=!0;for(;n;)try{await this.requestIFD(e),++e}catch(r){if(r instanceof oM)n=!1;else throw r}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const n="GDAL_STRUCTURAL_METADATA_SIZE=",r=n.length+100;let i=await this.getSlice(e,r);if(n===UC(i,oo.ASCII,n.length,e)){const o=UC(i,oo.ASCII,r,e).split(`
|
|
4470
|
+
>]`),y+=Zpe(g,"</"+e+">"),y>=v)break;p=c}}else c=NB(s,"[ /]"+e+">",0);const d=o+e.length+c+1;if(r&&console.log("[xml-utils] end:",d),d===-1)return;const f=t.slice(o,d);let h;return u?h=null:h=f.slice(f.indexOf(">")+1,f.lastIndexOf("<")),{inner:h,outer:f,start:o,end:d}}oUt.exports=T6e;bR.default=T6e;const dUt=bR;function I6e(t,e,n){const r=[],i=n&&n.debug||!1,a=n&&typeof n.nested=="boolean"?n.nested:!0;let o=n&&n.startIndex||0,s;for(;s=dUt(t,e,{debug:i,startIndex:o});)a?o=s.start+1+e.length:o=s.end,r.push(s);return i&&console.log("findTagsByName found",r.length,"tags"),r}aUt.exports=I6e;yR.default=I6e;const u4={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},Wv={};for(const t in u4)u4.hasOwnProperty(t)&&(Wv[u4[t]]=parseInt(t,10));const fUt=[Wv.BitsPerSample,Wv.ExtraSamples,Wv.SampleFormat,Wv.StripByteCounts,Wv.StripOffsets,Wv.StripRowCounts,Wv.TileByteCounts,Wv.TileOffsets,Wv.SubIFDs],DB={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},oo={};for(const t in DB)DB.hasOwnProperty(t)&&(oo[DB[t]]=parseInt(t,10));const Gf={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},hUt={Unspecified:0,Assocalpha:1,Unassalpha:2},pUt={Version:0,AddCompression:1},vUt={None:0,Deflate:1,Zstandard:2},gUt={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"};function mUt(t,e){const{width:n,height:r}=t,i=new Uint8Array(n*r*3);let a;for(let o=0,s=0;o<t.length;++o,s+=3)a=256-t[o]/e*256,i[s]=a,i[s+1]=a,i[s+2]=a;return i}function yUt(t,e){const{width:n,height:r}=t,i=new Uint8Array(n*r*3);let a;for(let o=0,s=0;o<t.length;++o,s+=3)a=t[o]/e*256,i[s]=a,i[s+1]=a,i[s+2]=a;return i}function bUt(t,e){const{width:n,height:r}=t,i=new Uint8Array(n*r*3),a=e.length/3,o=e.length/3*2;for(let s=0,c=0;s<t.length;++s,c+=3){const u=t[s];i[c]=e[u]/65536*256,i[c+1]=e[u+a]/65536*256,i[c+2]=e[u+o]/65536*256}return i}function xUt(t){const{width:e,height:n}=t,r=new Uint8Array(e*n*3);for(let i=0,a=0;i<t.length;i+=4,a+=3){const o=t[i],s=t[i+1],c=t[i+2],u=t[i+3];r[a]=255*((255-o)/256)*((255-u)/256),r[a+1]=255*((255-s)/256)*((255-u)/256),r[a+2]=255*((255-c)/256)*((255-u)/256)}return r}function CUt(t){const{width:e,height:n}=t,r=new Uint8ClampedArray(e*n*3);for(let i=0,a=0;i<t.length;i+=3,a+=3){const o=t[i],s=t[i+1],c=t[i+2];r[a]=o+1.402*(c-128),r[a+1]=o-.34414*(s-128)-.71414*(c-128),r[a+2]=o+1.772*(s-128)}return r}const SUt=.95047,wUt=1,EUt=1.08883;function _Ut(t){const{width:e,height:n}=t,r=new Uint8Array(e*n*3);for(let i=0,a=0;i<t.length;i+=3,a+=3){const o=t[i+0],s=t[i+1]<<24>>24,c=t[i+2]<<24>>24;let u=(o+16)/116,d=s/500+u,f=u-c/200,h,p,v;d=SUt*(d*d*d>.008856?d*d*d:(d-16/116)/7.787),u=wUt*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),f=EUt*(f*f*f>.008856?f*f*f:(f-16/116)/7.787),h=d*3.2406+u*-1.5372+f*-.4986,p=d*-.9689+u*1.8758+f*.0415,v=d*.0557+u*-.204+f*1.057,h=h>.0031308?1.055*h**(1/2.4)-.055:12.92*h,p=p>.0031308?1.055*p**(1/2.4)-.055:12.92*p,v=v>.0031308?1.055*v**(1/2.4)-.055:12.92*v,r[a]=Math.max(0,Math.min(1,h))*255,r[a+1]=Math.max(0,Math.min(1,p))*255,r[a+2]=Math.max(0,Math.min(1,v))*255}return r}const A6e=new Map;function K1(t,e){Array.isArray(t)||(t=[t]),t.forEach(n=>A6e.set(n,e))}async function TUt(t){const e=A6e.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);const n=await e();return new n(t)}K1([void 0,1],()=>Promise.resolve().then(()=>require("./raw-9c0f4034.js")).then(t=>t.default));K1(5,()=>Promise.resolve().then(()=>require("./lzw-f00e8c8c.js")).then(t=>t.default));K1(6,()=>{throw new Error("old style JPEG compression is not supported.")});K1(7,()=>Promise.resolve().then(()=>require("./jpeg-f3c7cefc.js")).then(t=>t.default));K1([8,32946],()=>Promise.resolve().then(()=>require("./deflate-b00c3ba5.js")).then(t=>t.default));K1(32773,()=>Promise.resolve().then(()=>require("./packbits-58fd9c05.js")).then(t=>t.default));K1(34887,()=>Promise.resolve().then(()=>require("./lerc-9800b656.js")).then(async t=>(await t.zstd.init(),t)).then(t=>t.default));K1(50001,()=>Promise.resolve().then(()=>require("./webimage-bc81928d.js")).then(t=>t.default));function iP(t,e,n,r=1){return new(Object.getPrototypeOf(t)).constructor(e*n*r)}function IUt(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const c=iP(s,r,i);for(let u=0;u<i;++u){const d=Math.min(Math.round(o*u),n-1);for(let f=0;f<r;++f){const h=Math.min(Math.round(a*f),e-1),p=s[d*e+h];c[u*r+f]=p}}return c})}function cw(t,e,n){return(1-n)*t+n*e}function AUt(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const c=iP(s,r,i);for(let u=0;u<i;++u){const d=o*u,f=Math.floor(d),h=Math.min(Math.ceil(d),n-1);for(let p=0;p<r;++p){const v=a*p,y=v%1,g=Math.floor(v),m=Math.min(Math.ceil(v),e-1),b=s[f*e+g],x=s[f*e+m],S=s[h*e+g],w=s[h*e+m],_=cw(cw(b,x,y),cw(S,w,y),d%1);c[u*r+p]=_}}return c})}function MUt(t,e,n,r,i,a="nearest"){switch(a.toLowerCase()){case"nearest":return IUt(t,e,n,r,i);case"bilinear":case"linear":return AUt(t,e,n,r,i);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function LUt(t,e,n,r,i,a){const o=e/r,s=n/i,c=iP(t,r,i,a);for(let u=0;u<i;++u){const d=Math.min(Math.round(s*u),n-1);for(let f=0;f<r;++f){const h=Math.min(Math.round(o*f),e-1);for(let p=0;p<a;++p){const v=t[d*e*a+h*a+p];c[u*r*a+f*a+p]=v}}}return c}function RUt(t,e,n,r,i,a){const o=e/r,s=n/i,c=iP(t,r,i,a);for(let u=0;u<i;++u){const d=s*u,f=Math.floor(d),h=Math.min(Math.ceil(d),n-1);for(let p=0;p<r;++p){const v=o*p,y=v%1,g=Math.floor(v),m=Math.min(Math.ceil(v),e-1);for(let b=0;b<a;++b){const x=t[f*e*a+g*a+b],S=t[f*e*a+m*a+b],w=t[h*e*a+g*a+b],_=t[h*e*a+m*a+b],A=cw(cw(x,S,y),cw(w,_,y),d%1);c[u*r*a+p*a+b]=A}}}return c}function OUt(t,e,n,r,i,a,o="nearest"){switch(o.toLowerCase()){case"nearest":return LUt(t,e,n,r,i,a);case"bilinear":case"linear":return RUt(t,e,n,r,i,a);default:throw new Error(`Unsupported resampling method: '${o}'`)}}function PUt(t,e,n){let r=0;for(let i=e;i<n;++i)r+=t[i];return r}function ZG(t,e,n){switch(t){case 1:if(e<=8)return new Uint8Array(n);if(e<=16)return new Uint16Array(n);if(e<=32)return new Uint32Array(n);break;case 2:if(e===8)return new Int8Array(n);if(e===16)return new Int16Array(n);if(e===32)return new Int32Array(n);break;case 3:switch(e){case 16:case 32:return new Float32Array(n);case 64:return new Float64Array(n)}break}throw Error("Unsupported data format/bitsPerSample")}function NUt(t,e){return(t===1||t===2)&&e<=32&&e%8===0?!1:!(t===3&&(e===16||e===32||e===64))}function DUt(t,e,n,r,i,a,o){const s=new DataView(t),c=n===2?o*a:o*a*r,u=n===2?1:r,d=ZG(e,i,c),f=parseInt("1".repeat(i),2);if(e===1){let h;n===1?h=r*i:h=i;let p=a*h;p&7&&(p=p+7&-8);for(let v=0;v<o;++v){const y=v*p;for(let g=0;g<a;++g){const m=y+g*u*i;for(let b=0;b<u;++b){const x=m+b*i,S=(v*a+g)*u+b,w=Math.floor(x/8),_=x%8;if(_+i<=8)d[S]=s.getUint8(w)>>8-i-_&f;else if(_+i<=16)d[S]=s.getUint16(w)>>16-i-_&f;else if(_+i<=24){const A=s.getUint16(w)<<8|s.getUint8(w+2);d[S]=A>>24-i-_&f}else d[S]=s.getUint32(w)>>32-i-_&f}}}}return d.buffer}class kUt{constructor(e,n,r,i,a,o){this.fileDirectory=e,this.geoKeys=n,this.dataView=r,this.littleEndian=i,this.tiles=a?{}:null,this.isTiled=!e.StripOffsets;const s=e.PlanarConfiguration;if(this.planarConfiguration=typeof s>"u"?1:s,this.planarConfiguration!==1&&this.planarConfiguration!==2)throw new Error("Invalid planar configuration.");this.source=o}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return typeof this.fileDirectory.SamplesPerPixel<"u"?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:typeof this.fileDirectory.RowsPerStrip<"u"?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(e){return this.isTiled||(e+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-e*this.getTileHeight()}getBytesPerPixel(){let e=0;for(let n=0;n<this.fileDirectory.BitsPerSample.length;++n)e+=this.getSampleByteSize(n);return e}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[e]/8)}getReaderForSample(e){const n=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,r=this.fileDirectory.BitsPerSample[e];switch(n){case 1:if(r<=8)return DataView.prototype.getUint8;if(r<=16)return DataView.prototype.getUint16;if(r<=32)return DataView.prototype.getUint32;break;case 2:if(r<=8)return DataView.prototype.getInt8;if(r<=16)return DataView.prototype.getInt16;if(r<=32)return DataView.prototype.getInt32;break;case 3:switch(r){case 16:return function(i,a){return C6e(this,i,a)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}break}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(e=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1}getBitsPerSample(e=0){return this.fileDirectory.BitsPerSample[e]}getArrayForSample(e,n){const r=this.getSampleFormat(e),i=this.getBitsPerSample(e);return ZG(r,i,n)}async getTileOrStrip(e,n,r,i,a){const o=Math.ceil(this.getWidth()/this.getTileWidth()),s=Math.ceil(this.getHeight()/this.getTileHeight());let c;const{tiles:u}=this;this.planarConfiguration===1?c=n*o+e:this.planarConfiguration===2&&(c=r*o*s+n*o+e);let d,f;this.isTiled?(d=this.fileDirectory.TileOffsets[c],f=this.fileDirectory.TileByteCounts[c]):(d=this.fileDirectory.StripOffsets[c],f=this.fileDirectory.StripByteCounts[c]);const h=(await this.source.fetch([{offset:d,length:f}],a))[0];let p;return u===null||!u[c]?(p=(async()=>{let v=await i.decode(this.fileDirectory,h);const y=this.getSampleFormat(),g=this.getBitsPerSample();return NUt(y,g)&&(v=DUt(v,y,this.planarConfiguration,this.getSamplesPerPixel(),g,this.getTileWidth(),this.getBlockHeight(n))),v})(),u!==null&&(u[c]=p)):p=u[c],{x:e,y:n,sample:r,data:await p}}async _readRaster(e,n,r,i,a,o,s,c,u){const d=this.getTileWidth(),f=this.getTileHeight(),h=this.getWidth(),p=this.getHeight(),v=Math.max(Math.floor(e[0]/d),0),y=Math.min(Math.ceil(e[2]/d),Math.ceil(h/d)),g=Math.max(Math.floor(e[1]/f),0),m=Math.min(Math.ceil(e[3]/f),Math.ceil(p/f)),b=e[2]-e[0];let x=this.getBytesPerPixel();const S=[],w=[];for(let P=0;P<n.length;++P)this.planarConfiguration===1?S.push(PUt(this.fileDirectory.BitsPerSample,0,n[P])/8):S.push(0),w.push(this.getReaderForSample(n[P]));const _=[],{littleEndian:A}=this;for(let P=g;P<m;++P)for(let R=v;R<y;++R){let N;this.planarConfiguration===1&&(N=this.getTileOrStrip(R,P,0,a,u));for(let k=0;k<n.length;++k){const B=k,H=n[k];this.planarConfiguration===2&&(x=this.getSampleByteSize(H),N=this.getTileOrStrip(R,P,H,a,u));const F=N.then(G=>{const V=G.data,z=new DataView(V),j=this.getBlockHeight(G.y),Y=G.y*f,W=G.x*d,Z=Y+j,ie=(G.x+1)*d,se=w[B],q=Math.min(j,j-(Z-e[3]),p-Y),te=Math.min(d,d-(ie-e[2]),h-W);for(let oe=Math.max(0,e[1]-Y);oe<q;++oe)for(let Q=Math.max(0,e[0]-W);Q<te;++Q){const ae=(oe*d+Q)*x,ge=se.call(z,ae+S[B],A);let pe;i?(pe=(oe+Y-e[1])*b*n.length+(Q+W-e[0])*n.length+B,r[pe]=ge):(pe=(oe+Y-e[1])*b+Q+W-e[0],r[B][pe]=ge)}});_.push(F)}}if(await Promise.all(_),o&&e[2]-e[0]!==o||s&&e[3]-e[1]!==s){let P;return i?P=OUt(r,e[2]-e[0],e[3]-e[1],o,s,n.length,c):P=MUt(r,e[2]-e[0],e[3]-e[1],o,s,c),P.width=o,P.height=s,P}return r.width=o||e[2]-e[0],r.height=s||e[3]-e[1],r}async readRasters({window:e,samples:n=[],interleave:r,pool:i=null,width:a,height:o,resampleMethod:s,fillValue:c,signal:u}={}){const d=e||[0,0,this.getWidth(),this.getHeight()];if(d[0]>d[2]||d[1]>d[3])throw new Error("Invalid subsets");const f=d[2]-d[0],h=d[3]-d[1],p=f*h,v=this.getSamplesPerPixel();if(!n||!n.length)for(let b=0;b<v;++b)n.push(b);else for(let b=0;b<n.length;++b)if(n[b]>=v)return Promise.reject(new RangeError(`Invalid sample index '${n[b]}'.`));let y;if(r){const b=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,x=Math.max.apply(null,this.fileDirectory.BitsPerSample);y=ZG(b,x,p*n.length),c&&y.fill(c)}else{y=[];for(let b=0;b<n.length;++b){const x=this.getArrayForSample(n[b],p);Array.isArray(c)&&b<c.length?x.fill(c[b]):c&&!Array.isArray(c)&&x.fill(c),y.push(x)}}const g=i||await TUt(this.fileDirectory);return await this._readRaster(d,n,y,r,g,a,o,s,u)}async readRGB({window:e,interleave:n=!0,pool:r=null,width:i,height:a,resampleMethod:o,enableAlpha:s=!1,signal:c}={}){const u=e||[0,0,this.getWidth(),this.getHeight()];if(u[0]>u[2]||u[1]>u[3])throw new Error("Invalid subsets");const d=this.fileDirectory.PhotometricInterpretation;if(d===Gf.RGB){let m=[0,1,2];if(this.fileDirectory.ExtraSamples!==hUt.Unspecified&&s){m=[];for(let b=0;b<this.fileDirectory.BitsPerSample.length;b+=1)m.push(b)}return this.readRasters({window:e,interleave:n,samples:m,pool:r,width:i,height:a,resampleMethod:o,signal:c})}let f;switch(d){case Gf.WhiteIsZero:case Gf.BlackIsZero:case Gf.Palette:f=[0];break;case Gf.CMYK:f=[0,1,2,3];break;case Gf.YCbCr:case Gf.CIELab:f=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const h={window:u,interleave:!0,samples:f,pool:r,width:i,height:a,resampleMethod:o,signal:c},{fileDirectory:p}=this,v=await this.readRasters(h),y=2**this.fileDirectory.BitsPerSample[0];let g;switch(d){case Gf.WhiteIsZero:g=mUt(v,y);break;case Gf.BlackIsZero:g=yUt(v,y);break;case Gf.Palette:g=bUt(v,p.ColorMap);break;case Gf.CMYK:g=xUt(v);break;case Gf.YCbCr:g=CUt(v);break;case Gf.CIELab:g=_Ut(v);break;default:throw new Error("Unsupported photometric interpretation.")}if(!n){const m=new Uint8Array(g.length/3),b=new Uint8Array(g.length/3),x=new Uint8Array(g.length/3);for(let S=0,w=0;S<g.length;S+=3,++w)m[w]=g[S],b[w]=g[S+1],x[w]=g[S+2];g=[m,b,x]}return g.width=v.width,g.height=v.height,g}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let n=0;n<this.fileDirectory.ModelTiepoint.length;n+=6)e.push({i:this.fileDirectory.ModelTiepoint[n],j:this.fileDirectory.ModelTiepoint[n+1],k:this.fileDirectory.ModelTiepoint[n+2],x:this.fileDirectory.ModelTiepoint[n+3],y:this.fileDirectory.ModelTiepoint[n+4],z:this.fileDirectory.ModelTiepoint[n+5]});return e}getGDALMetadata(e=null){const n={};if(!this.fileDirectory.GDAL_METADATA)return null;const r=this.fileDirectory.GDAL_METADATA;let i=yR(r,"Item");e===null?i=i.filter(a=>lw(a,"sample")===void 0):i=i.filter(a=>Number(lw(a,"sample"))===e);for(let a=0;a<i.length;++a){const o=i[a];n[lw(o,"name")]=o.inner}return n}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const e=this.fileDirectory.GDAL_NODATA;return Number(e.substring(0,e.length-1))}getOrigin(){const e=this.fileDirectory.ModelTiepoint,n=this.fileDirectory.ModelTransformation;if(e&&e.length===6)return[e[3],e[4],e[5]];if(n)return[n[3],n[7],n[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const n=this.fileDirectory.ModelPixelScale,r=this.fileDirectory.ModelTransformation;if(n)return[n[0],-n[1],n[2]];if(r)return r[1]===0&&r[4]===0?[r[0],-r[5],r[10]]:[Math.sqrt(r[0]*r[0]+r[4]*r[4]),-Math.sqrt(r[1]*r[1]+r[5]*r[5]),r[10]];if(e){const[i,a,o]=e.getResolution();return[i*e.getWidth()/this.getWidth(),a*e.getHeight()/this.getHeight(),o*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return this.geoKeys.GTRasterTypeGeoKey===1}getBoundingBox(e=!1){const n=this.getHeight(),r=this.getWidth();if(this.fileDirectory.ModelTransformation&&!e){const[i,a,o,s,c,u,d,f]=this.fileDirectory.ModelTransformation,p=[[0,0],[0,n],[r,0],[r,n]].map(([g,m])=>[s+i*g+a*m,f+c*g+u*m]),v=p.map(g=>g[0]),y=p.map(g=>g[1]);return[Math.min(...v),Math.min(...y),Math.max(...v),Math.max(...y)]}else{const i=this.getOrigin(),a=this.getResolution(),o=i[0],s=i[1],c=o+a[0]*r,u=s+a[1]*n;return[Math.min(o,c),Math.min(s,u),Math.max(o,c),Math.max(s,u)]}}}const UUt=kUt;class FUt{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,n){const r=this.getUint32(e,n),i=this.getUint32(e+4,n);let a;if(n){if(a=r+2**32*i,!Number.isSafeInteger(a))throw new Error(`${a} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return a}if(a=2**32*r+i,!Number.isSafeInteger(a))throw new Error(`${a} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return a}getInt64(e,n){let r=0;const i=(this._dataView.getUint8(e+(n?7:0))&128)>0;let a=!0;for(let o=0;o<8;o++){let s=this._dataView.getUint8(e+(n?o:7-o));i&&(a?s!==0&&(s=~(s-1)&255,a=!1):s=~s&255),r+=s*256**o}return i&&(r=-r),r}getUint8(e,n){return this._dataView.getUint8(e,n)}getInt8(e,n){return this._dataView.getInt8(e,n)}getUint16(e,n){return this._dataView.getUint16(e,n)}getInt16(e,n){return this._dataView.getInt16(e,n)}getUint32(e,n){return this._dataView.getUint32(e,n)}getInt32(e,n){return this._dataView.getInt32(e,n)}getFloat16(e,n){return C6e(this._dataView,e,n)}getFloat32(e,n){return this._dataView.getFloat32(e,n)}getFloat64(e,n){return this._dataView.getFloat64(e,n)}}class BUt{constructor(e,n,r,i){this._dataView=new DataView(e),this._sliceOffset=n,this._littleEndian=r,this._bigTiff=i}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,n){return this.sliceOffset<=e&&this.sliceTop>=e+n}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const n=this.readUint32(e),r=this.readUint32(e+4);let i;if(this._littleEndian){if(i=n+2**32*r,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}if(i=2**32*n+r,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}readInt64(e){let n=0;const r=(this._dataView.getUint8(e+(this._littleEndian?7:0))&128)>0;let i=!0;for(let a=0;a<8;a++){let o=this._dataView.getUint8(e+(this._littleEndian?a:7-a));r&&(i?o!==0&&(o=~(o-1)&255,i=!1):o=~o&255),n+=o*256**a}return r&&(n=-n),n}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}class VUt{async fetch(e,n=void 0){return Promise.all(e.map(r=>this.fetchSlice(r,n)))}async fetchSlice(e){throw new Error(`fetching of slice ${e} not possible, not implemented`)}get fileSize(){return null}async close(){}}class bY extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,bY),this.name="AbortError"}}class $Ut extends VUt{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,n){if(n&&n.aborted)throw new bY("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function zUt(t){return new $Ut(t)}function KG(t){switch(t){case oo.BYTE:case oo.ASCII:case oo.SBYTE:case oo.UNDEFINED:return 1;case oo.SHORT:case oo.SSHORT:return 2;case oo.LONG:case oo.SLONG:case oo.FLOAT:case oo.IFD:return 4;case oo.RATIONAL:case oo.SRATIONAL:case oo.DOUBLE:case oo.LONG8:case oo.SLONG8:case oo.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function HUt(t){const e=t.GeoKeyDirectory;if(!e)return null;const n={};for(let r=4;r<=e[3]*4;r+=4){const i=gUt[e[r]],a=e[r+1]?u4[e[r+1]]:null,o=e[r+2],s=e[r+3];let c=null;if(!a)c=s;else{if(c=t[a],typeof c>"u"||c===null)throw new Error(`Could not get value of geoKey '${i}'.`);typeof c=="string"?c=c.substring(s,s+o-1):c.subarray&&(c=c.subarray(s,s+o),o===1&&(c=c[0]))}n[i]=c}return n}function UC(t,e,n,r){let i=null,a=null;const o=KG(e);switch(e){case oo.BYTE:case oo.ASCII:case oo.UNDEFINED:i=new Uint8Array(n),a=t.readUint8;break;case oo.SBYTE:i=new Int8Array(n),a=t.readInt8;break;case oo.SHORT:i=new Uint16Array(n),a=t.readUint16;break;case oo.SSHORT:i=new Int16Array(n),a=t.readInt16;break;case oo.LONG:case oo.IFD:i=new Uint32Array(n),a=t.readUint32;break;case oo.SLONG:i=new Int32Array(n),a=t.readInt32;break;case oo.LONG8:case oo.IFD8:i=new Array(n),a=t.readUint64;break;case oo.SLONG8:i=new Array(n),a=t.readInt64;break;case oo.RATIONAL:i=new Uint32Array(n*2),a=t.readUint32;break;case oo.SRATIONAL:i=new Int32Array(n*2),a=t.readInt32;break;case oo.FLOAT:i=new Float32Array(n),a=t.readFloat32;break;case oo.DOUBLE:i=new Float64Array(n),a=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===oo.RATIONAL||e===oo.SRATIONAL)for(let s=0;s<n;s+=2)i[s]=a.call(t,r+s*o),i[s+1]=a.call(t,r+(s*o+4));else for(let s=0;s<n;++s)i[s]=a.call(t,r+s*o);return e===oo.ASCII?new TextDecoder("utf-8").decode(i):i}class GUt{constructor(e,n,r){this.fileDirectory=e,this.geoKeyDirectory=n,this.nextIFDByteOffset=r}}class oM extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class jUt{async readRasters(e={}){const{window:n,width:r,height:i}=e;let{resX:a,resY:o,bbox:s}=e;const c=await this.getImage();let u=c;const d=await this.getImageCount(),f=c.getBoundingBox();if(n&&s)throw new Error('Both "bbox" and "window" passed.');if(r||i){if(n){const[v,y]=c.getOrigin(),[g,m]=c.getResolution();s=[v+n[0]*g,y+n[1]*m,v+n[2]*g,y+n[3]*m]}const p=s||f;if(r){if(a)throw new Error("Both width and resX passed");a=(p[2]-p[0])/r}if(i){if(o)throw new Error("Both width and resY passed");o=(p[3]-p[1])/i}}if(a||o){const p=[];for(let v=0;v<d;++v){const y=await this.getImage(v),{SubfileType:g,NewSubfileType:m}=y.fileDirectory;(v===0||g===2||m&1)&&p.push(y)}p.sort((v,y)=>v.getWidth()-y.getWidth());for(let v=0;v<p.length;++v){const y=p[v],g=(f[2]-f[0])/y.getWidth(),m=(f[3]-f[1])/y.getHeight();if(u=y,a&&a>g||o&&o>m)break}}let h=n;if(s){const[p,v]=c.getOrigin(),[y,g]=u.getResolution(c);h=[Math.round((s[0]-p)/y),Math.round((s[1]-v)/g),Math.round((s[2]-p)/y),Math.round((s[3]-v)/g)],h=[Math.min(h[0],h[2]),Math.min(h[1],h[3]),Math.max(h[0],h[2]),Math.max(h[1],h[3])]}return u.readRasters({...e,window:h})}}class xY extends jUt{constructor(e,n,r,i,a={}){super(),this.source=e,this.littleEndian=n,this.bigTiff=r,this.firstIFDOffset=i,this.cache=a.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,n){const r=this.bigTiff?4048:1024;return new BUt((await this.source.fetch([{offset:e,length:typeof n<"u"?n:r}]))[0],e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const n=this.bigTiff?20:12,r=this.bigTiff?8:2;let i=await this.getSlice(e);const a=this.bigTiff?i.readUint64(e):i.readUint16(e),o=a*n+(this.bigTiff?16:6);i.covers(e,o)||(i=await this.getSlice(e,o));const s={};let c=e+(this.bigTiff?8:2);for(let f=0;f<a;c+=n,++f){const h=i.readUint16(c),p=i.readUint16(c+2),v=this.bigTiff?i.readUint64(c+4):i.readUint32(c+4);let y,g;const m=KG(p),b=c+(this.bigTiff?12:8);if(m*v<=(this.bigTiff?8:4))y=UC(i,p,v,b);else{const x=i.readOffset(b),S=KG(p)*v;if(i.covers(x,S))y=UC(i,p,v,x);else{const w=await this.getSlice(x,S);y=UC(w,p,v,x)}}v===1&&fUt.indexOf(h)===-1&&!(p===oo.RATIONAL||p===oo.SRATIONAL)?g=y[0]:g=y,s[u4[h]]=g}const u=HUt(s),d=i.readOffset(e+r+n*a);return new GUt(s,u,d)}async requestIFD(e){if(this.ifdRequests[e])return this.ifdRequests[e];if(e===0)return this.ifdRequests[e]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[e];if(!this.ifdRequests[e-1])try{this.ifdRequests[e-1]=this.requestIFD(e-1)}catch(n){throw n instanceof oM?new oM(e):n}return this.ifdRequests[e]=(async()=>{const n=await this.ifdRequests[e-1];if(n.nextIFDByteOffset===0)throw new oM(e);return this.parseFileDirectoryAt(n.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const n=await this.requestIFD(e);return new UUt(n.fileDirectory,n.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let e=0,n=!0;for(;n;)try{await this.requestIFD(e),++e}catch(r){if(r instanceof oM)n=!1;else throw r}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const n="GDAL_STRUCTURAL_METADATA_SIZE=",r=n.length+100;let i=await this.getSlice(e,r);if(n===UC(i,oo.ASCII,n.length,e)){const o=UC(i,oo.ASCII,r,e).split(`
|
|
4471
4471
|
`)[0],s=Number(o.split("=")[1].split(" ")[0])+o.length;s>r&&(i=await this.getSlice(e,s));const c=UC(i,oo.ASCII,s,e);this.ghostValues={},c.split(`
|
|
4472
4472
|
`).filter(u=>u.length>0).map(u=>u.split("=")).forEach(([u,d])=>{this.ghostValues[u]=d})}return this.ghostValues}static async fromSource(e,n,r){const i=(await e.fetch([{offset:0,length:1024}],r))[0],a=new FUt(i),o=a.getUint16(0,0);let s;if(o===18761)s=!0;else if(o===19789)s=!1;else throw new TypeError("Invalid byte order value.");const c=a.getUint16(2,s);let u;if(c===42)u=!1;else if(c===43){if(u=!0,a.getUint16(4,s)!==8)throw new Error("Unsupported offset byte-size.")}else throw new TypeError("Invalid magic number.");const d=u?a.getUint64(8,s):a.getUint32(4,s);return new xY(e,s,u,d,n)}close(){return typeof this.source.close=="function"?this.source.close():!1}}async function Kpe(t,e){return xY.fromSource(zUt(t),e)}const WUt=({axon_check:t,fbxTreeDatas:e,setLeftMenuTabIndex:n,swcRef:r,setIsChartOpen:i,setEchartValue:a,setChartValue:o,reset:s})=>{const c=C.useRef(null),u=C.useRef(null),[d,f]=C.useState(!1),[h,p]=C.useState(""),[v,y]=C.useState(""),[g,m]=C.useState({x:0,y:0}),b=C.useRef([]),x=C.useRef([]),S=C.useRef(null),w=C.useRef(null),[_,A]=C.useState(!0),P=C.useRef("#000"),[R,N]=C.useState(["Isocortex","OLF","HPF","CTXsp","STR","PAL","IB","MB","HB","CB","VS","fiber tract"]),[k,B]=C.useState({nodes:[],links:[],categories:[]});let H=C.useRef(null),F=!1;const G=(Z,ie)=>{N(se=>[...se.filter(q=>!Z.includes(q)),...ie])};C.useEffect(()=>{N(["Isocortex","OLF","HPF","CTXsp","STR","PAL","IB","MB","HB","CB","VS","fiber tract"])},[s]);const V=(Z,ie)=>ie.map(se=>{const q=Z.find(oe=>oe.id===se.source),te=Z.find(oe=>oe.id===se.target);return{...se,lineStyle:{color:{type:"linear",x:0,y:0,x2:1,y2:0,colorStops:[{offset:0,color:te.itemStyle.color},{offset:1,color:q.itemStyle.color}]},width:1,curveness:.3}}});C.useEffect(()=>{z(R)},[R]);const z=Z=>{fetch("/app-api/d-api/connectivity",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Z})}).then(ie=>ie.json()).then(ie=>{ie.code==200?B(ie.node):Ic.error(ie.message)})};C.useEffect(()=>{u.current=$7(c.current),u.current.clear();const Z=()=>u.current.getOption().series[0].data,ie={tooltip:{formatter:Q=>{var ae,ge;return Q.dataType==="node"?`${Q.data.fullname} (${Q.data.name})<br>Downstream: ${((ae=t[Q.data.name].down)==null?void 0:ae.length)??0} projection neuron(s)<br>Upstream: projected by ${((ge=t[Q.data.name].up)==null?void 0:ge.length)??0} neuron(s)`:(Q.dataType,"")}},animationDurationUpdate:1500,animationEasingUpdate:"quinticInOut",series:[{name:"Les Miserables",type:"graph",layout:"circular",circular:{rotateLabel:!0},data:k.nodes,links:V(k.nodes,k.links),categories:k.categories,roam:!0,label:{show:!0,position:"right",formatter:"{b}",textStyle:{fontSize:20}},lineStyle:{color:"source",curveness:.3}}]};function se(Q){if(Q.event.event.preventDefault(),Q.dataType=="node"){const ae=q(Q.data.name,e);let ge=j(ae);ge&&G(ge,[ae.name])}if(Q.dataType=="edge"){const ae=Z().find(pe=>pe.id===Q.data.source),ge=Z().find(pe=>pe.id===Q.data.target);b.current=t[ae.name].soma.filter(function(pe){return t[ge.name].axon.indexOf(pe)>-1}),x.current=t[ge.name].soma.filter(function(pe){return t[ae.name].axon.indexOf(pe)>-1}),p(ae.name),y(ge.name),m({x:Q.event.event.clientX+2,y:Q.event.event.clientY}),f(!0),P.current=Q.data.lineStyle.color.colorStops[0].color}}const q=(Q,ae)=>{let ge={name:""};for(let pe=0;pe<ae.length;pe++){const he=ae[pe];if(he.children){if(he.children.some(ne=>ne.name===Q)){ge=he;break}else if(q(Q,he.children)){ge=q(Q,he.children);break}}}return ge},te=Q=>{clearTimeout(H.current),F=!0,a(Q.data.name),o(Q.data.name),i(!1)},oe=Q=>{H.current=setTimeout(()=>{if(!F){const ae=Y(Q.data.name,e);if(ae){let ge=[];"children"in ae?(ae.children.forEach(pe=>{ge.push(pe.name)}),G([Q.data.name],ge)):Ic.error("No child node")}}F=!1},300)};return u.current.setOption(ie),u.current.on("click",oe),u.current.on("dblclick",te),u.current.on("contextmenu",se),()=>{u.current.off("click",oe),u.current.off("dblclick",te),u.current.off("contextmenu",se)}},[e,k]);const j=Z=>{const ie=[],se=q=>{ie.push(q.name),q.children&&q.children.forEach(te=>se(te))};return se(Z),ie},Y=(Z,ie)=>{let se=[],q=!1,te;for(let oe=0;oe<ie.length;oe++)se.push(ie[oe]);for(;se.length>0&&!q;){let oe=se.pop();if(oe.name==Z){q=!0,te=oe;break}else if(oe.children)for(let Q=0;Q<oe.children.length;Q++)se.push(oe.children[Q])}return te},W=[{key:"1",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Z=>{n(3),r.current.setSearchValue(v),r.current.setSomaValue(h),f(!1),i(!1)}},h," →",v,": ",b.current.length," projection neruon(s)")},{key:"2",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Z=>{n(3),r.current.setSearchValue(h),r.current.setSomaValue(v),f(!1),i(!1)}},v," →",h,": ",x.current.length," projection neruon(s)")}];return C.createElement(C.Fragment,null,C.createElement("div",{style:{overflow:"hidden",position:"absolute",width:"500px",height:"200px"}},C.createElement("div",{ref:S,style:{zIndex:9,position:"absolute",backgroundColor:"#f1f1f180",borderTopRightRadius:"5px",borderTopLeftRadius:"5px",borderBottomRightRadius:"5px",transform:_?"translateY(0)":"translateY(-99%)",transition:"transform 0.3s ease-in-out",padding:"5px"}},C.createElement("p",{style:{paddingLeft:"10px",paddingRight:"10px"}},"- Mouse-over a node to see upstream and downstream neuron numbers",C.createElement("br",null),"- Left-click a node to expand its children structures",C.createElement("br",null),"- Righ-click a node to collapse to its parent structure",C.createElement("br",null),"- Double-click a node to visualize all its projections in the main window",C.createElement("br",null),"- Righ-click a line to see the projections between two connected nodes",C.createElement("br",null),"- Left-click the popup menu of the line to inquire the projection neurons"),C.createElement("a",{style:{zIndex:9,position:"absolute",bottom:"-28px",left:0,display:"flex"},onClick:()=>{A(!_)}},C.createElement("div",{style:{width:"90px",height:"28px",display:"flex",justifyContent:"center",borderBottomRightRadius:"5px",borderBottomLeftRadius:"5px",backgroundColor:"#f1f1f180"}},C.createElement("div",{style:{display:"flex",alignItems:"center",color:"#000"}},"Help ",C.createElement("div",{ref:w,style:{width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent",borderBottom:_?"10px solid #000":0,borderTop:_?0:"10px solid #000"}})))))),C.createElement(tx,{menu:{items:W},open:d,overlayStyle:{position:"absolute",left:g.x,top:g.y,width:"auto",minWidth:"auto",border:`2px solid ${P}`},overlayClassName:"pipeline_dropdown"},C.createElement("div",{ref:c,style:{width:"100%",height:"calc(100vh - 75px)"},onMouseEnter:()=>{f(!1)}})))};class XUt{constructor(e,n,r,i,a,o,s){Uf(this,"name");Uf(this,"branches");Uf(this,"indices");Uf(this,"points");Uf(this,"numSoma");Uf(this,"vao");Uf(this,"vbo");Uf(this,"ebo");Uf(this,"viewType",0);this.name=n,this.branches=[],this.indices=[],this.points=[],this.numSoma=0,this.vao=null,this.vbo=null,this.ebo=null,o&&(this.viewType=o);for(var c=null,u=e.split(`
|
|
4473
4473
|
`),d=0;d<u.length;++d)if(u[d][0]!="#"){if(u[d].length==0&&c!=null){c.count=this.indices.length-c.start,this.branches.push(c),c=null;continue}var f=u[d].trim().split(" "),h=parseInt(f[0]);if(i!=null)if(a!=null)var p=parseFloat(f[2])+parseFloat(a[0])-parseFloat(i[0]),v=parseFloat(f[3])+parseFloat(a[2])-parseFloat(i[2]),y=parseFloat(f[4])+parseFloat(a[4])-parseFloat(i[4]);else var p=parseFloat(f[2])+parseFloat(r[0])-parseFloat(i[0]),v=parseFloat(f[3])+parseFloat(r[2])-parseFloat(i[2]),y=parseFloat(f[4])+parseFloat(r[4])-parseFloat(i[4]);else if(a!=null)var p=parseFloat(f[2])+parseFloat(a[0])-parseFloat(r[0]),v=parseFloat(f[3])+parseFloat(a[2])-parseFloat(r[2]),y=parseFloat(f[4])+parseFloat(a[4])-parseFloat(r[4]);else if(o)var p=parseFloat(f[2])+parseFloat(r[0])-s[0],v=parseFloat(f[3])+parseFloat(r[2])-s[2],y=parseFloat(f[4])+parseFloat(r[4])-s[4];else var p=parseFloat(f[2]),v=parseFloat(f[3]),y=parseFloat(f[4]);var g=parseInt(f[6]);h==1?(c={start:0},this.indices.push(0),this.numSoma=1):g!=h-1||g==-1?(c.count=this.indices.length-c.start,this.branches.push(c),c={start:this.indices.length},g!=-1?this.indices.push(g-1):this.numSoma+=1,this.indices.push(this.points.length/3)):this.indices.push(this.points.length/3),this.points.push(p),this.points.push(v),this.points.push(y)}c&&(c.count=this.indices.length-c.start,this.branches.push(c))}}Sa([g5e,KIe,eIe,M4e]);const Vv=Om.TabPane,{TextArea:Ype}=jc,ZUt=`
|